19 #include "CLHEP/Random/RandFlat.h" 32 orderedProcessHistoryIDs_(),
33 sequential_(pset.getUntrackedParameter<bool>(
"sequential",
false)),
34 sameLumiBlock_(pset.getUntrackedParameter<bool>(
"sameLumiBlock",
false)),
36 eventsRemainingInFile_(0),
44 initialNumberOfEventsToSkip_(pset.getUntrackedParameter<unsigned
int>(
"skipEvents", 0
U)),
45 treeCacheSize_(pset.getUntrackedParameter<unsigned
int>(
"cacheSize", roottree::
defaultCacheSize)),
46 enablePrefetching_(
false) {
91 std::ifstream
f(
"/dev/urandom");
93 f.read(reinterpret_cast<char*>(&seed),
sizeof(seed));
94 std::default_random_engine dre(seed);
96 std::uniform_int_distribution<int>
distribution(0, count - 1);
131 return std::make_shared<RootFile>(
144 currentIndexIntoFile,
153 bool completed =
rootFile()->skipEntries(offset);
162 completed =
rootFile()->skipEntries(offset);
204 rootFile()->indexIntoFileIter().
lumi() !=
id.luminosityBlock()) {
211 bool found =
rootFile()->setEntryAtNextEventInLumi(
id.
run(),
id.luminosityBlock());
213 found =
rootFile()->readCurrentEvent(cache);
232 "RootEmbeddedFileSequence::readOneSpecified(): Secondary Input files" <<
233 " do not contain specified event:\n" <<
id <<
"\n";
236 found =
rootFile()->readCurrentEvent(cache);
239 if(fileNameHash == 0
U) {
253 if(newSeqNumber != currentSeqNumber) {
255 currentSeqNumber = newSeqNumber;
260 "RootEmbeddedFileSequence::readOneRandom(): Secondary Input file " <<
fileName() <<
" contains no events.\n";
269 bool found =
rootFile()->readCurrentEvent(cache);
284 rootFile()->indexIntoFileIter().
lumi() !=
id.luminosityBlock()) {
289 int eventsInLumi = 0;
291 while(
rootFile()->setEntryAtNextEventInLumi(
id.
run(),
id.luminosityBlock())) ++eventsInLumi;
294 int eventInLumi = CLHEP::RandFlat::shootInt(engine, eventsInLumi);
295 for(
int i = 0;
i < eventInLumi; ++
i) {
296 bool found =
rootFile()->setEntryAtNextEventInLumi(
id.
run(),
id.luminosityBlock());
301 bool found =
rootFile()->setEntryAtNextEventInLumi(
id.
run(),
id.luminosityBlock());
303 found =
rootFile()->readCurrentEvent(cache);
306 bool found =
rootFile()->setEntryAtItem(
id.
run(),
id.luminosityBlock(), 0);
326 ->setComment(
"True: loopEvents() reads events sequentially from beginning of first file.\n" 327 "False: loopEvents() first reads events beginning at random event. New files also chosen randomly");
329 ->setComment(
"True: loopEvents() reads events only in same lumi as the specified event.\n" 330 "False: loopEvents() reads events regardless of lumi.");
332 ->setComment(
"Skip the first 'skipEvents' events. Used only if 'sequential' is True and 'sameLumiBlock' is False");
334 ->setComment(
"Size of ROOT TTree prefetch cache. Affects performance.");
virtual RootFileSharedPtr makeRootFile(std::shared_ptr< InputFile > filePtr) override
void readOneSpecified(EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &id)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
unsigned int nStreams() const
virtual void initFile_(bool skipBadFiles) override
unsigned int const defaultCacheSize
bool bypassVersionCheck() const
EmbeddedRootSource & input_
static std::string const input
bool readOneRandomWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
virtual void closeFile_() override
bool readOneSequential(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *)
virtual ~RootEmbeddedFileSequence()
bool readOneRandom(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *)
RunHelperBase * runHelper()
EventID const & eventID() const
bool readOneEvent(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
bool(RootEmbeddedFileSequence::* fptr_)(EventPrincipal &, size_t &, CLHEP::HepRandomEngine *, EventID 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 readOneSequentialWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
int treeMaxVirtualSize() const
bool skipBadFiles() const
int initialNumberOfEventsToSkip_
static void fillDescription(ParameterSetDescription &desc)
static EntryNumber_t const invalidEntry
size_t fileNameHash() const
ProductSelectorRules const & productSelectorRules() const
void updateFromInput(ProductList const &other)
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
void skipEntries(unsigned int offset)
int eventsRemainingInFile_
unsigned int treeCacheSize_
RootEmbeddedFileSequence(ParameterSet const &pset, EmbeddedRootSource &input, InputFileCatalog const &catalog)