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::unique_ptr< FileBlockreadFile_ ()
 
ProcessingController::ReverseState reverseState () const
 
void rewind_ ()
 
 RootPrimaryFileSequence (ParameterSet const &pset, PoolSource &input, InputFileCatalog const &catalog)
 
 RootPrimaryFileSequence (RootPrimaryFileSequence const &)=delete
 
bool skipEvents (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
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
void readEvent (EventPrincipal &cache)
 
void readLuminosityBlock_ (LuminosityBlockPrincipal &lumiPrincipal)
 
std::shared_ptr< LuminosityBlockAuxiliaryreadLuminosityBlockAuxiliary_ ()
 
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 const > duplicateChecker () const
 
std::shared_ptr< DuplicateChecker > & duplicateChecker ()
 
std::shared_ptr< EventSkipperByID const > eventSkipperByID () const
 
std::shared_ptr< EventSkipperByID > & eventSkipperByID ()
 
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_
 
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
 
bool firstFile_
 
int initialNumberOfEventsToSkip_
 
PoolSourceinput_
 
bool noEventSort_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
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::string const & fallbackFileName () const
 
std::vector< FileCatalogItem > const & fileCatalogItems () const
 
std::string const & fileName () 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 const > rootFile () const
 
std::shared_ptr< RootFile > & rootFile ()
 
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

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

Definition at line 21 of file RootPrimaryFileSequence.cc.

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

24  :
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 
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 = pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
48  if(branchesMustMatch == std::string("strict")) branchesMustMatch_ = BranchDescription::Strict;
49 
50  // Prestage the files
53  }
54  // Open the first file.
57  if(rootFile()) break;
58  }
59  if(rootFile()) {
60  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
63  }
64  }
65  }
void initFile(bool skipBadFiles)
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:334
std::string const & fileName() const
static std::unique_ptr< EventSkipperByID > create(ParameterSet const &pset)
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
static std::string const input
Definition: EdmProvDump.cc:45
static const StorageFactory * get(void)
void stagein(const std::string &url) const
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
std::shared_ptr< RootFile const > rootFile() const
bool skipBadFiles() const
Definition: PoolSource.h:40
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
BranchDescription::MatchMode branchesMustMatch_
void updateFromInput(ProductList const &other)
RootInputFileSequence(ParameterSet const &pset, InputFileCatalog const &catalog)
edm::RootPrimaryFileSequence::~RootPrimaryFileSequence ( )
override

Definition at line 67 of file RootPrimaryFileSequence.cc.

67  {
68  }
edm::RootPrimaryFileSequence::RootPrimaryFileSequence ( RootPrimaryFileSequence const &  )
delete

Member Function Documentation

void edm::RootPrimaryFileSequence::closeFile_ ( )
overridevirtual

Implements edm::RootInputFileSequence.

Definition at line 95 of file RootPrimaryFileSequence.cc.

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

Referenced by endJob(), and rewind_().

95  {
96  // close the currently open file, if any, and delete the RootFile object.
97  if(rootFile()) {
98  auto sentry = std::make_unique<InputSource::FileCloseSentry>(input_, lfn(), usedFallback());
99  rootFile()->close();
100  if(duplicateChecker_) duplicateChecker_->inputFileClosed();
101  rootFile().reset();
102  }
103  }
std::string const & lfn() const
std::shared_ptr< RootFile const > rootFile() const
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
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().

std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
std::shared_ptr<DuplicateChecker>& edm::RootPrimaryFileSequence::duplicateChecker ( )
inlineprivate

Definition at line 72 of file RootPrimaryFileSequence.h.

References duplicateChecker_, and edm::get_underlying_safe().

std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
void edm::RootPrimaryFileSequence::endJob ( void  )

Definition at line 71 of file RootPrimaryFileSequence.cc.

References closeFile_().

71  {
72  closeFile_();
73  }
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().

edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
std::shared_ptr<EventSkipperByID>& edm::RootPrimaryFileSequence::eventSkipperByID ( )
inlineprivate

Definition at line 70 of file RootPrimaryFileSequence.h.

References eventSkipperByID_, and edm::get_underlying_safe().

edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
void edm::RootPrimaryFileSequence::fillDescription ( ParameterSetDescription desc)
static

Definition at line 322 of file RootPrimaryFileSequence.cc.

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

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

