CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::RootInputFileSequence Class Reference

#include <RootInputFileSequence.h>

Public Types

typedef boost::shared_ptr
< RootFile
RootFileSharedPtr
 

Public Member Functions

void closeFile_ ()
 
bool containedInCurrentFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
void dropUnwantedBranches_ (std::vector< std::string > const &wantedBranches)
 
void endJob ()
 
boost::shared_ptr
< BranchIDListHelper const > 
fileBranchIDListHelper () const
 
boost::shared_ptr
< ProductRegistry const > 
fileProductRegistry () const
 
ProcessingController::ForwardState forwardState () const
 
InputSource::ItemType getNextItemType (RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
 
bool goToEvent (EventID const &eventID)
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
ProcessHistoryRegistry const & processHistoryRegistry () const
 
ProcessHistoryRegistryprocessHistoryRegistryForUpdate ()
 
void readEvent (EventPrincipal &cache)
 
std::unique_ptr< FileBlockreadFile_ ()
 
void readLuminosityBlock_ (LuminosityBlockPrincipal &lumiPrincipal)
 
boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
void readOneRandom (EventPrincipal &cache, CLHEP::HepRandomEngine *)
 
bool readOneRandomWithID (EventPrincipal &cache, LuminosityBlockID const &id, CLHEP::HepRandomEngine *)
 
bool readOneSequential (EventPrincipal &cache)
 
bool readOneSequentialWithID (EventPrincipal &cache, LuminosityBlockID const &id)
 
void readOneSpecified (EventPrincipal &cache, EventID const &id)
 
void readRun_ (RunPrincipal &runPrincipal)
 
boost::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
ProcessingController::ReverseState reverseState () const
 
void rewind_ ()
 
 RootInputFileSequence (ParameterSet const &pset, PoolSource &input, InputFileCatalog const &catalog, unsigned int nStreams, InputType inputType)
 
 RootInputFileSequence (RootInputFileSequence const &)=delete
 
bool skipEvents (int offset)
 
bool skipToItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, bool currentFileFirst=true)
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
virtual ~RootInputFileSequence ()
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Member Functions

std::vector< FileCatalogItem >
const & 
fileCatalogItems () const
 
void initFile (bool skipBadFiles)
 
bool nextFile ()
 
bool previousFile ()
 
ProcessConfiguration const & processConfiguration () const
 
boost::shared_ptr
< ProductRegistry const > 
productRegistry () const
 
ProductRegistryproductRegistryUpdate () const
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void rewindFile ()
 

Private Attributes

BranchDescription::MatchMode branchesMustMatch_
 
InputFileCatalog const & catalog_
 
bool dropDescendants_
 
boost::shared_ptr
< DuplicateChecker
duplicateChecker_
 
bool enablePrefetching_
 
boost::shared_ptr
< EventSkipperByID
eventSkipperByID_
 
int eventsRemainingInFile_
 
std::vector< FileCatalogItem >
::const_iterator 
fileIter_
 
std::vector< FileCatalogItem >
::const_iterator 
fileIterBegin_
 
std::vector< FileCatalogItem >
::const_iterator 
fileIterEnd_
 
std::vector< FileCatalogItem >
::const_iterator 
fileIterLastOpened_
 
bool firstFile_
 
std::vector< boost::shared_ptr
< IndexIntoFile > > 
indexesIntoFiles_
 
int initialNumberOfEventsToSkip_
 
PoolSourceinput_
 
InputType inputType_
 
bool labelRawDataLikeMC_
 
std::string lfn_
 
bool noEventSort_
 
unsigned int nStreams_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
ProductSelectorRules productSelectorRules_
 
RootFileSharedPtr rootFile_
 
RunNumber_t setRun_
 
bool skipBadFiles_
 
unsigned int treeCacheSize_
 
int const treeMaxVirtualSize_
 
bool usedFallback_
 
bool usingGoToEvent_
 

Detailed Description

Definition at line 37 of file RootInputFileSequence.h.

Member Typedef Documentation

Definition at line 49 of file RootInputFileSequence.h.

Constructor & Destructor Documentation

edm::RootInputFileSequence::RootInputFileSequence ( ParameterSet const &  pset,
PoolSource input,
InputFileCatalog const &  catalog,
unsigned int  nStreams,
InputType  inputType 
)
explicit

Definition at line 27 of file RootInputFileSequence.cc.

References StorageFactory::activateTimeout(), branchesMustMatch_, enablePrefetching_, fileIter_, fileIterBegin_, fileIterEnd_, StorageFactory::get(), edm::ParameterSet::getUntrackedParameter(), initFile(), initialNumberOfEventsToSkip_, inputType_, edm::Service< T >::isAvailable(), edm::Primary, productRegistryUpdate(), rootFile_, edm::SecondarySource, skipBadFiles_, skipEvents(), StorageFactory::stagein(), edm::BranchDescription::Strict, AlCaHLTBitMon_QueryRunRegistry::string, treeCacheSize_, and edm::ProductRegistry::updateFromInput().

