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_ ()
 
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 ()
 
bool goToEvent (EventID const &eventID)
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
EventPrincipalreadEvent (EventPrincipal &cache)
 
std::unique_ptr< FileBlockreadFile_ ()
 
boost::shared_ptr
< LuminosityBlockPrincipal
readLuminosityBlock_ (boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal)
 
boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
EventPrincipalreadOneRandom (EventPrincipal &cache)
 
EventPrincipalreadOneRandomWithID (EventPrincipal &cache, LuminosityBlockID const &id)
 
EventPrincipalreadOneSequential (EventPrincipal &cache)
 
EventPrincipalreadOneSequentialWithID (EventPrincipal &cache, LuminosityBlockID const &id)
 
EventPrincipalreadOneSpecified (EventPrincipal &cache, EventID const &id)
 
boost::shared_ptr< RunPrincipalreadRun_ (boost::shared_ptr< RunPrincipal > runPrincipal)
 
boost::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
ProcessingController::ReverseState reverseState () const
 
void rewind_ ()
 
 RootInputFileSequence (ParameterSet const &pset, PoolSource const &input, InputFileCatalog const &catalog, InputType::InputType inputType)
 
 RootInputFileSequence (RootInputFileSequence const &)=delete
 
bool skipEvents (int offset)
 
bool skipToItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, bool currentFileFirst=true)
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
virtual ~RootInputFileSequence ()
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 38 of file RootInputFileSequence.h.

Member Typedef Documentation

Definition at line 46 of file RootInputFileSequence.h.

Constructor & Destructor Documentation

edm::RootInputFileSequence::RootInputFileSequence ( ParameterSet const &  pset,
PoolSource const &  input,
InputFileCatalog const &  catalog,
InputType::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(), parametersMustMatch_, edm::InputType::Primary, productRegistryUpdate(), rootFile_, 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_(),
50  // The default value provided as the second argument to the getUntrackedParameter function call
51  // is not used when the ParameterSet has been validated and the parameters are not optional
52  // in the description. This is currently true when PoolSource is the primary input source.
53  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
54  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
55  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
56  // and should be deleted from the code.
57  initialNumberOfEventsToSkip_(inputType == InputType::Primary ? pset.getUntrackedParameter<unsigned int>("skipEvents", 0U) : 0U),
58  noEventSort_(inputType == InputType::Primary ? pset.getUntrackedParameter<bool>("noEventSort", true) : false),
59  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
60  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 parametersMustMatch = pset.getUntrackedParameter<std::string>("parametersMustMatch", std::string("permissive"));
93  if(parametersMustMatch == std::string("strict")) parametersMustMatch_ = BranchDescription::Strict;
94 
95  std::string branchesMustMatch = pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
96  if(branchesMustMatch == std::string("strict")) branchesMustMatch_ = BranchDescription::Strict;
97 
100  if(rootFile_) break;
101  }
102  if(rootFile_) {
103  productRegistryUpdate().updateFromInput(rootFile_->productRegistry()->productList());
106  }
107  }
108  }
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:35
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:38
std::unique_ptr< CLHEP::RandFlat > flatDistribution_
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
#define begin
Definition: vmac.h:31
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)
BranchDescription::MatchMode parametersMustMatch_
InputType::InputType inputType_
tuple size
Write out results.
InputFileCatalog const & catalog_
edm::RootInputFileSequence::~RootInputFileSequence ( )
virtual

Definition at line 347 of file RootInputFileSequence.cc.

347  {
348  }
edm::RootInputFileSequence::RootInputFileSequence ( RootInputFileSequence const &  )
delete

Member Function Documentation

void edm::RootInputFileSequence::closeFile_ ( )

Definition at line 139 of file RootInputFileSequence.cc.

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

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

139  {
140  // close the currently open file, if any, and delete the RootFile object.
141  if(rootFile_) {
143  std::unique_ptr<InputSource::FileCloseSentry>
144  sentry((inputType_ == InputType::Primary) ? new InputSource::FileCloseSentry(input_, lfn_, usedFallback_) : 0);
145  rootFile_->close();
146  if(duplicateChecker_) duplicateChecker_->inputFileClosed();
147  }
148  rootFile_.reset();
149  }
150  }
boost::shared_ptr< DuplicateChecker > duplicateChecker_
InputType::InputType inputType_
void edm::RootInputFileSequence::dropUnwantedBranches_ ( std::vector< std::string > const &  wantedBranches)

