CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::RootPrimaryFileSequence Class Reference

#include <RootPrimaryFileSequence.h>

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

Public Types

typedef std::shared_ptr< RootFileRootFileSharedPtr
 

Public Member Functions

virtual 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, unsigned int nStreams)
 
 RootPrimaryFileSequence (RootPrimaryFileSequence const &)=delete
 
bool skipEvents (int offset)
 
virtual ~RootPrimaryFileSequence ()
 
- 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
< 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

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_
 
bool bypassVersionCheck_
 
bool dropDescendants_
 
std::shared_ptr< DuplicateCheckerduplicateChecker_
 
bool enablePrefetching_
 
std::shared_ptr< EventSkipperByIDeventSkipperByID_
 
bool firstFile_
 
int initialNumberOfEventsToSkip_
 
PoolSourceinput_
 
bool labelRawDataLikeMC_
 
bool noEventSort_
 
unsigned int nStreams_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
ProductSelectorRules productSelectorRules_
 
RunNumber_t setRun_
 
bool skipBadFiles_
 
unsigned int treeCacheSize_
 
int const treeMaxVirtualSize_
 
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
 
RootFileSharedPtr const & rootFile () const
 
RootFileSharedPtrrootFile ()
 
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 33 of file RootPrimaryFileSequence.h.

Member Typedef Documentation

Definition at line 44 of file RootPrimaryFileSequence.h.

Constructor & Destructor Documentation

edm::RootPrimaryFileSequence::RootPrimaryFileSequence ( ParameterSet const &  pset,
PoolSource input,
InputFileCatalog const &  catalog,
unsigned int  nStreams 
)
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(), skipBadFiles_, skipEvents(), StorageFactory::stagein(), edm::BranchDescription::Strict, AlCaHLTBitMon_QueryRunRegistry::string, treeCacheSize_, and edm::ProductRegistry::updateFromInput().

25  :
27  input_(input),
28  firstFile_(true),
31  nStreams_(nStreams),
33  // The default value provided as the second argument to the getUntrackedParameter function call
34  // is not used when the ParameterSet has been validated and the parameters are not optional
35  // in the description. This is currently true when PoolSource is the primary input source.
36  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
37  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
38  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
39  // and should be deleted from the code.
40  initialNumberOfEventsToSkip_(pset.getUntrackedParameter<unsigned int>("skipEvents", 0U)),
41  noEventSort_(pset.getUntrackedParameter<bool>("noEventSort", true)),
42  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
43  bypassVersionCheck_(pset.getUntrackedParameter<bool>("bypassVersionCheck", false)),
44  treeCacheSize_(noEventSort_ ? pset.getUntrackedParameter<unsigned int>("cacheSize", roottree::defaultCacheSize) : 0U),
45  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
46  setRun_(pset.getUntrackedParameter<unsigned int>("setRunNumber", 0U)),
47  productSelectorRules_(pset, "inputCommands", "InputSource"),
48  duplicateChecker_(new DuplicateChecker(pset)),
49  dropDescendants_(pset.getUntrackedParameter<bool>("dropDescendantsOfDroppedBranches", true)),
50  labelRawDataLikeMC_(pset.getUntrackedParameter<bool>("labelRawDataLikeMC", true)),
51  usingGoToEvent_(false),
52  enablePrefetching_(false) {
53 
54  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
56  if(pSLC.isAvailable()) {
57  if(treeCacheSize_ != 0U && pSLC->sourceTTreeCacheSize()) {
58  treeCacheSize_ = *(pSLC->sourceTTreeCacheSize());
59  }
60  enablePrefetching_ = pSLC->enablePrefetching();
61  }
62 
63  std::string branchesMustMatch = pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive"));
64  if(branchesMustMatch == std::string("strict")) branchesMustMatch_ = BranchDescription::Strict;
65 
66  // Prestage the files
69  }
70  // Open the first file.
73  if(rootFile()) break;
74  }
75  if(rootFile()) {
76  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
79  }
80  }
81  }
void initFile(bool skipBadFiles)
std::string const & fileName() const
std::shared_ptr< DuplicateChecker > duplicateChecker_
unsigned int const defaultCacheSize
Definition: RootTree.h:37
static std::string const input
Definition: EdmProvDump.cc:43
std::shared_ptr< EventSkipperByID > eventSkipperByID_
static const StorageFactory * get(void)
void stagein(const std::string &url) const
RootFileSharedPtr const & rootFile() const
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
ProductSelectorRules productSelectorRules_
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:345
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 83 of file RootPrimaryFileSequence.cc.

83  {
84  }
edm::RootPrimaryFileSequence::RootPrimaryFileSequence ( RootPrimaryFileSequence const &  )
delete

Member Function Documentation

void edm::RootPrimaryFileSequence::closeFile_ ( )
overridevirtual

