Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • readers/DelphesCMSFWLite.cpp

    r9e08f27 r0799cd1  
    311311  DelphesFactory *factory = 0;
    312312  TObjArray *allParticleOutputArray = 0, *stableParticleOutputArray = 0, *partonOutputArray = 0;
    313   Int_t i;
     313  Int_t i, maxEvents, skipEvents;
    314314  Long64_t eventCounter, numberOfEvents;
    315315  Bool_t firstEvent = kTRUE;
     
    353353    confReader = new ExRootConfReader;
    354354    confReader->ReadFile(argv[1]);
     355   
     356    maxEvents = confReader->GetInt("::MaxEvents", 0);
     357    skipEvents = confReader->GetInt("::SkipEvents", 0);
     358   
     359    if(maxEvents < 0)
     360    {
     361      throw runtime_error("MaxEvents must be zero or positive");
     362    }
     363   
     364    if(skipEvents < 0)
     365    {
     366      throw runtime_error("SkipEvents must be zero or positive");
     367    }
    355368
    356369    modularDelphes = new Delphes("Delphes");
     
    391404      treeWriter->Clear();
    392405
    393       for(event.toBegin(); !event.atEnd() && !interrupted; ++event)
     406      for(event.toBegin(); !event.atEnd() && !interrupted && (maxEvents <= 0 || eventCounter-skipEvents < maxEvents); ++event)
    394407      {
    395         ConvertInput(event, eventCounter, branchEvent, branchWeight, factory,
    396           allParticleOutputArray, stableParticleOutputArray, partonOutputArray, firstEvent);
    397         modularDelphes->ProcessTask();
    398 
    399         firstEvent = kFALSE;
    400 
    401         treeWriter->Fill();
    402 
    403         modularDelphes->Clear();
    404         treeWriter->Clear();
     408        if(eventCounter > skipEvents){
     409          ConvertInput(event, eventCounter, branchEvent, branchWeight, factory,
     410            allParticleOutputArray, stableParticleOutputArray, partonOutputArray, firstEvent);
     411          modularDelphes->ProcessTask();
     412
     413          firstEvent = kFALSE;
     414
     415          treeWriter->Fill();
     416
     417          modularDelphes->Clear();
     418          treeWriter->Clear();
     419        }
    405420
    406421        progressBar.Update(eventCounter, eventCounter);
Note: See TracChangeset for help on using the changeset viewer.