Definition at line 581 of file RootInputFileSequence.cc.

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

581  {
582  std::vector<std::string> rules;
583  rules.reserve(wantedBranches.size() + 1);
584  rules.emplace_back("drop *");
585  for(std::vector<std::string>::const_iterator it = wantedBranches.begin(), itEnd = wantedBranches.end();
586  it != itEnd; ++it) {
587  rules.push_back("keep " + *it + "_*");
588  }
589  ParameterSet pset;
590  pset.addUntrackedParameter("inputCommands", rules);
591  productSelectorRules_ = ProductSelectorRules(pset, "inputCommands", "InputSource");
592  }
ProductSelectorRules productSelectorRules_
void edm::RootInputFileSequence::endJob ( void  )

Definition at line 116 of file RootInputFileSequence.cc.

References closeFile_().

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

Definition at line 291 of file RootInputFileSequence.cc.

References rootFile_.

291  {
292  assert(rootFile_);
293  return rootFile_->branchIDListHelper();
294  }
std::vector< FileCatalogItem > const & edm::RootInputFileSequence::fileCatalogItems ( ) const
private

Definition at line 111 of file RootInputFileSequence.cc.

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

Referenced by readOneRandom().

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

Definition at line 285 of file RootInputFileSequence.cc.

References rootFile_.

285  {
286  assert(rootFile_);
287  return rootFile_->productRegistry();
288  }
void edm::RootInputFileSequence::fillDescription ( ParameterSetDescription desc)
static

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

741  {
742  desc.addUntracked<unsigned int>("skipEvents", 0U)
743  ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed.");
744  desc.addUntracked<bool>("noEventSort", true)
745  ->setComment("True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n"
746  "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note 3).\n"
747  "Note 1: Events within the same lumi will always be processed contiguously.\n"
748  "Note 2: Lumis within the same run will always be processed contiguously.\n"
749  "Note 3: Any sorting occurs independently in each input file (no sorting across input files).");
750  desc.addUntracked<bool>("skipBadFiles", false)
751  ->setComment("True: Ignore any missing or unopenable input file.\n"
752  "False: Throw exception if missing or unopenable input file.");
753  desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize)
754  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
755  desc.addUntracked<int>("treeMaxVirtualSize", -1)
756  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
757  desc.addUntracked<unsigned int>("setRunNumber", 0U)
758  ->setComment("If non-zero, change number of first run to this number. Apply same offset to all runs. Allowed only for simulation.");
759  desc.addUntracked<bool>("dropDescendantsOfDroppedBranches", true)
760  ->setComment("If True, also drop on input any descendent of any branch dropped on input.");
761  std::string defaultString("permissive");
762  desc.addUntracked<std::string>("parametersMustMatch", defaultString)
763  ->setComment("'strict': Values of tracked parameters must be unique across all input files.\n"
764  "'permissive': Values of tracked parameters may differ across or within files.");
765  desc.addUntracked<std::string>("branchesMustMatch", defaultString)
766  ->setComment("'strict': Branches in each input file must match those in the first file.\n"
767  "'permissive': Branches in each input file may be any subset of those in the first file.");
768  desc.addUntracked<bool>("labelRawDataLikeMC", true)
769  ->setComment("If True: replace module label for raw data to match MC. Also use 'LHC' as process.");
770 
771  ProductSelectorRules::fillDescription(desc, "inputCommands");
774  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
static void fillDescription(ParameterSetDescription &desc)
unsigned int const defaultCacheSize
Definition: RootTree.h:35
static void fillDescription(ParameterSetDescription &desc)
ProcessingController::ForwardState edm::RootInputFileSequence::forwardState ( ) const
InputSource::ItemType edm::RootInputFileSequence::getNextItemType ( )

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