322  {
323  desc.addUntracked<unsigned int>("skipEvents", 0U)
324  ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed.");
325  desc.addUntracked<bool>("noEventSort", true)
326  ->setComment("True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n"
327  "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note 3).\n"
328  "Note 1: Events within the same lumi will always be processed contiguously.\n"
329  "Note 2: Lumis within the same run will always be processed contiguously.\n"
330  "Note 3: Any sorting occurs independently in each input file (no sorting across input files).");
331  desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize)
332  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
333  std::string defaultString("permissive");
334  desc.addUntracked<std::string>("branchesMustMatch", defaultString)
335  ->setComment("'strict': Branches in each input file must match those in the first file.\n"
336  "'permissive': Branches in each input file may be any subset of those in the first file.");
337 
340  }
static void fillDescription(ParameterSetDescription &desc)
unsigned int const defaultCacheSize
Definition: RootTree.h:46
static void fillDescription(ParameterSetDescription &desc)
ProcessingController::ForwardState edm::RootPrimaryFileSequence::forwardState ( ) const
InputSource::ItemType edm::RootPrimaryFileSequence::getNextItemType ( RunNumber_t run,
LuminosityBlockNumber_t lumi,
EventNumber_t event 
)

Definition at line 191 of file RootPrimaryFileSequence.cc.

References edm::RootInputFileSequence::atLastFile(), 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, edm::RootInputFileSequence::noMoreFiles(), and edm::RootInputFileSequence::rootFile().

191  {
192  if(noMoreFiles()) {
193  return InputSource::IsStop;
194  }
195  if(firstFile_) {
196  return InputSource::IsFile;
197  }
198  if(rootFile()) {
199  IndexIntoFile::EntryType entryType = rootFile()->getNextItemType(run, lumi, event);
200  if(entryType == IndexIntoFile::kEvent) {
201  return InputSource::IsEvent;
202  } else if(entryType == IndexIntoFile::kLumi) {
203  return InputSource::IsLumi;
204  } else if(entryType == IndexIntoFile::kRun) {
205  return InputSource::IsRun;
206  }
207  assert(entryType == IndexIntoFile::kEnd);
208  }
209  if(atLastFile()) {
210  return InputSource::IsStop;
211  }
212  return InputSource::IsFile;
213  }
std::shared_ptr< RootFile const > rootFile() const
Definition: event.py:1
bool edm::RootPrimaryFileSequence::goToEvent ( EventID const &  eventID)

Definition at line 258 of file RootPrimaryFileSequence.cc.

References begin, end, edm::EventID::event(), runEdmFileComparison::found, 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_.

