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::RootEmbeddedFileSequence Class Reference

#include <RootEmbeddedFileSequence.h>

Inheritance diagram for edm::RootEmbeddedFileSequence:
edm::RootInputFileSequence

Public Types

typedef std::shared_ptr< RootFileRootFileSharedPtr
 

Public Member Functions

virtual void closeFile_ () override
 
void dropUnwantedBranches_ (std::vector< std::string > const &wantedBranches)
 
void endJob ()
 
RootEmbeddedFileSequenceoperator= (RootEmbeddedFileSequence const &)=delete
 
bool readOneEvent (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
 
bool readOneRandom (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *)
 
bool readOneRandomWithID (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
 
bool readOneSequential (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *)
 
bool readOneSequentialWithID (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
 
void readOneSpecified (EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &id)
 
 RootEmbeddedFileSequence (ParameterSet const &pset, EmbeddedRootSource &input, InputFileCatalog const &catalog, unsigned int nStreams)
 
 RootEmbeddedFileSequence (RootEmbeddedFileSequence const &)=delete
 
void skipEntries (unsigned int offset)
 
virtual ~RootEmbeddedFileSequence ()
 
- 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
 

Private Attributes

bool bypassVersionCheck_
 
bool enablePrefetching_
 
int eventsRemainingInFile_
 
bool(RootEmbeddedFileSequence::* fptr_ )(EventPrincipal &, size_t &, CLHEP::HepRandomEngine *, EventID const *)
 
int initialNumberOfEventsToSkip_
 
EmbeddedRootSourceinput_
 
unsigned int nStreams_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
ProductSelectorRules productSelectorRules_
 
bool sameLumiBlock_
 
bool sequential_
 
bool skipBadFiles_
 
int const treeMaxVirtualSize_
 

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 RootEmbeddedFileSequence.h.

Member Typedef Documentation

Definition at line 44 of file RootEmbeddedFileSequence.h.

Constructor & Destructor Documentation

edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence ( ParameterSet const &  pset,
EmbeddedRootSource input,
InputFileCatalog const &  catalog,
unsigned int  nStreams 
)
explicit

Definition at line 26 of file RootEmbeddedFileSequence.cc.

References assert(), edm::RootInputFileSequence::atFirstFile(), edm::errors::Configuration, prof2calltree::count, enablePrefetching_, Exception, f, fptr_, edm::RootInputFileSequence::initFile(), initialNumberOfEventsToSkip_, input_, edm::IndexIntoFile::invalidEntry, edm::Service< T >::isAvailable(), edm::RootInputFileSequence::noFiles(), edm::RootInputFileSequence::numberOfFiles(), hltrates_dqm_sourceclient-live_cfg::offset, edm::VectorInputSource::productRegistryUpdate(), readOneRandom(), readOneRandomWithID(), readOneSequential(), readOneSequentialWithID(), edm::RootInputFileSequence::rootFile(), sameLumiBlock_, fileCollector::seed, sequential_, edm::RootInputFileSequence::setAtFileSequenceNumber(), edm::RootInputFileSequence::setAtFirstFile(), skipBadFiles_, skipEntries(), and edm::ProductRegistry::updateFromInput().

30  :
32  input_(input),
34  nStreams_(nStreams),
35  sequential_(pset.getUntrackedParameter<bool>("sequential", false)),
36  sameLumiBlock_(pset.getUntrackedParameter<bool>("sameLumiBlock", false)),
37  fptr_(nullptr),
39  // The default value provided as the second argument to the getUntrackedParameter function call
40  // is not used when the ParameterSet has been validated and the parameters are not optional
41  // in the description. This is currently true when PoolSource is the primary input source.
42  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
43  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
44  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
45  // and should be deleted from the code.
46  initialNumberOfEventsToSkip_(pset.getUntrackedParameter<unsigned int>("skipEvents", 0U)),
47  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
48  bypassVersionCheck_(pset.getUntrackedParameter<bool>("bypassVersionCheck", false)),
49  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
50  productSelectorRules_(pset, "inputCommands", "InputSource"),
51  enablePrefetching_(false) {
52 
53  if(noFiles()) {
54  throw Exception(errors::Configuration) << "RootEmbeddedFileSequence no input files specified for secondary input source.\n";
55  }
56  //
57  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
59  if(pSLC.isAvailable()) {
60  enablePrefetching_ = pSLC->enablePrefetching();
61  }
62 
63  // Set the pointer to the function that reads an event.
64  if(sameLumiBlock_) {
65  if(sequential_) {
67  } else {
69  }
70  } else {
71  if(sequential_) {
73  } else {
75  }
76  }
77 
78  // For the secondary input source we do not stage in.
79  if(sequential_) {
80  // We open the first file
81  if(!atFirstFile()) {
83  initFile(false);
84  }
85  assert(rootFile());
86  rootFile()->setAtEventEntry(IndexIntoFile::invalidEntry);
87  if(!sameLumiBlock_) {
89  }
90  } else {
91  // We randomly choose the first file to open.
92  // We cannot use the random number service yet.
93  std::ifstream f("/dev/urandom");
94  unsigned int seed;
95  f.read(reinterpret_cast<char*>(&seed), sizeof(seed));
96  std::default_random_engine dre(seed);
97  size_t count = numberOfFiles();
98  std::uniform_int_distribution<int> distribution(0, count - 1);
99  while(!rootFile() && count != 0) {
100  --count;
101  int offset = distribution(dre);
102  setAtFileSequenceNumber(offset);
104  }
105  }
106  if(rootFile()) {
107  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
108  }
109  }
bool(RootEmbeddedFileSequence::* fptr_)(EventPrincipal &, size_t &, CLHEP::HepRandomEngine *, EventID const *)
void initFile(bool skipBadFiles)
void setAtFileSequenceNumber(size_t offset)
assert(m_qm.get())
ProductRegistry & productRegistryUpdate() const
static std::string const input
Definition: EdmProvDump.cc:43
bool readOneRandomWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
bool readOneSequential(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *)
bool readOneRandom(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *)
RootFileSharedPtr const & rootFile() const
double f[11][100]
ProductSelectorRules productSelectorRules_
bool readOneSequentialWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
static EntryNumber_t const invalidEntry
void updateFromInput(ProductList const &other)
RootInputFileSequence(ParameterSet const &pset, InputFileCatalog const &catalog)
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
void skipEntries(unsigned int offset)
edm::RootEmbeddedFileSequence::~RootEmbeddedFileSequence ( )
virtual

Definition at line 111 of file RootEmbeddedFileSequence.cc.

111  {
112  }
edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence ( RootEmbeddedFileSequence const &  )
delete

Member Function Documentation

void edm::RootEmbeddedFileSequence::closeFile_ ( )
overridevirtual

Implements edm::RootInputFileSequence.

Definition at line 119 of file RootEmbeddedFileSequence.cc.

References edm::RootInputFileSequence::rootFile().

Referenced by endJob().

119  {
120  // delete the RootFile object.
121  if(rootFile()) {
122  rootFile().reset();
123  }
124  }
RootFileSharedPtr const & rootFile() const
void edm::RootEmbeddedFileSequence::dropUnwantedBranches_ ( std::vector< std::string > const &  wantedBranches)

Definition at line 166 of file RootEmbeddedFileSequence.cc.

References edm::ParameterSet::addUntrackedParameter(), productSelectorRules_, cmsCodeRulesChecker::rules, and AlCaHLTBitMon_QueryRunRegistry::string.

166  {
167  std::vector<std::string> rules;
168  rules.reserve(wantedBranches.size() + 1);
169  rules.emplace_back("drop *");
170  for(std::string const& branch : wantedBranches) {
171  rules.push_back("keep " + branch + "_*");
172  }
173  ParameterSet pset;
174  pset.addUntrackedParameter("inputCommands", rules);
175  productSelectorRules_ = ProductSelectorRules(pset, "inputCommands", "InputSource");
176  }
ProductSelectorRules productSelectorRules_
void edm::RootEmbeddedFileSequence::endJob ( void  )

Definition at line 115 of file RootEmbeddedFileSequence.cc.

References closeFile_().

115  {
116  closeFile_();
117  }
void edm::RootEmbeddedFileSequence::fillDescription ( ParameterSetDescription desc)
static

Definition at line 357 of file RootEmbeddedFileSequence.cc.

References edm::ParameterSetDescription::addUntracked(), and edm::ProductSelectorRules::fillDescription().

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

357  {
358  desc.addUntracked<bool>("sequential", false)
359  ->setComment("True: loopEvents() reads events sequentially from beginning of first file.\n"
360  "False: loopEvents() first reads events beginning at random event. New files also chosen randomly");
361  desc.addUntracked<bool>("sameLumiBlock", false)
362  ->setComment("True: loopEvents() reads events only in same lumi as the specified event.\n"
363  "False: loopEvents() reads events regardless of lumi.");
364  desc.addUntracked<unsigned int>("skipEvents", 0U)
365  ->setComment("Skip the first 'skipEvents' events. Used only if 'sequential' is True and 'sameLumiBlock' is False");
366  desc.addUntracked<bool>("skipBadFiles", false)
367  ->setComment("True: Ignore any missing or unopenable input file.\n"
368  "False: Throw exception if missing or unopenable input file.");
369  desc.addUntracked<bool>("bypassVersionCheck", false)
370  ->setComment("True: Bypass release version check.\n"
371  "False: Throw exception if reading file in a release prior to the release in which the file was written.");
372  desc.addUntracked<int>("treeMaxVirtualSize", -1)
373  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
374 
375  ProductSelectorRules::fillDescription(desc, "inputCommands");
376  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
void edm::RootEmbeddedFileSequence::initFile_ ( bool  skipBadFiles)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 126 of file RootEmbeddedFileSequence.cc.

References edm::RootInputFileSequence::initTheFile(), and edm::SecondarySource.

126  {
127  initTheFile(skipBadFiles, false, nullptr, "mixingFiles", InputType::SecondarySource);
128  }
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
tuple skipBadFiles
Definition: example_cfg.py:64
RootEmbeddedFileSequence::RootFileSharedPtr edm::RootEmbeddedFileSequence::makeRootFile ( std::shared_ptr< InputFile filePtr)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 131 of file RootEmbeddedFileSequence.cc.

References bypassVersionCheck_, enablePrefetching_, edm::RootInputFileSequence::fileName(), edm::RootInputFileSequence::indexesIntoFiles(), input_, edm::RootInputFileSequence::logicalFileName(), nStreams_, orderedProcessHistoryIDs_, edm::VectorInputSource::processHistoryRegistryForUpdate(), productSelectorRules_, edm::InputSource::RunsLumisAndEvents, edm::SecondarySource, edm::RootInputFileSequence::sequenceNumberOfFile(), and treeMaxVirtualSize_.

131  {
132  size_t currentIndexIntoFile = sequenceNumberOfFile();
133  return std::make_shared<RootFile>(
134  fileName(),
135  ProcessConfiguration(),
136  logicalFileName(),
137  filePtr,
138  nullptr, // eventSkipperByID_
139  false, // initialNumberOfEventsToSkip_ != 0 (not used)
140  -1, // remainingEvents()
141  -1, // remainingLuminosityBlocks()
142  nStreams_,
143  0U, // treeCacheSize_
146  0U, // setRun_
147  false, // noEventSort_
150  std::make_shared<BranchIDListHelper>(),
151  std::make_shared<ThinnedAssociationsHelper>(),
152  std::vector<BranchID>(), // associationsFromSecondary_
153  nullptr, // duplicateChecker_
154  false, // dropDescendants_
157  currentIndexIntoFile,
160  false, // labelRawDataLikeMC_
161  false, // usingGoToEvent_
163  }
std::string const & logicalFileName() const
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
std::string const & fileName() const
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
ProductSelectorRules productSelectorRules_
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
RootEmbeddedFileSequence& edm::RootEmbeddedFileSequence::operator= ( RootEmbeddedFileSequence const &  )
delete
bool edm::RootEmbeddedFileSequence::readOneEvent ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  engine,
EventID const *  id 
)

Definition at line 350 of file RootEmbeddedFileSequence.cc.

References assert(), fptr_, sameLumiBlock_, and sequential_.

350  {
351  assert(!sameLumiBlock_ || id != nullptr);
352  assert(sequential_ || engine != nullptr);
353  return (this->*fptr_)(cache, fileNameHash, engine, id);
354  }
bool(RootEmbeddedFileSequence::* fptr_)(EventPrincipal &, size_t &, CLHEP::HepRandomEngine *, EventID const *)
assert(m_qm.get())
bool edm::RootEmbeddedFileSequence::readOneRandom ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  engine,
EventID const *   
)

Definition at line 276 of file RootEmbeddedFileSequence.cc.

References assert(), eventsRemainingInFile_, Exception, edm::RootInputFileSequence::fileCatalogItems(), edm::RootInputFileSequence::fileName(), newFWLiteAna::found, edm::RootInputFileSequence::initFile(), edm::RootInputFileSequence::lfnHash(), edm::errors::NotFound, edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::sequenceNumberOfFile(), edm::RootInputFileSequence::setAtFileSequenceNumber(), findQualityFiles::size, and skipBadFiles_.

Referenced by RootEmbeddedFileSequence().

276  {
277  assert(rootFile());
278  assert(engine);
279  skipBadFiles_ = false;
280  unsigned int currentSeqNumber = sequenceNumberOfFile();
281  while(eventsRemainingInFile_ == 0) {
282 
283  unsigned int newSeqNumber = CLHEP::RandFlat::shootInt(engine, fileCatalogItems().size());
284  setAtFileSequenceNumber(newSeqNumber);
285  if(newSeqNumber != currentSeqNumber) {
286  initFile(false);
287  currentSeqNumber = newSeqNumber;
288  }
289  eventsRemainingInFile_ = rootFile()->eventTree().entries();
290  if(eventsRemainingInFile_ == 0) {
291  throw Exception(errors::NotFound) <<
292  "RootEmbeddedFileSequence::readOneRandom(): Secondary Input file " << fileName() << " contains no events.\n";
293  }
294  rootFile()->setAtEventEntry(CLHEP::RandFlat::shootInt(engine, eventsRemainingInFile_) - 1);
295  }
296  rootFile()->nextEventEntry();
297 
298  bool found = rootFile()->readCurrentEvent(cache);
299  if(!found) {
300  rootFile()->setAtEventEntry(0);
301  bool found = rootFile()->readCurrentEvent(cache);
302  assert(found);
303  }
304  fileNameHash = lfnHash();
306  return true;
307  }
void initFile(bool skipBadFiles)
std::string const & fileName() const
void setAtFileSequenceNumber(size_t offset)
assert(m_qm.get())
std::vector< FileCatalogItem > const & fileCatalogItems() const
RootFileSharedPtr const & rootFile() const
tuple size
Write out results.
bool edm::RootEmbeddedFileSequence::readOneRandomWithID ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  engine,
EventID const *  id 
)

Definition at line 310 of file RootEmbeddedFileSequence.cc.

References assert(), newFWLiteAna::found, i, edm::RootInputFileSequence::lfnHash(), fjr2json::lumi, edm::RootInputFileSequence::noMoreFiles(), edm::RootInputFileSequence::rootFile(), DTTTrigCorrFirst::run, skipBadFiles_, and edm::RootInputFileSequence::skipToItem().

Referenced by RootEmbeddedFileSequence().

310  {
311  assert(engine);
312  assert(idp);
313  EventID const& id = *idp;
314  skipBadFiles_ = false;
315  if(noMoreFiles() || !rootFile() ||
316  rootFile()->indexIntoFileIter().run() != id.run() ||
317  rootFile()->indexIntoFileIter().lumi() != id.luminosityBlock()) {
318  bool found = skipToItem(id.run(), id.luminosityBlock(), 0);
319  if(!found) {
320  return false;
321  }
322  int eventsInLumi = 0;
323  assert(rootFile());
324  while(rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock())) ++eventsInLumi;
325  found = skipToItem(id.run(), id.luminosityBlock(), 0);
326  assert(found);
327  int eventInLumi = CLHEP::RandFlat::shootInt(engine, eventsInLumi);
328  for(int i = 0; i < eventInLumi; ++i) {
329  bool found = rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
330  assert(found);
331  }
332  }
333  assert(rootFile());
334  bool found = rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
335  if(found) {
336  found = rootFile()->readCurrentEvent(cache);
337  }
338  if(!found) {
339  bool found = rootFile()->setEntryAtItem(id.run(), id.luminosityBlock(), 0);
340  if(!found) {
341  return false;
342  }
343  return readOneRandomWithID(cache, fileNameHash, engine, idp);
344  }
345  fileNameHash = lfnHash();
346  return true;
347  }
int i
Definition: DBlmapReader.cc:9
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
bool readOneRandomWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
RootFileSharedPtr const & rootFile() const
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
bool edm::RootEmbeddedFileSequence::readOneSequential ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  ,
EventID const *   
)

