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 std::shared_ptr< RootFileRootFileSharedPtr
 

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 ()
 
std::shared_ptr
< BranchIDListHelper const > 
fileBranchIDListHelper () const
 
std::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)
 
void initAssociationsFromSecondary (std::set< BranchID > const &)
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
ProcessHistoryRegistry const & processHistoryRegistry () const
 
ProcessHistoryRegistryprocessHistoryRegistryForUpdate ()
 
void readEvent (EventPrincipal &cache)
 
std::unique_ptr< FileBlockreadFile_ ()
 
void readLuminosityBlock_ (LuminosityBlockPrincipal &lumiPrincipal)
 
std::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)
 
std::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
 
std::shared_ptr
< ProductRegistry const > 
productRegistry () const
 
ProductRegistryproductRegistryUpdate () const
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void rewindFile ()
 

Private Attributes

std::vector< BranchIDassociationsFromSecondary_
 
BranchDescription::MatchMode branchesMustMatch_
 
bool bypassVersionCheck_
 
InputFileCatalog const & catalog_
 
bool dropDescendants_
 
std::shared_ptr< DuplicateCheckerduplicateChecker_
 
bool enablePrefetching_
 
std::shared_ptr< EventSkipperByIDeventSkipperByID_
 
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< std::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 39 of file RootInputFileSequence.h.

Member Typedef Documentation

Definition at line 51 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 28 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().

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

360  {
361  }
edm::RootInputFileSequence::RootInputFileSequence ( RootInputFileSequence const &  )
delete

Member Function Documentation

void edm::RootInputFileSequence::closeFile_ ( )

Definition at line 137 of file RootInputFileSequence.cc.

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

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

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

Definition at line 432 of file RootInputFileSequence.cc.

References rootFile_.

432  {
433  if(!rootFile_) return false;
434  return rootFile_->containsItem(run, lumi, event);
435  }
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 625 of file RootInputFileSequence.cc.

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

625  {
626  std::vector<std::string> rules;
627  rules.reserve(wantedBranches.size() + 1);
628  rules.emplace_back("drop *");
629  for(std::string const& branch : wantedBranches) {
630  rules.push_back("keep " + branch + "_*");
631  }
632  ParameterSet pset;
633  pset.addUntrackedParameter("inputCommands", rules);
634  productSelectorRules_ = ProductSelectorRules(pset, "inputCommands", "InputSource");
635  }
ProductSelectorRules productSelectorRules_
void edm::RootInputFileSequence::endJob ( void  )

Definition at line 114 of file RootInputFileSequence.cc.

References closeFile_().

114  {
115  closeFile_();
116  }
std::shared_ptr< BranchIDListHelper const > edm::RootInputFileSequence::fileBranchIDListHelper ( ) const

Definition at line 306 of file RootInputFileSequence.cc.

References rootFile_.

306  {
307  assert(rootFile_);
308  return rootFile_->branchIDListHelper();
309  }
std::vector< FileCatalogItem > const & edm::RootInputFileSequence::fileCatalogItems ( ) const
private

Definition at line 109 of file RootInputFileSequence.cc.

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

Referenced by readOneRandom().

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

Definition at line 300 of file RootInputFileSequence.cc.

References rootFile_.

300  {
301  assert(rootFile_);
302  return rootFile_->productRegistry();
303  }
void edm::RootInputFileSequence::fillDescription ( ParameterSetDescription desc)
static

Definition at line 787 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().

