CMS 3D CMS Logo

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

#include <RootInputFileSequence.h>

Public Types

typedef boost::shared_ptr
< RootFile
RootFileSharedPtr
 

Public Member Functions

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

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 37 of file RootInputFileSequence.h.

Member Typedef Documentation

Definition at line 49 of file RootInputFileSequence.h.

Constructor & Destructor Documentation

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

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

Definition at line 355 of file RootInputFileSequence.cc.

355  {
356  }
edm::RootInputFileSequence::RootInputFileSequence ( RootInputFileSequence const &  )
delete

Member Function Documentation

void edm::RootInputFileSequence::closeFile_ ( )

Definition at line 138 of file RootInputFileSequence.cc.

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

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

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

Definition at line 422 of file RootInputFileSequence.cc.

References rootFile_.

422  {
423  if(!rootFile_) return false;
424  return rootFile_->containsItem(run, lumi, event);
425  }
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 609 of file RootInputFileSequence.cc.

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

609  {
610  std::vector<std::string> rules;
611  rules.reserve(wantedBranches.size() + 1);
612  rules.emplace_back("drop *");
613  for(std::vector<std::string>::const_iterator it = wantedBranches.begin(), itEnd = wantedBranches.end();
614  it != itEnd; ++it) {
615  rules.push_back("keep " + *it + "_*");
616  }
617  ParameterSet pset;
618  pset.addUntrackedParameter("inputCommands", rules);
619  productSelectorRules_ = ProductSelectorRules(pset, "inputCommands", "InputSource");
620  }
ProductSelectorRules productSelectorRules_
void edm::RootInputFileSequence::endJob ( void  )

Definition at line 115 of file RootInputFileSequence.cc.

References closeFile_().

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

Definition at line 301 of file RootInputFileSequence.cc.

References rootFile_.

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

Definition at line 110 of file RootInputFileSequence.cc.

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

Referenced by readOneRandom().

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

Definition at line 295 of file RootInputFileSequence.cc.

References rootFile_.

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

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

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

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

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

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

Definition at line 151 of file RootInputFileSequence.cc.

References 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, 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().

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

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

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

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

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

Referenced by initFile().

584  {
585  return input_.processConfiguration();
586  }
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:204
ProcessHistoryRegistry const & edm::RootInputFileSequence::processHistoryRegistry ( ) const

Definition at line 574 of file RootInputFileSequence.cc.

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

574  {
576  }
ProcessHistoryRegistry const & processHistoryRegistry() const
Const accessor for process history registry.
Definition: InputSource.h:170
ProcessHistoryRegistry & edm::RootInputFileSequence::processHistoryRegistryForUpdate ( )

Definition at line 579 of file RootInputFileSequence.cc.

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

Referenced by initFile().

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

Definition at line 604 of file RootInputFileSequence.cc.

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

604  {
605  return input_.productRegistry();
606  }
boost::shared_ptr< ProductRegistry const > productRegistry() const
Accessor for product registry.
Definition: InputSource.h:167
ProductRegistry & edm::RootInputFileSequence::productRegistryUpdate ( ) const
private

Definition at line 599 of file RootInputFileSequence.cc.

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

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

599  {
600  return input_.productRegistryUpdate();
601  }
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:343
void edm::RootInputFileSequence::readEvent ( EventPrincipal cache)

Definition at line 392 of file RootInputFileSequence.cc.

References rootFile_.

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

Definition at line 120 of file RootInputFileSequence.cc.

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

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

Definition at line 374 of file RootInputFileSequence.cc.

References rootFile_.

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

Definition at line 364 of file RootInputFileSequence.cc.

References rootFile_.

364  {
365  return rootFile_->readLuminosityBlockAuxiliary_();
366  }
void edm::RootInputFileSequence::readOneRandom ( EventPrincipal cache)

Definition at line 692 of file RootInputFileSequence.cc.

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

