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
< ProductRegistry const > 
fileProductRegistry () const
 
ProcessingController::ForwardState forwardState () const
 
InputSource::ItemType getNextItemType ()
 
bool goToEvent (EventID const &eventID)
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
EventPrincipalreadEvent (EventPrincipal &cache, boost::shared_ptr< LuminosityBlockPrincipal > lb)
 
boost::shared_ptr< FileBlockreadFile_ (PrincipalCache &cache)
 
boost::shared_ptr
< LuminosityBlockPrincipal
readLuminosityBlock_ (boost::shared_ptr< LuminosityBlockPrincipal > lbCache)
 
boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
EventPrincipalreadOneRandom ()
 
EventPrincipalreadOneRandomWithID (LuminosityBlockID const &id)
 
EventPrincipalreadOneSequential ()
 
EventPrincipalreadOneSequentialWithID (LuminosityBlockID const &id)
 
EventPrincipalreadOneSpecified (EventID const &id)
 
boost::shared_ptr< RunPrincipalreadRun_ (boost::shared_ptr< RunPrincipal > rpCache)
 
boost::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
void reset (PrincipalCache &cache)
 
ProcessingController::ReverseState reverseState () const
 
void rewind_ ()
 
 RootInputFileSequence (ParameterSet const &pset, PoolSource const &input, InputFileCatalog const &catalog, PrincipalCache &cache, InputType::InputType inputType)
 
 RootInputFileSequence (RootInputFileSequence const &)=delete
 
bool skipEvents (int offset, PrincipalCache &cache)
 
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 (PrincipalCache &cache)
 
bool previousFile (PrincipalCache &cache)
 
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_
 
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_
 
GroupSelectorRules groupSelectorRules_
 
std::vector< boost::shared_ptr
< IndexIntoFile > > 
indexesIntoFiles_
 
PoolSource const & input_
 
InputType::InputType inputType_
 
bool labelRawDataLikeMC_
 
bool noEventSort_
 
int numberOfEventsToSkip_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
BranchDescription::MatchMode parametersMustMatch_
 
RootFileSharedPtr rootFile_
 
RunNumber_t setRun_
 
bool skipBadFiles_
 
unsigned int treeCacheSize_
 
int const treeMaxVirtualSize_
 
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,
PrincipalCache cache,
InputType::InputType  inputType 
)
explicit

Definition at line 26 of file RootInputFileSequence.cc.

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

31  :
32  input_(input),
33  inputType_(inputType),
35  firstFile_(true),
40  rootFile_(),
48  // The default value provided as the second argument to the getUntrackedParameter function call
49  // is not used when the ParameterSet has been validated and the parameters are not optional
50  // in the description. This is currently true when PoolSource is the primary input source.
51  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
52  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
53  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
54  // and should be deleted from the code.
55  numberOfEventsToSkip_(inputType == InputType::Primary ? pset.getUntrackedParameter<unsigned int>("skipEvents", 0U) : 0U),
56  noEventSort_(inputType == InputType::Primary ? pset.getUntrackedParameter<bool>("noEventSort", true) : false),
57  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
58  treeCacheSize_(noEventSort_ ? pset.getUntrackedParameter<unsigned int>("cacheSize", roottree::defaultCacheSize) : 0U),
59  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
60  setRun_(pset.getUntrackedParameter<unsigned int>("setRunNumber", 0U)),
61  groupSelectorRules_(pset, "inputCommands", "InputSource"),
62  duplicateChecker_(inputType == InputType::Primary ? new DuplicateChecker(pset) : 0),
63  dropDescendants_(pset.getUntrackedParameter<bool>("dropDescendantsOfDroppedBranches", inputType != InputType::SecondarySource)),
64  labelRawDataLikeMC_(pset.getUntrackedParameter<bool>("labelRawDataLikeMC", true)),
65  usingGoToEvent_(false) {
66 
67  //we now allow the site local config to specify what the TTree cache size should be
69  if(treeCacheSize_ != 0U && pSLC.isAvailable() && pSLC->sourceTTreeCacheSize()) {
70  treeCacheSize_ = *(pSLC->sourceTTreeCacheSize());
71  }
72 
74  //NOTE: we do not want to stage in secondary files since we can be given a list of
75  // thousands of files and prestaging all those files can cause a site to fail
78  factory->activateTimeout(fileIter_->fileName());
79  factory->stagein(fileIter_->fileName());
80  }
81  }
82 
83  std::string parametersMustMatch = pset.getUntrackedParameter<std::string>("parametersMustMatch", std::string("permissive"));
84  if(parametersMustMatch == std::string("strict")) parametersMustMatch_ = BranchDescription::Strict;
85 
86  std::string branchesMustMatch = pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
87  if(branchesMustMatch == std::string("strict")) branchesMustMatch_ = BranchDescription::Strict;
88 
89  if(inputType != InputType::SecondarySource) {
92  if(rootFile_) break;
93  }
94  if(rootFile_) {
95  productRegistryUpdate().updateFromInput(rootFile_->productRegistry()->productList());
96  if(numberOfEventsToSkip_ != 0) {
98  }
99  }
100  }
101  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void stagein(const std::string &url)
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
ProductRegistry & productRegistryUpdate() const
GroupSelectorRules groupSelectorRules_
unsigned int const defaultCacheSize
Definition: RootTree.h:34
bool skipEvents(int offset, PrincipalCache &cache)
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 337 of file RootInputFileSequence.cc.

