00001 #include <stdio.h>
00002 #include <iostream>
00003 #include <fstream>
00004 #include <sstream>
00005 #include "HepMC/PythiaWrapper.h"
00006 #include "CascadeWrapper.h"
00007 #include "MyCascadeWrapper.h"
00008
00009 void readConfigFile(string configfile){
00010
00011 string line;
00012 ifstream myfile (configfile.c_str());
00013 if (myfile.is_open())
00014 {
00015
00016 while (! myfile.eof() )
00017 {
00018 string myblock;
00019 string myentry;
00020 string mystr;
00021
00022
00023 int myint1=-9999;
00024 int myint2=-9999;
00025 int myint3=-9999;
00026 int myint4=-9999;
00027 int myint5=-9999;
00028
00029 double myfl1=-9999.9;
00030 double myfl2=-9999.9;
00031 double myfl3=-9999.9;
00032 double myfl4=-9999.9;
00033 double myfl5=-9999.9;
00034
00035
00036 getline (myfile,line);
00037
00038
00039
00040 std::istringstream instring(line);
00041 std::istringstream instring2(line);
00042 std::istringstream instring3(line);
00043 std::string temp;
00044
00045
00046
00047
00048
00049 instring >> myblock >>myentry;
00050 instring2 >> temp >> myfl1 >> myfl2 >> myfl3 >> myfl4 >> myfl5;
00051 instring3 >> temp >> myint1 >> myint2 >> myint3 >> myint4 >> myint5;
00052
00053
00054 std::string::size_type pos = myblock.find("#");
00055 if(pos != std::string::npos) continue;
00056
00057 std::string::size_type pos2 = myblock.find("*");
00058 if(pos2 != std::string::npos) continue;
00059
00060 std::string::size_type pos3 = myblock.find("/");
00061 if(pos3 != std::string::npos) continue;
00062
00063 std::string::size_type pos4 = myblock.find("!");
00064 if(pos4 != std::string::npos) continue;
00065
00066 if(myblock.empty()) continue;
00067
00068
00069
00070
00071
00072
00073 if (myblock == "'PBE1'" && myfl3!=-9999.9) {
00074 cainpu.plepin=myfl3;
00075 std::cout << "'PBE1' = " << cainpu.plepin << std::endl;
00076 }
00077 else if (myblock == "'KBE1'" && myint3!=-9999) {
00078 caluco.ke=myint3;
00079 std::cout << "'KBE1' = " << caluco.ke << std::endl;
00080 }
00081 else if (myblock == "'IRE1'" && myint3!=-9999) {
00082 capar6.ires[1-1]=myint3;
00083 std::cout << "'IRE1' = " << capar6.ires[1-1] << std::endl;
00084 }
00085 else if (myblock == "'PBE2'" && myfl3!=-9999.9) {
00086 cainpu.ppin=myfl3;
00087 std::cout << "'PBE2' = " << cainpu.ppin << std::endl;
00088 }
00089 else if (myblock == "'KBE2'" && myint3!=-9999) {
00090 caluco.kp=myint3;
00091 std::cout << "'KBE2' = " << caluco.kp << std::endl;
00092 }
00093 else if (myblock == "'IRE2'" && myint3!=-9999) {
00094 capar6.ires[2-1]=myint3;
00095 std::cout << "'IRE2' = " << capar6.ires[2-1] << std::endl;
00096 }
00097 else if (myblock == "'QMIN'" && myfl3!=-9999.9) {
00098 values.qmi=myfl3;
00099 std::cout << "'QMIN' = " << values.qmi << std::endl;
00100 }
00101 else if (myblock == "'QMAX'" && myfl3!=-9999.9) {
00102 values.qma=myfl3;
00103 std::cout << "'QMAX' = " << values.qma << std::endl;
00104 }
00105 else if (myblock == "'YMIN'" && myfl3!=-9999.9) {
00106 values.ymi=myfl3;
00107 std::cout << "'YMIN' = " << values.ymi << std::endl;
00108 }
00109 else if (myblock == "'YMAX'" && myfl3!=-9999.9) {
00110 values.yma=myfl3;
00111 std::cout << "'YMAX' = " << values.yma << std::endl;
00112 }
00113 else if (myblock == "'THEI'" && myfl3!=-9999.9) {
00114 caelec.themi=myfl3;
00115 std::cout << "'THEI' = " << caelec.themi << std::endl;
00116 }
00117 else if (myblock == "'THEM'" && myfl3!=-9999.9) {
00118 caelec.thema=myfl3;
00119 std::cout << "'THEM' = " << caelec.thema << std::endl;
00120 }
00121 else if (myblock == "'NFLA'" && myint3!=-9999) {
00122 caluco.nflav=myint3;
00123 std::cout << "'NFLA' = " << caluco.nflav << std::endl;
00124 }
00125 else if (myblock == "'MULT'" && myint3!=-9999) {
00126 camult.mult=myint3;
00127 std::cout << "'MULT' = " << camult.mult << std::endl;
00128 }
00129 else if (myblock == "'IPRO'" && myint3!=-9999) {
00130 capar1.ipro=myint3;
00131 std::cout << "'IPRO' = " << capar1.ipro << std::endl;
00132 }
00133 else if (myblock == "'IHFL'" && myint3!=-9999) {
00134 cahflav.ihfla=myint3;
00135 std::cout << "'IHFL' = " << cahflav.ihfla << std::endl;
00136 }
00137 else if (myblock == "'PTCU'" && myfl3!=-9999.9) {
00138 captcut.pt2cut[1-1]=myfl3;
00139 std::cout << "'PTCU' = " << captcut.pt2cut[1-1] << std::endl;
00140 }
00141 else if (myblock == "'NFRA'" && myint3!=-9999) {
00142 cainpu.nfrag=myint3;
00143 std::cout << "'NFRA' = " << cainpu.nfrag << std::endl;
00144 }
00145 else if (myblock == "'IFPS'" && myint3!=-9999) {
00146 cainpu.ifps=myint3;
00147 std::cout << "'IFPS' = " << cainpu.ifps << std::endl;
00148 }
00149 else if (myblock == "'ITIM'" && myint3!=-9999) {
00150 casshwr.itimshr=myint3;
00151 std::cout << "'ITIM' = " << casshwr.itimshr << std::endl;
00152 }
00153 else if (myblock == "'ICCF'" && myint3!=-9999) {
00154 casshwr.iccfm=myint3;
00155 std::cout << "'ICCF' = " << casshwr.iccfm << std::endl;
00156 }
00157 else if (myblock == "'IRAM'" && myint3!=-9999) {
00158 capar1.irunaem=myint3;
00159 std::cout << "'IRAM' = " << capar1.irunaem << std::endl;
00160 }
00161 else if (myblock == "'IRAS'" && myint3!=-9999) {
00162 capar1.iruna=myint3;
00163 std::cout << "'IRAS' = " << capar1.iruna << std::endl;
00164 }
00165 else if (myblock == "'IQ2S'" && myint3!=-9999) {
00166 capar1.iq2=myint3;
00167 std::cout << "'IQ2S' = " << capar1.iq2 << std::endl;
00168 }
00169 else if (myblock == "'SCAL'" && myfl3!=-9999) {
00170 scalf.scalfa=myfl3;
00171 std::cout << "'SCAL' = " << scalf.scalfa << std::endl;
00172 }
00173 else if (myblock == "'IGLU'" && myint3!=-9999) {
00174 cagluon.iglu=myint3;
00175 std::cout << "'IGLU' = " << cagluon.iglu << std::endl;
00176 }
00177 else if (myblock == "'NCAL'" && myint3!=-9999) {
00178 integr.ncb=myint3;
00179 std::cout << "'NCAL' = " << integr.ncb << std::endl;
00180 }
00181 else if (myblock == "'ACC1'" && myfl3!=-9999.9) {
00182 integr.acc1=myfl3;
00183 std::cout << "'ACC1' = " << integr.acc1 << std::endl;
00184 }
00185 else if (myblock == "'ACC2'" && myfl3!=-9999.9) {
00186 integr.acc2=myfl3;
00187 std::cout << "'ACC2' = " << integr.acc2 << std::endl;
00188 }
00189 else if (myblock == "'INTE'" && myint3!=-9999) {
00190 cainpu.inter=myint3;
00191 std::cout << "'INTE' = " << cainpu.inter << std::endl;
00192 }
00193
00194 else if (myblock == "'KT1'" && myfl3!=-9999.9) {
00195 casprkt.prkt1=myfl3;
00196 std::cout << "'KT1' = " << casprkt.prkt1 << std::endl;
00197 }
00198
00199 else if (myblock == "'KT2'" && myfl3!=-9999.9) {
00200 casprkt.prkt2=myfl3;
00201 std::cout << "'KT2' = " << casprkt.prkt2 << std::endl;
00202 }
00203
00204 else if (myblock == "'KTRE'" && myfl3!=-9999.9) {
00205 casprkt.prktrem=myfl3;
00206 std::cout << "'KTRE' = " << casprkt.prktrem << std::endl;
00207 }
00208 else if (myblock == "'ILHA'" && myint3!=-9999) {
00209 caherup.ilha=myint3;
00210 std::cout << "'ILHA' = " << caherup.ilha << std::endl;
00211 }
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224 else if (myblock == "'PMAS'" && myint1!=-9999 && myint2!=-9999 && myfl3!=-9999.9) {
00225 pydat2.pmas[myint2-1][myint1-1]=myfl3;
00226 std::cout << "PMAS = pydat2.pmas[" << myint2<<"-1]["<< myint1 << "-1]=" << pydat2.pmas[myint2-1][myint1-1] << std::endl;
00227 }
00228 else if(myblock == "'PARU'" && myint1!=-9999 && myfl3!=-9999.9) {
00229 std::cout<<"here"<<std::endl;
00230 pydat1.paru[myint1-1]=myfl3;
00231 std::cout << "PARU = pydat1.paru[" << myint1<<"-1]=" << pydat1.paru[myint1-1] << std::endl;
00232 }
00233 if((myblock == "'MSTU'") && (myint1!=-9999) && (myint3!=-9999)){
00234 pydat1.mstu[myint1-1]=myint3;
00235 std::cout << "MSTU = pydat1.mstu[" << myint1<<"-1]=" << pydat1.mstu[myint1-1] << std::endl;
00236 }
00237 else if((myblock == "'MSTJ'") && (myint1!=-9999) && (myint3!=-9999)){
00238 pydat1.mstj[myint1-1]=myint3;
00239 std::cout << "MSTJ = pydat1.mstj[" << myint1<<"-1]=" << pydat1.mstj[myint1-1] << std::endl;
00240 }
00241 else {
00242 std::cout << "cascade: available list: CAELEC, CAHERUP, CAHFLAV, CAINPU, CALUCO, CAMULT, CAPAR1, CAPAR6, CAPTCUT, CASPRKT, CASSHWR, INTEGR, VALUES, ... you have specified " << myblock << std::endl ;
00243 }
00244 }
00245 myfile.close();
00246 }
00247 else cout << "Unable to open file";
00248
00249 };
00250