CMS 3D CMS Logo

List of all members | 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 Member Functions

void closeFile_ () override
 
void endJob ()
 
RootEmbeddedFileSequenceoperator= (RootEmbeddedFileSequence const &)=delete
 
bool readOneEvent (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool recycleFiles)
 
bool readOneRandom (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *, bool)
 
bool readOneRandomWithID (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool)
 
bool readOneSequential (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *, bool recycleFiles)
 
bool readOneSequentialWithID (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool)
 
void readOneSpecified (EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &id)
 
 RootEmbeddedFileSequence (ParameterSet const &pset, EmbeddedRootSource &input, InputFileCatalog const &catalog)
 
 RootEmbeddedFileSequence (RootEmbeddedFileSequence const &)=delete
 
void skipEntries (unsigned int offset)
 
 ~RootEmbeddedFileSequence () override
 
- Public Member Functions inherited from edm::RootInputFileSequence
bool containedInCurrentFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
std::shared_ptr< BranchIDListHelper const > fileBranchIDListHelper () const
 
std::shared_ptr< ProductRegistry const > fileProductRegistry () const
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
void readEvent (EventPrincipal &cache)
 
void readLuminosityBlock_ (LuminosityBlockPrincipal &lumiPrincipal)
 
std::shared_ptr< LuminosityBlockAuxiliaryreadLuminosityBlockAuxiliary_ ()
 
void readRun_ (RunPrincipal &runPrincipal)
 
std::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
 RootInputFileSequence (ParameterSet const &pset, InputFileCatalog const &catalog)
 
 RootInputFileSequence (RootInputFileSequence const &)=delete
 
bool skipToItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
 
virtual ~RootInputFileSequence ()
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Member Functions

void initFile_ (bool skipBadFiles) override
 
RootFileSharedPtr makeRootFile (std::shared_ptr< InputFile > filePtr) override
 

Private Attributes

bool enablePrefetching_
 
int eventsRemainingInFile_
 
bool(RootEmbeddedFileSequence::* fptr_ )(EventPrincipal &, size_t &, CLHEP::HepRandomEngine *, EventID const *, bool)
 
int initialNumberOfEventsToSkip_
 
EmbeddedRootSourceinput_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
bool sameLumiBlock_
 
bool sequential_
 
unsigned int treeCacheSize_
 

Additional Inherited Members

- Protected Types inherited from edm::RootInputFileSequence
typedef std::shared_ptr< RootFileRootFileSharedPtr
 
- Protected Member Functions inherited from edm::RootInputFileSequence
bool atFirstFile () const
 
bool atLastFile () const
 
std::string const & fallbackFileName () const
 
std::vector< FileCatalogItem > const & fileCatalogItems () const
 
std::string const & fileName () const
 
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles () const
 
void initFile (bool skipBadFiles)
 
void initTheFile (bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
 
std::string const & lfn () const
 
size_t lfnHash () const
 
std::string const & logicalFileName () const
 
bool noFiles () const
 
bool noMoreFiles () const
 
size_t numberOfFiles () const
 
std::shared_ptr< RootFile const > rootFile () const
 
std::shared_ptr< RootFile > & rootFile ()
 
size_t sequenceNumberOfFile () const
 
void setAtFileSequenceNumber (size_t offset)
 
void setAtFirstFile ()
 
void setAtNextFile ()
 
void setAtPreviousFile ()
 
void setIndexIntoFile (size_t index)
 
void setNoMoreFiles ()
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash)
 
bool usedFallback () const
 

Detailed Description

Definition at line 32 of file RootEmbeddedFileSequence.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file RootEmbeddedFileSequence.cc.

