Changeset 1395 in svn for trunk/readers/DelphesCMSFWLite.cpp
- Timestamp:
- Jul 8, 2014, 1:59:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/readers/DelphesCMSFWLite.cpp
r1190 r1395 36 36 #include "DataFormats/FWLite/interface/Handle.h" 37 37 #include "DataFormats/HepMCCandidate/interface/GenParticle.h" 38 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" 39 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" 38 40 39 41 using namespace std; … … 41 43 //--------------------------------------------------------------------------- 42 44 43 void ConvertInput(fwlite::Event &event, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray) 45 void ConvertInput(fwlite::Event &event, Long64_t eventCounter, 46 ExRootTreeBranch *branchEvent, DelphesFactory *factory, 47 TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, 48 TObjArray *partonOutputArray) 44 49 { 50 fwlite::Handle< GenEventInfoProduct > handleGenEventInfo; 51 45 52 fwlite::Handle< vector< reco::GenParticle > > handleParticle; 46 53 vector< reco::GenParticle >::const_iterator itParticle; … … 49 56 vector< const reco::Candidate * >::iterator itCandidate; 50 57 58 handleGenEventInfo.getByLabel(event, "generator"); 51 59 handleParticle.getByLabel(event, "genParticles"); 52 60 61 HepMCEvent *element; 53 62 Candidate *candidate; 54 63 TDatabasePDG *pdg; … … 60 69 Double_t x, y, z; 61 70 71 element = static_cast<HepMCEvent *>(branchEvent->NewEntry()); 72 73 element->Number = eventCounter; 74 75 element->ProcessID = handleGenEventInfo->signalProcessID(); 76 element->MPI = 1; 77 element->Weight = handleGenEventInfo->weight(); 78 element->Scale = handleGenEventInfo->qScale(); 79 element->AlphaQED = handleGenEventInfo->alphaQED(); 80 element->AlphaQCD = handleGenEventInfo->alphaQCD(); 81 82 element->ID1 = 0; 83 element->ID2 = 0; 84 element->X1 = 0.0; 85 element->X2 = 0.0; 86 element->ScalePDF = 0.0; 87 element->PDF1 = 0.0; 88 element->PDF2 = 0.0; 89 90 element->ReadTime = 0.0; 91 element->ProcTime = 0.0; 92 62 93 pdg = TDatabasePDG::Instance(); 63 94 … … 82 113 83 114 candidate->Status = status; 115 116 if(particle.mother()) 117 { 118 itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.mother()); 119 if(itCandidate != vectorCandidate.end()) candidate->M1 = distance(vectorCandidate.begin(), itCandidate); 120 } 84 121 85 122 itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(0)); … … 131 168 TStopwatch eventStopWatch; 132 169 ExRootTreeWriter *treeWriter = 0; 170 ExRootTreeBranch *branchEvent = 0; 133 171 ExRootConfReader *confReader = 0; 134 172 Delphes *modularDelphes = 0; … … 169 207 treeWriter = new ExRootTreeWriter(outputFile, "Delphes"); 170 208 209 branchEvent = treeWriter->NewBranch("Event", HepMCEvent::Class()); 210 171 211 confReader = new ExRootConfReader; 172 212 confReader->ReadFile(argv[1]); … … 210 250 for(event.toBegin(); !event.atEnd() && !interrupted; ++event) 211 251 { 212 ConvertInput(event, factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray); 252 ConvertInput(event, eventCounter, branchEvent, factory, 253 allParticleOutputArray, stableParticleOutputArray, partonOutputArray); 213 254 modularDelphes->ProcessTask(); 214 255
Note:
See TracChangeset
for help on using the changeset viewer.