337  {
338  }
edm::RootInputFileSequence::RootInputFileSequence ( RootInputFileSequence const &  )
delete

Member Function Documentation

void edm::RootInputFileSequence::closeFile_ ( )

Definition at line 132 of file RootInputFileSequence.cc.

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

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

132  {
133  // close the currently open file, if any, and delete the RootFile object.
134  if(rootFile_) {
136  std::unique_ptr<InputSource::FileCloseSentry>
137  sentry((inputType_ == InputType::Primary) ? new InputSource::FileCloseSentry(input_) : 0);
138  rootFile_->close();
139  if(duplicateChecker_) duplicateChecker_->inputFileClosed();
140  }
141  rootFile_.reset();
142  }
143  }
boost::shared_ptr< DuplicateChecker > duplicateChecker_
InputType::InputType inputType_
void edm::RootInputFileSequence::dropUnwantedBranches_ ( std::vector< std::string > const &  wantedBranches)

Definition at line 588 of file RootInputFileSequence.cc.

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

588  {
589  std::vector<std::string> rules;
590  rules.reserve(wantedBranches.size() + 1);
591  rules.emplace_back("drop *");
592  for(std::vector<std::string>::const_iterator it = wantedBranches.begin(), itEnd = wantedBranches.end();
593  it != itEnd; ++it) {
594  rules.push_back("keep " + *it + "_*");
595  }
596  ParameterSet pset;
597  pset.addUntrackedParameter("inputCommands", rules);
598  groupSelectorRules_ = GroupSelectorRules(pset, "inputCommands", "InputSource");
599  }
GroupSelectorRules groupSelectorRules_
void edm::RootInputFileSequence::endJob ( void  )

Definition at line 109 of file RootInputFileSequence.cc.

References closeFile_().

109  {
110  closeFile_();
111  }
std::vector< FileCatalogItem > const & edm::RootInputFileSequence::fileCatalogItems ( ) const
private

Definition at line 104 of file RootInputFileSequence.cc.

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

Referenced by readOneRandom().

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

Definition at line 271 of file RootInputFileSequence.cc.

References rootFile_.

271  {
272  assert(rootFile_);
273  return rootFile_->productRegistry();
274  }
void edm::RootInputFileSequence::fillDescription ( ParameterSetDescription desc)
static

Definition at line 748 of file RootInputFileSequence.cc.

References edm::ParameterSetDescription::addUntracked(), edm::roottree::defaultCacheSize, edm::EventSkipperByID::fillDescription(), edm::GroupSelectorRules::fillDescription(), and edm::DuplicateChecker::fillDescription().

Referenced by edm::PoolSource::fillDescriptions().

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

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