References edm::RootInputFileSequence::atFirstFile(), edm::errors::Configuration, KineDebug3::count(), SurveyInfoScenario_cff::distribution, enablePrefetching_, Exception, f, fptr_, edm::RootInputFileSequence::initFile(), initialNumberOfEventsToSkip_, input_, edm::IndexIntoFile::invalidEntry, edm::Service< T >::isAvailable(), edm::RootInputFileSequence::noFiles(), edm::RootInputFileSequence::numberOfFiles(), PFRecoTauDiscriminationByIsolation_cfi::offset, edm::VectorInputSource::productRegistryUpdate(), readOneRandom(), readOneRandomWithID(), readOneSequential(), readOneSequentialWithID(), edm::RootInputFileSequence::rootFile(), sameLumiBlock_, SurveyInfoScenario_cff::seed, sequential_, edm::RootInputFileSequence::setAtFileSequenceNumber(), edm::RootInputFileSequence::setAtFirstFile(), edm::EmbeddedRootSource::skipBadFiles(), skipEntries(), treeCacheSize_, mitigatedMETSequence_cff::U, and edm::ProductRegistry::updateFromInput().

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

Definition at line 109 of file RootEmbeddedFileSequence.cc.

109  {
110  }
edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence ( RootEmbeddedFileSequence const &  )
delete

Member Function Documentation

void edm::RootEmbeddedFileSequence::closeFile_ ( )
overridevirtual

Implements edm::RootInputFileSequence.

Definition at line 117 of file RootEmbeddedFileSequence.cc.

References edm::RootInputFileSequence::rootFile().

Referenced by endJob().

117  {
118  // delete the RootFile object.
119  if(rootFile()) {
120  rootFile().reset();
121  }
122  }
std::shared_ptr< RootFile const > rootFile() const
void edm::RootEmbeddedFileSequence::endJob ( void  )

Definition at line 113 of file RootEmbeddedFileSequence.cc.

References closeFile_().

113  {
114  closeFile_();
115  }
void edm::RootEmbeddedFileSequence::fillDescription ( ParameterSetDescription desc)
static

Definition at line 328 of file RootEmbeddedFileSequence.cc.

References edm::ParameterSetDescription::addUntracked(), edm::roottree::defaultCacheSize, and mitigatedMETSequence_cff::U.

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

328  {
329  desc.addUntracked<bool>("sequential", false)
330  ->setComment("True: loopEvents() reads events sequentially from beginning of first file.\n"
331  "False: loopEvents() first reads events beginning at random event. New files also chosen randomly");
332  desc.addUntracked<bool>("sameLumiBlock", false)
333  ->setComment("True: loopEvents() reads events only in same lumi as the specified event.\n"
334  "False: loopEvents() reads events regardless of lumi.");
335  desc.addUntracked<unsigned int>("skipEvents", 0U)
336  ->setComment("Skip the first 'skipEvents' events. Used only if 'sequential' is True and 'sameLumiBlock' is False");
337  desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize)
338  ->setComment("Size of ROOT TTree prefetch cache. Affects performance.");
339  }
unsigned int const defaultCacheSize
Definition: RootTree.h:46
void edm::RootEmbeddedFileSequence::initFile_ ( bool  skipBadFiles)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 124 of file RootEmbeddedFileSequence.cc.

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

124  {
125  initTheFile(skipBadFiles, false, nullptr, "mixingFiles", InputType::SecondarySource);
126  }
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
RootEmbeddedFileSequence::RootFileSharedPtr edm::RootEmbeddedFileSequence::makeRootFile ( std::shared_ptr< InputFile filePtr)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 129 of file RootEmbeddedFileSequence.cc.

References edm::EmbeddedRootSource::bypassVersionCheck(), enablePrefetching_, edm::RootInputFileSequence::fileName(), edm::RootInputFileSequence::indexesIntoFiles(), input_, edm::RootInputFileSequence::logicalFileName(), edm::EmbeddedRootSource::nStreams(), orderedProcessHistoryIDs_, edm::VectorInputSource::processHistoryRegistryForUpdate(), edm::EmbeddedRootSource::productSelectorRules(), edm::EmbeddedRootSource::runHelper(), edm::SecondarySource, edm::RootInputFileSequence::sequenceNumberOfFile(), treeCacheSize_, and edm::EmbeddedRootSource::treeMaxVirtualSize().

