55{
   58 
   60 
   61  string    inputFile;
   63  size_t    numberOfFiles;
   64  Long64_t  autoflush;
   65  bool      option;
   67 
   68  try {
   69    
   70    JParser<> zap(
"Auxiliary program for time sorting of Monte-Carlo events.");
 
   71    
   77    zap[
'O'] = 
make_field(option,     
"Write [multi] header to each output file");
 
   79 
   80    zap(argc, argv);
   81  }
   82  catch(const exception& error) {
   83    FATAL(error.what() << endl);
 
   84  }
   85 
   86 
   87  if (numberOfFiles == 0) {
   88    numberOfFiles = 1;
   89  }
   90 
   93  }
   94 
   96  
   98 
   99  counter_type ns = (number_of_events + numberOfFiles - 1) / numberOfFiles;
 
  101 
  103 
  104  for (size_t i = 0; i != numberOfFiles; ++i, ni += ns) {
  105 
  106    const JLimit limit(ni, min(ni + ns, number_of_events));
 
  107 
  109 
  110    STATUS(
"Processing " << filename << 
' ' << limit << 
"." << flush);
 
  111 
  112    buffer.clear();
  113 
  114    for (in.setLimit(limit); in.hasNext(); ) {
  115      buffer.push_back(*in.next());
  116    }
  117 
  119 
  120    sort(buffer.begin(), buffer.end(), JCompare_t());
  121 
  123 
  125 
  126    out.open();
  127    
  130 
  131    out.put(
JMeta(argc, argv));
 
  132 
  133    for (const auto& evt : buffer) {
  134      out.put(evt);
  135    }
  136 
  137    if (i == 0 || option) {
  138 
  140 
  141      io >> out;
  142    }
  143 
  144    out.close();
  145 
  147  }
  148 
  149  return 0;
  150}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Utility class to parse command line options.
 
JTreeWriter object output.
 
JTreeWriter< T > & getTreeWriter()
Get TreeWriter.
 
Object reading from a list of files.
 
Template definition for direct access of elements in ROOT TChain.
 
std::string setWildCard(const std::string &file_name, const std::string &value)
Get file name by setting wild card to given value.
 
bool hasWildCard(const std::string &file_name)
Check presence of wild card.
 
static const char FILENAME_WILDCARD
wild card character for file name substitution
 
std::string to_string(const T &value)
Convert value to string.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Long64_t counter_type
Type definition for counter.
 
Auxiliary class for defining the range of iterations of objects.