32  :
33  input_(input),
34  inputType_(inputType),
36  firstFile_(true),
37  lfn_("unknown"),
42  rootFile_(),
46  nStreams_(nStreams),
49  // The default value provided as the second argument to the getUntrackedParameter function call
50  // is not used when the ParameterSet has been validated and the parameters are not optional
51  // in the description. This is currently true when PoolSource is the primary input source.
52  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
53  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
54  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
55  // and should be deleted from the code.
56  initialNumberOfEventsToSkip_(inputType == InputType::Primary ? pset.getUntrackedParameter<unsigned int>("skipEvents", 0U) : 0U),
57  noEventSort_(inputType == InputType::Primary ? pset.getUntrackedParameter<bool>("noEventSort", true) : false),
58  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
59  treeCacheSize_(noEventSort_ ? pset.getUntrackedParameter<unsigned int>("cacheSize", roottree::defaultCacheSize) : 0U),
60  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
61  setRun_(pset.getUntrackedParameter<unsigned int>("setRunNumber", 0U)),
62  productSelectorRules_(pset, "inputCommands", "InputSource"),
63  duplicateChecker_(inputType == InputType::Primary ? new DuplicateChecker(pset) : 0),
64  dropDescendants_(pset.getUntrackedParameter<bool>("dropDescendantsOfDroppedBranches", inputType != InputType::SecondarySource)),
65  labelRawDataLikeMC_(pset.getUntrackedParameter<bool>("labelRawDataLikeMC", true)),
66  usingGoToEvent_(false),
67  enablePrefetching_(false),
68  usedFallback_(false) {
69 
70  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
72  if(pSLC.isAvailable()) {
73  if(treeCacheSize_ != 0U && pSLC->sourceTTreeCacheSize()) {
74  treeCacheSize_ = *(pSLC->sourceTTreeCacheSize());
75  }
76  enablePrefetching_ = pSLC->enablePrefetching();
77  }
78 
81  factory->activateTimeout(fileIter_->fileName());
82  factory->stagein(fileIter_->fileName());
83  //NOTE: we do not want to stage in all secondary files since we can be given a list of
84  // thousands of files and prestaging all those files can cause a site to fail.
85  // So, we stage in the first secondary file only.
87  break;
88  }
89  }
90 
91  std::string branchesMustMatch = pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
92  if(branchesMustMatch == std::string("strict")) branchesMustMatch_ = BranchDescription::Strict;
93 
96  if(rootFile_) break;
97  }
98  if(rootFile_) {
99  productRegistryUpdate().updateFromInput(rootFile_->productRegistry()->productList());
102  }
103  }
104  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void stagein(const std::string &url)
void initFile(bool skipBadFiles)
ProductSelectorRules productSelectorRules_
std::vector< FileCatalogItem >::const_iterator fileIter_
ProductRegistry & productRegistryUpdate() const
unsigned int const defaultCacheSize
Definition: RootTree.h:37
static std::string const input
Definition: EdmProvDump.cc:44
static StorageFactory * get(void)
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
std::vector< FileCatalogItem > const & fileCatalogItems() const
boost::shared_ptr< DuplicateChecker > duplicateChecker_
#define end
Definition: vmac.h:37
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
#define begin
Definition: vmac.h:30
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
void updateFromInput(ProductList const &other)
void activateTimeout(const std::string &url)
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
BranchDescription::MatchMode branchesMustMatch_
static std::auto_ptr< EventSkipperByID > create(ParameterSet const &pset)
tuple size
Write out results.
InputFileCatalog const & catalog_
edm::RootInputFileSequence::~RootInputFileSequence ( )
virtual

Definition at line 352 of file RootInputFileSequence.cc.

352  {
353  }
edm::RootInputFileSequence::RootInputFileSequence ( RootInputFileSequence const &  )
delete

Member Function Documentation

void edm::RootInputFileSequence::closeFile_ ( )

Definition at line 135 of file RootInputFileSequence.cc.

References duplicateChecker_, input_, inputType_, lfn_, edm::Primary, rootFile_, edm::SecondarySource, and usedFallback_.

Referenced by endJob(), initFile(), and rewind_().

135  {
136  // close the currently open file, if any, and delete the RootFile object.
137  if(rootFile_) {
139  std::unique_ptr<InputSource::FileCloseSentry>
140  sentry((inputType_ == InputType::Primary) ? new InputSource::FileCloseSentry(input_, lfn_, usedFallback_) : 0);
141  rootFile_->close();
142  if(duplicateChecker_) duplicateChecker_->inputFileClosed();
143  }
144  rootFile_.reset();
145  }
146  }
boost::shared_ptr< DuplicateChecker > duplicateChecker_
bool edm::RootInputFileSequence::containedInCurrentFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Definition at line 424 of file RootInputFileSequence.cc.

References rootFile_.

424  {
425  if(!rootFile_) return false;
426  return rootFile_->containsItem(run, lumi, event);
427  }
tuple lumi
Definition: fjr2json.py:35
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 edm::RootInputFileSequence::dropUnwantedBranches_ ( std::vector< std::string > const &  wantedBranches)

Definition at line 617 of file RootInputFileSequence.cc.

References edm::ParameterSet::addUntrackedParameter(), productSelectorRules_, cmsCodeRulesChecker::rules, and AlCaHLTBitMon_QueryRunRegistry::string.

617  {
618  std::vector<std::string> rules;
619  rules.reserve(wantedBranches.size() + 1);
620  rules.emplace_back("drop *");
621  for(std::string const& branch : wantedBranches) {
622  rules.push_back("keep " + branch + "_*");
623  }
624  ParameterSet pset;
625  pset.addUntrackedParameter("inputCommands", rules);
626  productSelectorRules_ = ProductSelectorRules(pset, "inputCommands", "InputSource");
627  }
ProductSelectorRules productSelectorRules_
void edm::RootInputFileSequence::endJob ( void  )

Definition at line 112 of file RootInputFileSequence.cc.

References closeFile_().

112  {
113  closeFile_();
114  }
boost::shared_ptr< BranchIDListHelper const > edm::RootInputFileSequence::fileBranchIDListHelper ( ) const

Definition at line 298 of file RootInputFileSequence.cc.

References rootFile_.

298  {
299  assert(rootFile_);
300  return rootFile_->branchIDListHelper();
301  }
std::vector< FileCatalogItem > const & edm::RootInputFileSequence::fileCatalogItems ( ) const
private

Definition at line 107 of file RootInputFileSequence.cc.

References catalog_, and edm::InputFileCatalog::fileCatalogItems().

Referenced by readOneRandom().