129  {
130  size_t currentIndexIntoFile = sequenceNumberOfFile();
131  return std::make_shared<RootFile>(
132  fileName(),
133  ProcessConfiguration(),
134  logicalFileName(),
135  filePtr,
136  input_.nStreams(),
139  input_.runHelper(),
144  currentIndexIntoFile,
148  }
std::string const & logicalFileName() const
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
std::string const & fileName() const
unsigned int nStreams() const
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
bool bypassVersionCheck() const
RunHelperBase * runHelper()
ProductSelectorRules const & productSelectorRules() const
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,
bool  recycleFiles 
)

Definition at line 321 of file RootEmbeddedFileSequence.cc.

References helperFunctions::cache(), fptr_, triggerObjects_cff::id, sameLumiBlock_, and sequential_.

321  {
322  assert(!sameLumiBlock_ || id != nullptr);
323  assert(sequential_ || engine != nullptr);
324  return (this->*fptr_)(cache, fileNameHash, engine, id, recycleFiles);
325  }
bool(RootEmbeddedFileSequence::* fptr_)(EventPrincipal &, size_t &, CLHEP::HepRandomEngine *, EventID const *, bool)
def cache(function)
bool edm::RootEmbeddedFileSequence::readOneRandom ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  engine,
EventID const *  ,
bool   
)

Definition at line 249 of file RootEmbeddedFileSequence.cc.

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

Referenced by RootEmbeddedFileSequence().

249  {
250  assert(rootFile());
251  assert(engine);
252  unsigned int currentSeqNumber = sequenceNumberOfFile();
253  while(eventsRemainingInFile_ == 0) {
254 
255  unsigned int newSeqNumber = CLHEP::RandFlat::shootInt(engine, fileCatalogItems().size());
256  setAtFileSequenceNumber(newSeqNumber);
257  if(newSeqNumber != currentSeqNumber) {
258  initFile(false);
259  currentSeqNumber = newSeqNumber;
260  }
261  eventsRemainingInFile_ = rootFile()->eventTree().entries();
262  if(eventsRemainingInFile_ == 0) {
263  throw Exception(errors::NotFound) <<
264  "RootEmbeddedFileSequence::readOneRandom(): Secondary Input file " << fileName() << " contains no events.\n";
265  }
266  rootFile()->setAtEventEntry(CLHEP::RandFlat::shootInt(engine, eventsRemainingInFile_) - 1);
267  }
268  rootFile()->nextEventEntry();
269 
270  bool found = rootFile()->readCurrentEvent(cache);
271  if(!found) {
272  rootFile()->setAtEventEntry(0);
273  bool found = rootFile()->readCurrentEvent(cache);
274  assert(found);
275  }
276  fileNameHash = lfnHash();
278  return true;
279  }
size
Write out results.
void initFile(bool skipBadFiles)
std::string const & fileName() const
void setAtFileSequenceNumber(size_t offset)
std::vector< FileCatalogItem > const & fileCatalogItems() const
def cache(function)
std::shared_ptr< RootFile const > rootFile() const
bool edm::RootEmbeddedFileSequence::readOneRandomWithID ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  engine,
EventID const *  id,
bool  recycleFiles 
)

Definition at line 282 of file RootEmbeddedFileSequence.cc.

References runEdmFileComparison::found, mps_fire::i, edm::RootInputFileSequence::lfnHash(), csvLumiCalc::lumi, edm::RootInputFileSequence::noMoreFiles(), edm::RootInputFileSequence::rootFile(), findQualityFiles::run, and edm::RootInputFileSequence::skipToItem().

Referenced by RootEmbeddedFileSequence().

