19 #include "CLHEP/Random/RandFlat.h"
31 orderedProcessHistoryIDs_(),
32 sequential_(pset.getUntrackedParameter<bool>(
"sequential",
false)),
33 sameLumiBlock_(pset.getUntrackedParameter<bool>(
"sameLumiBlock",
false)),
35 eventsRemainingInFile_(0),
43 initialNumberOfEventsToSkip_(pset.getUntrackedParameter<unsigned int>(
"skipEvents", 0U)),
44 enablePrefetching_(
false),
45 enforceGUIDInFileName_(pset.getUntrackedParameter<bool>(
"enforceGUIDInFileName",
false)) {
86 std::ifstream
f(
"/dev/urandom");
88 f.read(reinterpret_cast<char*>(&seed),
sizeof(seed));
89 std::default_random_engine dre(seed);
91 std::uniform_int_distribution<int> distribution(0, count - 1);
94 int offset = distribution(dre);
120 std::shared_ptr<InputFile> filePtr) {
122 return std::make_shared<RootFile>(
fileName(),
133 currentIndexIntoFile,
142 bool completed =
rootFile()->skipEntries(offset);
151 completed =
rootFile()->skipEntries(offset);
192 rootFile()->indexIntoFileIter().
lumi() !=
id.luminosityBlock()) {
199 bool found =
rootFile()->setEntryAtNextEventInLumi(
id.
run(),
id.luminosityBlock());
201 found =
rootFile()->readCurrentEvent(cache);
215 size_t& fileNameHash,
221 <<
" do not contain specified event:\n"
225 found =
rootFile()->readCurrentEvent(cache);
228 if (fileNameHash == 0U) {
241 if (newSeqNumber != currentSeqNumber) {
243 currentSeqNumber = newSeqNumber;
248 <<
fileName() <<
" contains no events.\n";
257 bool found =
rootFile()->readCurrentEvent(cache);
271 rootFile()->indexIntoFileIter().
lumi() !=
id.luminosityBlock()) {
276 int eventsInLumi = 0;
278 while (
rootFile()->setEntryAtNextEventInLumi(
id.
run(),
id.luminosityBlock()))
282 int eventInLumi = CLHEP::RandFlat::shootInt(engine, eventsInLumi);
283 for (
int i = 0;
i < eventInLumi; ++
i) {
284 bool found =
rootFile()->setEntryAtNextEventInLumi(
id.
run(),
id.luminosityBlock());
289 bool found =
rootFile()->setEntryAtNextEventInLumi(
id.
run(),
id.luminosityBlock());
291 found =
rootFile()->readCurrentEvent(cache);
294 bool found =
rootFile()->setEntryAtItem(
id.
run(),
id.luminosityBlock(), 0);
308 return (this->*
fptr_)(cache, fileNameHash, engine, id);
314 "True: loopEvents() reads events sequentially from beginning of first file.\n"
315 "False: loopEvents() first reads events beginning at random event. New files also chosen randomly");
318 "True: loopEvents() reads events only in same lumi as the specified event.\n"
319 "False: loopEvents() reads events regardless of lumi.");
322 "Skip the first 'skipEvents' events. Used only if 'sequential' is True and 'sameLumiBlock' is False");
325 "True: file name part is required to be equal to the GUID of the file\n"
326 "False: file name can be anything");
bool(RootEmbeddedFileSequence::* fptr_)(EventPrincipal &, size_t &, CLHEP::HepRandomEngine *, EventID const *)
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
bool bypassVersionCheck() const
EmbeddedRootSource & input_
static std::string const input
bool readOneRandomWithID(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
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 *)
bool enforceGUIDInFileName_
RunHelperBase * runHelper()
EventID const & eventID() const
bool readOneEvent(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)
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
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
size_t fileNameHash() const
ProductSelectorRules const & productSelectorRules() const
void updateFromInput(ProductList const &other)
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
void skipEntries(unsigned int offset)
volatile std::atomic< bool > shutdown_flag false
int eventsRemainingInFile_
tuple size
Write out results.
RootEmbeddedFileSequence(ParameterSet const &pset, EmbeddedRootSource &input, InputFileCatalog const &catalog)