107  {
108  return catalog_.fileCatalogItems();
109  }
std::vector< FileCatalogItem > const & fileCatalogItems() const
InputFileCatalog const & catalog_
boost::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::fileProductRegistry ( ) const

Definition at line 292 of file RootInputFileSequence.cc.

References rootFile_.

292  {
293  assert(rootFile_);
294  return rootFile_->productRegistry();
295  }
void edm::RootInputFileSequence::fillDescription ( ParameterSetDescription desc)
static

Definition at line 779 of file RootInputFileSequence.cc.

References edm::ParameterSetDescription::addUntracked(), edm::roottree::defaultCacheSize, edm::EventSkipperByID::fillDescription(), edm::ProductSelectorRules::fillDescription(), edm::DuplicateChecker::fillDescription(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::PoolSource::fillDescriptions().

779  {
780  desc.addUntracked<unsigned int>("skipEvents", 0U)
781  ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed.");
782  desc.addUntracked<bool>("noEventSort", true)
783  ->setComment("True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n"
784  "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note 3).\n"
785  "Note 1: Events within the same lumi will always be processed contiguously.\n"
786  "Note 2: Lumis within the same run will always be processed contiguously.\n"
787  "Note 3: Any sorting occurs independently in each input file (no sorting across input files).");
788  desc.addUntracked<bool>("skipBadFiles", false)
789  ->setComment("True: Ignore any missing or unopenable input file.\n"
790  "False: Throw exception if missing or unopenable input file.");
791  desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize)
792  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
793  desc.addUntracked<int>("treeMaxVirtualSize", -1)
794  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
795  desc.addUntracked<unsigned int>("setRunNumber", 0U)
796  ->setComment("If non-zero, change number of first run to this number. Apply same offset to all runs. Allowed only for simulation.");
797  desc.addUntracked<bool>("dropDescendantsOfDroppedBranches", true)
798  ->setComment("If True, also drop on input any descendent of any branch dropped on input.");
799  std::string defaultString("permissive");
800  desc.addUntracked<std::string>("branchesMustMatch", defaultString)
801  ->setComment("'strict': Branches in each input file must match those in the first file.\n"
802  "'permissive': Branches in each input file may be any subset of those in the first file.");
803  desc.addUntracked<bool>("labelRawDataLikeMC", true)
804  ->setComment("If True: replace module label for raw data to match MC. Also use 'LHC' as process.");
805 
806  ProductSelectorRules::fillDescription(desc, "inputCommands");
809  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
static void fillDescription(ParameterSetDescription &desc)
unsigned int const defaultCacheSize
Definition: RootTree.h:37
static void fillDescription(ParameterSetDescription &desc)
ProcessingController::ForwardState edm::RootInputFileSequence::forwardState ( ) const
InputSource::ItemType edm::RootInputFileSequence::getNextItemType ( RunNumber_t run,
LuminosityBlockNumber_t lumi,
EventNumber_t event 
)

Definition at line 399 of file RootInputFileSequence.cc.

References fileIter_, fileIterEnd_, firstFile_, edm::InputSource::IsEvent, edm::InputSource::IsFile, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::InputSource::IsStop, edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, and rootFile_.

399  {
400  if(fileIter_ == fileIterEnd_) {
401  return InputSource::IsStop;
402  }
403  if(firstFile_) {
404  return InputSource::IsFile;
405  }
406  if(rootFile_) {
407  IndexIntoFile::EntryType entryType = rootFile_->getNextItemType(run, lumi, event);
408  if(entryType == IndexIntoFile::kEvent) {
409  return InputSource::IsEvent;
410  } else if(entryType == IndexIntoFile::kLumi) {
411  return InputSource::IsLumi;
412  } else if(entryType == IndexIntoFile::kRun) {
413  return InputSource::IsRun;
414  }
415  assert(entryType == IndexIntoFile::kEnd);
416  }
417  if(fileIter_ + 1 == fileIterEnd_) {
418  return InputSource::IsStop;
419  }
420  return InputSource::IsFile;
421  }
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
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
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
bool edm::RootInputFileSequence::goToEvent ( EventID const &  eventID)

Definition at line 476 of file RootInputFileSequence.cc.

References edm::EventID::event(), fileIter_, fileIterBegin_, newFWLiteAna::found, indexesIntoFiles_, initFile(), edm::EventID::luminosityBlock(), rootFile_, edm::EventID::run(), and usingGoToEvent_.

476  {
477  usingGoToEvent_ = true;
478  if(rootFile_) {
479  if(rootFile_->goToEvent(eventID)) {
480  return true;
481  }
482  // If only one input file, give up now, to save time.
483  if(rootFile_ && indexesIntoFiles_.size() == 1) {
484  return false;
485  }
486  // Save the current file and position so that we can restore them
487  // if we fail to restore the desired event
488  bool closedOriginalFile = false;
489  std::vector<FileCatalogItem>::const_iterator originalFile = fileIter_;
490  IndexIntoFile::IndexIntoFileItr originalPosition = rootFile_->indexIntoFileIter();
491 
492  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
493  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
494  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
495  if(*it && (*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
496  // We found it. Close the currently open file, and open the correct one.
497  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
498  initFile(false);
499  // Now get the item from the correct file.
500  assert(rootFile_);
501  bool found = rootFile_->goToEvent(eventID);
502  assert(found);
503  return true;
504  }
505  }
506  // Look for item in files not yet opened.
507  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
508  if(!*it) {
509  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
510  initFile(false);
511  closedOriginalFile = true;
512  if((*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
513  assert(rootFile_);
514  if(rootFile_->goToEvent(eventID)) {
515  return true;
516  }
517  }
518  }
519  }
520  if(closedOriginalFile) {
521  fileIter_ = originalFile;
522  initFile(false);
523  assert(rootFile_);
524  rootFile_->setPosition(originalPosition);
525  }
526  }
527  return false;
528  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
void edm::RootInputFileSequence::initFile ( bool  skipBadFiles)
private

Definition at line 148 of file RootInputFileSequence.cc.

References edm::InputSource::branchIDListHelper(), closeFile_(), dropDescendants_, duplicateChecker_, alignCSCRings::e, enablePrefetching_, eventSkipperByID_, edm::hlt::Exception, cms::Exception::explainSelf(), edm::errors::FallbackFileOpenError, fileIter_, fileIterBegin_, fileIterEnd_, fileIterLastOpened_, edm::errors::FileOpenError, indexesIntoFiles_, initialNumberOfEventsToSkip_, input_, RPC_Client_on_RootFile::InputFile, inputType_, labelRawDataLikeMC_, lfn_, noEventSort_, nStreams_, orderedProcessHistoryIDs_, dbtoconf::out, dbtoconf::pfn, edm::Primary, processConfiguration(), processHistoryRegistryForUpdate(), edm::InputSource::processingMode(), productSelectorRules_, remainingEvents(), remainingLuminosityBlocks(), edm::InputFile::reportFallbackAttempt(), edm::InputFile::reportSkippedFile(), rootFile_, edm::SecondaryFile, edm::SecondarySource, setRun_, AlCaHLTBitMon_QueryRunRegistry::string, treeCacheSize_, treeMaxVirtualSize_, usedFallback_, and usingGoToEvent_.

Referenced by goToEvent(), nextFile(), previousFile(), readFile_(), readOneRandom(), readOneSequential(), rewind_(), RootInputFileSequence(), skipToItem(), and skipToItemInNewFile().

148  {
149  // We are really going to close the open file.
150 
151  // If this is the primary sequence, we are not duplicate checking across files
152  // and we are not using random access to find events, then we can delete the
153  // IndexIntoFile for the file we are closing. If we can't delete all of it,
154  // then we can delete the parts we do not need.
156  size_t currentIndexIntoFile = fileIterLastOpened_ - fileIterBegin_;
157  bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled();
158  bool deleteIndexIntoFile = inputType_ == InputType::Primary &&
159  !needIndexesForDuplicateChecker &&
161  if(deleteIndexIntoFile) {
162  indexesIntoFiles_[currentIndexIntoFile].reset();
163  } else {
164  if(indexesIntoFiles_[currentIndexIntoFile]) indexesIntoFiles_[currentIndexIntoFile]->inputFileClosed();
165  }
167  }
168  closeFile_();
169 
170  if(fileIter_ == fileIterEnd_) {
171  // No files specified
172  return;
173  }
174 
175  // Check if the logical file name was found.
176  if(fileIter_->fileName().empty()) {
177  // LFN not found in catalog.
178  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
179  if(!skipBadFiles) {
180  throw cms::Exception("LogicalFileNameNotFound", "RootInputFileSequence::initFile()\n")
181  << "Logical file name '" << fileIter_->logicalFileName() << "' was not found in the file catalog.\n"
182  << "If you wanted a local file, you forgot the 'file:' prefix\n"
183  << "before the file name in your configuration file.\n";
184  }
185  LogWarning("") << "Input logical file: " << fileIter_->logicalFileName() << " was not found in the catalog, and will be skipped.\n";
186  return;
187  }
188 
189  lfn_ = fileIter_->logicalFileName().empty() ? fileIter_->fileName() : fileIter_->logicalFileName();
190  usedFallback_ = false;
191 
192  // Determine whether we have a fallback URL specified; if so, prepare it;
193  // Only valid if it is non-empty and differs from the original filename.
194  std::string fallbackName = fileIter_->fallbackFileName();
195  bool hasFallbackUrl = !fallbackName.empty() && fallbackName != fileIter_->fileName();
196 
197  boost::shared_ptr<InputFile> filePtr;
198  try {
199  std::unique_ptr<InputSource::FileOpenSentry>
200  sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_, lfn_, usedFallback_) : 0);
201  filePtr.reset(new InputFile(gSystem->ExpandPathName(fileIter_->fileName().c_str()), " Initiating request to open file ", inputType_));
202  }
203  catch (cms::Exception const& e) {
204  if(!skipBadFiles) {
205  if(hasFallbackUrl) {
206  std::ostringstream out;
207  out << e.explainSelf();
208  std::string pfn(gSystem->ExpandPathName(fallbackName.c_str()));
209  InputFile::reportFallbackAttempt(pfn, fileIter_->logicalFileName(), out.str());
210  } else {
211  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
212  Exception ex(errors::FileOpenError, "", e);
213  ex.addContext("Calling RootInputFileSequence::initFile()");
214  std::ostringstream out;
215  out << "Input file " << fileIter_->fileName() << " could not be opened.";
216  ex.addAdditionalInfo(out.str());
217  throw ex;
218  }
219  }
220  }
221  if(!filePtr && (hasFallbackUrl)) {
222  try {
223  usedFallback_ = true;
224  std::unique_ptr<InputSource::FileOpenSentry>
225  sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_, lfn_, usedFallback_) : 0);
226  filePtr.reset(new InputFile(gSystem->ExpandPathName(fallbackName.c_str()), " Fallback request to file ", inputType_));
227  }
228  catch (cms::Exception const& e) {
229  if(!skipBadFiles) {
230  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
232  ex.addContext("Calling RootInputFileSequence::initFile()");
233  std::ostringstream out;
234  out << "Input file " << fileIter_->fileName() << " could not be opened.\n";
235  out << "Fallback Input file " << fallbackName << " also could not be opened.";
236  ex.addAdditionalInfo(out.str());
237  throw ex;
238  }
239  }
240  }
241  if(filePtr) {
242  std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile = fileIter_ - fileIterBegin_;
243  rootFile_ = RootFileSharedPtr(new RootFile(
244  fileIter_->fileName(),
246  fileIter_->logicalFileName(),
247  filePtr,
250  remainingEvents(),
252  nStreams_,
256  setRun_,
257  noEventSort_,
259  inputType_,
260  (inputType_ == InputType::SecondarySource ? boost::shared_ptr<BranchIDListHelper>(new BranchIDListHelper()) : input_.branchIDListHelper()),
265  currentIndexIntoFile,
270 
271  assert(rootFile_);
273  indexesIntoFiles_[currentIndexIntoFile] = rootFile_->indexIntoFileSharedPtr();
274  char const* inputType = 0;
275  switch(inputType_) {
276  case InputType::Primary: inputType = "primaryFiles"; break;
277  case InputType::SecondaryFile: inputType = "secondaryFiles"; break;
278  case InputType::SecondarySource: inputType = "mixingFiles"; break;
279  }
280  rootFile_->reportOpened(inputType);
281  } else {
282  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
283  if(!skipBadFiles) {
285  "RootInputFileSequence::initFile(): Input file " << fileIter_->fileName() << " was not found or could not be opened.\n";
286  }
287  LogWarning("") << "Input file: " << fileIter_->fileName() << " was not found or could not be opened, and will be skipped.\n";
288  }
289  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
list pfn
Definition: dbtoconf.py:76
ProductSelectorRules productSelectorRules_
ProcessConfiguration const & processConfiguration() const
virtual std::string explainSelf() const
Definition: Exception.cc:146
std::vector< FileCatalogItem >::const_iterator fileIter_
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:253
uint16_t size_type
tuple InputFile
Open Root file and provide MEs ############.
static void reportFallbackAttempt(std::string const &pfn, std::string const &logicalFileName, std::string const &errorMessage)
Definition: InputFile.cc:79
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
boost::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:177
boost::shared_ptr< DuplicateChecker > duplicateChecker_
static void reportSkippedFile(std::string const &fileName, std::string const &logicalFileName)
Definition: InputFile.cc:73
tuple out
Definition: dbtoconf.py:99
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
tuple skipBadFiles
Definition: example_cfg.py:64
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
boost::shared_ptr< RootFile > RootFileSharedPtr
bool edm::RootInputFileSequence::nextFile ( )
private

Definition at line 303 of file RootInputFileSequence.cc.

References branchesMustMatch_, edm::hlt::Exception, fileIter_, fileIterBegin_, fileIterEnd_, initFile(), inputType_, edm::ProductRegistry::merge(), edm::errors::MismatchedInputFiles, edm::Primary, productRegistryUpdate(), rootFile_, skipBadFiles_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by readFile_(), and skipEvents().

303  {
305  if(fileIter_ == fileIterEnd_) {
307  return false;
308  } else {
310  }
311  }
312 
314 
316  // make sure the new product registry is compatible with the main one
317  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
318  fileIter_->fileName(),
320  if(!mergeInfo.empty()) {
321  throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::nextFile()") << mergeInfo;
322  }
323  }
324  return true;
325  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
ProductRegistry & productRegistryUpdate() const
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
BranchDescription::MatchMode branchesMustMatch_
RootInputFileSequence& edm::RootInputFileSequence::operator= ( RootInputFileSequence const &  )
delete
bool edm::RootInputFileSequence::previousFile ( )
private

Definition at line 327 of file RootInputFileSequence.cc.

References branchesMustMatch_, edm::hlt::Exception, fileIter_, fileIterBegin_, fileIterEnd_, initFile(), inputType_, edm::ProductRegistry::merge(), edm::errors::MismatchedInputFiles, edm::Primary, productRegistryUpdate(), rootFile_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by skipEvents().

327  {
328  if(fileIter_ == fileIterBegin_) {
330  return false;
331  } else {
333  }
334  }
335  --fileIter_;
336 
337  initFile(false);
338 
340  // make sure the new product registry is compatible to the main one
341  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
342  fileIter_->fileName(),
344  if(!mergeInfo.empty()) {
345  throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::previousEvent()") << mergeInfo;
346  }
347  }
348  if(rootFile_) rootFile_->setToLastEntry();
349  return true;
350  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
ProductRegistry & productRegistryUpdate() const
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
BranchDescription::MatchMode branchesMustMatch_
ProcessConfiguration const & edm::RootInputFileSequence::processConfiguration ( ) const
private

