CMS 3D CMS Logo

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

#include <RootInputFileSequence.h>

Public Types

typedef boost::shared_ptr
< RootFile
RootFileSharedPtr
 

Public Member Functions

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

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Member Functions

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

Private Attributes

BranchDescription::MatchMode branchesMustMatch_
 
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::vector< boost::shared_ptr
< IndexIntoFile > > 
indexesIntoFiles_
 
int initialNumberOfEventsToSkip_
 
PoolSourceinput_
 
InputType inputType_
 
bool labelRawDataLikeMC_
 
std::string lfn_
 
bool noEventSort_
 
unsigned int nStreams_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
ProductSelectorRules productSelectorRules_
 
RootFileSharedPtr rootFile_
 
RunNumber_t setRun_
 
bool skipBadFiles_
 
unsigned int treeCacheSize_
 
int const treeMaxVirtualSize_
 
bool usedFallback_
 
bool usingGoToEvent_
 

Detailed Description

Definition at line 37 of file RootInputFileSequence.h.

Member Typedef Documentation

Definition at line 49 of file RootInputFileSequence.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file RootInputFileSequence.cc.

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

32  :
33  input_(input),
34  inputType_(inputType),
36  firstFile_(true),
37  lfn_("unknown"),
42  rootFile_(),
46  nStreams_(nStreams),
49  // The default value provided as the second argument to the getUntrackedParameter function call
50  // is not used when the ParameterSet has been validated and the parameters are not optional
51  // in the description. This is currently true when PoolSource is the primary input source.
52  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
53  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
54  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
55  // and should be deleted from the code.
56  initialNumberOfEventsToSkip_(inputType == InputType::Primary ? pset.getUntrackedParameter<unsigned int>("skipEvents", 0U) : 0U),
57  noEventSort_(inputType == InputType::Primary ? pset.getUntrackedParameter<bool>("noEventSort", true) : false),
58  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
59  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  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void stagein(const std::string &url)
void initFile(bool skipBadFiles)
ProductSelectorRules productSelectorRules_
std::vector< FileCatalogItem >::const_iterator fileIter_
ProductRegistry & productRegistryUpdate() const
unsigned int const defaultCacheSize
Definition: RootTree.h:37
static std::string const input
Definition: EdmProvDump.cc:44
static StorageFactory * get(void)
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
std::vector< FileCatalogItem > const & fileCatalogItems() const
boost::shared_ptr< DuplicateChecker > duplicateChecker_
#define end
Definition: vmac.h:37
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
#define begin
Definition: vmac.h:30
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
void updateFromInput(ProductList const &other)
void activateTimeout(const std::string &url)
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
BranchDescription::MatchMode branchesMustMatch_
static std::auto_ptr< EventSkipperByID > create(ParameterSet const &pset)
tuple size
Write out results.
InputFileCatalog const & catalog_
edm::RootInputFileSequence::~RootInputFileSequence ( )
virtual

Definition at line 354 of file RootInputFileSequence.cc.

354  {
355  }
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  }
boost::shared_ptr< DuplicateChecker > duplicateChecker_
bool edm::RootInputFileSequence::containedInCurrentFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Definition at line 426 of file RootInputFileSequence.cc.

References rootFile_.

426  {
427  if(!rootFile_) return false;
428  return rootFile_->containsItem(run, lumi, event);
429  }
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 619 of file RootInputFileSequence.cc.

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

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

Definition at line 113 of file RootInputFileSequence.cc.

References closeFile_().

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

Definition at line 300 of file RootInputFileSequence.cc.

References rootFile_.

300  {
301  assert(rootFile_);
302  return rootFile_->branchIDListHelper();
303  }
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_
boost::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::fileProductRegistry ( ) const

Definition at line 294 of file RootInputFileSequence.cc.