389  {
390  if(fileIter_ == fileIterEnd_) {
391  return InputSource::IsStop;
392  }
393  if(firstFile_) {
394  return InputSource::IsFile;
395  }
396  if(rootFile_) {
397  IndexIntoFile::EntryType entryType = rootFile_->getNextEntryTypeWanted();
398  if(entryType == IndexIntoFile::kEvent) {
399  return InputSource::IsEvent;
400  } else if(entryType == IndexIntoFile::kLumi) {
401  return InputSource::IsLumi;
402  } else if(entryType == IndexIntoFile::kRun) {
403  return InputSource::IsRun;
404  }
405  assert(entryType == IndexIntoFile::kEnd);
406  }
407  if(fileIter_ + 1 == fileIterEnd_) {
408  return InputSource::IsStop;
409  }
410  return InputSource::IsFile;
411  }
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
bool edm::RootInputFileSequence::goToEvent ( EventID const &  eventID)

Definition at line 455 of file RootInputFileSequence.cc.

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

455  {
456  usingGoToEvent_ = true;
457  if(rootFile_) {
458  if(rootFile_->goToEvent(eventID)) {
459  return true;
460  }
461  // If only one input file, give up now, to save time.
462  if(rootFile_ && indexesIntoFiles_.size() == 1) {
463  return false;
464  }
465  // Save the current file and position so that we can restore them
466  // if we fail to restore the desired event
467  bool closedOriginalFile = false;
468  std::vector<FileCatalogItem>::const_iterator originalFile = fileIter_;
469  IndexIntoFile::IndexIntoFileItr originalPosition = rootFile_->indexIntoFileIter();
470 
471  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
472  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
473  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
474  if(*it && (*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
475  // We found it. Close the currently open file, and open the correct one.
476  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
477  initFile(false);
478  // Now get the item from the correct file.
479  bool found = rootFile_->goToEvent(eventID);
480  assert (found);
481  return true;
482  }
483  }
484  // Look for item in files not yet opened.
485  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
486  if(!*it) {
487  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
488  initFile(false);
489  closedOriginalFile = true;
490  if((*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
491  if (rootFile_->goToEvent(eventID)) {
492  return true;
493  }
494  }
495  }
496  }
497  if(closedOriginalFile) {
498  fileIter_ = originalFile;
499  initFile(false);
500  rootFile_->setPosition(originalPosition);
501  }
502  }
503  return false;
504  }
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 152 of file RootInputFileSequence.cc.

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

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

152  {
153  // We are really going to close the open file.
154 
155  // If this is the primary sequence, we are not duplicate checking across files
156  // and we are not using random access to find events, then we can delete the
157  // IndexIntoFile for the file we are closing. If we can't delete all of it,
158  // then we can delete the parts we do not need.
160  size_t currentIndexIntoFile = fileIterLastOpened_ - fileIterBegin_;
161  bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled();
162  bool deleteIndexIntoFile = inputType_ == InputType::Primary &&
163  !needIndexesForDuplicateChecker &&
165  if(deleteIndexIntoFile) {
166  indexesIntoFiles_[currentIndexIntoFile].reset();
167  } else {
168  if(indexesIntoFiles_[currentIndexIntoFile]) indexesIntoFiles_[currentIndexIntoFile]->inputFileClosed();
169  }
171  }
172  closeFile_();
173 
174  if(fileIter_ == fileIterEnd_) {
175  // No files specified
176  return;
177  }
178 
179  // Check if the logical file name was found.
180  if(fileIter_->fileName().empty()) {
181  // LFN not found in catalog.
182  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
183  if(!skipBadFiles) {
184  throw cms::Exception("LogicalFileNameNotFound", "RootInputFileSequence::initFile()\n")
185  << "Logical file name '" << fileIter_->logicalFileName() << "' was not found in the file catalog.\n"
186  << "If you wanted a local file, you forgot the 'file:' prefix\n"
187  << "before the file name in your configuration file.\n";
188  }
189  LogWarning("") << "Input logical file: " << fileIter_->logicalFileName() << " was not found in the catalog, and will be skipped.\n";
190  return;
191  }
192 
193  lfn_ = fileIter_->logicalFileName().empty() ? fileIter_->fileName() : fileIter_->logicalFileName();
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_) : 0);
204  filePtr.reset(new InputFile(gSystem->ExpandPathName(fileIter_->fileName().c_str()), " Initiating request to open file "));
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  std::unique_ptr<InputSource::FileOpenSentry>
227  sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_) : 0);
228  filePtr.reset(new InputFile(gSystem->ExpandPathName(fallbackName.c_str()), " Fallback request to file "));
229  usedFallback_ = true;
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(fileIter_->fileName(),
247  processConfiguration(), fileIter_->logicalFileName(), filePtr,
251  setRun_,
252  noEventSort_,
254  inputType_,
255  (inputType_ == InputType::SecondarySource ? boost::shared_ptr<BranchIDListHelper>(new BranchIDListHelper()) : input_.branchIDListHelper()),
259  currentIndexIntoFile,
264 
266  indexesIntoFiles_[currentIndexIntoFile] = rootFile_->indexIntoFileSharedPtr();
267  char const* inputType = 0;
268  switch(inputType_) {
269  case InputType::Primary: inputType = "primaryFiles"; break;
270  case InputType::SecondaryFile: inputType = "secondaryFiles"; break;
271  case InputType::SecondarySource: inputType = "mixingFiles"; break;
272  }
273  rootFile_->reportOpened(inputType);
274  } else {
275  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
276  if(!skipBadFiles) {
278  "RootInputFileSequence::initFile(): Input file " << fileIter_->fileName() << " was not found or could not be opened.\n";
279  }
280  LogWarning("") << "Input file: " << fileIter_->fileName() << " was not found or could not be opened, and will be skipped.\n";
281  }
282  }
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:238
static void reportSkippedFile(std::string const &fileName, std::string const &logicalFileName)
Definition: InputFile.cc:67
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:73
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
boost::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:165
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_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
InputType::InputType inputType_
boost::shared_ptr< RootFile > RootFileSharedPtr
bool edm::RootInputFileSequence::nextFile ( )
private