Definition at line 195 of file RootEmbeddedFileSequence.cc.

References assert(), newFWLiteAna::found, edm::RootInputFileSequence::initFile(), edm::IndexIntoFile::invalidEntry, edm::RootInputFileSequence::lfnHash(), edm::RootInputFileSequence::noMoreFiles(), edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::setAtFirstFile(), edm::RootInputFileSequence::setAtNextFile(), and skipBadFiles_.

Referenced by RootEmbeddedFileSequence().

195  {
196  skipBadFiles_ = false;
197  assert(rootFile());
198  rootFile()->nextEventEntry();
199  bool found = rootFile()->readCurrentEvent(cache);
200  if(!found) {
201  setAtNextFile();
202  if(noMoreFiles()) {
203  setAtFirstFile();
204  }
205  initFile(false);
206  assert(rootFile());
207  rootFile()->setAtEventEntry(IndexIntoFile::invalidEntry);
208  return readOneSequential(cache, fileNameHash, nullptr, nullptr);
209  }
210  fileNameHash = lfnHash();
211  return true;
212  }
void initFile(bool skipBadFiles)
assert(m_qm.get())
bool readOneSequential(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *)
RootFileSharedPtr const & rootFile() const
static EntryNumber_t const invalidEntry
bool edm::RootEmbeddedFileSequence::readOneSequentialWithID ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  ,
EventID const *  id 
)

