00001 #include <stdio.h>
00002 #include <iostream>
00003 #include <fstream>
00004 #include <sstream>
00005 #include "HepMC/PythiaWrapper.h"
00006 #include "MyPythia6Wrapper.h"
00007
00008 void readConfigFile(string configfile){
00009 string line;
00010 ifstream myfile (configfile.c_str());
00011 if (myfile.is_open())
00012 {
00013
00014 while (! myfile.eof() )
00015 {
00016 string myblock;
00017 string myentry;
00018 string mystr;
00019
00020
00021 int myint1=-9999;
00022 int myint2=-9999;
00023 int myint3=-9999;
00024 int myint4=-9999;
00025 int myint5=-9999;
00026
00027 double myfl0=-9999.9;
00028 double myfl1=-9999.9;
00029 double myfl2=-9999.9;
00030 double myfl3=-9999.9;
00031 double myfl4=-9999.9;
00032
00033
00034 getline (myfile,line);
00035
00036
00037
00038 std::istringstream instring(line);
00039 std::istringstream instring2(line);
00040 std::istringstream instring3(line);
00041 std::string temp;
00042
00043
00044 instring >> myblock >> myentry >> mystr;
00045 instring2 >> temp >> temp >> myfl0 >> myfl1 >> myfl2 >> myfl3 >> myfl4;
00046 instring3 >> temp >> temp >> myint1 >> myint2 >> myint3 >> myint4 >> myint5;
00047
00048
00049 std::string::size_type pos = myblock.find("#");
00050 if(pos != std::string::npos) continue;
00051
00052 std::string::size_type pos2 = myblock.find("*");
00053 if(pos2 != std::string::npos) continue;
00054
00055 std::string::size_type pos3 = myblock.find("/");
00056 if(pos3 != std::string::npos) continue;
00057
00058 if(myblock.empty()) continue;
00059
00060
00061
00062
00063
00064
00065
00066 if (myblock == "pysubs") {
00067 if((myentry == "msel") && (myint1!=-9999)){
00068 pysubs.msel=myint1;
00069 std::cout << "pysubs.msel=" << pysubs.msel << std::endl;
00070 }
00071 else if ((myentry == "msub") && (myint1!=-9999) && (myint2!=-9999)){
00072 pysubs.msub[myint1-1]=myint2;
00073 std::cout << "pysubs.msub["<<myint1<<"-1]=" << pysubs.msub[myint1-1] << std::endl;
00074 }
00075 else if ((myentry == "ckin") && (myint1!=-9999) && (myfl1!=-9999.9)){
00076 pysubs.ckin[myint1-1]=myfl1;
00077 std::cout << "pysubs.ckin["<<myint1<<"-1]=" << pysubs.ckin[myint1-1] << std::endl;
00078 }
00079 else if ((myentry == "kfin") && (myint1!=-9999) && (myint2!=-9999) && (myint3!=-9999)){
00080 pysubs.kfin[myint2-1][myint1-1]=myint3;
00081 std::cout << "pysubs.kfin[" << myint2<<"-1]["<<myint1<<"-1]=" << pysubs.kfin[myint2-1][myint1-1] << std::endl;
00082 }
00083 else {
00084 std::cout << "pythia6: block PYSUBS has MSEL, MSUB, KFIN AND CKIN: YOU HAVE SPECIFIED "<< myentry <<std::endl;
00085 }
00086 }
00087 else if (myblock == "pypars"){
00088 if((myentry == "mstp") && (myint1!=-9999) && (myint2!=-9999)){
00089 pypars.mstp[myint1-1]=myint2;
00090 std::cout << "pypars.mstp[" << myint1<<"-1]=" << pypars.mstp[myint1-1] << std::endl;
00091 }
00092 else if((myentry == "msti") && (myint1!=-9999) && (myint2!=-9999)){
00093 pypars.msti[myint1-1]=myint2;
00094 std::cout << "pypars.msti[" << myint1<<"-1]=" << pypars.msti[myint1-1] << std::endl;
00095 }
00096 else if((myentry == "parp") && (myint1!=-9999) && (myfl1!=-9999.9)){
00097 pypars.parp[myint1-1]=myfl1;
00098 std::cout << "pypars.parp[" << myint1<<"-1]=" << pypars.parp[myint1-1] << std::endl;
00099 }
00100 else if((myentry == "pari") && (myint1!=-9999) && (myfl1!=-9999.9)){
00101 pypars.pari[myint1-1]=myfl1;
00102 std::cout << "pypars.parp[" << myint1<<"-1]=" << pypars.pari[myint1-1] << std::endl;
00103 }
00104 else {
00105 std::cout << "pythia6: block PYPARS has MSTP,PARP, MSTI AND PARI: YOU HAVE SPECIFIED "<< myentry <<std::endl;
00106 }
00107 }
00108 else if (myblock == "pydat1"){
00109 if((myentry == "mstu") && (myint1!=-9999) && (myint2!=-9999)){
00110 pydat1.mstu[myint1-1]=myint2;
00111 std::cout << "pydat1.mstu[" << myint1<<"-1]=" << pydat1.mstu[myint1-1] << std::endl;
00112 }
00113 else if((myentry == "mstj") && (myint1!=-9999) && (myint2!=-9999)){
00114 pydat1.mstj[myint1]=myint2;
00115 std::cout << "pydat1.mstj[" << myint1<<"-1]=" << pydat1.mstj[myint1] << std::endl;
00116 }
00117 else if((myentry == "paru") && (myint1!=-9999) && (myfl1!=-9999.9)){
00118 pydat1.paru[myint1-1]=myfl1;
00119 std::cout << "pydat1.paru[" << myint1<<"-1]=" << pydat1.paru[myint1-1] << std::endl;
00120 }
00121 else if((myentry == "parj") && (myint1!=-9999) && (myfl1!=-9999.9)){
00122 pydat1.parj[myint1-1]=myfl1;
00123 std::cout << "pydat1.parj[" << myint1<<"-1]=" << pydat1.parj[myint1-1] << std::endl;
00124 }
00125 else {
00126 std::cout << "pythia6: block PYDAT1 HAS MSTU, MSTJ, PARU AND PARJ: YOU HAVE SPECIFIED "<< myentry << std::endl;
00127 }
00128 }
00129 else if (myblock == "pydat2"){
00130 if((myentry == "kchg") && (myint1!=-9999) && (myint2!=-9999) && (myint3!=-9999)){
00131 pydat2.kchg[myint2-1][myint1-1]=myint3;
00132 std::cout << "pydat2.kchg[" << myint2<<"-1]["<< myint1 << "-1]=" << pydat2.kchg[myint2-1][myint1-1] << std::endl;
00133 }
00134 else if((myentry == "pmas") && (myint1!=-9999) && (myint2!=-9999) && (myfl2!=-9999.9)){
00135 pydat2.pmas[myint2-1][myint1-1]=myfl2;
00136 std::cout << "pydat2.pmas[" << myint2<<"-1]["<< myint1 << "-1]=" << pydat2.pmas[myint2-1][myint1-1] << std::endl;
00137 }
00138 else if((myentry == "parf") && (myint1!=-9999) && (myfl1!=-9999.9)){
00139 pydat2.parf[myint1-1]=myfl1;
00140 std::cout << "pydat2.parf[" << myint1<<"-1]=" << pydat2.parf[myint1-1] << std::endl;
00141 }
00142 else if((myentry == "vckm") && (myint1!=-9999) && (myint2!=-9999) && (myfl2!=-9999.9)){
00143 pydat2.vckm[myint2-1][myint1-1]=myfl2;
00144 std::cout << "pydat2.vckm[" << myint2<<"-1]["<< myint1 << "-1]=" << pydat2.vckm[myint2-1][myint1-1] << std::endl;
00145 }
00146 else {
00147 std::cout << "pythia6: block PYDAT2 HAS KCHG, PMAS, PARF AND VCKM: YOU HAVE SPECIFIED "<< myentry << std::endl;
00148 }
00149 }
00150 else if (myblock == "pydat3"){
00151 if((myentry == "mdcy") && (myint1!=-9999) && (myint2!=-9999) && (myint3!=-9999)){
00152 pydat3.mdcy[myint2-1][myint1-1]=myint3;
00153 std::cout << "pydat2.mdcy[" << myint2<<"-1]["<< myint1 << "-1]=" << pydat3.mdcy[myint2-1][myint1-1] << std::endl;
00154 }
00155 else if((myentry == "mdme") && (myint1!=-9999) && (myint2!=-9999) && (myint3!=-9999)){
00156 pydat3.mdme[myint2-1][myint1-1]=myint3;
00157 std::cout << "pydat3.mdme[" << myint2<<"-1]["<< myint1 << "-1]=" << pydat3.mdme[myint2-1][myint1-1] << std::endl;
00158 }
00159 else if((myentry == "brat") && (myint1!=-9999) && (myfl1!=-9999.9)){
00160 pydat3.brat[myint1-1]=myfl1;
00161 std::cout << "pydat2.brat[" << myint1<<"-1]=" << pydat3.brat[myint1-1] << std::endl;
00162 }
00163 else if((myentry == "kfdp") && (myint1!=-9999) && (myint2!=-9999) && (myint3!=-9999)){
00164 pydat3.kfdp[myint2-1][myint1-1]=myint3;
00165 std::cout << "pydat2.kfdp[" << myint2<<"-1]["<< myint1 << "-1]=" << pydat3.kfdp[myint2-1][myint1-1] << std::endl;
00166 }
00167 else {
00168 std::cout << "pythia6: block PYDAT3 HAS KFDP, MDCY, BRAT AND MDME : YOU HAVE SPECIFIED "<< myentry << std::endl ;
00169 }
00170 }
00171 else if (myblock == "pydatr"){
00172 if((myentry == "mrpy") && (myint1!=-9999) && (myint2!=-9999)){
00173 pydatr.mrpy[myint1-1]=myint2;
00174 std::cout << "pydatr.mrpy[" << myint1<<"-1]=" << pydatr.mrpy[myint1-1] << std::endl;
00175 }
00176 else if((myentry == "rrpy") && (myint1!=-9999) && (myfl1!=-9999.9)){
00177 pydatr.rrpy[myint1-1]=myfl1;
00178 std::cout << "pydatr.rrpy[" << myint1<<"-1]=" << pydatr.rrpy[myint1-1] << std::endl;
00179 }
00180 else {
00181 std::cout << "pythia6: block PYDATR HAS MRPY AND RRPY : YOU HAVE SPECIFIED "<< myentry << std::endl;
00182 }
00183 }
00184 else if (myblock == "pyint2"){
00185 if ((myentry == "iset") && (myint1!=-9999) && (myint2!=-9999)){
00186 pyint2.iset[myint1-1]=myint2;
00187 std::cout << "pyint2.iset[" << myint1<<"-1]=" << pyint2.iset[myint1-1] << std::endl;
00188 }
00189 else if ((myentry == "kfpr") && (myint1!=-9999) && (myint2!=-9999) && (myint3!=-9999)){
00190 pyint2.kfpr[myint2-1][myint1-1]=myint3;
00191 std::cout << "pyint2.kfpr[" << myint2<<"-1][" << myint1<< "-1]=" << pyint2.kfpr[myint2-1][myint1-1] << std::endl;
00192 }
00193 else if ((myentry == "coef") && (myint1!=-9999) && (myint2!=-9999) && (myfl2!=-9999.9)){
00194 pyint2.coef[myint2-1][myint1-1]=myfl2;
00195 std::cout << "pyint2.coef[" << myint2<<"-1][" << myint1<< "-1]=" << pyint2.coef[myint2-1][myint1-1] << std::endl;
00196 }
00197 else if ((myentry == "icol") && (myint1!=-9999) && (myint2!=-9999) && (myint3!=-9999) && (myint4!=-9999)){
00198 pyint2.icol[myint3-1][myint2-1][myint1-1]=myint4;
00199 std::cout << "pyint2.icol[" << myint3<<"-1][" << myint2<< "-1]["<< myint1<< "-1]=" << pyint2.icol[myint3-1][myint2-1][myint1-1] << std::endl;
00200 }
00201 else {
00202 std::cout << "pythia6: block PYINT2 has ISET KFPR COEF AND ICOL: YOU HAVE SPECIFIED "<< myentry << std::endl;
00203 }
00204 }
00205 else if (myblock == "select"){
00206 if ((myentry == "pytune") && (myint1!=-9999)){
00207 pytune( &myint1 );
00208 std::cout << "pytune("<< myint1<< ")" << std::endl;
00209 }
00210 else {
00211 std::cout << "pythia6: block SELECT has PYTUNE: YOU HAVE SPECIFIED "<< myentry << std::endl;
00212 }
00213 }
00214
00215 else
00216 std::cout << "pythia6: available list: PYSUBS, PYPARS, PYDAT1, PYDAT2, PYDAT3, PYDATR ... you have specified " << myblock << std::endl ;
00217
00218 }
00219 myfile.close();
00220 }
00221 else cout << "Unable to open file";
00222
00223 };
00224