379  {
380  if(fileIter_ == fileIterEnd_) {
381  return InputSource::IsStop;
382  }
383  if(firstFile_) {
384  return InputSource::IsFile;
385  }
386  if(rootFile_) {
387  IndexIntoFile::EntryType entryType = rootFile_->getNextEntryTypeWanted();
388  if(entryType == IndexIntoFile::kEvent) {
389  return InputSource::IsEvent;
390  } else if(entryType == IndexIntoFile::kLumi) {
391  return InputSource::IsLumi;
392  } else if(entryType == IndexIntoFile::kRun) {
393  return InputSource::IsRun;
394  }
395  assert(entryType == IndexIntoFile::kEnd);
396  }
397  if(fileIter_ + 1 == fileIterEnd_) {
398  return InputSource::IsStop;
399  }
400  return InputSource::IsFile;
401  }
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
bool edm::RootInputFileSequence::goToEvent ( EventID const &  eventID)

Definition at line 462 of file RootInputFileSequence.cc.

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

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

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

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

145  {
146  // We are really going to close the open file.
147 
148  // If this is the primary sequence, we are not duplicate checking across files
149  // and we are not using random access to find events, then we can delete the
150  // IndexIntoFile for the file we are closing. If we can't delete all of it,
151  // then we can delete the parts we do not need.
153  size_t currentIndexIntoFile = fileIterLastOpened_ - fileIterBegin_;
154  bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled();
155  bool deleteIndexIntoFile = inputType_ == InputType::Primary &&
156  !needIndexesForDuplicateChecker &&
158  if(deleteIndexIntoFile) {
159  indexesIntoFiles_[currentIndexIntoFile].reset();
160  } else {
161  if(indexesIntoFiles_[currentIndexIntoFile]) indexesIntoFiles_[currentIndexIntoFile]->inputFileClosed();
162  }
164  }
165  closeFile_();
166 
167  if(fileIter_ == fileIterEnd_) {
168  // No files specified
169  return;
170  }
171 
172  // Check if the logical file name was found.
173  if(fileIter_->fileName().empty()) {
174  // LFN not found in catalog.
175  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
176  if(!skipBadFiles) {
177  throw cms::Exception("LogicalFileNameNotFound", "RootInputFileSequence::initFile()\n")
178  << "Logical file name '" << fileIter_->logicalFileName() << "' was not found in the file catalog.\n"
179  << "If you wanted a local file, you forgot the 'file:' prefix\n"
180  << "before the file name in your configuration file.\n";
181  }
182  LogWarning("") << "Input logical file: " << fileIter_->logicalFileName() << " was not found in the catalog, and will be skipped.\n";
183  return;
184  }
185 
186  // Determine whether we have a fallback URL specified; if so, prepare it;
187  // Only valid if it is non-empty and differs from the original filename.
188  std::string fallbackName = fileIter_->fallbackFileName();
189  bool hasFallbackUrl = !fallbackName.empty() && fallbackName != fileIter_->fileName();
190 
191  boost::shared_ptr<InputFile> filePtr;
192  try {
193  std::unique_ptr<InputSource::FileOpenSentry>
194  sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_) : 0);
195  filePtr.reset(new InputFile(gSystem->ExpandPathName(fileIter_->fileName().c_str()), " Initiating request to open file "));
196  }
197  catch (cms::Exception const& e) {
198  if(!skipBadFiles) {
199  if(hasFallbackUrl) {
200  std::ostringstream out;
201  out << e.explainSelf();
202  std::string pfn(gSystem->ExpandPathName(fallbackName.c_str()));
203  InputFile::reportFallbackAttempt(pfn, fileIter_->logicalFileName(), out.str());
204  } else {
205  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
206  Exception ex(errors::FileOpenError, "", e);
207  ex.addContext("Calling RootInputFileSequence::initFile()");
208  ex.clearMessage();
209  ex << "Input file " << fileIter_->fileName() << " was not found, could not be opened, or is corrupted.\n";
210  throw ex;
211  }
212  }
213  }
214  if(!filePtr && (hasFallbackUrl)) {
215  try {
216  std::unique_ptr<InputSource::FileOpenSentry>
217  sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_) : 0);
218  filePtr.reset(new InputFile(gSystem->ExpandPathName(fallbackName.c_str()), " Fallback request to file "));
219  }
220  catch (cms::Exception const& e) {
221  if(!skipBadFiles) {
222  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
224  ex.addContext("Calling RootInputFileSequence::initFile()");
225  ex.clearMessage();
226  ex << "Input file " << fileIter_->fileName() << " was not found, could not be opened, or is corrupted.\n";
227  ex << "Fallback Input file " << fallbackName << " also was not found, could not be opened, or is corrupted.\n";
228  throw ex;
229  }
230  }
231  }
232  if(filePtr) {
233  std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile = fileIter_ - fileIterBegin_;
234  rootFile_ = RootFileSharedPtr(new RootFile(fileIter_->fileName(),
235  processConfiguration(), fileIter_->logicalFileName(), filePtr,
239  setRun_,
240  noEventSort_,
242  inputType_,
246  currentIndexIntoFile,
249  usingGoToEvent_));
250 
252  indexesIntoFiles_[currentIndexIntoFile] = rootFile_->indexIntoFileSharedPtr();
253  char const* inputType = 0;
254  switch(inputType_) {
255  case InputType::Primary: inputType = "primaryFiles"; break;
256  case InputType::SecondaryFile: inputType = "secondaryFiles"; break;
257  case InputType::SecondarySource: inputType = "mixingFiles"; break;
258  }
259  rootFile_->reportOpened(inputType);
260  } else {
261  InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName());
262  if(!skipBadFiles) {
264  "RootInputFileSequence::initFile(): Input file " << fileIter_->fileName() << " was not found or could not be opened.\n";
265  }
266  LogWarning("") << "Input file: " << fileIter_->fileName() << " was not found or could not be opened, and will be skipped.\n";
267  }
268  }
std::vector< boost::shared_ptr< IndexIntoFile > > indexesIntoFiles_
list pfn
Definition: dbtoconf.py:76
ProcessConfiguration const & processConfiguration() const
virtual std::string explainSelf() const
Definition: Exception.cc:146
std::vector< FileCatalogItem >::const_iterator fileIter_
GroupSelectorRules groupSelectorRules_
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:229
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< 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 ( PrincipalCache cache)
private

