Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • readers/DelphesCMSFWLite.cpp

    r7611cb9 r355a7d7  
    6565  ExRootTreeBranch *branchEvent, ExRootTreeBranch *branchRwgt,
    6666  DelphesFactory *factory, TObjArray *allParticleOutputArray,
    67   TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray, Bool_t firstEvent)
     67  TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray)
    6868{
    69 
    7069  fwlite::Handle< GenEventInfoProduct > handleGenEventInfo;
     70
    7171  fwlite::Handle< LHEEventProduct > handleLHEEvent;
     72
    7273  fwlite::Handle< vector< reco::GenParticle > > handleParticle;
    73 
    7474  vector< reco::GenParticle >::const_iterator itParticle;
    7575
     
    7878
    7979  handleGenEventInfo.getByLabel(event, "generator");
    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());
     80  handleLHEEvent.getByLabel(event, "externalLHEProducer");
     81  handleParticle.getByLabel(event, "genParticles");
    10982
    11083  HepMCEvent *element;
     
    11891  Double_t px, py, pz, e, mass;
    11992  Double_t x, y, z;
     93
     94  const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights();
     95  vector< gen::WeightsInfo >::const_iterator itWeightsInfo;
    12096
    12197  element = static_cast<HepMCEvent *>(branchEvent->NewEntry());
     
    141117  element->ProcTime = 0.0;
    142118
    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     } 
     119  for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo)
     120  {
     121    weight = static_cast<Weight *>(branchRwgt->NewEntry());
     122    weight->Weight = itWeightsInfo->wgt;
    154123  }
    155124
     
    238207  Int_t i;
    239208  Long64_t eventCounter, numberOfEvents;
    240   Bool_t firstEvent = kTRUE;
    241209
    242210  if(argc < 4)
     
    272240
    273241    branchEvent = treeWriter->NewBranch("Event", HepMCEvent::Class());
    274     branchRwgt = treeWriter->NewBranch("Rwgt", Weight::Class());
     242    branchRwgt = treeWriter->NewBranch("Weight", Weight::Class());
    275243
    276244    confReader = new ExRootConfReader;
     
    313281      modularDelphes->Clear();
    314282      treeWriter->Clear();
    315 
    316283      for(event.toBegin(); !event.atEnd() && !interrupted; ++event)
    317284      {
    318285        ConvertInput(event, eventCounter, branchEvent, branchRwgt, factory,
    319           allParticleOutputArray, stableParticleOutputArray, partonOutputArray, firstEvent);
     286          allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
    320287        modularDelphes->ProcessTask();
    321          
    322         firstEvent = kFALSE;
    323288
    324289        treeWriter->Fill();
Note: See TracChangeset for help on using the changeset viewer.