Definition at line 592 of file RootInputFileSequence.cc.

References input_, and edm::InputSource::processConfiguration().

Referenced by initFile().

592  {
593  return input_.processConfiguration();
594  }
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:208
ProcessHistoryRegistry const & edm::RootInputFileSequence::processHistoryRegistry ( ) const

Definition at line 582 of file RootInputFileSequence.cc.

References input_, and edm::InputSource::processHistoryRegistry().

582  {
584  }
ProcessHistoryRegistry const & processHistoryRegistry() const
Const accessor for process history registry.
Definition: InputSource.h:171
ProcessHistoryRegistry & edm::RootInputFileSequence::processHistoryRegistryForUpdate ( )

Definition at line 587 of file RootInputFileSequence.cc.

References input_, and edm::InputSource::processHistoryRegistryForUpdate().

Referenced by initFile().

587  {
589  }
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Non-const accessor for process history registry.
Definition: InputSource.h:174
boost::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::productRegistry ( ) const
private

Definition at line 612 of file RootInputFileSequence.cc.

References input_, and edm::InputSource::productRegistry().

612  {
613  return input_.productRegistry();
614  }
boost::shared_ptr< ProductRegistry const > productRegistry() const
Accessor for product registry.
Definition: InputSource.h:168
ProductRegistry & edm::RootInputFileSequence::productRegistryUpdate ( ) const
private

