Fork me on GitHub

Changeset 98ce52a in git for readers


Ignore:
Timestamp:
Aug 23, 2016, 3:01:17 PM (8 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
27a1694, 91acc76, 9327245
Parents:
bdfe7f2 (diff), 7611cb9 (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.
Message:

Merge branch 'master' of github.com:delphes/delphes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • readers/DelphesCMSFWLite.cpp

    rbdfe7f2 r98ce52a  
    6565  ExRootTreeBranch *branchEvent, ExRootTreeBranch *branchRwgt,
    6666  DelphesFactory *factory, TObjArray *allParticleOutputArray,
    67   TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray)
     67  TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray, Bool_t firstEvent)
    6868{
     69
    6970  fwlite::Handle< GenEventInfoProduct > handleGenEventInfo;
    70 
    7171  fwlite::Handle< LHEEventProduct > handleLHEEvent;
    72 
    7372  fwlite::Handle< vector< reco::GenParticle > > handleParticle;
     73
    7474  vector< reco::GenParticle >::const_iterator itParticle;
    7575
     
    7878
    7979  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());
    82109
    83110  HepMCEvent *element;
     
    91118  Double_t px, py, pz, e, mass;
    92119  Double_t x, y, z;
    93 
    94   const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights();
    95   vector< gen::WeightsInfo >::const_iterator itWeightsInfo;
    96120
    97121  element = static_cast<HepMCEvent *>(branchEvent->NewEntry());
     
    117141  element->ProcTime = 0.0;
    118142
    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    } 
    123154  }
    124155
     
    207238  Int_t i;
    208239  Long64_t eventCounter, numberOfEvents;
     240  Bool_t firstEvent = kTRUE;
    209241
    210242  if(argc < 4)
     
    281313      modularDelphes->Clear();
    282314      treeWriter->Clear();
     315
    283316      for(event.toBegin(); !event.atEnd() && !interrupted; ++event)
    284317      {
    285318        ConvertInput(event, eventCounter, branchEvent, branchRwgt, factory,
    286           allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
     319          allParticleOutputArray, stableParticleOutputArray, partonOutputArray, firstEvent);
    287320        modularDelphes->ProcessTask();
     321         
     322        firstEvent = kFALSE;
    288323
    289324        treeWriter->Fill();
Note: See TracChangeset for help on using the changeset viewer.