References rootFile_.

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

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

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

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

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

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

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  boost::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  filePtr.reset(new InputFile(gSystem->ExpandPathName(fallbackName.c_str()), " Fallback request to file ", inputType_));
228  }
229  catch (cms::Exception const& e) {
230  if(!skipBadFiles) {
231  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
233  ex.addContext("Calling RootInputFileSequence::initFile()");
234  std::ostringstream out;
235  out << "Input file " << fileIter_->fileName() << " could not be opened.\n";
236  out << "Fallback Input file " << fallbackName << " also could not be opened.";
237  ex.addAdditionalInfo(out.str());
238  throw ex;
239  }
240  }
241  }
242  if(filePtr) {
243  std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile = fileIter_ - fileIterBegin_;
244  rootFile_ = RootFileSharedPtr(new RootFile(
245  fileIter_->fileName(),
247  fileIter_->logicalFileName(),
248  filePtr,
251  remainingEvents(),
253  nStreams_,
257  setRun_,
258  noEventSort_,
260  inputType_,
261  (inputType_ == InputType::SecondarySource ? boost::shared_ptr<BranchIDListHelper>(new BranchIDListHelper()) : input_.branchIDListHelper()),
266  currentIndexIntoFile,
272 
273  assert(rootFile_);
275  indexesIntoFiles_[currentIndexIntoFile] = rootFile_->indexIntoFileSharedPtr();
276  char const* inputType = 0;
277  switch(inputType_) {
278  case InputType::Primary: inputType = "primaryFiles"; break;
279  case InputType::SecondaryFile: inputType = "secondaryFiles"; break;
280  case InputType::SecondarySource: inputType = "mixingFiles"; break;
281  }
282  rootFile_->reportOpened(inputType);
283  } else {
284  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
285  if(!skipBadFiles) {
287  "RootInputFileSequence::initFile(): Input file " << fileIter_->fileName() << " was not found or could not be opened.\n";
288  }
289  LogWarning("") << "Input file: " << fileIter_->fileName() << " was not found or could not be opened, and will be skipped.\n";
290  }
291  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
list pfn
Definition: dbtoconf.py:76
ProductSelectorRules productSelectorRules_
ProcessConfiguration const & processConfiguration() const
virtual std::string explainSelf() const
Definition: Exception.cc:146
std::vector< FileCatalogItem >::const_iterator fileIter_
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:253
uint16_t size_type
tuple InputFile
Open Root file and provide MEs ############.
static void reportFallbackAttempt(std::string const &pfn, std::string const &logicalFileName, std::string const &errorMessage)
Definition: InputFile.cc:79
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
boost::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:177
boost::shared_ptr< DuplicateChecker > duplicateChecker_
static void reportSkippedFile(std::string const &fileName, std::string const &logicalFileName)
Definition: InputFile.cc:73
tuple out
Definition: dbtoconf.py:99
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
tuple skipBadFiles
Definition: example_cfg.py:64
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
boost::shared_ptr< RootFile > RootFileSharedPtr
bool edm::RootInputFileSequence::nextFile ( )
private

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

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

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

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

Referenced by initFile().

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

Definition at line 584 of file RootInputFileSequence.cc.

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

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

Definition at line 589 of file RootInputFileSequence.cc.

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

Referenced by initFile().

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

Definition at line 614 of file RootInputFileSequence.cc.

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

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

Definition at line 609 of file RootInputFileSequence.cc.

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

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

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

Definition at line 395 of file RootInputFileSequence.cc.

References rootFile_.

395  {
396  assert(rootFile_);
397  rootFile_->readEvent(eventPrincipal);
398  }
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 376 of file RootInputFileSequence.cc.

References rootFile_.

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

Definition at line 364 of file RootInputFileSequence.cc.

References rootFile_.

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

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

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

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

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

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

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

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

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

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

References rootFile_.

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

Definition at line 358 of file RootInputFileSequence.cc.

References rootFile_.

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

Definition at line 599 of file RootInputFileSequence.cc.

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

Referenced by initFile().

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

Definition at line 604 of file RootInputFileSequence.cc.

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

Referenced by initFile().

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

Definition at line 433 of file RootInputFileSequence.cc.

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

433  {
434  if(fileIter_ != fileIterBegin_) {
435  closeFile_();
437  }
438  if(!rootFile_) {
439  initFile(false);
440  }
441  rewindFile();
442  firstFile_ = true;
443  if(rootFile_) {
446  }
447  }
448  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
void edm::RootInputFileSequence::rewindFile ( )
private

Definition at line 452 of file RootInputFileSequence.cc.

References rootFile_.

Referenced by rewind_().

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

Definition at line 458 of file RootInputFileSequence.cc.

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

Referenced by rewind_(), and RootInputFileSequence().

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

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

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

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

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

Referenced by readOneSequentialWithID(), and skipToItem().

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

boost::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().

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

Definition at line 108 of file RootInputFileSequence.h.

Referenced by initFile().

int edm::RootInputFileSequence::eventsRemainingInFile_
private

Definition at line 109 of file RootInputFileSequence.h.

Referenced by readOneRandom().

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

Definition at line 100 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::firstFile_
private

Definition at line 95 of file RootInputFileSequence.h.

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

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

Definition at line 104 of file RootInputFileSequence.h.

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

int edm::RootInputFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 110 of file RootInputFileSequence.h.

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

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

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