Definition at line 607 of file RootInputFileSequence.cc.

References input_, and edm::InputSource::productRegistryUpdate().

Referenced by nextFile(), previousFile(), and RootInputFileSequence().

607  {
608  return input_.productRegistryUpdate();
609  }
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:347
void edm::RootInputFileSequence::readEvent ( EventPrincipal cache)

Definition at line 393 of file RootInputFileSequence.cc.

References rootFile_.

393  {
394  assert(rootFile_);
395  rootFile_->readEvent(eventPrincipal);
396  }
std::unique_ptr< FileBlock > edm::RootInputFileSequence::readFile_ ( )

Definition at line 117 of file RootInputFileSequence.cc.

References firstFile_, initFile(), nextFile(), rootFile_, and skipBadFiles_.

117  {
118  if(firstFile_) {
119  // The first input file has already been opened.
120  firstFile_ = false;
121  if(!rootFile_) {
123  }
124  } else {
125  if(!nextFile()) {
126  assert(0);
127  }
128  }
129  if(!rootFile_) {
130  return std::unique_ptr<FileBlock>(new FileBlock);
131  }
132  return rootFile_->createFileBlock();
133  }
void initFile(bool skipBadFiles)
void edm::RootInputFileSequence::readLuminosityBlock_ ( LuminosityBlockPrincipal lumiPrincipal)