Definition at line 296 of file RootInputFileSequence.cc.

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

Referenced by readFile_(), and skipEvents().

296  {
298  if(fileIter_ == fileIterEnd_) {
300  return false;
301  } else {
303  }
304  }
305 
307 
309  // make sure the new product registry is compatible with the main one
310  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
311  fileIter_->fileName(),
314  if(!mergeInfo.empty()) {
315  throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::nextFile()") << mergeInfo;
316  }
317  }
318  return true;
319  }
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 parametersMustMatch=BranchDescription::Permissive, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
BranchDescription::MatchMode branchesMustMatch_
BranchDescription::MatchMode parametersMustMatch_
InputType::InputType inputType_
RootInputFileSequence& edm::RootInputFileSequence::operator= ( RootInputFileSequence const &  )
delete
bool edm::RootInputFileSequence::previousFile ( )
private

Definition at line 321 of file RootInputFileSequence.cc.

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

Referenced by skipEvents().

321  {
322  if(fileIter_ == fileIterBegin_) {
324  return false;
325  } else {
327  }
328  }
329  --fileIter_;
330 
331  initFile(false);
332 
334  // make sure the new product registry is compatible to the main one
335  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
336  fileIter_->fileName(),
339  if(!mergeInfo.empty()) {
340  throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::previousEvent()") << mergeInfo;
341  }
342  }
343  if(rootFile_) rootFile_->setToLastEntry();
344  return true;
345  }
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 parametersMustMatch=BranchDescription::Permissive, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
BranchDescription::MatchMode branchesMustMatch_
BranchDescription::MatchMode parametersMustMatch_
InputType::InputType inputType_
ProcessConfiguration const & edm::RootInputFileSequence::processConfiguration ( ) const
private

Definition at line 556 of file RootInputFileSequence.cc.

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

Referenced by initFile().

556  {
557  return input_.processConfiguration();
558  }
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:193
boost::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::productRegistry ( ) const
private

Definition at line 576 of file RootInputFileSequence.cc.

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

576  {
577  return input_.productRegistry();
578  }
boost::shared_ptr< ProductRegistry const > productRegistry() const
Accessor for product registry.
Definition: InputSource.h:162
ProductRegistry & edm::RootInputFileSequence::productRegistryUpdate ( ) const
private

Definition at line 571 of file RootInputFileSequence.cc.

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

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

571  {
572  return input_.productRegistryUpdate();
573  }
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:316
EventPrincipal * edm::RootInputFileSequence::readEvent ( EventPrincipal cache)

