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