Implements edm::RootInputFileSequence.

Definition at line 111 of file RootPrimaryFileSequence.cc.

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

Referenced by endJob(), and rewind_().

111  {
112  // close the currently open file, if any, and delete the RootFile object.
113  if(rootFile()) {
114  std::unique_ptr<InputSource::FileCloseSentry>
115  sentry(new InputSource::FileCloseSentry(input_, lfn(), usedFallback()));
116  rootFile()->close();
117  if(duplicateChecker_) duplicateChecker_->inputFileClosed();
118  rootFile().reset();
119  }
120  }
std::shared_ptr< DuplicateChecker > duplicateChecker_
std::string const & lfn() const
RootFileSharedPtr const & rootFile() const
void edm::RootPrimaryFileSequence::endJob ( void  )

Definition at line 87 of file RootPrimaryFileSequence.cc.

References closeFile_().

87  {
88  closeFile_();
89  }
void edm::RootPrimaryFileSequence::fillDescription ( ParameterSetDescription desc)
static

Definition at line 340 of file RootPrimaryFileSequence.cc.

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

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

340  {
341  desc.addUntracked<unsigned int>("skipEvents", 0U)
342  ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed.");
343  desc.addUntracked<bool>("noEventSort", true)
344  ->setComment("True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n"
345  "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note 3).\n"
346  "Note 1: Events within the same lumi will always be processed contiguously.\n"
347  "Note 2: Lumis within the same run will always be processed contiguously.\n"
348  "Note 3: Any sorting occurs independently in each input file (no sorting across input files).");
349  desc.addUntracked<bool>("skipBadFiles", false)
350  ->setComment("True: Ignore any missing or unopenable input file.\n"
351  "False: Throw exception if missing or unopenable input file.");
352  desc.addUntracked<bool>("bypassVersionCheck", false)
353  ->setComment("True: Bypass release version check.\n"
354  "False: Throw exception if reading file in a release prior to the release in which the file was written.");
355  desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize)
356  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
357  desc.addUntracked<int>("treeMaxVirtualSize", -1)
358  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
359  desc.addUntracked<unsigned int>("setRunNumber", 0U)
360  ->setComment("If non-zero, change number of first run to this number. Apply same offset to all runs. Allowed only for simulation.");
361  desc.addUntracked<bool>("dropDescendantsOfDroppedBranches", true)
362  ->setComment("If True, also drop on input any descendent of any branch dropped on input.");
363  std::string defaultString("permissive");
364  desc.addUntracked<std::string>("branchesMustMatch", defaultString)
365  ->setComment("'strict': Branches in each input file must match those in the first file.\n"
366  "'permissive': Branches in each input file may be any subset of those in the first file.");
367  desc.addUntracked<bool>("labelRawDataLikeMC", true)
368  ->setComment("If True: replace module label for raw data to match MC. Also use 'LHC' as process.");
369 
370  ProductSelectorRules::fillDescription(desc, "inputCommands");
373  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
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 208 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().

208  {
209  if(noMoreFiles()) {
210  return InputSource::IsStop;
211  }
212  if(firstFile_) {
213  return InputSource::IsFile;
214  }
215  if(rootFile()) {
216  IndexIntoFile::EntryType entryType = rootFile()->getNextItemType(run, lumi, event);
217  if(entryType == IndexIntoFile::kEvent) {
218  return InputSource::IsEvent;
219  } else if(entryType == IndexIntoFile::kLumi) {
220  return InputSource::IsLumi;
221  } else if(entryType == IndexIntoFile::kRun) {
222  return InputSource::IsRun;
223  }
224  assert(entryType == IndexIntoFile::kEnd);
225  }
226  if(atLastFile()) {
227  return InputSource::IsStop;
228  }
229  return InputSource::IsFile;
230  }
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool edm::RootPrimaryFileSequence::goToEvent ( EventID const &  eventID)

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