Definition at line 384 of file RootInputFileSequence.cc.

References rootFile_.

384  {
385  return rootFile_->readEvent(eventPrincipal);
386  }
std::unique_ptr< FileBlock > edm::RootInputFileSequence::readFile_ ( )

Definition at line 121 of file RootInputFileSequence.cc.

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

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

Definition at line 366 of file RootInputFileSequence.cc.

References rootFile_.

366  {
367  return rootFile_->readLumi(lumiPrincipal);
368  }
boost::shared_ptr< LuminosityBlockAuxiliary > edm::RootInputFileSequence::readLuminosityBlockAuxiliary_ ( )

Definition at line 356 of file RootInputFileSequence.cc.

References rootFile_.

356  {
357  return rootFile_->readLuminosityBlockAuxiliary_();
358  }
EventPrincipal * edm::RootInputFileSequence::readOneRandom ( EventPrincipal cache)

Definition at line 662 of file RootInputFileSequence.cc.

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

662  {
664  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandom(): no input files specified for secondary input source.\n";
665  }
666  if(!flatDistribution_) {
668  CLHEP::HepRandomEngine& engine = rng->getEngine();
669  flatDistribution_.reset(new CLHEP::RandFlat(engine));
670  }
671  skipBadFiles_ = false;
672  unsigned int currentSeqNumber = fileIter_ - fileIterBegin_;
673  while(eventsRemainingInFile_ == 0) {
674  fileIter_ = fileIterBegin_ + flatDistribution_->fireInt(fileCatalogItems().size());
675  unsigned int newSeqNumber = fileIter_ - fileIterBegin_;
676  if(newSeqNumber != currentSeqNumber) {
677  initFile(false);
678  currentSeqNumber = newSeqNumber;
679  }
680  eventsRemainingInFile_ = rootFile_->eventTree().entries();
681  if(eventsRemainingInFile_ == 0) {
682  throw Exception(errors::NotFound) <<
683  "RootInputFileSequence::readOneRandom(): Secondary Input file " << fileIter_->fileName() << " contains no events.\n";
684  }
685  rootFile_->setAtEventEntry(flatDistribution_->fireInt(eventsRemainingInFile_) - 1);
686  }
687  rootFile_->nextEventEntry();
688 
689  EventPrincipal* ep = rootFile_->readCurrentEvent(cache);
690  if(ep == 0) {
691  rootFile_->setAtEventEntry(0);
692  ep = rootFile_->readCurrentEvent(cache);
693  assert(ep != 0);
694  }
696  return ep;
697  }
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.
EventPrincipal * edm::RootInputFileSequence::readOneRandomWithID ( EventPrincipal cache,
LuminosityBlockID const &  id 
)

Definition at line 702 of file RootInputFileSequence.cc.

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

702  {
704  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandomWithID(): no input files specified for secondary input source.\n";
705  }
706  if(!flatDistribution_) {
708  CLHEP::HepRandomEngine& engine = rng->getEngine();
709  flatDistribution_.reset(new CLHEP::RandFlat(engine));
710  }
711  skipBadFiles_ = false;
712  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
713  rootFile_->indexIntoFileIter().run() != id.run() ||
714  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
715  bool found = skipToItem(id.run(), id.luminosityBlock(), 0);
716  if(!found) {
717  return 0;
718  }
719  int eventsInLumi = 0;
720  while(rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock())) ++eventsInLumi;
721  found = skipToItem(id.run(), id.luminosityBlock(), 0);
722  assert(found);
723  int eventInLumi = flatDistribution_->fireInt(eventsInLumi);
724  for(int i = 0; i < eventInLumi; ++i) {
725  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
726  assert(found);
727  }
728  }
729  bool nextFound = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
730  EventPrincipal* ep = (nextFound ? rootFile_->readCurrentEvent(cache) : 0);
731  if(ep == 0) {
732  bool found = rootFile_->setEntryAtItem(id.run(), id.luminosityBlock(), 0);
733  if(found) {
734  return readOneRandomWithID(cache, id);
735  }
736  }
737  return ep;
738  }
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)
EventPrincipal * readOneRandomWithID(EventPrincipal &cache, LuminosityBlockID const &id)
std::unique_ptr< CLHEP::RandFlat > flatDistribution_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
EventPrincipal * edm::RootInputFileSequence::readOneSequential ( EventPrincipal cache)

