CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RootInputFileSequence.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 ----------------------------------------------------------------------*/
4 #include "PoolSource.h"
5 #include "RootFile.h"
6 #include "RootTree.h"
7 #include "DuplicateChecker.h"
8 
20 
21 #include "CLHEP/Random/RandFlat.h"
22 #include "InputFile.h"
23 #include "TSystem.h"
24 
25 namespace edm {
27  ParameterSet const& pset,
28  PoolSource const& input,
30  PrincipalCache& cache,
31  bool primaryFiles) :
32  input_(input),
33  catalog_(catalog),
34  firstFile_(true),
35  fileIterBegin_(fileCatalogItems().begin()),
36  fileIterEnd_(fileCatalogItems().end()),
37  fileIter_(fileIterEnd_),
38  fileIterLastOpened_(fileIterEnd_),
39  rootFile_(),
40  parametersMustMatch_(BranchDescription::Permissive),
41  branchesMustMatch_(BranchDescription::Permissive),
42  flatDistribution_(),
43  indexesIntoFiles_(fileCatalogItems().size()),
44  orderedProcessHistoryIDs_(),
45  eventSkipperByID_(primaryFiles ? EventSkipperByID::create(pset).release() : 0),
46  eventsRemainingInFile_(0),
47  // The default value provided as the second argument to the getUntrackedParameter function call
48  // is not used when the ParameterSet has been validated and the parameters are not optional
49  // in the description. This is currently true when PoolSource is the primary input source.
50  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
51  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
52  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
53  // and should be deleted from the code.
54  numberOfEventsToSkip_(primaryFiles ? pset.getUntrackedParameter<unsigned int>("skipEvents", 0U) : 0U),
55  noEventSort_(primaryFiles ? pset.getUntrackedParameter<bool>("noEventSort", true) : false),
56  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
57  treeCacheSize_(pset.getUntrackedParameter<unsigned int>("cacheSize", input::defaultCacheSize)),
58  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
59  setRun_(pset.getUntrackedParameter<unsigned int>("setRunNumber", 0U)),
60  groupSelectorRules_(pset, "inputCommands", "InputSource"),
61  primaryFiles_(primaryFiles),
62  duplicateChecker_(primaryFiles ? new DuplicateChecker(pset) : 0),
63  dropDescendants_(pset.getUntrackedParameter<bool>("dropDescendantsOfDroppedBranches", primary())),
64  usingGoToEvent_(false) {
65 
66  //we now allow the site local config to specify what the TTree cache size should be
68  if(pSLC.isAvailable() && pSLC->sourceTTreeCacheSize()) {
70  }
73  factory->activateTimeout(fileIter_->fileName());
74  factory->stagein(fileIter_->fileName());
75  }
76 
77  std::string parametersMustMatch = pset.getUntrackedParameter<std::string>("parametersMustMatch", std::string("permissive"));
78  if(parametersMustMatch == std::string("strict")) parametersMustMatch_ = BranchDescription::Strict;
79 
80  std::string branchesMustMatch = pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
81  if(branchesMustMatch == std::string("strict")) branchesMustMatch_ = BranchDescription::Strict;
82 
83  if(primary()) {
86  if(rootFile_) break;
87  }
88  if(rootFile_) {
89  productRegistryUpdate().updateFromInput(rootFile_->productRegistry()->productList());
90  if(numberOfEventsToSkip_ != 0) {
92  }
93  }
94  }
95  }
96 
97  std::vector<FileCatalogItem> const&
99  return catalog_.fileCatalogItems();
100  }
101 
102  void
104  closeFile_();
105  }
106 
107  boost::shared_ptr<FileBlock>
109  if(firstFile_) {
110  // The first input file has already been opened.
111  firstFile_ = false;
112  if(!rootFile_) {
114  }
115  } else {
116  if(!nextFile(cache)) {
117  assert(0);
118  }
119  }
120  if(!rootFile_) {
121  return boost::shared_ptr<FileBlock>(new FileBlock);
122  }
123  return rootFile_->createFileBlock();
124  }
125 
127  // close the currently open file, if any, and delete the RootFile object.
128  if(rootFile_) {
129  if (primary()) {
130  assert(rootFile_.unique());
131  std::auto_ptr<InputSource::FileCloseSentry>
133  rootFile_->close();
134  if(duplicateChecker_) duplicateChecker_->inputFileClosed();
135  }
136  rootFile_.reset();
137  }
138  }
139 
140  void RootInputFileSequence::initFile(bool skipBadFiles) {
141  // We are really going to close the open file.
142 
143  // If this is the primary sequence, we are not duplicate checking across files
144  // and we are not using random access to find events, then we can delete the
145  // IndexIntoFile for the file we are closing. If we can't delete all of it,
146  // then we can delete the parts we do not need.
148  size_t currentIndexIntoFile = fileIterLastOpened_ - fileIterBegin_;
149  bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled();
150  bool deleteIndexIntoFile = primaryFiles_ &&
151  !needIndexesForDuplicateChecker &&
153  if (deleteIndexIntoFile) {
154  indexesIntoFiles_[currentIndexIntoFile].reset();
155  } else {
156  if (indexesIntoFiles_[currentIndexIntoFile]) indexesIntoFiles_[currentIndexIntoFile]->inputFileClosed();
157  }
159  }
160  closeFile_();
161 
162  // Determine whether we have a fallback URL specified; if so, prepare it;
163  // Only valid if it is non-empty and differs from the original filename.
164  std::string fallbackName = fileIter_->fallbackFileName();
165  bool hasFallbackUrl = (!fallbackName.empty()) || (fallbackName == fileIter_->fileName());
166 
167  boost::shared_ptr<InputFile> filePtr;
168  try {
169  std::auto_ptr<InputSource::FileOpenSentry>
171  filePtr.reset(new InputFile(gSystem->ExpandPathName(fileIter_->fileName().c_str()), " Initiating request to open file "));
172  }
173  catch (cms::Exception const& e) {
174  if(!skipBadFiles && !hasFallbackUrl) {
175  throw edm::Exception(edm::errors::FileOpenError) << e.explainSelf() << "\n" <<
176  "RootInputFileSequence::initFile(): Input file " << fileIter_->fileName() << " was not found or could not be opened.\n";
177  }
178  }
179  if(!filePtr && (hasFallbackUrl)) {
180  try {
181  std::auto_ptr<InputSource::FileOpenSentry>
183  filePtr.reset(new InputFile(gSystem->ExpandPathName(fallbackName.c_str()), " Fallback request to file "));
184  }
185  catch (cms::Exception const& e) {
186  if(!skipBadFiles) {
187  throw edm::Exception(edm::errors::FileOpenError) << e.explainSelf() << "\n" <<
188  "RootInputFileSequence::initFile(): Input fallback file " << fallbackName << " was not found or could not be opened.\n";
189  }
190  }
191  }
192  if(filePtr) {
193  std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile = fileIter_ - fileIterBegin_;
194  rootFile_ = RootFileSharedPtr(new RootFile(fileIter_->fileName(),
195  processConfiguration(), fileIter_->logicalFileName(), filePtr,
199  setRun_,
200  noEventSort_,
203 
205  indexesIntoFiles_[currentIndexIntoFile] = rootFile_->indexIntoFileSharedPtr();
206  rootFile_->reportOpened(primary() ?
207  (primaryFiles_ ? "primaryFiles" : "secondaryFiles") : "mixingFiles");
208  } else {
209  if(!skipBadFiles) {
211  "RootInputFileSequence::initFile(): Input file " << fileIter_->fileName() << " was not found or could not be opened.\n";
212  }
213  LogWarning("") << "Input file: " << fileIter_->fileName() << " was not found or could not be opened, and will be skipped.\n";
214  }
215  }
216 
217  boost::shared_ptr<ProductRegistry const>
219  return rootFile_->productRegistry();
220  }
221 
224  if(fileIter_ == fileIterEnd_) {
225  if(primaryFiles_) {
226  return false;
227  } else {
229  }
230  }
231 
233 
234  if(primaryFiles_ && rootFile_) {
235  size_t size = productRegistry()->size();
236  // make sure the new product registry is compatible with the main one
237  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
238  fileIter_->fileName(),
241  if(!mergeInfo.empty()) {
242  throw edm::Exception(errors::MismatchedInputFiles,"RootInputFileSequence::nextFile()") << mergeInfo;
243  }
244  if (productRegistry()->size() > size) {
246  }
248  }
249  return true;
250  }
251 
253  if(fileIter_ == fileIterBegin_) {
254  if(primaryFiles_) {
255  return false;
256  } else {
258  }
259  }
260  --fileIter_;
261 
262  initFile(false);
263 
264  if(primaryFiles_ && rootFile_) {
265  size_t size = productRegistry()->size();
266  // make sure the new product registry is compatible to the main one
267  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
268  fileIter_->fileName(),
271  if(!mergeInfo.empty()) {
272  throw edm::Exception(errors::MismatchedInputFiles,"RootInputFileSequence::previousEvent()") << mergeInfo;
273  }
274  if (productRegistry()->size() > size) {
276  }
278  }
279  if(rootFile_) rootFile_->setToLastEntry();
280  return true;
281  }
282 
284  }
285 
286  boost::shared_ptr<RunAuxiliary>
288  boost::shared_ptr<RunAuxiliary> aux = rootFile_->readRunAuxiliary_();
289  return aux;
290  }
291 
292  boost::shared_ptr<LuminosityBlockAuxiliary>
294  boost::shared_ptr<LuminosityBlockAuxiliary> aux = rootFile_->readLuminosityBlockAuxiliary_();
295  return aux;
296  }
297 
298  boost::shared_ptr<RunPrincipal>
299  RootInputFileSequence::readRun_(boost::shared_ptr<RunPrincipal> rpCache) {
300  return rootFile_->readRun_(rpCache);
301  }
302 
303  boost::shared_ptr<LuminosityBlockPrincipal>
304  RootInputFileSequence::readLuminosityBlock_(boost::shared_ptr<LuminosityBlockPrincipal> lbCache) {
305  return rootFile_->readLumi(lbCache);
306  }
307 
308  // readEvent() is responsible for setting up the EventPrincipal.
309  //
310  // 1. create an EventPrincipal with a unique EventID
311  // 2. For each entry in the provenance, put in one Group,
312  // holding the Provenance for the corresponding EDProduct.
313  // 3. set up the caches in the EventPrincipal to know about this
314  // Group.
315  //
316  // We do *not* create the EDProduct instance (the equivalent of reading
317  // the branch containing this EDProduct. That will be done by the Delayed Reader,
318  // when it is asked to do so.
319  //
320 
322  RootInputFileSequence::readEvent(EventPrincipal& cache, boost::shared_ptr<LuminosityBlockPrincipal> lb) {
323  return rootFile_->readEvent(cache, lb);
324  }
325 
328  if(fileIter_ == fileIterEnd_) {
329  return InputSource::IsStop;
330  }
331  if(firstFile_) {
332  return InputSource::IsFile;
333  }
334  if(rootFile_) {
335  IndexIntoFile::EntryType entryType = rootFile_->getNextEntryTypeWanted();
336  if(entryType == IndexIntoFile::kEvent) {
337  return InputSource::IsEvent;
338  } else if(entryType == IndexIntoFile::kLumi) {
339  return InputSource::IsLumi;
340  } else if(entryType == IndexIntoFile::kRun) {
341  return InputSource::IsRun;
342  }
343  assert(entryType == IndexIntoFile::kEnd);
344  }
345  if(fileIter_ + 1 == fileIterEnd_) {
346  return InputSource::IsStop;
347  }
348  return InputSource::IsFile;
349  }
350 
351  // Rewind to before the first event that was read.
352  void
354  if (fileIter_ != fileIterBegin_) {
355  closeFile_();
357  }
358  if (!rootFile_) {
359  initFile(false);
360  }
361  rewindFile();
362  firstFile_ = true;
363  }
364 
365  // Rewind to the beginning of the current file
366  void
368  rootFile_->rewind();
369  }
370 
371  void
373  //NOTE: Need to handle duplicate checker
374  // Also what if skipBadFiles_==true and the first time we succeeded but after a reset we fail?
375  if(primary()) {
376  firstFile_ = true;
379  if(rootFile_) break;
380  }
381  if(rootFile_) {
382  if(numberOfEventsToSkip_ != 0) {
384  }
385  }
386  }
387  }
388 
389  // Advance "offset" events. Offset can be positive or negative (or zero).
390  bool
392  assert (numberOfEventsToSkip_ == 0 || numberOfEventsToSkip_ == offset);
394  while(numberOfEventsToSkip_ != 0) {
395  bool atEnd = rootFile_->skipEvents(numberOfEventsToSkip_);
396  if((numberOfEventsToSkip_ > 0 || atEnd) && !nextFile(cache)) {
398  return false;
399  }
400  if(numberOfEventsToSkip_ < 0 && !previousFile(cache)) {
403  return false;
404  }
405  }
406  return true;
407  }
408 
409  bool
411  usingGoToEvent_ = true;
412  if (rootFile_) {
413  if (rootFile_->goToEvent(eventID)) {
414  return true;
415  }
416  // If only one input file, give up now, to save time.
417  if(rootFile_ && indexesIntoFiles_.size() == 1) {
418  return false;
419  }
420  // Save the current file and position so that we can restore them
421  // if we fail to restore the desired event
422  bool closedOriginalFile = false;
423  std::vector<FileCatalogItem>::const_iterator originalFile = fileIter_;
424  IndexIntoFile::IndexIntoFileItr originalPosition = rootFile_->indexIntoFileIter();
425 
426  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
427  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
428  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
429  if(*it && (*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
430  // We found it. Close the currently open file, and open the correct one.
431  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
432  initFile(false);
433  // Now get the item from the correct file.
434  bool found = rootFile_->goToEvent(eventID);
435  assert (found);
436  return true;
437  }
438  }
439  // Look for item in files not yet opened.
440  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
441  if(!*it) {
442  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
443  initFile(false);
444  closedOriginalFile = true;
445  if ((*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
446  if (rootFile_->goToEvent(eventID)) {
447  return true;
448  }
449  }
450  }
451  }
452  if (closedOriginalFile) {
453  fileIter_ = originalFile;
454  initFile(false);
455  rootFile_->setPosition(originalPosition);
456  }
457  }
458  return false;
459  }
460 
461  bool
463  // Attempt to find item in currently open input file.
464  bool found = rootFile_ && rootFile_->setEntryAtItem(run, lumi, event);
465  if(!found) {
466  // If only one input file, give up now, to save time.
467  if(rootFile_ && indexesIntoFiles_.size() == 1) {
468  return false;
469  }
470  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
471  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
472  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
473  if(*it && (*it)->containsItem(run, lumi, event)) {
474  // We found it. Close the currently open file, and open the correct one.
475  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
476  initFile(false);
477  // Now get the item from the correct file.
478  found = rootFile_->setEntryAtItem(run, lumi, event);
479  assert (found);
480  return true;
481  }
482  }
483  // Look for item in files not yet opened.
484  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
485  if(!*it) {
486  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
487  initFile(false);
488  found = rootFile_->setEntryAtItem(run, lumi, event);
489  if(found) {
490  return true;
491  }
492  }
493  }
494  // Not found
495  return false;
496  }
497  return true;
498  }
499 
500  bool const
502  return input_.primary();
503  }
504 
505  ProcessConfiguration const&
507  return input_.processConfiguration();
508  }
509 
510  int
512  return input_.remainingEvents();
513  }
514 
515  int
518  }
519 
522  return input_.productRegistryUpdate();
523  }
524 
525  boost::shared_ptr<ProductRegistry const>
527  return input_.productRegistry();
528  }
529 
530  void
531  RootInputFileSequence::dropUnwantedBranches_(std::vector<std::string> const& wantedBranches) {
532  std::vector<std::string> rules;
533  rules.reserve(wantedBranches.size() + 1);
534  rules.push_back(std::string("drop *"));
535  for(std::vector<std::string>::const_iterator it = wantedBranches.begin(), itEnd = wantedBranches.end();
536  it != itEnd; ++it) {
537  rules.push_back("keep " + *it + "_*");
538  }
540  pset.addUntrackedParameter("inputCommands", rules);
541  groupSelectorRules_ = GroupSelectorRules(pset, "inputCommands", "InputSource");
542  }
543 
544  void
546  for(int i = 0; i < number; ++i) {
547  boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(rootFile_->productRegistry(), processConfiguration()));
548  EventPrincipal* ev = rootFile_->readCurrentEvent(*ep);
549  if(ev == 0) {
550  return;
551  }
552  assert(ev == ep.get());
553  result.push_back(ep);
554  rootFile_->nextEventEntry();
555  }
556  }
557 
558  void
559  RootInputFileSequence::readManyRandom(int number, EventPrincipalVector& result, unsigned int& fileSeqNumber) {
560  result.reserve(number);
561  if (!flatDistribution_) {
563  CLHEP::HepRandomEngine& engine = rng->getEngine();
564  flatDistribution_.reset(new CLHEP::RandFlat(engine));
565  }
566  skipBadFiles_ = false;
567  unsigned int currentSeqNumber = fileIter_ - fileIterBegin_;
568  while(eventsRemainingInFile_ < number) {
569  fileIter_ = fileIterBegin_ + flatDistribution_->fireInt(fileCatalogItems().size());
570  unsigned int newSeqNumber = fileIter_ - fileIterBegin_;
571  if(newSeqNumber != currentSeqNumber) {
572  initFile(false);
573  }
574  eventsRemainingInFile_ = rootFile_->eventTree().entries();
575  if(eventsRemainingInFile_ == 0) {
577  "RootInputFileSequence::readManyRandom_(): Secondary Input file " << fileIter_->fileName() << " contains no events.\n";
578  }
579  rootFile_->setAtEventEntry(flatDistribution_->fireInt(eventsRemainingInFile_));
580  }
581  fileSeqNumber = fileIter_ - fileIterBegin_;
582  for(int i = 0; i < number; ++i) {
583  boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(rootFile_->productRegistry(), processConfiguration()));
584  EventPrincipal* ev = rootFile_->readCurrentEvent(*ep);
585  if(ev == 0) {
586  rewindFile();
587  ev = rootFile_->readCurrentEvent(*ep);
588  assert(ev != 0);
589  }
590  assert(ev == ep.get());
591  result.push_back(ep);
593  rootFile_->nextEventEntry();
594  }
595  }
596 
597  void
598  RootInputFileSequence::readManySequential(int number, EventPrincipalVector& result, unsigned int& fileSeqNumber) {
599  result.reserve(number);
600  skipBadFiles_ = false;
601  if (fileIter_ == fileIterEnd_ || !rootFile_) {
603  initFile(false);
604  rootFile_->setAtEventEntry(0);
605  }
606  fileSeqNumber = fileIter_ - fileIterBegin_;
607  unsigned int numberRead = 0;
608  for(int i = 0; i < number; ++i) {
609  boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(rootFile_->productRegistry(), processConfiguration()));
610  EventPrincipal* ev = rootFile_->readCurrentEvent(*ep);
611  if(ev == 0) {
612  if (numberRead == 0) {
613  ++fileIter_;
614  fileSeqNumber = fileIter_ - fileIterBegin_;
615  if (fileIter_ == fileIterEnd_) {
616  return;
617  }
618  initFile(false);
619  rootFile_->setAtEventEntry(0);
620  return readManySequential(number, result, fileSeqNumber);
621  }
622  return;
623  }
624  assert(ev == ep.get());
625  result.push_back(ep);
626  ++numberRead;
627  rootFile_->nextEventEntry();
628  }
629  }
630 
631  void
633  skipBadFiles_ = false;
634  result.reserve(events.size());
635  for (std::vector<EventID>::const_iterator it = events.begin(), itEnd = events.end(); it != itEnd; ++it) {
636  bool found = skipToItem(it->run(), it->luminosityBlock(), it->event());
637  if (!found) {
639  "RootInputFileSequence::readManySpecified_(): Secondary Input file " <<
640  fileIter_->fileName() <<
641  " does not contain specified event:\n" << *it << "\n";
642  }
643  boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(rootFile_->productRegistry(), processConfiguration()));
644  EventPrincipal* ev = rootFile_->readCurrentEvent(*ep);
645  if (ev == 0) {
647  "RootInputFileSequence::readManySpecified_(): Secondary Input file " <<
648  fileIter_->fileName() <<
649  " contains specified event " << *it << " that cannot be read.\n";
650  }
651  assert(ev == ep.get());
652  result.push_back(ep);
653  }
654  }
655 
656  void
658  desc.addUntracked<unsigned int>("skipEvents", 0U)
659  ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed.");
660  desc.addUntracked<bool>("noEventSort", true)
661  ->setComment("True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n"
662  "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note 3).\n"
663  "Note 1: Events within the same lumi will always be processed contiguously.\n"
664  "Note 2: Lumis within the same run will always be processed contiguously.\n"
665  "Note 3: Any sorting occurs independently in each input file (no sorting across input files).");
666  desc.addUntracked<bool>("skipBadFiles", false)
667  ->setComment("True: Ignore any missing or unopenable input file.\n"
668  "False: Throw exception if missing or unopenable input file.");
669  desc.addUntracked<unsigned int>("cacheSize", input::defaultCacheSize)
670  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
671  desc.addUntracked<int>("treeMaxVirtualSize", -1)
672  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
673  desc.addUntracked<unsigned int>("setRunNumber", 0U)
674  ->setComment("If non-zero, change number of first run to this number. Apply same offset to all runs. Allowed only for simulation.");
675  desc.addUntracked<bool>("dropDescendantsOfDroppedBranches", true)
676  ->setComment("If True, also drop on input any descendent of any branch dropped on input.");
677  std::string defaultString("permissive");
678  desc.addUntracked<std::string>("parametersMustMatch", defaultString)
679  ->setComment("'strict': Values of tracked parameters must be unique across all input files.\n"
680  "'permissive': Values of tracked parameters may differ across or within files.");
681  desc.addUntracked<std::string>("branchesMustMatch", defaultString)
682  ->setComment("'strict': Branches in each input file must match those in the first file.\n"
683  "'permissive': Branches in each input file may be any subset of those in the first file.");
684 
685  GroupSelectorRules::fillDescription(desc, "inputCommands");
688  }
689 
692  if (rootFile_) {
693  if (!rootFile_->wasLastEventJustRead()) {
695  }
696  std::vector<FileCatalogItem>::const_iterator itr(fileIter_);
697  if (itr != fileIterEnd_) ++itr;
698  if (itr != fileIterEnd_) {
700  }
702  }
704  }
705 
708  if (rootFile_) {
709  if (!rootFile_->wasFirstEventJustRead()) {
711  }
712  if (fileIter_ != fileIterBegin_) {
714  }
716  }
718  }
719 }
RunNumber_t run() const
Definition: EventID.h:42
void readManySequential(int number, EventPrincipalVector &result, unsigned int &fileSeqNumber)
boost::shared_ptr< RunPrincipal > readRun_(boost::shared_ptr< RunPrincipal > rpCache)
ProcessingController::ForwardState forwardState() const
EventNumber_t event() const
Definition: EventID.h:44
T getUntrackedParameter(std::string const &, T const &) const
boost::shared_ptr< ProductRegistry const > fileProductRegistry() const
int i
Definition: DBlmapReader.cc:9
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void stagein(const std::string &url)
void initFile(bool skipBadFiles)
bool goToEvent(EventID const &eventID, PrincipalCache &cache)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
RootInputFileSequence(ParameterSet const &pset, PoolSource const &input, InputFileCatalog const &catalog, PrincipalCache &cache, bool primaryFiles)
ProcessConfiguration const & processConfiguration() const
unsigned int EventNumber_t
Definition: EventID.h:30
EventPrincipal * readEvent(EventPrincipal &cache, boost::shared_ptr< LuminosityBlockPrincipal > lb)
bool const primary() const
Accessor for primary input source flag.
Definition: InputSource.h:193
VectorInputSource::EventPrincipalVector EventPrincipalVector
virtual std::string explainSelf() const
Definition: Exception.cc:56
boost::shared_ptr< RunAuxiliary > readRunAuxiliary_()
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:41
ProductRegistry & productRegistryUpdate() const
GroupSelectorRules groupSelectorRules_
boost::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:233
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
static void fillDescription(ParameterSetDescription &desc)
unsigned int const defaultCacheSize
Definition: Inputfwd.h:22
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode parametersMustMatch=BranchDescription::Permissive, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
void adjustIndexesAfterProductRegistryAddition()
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
uint16_t size_type
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
static void fillDescription(ParameterSetDescription &desc)
bool skipEvents(int offset, PrincipalCache &cache)
static StorageFactory * get(void)
tuple InputFile
Open Root file and provide MEs ############.
void adjustEventToNewProductRegistry(boost::shared_ptr< ProductRegistry const > reg)
void reset(PrincipalCache &cache)
boost::shared_ptr< LuminosityBlockPrincipal > readLuminosityBlock_(boost::shared_ptr< LuminosityBlockPrincipal > lbCache)
int remainingEvents() const
Definition: InputSource.h:176
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
void readManySpecified(std::vector< EventID > const &events, EventPrincipalVector &result)
std::vector< FileCatalogItem > const & fileCatalogItems() const
tuple result
Definition: query.py:137
virtual unsigned int const * sourceTTreeCacheSize() const =0
bool isAvailable() const
Definition: Service.h:47
boost::shared_ptr< DuplicateChecker > duplicateChecker_
void readMany(int number, EventPrincipalVector &result)
tuple pset
Definition: CrabTask.py:85
#define end
Definition: vmac.h:38
unsigned int offset(bool)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void dropUnwantedBranches_(std::vector< std::string > const &wantedBranches)
bool nextFile(PrincipalCache &cache)
tuple input
Definition: collect_tpl.py:10
boost::shared_ptr< FileBlock > readFile_(PrincipalCache &cache)
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:202
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:299
void readManyRandom(int number, EventPrincipalVector &result, unsigned int &fileSeqNumber)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
boost::shared_ptr< ProductRegistry const > productRegistry() const
Accessor for product registry.
Definition: InputSource.h:161
static void fillDescription(ParameterSetDescription &desc)
#define begin
Definition: vmac.h:31
author Stefano ARGIRO author Bill Tanenbaum
tuple events
Definition: patZpeak.py:19
InputSource::ItemType getNextItemType()
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
void updateFromInput(ProductList const &other)
bool previousFile(PrincipalCache &cache)
void activateTimeout(const std::string &url)
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
int remainingLuminosityBlocks() const
Definition: InputSource.h:184
unsigned int RunNumber_t
Definition: EventRange.h:32
BranchDescription::MatchMode branchesMustMatch_
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:190
ProcessingController::ReverseState reverseState() const
boost::scoped_ptr< CLHEP::RandFlat > flatDistribution_
BranchDescription::MatchMode parametersMustMatch_
SurfaceDeformation * create(int type, const std::vector< double > &params)
tuple size
Write out results.
boost::shared_ptr< RootFile > RootFileSharedPtr
std::vector< FileCatalogItem > const & fileCatalogItems() const
boost::shared_ptr< ProductRegistry const > productRegistry() const
InputFileCatalog const & catalog_