Definition at line 276 of file RootInputFileSequence.cc.

References edm::PrincipalCache::adjustEventToNewProductRegistry(), edm::PrincipalCache::adjustIndexesAfterProductRegistryAddition(), branchesMustMatch_, edm::hlt::Exception, fileIter_, fileIterBegin_, fileIterEnd_, initFile(), inputType_, edm::ProductRegistry::merge(), edm::errors::MismatchedInputFiles, parametersMustMatch_, edm::InputType::Primary, productRegistry(), productRegistryUpdate(), rootFile_, findQualityFiles::size, and skipBadFiles_.

Referenced by readFile_(), and skipEvents().

276  {
278  if(fileIter_ == fileIterEnd_) {
280  return false;
281  } else {
283  }
284  }
285 
287 
289  size_t size = productRegistry()->size();
290  // make sure the new product registry is compatible with the main one
291  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
292  fileIter_->fileName(),
295  if(!mergeInfo.empty()) {
296  throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::nextFile()") << mergeInfo;
297  }
298  if(productRegistry()->size() > size) {
299  cache.adjustIndexesAfterProductRegistryAddition();
300  }
301  cache.adjustEventToNewProductRegistry(productRegistry());
302  }
303  return true;
304  }
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_
tuple size
Write out results.
boost::shared_ptr< ProductRegistry const > productRegistry() const
RootInputFileSequence& edm::RootInputFileSequence::operator= ( RootInputFileSequence const &  )
delete
bool edm::RootInputFileSequence::previousFile ( PrincipalCache cache)
private

Definition at line 306 of file RootInputFileSequence.cc.

References edm::PrincipalCache::adjustEventToNewProductRegistry(), edm::PrincipalCache::adjustIndexesAfterProductRegistryAddition(), branchesMustMatch_, edm::hlt::Exception, fileIter_, fileIterBegin_, fileIterEnd_, initFile(), inputType_, edm::ProductRegistry::merge(), edm::errors::MismatchedInputFiles, parametersMustMatch_, edm::InputType::Primary, productRegistry(), productRegistryUpdate(), rootFile_, and findQualityFiles::size.

Referenced by skipEvents().