787  {
788  desc.addUntracked<unsigned int>("skipEvents", 0U)
789  ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed.");
790  desc.addUntracked<bool>("noEventSort", true)
791  ->setComment("True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n"
792  "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note 3).\n"
793  "Note 1: Events within the same lumi will always be processed contiguously.\n"
794  "Note 2: Lumis within the same run will always be processed contiguously.\n"
795  "Note 3: Any sorting occurs independently in each input file (no sorting across input files).");
796  desc.addUntracked<bool>("skipBadFiles", false)
797  ->setComment("True: Ignore any missing or unopenable input file.\n"
798  "False: Throw exception if missing or unopenable input file.");
799  desc.addUntracked<bool>("bypassVersionCheck", false)
800  ->setComment("True: Bypass release version check.\n"
801  "False: Throw exception if reading file in a release prior to the release in which the file was written.");
802  desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize)
803  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
804  desc.addUntracked<int>("treeMaxVirtualSize", -1)
805  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
806  desc.addUntracked<unsigned int>("setRunNumber", 0U)
807  ->setComment("If non-zero, change number of first run to this number. Apply same offset to all runs. Allowed only for simulation.");
808  desc.addUntracked<bool>("dropDescendantsOfDroppedBranches", true)
809  ->setComment("If True, also drop on input any descendent of any branch dropped on input.");
810  std::string defaultString("permissive");
811  desc.addUntracked<std::string>("branchesMustMatch", defaultString)
812  ->setComment("'strict': Branches in each input file must match those in the first file.\n"
813  "'permissive': Branches in each input file may be any subset of those in the first file.");
814  desc.addUntracked<bool>("labelRawDataLikeMC", true)
815  ->setComment("If True: replace module label for raw data to match MC. Also use 'LHC' as process.");
816 
817  ProductSelectorRules::fillDescription(desc, "inputCommands");
820  }
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 407 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_.

407  {
408  if(fileIter_ == fileIterEnd_) {
409  return InputSource::IsStop;
410  }
411  if(firstFile_) {
412  return InputSource::IsFile;
413  }
414  if(rootFile_) {
415  IndexIntoFile::EntryType entryType = rootFile_->getNextItemType(run, lumi, event);
416  if(entryType == IndexIntoFile::kEvent) {
417  return InputSource::IsEvent;
418  } else if(entryType == IndexIntoFile::kLumi) {
419  return InputSource::IsLumi;
420  } else if(entryType == IndexIntoFile::kRun) {
421  return InputSource::IsRun;
422  }
423  assert(entryType == IndexIntoFile::kEnd);
424  }
425  if(fileIter_ + 1 == fileIterEnd_) {
426  return InputSource::IsStop;
427  }
428  return InputSource::IsFile;
429  }
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 484 of file RootInputFileSequence.cc.

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

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

Definition at line 852 of file RootInputFileSequence.cc.

References associationsFromSecondary_, and rootFile_.

852  {
853  for(auto const& branchID : associationsFromSecondary) {
854  associationsFromSecondary_.push_back(branchID);
855  }
856  rootFile_->initAssociationsFromSecondary(associationsFromSecondary_);
857  }
std::vector< BranchID > associationsFromSecondary_
void edm::RootInputFileSequence::initFile ( bool  skipBadFiles)
private

Definition at line 150 of file RootInputFileSequence.cc.

References StorageFactory::activateTimeout(), associationsFromSecondary_, edm::InputSource::branchIDListHelper(), bypassVersionCheck_, closeFile_(), dropDescendants_, duplicateChecker_, alignCSCRings::e, enablePrefetching_, eventSkipperByID_, edm::hlt::Exception, cms::Exception::explainSelf(), edm::errors::FallbackFileOpenError, fileIter_, fileIterBegin_, fileIterEnd_, fileIterLastOpened_, edm::errors::FileOpenError, StorageFactory::get(), 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, edm::InputSource::thinnedAssociationsHelper(), treeCacheSize_, treeMaxVirtualSize_, usedFallback_, and usingGoToEvent_.

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

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

Definition at line 311 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().

311  {
313  if(fileIter_ == fileIterEnd_) {
315  return false;
316  } else {
318  }
319  }
320 
322 
324  // make sure the new product registry is compatible with the main one
325  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
326  fileIter_->fileName(),
328  if(!mergeInfo.empty()) {
329  throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::nextFile()") << mergeInfo;
330  }
331  }
332  return true;
333  }
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 335 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().

335  {
336  if(fileIter_ == fileIterBegin_) {
338  return false;
339  } else {
341  }
342  }
343  --fileIter_;
344 
345  initFile(false);
346 
348  // make sure the new product registry is compatible to the main one
349  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
350  fileIter_->fileName(),
352  if(!mergeInfo.empty()) {
353  throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::previousEvent()") << mergeInfo;
354  }
355  }
356  if(rootFile_) rootFile_->setToLastEntry();
357  return true;
358  }
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 600 of file RootInputFileSequence.cc.

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

Referenced by initFile().

600  {
601  return input_.processConfiguration();
602  }
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:212
ProcessHistoryRegistry const & edm::RootInputFileSequence::processHistoryRegistry ( ) const

