Changeset 380 in svn
- Timestamp:
- May 12, 2009, 9:47:12 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CHANGELOG
r373 r380 6 6 - E_cut for n/gamma reconstruction 7 7 - time resolution also for RP220,RP420 8 - Distinction between forward detectors with (TRootForwardTagger) /without (TRootRomanPot) time measurement8 - new : PDG tables for particles 9 9 10 10 -
trunk/Delphes.cpp
r372 r380 213 213 //Smearing information 214 214 RESOLution *DET = new RESOLution(); 215 215 216 cout <<"** **"<< endl; 216 217 cout <<"** ####### Start reading DETECTOR parameters ####### **"<< endl; … … 224 225 << right << setw(2) <<"**"<<""<<endl; 225 226 cout <<"** **"<< endl; 227 DET->ReadParticleDataGroupTable(); 228 //DET->PDGtable.print(); 226 229 227 230 //Trigger information … … 260 263 cout <<"** StdHEP file format detected **"<<endl; 261 264 cout <<"** This can take several minutes **"<< endl; 262 STDHEPConverter converter(inputFileList,outputfilename );//case ntpl file in input list265 STDHEPConverter converter(inputFileList,outputfilename,DET->PDGtable);//case ntpl file in input list 263 266 } 264 267 else if(line.length() == 1+line.find_last_of(".lhe")) … … 266 269 cout <<"** LHEF file format detected **"<<endl; 267 270 cout <<"** This can take several minutes **"<< endl; 268 LHEFConverter converter(inputFileList,outputfilename );//case ntpl file in input list271 LHEFConverter converter(inputFileList,outputfilename,DET->PDGtable);//case ntpl file in input list 269 272 } 270 273 else if(line.length() == 1+line.find_last_of(".root")) … … 272 275 cout <<"** h2root file format detected **"<<endl; 273 276 cout <<"** This can take several minutes **"<< endl; 274 HEPEVTConverter converter(inputFileList,outputfilename );//case ntpl file in input list277 HEPEVTConverter converter(inputFileList,outputfilename,DET->PDGtable);//case ntpl file in input list 275 278 } 276 279 else if(line.length() == 1+line.find_last_of(".hepmc")) … … 278 281 cout <<"** HepMC ASCII file format detected **"<<endl; 279 282 cout <<"** This can take several minutes **"<< endl; 280 HepMCConverter converter(inputFileList,outputfilename );283 HepMCConverter converter(inputFileList,outputfilename,DET->PDGtable); 281 284 } 282 285 else { … … 309 312 ExRootTreeBranch *branchZDC = treeWriter->NewBranch("ZDChits", TRootZdcHits::Class()); 310 313 ExRootTreeBranch *branchRP220 = treeWriter->NewBranch("RP220hits", TRootRomanPotHits::Class()); 311 ExRootTreeBranch *branchFP420 = treeWriter->NewBranch("FP420hits", TRootForwardTaggerHits::Class()); 314 //ExRootTreeBranch *branchFP420 = treeWriter->NewBranch("FP420hits", TRootForwardTaggerHits::Class()); 315 ExRootTreeBranch *branchFP420 = treeWriter->NewBranch("FP420hits", TRootRomanPotHits::Class()); 312 316 313 317 TRootETmis *elementEtmis; … … 397 401 { 398 402 TRootGenParticle *particle = new TRootGenParticle(particleG); 403 PdgParticle pdg_part = DET->PDGtable[particle->PID]; 404 particle->Charge = pdg_part.charge(); 405 particle->M = pdg_part.mass(); 406 //particle->Charge=ChargeVal(particle->PID); 407 particle->setFractions(); // init 399 408 int pid = abs(particle->PID); 400 particle->Charge=ChargeVal(particle->PID);401 particle->setFractions(); // init402 409 403 410 -
trunk/Examples/Convertors_Only.cpp
r266 r380 45 45 #include "DataConverter.h" 46 46 #include "HEPEVTConverter.h" 47 #include "HepMCConverter.h" 47 48 #include "LHEFConverter.h" 48 49 #include "STDHEPConverter.h" … … 60 61 61 62 using namespace std; 62 63 //------------------------------------------------------------------------------64 void todo(string filename) {65 ifstream infile(filename.c_str());66 cout << "** TODO list ..." << endl;67 while(infile.good()) {68 string temp;69 getline(infile,temp);70 cout << "*" << temp << endl;71 }72 cout << "** done...\n";73 }74 63 75 64 //------------------------------------------------------------------------------ … … 88 77 delete [] appOpt; 89 78 90 if(argc != 3) {91 cout << " Usage: " << argv[0] << " input_file output_file " << endl;79 if(argc != 4) { 80 cout << " Usage: " << argv[0] << " input_file output_file PDG_Table" << endl; 92 81 cout << " input_list - list of files in Ntpl, StdHep of LHEF format," << endl; 93 cout << " output_file - output file." << endl; 82 cout << " output_file - output file," << endl; 83 cout << " PDG_Table - file with PDG particle table" << endl; 94 84 exit(1); 95 85 } … … 160 150 161 151 //read the output TROOT file 162 string inputFileList(argv[1]), outputfilename(argv[2]) ;152 string inputFileList(argv[1]), outputfilename(argv[2]), pdgtablefilename(argv[3]); 163 153 if(outputfilename.find(".root") > outputfilename.length()) { 164 154 cout <<"** ERROR: 'output_file' should be a .root file. Exiting... **"<< endl; 165 155 exit(1); 166 156 } 167 157 158 RESOLution DET; 159 DET.PdgTableFilename = pdgtablefilename; 160 DET.ReadParticleDataGroupTable(); // DET.PDGtable.print(); 161 168 162 TFile *outputFile = TFile::Open(outputfilename.c_str(), "RECREATE"); // Creates the file, but should be closed just after 169 163 outputFile->Close(); … … 174 168 175 169 // data converters 176 DataConverter *converter=NULL;177 170 cout <<"** **"<<endl; 178 171 cout <<"** ####### Start convertion to TRoot format ######## **"<< endl; 179 172 180 if( strstr(line.c_str(),".hep"))181 { 173 if(line.length() == 1+line.find_last_of(".hep")) 174 { 182 175 cout <<"** StdHEP file format detected **"<<endl; 183 176 cout <<"** This can take several minutes **"<< endl; 184 converter = new STDHEPConverter(inputFileList,outputfilename);//case ntpl file in input list185 } 186 else if( strstr(line.c_str(),".lhe"))177 STDHEPConverter converter(inputFileList,outputfilename,DET.PDGtable);//case ntpl file in input list 178 } 179 else if(line.length() == 1+line.find_last_of(".lhe")) 187 180 { 188 181 cout <<"** LHEF file format detected **"<<endl; 189 182 cout <<"** This can take several minutes **"<< endl; 190 converter = new LHEFConverter(inputFileList,outputfilename);//case ntpl file in input list191 } 192 else if( strstr(line.c_str(),".root"))183 LHEFConverter converter(inputFileList,outputfilename,DET.PDGtable);//case ntpl file in input list 184 } 185 else if(line.length() == 1+line.find_last_of(".root")) 193 186 { 194 187 cout <<"** h2root file format detected **"<<endl; 195 188 cout <<"** This can take several minutes **"<< endl; 196 converter = new HEPEVTConverter(inputFileList,outputfilename);//case ntpl file in input list 189 HEPEVTConverter converter(inputFileList,outputfilename,DET.PDGtable);//case ntpl file in input list 190 } 191 else if(line.length() == 1+line.find_last_of(".hepmc")) 192 { 193 cout <<"** HepMC ASCII file format detected **"<<endl; 194 cout <<"** This can take several minutes **"<< endl; 195 HepMCConverter converter(inputFileList,outputfilename,DET.PDGtable); 197 196 } 198 197 else { 199 cerr << left << setw(4) <<"** "<<"" 200 << left << setw(63) << line.c_str() <<"" 201 << right << setw(2) <<"**"<<endl; 202 cerr <<"** ERROR: File format not identified -- Exiting... **"<< endl; 203 cout <<"** **"<< endl; 204 cout <<"*********************************************************************"<< endl; 205 return -1;}; 198 cerr << left << setw(4) <<"** "<<"" 199 << left << setw(63) << line.c_str() <<"" 200 << right << setw(2) <<"**"<<endl; 201 cerr <<"** ERROR: File format not identified -- Exiting... **"<< endl; 202 cout <<"** **"<< endl; 203 cout <<"*********************************************************************"<< endl; 204 return -1;}; 205 206 206 cout <<"** Exiting conversion... **"<< endl; 207 207 cout <<"*********************************************************************"<< endl; … … 209 209 210 210 211 delete converter;212 211 213 212 } -
trunk/data/DetectorCard.dat
r374 r380 120 120 NEvents_Frog 100 121 121 122 # input PDG tables 123 PdgTableFilename data/particle.tbl // table with particle pid,mass,charge,... 124 -
trunk/data/DetectorCard_ATLAS.dat
r374 r380 120 120 NEvents_Frog 100 121 121 122 # input PDG tables 123 PdgTableFilename data/particle.tbl // table with particle pid,mass,charge,... 124 -
trunk/data/DetectorCard_CMS.dat
r374 r380 121 121 NEvents_Frog 100 122 122 123 # input PDG tables 124 PdgTableFilename data/particle.tbl // table with particle pid,mass,charge,... 125 -
trunk/interface/DataConverter.h
r357 r380 38 38 #include <string> 39 39 40 #include "PdgParticle.h" 40 41 #include "Utilities/ExRootAnalysis/interface/ExRootTreeBranch.h" 41 42 #include "Utilities/ExRootAnalysis/interface/LHEF.h" … … 48 49 49 50 DataConverter() : Nevt(-1) {}; 50 DataConverter(const int &N) : Nevt(N) {};51 DataConverter(const PdgTable& table, const int &N) : Nevt(N), pdg_table(table) {}; 51 52 virtual ~DataConverter() {}; 52 53 53 54 private: 54 55 int Nevt; // number of events to read; -1 means "all of them" 56 57 public: 58 PdgTable pdg_table; // table of particles from PDG 55 59 }; 56 60 -
trunk/interface/HEPEVTConverter.h
r357 r380 88 88 public: 89 89 90 HEPEVTConverter(const string& inputFileList, const string& outputFileName, const int& Nevents=-1);90 HEPEVTConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents=-1); 91 91 92 92 }; -
trunk/interface/HepMCConverter.h
r368 r380 46 46 class HepMCConverter : public DataConverter { 47 47 public: 48 HepMCConverter(const string& inputFileList, const string& outputFileName, const int& Nevents=-1);48 HepMCConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents=-1); 49 49 virtual ~HepMCConverter(); 50 50 -
trunk/interface/LHEFConverter.h
r357 r380 49 49 public: 50 50 51 LHEFConverter(const string& inputFileList, const string& outputFileName, const int& Nevents=-1);51 LHEFConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents=-1); 52 52 virtual ~LHEFConverter(); 53 53 -
trunk/interface/STDHEPConverter.h
r357 r380 41 41 class STDHEPConverter : public DataConverter { 42 42 public: 43 STDHEPConverter(const string& inputFileList, const string& outputFileName, const int& Nevents=-1);43 STDHEPConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents=-1); 44 44 virtual ~STDHEPConverter(); 45 45 -
trunk/interface/SmearUtil.h
r374 r380 45 45 #include "TSimpleArray.h" 46 46 #include "PhysicsTower.hh" 47 #include "PdgParticle.h" 47 48 48 49 using namespace std; … … 213 214 214 215 int NEvents_Frog; 215 float PT_QUARKS_MIN; // minimal pt needed for quarks to reach the tracker, in GeV 216 float PT_QUARKS_MIN; // minimal pt needed for quarks to reach the tracker, in GeV 217 218 string PdgTableFilename; 219 //map<int,PdgParticle> PdgTable; 220 PdgTable PDGtable; 216 221 217 222 // to sort a vector … … 221 226 /// Reads the data card for the initialisation of the parameters 222 227 void ReadDataCard(const string datacard); 228 229 /// Reads the PDG table 230 void ReadParticleDataGroupTable(); 223 231 224 232 /// Create the output log file -
trunk/src/BFieldProp.cc
r294 r380 31 31 32 32 #include "BFieldProp.h" 33 #include "PdgParticle.h" 33 34 #include "SystemOfUnits.h" 34 35 #include "PhysicalConstants.h" … … 131 132 if (!DET->FLAG_bfield ) return; 132 133 133 q = ChargeVal(Part->PID) *eplus; // in units of 'e' 134 double M; 135 //int q1 = ChargeVal(Part->PID) *eplus; // in units of 'e' 136 if(Part->M < -999) { // unitialised! 137 PdgParticle pdg_part = DET->PDGtable[Part->PID]; 138 q = pdg_part.charge() *eplus; // in units of 'e' 139 M = pdg_part.mass(); // GeV 140 } else { q = Part->Charge; M = Part->M; } 141 134 142 if(q==0) return; 135 143 if(R_max==0) { cout << "ERROR: magnetic field has no lateral extention\n"; return;} … … 165 173 double PT = Part->PT; 166 174 double E = Part->E; // [GeV] 167 double M = Part->M; // [GeV]/c²175 //double M = Part->M; // [GeV]/c² 168 176 double Phi = UNDEFINED; 169 177 … … 477 485 double p = sqrt(pz*pz + pt*pt); //sqrt(px*px+py*py+pz*pz); 478 486 479 double M = Part->M;487 //double M = Part->M; // see above 480 488 double vx = px/M; 481 489 double vy = py/M; -
trunk/src/HEPEVTConverter.cc
r352 r380 169 169 170 170 171 HEPEVTConverter::HEPEVTConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) : DataConverter(Nevents)171 HEPEVTConverter::HEPEVTConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) : DataConverter(pdg,Nevents) 172 172 { 173 173 string buffer; -
trunk/src/HepMCConverter.cc
r376 r380 36 36 #include "BlockClasses.h" 37 37 38 #include " SmearUtil.h"38 #include "PdgParticle.h" 39 39 #include "ExRootTreeWriter.h" 40 40 #include "ExRootTreeBranch.h" … … 197 197 element->D1 = da1; 198 198 element->D2 = da2; 199 element->Charge = ChargeVal(pid);200 199 201 200 element->E = index_to_particle[n]->momentum().e(); … … 203 202 element->Py = index_to_particle[n]->momentum().py(); 204 203 element->Pz = index_to_particle[n]->momentum().pz(); 205 element->M = index_to_particle[n]->momentum().m(); 206 207 float PT = sqrt(pow(element->Px,2)+pow(element->Py,2)); 208 element->PT = PT; 204 205 206 //cout << "element->PID = " << pid << "\t"; 207 //PdgParticle pdg_part(PdgID[pid]); 208 //element->M = index_to_particle[n]->momentum().m(); // this is the particle virtuality, not its rest mass 209 //element->M = pdg_part.mass(); 210 //element->Charge = pdg_part.charge(); 211 //cout << "element->M = " << element->M << " \t element->Charge = " << element->Charge << endl; 212 213 element->PT = sqrt(pow(element->Px,2)+pow(element->Py,2)); 209 214 210 215 momentum.SetPxPyPzE(element->Px, element->Py, element->Pz, element->E); … … 256 261 //------------------------------------------------------------------------------ 257 262 258 HepMCConverter::HepMCConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) : DataConverter(Nevents)263 HepMCConverter::HepMCConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) : DataConverter(pdg,Nevents) 259 264 { 260 265 -
trunk/src/LHEFConverter.cc
r369 r380 39 39 #include "BlockClasses.h" 40 40 #include "LHEFConverter.h" 41 #include "SmearUtil.h" 42 #include "PdgParticle.h" 41 43 42 44 using namespace std; … … 85 87 element->Pz = hepeup.PUP[particle][2]; 86 88 element->E = hepeup.PUP[particle][3]; 87 element->M = hepeup.PUP[particle][4]; 88 89 //element->M = hepeup.PUP[particle][4]; 90 //element->Charge = ChargeVal(element->PID); 91 92 PdgParticle pdg_part = pdg_table[element->PID]; 93 element->Charge = pdg_part.charge(); 94 element->M = pdg_part.mass(); 95 89 96 momentum.SetPxPyPzE(element->Px, element->Py, element->Pz, element->E); 90 97 element->PT = momentum.Perp(); … … 105 112 //------------------------------------------------------------------------------ 106 113 //Nevents not yet implemented! 08.03.2009 107 LHEFConverter::LHEFConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) :108 DataConverter( Nevents) {114 LHEFConverter::LHEFConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) : 115 DataConverter(pdg,Nevents) { 109 116 110 117 ExRootTreeWriter *treeWriter = new ExRootTreeWriter(outputFileName, "GEN"); -
trunk/src/STDHEPConverter.cc
r376 r380 41 41 #include "stdhep_declarations.h" 42 42 #include "STDHEPConverter.h" 43 #include "PdgParticle.h" 43 44 44 45 using namespace std; … … 79 80 element->D1 = myhepevt.jdahep[number][0] - 1; 80 81 element->D2 = myhepevt.jdahep[number][1] - 1; 81 // element->Charge = myhepevt.hepchg(element->PID); 82 element->Charge = ChargeVal(element->PID); 82 PdgParticle pdg_part = pdg_table[element->PID]; 83 element->Charge = pdg_part.charge(); 84 element->M = pdg_part.mass(); 83 85 84 86 element->E = myhepevt.phep[number][3]; … … 86 88 element->Py = myhepevt.phep[number][1]; 87 89 element->Pz = myhepevt.phep[number][2]; 88 element->M = myhepevt.phep[number][4];90 //element->M = myhepevt.phep[number][4]; 89 91 90 92 momentum.SetPxPyPzE(element->Px, element->Py, element->Pz, element->E); … … 111 113 //------------------------------------------------------------------------------ 112 114 113 STDHEPConverter::STDHEPConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) : DataConverter(Nevents)115 STDHEPConverter::STDHEPConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) : DataConverter(pdg, Nevents) 114 116 { 115 117 int ierr, entryType; -
trunk/src/SmearUtil.cc
r376 r380 42 42 #include <sstream> 43 43 #include <iomanip> 44 #include <map> 44 45 using namespace std; 45 46 … … 195 196 RP_cross_y = 0.0; 196 197 RP_cross_ang = 142.5; 198 199 PdgTableFilename = "data/particle.tbl"; 197 200 198 201 } … … 332 335 333 336 PT_QUARKS_MIN = DET.PT_QUARKS_MIN; 337 PdgTableFilename = DET.PdgTableFilename; 338 PDGtable = DET.PDGtable; 334 339 } 335 340 … … 468 473 469 474 PT_QUARKS_MIN = DET.PT_QUARKS_MIN; 475 476 PdgTableFilename = DET.PdgTableFilename; 477 PDGtable = DET.PDGtable; 470 478 return *this; 471 479 } … … 577 585 else if(strstr(temp_string.c_str(),"FLAG_lhco")) {curstring >> varname >> ivalue; FLAG_lhco = ivalue;} 578 586 else if(strstr(temp_string.c_str(),"NEvents_Frog")) {curstring >> varname >> ivalue; NEvents_Frog = ivalue;} 587 588 else if(strstr(temp_string.c_str(),"PdgTableFilename")) {curstring >> varname >> svalue; PdgTableFilename = svalue;} 579 589 } 580 590 … … 657 667 f_out <<"**********************************************************************"<< endl; 658 668 f_out <<"** **"<< endl; 659 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n"; 669 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n"; 670 f_out<<"# Input PDG table : " << PdgTableFilename << " *"<<"\n"; 671 f_out<<"* *"<<"\n"; 660 672 f_out<<"* *"<<"\n"; 661 673 f_out<<"#******************************** *"<<"\n"; … … 1280 1292 int ChargeVal(const int pid) 1281 1293 { 1294 cout << "ChargeVal :: deprecated function, do not use it anymore" << endl; 1282 1295 int charge; 1283 1296 if( … … 1295 1308 1296 1309 } 1310 1311 //------------------------------------------------------------------------------ 1312 void RESOLution::ReadParticleDataGroupTable() { 1313 1314 string temp_string; 1315 istringstream curstring; 1316 1317 ifstream fichier_a_lire(PdgTableFilename.c_str()); 1318 if(!fichier_a_lire.good()) { 1319 cout <<"** ERROR: PDG Table ("<< PdgTableFilename 1320 << ") not found! exit. **" << endl; 1321 exit(1); 1322 return; 1323 } 1324 // first three lines of the file are useless 1325 getline(fichier_a_lire,temp_string); 1326 getline(fichier_a_lire,temp_string); 1327 getline(fichier_a_lire,temp_string); 1328 1329 1330 while (getline(fichier_a_lire,temp_string)) { 1331 curstring.clear(); // needed when using several times istringstream::str(string) 1332 curstring.str(temp_string); 1333 int ID; string name; int charge; float mass; float width; float lifetime; 1334 // ID name chg mass total width lifetime 1335 // 1 d -1 0.33000 0.00000 0.00000E+00 1336 curstring >> ID >> name >> charge >> mass >> width >> lifetime; 1337 PdgParticle particle(ID,name,mass,charge/3.,width,lifetime); 1338 PDGtable.insert(ID,particle); 1339 //PdgTable.insert(pair<int,PdgParticle>(ID,particle)); 1340 //cout << PDGtable[ID].name() << "\t" << PDGtable[ID].mass() << "\t" << PDGtable[ID].charge() << endl; 1341 } 1342 1343 } // ReadParticleDataGroupTable
Note:
See TracChangeset
for help on using the changeset viewer.