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_
 
bool enforceGUIDInFileName_
 
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  enforceGUIDInFileName_(pset.getUntrackedParameter<bool>("enforceGUIDInFileName", false)) {
48 
49  if(noFiles()) {
50  throw Exception(errors::Configuration) << "RootEmbeddedFileSequence no input files specified for secondary input source.\n";
51  }
52  //
53  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
55  if(pSLC.isAvailable()) {
56  if(treeCacheSize_ != 0U && pSLC->sourceTTreeCacheSize()) {
57  treeCacheSize_ = *(pSLC->sourceTTreeCacheSize());
58  }
59  enablePrefetching_ = pSLC->enablePrefetching();
60  }
61 
62  // Set the pointer to the function that reads an event.
63  if(sameLumiBlock_) {
64  if(sequential_) {
66  } else {
68  }
69  } else {
70  if(sequential_) {
72  } else {
74  }
75  }
76 
77  // For the secondary input source we do not stage in.
78  if(sequential_) {
79  // We open the first file
80  if(!atFirstFile()) {
82  initFile(false);
83  }
84  assert(rootFile());
85  rootFile()->setAtEventEntry(IndexIntoFile::invalidEntry);
86  if(!sameLumiBlock_) {
88  }
89  } else {
90  // We randomly choose the first file to open.
91  // We cannot use the random number service yet.
92  std::ifstream f("/dev/urandom");
93  unsigned int seed;
94  f.read(reinterpret_cast<char*>(&seed), sizeof(seed));
95  std::default_random_engine dre(seed);
96  size_t count = numberOfFiles();
97  std::uniform_int_distribution<int> distribution(0, count - 1);
98  while(!rootFile() && count != 0) {
99  --count;
100  int offset = distribution(dre);
101  setAtFileSequenceNumber(offset);
103  }
104  }
105  if(rootFile()) {
106  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
107  }
108  }
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 110 of file RootEmbeddedFileSequence.cc.

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

Member Function Documentation

void edm::RootEmbeddedFileSequence::closeFile_ ( )
overridevirtual

Implements edm::RootInputFileSequence.

Definition at line 118 of file RootEmbeddedFileSequence.cc.

References edm::RootInputFileSequence::rootFile().

Referenced by endJob().

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

Definition at line 114 of file RootEmbeddedFileSequence.cc.

References closeFile_().

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

Definition at line 330 of file RootEmbeddedFileSequence.cc.

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

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

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

Implements edm::RootInputFileSequence.

Definition at line 125 of file RootEmbeddedFileSequence.cc.

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

125  {
126  initTheFile(skipBadFiles, false, nullptr, "mixingFiles", InputType::SecondarySource);
127  }
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 130 of file RootEmbeddedFileSequence.cc.

References edm::EmbeddedRootSource::bypassVersionCheck(), enablePrefetching_, enforceGUIDInFileName_, 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().

