43 int lastDigit = count % 10;
44 if(lastDigit >= 4 || lastDigit == 0)
return th;
46 if(count % 100 - lastDigit == 10)
return th;
47 return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
50 boost::shared_ptr<T> createSharedPtrToStatic(
T* ptr) {
51 return boost::shared_ptr<T>(ptr, do_nothing_deleter());
57 actReg_(desc.actReg_),
58 maxEvents_(desc.maxEvents_),
59 remainingEvents_(maxEvents_),
60 maxLumis_(desc.maxLumis_),
61 remainingLumis_(maxLumis_),
63 processingMode_(RunsLumisAndEvents),
64 moduleDescription_(desc.moduleDescription_),
65 productRegistry_(createSharedPtrToStatic<
ProductRegistry>(desc.productRegistry_)),
67 branchIDListHelper_(desc.branchIDListHelper_),
68 primary_(pset.getParameter<std::
string>(
"@module_label") == std::
string(
"@main_input")),
79 numberOfEventsBeforeBigSkip_(0) {
82 std::ostringstream statusfilename;
83 statusfilename <<
"source_" << getpid();
91 std::string const defaultMode(
"RunsLumisAndEvents");
101 if(processingMode == runMode) {
103 }
else if(processingMode == runLumiMode) {
105 }
else if(processingMode != defaultMode) {
107 <<
"InputSource::InputSource()\n"
108 <<
"The 'processingMode' parameter for sources has an illegal value '" << processingMode <<
"'\n"
109 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" << runMode <<
"'.\n";
138 "'RunsLumisAndEvents': process runs, lumis, and events.\n"
139 "'RunsAndLumis': process runs and lumis (not events).\n"
140 "'Runs': process runs (not lumis or events).");
141 desc.
addUntracked<
bool>(
"writeStatusFile",
false)->setComment(
"Write a status file. Intended for use by workflow management.");
151 unsigned long toSkip =
receiver_->numberToSkip();
174 ItemType itemType = callWithTryCatchAndPrint<ItemType>( [
this](){
return getNextItemType(); },
"Calling InputSource::getNextItemType" );
215 }
else if(newState ==
IsRun || oldState ==
IsFile) {
218 }
else if(newState ==
IsLumi || oldState ==
IsRun) {
234 boost::shared_ptr<LuminosityBlockAuxiliary>
237 "Calling InputSource::readLuminosityBlockAuxiliary_" );
240 boost::shared_ptr<RunAuxiliary>
242 return callWithTryCatchAndPrint<boost::shared_ptr<RunAuxiliary> >( [
this](){
return readRunAuxiliary_(); },
243 "Calling InputSource::readRunAuxiliary_" );
264 std::unique_ptr<FileBlock>
268 return callWithTryCatchAndPrint<std::unique_ptr<FileBlock> >( [
this](){
return readFile_(); },
269 "Calling InputSource::readFile_" );
274 if(fb !=
nullptr) fb->
close();
275 callWithTryCatchAndPrint<void>( [
this](){
closeFile_(); },
276 "Calling InputSource::closeFile_",
277 cleaningUpAfterException );
284 std::unique_ptr<FileBlock>
286 return std::unique_ptr<FileBlock>(
new FileBlock);
292 callWithTryCatchAndPrint<void>( [
this,&
runPrincipal](){
readRun_(runPrincipal); },
"Calling InputSource::readRun_" );
298 callWithTryCatchAndPrint<void>( [
this,&rp](){
readRun_(rp); },
"Calling InputSource::readRun_" );
304 callWithTryCatchAndPrint<void>( [
this,&lumiPrincipal](){
readLuminosityBlock_(lumiPrincipal); },
"Calling InputSource::readLuminosityBlock_" );
313 callWithTryCatchAndPrint<void>( [
this,&lbp](){
readLuminosityBlock_(lbp); },
"Calling InputSource::readLuminosityBlock_" );
340 callWithTryCatchAndPrint<void>( [
this,&ep](){
readEvent_(ep); },
"Calling InputSource::readEvent_" );
363 result =
readIt(eventID, ep, streamContext);
378 callWithTryCatchAndPrint<void>( [
this,&
offset](){
skip(offset); },
"Calling InputSource::skip" );
383 return callWithTryCatchAndPrint<bool>( [
this,&eventID](){
return goToEvent_(eventID); },
"Calling InputSource::goToEvent_" );
393 callWithTryCatchAndPrint<void>( [
this](){
rewind_(); },
"Calling InputSource::rewind_" );
395 unsigned int numberToSkip =
receiver_->numberToSkip();
406 <<
", Event " << eventID.
event()
408 <<
" at " << std::setprecision(3) <<
TimeOfDay();
412 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
422 <<
"InputSource::readIt()\n"
423 <<
"Random access is not implemented for this type of Input Source\n"
424 <<
"Contact a Framework Developer\n";
430 <<
"InputSource::setRun()\n"
431 <<
"Run number cannot be modified for this type of Input Source\n"
432 <<
"Contact a Framework Developer\n";
438 <<
"InputSource::setLumi()\n"
439 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n"
440 <<
"Contact a Framework Developer\n";
446 <<
"InputSource::skip()\n"
447 <<
"Forking and random access are not implemented for this type of Input Source\n"
448 <<
"Contact a Framework Developer\n";
454 <<
"InputSource::goToEvent_()\n"
455 <<
"Random access is not implemented for this type of Input Source\n"
456 <<
"Contact a Framework Developer\n";
463 <<
"InputSource::rewind()\n"
464 <<
"Forking and random access are not implemented for this type of Input Source\n"
465 <<
"Contact a Framework Developer\n";
484 rng->postEventRead(event);
491 callWithTryCatchAndPrint<void>( [
this,&
run](){
beginRun(run); },
"Calling InputSource::beginRun" );
500 callWithTryCatchAndPrint<void>( [
this,&
run](){
endRun(run); },
"Calling InputSource::endRun", cleaningUpAfterException );
507 callWithTryCatchAndPrint<void>( [
this,&lb](){
beginLuminosityBlock(lb); },
"Calling InputSource::beginLuminosityBlock" );
516 callWithTryCatchAndPrint<void>( [
this,&lb](){
endLuminosityBlock(lb); },
"Calling InputSource::endLuminosityBlock", cleaningUpAfterException );
522 callWithTryCatchAndPrint<void>( [
this](){
preForkReleaseResources(); },
"Calling InputSource::preForkReleaseResources" );
528 "Calling InputSource::postForkReacquireResources" );
533 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
534 "Calling InputSource::randomAccess_" );
539 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
540 "Calling InputSource::forwardState_" );
545 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
546 "Calling InputSource::reverseState__" );
627 source_.actReg()->postSourceSignal_(sc_.streamID());
631 sentry_(source.
actReg()->preSourceLumiSignal_, source.
actReg()->postSourceLumiSignal_) {
635 sentry_(source.
actReg()->preSourceRunSignal_, source.
actReg()->postSourceRunSignal_) {
641 post_(source.
actReg()->postOpenFileSignal_),
643 usedFallback_(usedFallback) {
644 source.
actReg()->preOpenFileSignal_(lfn, usedFallback);
648 post_(lfn_, usedFallback_);
654 post_(source.
actReg()->postCloseFileSignal_),
656 usedFallback_(usedFallback) {
657 source.
actReg()->preCloseFileSignal_(lfn, usedFallback);
661 post_(lfn_, usedFallback_);
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
static std::string const source("source")
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
RunSourceSentry(InputSource const &source)
EventID const & id() const
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
LuminosityBlockNumber_t luminosityBlock() const
unsigned int LuminosityBlockNumber_t
void setEndTime(Timestamp const &time)
Timestamp const & time() const
FileCloseSentry(InputSource const &source, std::string const &lfn, bool usedFallback)
TypeLabelList & typeLabelList()
used by the fwk to register the list of products of this module
EventSourceSentry(InputSource const &source, StreamContext &sc)
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void addDefault(ParameterSetDescription const &psetDescription)
void setEndTime(Timestamp const &time)
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
StreamID const & streamID() const
static const std::string kBaseType("EDAnalyzer")
volatile std::atomic< bool > shutdown_flag false
FileOpenSentry(InputSource const &source, std::string const &lfn, bool usedFallback)
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)
std::string createGlobalIdentifier()