Definition at line 595 of file RootInputFileSequence.cc.

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

595  {
596  skipBadFiles_ = false;
597  if(fileIter_ == fileIterEnd_ || !rootFile_) {
599  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified for secondary input source.\n";
600  }
602  initFile(false);
603  rootFile_->setAtEventEntry(-1);
604  }
605  rootFile_->nextEventEntry();
606  EventPrincipal* ep = rootFile_->readCurrentEvent(cache);
607  if(ep == 0) {
608  ++fileIter_;
609  if(fileIter_ == fileIterEnd_) {
610  return 0;
611  }
612  initFile(false);
613  rootFile_->setAtEventEntry(-1);
614  return readOneSequential(cache);
615  }
616  return ep;
617  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
EventPrincipal * readOneSequential(EventPrincipal &cache)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
EventPrincipal * edm::RootInputFileSequence::readOneSequentialWithID ( EventPrincipal cache,
LuminosityBlockID const &  id 
)

Definition at line 620 of file RootInputFileSequence.cc.

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

620  {
622  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequentialWithID(): no input files specified for secondary input source.\n";
623  }
624  skipBadFiles_ = false;
625  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
626  rootFile_->indexIntoFileIter().run() != id.run() ||
627  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
628  bool found = skipToItem(id.run(), id.luminosityBlock(), 0, false);
629  if(!found) {
630  return 0;
631  }
632  }
633  bool nextFound = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
634  EventPrincipal* ep = (nextFound ? rootFile_->readCurrentEvent(cache) : 0);
635  if(ep == 0) {
636  bool found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0);
637  if(found) {
638  return readOneSequentialWithID(cache, id);
639  }
640  }
641  return ep;
642  }
std::vector< FileCatalogItem >::const_iterator fileIter_
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, bool currentFileFirst=true)
EventPrincipal * 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_
EventPrincipal * edm::RootInputFileSequence::readOneSpecified ( EventPrincipal cache,
EventID const &  id 
)

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

645  {
647  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSpecified(): no input files specified for secondary input source.\n";
648  }
649  skipBadFiles_ = false;
650  bool found = skipToItem(id.run(), id.luminosityBlock(), id.event());
651  if(!found) {
652  throw Exception(errors::NotFound) <<
653  "RootInputFileSequence::readOneSpecified(): Secondary Input files" <<
654  " do not contain specified event:\n" << id << "\n";
655  }
656  EventPrincipal* ep = rootFile_->readCurrentEvent(cache);
657  assert(ep != 0);
658  return ep;
659  }
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_
boost::shared_ptr< RunPrincipal > edm::RootInputFileSequence::readRun_ ( boost::shared_ptr< RunPrincipal runPrincipal)

Definition at line 361 of file RootInputFileSequence.cc.

References rootFile_.

361  {
362  return rootFile_->readRun_(runPrincipal);
363  }
boost::shared_ptr< RunAuxiliary > edm::RootInputFileSequence::readRunAuxiliary_ ( )

Definition at line 351 of file RootInputFileSequence.cc.

References rootFile_.

351  {
352  return rootFile_->readRunAuxiliary_();
353  }
int edm::RootInputFileSequence::remainingEvents ( ) const
private

Definition at line 561 of file RootInputFileSequence.cc.

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

Referenced by initFile().

561  {
562  return input_.remainingEvents();
563  }
int remainingEvents() const
Definition: InputSource.h:179
int edm::RootInputFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 566 of file RootInputFileSequence.cc.

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

Referenced by initFile().

566  {
568  }
int remainingLuminosityBlocks() const
Definition: InputSource.h:187
ProcessingController::ReverseState edm::RootInputFileSequence::reverseState ( ) const
void edm::RootInputFileSequence::rewind_ ( )

Definition at line 415 of file RootInputFileSequence.cc.

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

415  {
416  if(fileIter_ != fileIterBegin_) {
417  closeFile_();
419  }
420  if(!rootFile_) {
421  initFile(false);
422  }
423  rewindFile();
424  firstFile_ = true;
425  if(rootFile_) {
428  }
429  }
430  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
void edm::RootInputFileSequence::rewindFile ( )
private