130  {
131  size_t currentIndexIntoFile = sequenceNumberOfFile();
132  return std::make_shared<RootFile>(
133  fileName(),
134  ProcessConfiguration(),
135  logicalFileName(),
136  filePtr,
137  input_.nStreams(),
140  input_.runHelper(),
145  currentIndexIntoFile,
150  }
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 323 of file RootEmbeddedFileSequence.cc.

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

323  {
324  assert(!sameLumiBlock_ || id != nullptr);
325  assert(sequential_ || engine != nullptr);
326  return (this->*fptr_)(cache, fileNameHash, engine, id, recycleFiles);
327  }
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 251 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().

251  {
252  assert(rootFile());
253  assert(engine);
254  unsigned int currentSeqNumber = sequenceNumberOfFile();
255  while(eventsRemainingInFile_ == 0) {
256 
257  unsigned int newSeqNumber = CLHEP::RandFlat::shootInt(engine, fileCatalogItems().size());
258  setAtFileSequenceNumber(newSeqNumber);
259  if(newSeqNumber != currentSeqNumber) {
260  initFile(false);
261  currentSeqNumber = newSeqNumber;
262  }
263  eventsRemainingInFile_ = rootFile()->eventTree().entries();
264  if(eventsRemainingInFile_ == 0) {
265  throw Exception(errors::NotFound) <<
266  "RootEmbeddedFileSequence::readOneRandom(): Secondary Input file " << fileName() << " contains no events.\n";
267  }
268  rootFile()->setAtEventEntry(CLHEP::RandFlat::shootInt(engine, eventsRemainingInFile_) - 1);
269  }
270  rootFile()->nextEventEntry();
271 
272  bool found = rootFile()->readCurrentEvent(cache);
273  if(!found) {
274  rootFile()->setAtEventEntry(0);
275  bool found = rootFile()->readCurrentEvent(cache);
276  assert(found);
277  }
278  fileNameHash = lfnHash();
280  return true;
281  }
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 284 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().

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

169  {
170  assert(rootFile());
171  rootFile()->nextEventEntry();
172  bool found = rootFile()->readCurrentEvent(cache);
173  if(!found) {
174  setAtNextFile();
175  if(noMoreFiles()) {
176  if (recycleFiles) {
177  setAtFirstFile();
178  } else {
179  return false;
180  }
181  }
182  initFile(false);
183  assert(rootFile());
184  rootFile()->setAtEventEntry(IndexIntoFile::invalidEntry);
185  return readOneSequential(cache, fileNameHash, nullptr, nullptr, recycleFiles);
186  }
187  fileNameHash = lfnHash();
188  return true;
189  }
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 192 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().

192  {
193  assert(idp);
194  EventID const& id = *idp;
197  if(offset > 0) {
198  assert(rootFile());
199  while(offset > 0) {
200  bool found = readOneSequentialWithID(cache, fileNameHash, nullptr, idp, recycleFiles);
201  if(!found) {
202  return false;
203  }
204  --offset;
205  }
206  }
207  assert(rootFile());
208  if(noMoreFiles() ||
209  rootFile()->indexIntoFileIter().run() != id.run() ||
210  rootFile()->indexIntoFileIter().lumi() != id.luminosityBlock()) {
211  bool found = skipToItem(id.run(), id.luminosityBlock(), 0, 0, false);
212  if(!found) {
213  return false;
214  }
215  }
216  assert(rootFile());
217  bool found = rootFile()->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock());
218  if(found) {
219  found = rootFile()->readCurrentEvent(cache);
220  }
221  if(!found) {
222  found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0);
223  if(!found) {
224  return false;
225  }
226  return readOneSequentialWithID(cache, fileNameHash, nullptr, idp, recycleFiles);
227  }
228  fileNameHash = lfnHash();
229  return true;
230  }
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 233 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.

233  {
234  EventID const& id = idx.eventID();
235  bool found = skipToItem(id.run(), id.luminosityBlock(), id.event(), idx.fileNameHash());
236  if(!found) {
237  throw Exception(errors::NotFound) <<
238  "RootEmbeddedFileSequence::readOneSpecified(): Secondary Input files" <<
239  " do not contain specified event:\n" << id << "\n";
240  }
241  assert(rootFile());
242  found = rootFile()->readCurrentEvent(cache);
243  assert(found);
244  fileNameHash = idx.fileNameHash();
245  if(fileNameHash == 0U) {
246  fileNameHash = lfnHash();
247  }
248  }
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 153 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().

153  {
154  // offset is decremented by the number of events actually skipped.
155  bool completed = rootFile()->skipEntries(offset);
156  while(!completed) {
157  setAtNextFile();
158  if(noMoreFiles()) {
159  setAtFirstFile();
160  }
161  initFile(false);
162  assert(rootFile());
163  rootFile()->setAtEventEntry(IndexIntoFile::invalidEntry);
164  completed = rootFile()->skipEntries(offset);
165  }
166  }
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().

bool edm::RootEmbeddedFileSequence::enforceGUIDInFileName_
private

Definition at line 68 of file RootEmbeddedFileSequence.h.

Referenced by makeRootFile().

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