275  {
276  usingGoToEvent_ = true;
277  if(rootFile()) {
278  if(rootFile()->goToEvent(eventID)) {
279  return true;
280  }
281  // If only one input file, give up now, to save time.
282  if(rootFile() && indexesIntoFiles().size() == 1) {
283  return false;
284  }
285  // Save the current file and position so that we can restore them
286  // if we fail to restore the desired event
287  bool closedOriginalFile = false;
288  size_t const originalFileSequenceNumber = sequenceNumberOfFile();
289  IndexIntoFile::IndexIntoFileItr originalPosition = rootFile()->indexIntoFileIter();
290 
291  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
292  typedef std::vector<std::shared_ptr<IndexIntoFile> >::const_iterator Iter;
293  for(Iter it = indexesIntoFiles().begin(), itEnd = indexesIntoFiles().end(); it != itEnd; ++it) {
294  if(*it && (*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
295  // We found it. Close the currently open file, and open the correct one.
297  initFile(false);
298  // Now get the item from the correct file.
299  assert(rootFile());
300  bool found = rootFile()->goToEvent(eventID);
301  assert(found);
302  return true;
303  }
304  }
305  // Look for item in files not yet opened.
306  for(Iter it = indexesIntoFiles().begin(), itEnd = indexesIntoFiles().end(); it != itEnd; ++it) {
307  if(!*it) {
309  initFile(false);
310  closedOriginalFile = true;
311  if((*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) {
312  assert(rootFile());
313  if(rootFile()->goToEvent(eventID)) {
314  return true;
315  }
316  }
317  }
318  }
319  if(closedOriginalFile) {
320  setAtFileSequenceNumber(originalFileSequenceNumber);
321  initFile(false);
322  assert(rootFile());
323  rootFile()->setPosition(originalPosition);
324  }
325  }
326  return false;
327  }
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)
RootFileSharedPtr const & rootFile() const
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
tuple size
Write out results.
void edm::RootPrimaryFileSequence::initFile_ ( bool  skipBadFiles)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 123 of file RootPrimaryFileSequence.cc.

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

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

Implements edm::RootInputFileSequence.

Definition at line 132 of file RootPrimaryFileSequence.cc.

References edm::InputSource::branchIDListHelper(), bypassVersionCheck_, dropDescendants_, duplicateChecker_, enablePrefetching_, eventSkipperByID_, edm::RootInputFileSequence::fileName(), edm::RootInputFileSequence::indexesIntoFiles(), initialNumberOfEventsToSkip_, input_, labelRawDataLikeMC_, edm::RootInputFileSequence::logicalFileName(), noEventSort_, nStreams_, orderedProcessHistoryIDs_, edm::Primary, edm::InputSource::processConfiguration(), edm::InputSource::processHistoryRegistryForUpdate(), edm::InputSource::processingMode(), productSelectorRules_, remainingEvents(), remainingLuminosityBlocks(), edm::RootInputFileSequence::sequenceNumberOfFile(), setRun_, edm::InputSource::thinnedAssociationsHelper(), treeCacheSize_, treeMaxVirtualSize_, and usingGoToEvent_.

132  {
133  size_t currentIndexIntoFile = sequenceNumberOfFile();
134  return std::make_shared<RootFile>(
135  fileName(),
137  logicalFileName(),
138  filePtr,
141  remainingEvents(),
143  nStreams_,
147  setRun_,
148  noEventSort_,
153  std::vector<BranchID>(), // associationsFromSecondary_
158  currentIndexIntoFile,
164  }
std::string const & logicalFileName() const
std::string const & fileName() const
std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper() const
Accessor for thinnedAssociationsHelper.
Definition: InputSource.h:178
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:251
std::shared_ptr< DuplicateChecker > duplicateChecker_
std::shared_ptr< EventSkipperByID > eventSkipperByID_
std::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:175
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
ProductSelectorRules productSelectorRules_
ProcessHistoryRegistry & processHistoryRegistryForUpdate() const
Definition: InputSource.h:346
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:209
bool edm::RootPrimaryFileSequence::nextFile ( )
private

Definition at line 166 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(), skipBadFiles_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by readFile_(), and skipEvents().

166  {
167  if(!noMoreFiles()) setAtNextFile();
168  if(noMoreFiles()) {
169  return false;
170  }
171 
173 
174  if(rootFile()) {
175  // make sure the new product registry is compatible with the main one
176  std::string mergeInfo = input_.productRegistryUpdate().merge(*rootFile()->productRegistry(),
177  fileName(),
179  if(!mergeInfo.empty()) {
180  throw Exception(errors::MismatchedInputFiles,"RootPrimaryFileSequence::nextFile()") << mergeInfo;
181  }
182  }
183  return true;
184  }
void initFile(bool skipBadFiles)
std::string const & fileName() const
RootFileSharedPtr const & rootFile() const
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:345
BranchDescription::MatchMode branchesMustMatch_
RootPrimaryFileSequence& edm::RootPrimaryFileSequence::operator= ( RootPrimaryFileSequence const &  )
delete
bool edm::RootPrimaryFileSequence::previousFile ( )
private

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

186  {
187  if(atFirstFile()) {
188  return false;
189  }
191 
192  initFile(false);
193 
194  if(rootFile()) {
195  // make sure the new product registry is compatible to the main one
196  std::string mergeInfo = input_.productRegistryUpdate().merge(*rootFile()->productRegistry(),
197  fileName(),
199  if(!mergeInfo.empty()) {
200  throw Exception(errors::MismatchedInputFiles,"RootPrimaryFileSequence::previousEvent()") << mergeInfo;
201  }
202  }
203  if(rootFile()) rootFile()->setToLastEntry();
204  return true;
205  }
void initFile(bool skipBadFiles)
std::string const & fileName() const
RootFileSharedPtr const & rootFile() const
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:345
BranchDescription::MatchMode branchesMustMatch_
std::unique_ptr< FileBlock > edm::RootPrimaryFileSequence::readFile_ ( )

Definition at line 92 of file RootPrimaryFileSequence.cc.

References assert(), firstFile_, edm::RootInputFileSequence::initFile(), nextFile(), edm::RootInputFileSequence::rootFile(), and skipBadFiles_.

92  {
93  if(firstFile_) {
94  // The first input file has already been opened.
95  firstFile_ = false;
96  if(!rootFile()) {
98  }
99  } else {
100  if(!nextFile()) {
101  assert(0);
102  }
103  }
104  if(!rootFile()) {
105  return std::unique_ptr<FileBlock>(new FileBlock);
106  }
107  return rootFile()->createFileBlock();
108  }
void initFile(bool skipBadFiles)
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
int edm::RootPrimaryFileSequence::remainingEvents ( ) const
private

Definition at line 330 of file RootPrimaryFileSequence.cc.

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

Referenced by makeRootFile().

330  {
331  return input_.remainingEvents();
332  }
int remainingEvents() const
Definition: InputSource.h:195
int edm::RootPrimaryFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 335 of file RootPrimaryFileSequence.cc.

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

Referenced by makeRootFile().

335  {
337  }
int remainingLuminosityBlocks() const
Definition: InputSource.h:203
ProcessingController::ReverseState edm::RootPrimaryFileSequence::reverseState ( ) const
void edm::RootPrimaryFileSequence::rewind_ ( )

Definition at line 234 of file RootPrimaryFileSequence.cc.

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

234  {
235  if(!atFirstFile()) {
236  closeFile_();
237  setAtFirstFile();
238  }
239  if(!rootFile()) {
240  initFile(false);
241  }
242  rewindFile();
243  firstFile_ = true;
244  if(rootFile()) {
247  }
248  }
249  }
void initFile(bool skipBadFiles)
RootFileSharedPtr const & rootFile() const
void edm::RootPrimaryFileSequence::rewindFile ( )
private

Definition at line 253 of file RootPrimaryFileSequence.cc.

References edm::RootInputFileSequence::rootFile().

Referenced by rewind_().

253  {
254  if(rootFile()) rootFile()->rewind();
255  }
RootFileSharedPtr const & rootFile() const
bool edm::RootPrimaryFileSequence::skipEvents ( int  offset)

Definition at line 259 of file RootPrimaryFileSequence.cc.

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

Referenced by rewind_(), and RootPrimaryFileSequence().

259  {
260  assert(rootFile());
261  while(offset != 0) {
262  bool atEnd = rootFile()->skipEvents(offset);
263  if((offset > 0 || atEnd) && !nextFile()) {
264  return false;
265  }
266  if(offset < 0 && !previousFile()) {
267  setNoMoreFiles();
268  return false;
269  }
270  }
271  return true;
272  }
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const

Member Data Documentation

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

Definition at line 67 of file RootPrimaryFileSequence.h.

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

bool edm::RootPrimaryFileSequence::bypassVersionCheck_
private

Definition at line 75 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

bool edm::RootPrimaryFileSequence::dropDescendants_
private

Definition at line 81 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

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

Definition at line 80 of file RootPrimaryFileSequence.h.

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

bool edm::RootPrimaryFileSequence::enablePrefetching_
private

Definition at line 84 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile(), and RootPrimaryFileSequence().

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

Definition at line 71 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

bool edm::RootPrimaryFileSequence::firstFile_
private

Definition at line 66 of file RootPrimaryFileSequence.h.

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

int edm::RootPrimaryFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 72 of file RootPrimaryFileSequence.h.

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

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

Definition at line 82 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

bool edm::RootPrimaryFileSequence::noEventSort_
private

Definition at line 73 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

unsigned int edm::RootPrimaryFileSequence::nStreams_
private

Definition at line 70 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

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

Definition at line 68 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

ProductSelectorRules edm::RootPrimaryFileSequence::productSelectorRules_
private

Definition at line 79 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

RunNumber_t edm::RootPrimaryFileSequence::setRun_
private

Definition at line 78 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

bool edm::RootPrimaryFileSequence::skipBadFiles_
private

Definition at line 74 of file RootPrimaryFileSequence.h.

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

unsigned int edm::RootPrimaryFileSequence::treeCacheSize_
private

Definition at line 76 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile(), and RootPrimaryFileSequence().

int const edm::RootPrimaryFileSequence::treeMaxVirtualSize_
private

Definition at line 77 of file RootPrimaryFileSequence.h.

Referenced by makeRootFile().

bool edm::RootPrimaryFileSequence::usingGoToEvent_
private

Definition at line 83 of file RootPrimaryFileSequence.h.

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