282  {
283  assert(engine);
284  assert(idp);
285  EventID const& id = *idp;
286  if(noMoreFiles() || !rootFile() ||
287  rootFile()->indexIntoFileIter().run() != id.run() ||
288  rootFile()->indexIntoFileIter().lumi() != id.luminosityBlock()) {
289  bool found = skipToItem(id.run(), id.luminosityBlock(), 0);
290  if(!found) {
291  return false;
292  }
293  int eventsInLumi = 0;
294  assert(rootFile());
295  while(rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock())) ++eventsInLumi;
296  found = skipToItem(id.run(), id.luminosityBlock(), 0);
297  assert(found);
298  int eventInLumi = CLHEP::RandFlat::shootInt(engine, eventsInLumi);
299  for(int i = 0; i < eventInLumi; ++i) {
300  bool found = rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
301  assert(found);
302  }
303  }
304  assert(rootFile());
305  bool found = rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
306  if(found) {
307  found = rootFile()->readCurrentEvent(cache);
308  }
309  if(!found) {
310  bool found = rootFile()->setEntryAtItem(id.run(), id.luminosityBlock(), 0);
311  if(!found) {
312  return false;
313  }
314  return readOneRandomWithID(cache, fileNameHash, engine, idp, recycleFiles);
315  }
316  fileNameHash = lfnHash();
317  return true;
318  }
bool readOneRandomWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool)
def cache(function)
std::shared_ptr< RootFile 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 *  ,
bool  recycleFiles 
)

Definition at line 167 of file RootEmbeddedFileSequence.cc.

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

Referenced by RootEmbeddedFileSequence().

167  {
168  assert(rootFile());
169  rootFile()->nextEventEntry();
170  bool found = rootFile()->readCurrentEvent(cache);
171  if(!found) {
172  setAtNextFile();
173  if(noMoreFiles()) {
174  if (recycleFiles) {
175  setAtFirstFile();
176  } else {
177  return false;
178  }
179  }
180  initFile(false);
181  assert(rootFile());
182  rootFile()->setAtEventEntry(IndexIntoFile::invalidEntry);
183  return readOneSequential(cache, fileNameHash, nullptr, nullptr, recycleFiles);
184  }
185  fileNameHash = lfnHash();
186  return true;
187  }
void initFile(bool skipBadFiles)
bool readOneSequential(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *, bool recycleFiles)
def cache(function)
std::shared_ptr< RootFile const > rootFile() const
static constexpr EntryNumber_t invalidEntry
bool edm::RootEmbeddedFileSequence::readOneSequentialWithID ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  ,
EventID const *  id,
bool  recycleFiles 
)

Definition at line 190 of file RootEmbeddedFileSequence.cc.

References runEdmFileComparison::found, initialNumberOfEventsToSkip_, edm::RootInputFileSequence::lfnHash(), csvLumiCalc::lumi, edm::RootInputFileSequence::noMoreFiles(), PFRecoTauDiscriminationByIsolation_cfi::offset, edm::RootInputFileSequence::rootFile(), findQualityFiles::run, edm::RootInputFileSequence::skipToItem(), and edm::RootInputFileSequence::skipToItemInNewFile().

Referenced by RootEmbeddedFileSequence().

190  {
191  assert(idp);
192  EventID const& id = *idp;
195  if(offset > 0) {
196  assert(rootFile());
197  while(offset > 0) {
198  bool found = readOneSequentialWithID(cache, fileNameHash, nullptr, idp, recycleFiles);
199  if(!found) {
200  return false;
201  }
202  --offset;
203  }
204  }
205  assert(rootFile());
206  if(noMoreFiles() ||
207  rootFile()->indexIntoFileIter().run() != id.run() ||
208  rootFile()->indexIntoFileIter().lumi() != id.luminosityBlock()) {
209  bool found = skipToItem(id.run(), id.luminosityBlock(), 0, 0, false);
210  if(!found) {
211  return false;
212  }
213  }
214  assert(rootFile());
215  bool found = rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
216  if(found) {
217  found = rootFile()->readCurrentEvent(cache);
218  }
219  if(!found) {
220  found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0);
221  if(!found) {
222  return false;
223  }
224  return readOneSequentialWithID(cache, fileNameHash, nullptr, idp, recycleFiles);
225  }
226  fileNameHash = lfnHash();
227  return true;
228  }
bool readOneSequentialWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool)
def cache(function)
std::shared_ptr< RootFile const > rootFile() const
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 231 of file RootEmbeddedFileSequence.cc.