Definition at line 215 of file RootEmbeddedFileSequence.cc.

References assert(), newFWLiteAna::found, initialNumberOfEventsToSkip_, edm::RootInputFileSequence::lfnHash(), fjr2json::lumi, edm::RootInputFileSequence::noMoreFiles(), hltrates_dqm_sourceclient-live_cfg::offset, edm::RootInputFileSequence::rootFile(), DTTTrigCorrFirst::run, skipBadFiles_, edm::RootInputFileSequence::skipToItem(), and edm::RootInputFileSequence::skipToItemInNewFile().

Referenced by RootEmbeddedFileSequence().

215  {
216  assert(idp);
217  EventID const& id = *idp;
218  skipBadFiles_ = false;
221  if(offset > 0) {
222  assert(rootFile());
223  while(offset > 0) {
224  bool found = readOneSequentialWithID(cache, fileNameHash, nullptr, idp);
225  if(!found) {
226  return false;
227  }
228  --offset;
229  }
230  }
231  assert(rootFile());
232  if(noMoreFiles() ||
233  rootFile()->indexIntoFileIter().run() != id.run() ||
234  rootFile()->indexIntoFileIter().lumi() != id.luminosityBlock()) {
235  bool found = skipToItem(id.run(), id.luminosityBlock(), 0, 0, false);
236  if(!found) {
237  return false;
238  }
239  }
240  assert(rootFile());
241  bool found = rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
242  if(found) {
243  found = rootFile()->readCurrentEvent(cache);
244  }
245  if(!found) {
246  found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0);
247  if(!found) {
248  return false;
249  }
250  return readOneSequentialWithID(cache, fileNameHash, nullptr, idp);
251  }
252  fileNameHash = lfnHash();
253  return true;
254  }
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
bool readOneSequentialWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
void edm::RootEmbeddedFileSequence::readOneSpecified ( EventPrincipal cache,
size_t &  fileNameHash,
SecondaryEventIDAndFileInfo const &  id 
)