Definition at line 374 of file RootInputFileSequence.cc.

References rootFile_.

374  {
375  assert(rootFile_);
376  rootFile_->readLuminosityBlock_(lumiPrincipal);
377  }
boost::shared_ptr< LuminosityBlockAuxiliary > edm::RootInputFileSequence::readLuminosityBlockAuxiliary_ ( )

Definition at line 362 of file RootInputFileSequence.cc.

References rootFile_.

362  {
363  assert(rootFile_);
364  return rootFile_->readLuminosityBlockAuxiliary_();
365  }
void edm::RootInputFileSequence::readOneRandom ( EventPrincipal cache,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 704 of file RootInputFileSequence.cc.

References edm::errors::Configuration, eventsRemainingInFile_, edm::hlt::Exception, fileCatalogItems(), fileIter_, fileIterBegin_, fileIterEnd_, newFWLiteAna::found, initFile(), edm::errors::NotFound, rootFile_, findQualityFiles::size, and skipBadFiles_.

704  {
706  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandom(): no input files specified for secondary input source.\n";
707  }
708  assert(rootFile_);
709  skipBadFiles_ = false;
710  unsigned int currentSeqNumber = fileIter_ - fileIterBegin_;
711  while(eventsRemainingInFile_ == 0) {
712 
713  fileIter_ = fileIterBegin_ + CLHEP::RandFlat::shootInt(engine, fileCatalogItems().size());
714  unsigned int newSeqNumber = fileIter_ - fileIterBegin_;
715  if(newSeqNumber != currentSeqNumber) {
716  initFile(false);
717  currentSeqNumber = newSeqNumber;
718  }
719  eventsRemainingInFile_ = rootFile_->eventTree().entries();
720  if(eventsRemainingInFile_ == 0) {
721  throw Exception(errors::NotFound) <<
722  "RootInputFileSequence::readOneRandom(): Secondary Input file " << fileIter_->fileName() << " contains no events.\n";
723  }
724  rootFile_->setAtEventEntry(CLHEP::RandFlat::shootInt(engine, eventsRemainingInFile_) - 1);
725  }
726  rootFile_->nextEventEntry();
727 
728  bool found = rootFile_->readCurrentEvent(cache);
729  if(!found) {
730  rootFile_->setAtEventEntry(0);
731  bool found = rootFile_->readCurrentEvent(cache);
732  assert(found);
733  }
735  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem > const & fileCatalogItems() const
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
tuple size
Write out results.
bool edm::RootInputFileSequence::readOneRandomWithID ( EventPrincipal cache,
LuminosityBlockID const &  id,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 740 of file RootInputFileSequence.cc.

References edm::errors::Configuration, edm::hlt::Exception, fileIter_, fileIterBegin_, fileIterEnd_, newFWLiteAna::found, i, rootFile_, DTTTrigCorrFirst::run, skipBadFiles_, and skipToItem().

740  {
742  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandomWithID(): no input files specified for secondary input source.\n";
743  }
744  skipBadFiles_ = false;
745  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
746  rootFile_->indexIntoFileIter().run() != id.run() ||
747  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
748  bool found = skipToItem(id.run(), id.luminosityBlock(), 0);
749  if(!found) {
750  return false;
751  }
752  int eventsInLumi = 0;
753  assert(rootFile_);
754  while(rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock())) ++eventsInLumi;
755  found = skipToItem(id.run(), id.luminosityBlock(), 0);
756  assert(found);
757  int eventInLumi = CLHEP::RandFlat::shootInt(engine, eventsInLumi);
758  for(int i = 0; i < eventInLumi; ++i) {
759  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
760  assert(found);
761  }
762  }
763  assert(rootFile_);
764  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
765  if(found) {
766  found = rootFile_->readCurrentEvent(cache);
767  }
768  if(!found) {
769  bool found = rootFile_->setEntryAtItem(id.run(), id.luminosityBlock(), 0);
770  if(!found) {
771  return false;
772  }
773  return readOneRandomWithID(cache, id, engine);
774  }
775  return true;
776  }
int i
Definition: DBlmapReader.cc:9
bool readOneRandomWithID(EventPrincipal &cache, LuminosityBlockID const &id, CLHEP::HepRandomEngine *)
std::vector< FileCatalogItem >::const_iterator fileIter_
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, bool currentFileFirst=true)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
bool edm::RootInputFileSequence::readOneSequential ( EventPrincipal cache)

Definition at line 630 of file RootInputFileSequence.cc.

References edm::errors::Configuration, edm::hlt::Exception, fileIter_, fileIterBegin_, fileIterEnd_, newFWLiteAna::found, initFile(), edm::IndexIntoFile::invalidEntry, rootFile_, and skipBadFiles_.

