CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::RootPrimaryFileSequence Class Reference

#include <RootPrimaryFileSequence.h>

Inheritance diagram for edm::RootPrimaryFileSequence:
edm::RootInputFileSequence

Public Member Functions

void closeFile_ () override
 
void endJob ()
 
ProcessingController::ForwardState forwardState () const
 
InputSource::ItemType getNextItemType (RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
 
bool goToEvent (EventID const &eventID)
 
RootPrimaryFileSequenceoperator= (RootPrimaryFileSequence const &)=delete
 
std::shared_ptr< FileBlockreadFile_ ()
 
ProcessingController::ReverseState reverseState () const
 
void rewind_ ()
 
 RootPrimaryFileSequence (ParameterSet const &pset, PoolSource &input, InputFileCatalog const &catalog)
 
 RootPrimaryFileSequence (RootPrimaryFileSequence const &)=delete
 
void skipEvents (int offset)
 
void skipEventsAtBeginning (int offset)
 
 ~RootPrimaryFileSequence () override
 
- Public Member Functions inherited from edm::RootInputFileSequence
bool containedInCurrentFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
std::shared_ptr< BranchIDListHelper const > fileBranchIDListHelper () const
 
std::shared_ptr< ProductRegistry const > fileProductRegistry () const
 
void fillProcessBlockHelper_ ()
 
bool nextProcessBlock_ (ProcessBlockPrincipal &)
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
bool readEvent (EventPrincipal &cache)
 
void readLuminosityBlock_ (LuminosityBlockPrincipal &lumiPrincipal)
 
std::shared_ptr< LuminosityBlockAuxiliaryreadLuminosityBlockAuxiliary_ ()
 
void readProcessBlock_ (ProcessBlockPrincipal &)
 
void readRun_ (RunPrincipal &runPrincipal)
 
std::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
 RootInputFileSequence (ParameterSet const &pset, InputFileCatalog const &catalog)
 
 RootInputFileSequence (RootInputFileSequence const &)=delete
 
bool skipToItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
 
virtual ~RootInputFileSequence ()
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Member Functions

std::shared_ptr< DuplicateChecker > & duplicateChecker ()
 
std::shared_ptr< DuplicateChecker const > duplicateChecker () const
 
std::shared_ptr< EventSkipperByID > & eventSkipperByID ()
 
std::shared_ptr< EventSkipperByID const > eventSkipperByID () const
 
void initFile_ (bool skipBadFiles) override
 
RootFileSharedPtr makeRootFile (std::shared_ptr< InputFile > filePtr) override
 
bool nextFile ()
 
bool previousFile ()
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void rewindFile ()
 

Private Attributes

BranchDescription::MatchMode branchesMustMatch_
 
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
 
bool enablePrefetching_
 
bool enforceGUIDInFileName_
 
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
 
edm::propagate_const< std::shared_ptr< FileBlock > > fb_
 
bool firstFile_
 
EventID goToEventID_
 
bool goToEventInNewFile_ = false
 
size_t goToFileSequenceOffset_ = 0
 
int initialNumberOfEventsToSkip_
 
PoolSourceinput_
 
bool noEventSort_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
bool skipIntoNewFile_ = false
 
size_t skipToFileSequenceNumber_ = 0
 
int skipToOffsetInFinalFile_ = 0
 
bool skipToStop_ = false
 
unsigned int treeCacheSize_
 
bool usingGoToEvent_
 

Additional Inherited Members

- Protected Types inherited from edm::RootInputFileSequence
typedef std::shared_ptr< RootFileRootFileSharedPtr
 
- Protected Member Functions inherited from edm::RootInputFileSequence
bool atFirstFile () const
 
bool atLastFile () const
 
std::vector< FileCatalogItem > const & fileCatalogItems () const
 
std::vector< std::string > const & fileNames () const
 
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles () const
 
void initFile (bool skipBadFiles)
 
void initTheFile (bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
 
std::string const & lfn () const
 
size_t lfnHash () const
 
std::string const & logicalFileName () const
 
bool noFiles () const
 
bool noMoreFiles () const
 
size_t numberOfFiles () const
 
std::shared_ptr< RootFile > & rootFile ()
 
std::shared_ptr< RootFile const > rootFile () const
 
size_t sequenceNumberOfFile () const
 
void setAtFileSequenceNumber (size_t offset)
 
void setAtFirstFile ()
 
void setAtNextFile ()
 
void setAtPreviousFile ()
 
void setIndexIntoFile (size_t index)
 
void setNoMoreFiles ()
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash)
 
bool usedFallback () const
 

Detailed Description

Definition at line 34 of file RootPrimaryFileSequence.h.

Constructor & Destructor Documentation

◆ RootPrimaryFileSequence() [1/2]

edm::RootPrimaryFileSequence::RootPrimaryFileSequence ( ParameterSet const &  pset,
PoolSource input,
InputFileCatalog const &  catalog 
)
explicit

Definition at line 22 of file RootPrimaryFileSequence.cc.

26  input_(input),
27  firstFile_(true),
31  initialNumberOfEventsToSkip_(pset.getUntrackedParameter<unsigned int>("skipEvents")),
32  noEventSort_(pset.getUntrackedParameter<bool>("noEventSort")),
33  treeCacheSize_(noEventSort_ ? pset.getUntrackedParameter<unsigned int>("cacheSize") : 0U),
34  duplicateChecker_(new DuplicateChecker(pset)),
35  usingGoToEvent_(false),
36  enablePrefetching_(false),
37  enforceGUIDInFileName_(pset.getUntrackedParameter<bool>("enforceGUIDInFileName")) {
38  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
40  if (pSLC.isAvailable()) {
41  if (treeCacheSize_ != 0U && pSLC->sourceTTreeCacheSize()) {
42  treeCacheSize_ = *(pSLC->sourceTTreeCacheSize());
43  }
44  enablePrefetching_ = pSLC->enablePrefetching();
45  }
46 
47  std::string branchesMustMatch =
48  pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
49  if (branchesMustMatch == std::string("strict"))
51 
52  // Prestage the files
55  }
56  // Open the first file.
59  if (rootFile())
60  break;
61  }
62  if (rootFile()) {
63  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
66  }
67  }
68  }

