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 StorageFactory::activateTimeout(), 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 
67 
68  // Prestage the files
70  factory->activateTimeout(fileName());
71  factory->stagein(fileName());
72  }
73  // Open the first file.
76  if(rootFile()) break;
77  }
78  if(rootFile()) {
79  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
82  }
83  }
84  }
void stagein(const std::string &url)
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 StorageFactory * get(void)
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)
void activateTimeout(const std::string &url)
static std::auto_ptr< EventSkipperByID > create(ParameterSet const &pset)
edm::RootPrimaryFileSequence::~RootPrimaryFileSequence ( )
virtual

Definition at line 86 of file RootPrimaryFileSequence.cc.

86  {
87  }
edm::RootPrimaryFileSequence::RootPrimaryFileSequence ( RootPrimaryFileSequence const &  )
delete

Member Function Documentation

void edm::RootPrimaryFileSequence::closeFile_ ( )
overridevirtual

Implements edm::RootInputFileSequence.

Definition at line 114 of file RootPrimaryFileSequence.cc.

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

Referenced by endJob(), and rewind_().

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

Definition at line 90 of file RootPrimaryFileSequence.cc.

References closeFile_().

90  {
91  closeFile_();
92  }
void edm::RootPrimaryFileSequence::fillDescription ( ParameterSetDescription desc)
static

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

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

211  {
212  if(noMoreFiles()) {
213  return InputSource::IsStop;
214  }
215  if(firstFile_) {
216  return InputSource::IsFile;
217  }
218  if(rootFile()) {
219  IndexIntoFile::EntryType entryType = rootFile()->getNextItemType(run, lumi, event);
220  if(entryType == IndexIntoFile::kEvent) {
221  return InputSource::IsEvent;
222  } else if(entryType == IndexIntoFile::kLumi) {
223  return InputSource::IsLumi;
224  } else if(entryType == IndexIntoFile::kRun) {
225  return InputSource::IsRun;
226  }
227  assert(entryType == IndexIntoFile::kEnd);
228  }
229  if(atLastFile()) {
230  return InputSource::IsStop;
231  }
232  return InputSource::IsFile;
233  }
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 278 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_.

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

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

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

135  {
136  size_t currentIndexIntoFile = sequenceNumberOfFile();
137  return std::make_shared<RootFile>(
138  fileName(),
140  logicalFileName(),
141  filePtr,
144  remainingEvents(),
146  nStreams_,
150  setRun_,
151  noEventSort_,
156  std::vector<BranchID>(), // associationsFromSecondary_
161  currentIndexIntoFile,
167  }
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 169 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().

169  {
170  if(!noMoreFiles()) setAtNextFile();
171  if(noMoreFiles()) {
172  return false;
173  }
174 
176 
177  if(rootFile()) {
178  // make sure the new product registry is compatible with the main one
179  std::string mergeInfo = input_.productRegistryUpdate().merge(*rootFile()->productRegistry(),
180  fileName(),
182  if(!mergeInfo.empty()) {
183  throw Exception(errors::MismatchedInputFiles,"RootPrimaryFileSequence::nextFile()") << mergeInfo;
184  }
185  }
186  return true;
187  }
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 189 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().

189  {
190  if(atFirstFile()) {
191  return false;
192  }
194 
195  initFile(false);
196 
197  if(rootFile()) {
198  // make sure the new product registry is compatible to the main one
199  std::string mergeInfo = input_.productRegistryUpdate().merge(*rootFile()->productRegistry(),
200  fileName(),
202  if(!mergeInfo.empty()) {
203  throw Exception(errors::MismatchedInputFiles,"RootPrimaryFileSequence::previousEvent()") << mergeInfo;
204  }
205  }
206  if(rootFile()) rootFile()->setToLastEntry();
207  return true;
208  }
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 95 of file RootPrimaryFileSequence.cc.

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

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

Definition at line 333 of file RootPrimaryFileSequence.cc.

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

Referenced by makeRootFile().

333  {
334  return input_.remainingEvents();
335  }
int remainingEvents() const
Definition: InputSource.h:195
int edm::RootPrimaryFileSequence::remainingLuminosityBlocks ( ) const
private

Definition at line 338 of file RootPrimaryFileSequence.cc.

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

Referenced by makeRootFile().

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

Definition at line 237 of file RootPrimaryFileSequence.cc.

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

237  {
238  if(!atFirstFile()) {
239  closeFile_();
240  setAtFirstFile();
241  }
242  if(!rootFile()) {
243  initFile(false);
244  }
245  rewindFile();
246  firstFile_ = true;
247  if(rootFile()) {
250  }
251  }
252  }
void initFile(bool skipBadFiles)
RootFileSharedPtr const & rootFile() const
void edm::RootPrimaryFileSequence::rewindFile ( )
private

Definition at line 256 of file RootPrimaryFileSequence.cc.

References edm::RootInputFileSequence::rootFile().

Referenced by rewind_().

256  {
257  if(rootFile()) rootFile()->rewind();
258  }
RootFileSharedPtr const & rootFile() const
bool edm::RootPrimaryFileSequence::skipEvents ( int  offset)

Definition at line 262 of file RootPrimaryFileSequence.cc.

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

Referenced by rewind_(), and RootPrimaryFileSequence().

262  {
263  assert(rootFile());
264  while(offset != 0) {
265  bool atEnd = rootFile()->skipEvents(offset);
266  if((offset > 0 || atEnd) && !nextFile()) {
267  return false;
268  }
269  if(offset < 0 && !previousFile()) {
270  setNoMoreFiles();
271  return false;
272  }
273  }
274  return true;
275  }
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().