Definition at line 257 of file RootEmbeddedFileSequence.cc.

References assert(), event(), edm::SecondaryEventIDAndFileInfo::eventID(), Exception, edm::SecondaryEventIDAndFileInfo::fileNameHash(), newFWLiteAna::found, edm::RootInputFileSequence::lfnHash(), edm::errors::NotFound, edm::RootInputFileSequence::rootFile(), DTTTrigCorrFirst::run, skipBadFiles_, and edm::RootInputFileSequence::skipToItem().

257  {
258  skipBadFiles_ = false;
259  EventID const& id = idx.eventID();
260  bool found = skipToItem(id.run(), id.luminosityBlock(), id.event(), idx.fileNameHash());
261  if(!found) {
262  throw Exception(errors::NotFound) <<
263  "RootEmbeddedFileSequence::readOneSpecified(): Secondary Input files" <<
264  " do not contain specified event:\n" << id << "\n";
265  }
266  assert(rootFile());
267  found = rootFile()->readCurrentEvent(cache);
268  assert(found);
269  fileNameHash = idx.fileNameHash();
270  if(fileNameHash == 0U) {
271  fileNameHash = lfnHash();
272  }
273  }
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 skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
void edm::RootEmbeddedFileSequence::skipEntries ( unsigned int  offset)