Definition at line 590 of file RootInputFileSequence.cc.

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

590  {
592  }
ProcessHistoryRegistry const & processHistoryRegistry() const
Const accessor for process history registry.
Definition: InputSource.h:172
ProcessHistoryRegistry & edm::RootInputFileSequence::processHistoryRegistryForUpdate ( )

Definition at line 595 of file RootInputFileSequence.cc.

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

Referenced by initFile().

595  {
597  }
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Non-const accessor for process history registry.
Definition: InputSource.h:175
std::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::productRegistry ( ) const
private

Definition at line 620 of file RootInputFileSequence.cc.

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

620  {
621  return input_.productRegistry();
622  }
std::shared_ptr< ProductRegistry const > productRegistry() const
Accessor for product registry.
Definition: InputSource.h:169
ProductRegistry & edm::RootInputFileSequence::productRegistryUpdate ( ) const
private

Definition at line 615 of file RootInputFileSequence.cc.

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

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

615  {
616  return input_.productRegistryUpdate();
617  }
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:351
void edm::RootInputFileSequence::readEvent ( EventPrincipal cache)

Definition at line 401 of file RootInputFileSequence.cc.

References rootFile_.

401  {
402  assert(rootFile_);
403  rootFile_->readEvent(eventPrincipal);
404  }
std::unique_ptr< FileBlock > edm::RootInputFileSequence::readFile_ ( )

Definition at line 119 of file RootInputFileSequence.cc.

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

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

Definition at line 382 of file RootInputFileSequence.cc.

References rootFile_.

382  {
383  assert(rootFile_);
384  rootFile_->readLuminosityBlock_(lumiPrincipal);
385  }
std::shared_ptr< LuminosityBlockAuxiliary > edm::RootInputFileSequence::readLuminosityBlockAuxiliary_ ( )

Definition at line 370 of file RootInputFileSequence.cc.

References rootFile_.

370  {
371  assert(rootFile_);
372  return rootFile_->readLuminosityBlockAuxiliary_();
373  }
void edm::RootInputFileSequence::readOneRandom ( EventPrincipal cache,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 712 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_.

712  {
714  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandom(): no input files specified for secondary input source.\n";
715  }
716  assert(rootFile_);
717  skipBadFiles_ = false;
718  unsigned int currentSeqNumber = fileIter_ - fileIterBegin_;
719  while(eventsRemainingInFile_ == 0) {
720 
721  fileIter_ = fileIterBegin_ + CLHEP::RandFlat::shootInt(engine, fileCatalogItems().size());
722  unsigned int newSeqNumber = fileIter_ - fileIterBegin_;
723  if(newSeqNumber != currentSeqNumber) {
724  initFile(false);
725  currentSeqNumber = newSeqNumber;
726  }
727  eventsRemainingInFile_ = rootFile_->eventTree().entries();
728  if(eventsRemainingInFile_ == 0) {
729  throw Exception(errors::NotFound) <<
730  "RootInputFileSequence::readOneRandom(): Secondary Input file " << fileIter_->fileName() << " contains no events.\n";
731  }
732  rootFile_->setAtEventEntry(CLHEP::RandFlat::shootInt(engine, eventsRemainingInFile_) - 1);
733  }
734  rootFile_->nextEventEntry();
735 
736  bool found = rootFile_->readCurrentEvent(cache);
737  if(!found) {
738  rootFile_->setAtEventEntry(0);
739  bool found = rootFile_->readCurrentEvent(cache);
740  assert(found);
741  }
743  }
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 748 of file RootInputFileSequence.cc.

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

748  {
750  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandomWithID(): no input files specified for secondary input source.\n";
751  }
752  skipBadFiles_ = false;
753  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
754  rootFile_->indexIntoFileIter().run() != id.run() ||
755  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
756  bool found = skipToItem(id.run(), id.luminosityBlock(), 0);
757  if(!found) {
758  return false;
759  }
760  int eventsInLumi = 0;
761  assert(rootFile_);
762  while(rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock())) ++eventsInLumi;
763  found = skipToItem(id.run(), id.luminosityBlock(), 0);
764  assert(found);
765  int eventInLumi = CLHEP::RandFlat::shootInt(engine, eventsInLumi);
766  for(int i = 0; i < eventInLumi; ++i) {
767  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
768  assert(found);
769  }
770  }
771  assert(rootFile_);
772  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
773  if(found) {
774  found = rootFile_->readCurrentEvent(cache);
775  }
776  if(!found) {
777  bool found = rootFile_->setEntryAtItem(id.run(), id.luminosityBlock(), 0);
778  if(!found) {
779  return false;
780  }
781  return readOneRandomWithID(cache, id, engine);
782  }
783  return true;
784  }
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 638 of file RootInputFileSequence.cc.

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