References branchesMustMatch_, enablePrefetching_, edm::RootInputFileSequence::fileNames(), StorageFactory::get(), edm::RootInputFileSequence::initFile(), initialNumberOfEventsToSkip_, input_, edm::Service< T >::isAvailable(), edm::RootInputFileSequence::noMoreFiles(), edm::PoolSource::productRegistryUpdate(), muonDTDigis_cfi::pset, edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::setAtFirstFile(), edm::RootInputFileSequence::setAtNextFile(), edm::PoolSource::skipBadFiles(), skipEventsAtBeginning(), StorageFactory::stagein(), edm::BranchDescription::Strict, AlCaHLTBitMon_QueryRunRegistry::string, treeCacheSize_, mitigatedMETSequence_cff::U, and edm::ProductRegistry::updateFromInput().

◆ ~RootPrimaryFileSequence()

edm::RootPrimaryFileSequence::~RootPrimaryFileSequence ( )
override

Definition at line 70 of file RootPrimaryFileSequence.cc.

70 {}

◆ RootPrimaryFileSequence() [2/2]

edm::RootPrimaryFileSequence::RootPrimaryFileSequence ( RootPrimaryFileSequence const &  )
delete

Member Function Documentation

◆ closeFile_()

void edm::RootPrimaryFileSequence::closeFile_ ( )
overridevirtual

Implements edm::RootInputFileSequence.

Definition at line 117 of file RootPrimaryFileSequence.cc.

117  {
118  // close the currently open file, if any, and delete the RootFile object.
119  if (rootFile()) {
120  auto sentry = std::make_unique<InputSource::FileCloseSentry>(input_, lfn(), usedFallback());
121  rootFile()->close();
122  if (duplicateChecker_)
123  duplicateChecker_->inputFileClosed();
124  rootFile().reset();
125  }
126  }

References duplicateChecker_, input_, edm::RootInputFileSequence::lfn(), edm::RootInputFileSequence::rootFile(), and edm::RootInputFileSequence::usedFallback().

Referenced by endJob(), and rewind_().

◆ duplicateChecker() [1/2]

std::shared_ptr<DuplicateChecker>& edm::RootPrimaryFileSequence::duplicateChecker ( )
inlineprivate

◆ duplicateChecker() [2/2]

std::shared_ptr<DuplicateChecker const> edm::RootPrimaryFileSequence::duplicateChecker ( ) const
inlineprivate

Definition at line 71 of file RootPrimaryFileSequence.h.

References duplicateChecker_, and edm::get_underlying_safe().

Referenced by makeRootFile().

◆ endJob()

void edm::RootPrimaryFileSequence::endJob ( void  )

Definition at line 72 of file RootPrimaryFileSequence.cc.

72 { closeFile_(); }

References closeFile_().

◆ eventSkipperByID() [1/2]

std::shared_ptr<EventSkipperByID>& edm::RootPrimaryFileSequence::eventSkipperByID ( )
inlineprivate

◆ eventSkipperByID() [2/2]

std::shared_ptr<EventSkipperByID const> edm::RootPrimaryFileSequence::eventSkipperByID ( ) const
inlineprivate

Definition at line 69 of file RootPrimaryFileSequence.h.

References eventSkipperByID_, and edm::get_underlying_safe().

Referenced by makeRootFile().

◆ fillDescription()

void edm::RootPrimaryFileSequence::fillDescription ( ParameterSetDescription desc)
static

Definition at line 403 of file RootPrimaryFileSequence.cc.

403  {
404  desc.addUntracked<unsigned int>("skipEvents", 0U)
405  ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed.");
406  desc.addUntracked<bool>("noEventSort", true)
407  ->setComment(
408  "True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n"
409  "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note "
410  "3).\n"
411  "Note 1: Events within the same lumi will always be processed contiguously.\n"
412  "Note 2: Lumis within the same run will always be processed contiguously.\n"
413  "Note 3: Any sorting occurs independently in each input file (no sorting across input files).");
414  desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize)
415  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
416  std::string defaultString("permissive");
417  desc.addUntracked<std::string>("branchesMustMatch", defaultString)
418  ->setComment(
419  "'strict': Branches in each input file must match those in the first file.\n"
420  "'permissive': Branches in each input file may be any subset of those in the first file.");
421  desc.addUntracked<bool>("enforceGUIDInFileName", false)
422  ->setComment(
423  "True: file name part is required to be equal to the GUID of the file\n"
424  "False: file name can be anything");
425 
428  }

