Fork me on GitHub

Changeset 7611cb9 in git for readers/DelphesCMSFWLite.cpp


Ignore:
Timestamp:
Aug 23, 2016, 1:52:03 PM (8 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
98ce52a
Parents:
5175bbe
Message:

added possibility of running even without LHE product defined (#974)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • readers/DelphesCMSFWLite.cpp

    r5175bbe r7611cb9  
    6565  ExRootTreeBranch *branchEvent, ExRootTreeBranch *branchRwgt,
    6666  DelphesFactory *factory, TObjArray *allParticleOutputArray,
    67   TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray)
     67  TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray, Bool_t firstEvent)
    6868{
    6969
     
    8787    handleLHEEvent.getByLabel(event, "externalLHEProducer");
    8888  }
    89   else
     89  else if (firstEvent)
    9090  {
    9191    std::cout<<"Wrong LHEEvent Label! Please, check the input file."<<std::endl;
    92     exit(-1);
    9392  }
    9493
     
    106105    exit(-1);
    107106  }
     107
     108  Bool_t foundLHE = !((handleLHEEvent.getBranchNameFor(event, "source")).empty()) || !((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty());
    108109
    109110  HepMCEvent *element;
     
    117118  Double_t px, py, pz, e, mass;
    118119  Double_t x, y, z;
    119 
    120   const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights();
    121   vector< gen::WeightsInfo >::const_iterator itWeightsInfo;
    122120
    123121  element = static_cast<HepMCEvent *>(branchEvent->NewEntry());
     
    143141  element->ProcTime = 0.0;
    144142
    145   for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo)
    146   {
    147     weight = static_cast<Weight *>(branchRwgt->NewEntry());
    148     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    } 
    149154  }
    150155
     
    233238  Int_t i;
    234239  Long64_t eventCounter, numberOfEvents;
     240  Bool_t firstEvent = kTRUE;
    235241
    236242  if(argc < 4)
     
    307313      modularDelphes->Clear();
    308314      treeWriter->Clear();
     315
    309316      for(event.toBegin(); !event.atEnd() && !interrupted; ++event)
    310317      {
    311318        ConvertInput(event, eventCounter, branchEvent, branchRwgt, factory,
    312           allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
     319          allParticleOutputArray, stableParticleOutputArray, partonOutputArray, firstEvent);
    313320        modularDelphes->ProcessTask();
     321         
     322        firstEvent = kFALSE;
    314323
    315324        treeWriter->Fill();
Note: See TracChangeset for help on using the changeset viewer.