638  {
639  skipBadFiles_ = false;
640  if(fileIter_ == fileIterEnd_ || !rootFile_) {
642  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified for secondary input source.\n";
643  }
645  initFile(false);
646  assert(rootFile_);
647  rootFile_->setAtEventEntry(IndexIntoFile::invalidEntry);
648  }
649  assert(rootFile_);
650  rootFile_->nextEventEntry();
651  bool found = rootFile_->readCurrentEvent(cache);
652  if(!found) {
653  ++fileIter_;
654  if(fileIter_ == fileIterEnd_) {
655  return false;
656  }
657  initFile(false);
658  assert(rootFile_);
659  rootFile_->setAtEventEntry(IndexIntoFile::invalidEntry);
660  return readOneSequential(cache);
661  }
662  return true;
663  }
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 666 of file RootInputFileSequence.cc.

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

666  {
668  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequentialWithID(): no input files specified for secondary input source.\n";
669  }
670  skipBadFiles_ = false;
671  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
672  rootFile_->indexIntoFileIter().run() != id.run() ||
673  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
674  bool found = skipToItem(id.run(), id.luminosityBlock(), 0, false);
675  if(!found) {
676  return false;
677  }
678  }
679  assert(rootFile_);
680  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
681  if(found) {
682  found = rootFile_->readCurrentEvent(cache);
683  }
684  if(!found) {
685  found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0);
686  if(!found) {
687  return false;
688  }
689  return readOneSequentialWithID(cache, id);
690  }
691  return true;
692  }
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 695 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().

695  {
697  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSpecified(): no input files specified for secondary input source.\n";
698  }
699  skipBadFiles_ = false;
700  bool found = skipToItem(id.run(), id.luminosityBlock(), id.event());
701  if(!found) {
702  throw Exception(errors::NotFound) <<
703  "RootInputFileSequence::readOneSpecified(): Secondary Input files" <<
704  " do not contain specified event:\n" << id << "\n";
705  }
706  assert(rootFile_);
707  found = rootFile_->readCurrentEvent(cache);
708  assert(found);
709  }
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 376 of file RootInputFileSequence.cc.

References rootFile_.

376  {
377  assert(rootFile_);
378  rootFile_->readRun_(runPrincipal);
379  }
std::shared_ptr< RunAuxiliary > edm::RootInputFileSequence::readRunAuxiliary_ ( )

Definition at line 364 of file RootInputFileSequence.cc.

References rootFile_.

364  {
365  assert(rootFile_);
366  return rootFile_->readRunAuxiliary_();
367  }
int edm::RootInputFileSequence::remainingEvents ( ) const
private

Definition at line 605 of file RootInputFileSequence.cc.

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

Referenced by initFile().

605  {
606  return input_.remainingEvents();
607  }
int remainingEvents() const
Definition: InputSource.h:198
int edm::RootInputFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 610 of file RootInputFileSequence.cc.

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

Referenced by initFile().

610  {
612  }
int remainingLuminosityBlocks() const
Definition: InputSource.h:206
ProcessingController::ReverseState edm::RootInputFileSequence::reverseState ( ) const
void edm::RootInputFileSequence::rewind_ ( )

Definition at line 439 of file RootInputFileSequence.cc.

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

439  {
440  if(fileIter_ != fileIterBegin_) {
441  closeFile_();
443  }
444  if(!rootFile_) {
445  initFile(false);
446  }
447  rewindFile();
448  firstFile_ = true;
449  if(rootFile_) {
452  }
453  }
454  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
void edm::RootInputFileSequence::rewindFile ( )
private

Definition at line 458 of file RootInputFileSequence.cc.

References rootFile_.

Referenced by rewind_().

458  {
459  if(rootFile_) rootFile_->rewind();
460  }
bool edm::RootInputFileSequence::skipEvents ( int  offset)