306  {
307  if(fileIter_ == fileIterBegin_) {
309  return false;
310  } else {
312  }
313  }
314  --fileIter_;
315 
316  initFile(false);
317 
319  size_t size = productRegistry()->size();
320  // make sure the new product registry is compatible to the main one
321  std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(),
322  fileIter_->fileName(),
325  if(!mergeInfo.empty()) {
326  throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::previousEvent()") << mergeInfo;
327  }
328  if(productRegistry()->size() > size) {
329  cache.adjustIndexesAfterProductRegistryAddition();
330  }
331  cache.adjustEventToNewProductRegistry(productRegistry());
332  }
333  if(rootFile_) rootFile_->setToLastEntry();
334  return true;
335  }
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_
tuple size
Write out results.
boost::shared_ptr< ProductRegistry const > productRegistry() const
ProcessConfiguration const & edm::RootInputFileSequence::processConfiguration ( ) const
private

Definition at line 563 of file RootInputFileSequence.cc.

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

Referenced by initFile().

563  {
564  return input_.processConfiguration();
565  }
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:184
boost::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::productRegistry ( ) const
private

Definition at line 583 of file RootInputFileSequence.cc.

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

Referenced by nextFile(), and previousFile().

583  {
584  return input_.productRegistry();
585  }
boost::shared_ptr< ProductRegistry const > productRegistry() const
Accessor for product registry.
Definition: InputSource.h:155
ProductRegistry & edm::RootInputFileSequence::productRegistryUpdate ( ) const
private

Definition at line 578 of file RootInputFileSequence.cc.

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

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

578  {
579  return input_.productRegistryUpdate();
580  }
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:295
EventPrincipal * edm::RootInputFileSequence::readEvent ( EventPrincipal cache,
boost::shared_ptr< LuminosityBlockPrincipal lb 
)

Definition at line 374 of file RootInputFileSequence.cc.

References rootFile_.

374  {
375  return rootFile_->readEvent(cache, lb);
376  }
boost::shared_ptr< FileBlock > edm::RootInputFileSequence::readFile_ ( PrincipalCache cache)

Definition at line 114 of file RootInputFileSequence.cc.

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

114  {
115  if(firstFile_) {
116  // The first input file has already been opened.
117  firstFile_ = false;
118  if(!rootFile_) {
120  }
121  } else {
122  if(!nextFile(cache)) {
123  assert(0);
124  }
125  }
126  if(!rootFile_) {
127  return boost::shared_ptr<FileBlock>(new FileBlock);
128  }
129  return rootFile_->createFileBlock();
130  }
void initFile(bool skipBadFiles)
bool nextFile(PrincipalCache &cache)
boost::shared_ptr< LuminosityBlockPrincipal > edm::RootInputFileSequence::readLuminosityBlock_ ( boost::shared_ptr< LuminosityBlockPrincipal lbCache)

Definition at line 356 of file RootInputFileSequence.cc.

References rootFile_.

356  {
357  return rootFile_->readLumi(lbCache);
358  }
boost::shared_ptr< LuminosityBlockAuxiliary > edm::RootInputFileSequence::readLuminosityBlockAuxiliary_ ( )

Definition at line 346 of file RootInputFileSequence.cc.

References rootFile_.

346  {
347  return rootFile_->readLuminosityBlockAuxiliary_();
348  }
EventPrincipal * edm::RootInputFileSequence::readOneRandom ( )

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

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

Definition at line 709 of file RootInputFileSequence.cc.

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

709  {
711  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandomWithID(): no input files specified for secondary input source.\n";
712  }
713  if(!flatDistribution_) {
715  CLHEP::HepRandomEngine& engine = rng->getEngine();
716  flatDistribution_.reset(new CLHEP::RandFlat(engine));
717  }
718  skipBadFiles_ = false;
719  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
720  rootFile_->indexIntoFileIter().run() != id.run() ||
721  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
722  bool found = skipToItem(id.run(), id.luminosityBlock(), 0);
723  if(!found) {
724  return 0;
725  }
726  int eventsInLumi = 0;
727  while(rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock())) ++eventsInLumi;
728  found = skipToItem(id.run(), id.luminosityBlock(), 0);
729  assert(found);
730  int eventInLumi = flatDistribution_->fireInt(eventsInLumi);
731  for(int i = 0; i < eventInLumi; ++i) {
732  bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
733  assert(found);
734  }
735  }
736  bool nextFound = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
737  EventPrincipal* ep = (nextFound ? rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal()) : 0);
738  if(ep == 0) {
739  bool found = rootFile_->setEntryAtItem(id.run(), id.luminosityBlock(), 0);
740  if(found) {
741  return readOneRandomWithID(id);
742  }
743  }
744  return ep;
745  }
int i
Definition: DBlmapReader.cc:9
EventPrincipal * readOneRandomWithID(LuminosityBlockID const &id)
std::vector< FileCatalogItem >::const_iterator fileIter_
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, bool currentFileFirst=true)
std::unique_ptr< CLHEP::RandFlat > flatDistribution_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
EventPrincipal * edm::RootInputFileSequence::readOneSequential ( )