References edm::roottree::defaultCacheSize, submitPVResolutionJobs::desc, edm::EventSkipperByID::fillDescription(), edm::DuplicateChecker::fillDescription(), AlCaHLTBitMon_QueryRunRegistry::string, and mitigatedMETSequence_cff::U.

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

◆ forwardState()

ProcessingController::ForwardState edm::RootPrimaryFileSequence::forwardState ( ) const

◆ getNextItemType()

InputSource::ItemType edm::RootPrimaryFileSequence::getNextItemType ( RunNumber_t run,
LuminosityBlockNumber_t lumi,
EventNumber_t event 
)

◆ goToEvent()

bool edm::RootPrimaryFileSequence::goToEvent ( EventID const &  eventID)

Definition at line 346 of file RootPrimaryFileSequence.cc.

346  {
347  usingGoToEvent_ = true;
348  if (rootFile()) {
349  if (rootFile()->goToEvent(eventID)) {
350  return true;
351  }
352  // If only one input file, give up now, to save time.
353  if (rootFile() && indexesIntoFiles().size() == 1) {
354  return false;
355  }
356  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
357  for (auto it = indexesIntoFiles().begin(), itEnd = indexesIntoFiles().end(); it != itEnd; ++it) {
358  if (*it && (*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
359  goToEventInNewFile_ = true;
360  goToFileSequenceOffset_ = it - indexesIntoFiles().begin();
361  goToEventID_ = eventID;
362  return true;
363  }
364  }
365 
366  // Save the current file and position so that we can restore them
367  bool closedOriginalFile = false;
368  size_t const originalFileSequenceNumber = sequenceNumberOfFile();
369  IndexIntoFile::IndexIntoFileItr originalPosition = rootFile()->indexIntoFileIter();
370 
371  // Look for item in files not yet opened.
372  bool foundIt = false;
373  for (auto it = indexesIntoFiles().begin(), itEnd = indexesIntoFiles().end(); it != itEnd; ++it) {
374  if (!*it) {
376  initFile(false);
377  assert(rootFile());
378  closedOriginalFile = true;
379  if ((*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
380  foundIt = true;
381  goToEventInNewFile_ = true;
382  goToFileSequenceOffset_ = it - indexesIntoFiles().begin();
383  goToEventID_ = eventID;
384  }
385  }
386  }
387  if (closedOriginalFile) {
388  setAtFileSequenceNumber(originalFileSequenceNumber);
389  initFile(false);
390  assert(rootFile());
391  rootFile()->setPosition(originalPosition);
392  rootFile()->updateFileBlock(*fb_);
393  }
394  return foundIt;
395  }
396  return false;
397  }

References cms::cuda::assert(), mps_fire::end, edm::EventID::event(), fb_, goToEventID_, goToEventInNewFile_, goToFileSequenceOffset_, edm::RootInputFileSequence::indexesIntoFiles(), edm::RootInputFileSequence::initFile(), edm::EventID::luminosityBlock(), edm::RootInputFileSequence::rootFile(), edm::EventID::run(), edm::RootInputFileSequence::sequenceNumberOfFile(), edm::RootInputFileSequence::setAtFileSequenceNumber(), findQualityFiles::size, and usingGoToEvent_.

◆ initFile_()

void edm::RootPrimaryFileSequence::initFile_ ( bool  skipBadFiles)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 128 of file RootPrimaryFileSequence.cc.

128  {
129  // If we are not duplicate checking across files and we are not using random access to find events,
130  // then we can delete the IndexIntoFile for the file we are closing.
131  // If we can't delete all of it, then we can delete the parts we do not need.
132  bool deleteIndexIntoFile = !usingGoToEvent_ && !(duplicateChecker_ && duplicateChecker_->checkingAllFiles() &&
133  !duplicateChecker_->checkDisabled());
134  initTheFile(skipBadFiles, deleteIndexIntoFile, &input_, "primaryFiles", InputType::Primary);
135  }

References duplicateChecker_, edm::RootInputFileSequence::initTheFile(), input_, edm::Primary, remoteMonitoring_LED_IterMethod_cfg::skipBadFiles, and usingGoToEvent_.

◆ makeRootFile()

RootPrimaryFileSequence::RootFileSharedPtr edm::RootPrimaryFileSequence::makeRootFile ( std::shared_ptr< InputFile filePtr)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 137 of file RootPrimaryFileSequence.cc.

137  {
138  size_t currentIndexIntoFile = sequenceNumberOfFile();
139  return std::make_shared<RootFile>(fileNames()[0],
141  logicalFileName(),
142  filePtr,
145  remainingEvents(),
147  input_.nStreams(),
151  input_.runHelper(),
152  noEventSort_,
156  input_.processBlockHelper().get(),
158  nullptr, // associationsFromSecondary
163  currentIndexIntoFile,
170  }

References edm::InputSource::branchIDListHelper(), edm::PoolSource::bypassVersionCheck(), edm::PoolSource::dropDescendants(), duplicateChecker(), enablePrefetching_, enforceGUIDInFileName_, eventSkipperByID(), edm::RootInputFileSequence::fileNames(), edm::RootInputFileSequence::indexesIntoFiles(), initialNumberOfEventsToSkip_, input_, edm::PoolSource::labelRawDataLikeMC(), edm::RootInputFileSequence::logicalFileName(), noEventSort_, edm::PoolSource::nStreams(), orderedProcessHistoryIDs_, edm::Primary, edm::InputSource::processBlockHelper(), edm::InputSource::processConfiguration(), edm::PoolSource::processHistoryRegistryForUpdate(), edm::InputSource::processingMode(), edm::PoolSource::productSelectorRules(), remainingEvents(), remainingLuminosityBlocks(), edm::PoolSource::runHelper(), edm::RootInputFileSequence::sequenceNumberOfFile(), edm::InputSource::thinnedAssociationsHelper(), treeCacheSize_, edm::PoolSource::treeMaxVirtualSize(), and usingGoToEvent_.

◆ nextFile()

bool edm::RootPrimaryFileSequence::nextFile ( )
private

Definition at line 172 of file RootPrimaryFileSequence.cc.

172  {
173  do {
174  if (!noMoreFiles())
175  setAtNextFile();
176  if (noMoreFiles()) {
177  return false;
178  }
179 
181  if (rootFile()) {
182  break;
183  }
184  // If we are not skipping bad files and the file
185  // open failed, then initFile should have thrown
187  } while (true);
188 
189  // make sure the new product registry is compatible with the main one
190  std::string mergeInfo =
191  input_.productRegistryUpdate().merge(*rootFile()->productRegistry(), fileNames()[0], branchesMustMatch_);
192  if (!mergeInfo.empty()) {
193  throw Exception(errors::MismatchedInputFiles, "RootPrimaryFileSequence::nextFile()") << mergeInfo;
194  }
195  return true;
196  }

References cms::cuda::assert(), branchesMustMatch_, Exception, edm::RootInputFileSequence::fileNames(), edm::RootInputFileSequence::initFile(), input_, edm::ProductRegistry::merge(), edm::errors::MismatchedInputFiles, edm::RootInputFileSequence::noMoreFiles(), edm::PoolSource::productRegistryUpdate(), edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::setAtNextFile(), edm::PoolSource::skipBadFiles(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by readFile_(), skipEvents(), and skipEventsAtBeginning().

◆ operator=()

RootPrimaryFileSequence& edm::RootPrimaryFileSequence::operator= ( RootPrimaryFileSequence const &  )
delete

◆ previousFile()

bool edm::RootPrimaryFileSequence::previousFile ( )
private

Definition at line 198 of file RootPrimaryFileSequence.cc.

198  {
199  if (atFirstFile()) {
200  return false;
201  }
203 
204  initFile(false);
205 
206  if (rootFile()) {
207  // make sure the new product registry is compatible to the main one
208  std::string mergeInfo =
209  input_.productRegistryUpdate().merge(*rootFile()->productRegistry(), fileNames()[0], branchesMustMatch_);
210  if (!mergeInfo.empty()) {
211  throw Exception(errors::MismatchedInputFiles, "RootPrimaryFileSequence::previousEvent()") << mergeInfo;
212  }
213  }
214  if (rootFile())
215  rootFile()->setToLastEntry();
216  return true;
217  }

References edm::RootInputFileSequence::atFirstFile(), branchesMustMatch_, Exception, edm::RootInputFileSequence::fileNames(), edm::RootInputFileSequence::initFile(), input_, edm::ProductRegistry::merge(), edm::errors::MismatchedInputFiles, edm::PoolSource::productRegistryUpdate(), edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::setAtPreviousFile(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by skipEvents().

◆ readFile_()

std::shared_ptr< FileBlock > edm::RootPrimaryFileSequence::readFile_ ( )

Definition at line 74 of file RootPrimaryFileSequence.cc.

74  {
75  std::shared_ptr<FileBlock> fileBlock;
76  if (firstFile_) {
77  firstFile_ = false;
78  // Usually the first input file will already be open
79  if (!rootFile()) {
81  }
82  } else if (goToEventInNewFile_) {
83  goToEventInNewFile_ = false;
85  initFile(false);
86  assert(rootFile());
87  bool found = rootFile()->goToEvent(goToEventID_);
88  assert(found);
89  } else if (skipIntoNewFile_) {
90  skipIntoNewFile_ = false;
92  initFile(false);
93  assert(rootFile());
94  if (skipToOffsetInFinalFile_ < 0) {
95  rootFile()->setToLastEntry();
96  }
97  bool atEnd = rootFile()->skipEvents(skipToOffsetInFinalFile_);
98  assert(!atEnd && skipToOffsetInFinalFile_ == 0);
99  } else {
100  if (!nextFile()) {
101  // handle case with last file bad and
102  // skipBadFiles true
103  fb_ = fileBlock;
104  return fileBlock;
105  }
106  }
107  if (!rootFile()) {
108  fileBlock = std::make_shared<FileBlock>();
109  fb_ = fileBlock;
110  return fileBlock;
111  }
112  fileBlock = rootFile()->createFileBlock();
113  fb_ = fileBlock;
114  return fileBlock;
115  }

References cms::cuda::assert(), fb_, firstFile_, newFWLiteAna::found, goToEventID_, goToEventInNewFile_, goToFileSequenceOffset_, edm::RootInputFileSequence::initFile(), input_, nextFile(), edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::setAtFileSequenceNumber(), edm::PoolSource::skipBadFiles(), skipIntoNewFile_, skipToFileSequenceNumber_, and skipToOffsetInFinalFile_.

◆ remainingEvents()

int edm::RootPrimaryFileSequence::remainingEvents ( ) const
private

Definition at line 399 of file RootPrimaryFileSequence.cc.

399 { return input_.remainingEvents(); }

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

Referenced by makeRootFile().

◆ remainingLuminosityBlocks()

int edm::RootPrimaryFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 401 of file RootPrimaryFileSequence.cc.

401 { return input_.remainingLuminosityBlocks(); }

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

Referenced by makeRootFile().

◆ reverseState()

ProcessingController::ReverseState edm::RootPrimaryFileSequence::reverseState ( ) const

◆ rewind_()

void edm::RootPrimaryFileSequence::rewind_ ( )

◆ rewindFile()

void edm::RootPrimaryFileSequence::rewindFile ( )
private

Definition at line 268 of file RootPrimaryFileSequence.cc.

268  {
269  if (rootFile())
270  rootFile()->rewind();
271  }

References edm::RootInputFileSequence::rootFile().

Referenced by rewind_().

◆ skipEvents()

void edm::RootPrimaryFileSequence::skipEvents ( int  offset)

Definition at line 286 of file RootPrimaryFileSequence.cc.

286  {
287  assert(rootFile());
288 
289  bool atEnd = rootFile()->skipEvents(offset);
290  if (!atEnd && offset == 0) {
291  // successfully completed skip within current file
292  return;
293  }
294 
295  // Return, if without closing the current file we know the skip cannot be completed
296  skipToStop_ = false;
297  if (offset > 0 || atEnd) {
298  if (atLastFile() || noMoreFiles()) {
299  skipToStop_ = true;
300  return;
301  }
302  }
303  if (offset < 0 && atFirstFile()) {
304  skipToStop_ = true;
305  return;
306  }
307 
308  // Save the current file and position so that we can restore them
309  size_t const originalFileSequenceNumber = sequenceNumberOfFile();
310  IndexIntoFile::IndexIntoFileItr originalPosition = rootFile()->indexIntoFileIter();
311 
312  if ((offset > 0 || atEnd) && !nextFile()) {
313  skipToStop_ = true; // Can only get here if skipBadFiles is true
314  }
315  if (offset < 0 && !previousFile()) {
316  skipToStop_ = true; // Can't actually get here
317  }
318 
319  if (!skipToStop_) {
320  while (offset != 0) {
322  bool atEnd = rootFile()->skipEvents(offset);
323  if ((offset > 0 || atEnd) && !nextFile()) {
324  skipToStop_ = true;
325  break;
326  }
327  if (offset < 0 && !previousFile()) {
328  skipToStop_ = true;
329  break;
330  }
331  }
332  if (!skipToStop_) {
333  skipIntoNewFile_ = true;
334  }
335  }
337 
338  // Restore the original file and position
339  setAtFileSequenceNumber(originalFileSequenceNumber);
340  initFile(false);
341  assert(rootFile());
342  rootFile()->setPosition(originalPosition);
343  rootFile()->updateFileBlock(*fb_);
344  }

References cms::cuda::assert(), edm::RootInputFileSequence::atFirstFile(), edm::RootInputFileSequence::atLastFile(), fb_, edm::RootInputFileSequence::initFile(), nextFile(), edm::RootInputFileSequence::noMoreFiles(), hltrates_dqm_sourceclient-live_cfg::offset, previousFile(), edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::sequenceNumberOfFile(), edm::RootInputFileSequence::setAtFileSequenceNumber(), skipIntoNewFile_, skipToFileSequenceNumber_, skipToOffsetInFinalFile_, and skipToStop_.

◆ skipEventsAtBeginning()

void edm::RootPrimaryFileSequence::skipEventsAtBeginning ( int  offset)

Definition at line 274 of file RootPrimaryFileSequence.cc.

274  {
275  assert(rootFile());
276  assert(offset >= 0);
277  while (offset != 0) {
278  bool atEnd = rootFile()->skipEvents(offset);
279  if ((offset > 0 || atEnd) && !nextFile()) {
280  return;
281  }
282  }
283  }

References cms::cuda::assert(), nextFile(), hltrates_dqm_sourceclient-live_cfg::offset, and edm::RootInputFileSequence::rootFile().

Referenced by rewind_(), and RootPrimaryFileSequence().

Member Data Documentation

◆ branchesMustMatch_

BranchDescription::MatchMode edm::RootPrimaryFileSequence::branchesMustMatch_
private

Definition at line 66 of file RootPrimaryFileSequence.h.

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

◆ duplicateChecker_

edm::propagate_const<std::shared_ptr<DuplicateChecker> > edm::RootPrimaryFileSequence::duplicateChecker_
private

Definition at line 79 of file RootPrimaryFileSequence.h.

Referenced by closeFile_(), duplicateChecker(), and initFile_().

◆ enablePrefetching_

bool edm::RootPrimaryFileSequence::enablePrefetching_
private

Definition at line 88 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile(), and RootPrimaryFileSequence().

◆ enforceGUIDInFileName_

bool edm::RootPrimaryFileSequence::enforceGUIDInFileName_
private

Definition at line 89 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

◆ eventSkipperByID_

edm::propagate_const<std::shared_ptr<EventSkipperByID> > edm::RootPrimaryFileSequence::eventSkipperByID_
private

Definition at line 75 of file RootPrimaryFileSequence.h.

Referenced by eventSkipperByID().

◆ fb_

edm::propagate_const<std::shared_ptr<FileBlock> > edm::RootPrimaryFileSequence::fb_
private

Definition at line 74 of file RootPrimaryFileSequence.h.

Referenced by goToEvent(), readFile_(), and skipEvents().

◆ firstFile_

bool edm::RootPrimaryFileSequence::firstFile_
private

Definition at line 65 of file RootPrimaryFileSequence.h.

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

◆ goToEventID_

EventID edm::RootPrimaryFileSequence::goToEventID_
private

Definition at line 83 of file RootPrimaryFileSequence.h.

Referenced by goToEvent(), and readFile_().

◆ goToEventInNewFile_

bool edm::RootPrimaryFileSequence::goToEventInNewFile_ = false
private

Definition at line 81 of file RootPrimaryFileSequence.h.

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

◆ goToFileSequenceOffset_

size_t edm::RootPrimaryFileSequence::goToFileSequenceOffset_ = 0
private

Definition at line 82 of file RootPrimaryFileSequence.h.

Referenced by goToEvent(), and readFile_().

◆ initialNumberOfEventsToSkip_

int edm::RootPrimaryFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 76 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile(), rewind_(), and RootPrimaryFileSequence().

◆ input_

PoolSource& edm::RootPrimaryFileSequence::input_
private

◆ noEventSort_

bool edm::RootPrimaryFileSequence::noEventSort_
private

Definition at line 77 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

◆ orderedProcessHistoryIDs_

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

Definition at line 67 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

◆ skipIntoNewFile_

bool edm::RootPrimaryFileSequence::skipIntoNewFile_ = false
private

Definition at line 85 of file RootPrimaryFileSequence.h.

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

◆ skipToFileSequenceNumber_

size_t edm::RootPrimaryFileSequence::skipToFileSequenceNumber_ = 0
private

Definition at line 86 of file RootPrimaryFileSequence.h.

Referenced by readFile_(), and skipEvents().

◆ skipToOffsetInFinalFile_

int edm::RootPrimaryFileSequence::skipToOffsetInFinalFile_ = 0
private

Definition at line 87 of file RootPrimaryFileSequence.h.

Referenced by readFile_(), and skipEvents().

◆ skipToStop_

bool edm::RootPrimaryFileSequence::skipToStop_ = false
private

Definition at line 84 of file RootPrimaryFileSequence.h.

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

◆ treeCacheSize_

unsigned int edm::RootPrimaryFileSequence::treeCacheSize_
private

Definition at line 78 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile(), and RootPrimaryFileSequence().

◆ usingGoToEvent_

bool edm::RootPrimaryFileSequence::usingGoToEvent_
private

Definition at line 80 of file RootPrimaryFileSequence.h.

Referenced by goToEvent(), initFile_(), and makeRootFile().

edm::RootInputFileSequence::noMoreFiles
bool noMoreFiles() const
Definition: RootInputFileSequence.h:71
edm::RootPrimaryFileSequence::firstFile_
bool firstFile_
Definition: RootPrimaryFileSequence.h:65
edm::RootPrimaryFileSequence::fb_
edm::propagate_const< std::shared_ptr< FileBlock > > fb_
Definition: RootPrimaryFileSequence.h:74
edm::IndexIntoFile::kLumi
Definition: IndexIntoFile.h:238
edm::RootPrimaryFileSequence::goToEventID_
EventID goToEventID_
Definition: RootPrimaryFileSequence.h:83
edm::errors::MismatchedInputFiles
Definition: EDMException.h:52
edm::RootPrimaryFileSequence::skipToStop_
bool skipToStop_
Definition: RootPrimaryFileSequence.h:84
edm::ProcessingController::kAtLastEvent
Definition: ProcessingController.h:34
edm::RootPrimaryFileSequence::previousFile
bool previousFile()
Definition: RootPrimaryFileSequence.cc:198
input
static const std::string input
Definition: EdmProvDump.cc:48
edm::RootInputFileSequence::setAtFirstFile
void setAtFirstFile()
Definition: RootInputFileSequence.h:76
edm::PoolSource::labelRawDataLikeMC
bool labelRawDataLikeMC() const
Definition: PoolSource.h:43
edm::RootPrimaryFileSequence::nextFile
bool nextFile()
Definition: RootPrimaryFileSequence.cc:172
edm::RootInputFileSequence::setAtFileSequenceNumber
void setAtFileSequenceNumber(size_t offset)
Definition: RootInputFileSequence.h:77
edm::ProcessingController::kUnknownReverse
Definition: ProcessingController.h:42
edm::PoolSource::productRegistryUpdate
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:330
getEcalConditions_orcoffint2r_cff.catalog
catalog
Definition: getEcalConditions_orcoffint2r_cff.py:40
edm::InputSource::thinnedAssociationsHelper
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
Accessors for thinnedAssociationsHelper.
Definition: InputSource.h:156
edm::IndexIntoFile::kEvent
Definition: IndexIntoFile.h:238
edm::RootPrimaryFileSequence::input_
PoolSource & input_
Definition: RootPrimaryFileSequence.h:64
edm::RootInputFileSequence::atFirstFile
bool atFirstFile() const
Definition: RootInputFileSequence.h:69
edm::DuplicateChecker::fillDescription
static void fillDescription(ParameterSetDescription &desc)
Definition: DuplicateChecker.cc:109
edm::ProductRegistry::updateFromInput
void updateFromInput(ProductList const &other)
Definition: ProductRegistry.cc:209
cms::cuda::assert
assert(be >=bs)
edm::RootPrimaryFileSequence::goToFileSequenceOffset_
size_t goToFileSequenceOffset_
Definition: RootPrimaryFileSequence.h:82
edm::RootPrimaryFileSequence::duplicateChecker
std::shared_ptr< DuplicateChecker const > duplicateChecker() const
Definition: RootPrimaryFileSequence.h:71
edm::get_underlying_safe
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:41
edm::PoolSource::nStreams
unsigned int nStreams() const
Definition: PoolSource.h:44
edm::BranchDescription::Strict
Definition: BranchDescription.h:36
remoteMonitoring_LED_IterMethod_cfg.skipBadFiles
skipBadFiles
Definition: remoteMonitoring_LED_IterMethod_cfg.py:24
edm::RootInputFileSequence::logicalFileName
std::string const & logicalFileName() const
Definition: RootInputFileSequence.h:84
edm::RootPrimaryFileSequence::usingGoToEvent_
bool usingGoToEvent_
Definition: RootPrimaryFileSequence.h:80
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::PoolSource::skipBadFiles
bool skipBadFiles() const
Definition: PoolSource.h:40
edm::RootPrimaryFileSequence::eventSkipperByID_
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
Definition: RootPrimaryFileSequence.h:75
edm::EventSkipperByID::create
static std::unique_ptr< EventSkipperByID > create(ParameterSet const &pset)
Definition: EventSkipperByID.cc:38
edm::RootPrimaryFileSequence::remainingEvents
int remainingEvents() const
Definition: RootPrimaryFileSequence.cc:399
edm::InputSource::IsRun
Definition: InputSource.h:54
edm::InputSource::remainingLuminosityBlocks
int remainingLuminosityBlocks() const
Definition: InputSource.h:186
edm::RootPrimaryFileSequence::remainingLuminosityBlocks
int remainingLuminosityBlocks() const
Definition: RootPrimaryFileSequence.cc:401
edm::BranchDescription::Permissive
Definition: BranchDescription.h:36
edm::RootInputFileSequence::initFile
void initFile(bool skipBadFiles)
Definition: RootInputFileSequence.h:59
edm::RootPrimaryFileSequence::duplicateChecker_
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
Definition: RootPrimaryFileSequence.h:79
edm::PoolSource::processHistoryRegistryForUpdate
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:331
edm::RootPrimaryFileSequence::rewindFile
void rewindFile()
Definition: RootPrimaryFileSequence.cc:268
edm::IndexIntoFile::kRun
Definition: IndexIntoFile.h:238
edm::ProcessingController::kNextFileExists
Definition: ProcessingController.h:33
edm::PoolSource::runHelper
RunHelperBase * runHelper()
Definition: PoolSource.h:47
StorageFactory::get
static const StorageFactory * get(void)
Definition: StorageFactory.cc:28
edm::RootPrimaryFileSequence::eventSkipperByID
std::shared_ptr< EventSkipperByID const > eventSkipperByID() const
Definition: RootPrimaryFileSequence.h:69
mps_fire.end
end
Definition: mps_fire.py:242
edm::RootInputFileSequence::setAtNextFile
void setAtNextFile()
Definition: RootInputFileSequence.h:79
edm::RootPrimaryFileSequence::skipEventsAtBeginning
void skipEventsAtBeginning(int offset)
Definition: RootPrimaryFileSequence.cc:274
edm::ProcessingController::kAtFirstEvent
Definition: ProcessingController.h:41
Service
StorageFactory::stagein
void stagein(const std::string &url) const
Definition: StorageFactory.cc:159
edm::RootInputFileSequence::atLastFile
bool atLastFile() const
Definition: RootInputFileSequence.h:70
edm::roottree::defaultCacheSize
unsigned const int defaultCacheSize
Definition: RootTree.h:38
edm::RootPrimaryFileSequence::noEventSort_
bool noEventSort_
Definition: RootPrimaryFileSequence.h:77
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::ProcessingController::kEventsAheadInFile
Definition: ProcessingController.h:32
edm::RootInputFileSequence::RootInputFileSequence
RootInputFileSequence(ParameterSet const &pset, InputFileCatalog const &catalog)
Definition: RootInputFileSequence.cc:22
edm::RootPrimaryFileSequence::skipToFileSequenceNumber_
size_t skipToFileSequenceNumber_
Definition: RootPrimaryFileSequence.h:86
edm::InputSource::processingMode
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:224
edm::InputSource::IsFile
Definition: InputSource.h:54
edm::RootPrimaryFileSequence::enablePrefetching_
bool enablePrefetching_
Definition: RootPrimaryFileSequence.h:88
edm::RootPrimaryFileSequence::treeCacheSize_
unsigned int treeCacheSize_
Definition: RootPrimaryFileSequence.h:78
fetchall_from_DQM_v2.release
release
Definition: fetchall_from_DQM_v2.py:92
edm::PoolSource::treeMaxVirtualSize
int treeMaxVirtualSize() const
Definition: PoolSource.h:45
edm::InputSource::IsLumi
Definition: InputSource.h:54
edm::RootInputFileSequence::rootFile
std::shared_ptr< RootFile const > rootFile() const
Definition: RootInputFileSequence.h:93
edm::RootPrimaryFileSequence::closeFile_
void closeFile_() override
Definition: RootPrimaryFileSequence.cc:117
edm::InputSource::IsStop
Definition: InputSource.h:54
edm::RootPrimaryFileSequence::goToEventInNewFile_
bool goToEventInNewFile_
Definition: RootPrimaryFileSequence.h:81
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::RootInputFileSequence::lfn
std::string const & lfn() const
Definition: RootInputFileSequence.h:85
edm::InputSource::branchIDListHelper
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
Accessors for branchIDListHelper.
Definition: InputSource.h:144
edm::ProcessingController::kEventsBackwardsInFile
Definition: ProcessingController.h:39
edm::InputSource::processConfiguration
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:192
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::InputType::Primary
edm::RootPrimaryFileSequence::initialNumberOfEventsToSkip_
int initialNumberOfEventsToSkip_
Definition: RootPrimaryFileSequence.h:76
edm::PoolSource::dropDescendants
bool dropDescendants() const
Definition: PoolSource.h:41
edm::InputSource::processBlockHelper
std::shared_ptr< ProcessBlockHelper const > processBlockHelper() const
Accessors for processBlockHelper.
Definition: InputSource.h:150
Exception
Definition: hltDiff.cc:245
edm::InputSource::remainingEvents
int remainingEvents() const
Definition: InputSource.h:178
edm::ProcessingController::kUnknownForward
Definition: ProcessingController.h:35
edm::EventSkipperByID::fillDescription
static void fillDescription(ParameterSetDescription &desc)
Definition: EventSkipperByID.cc:116
edm::RootPrimaryFileSequence::branchesMustMatch_
BranchDescription::MatchMode branchesMustMatch_
Definition: RootPrimaryFileSequence.h:66
edm::ProcessingController::kPreviousFileExists
Definition: ProcessingController.h:40
edm::RootInputFileSequence::initTheFile
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
Definition: RootInputFileSequence.cc:197
edm::RootInputFileSequence::usedFallback
bool usedFallback() const
Definition: RootInputFileSequence.h:91
edm::RootInputFileSequence::setAtPreviousFile
void setAtPreviousFile()
Definition: RootInputFileSequence.h:80
edm::RootPrimaryFileSequence::enforceGUIDInFileName_
bool enforceGUIDInFileName_
Definition: RootPrimaryFileSequence.h:89
edm::RootInputFileSequence::indexesIntoFiles
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
Definition: RootInputFileSequence.h:88
edm::IndexIntoFile::kEnd
Definition: IndexIntoFile.h:238
edm::ProductRegistry::merge
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
Definition: ProductRegistry.cc:250
edm::InputSource::IsEvent
Definition: InputSource.h:54
edm::PoolSource::productSelectorRules
ProductSelectorRules const & productSelectorRules() const
Definition: PoolSource.h:46
event
Definition: event.py:1
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
edm::PoolSource::bypassVersionCheck
bool bypassVersionCheck() const
Definition: PoolSource.h:42
lumi
Definition: LumiSectionData.h:20
edm::RootPrimaryFileSequence::orderedProcessHistoryIDs_
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
Definition: RootPrimaryFileSequence.h:67
edm::RootInputFileSequence::sequenceNumberOfFile
size_t sequenceNumberOfFile() const
Definition: RootInputFileSequence.h:73
edm::RootPrimaryFileSequence::skipToOffsetInFinalFile_
int skipToOffsetInFinalFile_
Definition: RootPrimaryFileSequence.h:87
edm::RootPrimaryFileSequence::goToEvent
bool goToEvent(EventID const &eventID)
Definition: RootPrimaryFileSequence.cc:346
edm::RootInputFileSequence::fileNames
std::vector< std::string > const & fileNames() const
Definition: RootInputFileSequence.h:82
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
edm::IndexIntoFile::EntryType
EntryType
Definition: IndexIntoFile.h:238
edm::RootPrimaryFileSequence::skipIntoNewFile_
bool skipIntoNewFile_
Definition: RootPrimaryFileSequence.h:85