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)
 
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

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 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  bypassVersionCheck_(pset.getUntrackedParameter<bool>("bypassVersionCheck", false)),
60  treeCacheSize_(noEventSort_ ? pset.getUntrackedParameter<unsigned int>("cacheSize", roottree::defaultCacheSize) : 0U),
61  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
62  setRun_(pset.getUntrackedParameter<unsigned int>("setRunNumber", 0U)),
63  productSelectorRules_(pset, "inputCommands", "InputSource"),
64  duplicateChecker_(inputType == InputType::Primary ? new DuplicateChecker(pset) : 0),
65  dropDescendants_(pset.getUntrackedParameter<bool>("dropDescendantsOfDroppedBranches", inputType != InputType::SecondarySource)),
66  labelRawDataLikeMC_(pset.getUntrackedParameter<bool>("labelRawDataLikeMC", true)),
67  usingGoToEvent_(false),
68  enablePrefetching_(false),
69  usedFallback_(false) {
70 
71  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
73  if(pSLC.isAvailable()) {
74  if(treeCacheSize_ != 0U && pSLC->sourceTTreeCacheSize()) {
75  treeCacheSize_ = *(pSLC->sourceTTreeCacheSize());
76  }
77  enablePrefetching_ = pSLC->enablePrefetching();
78  }
79 
82  factory->activateTimeout(fileIter_->fileName());
83  factory->stagein(fileIter_->fileName());
84  //NOTE: we do not want to stage in all secondary files since we can be given a list of
85  // thousands of files and prestaging all those files can cause a site to fail.
86  // So, we stage in the first secondary file only.
88  break;
89  }
90  }
91 
92  std::string branchesMustMatch = pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
93  if(branchesMustMatch == std::string("strict")) branchesMustMatch_ = BranchDescription::Strict;
94 
97  if(rootFile_) break;
98  }
99  if(rootFile_) {
100  productRegistryUpdate().updateFromInput(rootFile_->productRegistry()->productList());
103  }
104  }
105  }
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 357 of file RootInputFileSequence.cc.

357  {
358  }
edm::RootInputFileSequence::RootInputFileSequence ( RootInputFileSequence const &  )
delete

Member Function Documentation

void edm::RootInputFileSequence::closeFile_ ( )

Definition at line 136 of file RootInputFileSequence.cc.

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

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

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

Definition at line 429 of file RootInputFileSequence.cc.

References rootFile_.

429  {
430  if(!rootFile_) return false;
431  return rootFile_->containsItem(run, lumi, event);
432  }
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 622 of file RootInputFileSequence.cc.

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

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

Definition at line 113 of file RootInputFileSequence.cc.

References closeFile_().

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

Definition at line 303 of file RootInputFileSequence.cc.

References rootFile_.

303  {
304  assert(rootFile_);
305  return rootFile_->branchIDListHelper();
306  }
std::vector< FileCatalogItem > const & edm::RootInputFileSequence::fileCatalogItems ( ) const
private

Definition at line 108 of file RootInputFileSequence.cc.

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

Referenced by readOneRandom().

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

Definition at line 297 of file RootInputFileSequence.cc.

References rootFile_.

297  {
298  assert(rootFile_);
299  return rootFile_->productRegistry();
300  }
void edm::RootInputFileSequence::fillDescription ( ParameterSetDescription desc)
static

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

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

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

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

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

Definition at line 149 of file RootInputFileSequence.cc.

References StorageFactory::activateTimeout(), 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, treeCacheSize_, treeMaxVirtualSize_, usedFallback_, and usingGoToEvent_.

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

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

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

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

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

Referenced by initFile().

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

Definition at line 587 of file RootInputFileSequence.cc.

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

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

Definition at line 592 of file RootInputFileSequence.cc.

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

Referenced by initFile().

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

Definition at line 617 of file RootInputFileSequence.cc.

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

617  {
618  return input_.productRegistry();
619  }
std::shared_ptr< ProductRegistry const > productRegistry() const
Accessor for product registry.
Definition: InputSource.h:168
ProductRegistry & edm::RootInputFileSequence::productRegistryUpdate ( ) const
private

Definition at line 612 of file RootInputFileSequence.cc.

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

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

612  {
613  return input_.productRegistryUpdate();
614  }
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:347
void edm::RootInputFileSequence::readEvent ( EventPrincipal cache)

Definition at line 398 of file RootInputFileSequence.cc.

References rootFile_.

398  {
399  assert(rootFile_);
400  rootFile_->readEvent(eventPrincipal);
401  }
std::unique_ptr< FileBlock > edm::RootInputFileSequence::readFile_ ( )

Definition at line 118 of file RootInputFileSequence.cc.

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

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

Definition at line 379 of file RootInputFileSequence.cc.

References rootFile_.

379  {
380  assert(rootFile_);
381  rootFile_->readLuminosityBlock_(lumiPrincipal);
382  }
std::shared_ptr< LuminosityBlockAuxiliary > edm::RootInputFileSequence::readLuminosityBlockAuxiliary_ ( )

Definition at line 367 of file RootInputFileSequence.cc.

References rootFile_.

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

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

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

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

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

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

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

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

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

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

References rootFile_.

373  {
374  assert(rootFile_);
375  rootFile_->readRun_(runPrincipal);
376  }
std::shared_ptr< RunAuxiliary > edm::RootInputFileSequence::readRunAuxiliary_ ( )

Definition at line 361 of file RootInputFileSequence.cc.

References rootFile_.

361  {
362  assert(rootFile_);
363  return rootFile_->readRunAuxiliary_();
364  }
int edm::RootInputFileSequence::remainingEvents ( ) const
private

Definition at line 602 of file RootInputFileSequence.cc.

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

Referenced by initFile().

602  {
603  return input_.remainingEvents();
604  }
int remainingEvents() const
Definition: InputSource.h:194
int edm::RootInputFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 607 of file RootInputFileSequence.cc.

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

Referenced by initFile().

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

Definition at line 436 of file RootInputFileSequence.cc.

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

436  {
437  if(fileIter_ != fileIterBegin_) {
438  closeFile_();
440  }
441  if(!rootFile_) {
442  initFile(false);
443  }
444  rewindFile();
445  firstFile_ = true;
446  if(rootFile_) {
449  }
450  }
451  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
void edm::RootInputFileSequence::rewindFile ( )
private

Definition at line 455 of file RootInputFileSequence.cc.

References rootFile_.

Referenced by rewind_().

455  {
456  if(rootFile_) rootFile_->rewind();
457  }
bool edm::RootInputFileSequence::skipEvents ( int  offset)

Definition at line 461 of file RootInputFileSequence.cc.

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

Referenced by rewind_(), and RootInputFileSequence().

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

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

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

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

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

Referenced by readOneSequentialWithID(), and skipToItem().

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

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

Definition at line 102 of file RootInputFileSequence.h.

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

bool edm::RootInputFileSequence::bypassVersionCheck_
private

Definition at line 113 of file RootInputFileSequence.h.

Referenced by initFile().

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 119 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 118 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::enablePrefetching_
private

Definition at line 122 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

std::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<std::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 120 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 117 of file RootInputFileSequence.h.

Referenced by dropUnwantedBranches_(), and initFile().

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

Definition at line 116 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 114 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

int const edm::RootInputFileSequence::treeMaxVirtualSize_
private

Definition at line 115 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::usedFallback_
private

Definition at line 123 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::usingGoToEvent_
private

Definition at line 121 of file RootInputFileSequence.h.

Referenced by goToEvent(), and initFile().