Definition at line 602 of file RootInputFileSequence.cc.

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

602  {
603  skipBadFiles_ = false;
604  if(fileIter_ == fileIterEnd_ || !rootFile_) {
606  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified for secondary input source.\n";
607  }
609  initFile(false);
610  rootFile_->setAtEventEntry(-1);
611  }
612  rootFile_->nextEventEntry();
613  EventPrincipal* ep = rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal());
614  if(ep == 0) {
615  ++fileIter_;
616  if(fileIter_ == fileIterEnd_) {
617  return 0;
618  }
619  initFile(false);
620  rootFile_->setAtEventEntry(-1);
621  return readOneSequential();
622  }
623  return ep;
624  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
EventPrincipal * edm::RootInputFileSequence::readOneSequentialWithID ( LuminosityBlockID const &  id)

Definition at line 627 of file RootInputFileSequence.cc.

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

627  {
629  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequentialWithID(): no input files specified for secondary input source.\n";
630  }
631  skipBadFiles_ = false;
632  if(fileIter_ == fileIterEnd_ || !rootFile_ ||
633  rootFile_->indexIntoFileIter().run() != id.run() ||
634  rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) {
635  bool found = skipToItem(id.run(), id.luminosityBlock(), 0, false);
636  if(!found) {
637  return 0;
638  }
639  }
640  bool nextFound = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
641  EventPrincipal* ep = (nextFound ? rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal()) : 0);
642  if(ep == 0) {
643  bool found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0);
644  if(found) {
645  return readOneSequentialWithID(id);
646  }
647  }
648  return ep;
649  }
std::vector< FileCatalogItem >::const_iterator fileIter_
EventPrincipal * readOneSequentialWithID(LuminosityBlockID const &id)
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)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
EventPrincipal * edm::RootInputFileSequence::readOneSpecified ( EventID const &  id)

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

652  {
654  throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified for secondary input source.\n";
655  }
656  skipBadFiles_ = false;
657  bool found = skipToItem(id.run(), id.luminosityBlock(), id.event());
658  if(!found) {
659  throw Exception(errors::NotFound) <<
660  "RootInputFileSequence::readOneSpecified(): Secondary Input files" <<
661  " do not contain specified event:\n" << id << "\n";
662  }
663  EventPrincipal* ep = rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal());
664  assert(ep != 0);
665  return ep;
666  }
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 rpCache)

Definition at line 351 of file RootInputFileSequence.cc.

References rootFile_.

351  {
352  return rootFile_->readRun_(rpCache);
353  }
boost::shared_ptr< RunAuxiliary > edm::RootInputFileSequence::readRunAuxiliary_ ( )

Definition at line 341 of file RootInputFileSequence.cc.

References rootFile_.

341  {
342  return rootFile_->readRunAuxiliary_();
343  }
int edm::RootInputFileSequence::remainingEvents ( ) const
private

Definition at line 568 of file RootInputFileSequence.cc.

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

Referenced by initFile().

568  {
569  return input_.remainingEvents();
570  }
int remainingEvents() const
Definition: InputSource.h:170
int edm::RootInputFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 573 of file RootInputFileSequence.cc.

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

Referenced by initFile().

573  {
575  }
int remainingLuminosityBlocks() const
Definition: InputSource.h:178
void edm::RootInputFileSequence::reset ( PrincipalCache cache)

Definition at line 424 of file RootInputFileSequence.cc.

