CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 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)
 
virtual ~RootPrimaryFileSequence ()
 
- Public Member Functions inherited from edm::RootInputFileSequence
void closeFile ()
 
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
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
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

void closeFile_ () override
 
std::shared_ptr
< DuplicateChecker const > 
duplicateChecker () const
 
std::shared_ptr
< DuplicateChecker > & 
duplicateChecker ()
 
std::shared_ptr
< EventSkipperByID const > 
eventSkipperByID () const
 
std::shared_ptr
< EventSkipperByID > & 
eventSkipperByID ()
 
virtual void initFile_ (bool skipBadFiles) override
 
virtual 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_
 
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_, and edm::ProductRegistry::updateFromInput().

25  input_(input),
26  firstFile_(true),
30  initialNumberOfEventsToSkip_(pset.getUntrackedParameter<unsigned int>("skipEvents")),
31  noEventSort_(pset.getUntrackedParameter<bool>("noEventSort")),
32  treeCacheSize_(noEventSort_ ? pset.getUntrackedParameter<unsigned int>("cacheSize") : 0U),
33  duplicateChecker_(new DuplicateChecker(pset)),
34  usingGoToEvent_(false),
35  enablePrefetching_(false),
36  enforceGUIDInFileName_(pset.getUntrackedParameter<bool>("enforceGUIDInFileName")) {
37  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
39  if (pSLC.isAvailable()) {
40  if (treeCacheSize_ != 0U && pSLC->sourceTTreeCacheSize()) {
41  treeCacheSize_ = *(pSLC->sourceTTreeCacheSize());
42  }
43  enablePrefetching_ = pSLC->enablePrefetching();
44  }
45 
46  std::string branchesMustMatch =
47  pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
48  if (branchesMustMatch == std::string("strict"))
50 
51  // Prestage the files
54  }
55  // Open the first file.
58  if (rootFile())
59  break;
60  }
61  if (rootFile()) {
62  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
65  }
66  }
67  }
void initFile(bool skipBadFiles)
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:350
std::string const & fileName() const
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
static std::string const input
Definition: EdmProvDump.cc:44
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)
static std::auto_ptr< EventSkipperByID > create(ParameterSet const &pset)
edm::RootPrimaryFileSequence::~RootPrimaryFileSequence ( )
virtual

Definition at line 69 of file RootPrimaryFileSequence.cc.

69 {}
edm::RootPrimaryFileSequence::RootPrimaryFileSequence ( RootPrimaryFileSequence const &  )
delete

Member Function Documentation

void edm::RootPrimaryFileSequence::closeFile_ ( )
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 91 of file RootPrimaryFileSequence.cc.

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

91  {
92  // close the currently open file, if any, and delete the RootFile object.
93  if (rootFile()) {
94  std::unique_ptr<InputSource::FileCloseSentry>
95  sentry(new InputSource::FileCloseSentry(input_, lfn(), usedFallback()));
96  rootFile()->close();
98  duplicateChecker_->inputFileClosed();
99  rootFile().reset();
100  }
101  }
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  )
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 310 of file RootPrimaryFileSequence.cc.

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

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

310  {
311  desc.addUntracked<unsigned int>("skipEvents", 0U)
312  ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed.");
313  desc.addUntracked<bool>("noEventSort", true)
314  ->setComment(
315  "True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n"
316  "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note "
317  "3).\n"
318  "Note 1: Events within the same lumi will always be processed contiguously.\n"
319  "Note 2: Lumis within the same run will always be processed contiguously.\n"
320  "Note 3: Any sorting occurs independently in each input file (no sorting across input files).");
321  desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize)
322  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
323  std::string defaultString("permissive");
324  desc.addUntracked<std::string>("branchesMustMatch", defaultString)
325  ->setComment(
326  "'strict': Branches in each input file must match those in the first file.\n"
327  "'permissive': Branches in each input file may be any subset of those in the first file.");
328  desc.addUntracked<bool>("enforceGUIDInFileName", false)
329  ->setComment(
330  "True: file name part is required to be equal to the GUID of the file\n"
331  "False: file name can be anything");
332 
335  }
static void fillDescription(ParameterSetDescription &desc)
unsigned int const defaultCacheSize
Definition: RootTree.h:37
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 187 of file RootPrimaryFileSequence.cc.

References assert(), 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().

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

Definition at line 253 of file RootPrimaryFileSequence.cc.

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

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

Implements edm::RootInputFileSequence.

Definition at line 103 of file RootPrimaryFileSequence.cc.

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

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

Implements edm::RootInputFileSequence.