References event(), edm::SecondaryEventIDAndFileInfo::eventID(), Exception, edm::SecondaryEventIDAndFileInfo::fileNameHash(), runEdmFileComparison::found, edm::RootInputFileSequence::lfnHash(), edm::errors::NotFound, edm::RootInputFileSequence::rootFile(), findQualityFiles::run, edm::RootInputFileSequence::skipToItem(), and mitigatedMETSequence_cff::U.

231  {
232  EventID const& id = idx.eventID();
233  bool found = skipToItem(id.run(), id.luminosityBlock(), id.event(), idx.fileNameHash());
234  if(!found) {
235  throw Exception(errors::NotFound) <<
236  "RootEmbeddedFileSequence::readOneSpecified(): Secondary Input files" <<
237  " do not contain specified event:\n" << id << "\n";
238  }
239  assert(rootFile());
240  found = rootFile()->readCurrentEvent(cache);
241  assert(found);
242  fileNameHash = idx.fileNameHash();
243  if(fileNameHash == 0U) {
244  fileNameHash = lfnHash();
245  }
246  }
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
def cache(function)
std::shared_ptr< RootFile const > rootFile() const
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
void edm::RootEmbeddedFileSequence::skipEntries ( unsigned int  offset)

Definition at line 151 of file RootEmbeddedFileSequence.cc.

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

Referenced by RootEmbeddedFileSequence().

151  {
152  // offset is decremented by the number of events actually skipped.
153  bool completed = rootFile()->skipEntries(offset);
154  while(!completed) {
155  setAtNextFile();
156  if(noMoreFiles()) {
157  setAtFirstFile();
158  }
159  initFile(false);
160  assert(rootFile());
161  rootFile()->setAtEventEntry(IndexIntoFile::invalidEntry);
162  completed = rootFile()->skipEntries(offset);
163  }
164  }
void initFile(bool skipBadFiles)
std::shared_ptr< RootFile const > rootFile() const
static constexpr EntryNumber_t invalidEntry

Member Data Documentation

bool edm::RootEmbeddedFileSequence::enablePrefetching_
private

Definition at line 67 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile(), and RootEmbeddedFileSequence().

int edm::RootEmbeddedFileSequence::eventsRemainingInFile_
private

Definition at line 64 of file RootEmbeddedFileSequence.h.

Referenced by readOneRandom().

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

Definition at line 63 of file RootEmbeddedFileSequence.h.

Referenced by readOneEvent(), and RootEmbeddedFileSequence().

int edm::RootEmbeddedFileSequence::initialNumberOfEventsToSkip_
private

Definition at line 65 of file RootEmbeddedFileSequence.h.

Referenced by readOneSequentialWithID(), and RootEmbeddedFileSequence().

EmbeddedRootSource& edm::RootEmbeddedFileSequence::input_
private

Definition at line 57 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile(), and RootEmbeddedFileSequence().

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

Definition at line 59 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile().

bool edm::RootEmbeddedFileSequence::sameLumiBlock_
private

Definition at line 62 of file RootEmbeddedFileSequence.h.

Referenced by readOneEvent(), and RootEmbeddedFileSequence().

bool edm::RootEmbeddedFileSequence::sequential_
private

Definition at line 61 of file RootEmbeddedFileSequence.h.

Referenced by readOneEvent(), and RootEmbeddedFileSequence().

unsigned int edm::RootEmbeddedFileSequence::treeCacheSize_
private

Definition at line 66 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile(), and RootEmbeddedFileSequence().