References fileIter_, fileIterBegin_, fileIterEnd_, firstFile_, initFile(), inputType_, numberOfEventsToSkip_, rootFile_, edm::InputType::SecondarySource, skipBadFiles_, and skipEvents().

424  {
425  //NOTE: Need to handle duplicate checker
426  // Also what if skipBadFiles_==true and the first time we succeeded but after a reset we fail?
428  firstFile_ = true;
431  if(rootFile_) break;
432  }
433  if(rootFile_) {
434  if(numberOfEventsToSkip_ != 0) {
436  }
437  }
438  }
439  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
bool skipEvents(int offset, PrincipalCache &cache)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
InputType::InputType inputType_
ProcessingController::ReverseState edm::RootInputFileSequence::reverseState ( ) const
void edm::RootInputFileSequence::rewind_ ( )

Definition at line 405 of file RootInputFileSequence.cc.

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

405  {
406  if(fileIter_ != fileIterBegin_) {
407  closeFile_();
409  }
410  if(!rootFile_) {
411  initFile(false);
412  }
413  rewindFile();
414  firstFile_ = true;
415  }
void initFile(bool skipBadFiles)
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
void edm::RootInputFileSequence::rewindFile ( )
private

Definition at line 419 of file RootInputFileSequence.cc.

References rootFile_.

Referenced by rewind_().

419  {
420  if(rootFile_) rootFile_->rewind();
421  }
bool edm::RootInputFileSequence::skipEvents ( int  offset,
PrincipalCache cache 
)

Definition at line 443 of file RootInputFileSequence.cc.

References fileIter_, fileIterEnd_, nextFile(), numberOfEventsToSkip_, evf::evtn::offset(), previousFile(), and rootFile_.

Referenced by reset(), and RootInputFileSequence().

443  {
446  while(numberOfEventsToSkip_ != 0) {
447  bool atEnd = rootFile_->skipEvents(numberOfEventsToSkip_);
448  if((numberOfEventsToSkip_ > 0 || atEnd) && !nextFile(cache)) {
450  return false;
451  }
452  if(numberOfEventsToSkip_ < 0 && !previousFile(cache)) {
455  return false;
456  }
457  }
458  return true;
459  }
std::vector< FileCatalogItem >::const_iterator fileIter_
unsigned int offset(bool)
bool nextFile(PrincipalCache &cache)
bool previousFile(PrincipalCache &cache)
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 532 of file RootInputFileSequence.cc.

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

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

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

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

Referenced by readOneSequentialWithID(), and skipToItem().

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

Referenced by initFile().

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

Definition at line 111 of file RootInputFileSequence.h.

Referenced by closeFile_(), and initFile().

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

Definition at line 102 of file RootInputFileSequence.h.

Referenced by initFile().

int edm::RootInputFileSequence::eventsRemainingInFile_
private

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

Referenced by initFile().

bool edm::RootInputFileSequence::firstFile_
private

Definition at line 89 of file RootInputFileSequence.h.

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

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

Definition at line 98 of file RootInputFileSequence.h.

Referenced by readOneRandom(), and readOneRandomWithID().

GroupSelectorRules edm::RootInputFileSequence::groupSelectorRules_
private

Definition at line 110 of file RootInputFileSequence.h.

Referenced by dropUnwantedBranches_(), and initFile().

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

Definition at line 99 of file RootInputFileSequence.h.

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

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

Definition at line 113 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::noEventSort_
private

Definition at line 105 of file RootInputFileSequence.h.

Referenced by initFile().

int edm::RootInputFileSequence::numberOfEventsToSkip_
private

Definition at line 104 of file RootInputFileSequence.h.

Referenced by initFile(), reset(), RootInputFileSequence(), and skipEvents().

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

Definition at line 100 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 95 of file RootInputFileSequence.h.

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

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

Definition at line 109 of file RootInputFileSequence.h.

Referenced by initFile().

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

Definition at line 107 of file RootInputFileSequence.h.

Referenced by initFile(), and RootInputFileSequence().

int const edm::RootInputFileSequence::treeMaxVirtualSize_
private

Definition at line 108 of file RootInputFileSequence.h.

Referenced by initFile().

bool edm::RootInputFileSequence::usingGoToEvent_
private

Definition at line 114 of file RootInputFileSequence.h.

Referenced by goToEvent(), and initFile().