Definition at line 179 of file RootEmbeddedFileSequence.cc.

References assert(), edm::RootInputFileSequence::initFile(), edm::IndexIntoFile::invalidEntry, edm::RootInputFileSequence::noMoreFiles(), edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::setAtFirstFile(), and edm::RootInputFileSequence::setAtNextFile().

Referenced by RootEmbeddedFileSequence().

179  {
180  // offset is decremented by the number of events actually skipped.
181  bool completed = rootFile()->skipEntries(offset);
182  while(!completed) {
183  setAtNextFile();
184  if(noMoreFiles()) {
185  setAtFirstFile();
186  }
187  initFile(false);
188  assert(rootFile());
189  rootFile()->setAtEventEntry(IndexIntoFile::invalidEntry);
190  completed = rootFile()->skipEntries(offset);
191  }
192  }
void initFile(bool skipBadFiles)
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
static EntryNumber_t const invalidEntry

Member Data Documentation

bool edm::RootEmbeddedFileSequence::bypassVersionCheck_
private

Definition at line 72 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile().

bool edm::RootEmbeddedFileSequence::enablePrefetching_
private

Definition at line 75 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile(), and RootEmbeddedFileSequence().

int edm::RootEmbeddedFileSequence::eventsRemainingInFile_
private