Definition at line 434 of file RootInputFileSequence.cc.

References rootFile_.

Referenced by rewind_().

434  {
435  if(rootFile_) rootFile_->rewind();
436  }
bool edm::RootInputFileSequence::skipEvents ( int  offset)

Definition at line 440 of file RootInputFileSequence.cc.

References fileIter_, fileIterEnd_, nextFile(), previousFile(), and rootFile_.

Referenced by rewind_(), and RootInputFileSequence().

440  {
441  while(offset != 0) {
442  bool atEnd = rootFile_->skipEvents(offset);
443  if((offset > 0 || atEnd) && !nextFile()) {
444  return false;
445  }
446  if(offset < 0 && !previousFile()) {
448  return false;
449  }
450  }
451  return true;
452  }
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 525 of file RootInputFileSequence.cc.

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

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

525  {
526  // Attempt to find item in currently open input file.
527  bool found = currentFileFirst && rootFile_ && rootFile_->setEntryAtItem(run, lumi, event);
528  if(!found) {
529  // If only one input file, give up now, to save time.
530  if(currentFileFirst && rootFile_ && indexesIntoFiles_.size() == 1) {
531  return false;
532  }
533  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
534  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
535  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
536  if(*it && (*it)->containsItem(run, lumi, event)) {
537  // We found it. Close the currently open file, and open the correct one.
538  std::vector<FileCatalogItem>::const_iterator currentIter = fileIter_;
539  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
540  if(fileIter_ != currentIter) {
541  initFile(false);
542  }
543  // Now get the item from the correct file.
544  found = rootFile_->setEntryAtItem(run, lumi, event);
545  assert (found);
546  return true;
547  }
548  }
549  // Look for item in files not yet opened.
550  return skipToItemInNewFile(run, lumi, event);
551  }
552  return true;
553  }
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 507 of file RootInputFileSequence.cc.

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

Referenced by readOneSequentialWithID(), and skipToItem().

507  {
508  // Look for item in files not yet opened.
509  typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter;
510  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
511  if(!*it) {
512  fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin());
513  initFile(false);
514  bool found = rootFile_->setEntryAtItem(run, lumi, event);
515  if(found) {
516  return true;
517  }
518  }
519  }
520  // Not found
521  return false;
522  }
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 97 of file RootInputFileSequence.h.

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

InputFileCatalog const& edm::RootInputFileSequence::catalog_
private

Definition at line 88 of file RootInputFileSequence.h.

Referenced by fileCatalogItems().

bool edm::RootInputFileSequence::dropDescendants_
private

Definition at line 113 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 112 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::enablePrefetching_
private

Definition at line 116 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

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

Definition at line 103 of file RootInputFileSequence.h.

Referenced by initFile().

int edm::RootInputFileSequence::eventsRemainingInFile_
private

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

Referenced by initFile().

bool edm::RootInputFileSequence::firstFile_
private

Definition at line 89 of file RootInputFileSequence.h.

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

std::unique_ptr<CLHEP::RandFlat> edm::RootInputFileSequence::flatDistribution_
private

Definition at line 99 of file RootInputFileSequence.h.

Referenced by readOneRandom(), and readOneRandomWithID().

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

Definition at line 100 of file RootInputFileSequence.h.

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

int edm::RootInputFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 105 of file RootInputFileSequence.h.

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

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

Definition at line 114 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 90 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::noEventSort_
private

Definition at line 106 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 101 of file RootInputFileSequence.h.

Referenced by initFile().

BranchDescription::MatchMode edm::RootInputFileSequence::parametersMustMatch_
private

Definition at line 96 of file RootInputFileSequence.h.

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

ProductSelectorRules edm::RootInputFileSequence::productSelectorRules_
private

Definition at line 111 of file RootInputFileSequence.h.

Referenced by dropUnwantedBranches_(), and initFile().

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

Definition at line 110 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 108 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

int const edm::RootInputFileSequence::treeMaxVirtualSize_
private

Definition at line 109 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::usedFallback_
private

Definition at line 117 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

bool edm::RootInputFileSequence::usingGoToEvent_
private

Definition at line 115 of file RootInputFileSequence.h.

Referenced by goToEvent(), and initFile().