630  {
631  skipBadFiles_ = false;
632  if(fileIter_ == fileIterEnd_ || !rootFile_) {
634  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified for secondary input source.\n";
635  }
637  initFile(false);
638  assert(rootFile_);
639  rootFile_->setAtEventEntry(IndexIntoFile::invalidEntry);
640  }
641  assert(rootFile_);
642  rootFile_->nextEventEntry();
643  bool found = rootFile_->readCurrentEvent(cache);
644  if(!found) {
645  ++fileIter_;
646  if(fileIter_ == fileIterEnd_) {
647  return false;
648  }
649  initFile(false);
650  assert(rootFile_);
651  rootFile_->setAtEventEntry(IndexIntoFile::invalidEntry);
652  return readOneSequential(cache);
653  }
654  return true;
655  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
bool readOneSequential(EventPrincipal &cache)
static EntryNumber_t const invalidEntry
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
bool edm::RootInputFileSequence::readOneSequentialWithID ( EventPrincipal cache,
LuminosityBlockID const &  id 
)

Definition at line 658 of file RootInputFileSequence.cc.

References edm::errors::Configuration, edm::hlt::Exception, fileIter_, fileIterBegin_, fileIterEnd_, newFWLiteAna::found, rootFile_, DTTTrigCorrFirst::run, skipBadFiles_, skipToItem(), and skipToItemInNewFile().

658  {
660  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequentialWithID(): no input files specified for secondary input source.\n";
661  }
662  skipBadFiles_ = false;
663  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
664  rootFile_->indexIntoFileIter().run() != id.run() ||
665  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
666  bool found = skipToItem(id.run(), id.luminosityBlock(), 0, false);
667  if(!found) {
668  return false;
669  }
670  }
671  assert(rootFile_);
672  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
673  if(found) {
674  found = rootFile_->readCurrentEvent(cache);
675  }
676  if(!found) {
677  found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0);
678  if(!found) {
679  return false;
680  }
681  return readOneSequentialWithID(cache, id);
682  }
683  return true;
684  }
std::vector< FileCatalogItem >::const_iterator fileIter_
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, bool currentFileFirst=true)
bool readOneSequentialWithID(EventPrincipal &cache, LuminosityBlockID const &id)
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
void edm::RootInputFileSequence::readOneSpecified ( EventPrincipal cache,
EventID const &  id 
)

Definition at line 687 of file RootInputFileSequence.cc.

References edm::errors::Configuration, event(), edm::hlt::Exception, fileIterBegin_, fileIterEnd_, newFWLiteAna::found, edm::errors::NotFound, rootFile_, DTTTrigCorrFirst::run, skipBadFiles_, and skipToItem().

687  {
689  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSpecified(): no input files specified for secondary input source.\n";
690  }
691  skipBadFiles_ = false;
692  bool found = skipToItem(id.run(), id.luminosityBlock(), id.event());
693  if(!found) {
694  throw Exception(errors::NotFound) <<
695  "RootInputFileSequence::readOneSpecified(): Secondary Input files" <<
696  " do not contain specified event:\n" << id << "\n";
697  }
698  assert(rootFile_);
699  found = rootFile_->readCurrentEvent(cache);
700  assert(found);
701  }
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, bool currentFileFirst=true)
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
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
void edm::RootInputFileSequence::readRun_ ( RunPrincipal runPrincipal)

Definition at line 368 of file RootInputFileSequence.cc.

References rootFile_.

368  {
369  assert(rootFile_);
370  rootFile_->readRun_(runPrincipal);
371  }
boost::shared_ptr< RunAuxiliary > edm::RootInputFileSequence::readRunAuxiliary_ ( )

Definition at line 356 of file RootInputFileSequence.cc.

References rootFile_.

356  {
357  assert(rootFile_);
358  return rootFile_->readRunAuxiliary_();
359  }
int edm::RootInputFileSequence::remainingEvents ( ) const
private

Definition at line 597 of file RootInputFileSequence.cc.

References input_, and edm::InputSource::remainingEvents().

Referenced by initFile().

597  {
598  return input_.remainingEvents();
599  }
int remainingEvents() const
Definition: InputSource.h:194
int edm::RootInputFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 602 of file RootInputFileSequence.cc.

References input_, and edm::InputSource::remainingLuminosityBlocks().

Referenced by initFile().

602  {
604  }
int remainingLuminosityBlocks() const
Definition: InputSource.h:202
ProcessingController::ReverseState edm::RootInputFileSequence::reverseState ( ) const
void edm::RootInputFileSequence::rewind_ ( )

Definition at line 431 of file RootInputFileSequence.cc.

References closeFile_(), fileIter_, fileIterBegin_, firstFile_, initFile(), initialNumberOfEventsToSkip_, rewindFile(), rootFile_, and skipEvents().

431  {
432  if(fileIter_ != fileIterBegin_) {
433  closeFile_();
435  }
436  if(!rootFile_) {
437  initFile(false);
438  }
439  rewindFile();
440  firstFile_ = true;
441  if(rootFile_) {
444  }
445  }
446  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
void edm::RootInputFileSequence::rewindFile ( )
private

Definition at line 450 of file RootInputFileSequence.cc.

References rootFile_.

Referenced by rewind_().

450  {
451  if(rootFile_) rootFile_->rewind();
452  }
bool edm::RootInputFileSequence::skipEvents ( int  offset)

Definition at line 456 of file RootInputFileSequence.cc.

References fileIter_, fileIterEnd_, inputType_, nextFile(), previousFile(), rootFile_, and edm::SecondaryFile.

Referenced by rewind_(), and RootInputFileSequence().

