- Timestamp:
- Aug 25, 2016, 2:04:58 PM (8 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 629e819
- Parents:
- 7bb13cd (diff), 1408174 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- readers
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
readers/DelphesCMSFWLite.cpp
r7bb13cd r70b9632 65 65 ExRootTreeBranch *branchEvent, ExRootTreeBranch *branchRwgt, 66 66 DelphesFactory *factory, TObjArray *allParticleOutputArray, 67 TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray )67 TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray, Bool_t firstEvent) 68 68 { 69 69 70 fwlite::Handle< GenEventInfoProduct > handleGenEventInfo; 70 71 71 fwlite::Handle< LHEEventProduct > handleLHEEvent; 72 73 72 fwlite::Handle< vector< reco::GenParticle > > handleParticle; 73 74 74 vector< reco::GenParticle >::const_iterator itParticle; 75 75 … … 78 78 79 79 handleGenEventInfo.getByLabel(event, "generator"); 80 handleLHEEvent.getByLabel(event, "externalLHEProducer"); 81 handleParticle.getByLabel(event, "genParticles"); 80 81 if (!((handleLHEEvent.getBranchNameFor(event, "source")).empty())) 82 { 83 handleLHEEvent.getByLabel(event, "source"); 84 } 85 else if (!((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty())) 86 { 87 handleLHEEvent.getByLabel(event, "externalLHEProducer"); 88 } 89 else if (firstEvent) 90 { 91 std::cout<<"Wrong LHEEvent Label! Please, check the input file."<<std::endl; 92 } 93 94 if (!((handleParticle.getBranchNameFor(event, "genParticles")).empty())) 95 { 96 handleParticle.getByLabel(event, "genParticles"); 97 } 98 else if (!((handleParticle.getBranchNameFor(event, "prunedGenParticles")).empty())) 99 { 100 handleParticle.getByLabel(event, "prunedGenParticles"); 101 } 102 else 103 { 104 std::cout<<"Wrong GenParticle Label! Please, check the input file."<<std::endl; 105 exit(-1); 106 } 107 108 Bool_t foundLHE = !((handleLHEEvent.getBranchNameFor(event, "source")).empty()) || !((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty()); 82 109 83 110 HepMCEvent *element; … … 91 118 Double_t px, py, pz, e, mass; 92 119 Double_t x, y, z; 93 94 const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights();95 vector< gen::WeightsInfo >::const_iterator itWeightsInfo;96 120 97 121 element = static_cast<HepMCEvent *>(branchEvent->NewEntry()); … … 117 141 element->ProcTime = 0.0; 118 142 119 for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo) 120 { 121 weight = static_cast<Weight *>(branchRwgt->NewEntry()); 122 weight->Weight = itWeightsInfo->wgt; 143 144 if(foundLHE) 145 { 146 const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights(); 147 vector< gen::WeightsInfo >::const_iterator itWeightsInfo; 148 149 for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo) 150 { 151 weight = static_cast<Weight *>(branchRwgt->NewEntry()); 152 weight->Weight = itWeightsInfo->wgt; 153 } 123 154 } 124 155 … … 207 238 Int_t i; 208 239 Long64_t eventCounter, numberOfEvents; 240 Bool_t firstEvent = kTRUE; 209 241 210 242 if(argc < 4) … … 240 272 241 273 branchEvent = treeWriter->NewBranch("Event", HepMCEvent::Class()); 242 branchRwgt = treeWriter->NewBranch(" Rwgt", Weight::Class());274 branchRwgt = treeWriter->NewBranch("Weight", Weight::Class()); 243 275 244 276 confReader = new ExRootConfReader; … … 281 313 modularDelphes->Clear(); 282 314 treeWriter->Clear(); 315 283 316 for(event.toBegin(); !event.atEnd() && !interrupted; ++event) 284 317 { 285 318 ConvertInput(event, eventCounter, branchEvent, branchRwgt, factory, 286 allParticleOutputArray, stableParticleOutputArray, partonOutputArray );319 allParticleOutputArray, stableParticleOutputArray, partonOutputArray, firstEvent); 287 320 modularDelphes->ProcessTask(); 321 322 firstEvent = kFALSE; 288 323 289 324 treeWriter->Fill();
Note:
See TracChangeset
for help on using the changeset viewer.