692  {
694  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandom(): no input files specified for secondary input source.\n";
695  }
696  if(!flatDistribution_) {
698  CLHEP::HepRandomEngine& engine = rng->getEngine();
699  flatDistribution_.reset(new CLHEP::RandFlat(engine));
700  }
701  skipBadFiles_ = false;
702  unsigned int currentSeqNumber = fileIter_ - fileIterBegin_;
703  while(eventsRemainingInFile_ == 0) {
704  fileIter_ = fileIterBegin_ + flatDistribution_->fireInt(fileCatalogItems().size());
705  unsigned int newSeqNumber = fileIter_ - fileIterBegin_;
706  if(newSeqNumber != currentSeqNumber) {
707  initFile(false);
708  currentSeqNumber = newSeqNumber;
709  }
710  eventsRemainingInFile_ = rootFile_->eventTree().entries();
711  if(eventsRemainingInFile_ == 0) {
712  throw Exception(errors::NotFound) <<
713  "RootInputFileSequence::readOneRandom(): Secondary Input file " << fileIter_->fileName() << " contains no events.\n";
714  }
715  rootFile_->setAtEventEntry(flatDistribution_->fireInt(eventsRemainingInFile_) - 1);
716  }
717  rootFile_->nextEventEntry();
718 
719  bool found = rootFile_->readCurrentEvent(cache);
720  if(!found) {
721  rootFile_->setAtEventEntry(0);
722  bool found = rootFile_->readCurrentEvent(cache);
723  assert(found);
724  }
726  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem > const & fileCatalogItems() const
std::unique_ptr< CLHEP::RandFlat > flatDistribution_
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 
)

Definition at line 731 of file RootInputFileSequence.cc.

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

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

Definition at line 623 of file RootInputFileSequence.cc.

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

623  {
624  skipBadFiles_ = false;
625  if(fileIter_ == fileIterEnd_ || !rootFile_) {
627  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified for secondary input source.\n";
628  }
630  initFile(false);
631  rootFile_->setAtEventEntry(IndexIntoFile::invalidEntry);
632  }
633  rootFile_->nextEventEntry();
634  bool found = rootFile_->readCurrentEvent(cache);
635  if(!found) {
636  ++fileIter_;
637  if(fileIter_ == fileIterEnd_) {
638  return false;
639  }
640  initFile(false);
641  rootFile_->setAtEventEntry(IndexIntoFile::invalidEntry);
642  return readOneSequential(cache);
643  }
644  return true;
645  }
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 648 of file RootInputFileSequence.cc.

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

648  {
650  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequentialWithID(): no input files specified for secondary input source.\n";
651  }
652  skipBadFiles_ = false;
653  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
654  rootFile_->indexIntoFileIter().run() != id.run() ||
655  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
656  bool found = skipToItem(id.run(), id.luminosityBlock(), 0, false);
657  if(!found) {
658  return false;
659  }
660  }
661  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
662  if(found) {
663  found = rootFile_->readCurrentEvent(cache);
664  }
665  if(!found) {
666  found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0);
667  if(!found) {
668  return false;
669  }
670  return readOneSequentialWithID(cache, id);
671  }
672  return true;
673  }
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 676 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().

676  {
678  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSpecified(): no input files specified for secondary input source.\n";
679  }
680  skipBadFiles_ = false;
681  bool found = skipToItem(id.run(), id.luminosityBlock(), id.event());
682  if(!found) {
683  throw Exception(errors::NotFound) <<
684  "RootInputFileSequence::readOneSpecified(): Secondary Input files" <<
685  " do not contain specified event:\n" << id << "\n";
686  }
687  found = rootFile_->readCurrentEvent(cache);
688  assert(found);
689  }
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 369 of file RootInputFileSequence.cc.

References rootFile_.

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

Definition at line 359 of file RootInputFileSequence.cc.

References rootFile_.

359  {
360  return rootFile_->readRunAuxiliary_();
361  }
int edm::RootInputFileSequence::remainingEvents ( ) const
private

Definition at line 589 of file RootInputFileSequence.cc.

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

Referenced by initFile().

589  {
590  return input_.remainingEvents();
591  }
int remainingEvents() const
Definition: InputSource.h:190
int edm::RootInputFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 594 of file RootInputFileSequence.cc.

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