Definition at line 69 of file RootEmbeddedFileSequence.h.

Referenced by readOneRandom().

bool(RootEmbeddedFileSequence::* edm::RootEmbeddedFileSequence::fptr_)(EventPrincipal &, size_t &, CLHEP::HepRandomEngine *, EventID const *)
private

Definition at line 68 of file RootEmbeddedFileSequence.h.

Referenced by readOneEvent(), and RootEmbeddedFileSequence().

int edm::RootEmbeddedFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 70 of file RootEmbeddedFileSequence.h.

Referenced by readOneSequentialWithID(), and RootEmbeddedFileSequence().

EmbeddedRootSource& edm::RootEmbeddedFileSequence::input_
private

Definition at line 61 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile(), and RootEmbeddedFileSequence().

unsigned int edm::RootEmbeddedFileSequence::nStreams_
private

Definition at line 65 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile().

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

Definition at line 63 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile().

ProductSelectorRules edm::RootEmbeddedFileSequence::productSelectorRules_
private

Definition at line 74 of file RootEmbeddedFileSequence.h.

Referenced by dropUnwantedBranches_(), and makeRootFile().

bool edm::RootEmbeddedFileSequence::sameLumiBlock_
private

Definition at line 67 of file RootEmbeddedFileSequence.h.

Referenced by readOneEvent(), and RootEmbeddedFileSequence().

bool edm::RootEmbeddedFileSequence::sequential_
private

Definition at line 66 of file RootEmbeddedFileSequence.h.

Referenced by readOneEvent(), and RootEmbeddedFileSequence().

bool edm::RootEmbeddedFileSequence::skipBadFiles_
private
int const edm::RootEmbeddedFileSequence::treeMaxVirtualSize_
private

Definition at line 73 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile().