37 static std::string
const st(
"st");
38 static std::string
const nd(
"nd");
39 static std::string
const rd(
"rd");
40 static std::string
const th(
"th");
42 int lastDigit = count % 10;
43 if(lastDigit >= 4 || lastDigit == 0)
return th;
45 if(count % 100 - lastDigit == 10)
return th;
46 return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
49 boost::shared_ptr<T> createSharedPtrToStatic(
T* ptr) {
50 return boost::shared_ptr<T>(ptr, do_nothing_deleter());
56 actReg_(desc.actReg_),
57 principalCache_(desc.principalCache_),
58 maxEvents_(desc.maxEvents_),
59 remainingEvents_(maxEvents_),
60 maxLumis_(desc.maxLumis_),
61 remainingLumis_(maxLumis_),
63 processingMode_(RunsLumisAndEvents),
64 moduleDescription_(desc.moduleDescription_),
66 primary_(pset.getParameter<std::string>(
"@module_label") == std::string(
"@main_input")),
69 doneReadAhead_(
false),
76 std::ostringstream statusfilename;
77 statusfilename <<
"source_" << getpid();
85 std::string
const defaultMode(
"RunsLumisAndEvents");
86 std::string
const runMode(
"Runs");
87 std::string
const runLumiMode(
"RunsAndLumis");
95 if(processingMode == runMode) {
97 }
else if(processingMode == runLumiMode) {
99 }
else if(processingMode != defaultMode) {
101 <<
"InputSource::InputSource()\n"
102 <<
"The 'processingMode' parameter for sources has an illegal value '" << processingMode <<
"'\n"
103 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" << runMode <<
"'.\n";
121 static std::string
const kBaseType(
"Source");
130 std::string defaultString(
"RunsLumisAndEvents");
131 desc.
addUntracked<std::string>(
"processingMode", defaultString)->setComment(
132 "'RunsLumisAndEvents': process runs, lumis, and events.\n"
133 "'RunsAndLumis': process runs and lumis (not events).\n"
134 "'Runs': process runs (not lumis or events).");
135 desc.
addUntracked<
bool>(
"writeStatusFile",
false)->setComment(
"Write a status file. Intended for use by workflow management.");
154 ItemType itemType = callWithTryCatchAndPrint<ItemType>( [
this](){
return getNextItemType(); },
"Calling InputSource::getNextItemType" );
157 callWithTryCatchAndPrint<EventPrincipal*>( [
this](){
return readEvent_(); },
158 "Calling InputSource::readEvent_" );
198 }
else if(newState ==
IsRun || oldState ==
IsFile) {
201 }
else if(newState ==
IsLumi || oldState ==
IsRun) {
217 boost::shared_ptr<LuminosityBlockAuxiliary>
220 "Calling InputSource::readLuminosityBlockAuxiliary_" );
223 boost::shared_ptr<RunAuxiliary>
225 return callWithTryCatchAndPrint<boost::shared_ptr<RunAuxiliary> >( [
this](){
return readRunAuxiliary_(); },
226 "Calling InputSource::readRunAuxiliary_" );
247 boost::shared_ptr<FileBlock>
253 boost::shared_ptr<FileBlock>
fb = callWithTryCatchAndPrint<boost::shared_ptr<FileBlock> >( [
this](){
return readFile_(); },
254 "Calling InputSource::readFile_" );
261 callWithTryCatchAndPrint<void>( [
this](){
closeFile_(); },
262 "Calling InputSource::closeFile_",
263 cleaningUpAfterException );
270 boost::shared_ptr<FileBlock>
272 return boost::shared_ptr<FileBlock>(
new FileBlock);
275 boost::shared_ptr<RunPrincipal>
const
280 boost::shared_ptr<LuminosityBlockPrincipal>
const
295 "Calling InputSource::readRun_" );
313 boost::shared_ptr<LuminosityBlockPrincipal> lb(
322 "Calling InputSource::readLuminosityBlock_" );
336 boost::shared_ptr<RunPrincipal>
341 rpCache->fillRunPrincipal();
345 boost::shared_ptr<LuminosityBlockPrincipal>
347 lbCache->fillLuminosityBlockPrincipal();
359 "Calling InputSource::readEvent_" );
363 assert(lbCache->run() == result->
run());
380 result = callWithTryCatchAndPrint<EventPrincipal*>( [
this,&eventID](){
return readIt(eventID); },
381 "Calling InputSource::readIt" );
397 callWithTryCatchAndPrint<void>( [
this,&
offset](){
skip(offset); },
"Calling InputSource::skip" );
403 return callWithTryCatchAndPrint<bool>( [
this,&eventID](){
return goToEvent_(eventID); },
"Calling InputSource::goToEvent_" );
411 callWithTryCatchAndPrint<void>( [
this](){
rewind_(); },
"Calling InputSource::rewind_" );
419 <<
", Event " << eventID.
event()
421 <<
" at " << std::setprecision(3) <<
TimeOfDay();
425 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
435 <<
"InputSource::readIt()\n"
436 <<
"Random access is not implemented for this type of Input Source\n"
437 <<
"Contact a Framework Developer\n";
443 <<
"InputSource::setRun()\n"
444 <<
"Run number cannot be modified for this type of Input Source\n"
445 <<
"Contact a Framework Developer\n";
451 <<
"InputSource::setLumi()\n"
452 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n"
453 <<
"Contact a Framework Developer\n";
459 <<
"InputSource::skip()\n"
460 <<
"Random access is not implemented for this type of Input Source\n"
461 <<
"Contact a Framework Developer\n";
467 <<
"InputSource::goToEvent_()\n"
468 <<
"Random access is not implemented for this type of Input Source\n"
469 <<
"Contact a Framework Developer\n";
476 <<
"InputSource::rewind()\n"
477 <<
"Rewind is not implemented for this type of Input Source\n"
478 <<
"Contact a Framework Developer\n";
497 rng->postEventRead(event);
504 callWithTryCatchAndPrint<void>( [
this,&
run](){
beginRun(run); },
"Calling InputSource::beginRun" );
512 callWithTryCatchAndPrint<void>( [
this,&
run](){
endRun(run); },
"Calling InputSource::endRun", cleaningUpAfterException );
519 callWithTryCatchAndPrint<void>( [
this,&lb](){
beginLuminosityBlock(lb); },
"Calling InputSource::beginLuminosityBlock" );
527 callWithTryCatchAndPrint<void>( [
this,&lb](){
endLuminosityBlock(lb); },
"Calling InputSource::endLuminosityBlock", cleaningUpAfterException );
533 callWithTryCatchAndPrint<void>( [
this](){
preForkReleaseResources(); },
"Calling InputSource::preForkReleaseResources" );
539 "Calling InputSource::postForkReacquireResources" );
544 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
545 "Calling InputSource::randomAccess_" );
550 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
551 "Calling InputSource::forwardState_" );
556 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
557 "Calling InputSource::reverseState__" );
626 sentry_(source.
actReg()->preSourceSignal_, source.
actReg()->postSourceSignal_) {
630 sentry_(source.
actReg()->preSourceLumiSignal_, source.
actReg()->postSourceLumiSignal_) {
634 sentry_(source.
actReg()->preSourceRunSignal_, source.
actReg()->postSourceRunSignal_) {
638 sentry_(source.
actReg()->preOpenFileSignal_, source.
actReg()->postOpenFileSignal_) {
642 sentry_(source.
actReg()->preCloseFileSignal_, source.
actReg()->postCloseFileSignal_) {
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void merge(boost::shared_ptr< RunAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg)
RunSourceSentry(InputSource const &source)
LuminosityBlockPrincipal & lumiPrincipal(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
EventID const & id() const
static ThreadSafeRegistry * instance()
FileCloseSentry(InputSource const &source)
LuminosityBlockNumber_t luminosityBlock() const
void insert(boost::shared_ptr< RunPrincipal > rp)
LuminosityBlockNumber_t luminosityBlock() const
unsigned int LuminosityBlockNumber_t
void setEndTime(Timestamp const &time)
Timestamp const & time() const
TypeLabelList & typeLabelList()
used by the fwk to register the list of products of this module
boost::shared_ptr< RunPrincipal > const & runPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run) const
void addDefault(ParameterSetDescription const &psetDescription)
LuminosityBlockNumber_t luminosityBlock() const
boost::shared_ptr< LuminosityBlockPrincipal > const & lumiPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
void setEndTime(Timestamp const &time)
EventSourceSentry(InputSource const &source)
SourceSentry(Sig &pre, Sig &post)
unsigned int offset(bool)
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 merge(LuminosityBlockRange &lh, LuminosityBlockRange &rh)
static const std::string kBaseType("EDAnalyzer")
author Stefano ARGIRO author Bill Tanenbaum
EventPrincipal & eventPrincipal() const
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, bool iIsListener=false)
LumiSourceSentry(InputSource const &source)
bool luminosityBlockPrincipalPtrValid()
std::string createGlobalIdentifier()
RunPrincipal & runPrincipal(ProcessHistoryID const &phid, RunNumber_t run) const
FileOpenSentry(InputSource const &source)