Definition at line 112 of file RootPrimaryFileSequence.cc.

References edm::InputSource::branchIDListHelper(), edm::PoolSource::bypassVersionCheck(), edm::PoolSource::dropDescendants(), duplicateChecker(), enablePrefetching_, enforceGUIDInFileName_, 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_.

112  {
113  size_t currentIndexIntoFile = sequenceNumberOfFile();
114  return std::make_shared<RootFile>(fileName(),
116  logicalFileName(),
117  filePtr,
120  remainingEvents(),
122  input_.nStreams(),
126  input_.runHelper(),
127  noEventSort_,
132  nullptr, // associationsFromSecondary
137  currentIndexIntoFile,
144  }
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:256
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:178
bool labelRawDataLikeMC() const
Definition: PoolSource.h:43
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:351
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
Accessors for thinnedAssociationsHelper.
Definition: InputSource.h:182
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:214
std::shared_ptr< DuplicateChecker const > duplicateChecker() const
ProductSelectorRules const & productSelectorRules() const
Definition: PoolSource.h:46
bool edm::RootPrimaryFileSequence::nextFile ( )
private

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

146  {
147  if (!noMoreFiles())
148  setAtNextFile();
149  if (noMoreFiles()) {
150  return false;
151  }
152 
154 
155  if (rootFile()) {
156  // make sure the new product registry is compatible with the main one
157  std::string mergeInfo =
159  if (!mergeInfo.empty()) {
160  throw Exception(errors::MismatchedInputFiles, "RootPrimaryFileSequence::nextFile()") << mergeInfo;
161  }
162  }
163  return true;
164  }
void initFile(bool skipBadFiles)
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:350
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 166 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().

166  {
167  if (atFirstFile()) {
168  return false;
169  }
171 
172  initFile(false);
173 
174  if (rootFile()) {
175  // make sure the new product registry is compatible to the main one
176  std::string mergeInfo =
178  if (!mergeInfo.empty()) {
179  throw Exception(errors::MismatchedInputFiles, "RootPrimaryFileSequence::previousEvent()") << mergeInfo;
180  }
181  }
182  if (rootFile())
183  rootFile()->setToLastEntry();
184  return true;
185  }
void initFile(bool skipBadFiles)
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:350
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 73 of file RootPrimaryFileSequence.cc.

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

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

Definition at line 306 of file RootPrimaryFileSequence.cc.

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

Referenced by makeRootFile().

306 { return input_.remainingEvents(); }
int remainingEvents() const
Definition: InputSource.h:200
int edm::RootPrimaryFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 308 of file RootPrimaryFileSequence.cc.

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

Referenced by makeRootFile().

308 { return input_.remainingLuminosityBlocks(); }
int remainingLuminosityBlocks() const
Definition: InputSource.h:208
ProcessingController::ReverseState edm::RootPrimaryFileSequence::reverseState ( ) const
void edm::RootPrimaryFileSequence::rewind_ ( )

Definition at line 214 of file RootPrimaryFileSequence.cc.

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

214  {
215  if (!atFirstFile()) {
216  closeFile();
217  setAtFirstFile();
218  }
219  if (!rootFile()) {
220  initFile(false);
221  }
222  rewindFile();
223  firstFile_ = true;
224  if (rootFile()) {
225  if (initialNumberOfEventsToSkip_ != 0) {
227  }
228  }
229  }
void initFile(bool skipBadFiles)
std::shared_ptr< RootFile const > rootFile() const
void edm::RootPrimaryFileSequence::rewindFile ( )
private

Definition at line 232 of file RootPrimaryFileSequence.cc.

References edm::RootInputFileSequence::rootFile().

Referenced by rewind_().

232  {
233  if (rootFile())
234  rootFile()->rewind();
235  }
std::shared_ptr< RootFile const > rootFile() const
bool edm::RootPrimaryFileSequence::skipEvents ( int  offset)

Definition at line 238 of file RootPrimaryFileSequence.cc.

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

Referenced by rewind_(), and RootPrimaryFileSequence().

238  {
239  assert(rootFile());
240  while (offset != 0) {
241  bool atEnd = rootFile()->skipEvents(offset);
242  if ((offset > 0 || atEnd) && !nextFile()) {
243  return false;
244  }
245  if (offset < 0 && !previousFile()) {
246  setNoMoreFiles();
247  return false;
248  }
249  }
250  return true;
251  }
assert(m_qm.get())
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().

bool edm::RootPrimaryFileSequence::enforceGUIDInFileName_
private

Definition at line 81 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

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