Fork me on GitHub

Changeset 7b461f6 in git for readers/DelphesLHEF.cpp


Ignore:
Timestamp:
May 30, 2013, 12:48:26 AM (11 years ago)
Author:
pavel <pavel@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
a1f42b2
Parents:
84a1f7d
Message:

add MaxEvents and SkipEvents

File:
1 edited

Legend:

Unmodified
Added
Removed
  • readers/DelphesLHEF.cpp

    r84a1f7d r7b461f6  
    5151  TObjArray *stableParticleOutputArray = 0, *allParticleOutputArray = 0, *partonOutputArray = 0;
    5252  DelphesLHEFReader *reader = 0;
    53   Int_t i;
     53  Int_t i, maxEvents, skipEvents;
    5454  Long64_t length, eventCounter;
    5555
     
    8888    confReader = new ExRootConfReader;
    8989    confReader->ReadFile(argv[1]);
     90
     91    maxEvents = confReader->GetInt("::MaxEvents", 0);
     92    skipEvents = confReader->GetInt("::SkipEvents", 0);
     93
     94    if(maxEvents < 0)
     95    {
     96      throw runtime_error("MaxEvents must be zero or positive");
     97    }
     98
     99    if(skipEvents < 0)
     100    {
     101      throw runtime_error("SkipEvents must be zero or positive");
     102    }
    90103
    91104    modularDelphes = new Delphes("Delphes");
     
    146159      reader->Clear();
    147160      readStopWatch.Start();
    148       while(reader->ReadBlock(factory, allParticleOutputArray,
     161      while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) &&
     162        reader->ReadBlock(factory, allParticleOutputArray,
    149163        stableParticleOutputArray, partonOutputArray) && !interrupted)
    150164      {
     
    154168
    155169          readStopWatch.Stop();
    156           procStopWatch.Start();
    157           modularDelphes->ProcessTask();
    158           procStopWatch.Stop();
    159 
    160           reader->AnalyzeEvent(branchEvent, eventCounter, &readStopWatch, &procStopWatch);
    161 
    162           treeWriter->Fill();
    163 
    164           treeWriter->Clear();
     170
     171          if(eventCounter > skipEvents)
     172          {
     173            readStopWatch.Stop();
     174            procStopWatch.Start();
     175            modularDelphes->ProcessTask();
     176            procStopWatch.Stop();
     177
     178            reader->AnalyzeEvent(branchEvent, eventCounter, &readStopWatch, &procStopWatch);
     179
     180            treeWriter->Fill();
     181
     182            treeWriter->Clear();
     183          }
     184
    165185          modularDelphes->Clear();
    166186          reader->Clear();
Note: See TracChangeset for help on using the changeset viewer.