456  {
457  // We never call skipEvents for secondary input files. If we did,
458  // we would have to implement synchronization if a new file is opened.
459  // To avoid this, just assert.
461  assert(rootFile_);
462  while(offset != 0) {
463  bool atEnd = rootFile_->skipEvents(offset);
464  if((offset > 0 || atEnd) && !nextFile()) {
465  return false;
466  }
467  if(offset < 0 && !previousFile()) {
469  return false;
470  }
471  }
472  return true;
473  }
std::vector< FileCatalogItem >::const_iterator fileIter_
unsigned int offset(bool)
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
bool edm::RootInputFileSequence::skipToItem ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
bool  currentFileFirst = true 
)

Definition at line 550 of file RootInputFileSequence.cc.

References fileIter_, fileIterBegin_, newFWLiteAna::found, indexesIntoFiles_, initFile(), rootFile_, and skipToItemInNewFile().

Referenced by readOneRandomWithID(), readOneSequentialWithID(), and readOneSpecified().

550  {
551  // Attempt to find item in currently open input file.
552  bool found = currentFileFirst && rootFile_ && rootFile_->setEntryAtItem(run, lumi, event);
553  if(!found) {
554  // If only one input file, give up now, to save time.
555  if(currentFileFirst && rootFile_ && indexesIntoFiles_.size() == 1) {
556  return false;
557  }
558  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
559  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
560  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
561  if(*it && (*it)->containsItem(run, lumi, event)) {
562  // We found it. Close the currently open file, and open the correct one.
563  std::vector<FileCatalogItem>::const_iterator currentIter = fileIter_;
564  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
565  if(fileIter_ != currentIter) {
566  initFile(false);
567  }
568  // Now get the item from the correct file.
569  assert(rootFile_);
570  found = rootFile_->setEntryAtItem(run, lumi, event);
571  assert(found);
572  return true;
573  }
574  }
575  // Look for item in files not yet opened.
576  return skipToItemInNewFile(run, lumi, event);
577  }
578  return true;
579  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
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
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
bool edm::RootInputFileSequence::skipToItemInNewFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
)

Definition at line 531 of file RootInputFileSequence.cc.

References fileIter_, fileIterBegin_, newFWLiteAna::found, indexesIntoFiles_, initFile(), and rootFile_.

Referenced by readOneSequentialWithID(), and skipToItem().

531  {
532  // Look for item in files not yet opened.
533  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
534  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
535  if(!*it) {
536  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
537  initFile(false);
538  assert(rootFile_);
539  bool found = rootFile_->setEntryAtItem(run, lumi, event);
540  if(found) {
541  return true;
542  }
543  }
544  }
545  // Not found
546  return false;
547  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
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
std::vector< FileCatalogItem >::const_iterator fileIterBegin_

Member Data Documentation

BranchDescription::MatchMode edm::RootInputFileSequence::branchesMustMatch_
private

Definition at line 102 of file RootInputFileSequence.h.

Referenced by nextFile(), previousFile(), and RootInputFileSequence().

InputFileCatalog const& edm::RootInputFileSequence::catalog_
private

Definition at line 94 of file RootInputFileSequence.h.

Referenced by fileCatalogItems().

bool edm::RootInputFileSequence::dropDescendants_
private

Definition at line 118 of file RootInputFileSequence.h.

Referenced by initFile().

boost::shared_ptr<DuplicateChecker> edm::RootInputFileSequence::duplicateChecker_
private

Definition at line 117 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::enablePrefetching_
private

Definition at line 121 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

boost::shared_ptr<EventSkipperByID> edm::RootInputFileSequence::eventSkipperByID_
private

Definition at line 108 of file RootInputFileSequence.h.

Referenced by initFile().

int edm::RootInputFileSequence::eventsRemainingInFile_
private

Definition at line 109 of file RootInputFileSequence.h.

Referenced by readOneRandom().

std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIter_
private
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIterBegin_
private
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIterEnd_
private
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIterLastOpened_
private

Definition at line 100 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::firstFile_
private

Definition at line 95 of file RootInputFileSequence.h.

Referenced by getNextItemType(), readFile_(), and rewind_().

std::vector<boost::shared_ptr<IndexIntoFile> > edm::RootInputFileSequence::indexesIntoFiles_
private

Definition at line 104 of file RootInputFileSequence.h.

Referenced by goToEvent(), initFile(), skipToItem(), and skipToItemInNewFile().

int edm::RootInputFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 110 of file RootInputFileSequence.h.

Referenced by initFile(), rewind_(), and RootInputFileSequence().

PoolSource& edm::RootInputFileSequence::input_
private
InputType edm::RootInputFileSequence::inputType_
private
bool edm::RootInputFileSequence::labelRawDataLikeMC_
private

Definition at line 119 of file RootInputFileSequence.h.

Referenced by initFile().

std::string edm::RootInputFileSequence::lfn_
private

Definition at line 96 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::noEventSort_
private

Definition at line 111 of file RootInputFileSequence.h.

Referenced by initFile().

unsigned int edm::RootInputFileSequence::nStreams_
private

Definition at line 107 of file RootInputFileSequence.h.

Referenced by initFile().

std::vector<ProcessHistoryID> edm::RootInputFileSequence::orderedProcessHistoryIDs_
private

Definition at line 105 of file RootInputFileSequence.h.

Referenced by initFile().

ProductSelectorRules edm::RootInputFileSequence::productSelectorRules_
private

Definition at line 116 of file RootInputFileSequence.h.

Referenced by dropUnwantedBranches_(), and initFile().

RootFileSharedPtr edm::RootInputFileSequence::rootFile_
private
RunNumber_t edm::RootInputFileSequence::setRun_
private

Definition at line 115 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::skipBadFiles_
private
unsigned int edm::RootInputFileSequence::treeCacheSize_
private

Definition at line 113 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

int const edm::RootInputFileSequence::treeMaxVirtualSize_
private

Definition at line 114 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::usedFallback_
private

Definition at line 122 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::usingGoToEvent_
private

Definition at line 120 of file RootInputFileSequence.h.

Referenced by goToEvent(), and initFile().