Referenced by initFile().

594  {
596  }
int remainingLuminosityBlocks() const
Definition: InputSource.h:198
ProcessingController::ReverseState edm::RootInputFileSequence::reverseState ( ) const
void edm::RootInputFileSequence::rewind_ ( )

Definition at line 429 of file RootInputFileSequence.cc.

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

429  {
430  if(fileIter_ != fileIterBegin_) {
431  closeFile_();
433  }
434  if(!rootFile_) {
435  initFile(false);
436  }
437  rewindFile();
438  firstFile_ = true;
439  if(rootFile_) {
442  }
443  }
444  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
void edm::RootInputFileSequence::rewindFile ( )
private

Definition at line 448 of file RootInputFileSequence.cc.

References rootFile_.

Referenced by rewind_().

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

Definition at line 454 of file RootInputFileSequence.cc.

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

Referenced by rewind_(), and RootInputFileSequence().

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

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

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

543  {
544  // Attempt to find item in currently open input file.
545  bool found = currentFileFirst && rootFile_ && rootFile_->setEntryAtItem(run, lumi, event);
546  if(!found) {
547  // If only one input file, give up now, to save time.
548  if(currentFileFirst && rootFile_ && indexesIntoFiles_.size() == 1) {
549  return false;
550  }
551  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
552  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
553  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
554  if(*it && (*it)->containsItem(run, lumi, event)) {
555  // We found it. Close the currently open file, and open the correct one.
556  std::vector<FileCatalogItem>::const_iterator currentIter = fileIter_;
557  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
558  if(fileIter_ != currentIter) {
559  initFile(false);
560  }
561  // Now get the item from the correct file.
562  found = rootFile_->setEntryAtItem(run, lumi, event);
563  assert(found);
564  return true;
565  }
566  }
567  // Look for item in files not yet opened.
568  return skipToItemInNewFile(run, lumi, event);
569  }
570  return true;
571  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
bool edm::RootInputFileSequence::skipToItemInNewFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
)

Definition at line 525 of file RootInputFileSequence.cc.

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

Referenced by readOneSequentialWithID(), and skipToItem().

525  {
526  // Look for item in files not yet opened.
527  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
528  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
529  if(!*it) {
530  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
531  initFile(false);
532  bool found = rootFile_->setEntryAtItem(run, lumi, event);
533  if(found) {
534  return true;
535  }
536  }
537  }
538  // Not found
539  return false;
540  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< FileCatalogItem >::const_iterator fileIterBegin_

Member Data Documentation

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

Definition at line 102 of file RootInputFileSequence.h.

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

bool edm::RootInputFileSequence::bypassVersionCheck_
private

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

Referenced by initFile().

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

Definition at line 119 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::enablePrefetching_
private

Definition at line 123 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

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

Definition at line 109 of file RootInputFileSequence.h.

Referenced by initFile().

int edm::RootInputFileSequence::eventsRemainingInFile_
private

Definition at line 110 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::unique_ptr<CLHEP::RandFlat> edm::RootInputFileSequence::flatDistribution_
private

Definition at line 104 of file RootInputFileSequence.h.

Referenced by readOneRandom(), and readOneRandomWithID().

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

Definition at line 105 of file RootInputFileSequence.h.

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

int edm::RootInputFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 111 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 121 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 112 of file RootInputFileSequence.h.

Referenced by initFile().

unsigned int edm::RootInputFileSequence::nStreams_
private

Definition at line 108 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 106 of file RootInputFileSequence.h.

Referenced by initFile().

ProductSelectorRules edm::RootInputFileSequence::productSelectorRules_
private

Definition at line 118 of file RootInputFileSequence.h.

Referenced by dropUnwantedBranches_(), and initFile().

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

Definition at line 117 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 115 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

int const edm::RootInputFileSequence::treeMaxVirtualSize_
private

Definition at line 116 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::usedFallback_
private

Definition at line 124 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::usingGoToEvent_
private

Definition at line 122 of file RootInputFileSequence.h.

Referenced by goToEvent(), and initFile().