258  {
259  usingGoToEvent_ = true;
260  if(rootFile()) {
261  if(rootFile()->goToEvent(eventID)) {
262  return true;
263  }
264  // If only one input file, give up now, to save time.
265  if(rootFile() && indexesIntoFiles().size() == 1) {
266  return false;
267  }
268  // Save the current file and position so that we can restore them
269  // if we fail to restore the desired event
270  bool closedOriginalFile = false;
271  size_t const originalFileSequenceNumber = sequenceNumberOfFile();
272  IndexIntoFile::IndexIntoFileItr originalPosition = rootFile()->indexIntoFileIter();
273 
274  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
275  for(auto it = indexesIntoFiles().begin(), itEnd = indexesIntoFiles().end(); it != itEnd; ++it) {
276  if(*it && (*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
277  // We found it. Close the currently open file, and open the correct one.
279  initFile(false);
280  // Now get the item from the correct file.
281  assert(rootFile());
282  bool found = rootFile()->goToEvent(eventID);
283  assert(found);
284  return true;
285  }
286  }
287  // Look for item in files not yet opened.
288  for(auto it = indexesIntoFiles().begin(), itEnd = indexesIntoFiles().end(); it != itEnd; ++it) {
289  if(!*it) {
291  initFile(false);
292  closedOriginalFile = true;
293  if((*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
294  assert(rootFile());
295  if(rootFile()->goToEvent(eventID)) {
296  return true;
297  }
298  }
299  }
300  }
301  if(closedOriginalFile) {
302  setAtFileSequenceNumber(originalFileSequenceNumber);
303  initFile(false);
304  assert(rootFile());
305  rootFile()->setPosition(originalPosition);
306  }
307  }
308  return false;
309  }
size
Write out results.
void initFile(bool skipBadFiles)
void setAtFileSequenceNumber(size_t offset)
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
bool goToEvent(EventID const &eventID)
#define end
Definition: vmac.h:39
std::shared_ptr< RootFile const > rootFile() const
#define begin
Definition: vmac.h:32
void edm::RootPrimaryFileSequence::initFile_ ( bool  skipBadFiles)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 106 of file RootPrimaryFileSequence.cc.

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

106  {
107  // If we are not duplicate checking across files and we are not using random access to find events,
108  // then we can delete the IndexIntoFile for the file we are closing.
109  // If we can't delete all of it, then we can delete the parts we do not need.
110  bool deleteIndexIntoFile = !usingGoToEvent_ && !(duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled());
111  initTheFile(skipBadFiles, deleteIndexIntoFile, &input_, "primaryFiles", InputType::Primary);
112  }
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
RootPrimaryFileSequence::RootFileSharedPtr edm::RootPrimaryFileSequence::makeRootFile ( std::shared_ptr< InputFile filePtr)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 115 of file RootPrimaryFileSequence.cc.

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

115  {
116  size_t currentIndexIntoFile = sequenceNumberOfFile();
117  return std::make_shared<RootFile>(
118  fileName(),
120  logicalFileName(),
121  filePtr,
124  remainingEvents(),
126  input_.nStreams(),
130  input_.runHelper(),
131  noEventSort_,
136  nullptr, // associationsFromSecondary
141  currentIndexIntoFile,
147  }
std::string const & logicalFileName() const
std::string const & fileName() const
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:240
RunHelperBase * runHelper()
Definition: PoolSource.h:47
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
unsigned int nStreams() const
Definition: PoolSource.h:44
bool dropDescendants() const
Definition: PoolSource.h:41
bool bypassVersionCheck() const
Definition: PoolSource.h:42
int treeMaxVirtualSize() const
Definition: PoolSource.h:45
std::shared_ptr< EventSkipperByID const > eventSkipperByID() const
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
Accessors for branchIDListHelper.
Definition: InputSource.h:172
bool labelRawDataLikeMC() const
Definition: PoolSource.h:43
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:335
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
Accessors for thinnedAssociationsHelper.
Definition: InputSource.h:176
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:208
std::shared_ptr< DuplicateChecker const > duplicateChecker() const
ProductSelectorRules const & productSelectorRules() const
Definition: PoolSource.h:46
bool edm::RootPrimaryFileSequence::nextFile ( )
private

Definition at line 149 of file RootPrimaryFileSequence.cc.

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

Referenced by readFile_(), and skipEvents().

149  {
150  if(!noMoreFiles()) setAtNextFile();
151  if(noMoreFiles()) {
152  return false;
153  }
154 
156 
157  if(rootFile()) {
158  // make sure the new product registry is compatible with the main one
159  std::string mergeInfo = input_.productRegistryUpdate().merge(*rootFile()->productRegistry(),
160  fileName(),
162  if(!mergeInfo.empty()) {
163  throw Exception(errors::MismatchedInputFiles,"RootPrimaryFileSequence::nextFile()") << mergeInfo;
164  }
165  }
166  return true;
167  }
void initFile(bool skipBadFiles)
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:334
std::string const & fileName() const
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
std::shared_ptr< RootFile const > rootFile() const
bool skipBadFiles() const
Definition: PoolSource.h:40
BranchDescription::MatchMode branchesMustMatch_
RootPrimaryFileSequence& edm::RootPrimaryFileSequence::operator= ( RootPrimaryFileSequence const &  )
delete
bool edm::RootPrimaryFileSequence::previousFile ( )
private

Definition at line 169 of file RootPrimaryFileSequence.cc.

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

Referenced by skipEvents().

169  {
170  if(atFirstFile()) {
171  return false;
172  }
174 
175  initFile(false);
176 
177  if(rootFile()) {
178  // make sure the new product registry is compatible to the main one
179  std::string mergeInfo = input_.productRegistryUpdate().merge(*rootFile()->productRegistry(),
180  fileName(),
182  if(!mergeInfo.empty()) {
183  throw Exception(errors::MismatchedInputFiles,"RootPrimaryFileSequence::previousEvent()") << mergeInfo;
184  }
185  }
186  if(rootFile()) rootFile()->setToLastEntry();
187  return true;
188  }
void initFile(bool skipBadFiles)
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:334
std::string const & fileName() const
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
std::shared_ptr< RootFile const > rootFile() const
BranchDescription::MatchMode branchesMustMatch_
std::unique_ptr< FileBlock > edm::RootPrimaryFileSequence::readFile_ ( )

Definition at line 76 of file RootPrimaryFileSequence.cc.

References firstFile_, edm::RootInputFileSequence::initFile(), input_, nextFile(), edm::RootInputFileSequence::rootFile(), and edm::PoolSource::skipBadFiles().

76  {
77  if(firstFile_) {
78  // The first input file has already been opened.
79  firstFile_ = false;
80  if(!rootFile()) {
82  }
83  } else {
84  if(!nextFile()) {
85  assert(0);
86  }
87  }
88  if(!rootFile()) {
89  return std::make_unique<FileBlock>();
90  }
91  return rootFile()->createFileBlock();
92  }
void initFile(bool skipBadFiles)
std::shared_ptr< RootFile const > rootFile() const
bool skipBadFiles() const
Definition: PoolSource.h:40
int edm::RootPrimaryFileSequence::remainingEvents ( ) const
private

Definition at line 312 of file RootPrimaryFileSequence.cc.

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

Referenced by makeRootFile().

312  {
313  return input_.remainingEvents();
314  }
int remainingEvents() const
Definition: InputSource.h:194
int edm::RootPrimaryFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 317 of file RootPrimaryFileSequence.cc.

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

Referenced by makeRootFile().

317  {
319  }
int remainingLuminosityBlocks() const
Definition: InputSource.h:202
ProcessingController::ReverseState edm::RootPrimaryFileSequence::reverseState ( ) const
void edm::RootPrimaryFileSequence::rewind_ ( )

Definition at line 217 of file RootPrimaryFileSequence.cc.

References edm::RootInputFileSequence::atFirstFile(), closeFile_(), firstFile_, edm::RootInputFileSequence::initFile(), initialNumberOfEventsToSkip_, rewindFile(), edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::setAtFirstFile(), and skipEvents().

217  {
218  if(!atFirstFile()) {
219  closeFile_();
220  setAtFirstFile();
221  }
222  if(!rootFile()) {
223  initFile(false);
224  }
225  rewindFile();
226  firstFile_ = true;
227  if(rootFile()) {
230  }
231  }
232  }
void initFile(bool skipBadFiles)
std::shared_ptr< RootFile const > rootFile() const
void edm::RootPrimaryFileSequence::rewindFile ( )
private

Definition at line 236 of file RootPrimaryFileSequence.cc.

References edm::RootInputFileSequence::rootFile().

Referenced by rewind_().

236  {
237  if(rootFile()) rootFile()->rewind();
238  }
std::shared_ptr< RootFile const > rootFile() const
bool edm::RootPrimaryFileSequence::skipEvents ( int  offset)

Definition at line 242 of file RootPrimaryFileSequence.cc.

References nextFile(), previousFile(), edm::RootInputFileSequence::rootFile(), and edm::RootInputFileSequence::setNoMoreFiles().

Referenced by rewind_(), and RootPrimaryFileSequence().

242  {
243  assert(rootFile());
244  while(offset != 0) {
245  bool atEnd = rootFile()->skipEvents(offset);
246  if((offset > 0 || atEnd) && !nextFile()) {
247  return false;
248  }
249  if(offset < 0 && !previousFile()) {
250  setNoMoreFiles();
251  return false;
252  }
253  }
254  return true;
255  }
std::shared_ptr< RootFile const > rootFile() const

Member Data Documentation

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

Definition at line 66 of file RootPrimaryFileSequence.h.

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

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

Definition at line 78 of file RootPrimaryFileSequence.h.

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

bool edm::RootPrimaryFileSequence::enablePrefetching_
private

Definition at line 80 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile(), and RootPrimaryFileSequence().

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

Definition at line 74 of file RootPrimaryFileSequence.h.

Referenced by eventSkipperByID().

bool edm::RootPrimaryFileSequence::firstFile_
private

Definition at line 65 of file RootPrimaryFileSequence.h.

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

int edm::RootPrimaryFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 75 of file RootPrimaryFileSequence.h.

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

PoolSource& edm::RootPrimaryFileSequence::input_
private
bool edm::RootPrimaryFileSequence::noEventSort_
private

Definition at line 76 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

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

Definition at line 67 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

unsigned int edm::RootPrimaryFileSequence::treeCacheSize_
private

Definition at line 77 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile(), and RootPrimaryFileSequence().

bool edm::RootPrimaryFileSequence::usingGoToEvent_
private

Definition at line 79 of file RootPrimaryFileSequence.h.

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