40 int lastDigit = count % 10;
41 if(lastDigit >= 4 || lastDigit == 0)
return th;
43 if(count % 100 - lastDigit == 10)
return th;
44 return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
47 boost::shared_ptr<T> createSharedPtrToStatic(
T* ptr) {
48 return boost::shared_ptr<T>(ptr, do_nothing_deleter());
54 actReg_(desc.actReg_),
55 maxEvents_(desc.maxEvents_),
56 remainingEvents_(maxEvents_),
57 maxLumis_(desc.maxLumis_),
58 remainingLumis_(maxLumis_),
60 processingMode_(RunsLumisAndEvents),
61 moduleDescription_(desc.moduleDescription_),
62 productRegistry_(createSharedPtrToStatic<
ProductRegistry>(desc.productRegistry_)),
64 branchIDListHelper_(desc.branchIDListHelper_),
65 primary_(pset.getParameter<std::
string>(
"@module_label") == std::
string(
"@main_input")),
76 numberOfEventsBeforeBigSkip_(0) {
79 std::ostringstream statusfilename;
80 statusfilename <<
"source_" << getpid();
88 std::string const defaultMode(
"RunsLumisAndEvents");
98 if(processingMode == runMode) {
100 }
else if(processingMode == runLumiMode) {
102 }
else if(processingMode != defaultMode) {
104 <<
"InputSource::InputSource()\n"
105 <<
"The 'processingMode' parameter for sources has an illegal value '" << processingMode <<
"'\n"
106 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" << runMode <<
"'.\n";
135 "'RunsLumisAndEvents': process runs, lumis, and events.\n"
136 "'RunsAndLumis': process runs and lumis (not events).\n"
137 "'Runs': process runs (not lumis or events).");
138 desc.
addUntracked<
bool>(
"writeStatusFile",
false)->setComment(
"Write a status file. Intended for use by workflow management.");
148 unsigned long toSkip =
receiver_->numberToSkip();
171 ItemType itemType = callWithTryCatchAndPrint<ItemType>( [
this](){
return getNextItemType(); },
"Calling InputSource::getNextItemType" );
212 }
else if(newState ==
IsRun || oldState ==
IsFile) {
215 }
else if(newState ==
IsLumi || oldState ==
IsRun) {
231 boost::shared_ptr<LuminosityBlockAuxiliary>
234 "Calling InputSource::readLuminosityBlockAuxiliary_" );
237 boost::shared_ptr<RunAuxiliary>
239 return callWithTryCatchAndPrint<boost::shared_ptr<RunAuxiliary> >( [
this](){
return readRunAuxiliary_(); },
240 "Calling InputSource::readRunAuxiliary_" );
271 std::unique_ptr<FileBlock>
275 return callWithTryCatchAndPrint<std::unique_ptr<FileBlock> >( [
this](){
return readFile_(); },
276 "Calling InputSource::readFile_" );
281 if(fb !=
nullptr) fb->
close();
282 callWithTryCatchAndPrint<void>( [
this](){
closeFile_(); },
283 "Calling InputSource::closeFile_",
284 cleaningUpAfterException );
291 std::unique_ptr<FileBlock>
293 return std::unique_ptr<FileBlock>(
new FileBlock);
299 callWithTryCatchAndPrint<void>( [
this,&
runPrincipal](){
readRun_(runPrincipal); },
"Calling InputSource::readRun_" );
305 callWithTryCatchAndPrint<void>( [
this,&rp](){
readRun_(rp); },
"Calling InputSource::readRun_" );
311 callWithTryCatchAndPrint<void>( [
this,&lumiPrincipal](){
readLuminosityBlock_(lumiPrincipal); },
"Calling InputSource::readLuminosityBlock_" );
320 callWithTryCatchAndPrint<void>( [
this,&lbp](){
readLuminosityBlock_(lbp); },
"Calling InputSource::readLuminosityBlock_" );
347 callWithTryCatchAndPrint<void>( [
this,&ep](){
readEvent_(ep); },
"Calling InputSource::readEvent_" );
368 result =
readIt(eventID, ep, streamContext);
381 callWithTryCatchAndPrint<void>( [
this,&
offset](){
skip(offset); },
"Calling InputSource::skip" );
386 return callWithTryCatchAndPrint<bool>( [
this,&eventID](){
return goToEvent_(eventID); },
"Calling InputSource::goToEvent_" );
396 callWithTryCatchAndPrint<void>( [
this](){
rewind_(); },
"Calling InputSource::rewind_" );
398 unsigned int numberToSkip =
receiver_->numberToSkip();
409 <<
", Event " << eventID.
event()
411 <<
" at " << std::setprecision(3) <<
TimeOfDay();
415 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
425 <<
"InputSource::readIt()\n"
426 <<
"Random access is not implemented for this type of Input Source\n"
427 <<
"Contact a Framework Developer\n";
433 <<
"InputSource::setRun()\n"
434 <<
"Run number cannot be modified for this type of Input Source\n"
435 <<
"Contact a Framework Developer\n";
441 <<
"InputSource::setLumi()\n"
442 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n"
443 <<
"Contact a Framework Developer\n";
449 <<
"InputSource::skip()\n"
450 <<
"Forking and random access are not implemented for this type of Input Source\n"
451 <<
"Contact a Framework Developer\n";
457 <<
"InputSource::goToEvent_()\n"
458 <<
"Random access is not implemented for this type of Input Source\n"
459 <<
"Contact a Framework Developer\n";
466 <<
"InputSource::rewind()\n"
467 <<
"Forking and random access are not implemented for this type of Input Source\n"
468 <<
"Contact a Framework Developer\n";
486 callWithTryCatchAndPrint<void>( [
this,&
run](){
beginRun(run); },
"Calling InputSource::beginRun" );
495 callWithTryCatchAndPrint<void>( [
this,&
run](){
endRun(run); },
"Calling InputSource::endRun", cleaningUpAfterException );
502 callWithTryCatchAndPrint<void>( [
this,&lb](){
beginLuminosityBlock(lb); },
"Calling InputSource::beginLuminosityBlock" );
511 callWithTryCatchAndPrint<void>( [
this,&lb](){
endLuminosityBlock(lb); },
"Calling InputSource::endLuminosityBlock", cleaningUpAfterException );
517 callWithTryCatchAndPrint<void>( [
this](){
preForkReleaseResources(); },
"Calling InputSource::preForkReleaseResources" );
523 "Calling InputSource::postForkReacquireResources" );
528 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
529 "Calling InputSource::randomAccess_" );
534 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
535 "Calling InputSource::forwardState_" );
540 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
541 "Calling InputSource::reverseState__" );
622 source_.actReg()->postSourceSignal_(sc_.streamID());
626 sentry_(source.
actReg()->preSourceLumiSignal_, source.
actReg()->postSourceLumiSignal_) {
630 sentry_(source.
actReg()->preSourceRunSignal_, source.
actReg()->postSourceRunSignal_) {
636 post_(source.
actReg()->postOpenFileSignal_),
638 usedFallback_(usedFallback) {
639 source.
actReg()->preOpenFileSignal_(lfn, usedFallback);
643 post_(lfn_, usedFallback_);
649 post_(source.
actReg()->postCloseFileSignal_),
651 usedFallback_(usedFallback) {
652 source.
actReg()->preCloseFileSignal_(lfn, usedFallback);
656 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)
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()