38 int lastDigit = count % 10;
39 if(lastDigit >= 4 || lastDigit == 0)
return th;
41 if(count % 100 - lastDigit == 10)
return th;
42 return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
48 actReg_(desc.actReg_),
49 maxEvents_(desc.maxEvents_),
50 remainingEvents_(maxEvents_),
51 maxLumis_(desc.maxLumis_),
52 remainingLumis_(maxLumis_),
54 maxSecondsUntilRampdown_(desc.maxSecondsUntilRampdown_),
55 processingMode_(RunsLumisAndEvents),
56 moduleDescription_(desc.moduleDescription_),
57 productRegistry_(desc.productRegistry_),
59 branchIDListHelper_(desc.branchIDListHelper_),
60 thinnedAssociationsHelper_(desc.thinnedAssociationsHelper_),
70 numberOfEventsBeforeBigSkip_(0) {
73 std::ostringstream statusfilename;
74 statusfilename <<
"source_" << getpid();
81 std::string const defaultMode(
"RunsLumisAndEvents");
91 if(processingMode == runMode) {
93 }
else if(processingMode == runLumiMode) {
95 }
else if(processingMode != defaultMode) {
97 <<
"InputSource::InputSource()\n" 98 <<
"The 'processingMode' parameter for sources has an illegal value '" << processingMode <<
"'\n" 99 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" << runMode <<
"'.\n";
128 "'RunsLumisAndEvents': process runs, lumis, and events.\n" 129 "'RunsAndLumis': process runs and lumis (not events).\n" 130 "'Runs': process runs (not lumis or events).");
131 desc.
addUntracked<
bool>(
"writeStatusFile",
false)->setComment(
"Write a status file. Intended for use by workflow management.");
144 ItemType itemType = callWithTryCatchAndPrint<ItemType>( [
this](){
return getNextItemType(); },
"Calling InputSource::getNextItemType" );
185 }
else if(newState ==
IsRun || oldState ==
IsFile) {
188 }
else if(newState ==
IsLumi || oldState ==
IsRun) {
204 std::shared_ptr<LuminosityBlockAuxiliary>
207 "Calling InputSource::readLuminosityBlockAuxiliary_" );
210 std::shared_ptr<RunAuxiliary>
212 return callWithTryCatchAndPrint<std::shared_ptr<RunAuxiliary> >( [
this](){
return readRunAuxiliary_(); },
213 "Calling InputSource::readRunAuxiliary_" );
226 std::pair<SharedResourcesAcquirer*,std::recursive_mutex*>
231 std::pair<SharedResourcesAcquirer*,std::recursive_mutex*>
233 return std::pair<SharedResourcesAcquirer*,std::recursive_mutex*>(
nullptr,
nullptr);
244 std::unique_ptr<FileBlock>
248 return callWithTryCatchAndPrint<std::unique_ptr<FileBlock> >( [
this](){
return readFile_(); },
249 "Calling InputSource::readFile_" );
254 if(fb !=
nullptr) fb->
close();
255 callWithTryCatchAndPrint<void>( [
this](){
closeFile_(); },
256 "Calling InputSource::closeFile_",
257 cleaningUpAfterException );
264 std::unique_ptr<FileBlock>
266 return std::make_unique<FileBlock>();
272 callWithTryCatchAndPrint<void>( [
this,&runPrincipal](){
readRun_(runPrincipal); },
"Calling InputSource::readRun_" );
278 callWithTryCatchAndPrint<void>( [
this,&rp](){
readRun_(rp); },
"Calling InputSource::readRun_" );
284 callWithTryCatchAndPrint<void>( [
this,&lumiPrincipal](){
readLuminosityBlock_(lumiPrincipal); },
"Calling InputSource::readLuminosityBlock_" );
293 callWithTryCatchAndPrint<void>( [
this,&lbp](){
readLuminosityBlock_(lbp); },
"Calling InputSource::readLuminosityBlock_" );
320 callWithTryCatchAndPrint<void>( [
this,&ep](){
readEvent_(ep); },
"Calling InputSource::readEvent_" );
338 result =
readIt(eventID, ep, streamContext);
351 callWithTryCatchAndPrint<void>( [
this,&
offset](){
skip(offset); },
"Calling InputSource::skip" );
356 return callWithTryCatchAndPrint<bool>( [
this,&eventID](){
return goToEvent_(eventID); },
"Calling InputSource::goToEvent_" );
366 callWithTryCatchAndPrint<void>( [
this](){
rewind_(); },
"Calling InputSource::rewind_" );
374 <<
", Event " << eventID.
event()
376 <<
" at " << std::setprecision(3) <<
TimeOfDay();
380 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
390 <<
"InputSource::readIt()\n" 391 <<
"Random access is not implemented for this type of Input Source\n" 392 <<
"Contact a Framework Developer\n";
398 <<
"InputSource::setRun()\n" 399 <<
"Run number cannot be modified for this type of Input Source\n" 400 <<
"Contact a Framework Developer\n";
406 <<
"InputSource::setLumi()\n" 407 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n" 408 <<
"Contact a Framework Developer\n";
414 <<
"InputSource::skip()\n" 415 <<
"Random access are not implemented for this type of Input Source\n" 416 <<
"Contact a Framework Developer\n";
422 <<
"InputSource::goToEvent_()\n" 423 <<
"Random access is not implemented for this type of Input Source\n" 424 <<
"Contact a Framework Developer\n";
431 <<
"InputSource::rewind()\n" 432 <<
"Random access are not implemented for this type of Input Source\n" 433 <<
"Contact a Framework Developer\n";
451 callWithTryCatchAndPrint<void>( [
this,&
run](){
beginRun(run); },
"Calling InputSource::beginRun" );
452 run.
commit_(std::vector<edm::ProductResolverIndex>());
458 callWithTryCatchAndPrint<void>( [
this,&
run](){
endRun(run); },
"Calling InputSource::endRun", cleaningUpAfterException );
459 run.
commit_(std::vector<edm::ProductResolverIndex>());
465 callWithTryCatchAndPrint<void>( [
this,&lb](){
beginLuminosityBlock(lb); },
"Calling InputSource::beginLuminosityBlock" );
466 lb.
commit_(std::vector<edm::ProductResolverIndex>());
472 callWithTryCatchAndPrint<void>( [
this,&lb](){
endLuminosityBlock(lb); },
"Calling InputSource::endLuminosityBlock", cleaningUpAfterException );
473 lb.
commit_(std::vector<edm::ProductResolverIndex>());
478 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
479 "Calling InputSource::randomAccess_" );
484 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
485 "Calling InputSource::forwardState_" );
490 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
491 "Calling InputSource::reverseState__" );
565 sentry_(source.
actReg()->preSourceLumiSignal_, source.
actReg()->postSourceLumiSignal_) {
575 post_(source.
actReg()->postOpenFileSignal_),
577 usedFallback_(usedFallback) {
578 source.
actReg()->preOpenFileSignal_(lfn, usedFallback);
591 source.
actReg()->preCloseFileSignal_(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)
RunSourceSentry(InputSource const &source)
EventID const & id() const
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
LuminosityBlockNumber_t luminosityBlock() const
unsigned int LuminosityBlockNumber_t
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 commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
SourceSentry(Sig &pre, Sig &post)
InputSource const & source_
StreamID const & streamID() const
static const std::string kBaseType("EDAnalyzer")
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)
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
std::string createGlobalIdentifier()