Fork me on GitHub

Changeset 419 in svn for trunk/src


Ignore:
Timestamp:
May 28, 2009, 10:50:31 AM (15 years ago)
Author:
Xavier Rouby
Message:

Nevent implemented in DetectorCard

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/HEPEVTConverter.cc

    r380 r419  
    3636#include <sstream>
    3737#include <fstream>
     38#include <cmath>
    3839
    3940#include "TROOT.h"
     
    212213     
    213214      TRootC::GenParticle *element;
    214      
     215      allEntries = (Nevt<0)?allEntries:min((int)allEntries,Nevt); // do not miss the "+1" 
    215216      // Loop over all events
    216217      for(entry = 0; entry < allEntries; ++entry)
  • trunk/src/HepMCConverter.cc

    r380 r419  
    298298      HepMC::IO_GenEvent ascii_in(filename,std::ios::in);
    299299      // get the first event
     300
    300301      evt = ascii_in.read_next_event();
    301302     
    302303      while ( evt )
    303304        {
     305          if(Nevt>0 && entry>=Nevt) break;
     306
    304307          treeWriter->Clear();
    305308          AnalyseEvent(branchGenEvent, *evt,entry+1);
  • trunk/src/LHEFConverter.cc

    r413 r419  
    111111
    112112//------------------------------------------------------------------------------
    113 //Nevents not yet implemented! 08.03.2009
    114113LHEFConverter::LHEFConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) :
    115114 DataConverter(pdg,Nevents) {
     
    151150     
    152151      Long64_t allEntries = inputReader->getNumberOfEvents();
    153      
     152      allEntries = (Nevt<0)?allEntries:min((int)allEntries,Nevt); // do not miss the "+1"     
     153
    154154      if(allEntries > 0) {
    155155          // Loop over all events
     
    161161              treeWriter->Fill();
    162162              ++entry;
     163              if(allEntries<entry+1) break;
    163164          }
    164165      }
  • trunk/src/STDHEPConverter.cc

    r380 r419  
    3333#include <iostream>
    3434#include <fstream>
     35#include <cmath>
    3536#include "TLorentzVector.h"
    3637#include "BlockClasses.h"
     
    158159          break;
    159160        }
    160      
    161       Long64_t allEntries = nevt;
    162      
     161
     162      Long64_t allEntries = (Nevt<0)?nevt:min(nevt,Nevt+1); // do not miss the "+1"
    163163      if(allEntries > 0)
    164164        {
Note: See TracChangeset for help on using the changeset viewer.