Definition at line 464 of file RootInputFileSequence.cc.

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

Referenced by rewind_(), and RootInputFileSequence().

464  {
465  // We never call skipEvents for secondary input files. If we did,
466  // we would have to implement synchronization if a new file is opened.
467  // To avoid this, just assert.
469  assert(rootFile_);
470  while(offset != 0) {
471  bool atEnd = rootFile_->skipEvents(offset);
472  if((offset > 0 || atEnd) && !nextFile()) {
473  return false;
474  }
475  if(offset < 0 && !previousFile()) {
477  return false;
478  }
479  }
480  return true;
481  }
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 558 of file RootInputFileSequence.cc.

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

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

558  {
559  // Attempt to find item in currently open input file.
560  bool found = currentFileFirst && rootFile_ && rootFile_->setEntryAtItem(run, lumi, event);
561  if(!found) {
562  // If only one input file, give up now, to save time.
563  if(currentFileFirst && rootFile_ && indexesIntoFiles_.size() == 1) {
564  return false;
565  }
566  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
567  typedef std::vector<std::shared_ptr<IndexIntoFile> >::const_iterator Iter;
568  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
569  if(*it && (*it)->containsItem(run, lumi, event)) {
570  // We found it. Close the currently open file, and open the correct one.
571  std::vector<FileCatalogItem>::const_iterator currentIter = fileIter_;
572  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
573  if(fileIter_ != currentIter) {
574  initFile(false);
575  }
576  // Now get the item from the correct file.
577  assert(rootFile_);
578  found = rootFile_->setEntryAtItem(run, lumi, event);
579  assert(found);
580  return true;
581  }
582  }
583  // Look for item in files not yet opened.
584  return skipToItemInNewFile(run, lumi, event);
585  }
586  return true;
587  }
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< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
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 539 of file RootInputFileSequence.cc.

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

Referenced by readOneSequentialWithID(), and skipToItem().

539  {
540  // Look for item in files not yet opened.
541  typedef std::vector<std::shared_ptr<IndexIntoFile> >::const_iterator Iter;
542  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
543  if(!*it) {
544  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
545  initFile(false);
546  assert(rootFile_);
547  bool found = rootFile_->setEntryAtItem(run, lumi, event);
548  if(found) {
549  return true;
550  }
551  }
552  }
553  // Not found
554  return false;
555  }
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< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_

Member Data Documentation

std::vector<BranchID> edm::RootInputFileSequence::associationsFromSecondary_
private

Definition at line 109 of file RootInputFileSequence.h.

Referenced by initAssociationsFromSecondary(), and initFile().

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

Definition at line 105 of file RootInputFileSequence.h.

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

bool edm::RootInputFileSequence::bypassVersionCheck_
private

Definition at line 117 of file RootInputFileSequence.h.

Referenced by initFile().

InputFileCatalog const& edm::RootInputFileSequence::catalog_
private

Definition at line 97 of file RootInputFileSequence.h.

Referenced by fileCatalogItems().

bool edm::RootInputFileSequence::dropDescendants_
private

Definition at line 123 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 122 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::enablePrefetching_
private

Definition at line 126 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

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

Definition at line 112 of file RootInputFileSequence.h.

Referenced by initFile().

int edm::RootInputFileSequence::eventsRemainingInFile_
private

Definition at line 113 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 103 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::firstFile_
private

Definition at line 98 of file RootInputFileSequence.h.

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

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

Definition at line 107 of file RootInputFileSequence.h.

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

int edm::RootInputFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 114 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 124 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 99 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::noEventSort_
private

Definition at line 115 of file RootInputFileSequence.h.

Referenced by initFile().

unsigned int edm::RootInputFileSequence::nStreams_
private

Definition at line 111 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 108 of file RootInputFileSequence.h.

Referenced by initFile().

ProductSelectorRules edm::RootInputFileSequence::productSelectorRules_
private

Definition at line 121 of file RootInputFileSequence.h.

Referenced by dropUnwantedBranches_(), and initFile().

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

Definition at line 120 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 118 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

int const edm::RootInputFileSequence::treeMaxVirtualSize_
private

Definition at line 119 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::usedFallback_
private

Definition at line 127 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::usingGoToEvent_
private

Definition at line 125 of file RootInputFileSequence.h.

Referenced by goToEvent(), and initFile().