CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::SetRunHelper Class Reference

#include <RunHelper.h>

Inheritance diagram for edm::SetRunHelper:
edm::RunHelperBase

Public Member Functions

void checkRunConsistency (RunNumber_t run, RunNumber_t origninalRun) const override
 
void overrideRunNumber (EventID &event, bool isRealData) override
 
void overrideRunNumber (LuminosityBlockID &lumi) override
 
void overrideRunNumber (RunID &run) override
 
void setForcedRunOffset (RunNumber_t firstRun) override
 
 SetRunHelper (ParameterSet const &pset)
 
 ~SetRunHelper () override
 
- Public Member Functions inherited from edm::RunHelperBase
virtual void checkForNewRun (RunNumber_t run, LuminosityBlockNumber_t nextLumi)
 
virtual void checkLumiConsistency (LuminosityBlockNumber_t lumi, LuminosityBlockNumber_t origninalLumi) const
 
virtual bool fakeNewRun () const
 
virtual InputSource::ItemType nextItemType (InputSource::ItemType const &previousItemType, InputSource::ItemType const &newItemType, RunNumber_t, LuminosityBlockNumber_t, EventNumber_t)
 
 RunHelperBase ()=default
 
virtual RunNumber_t runNumberToUseForThisLumi () const
 
virtual ~RunHelperBase ()
 

Private Attributes

bool firstTime_
 
int forcedRunOffset_
 
RunNumber_t setRun_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::RunHelperBase
static void fillDescription (ParameterSetDescription &desc)
 

Detailed Description

Definition at line 47 of file RunHelper.h.

Constructor & Destructor Documentation

◆ SetRunHelper()

edm::SetRunHelper::SetRunHelper ( ParameterSet const &  pset)
explicit

Definition at line 45 of file RunHelper.cc.

46  : RunHelperBase(),
47  setRun_(pset.getUntrackedParameter<unsigned int>("setRunNumber")),
49  firstTime_(true) {}

◆ ~SetRunHelper()

edm::SetRunHelper::~SetRunHelper ( )
override

Definition at line 51 of file RunHelper.cc.

51 {}

Member Function Documentation

◆ checkRunConsistency()

void edm::SetRunHelper::checkRunConsistency ( RunNumber_t  run,
RunNumber_t  origninalRun 
) const
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 90 of file RunHelper.cc.

90  {
91  assert(run == originalRun + forcedRunOffset_);
92  }

References cms::cuda::assert(), forcedRunOffset_, and writedatasetfile::run.

◆ overrideRunNumber() [1/3]

void edm::SetRunHelper::overrideRunNumber ( EventID event,
bool  isRealData 
)
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 78 of file RunHelper.cc.

78  {
79  if (isRealData) {
80  throw Exception(errors::Configuration, "SetRunHelper::overrideRunNumber()")
81  << "The 'setRunNumber' parameter of PoolSource cannot be used with real data.\n";
82  }
83  id = EventID(id.run() + forcedRunOffset_, id.luminosityBlock(), id.event());
84  if (RunID(id.run()) < RunID::firstValidRun()) {
85  id = EventID(
87  }
88  }

References edm::errors::Configuration, edmPickEvents::event, Exception, edm::LuminosityBlockID::firstValidLuminosityBlock(), edm::RunID::firstValidRun(), forcedRunOffset_, and writedatasetfile::run.

◆ overrideRunNumber() [2/3]

void edm::SetRunHelper::overrideRunNumber ( LuminosityBlockID lumi)
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 72 of file RunHelper.cc.

72  {
73  id = LuminosityBlockID(id.run() + forcedRunOffset_, id.luminosityBlock());
74  if (RunID(id.run()) < RunID::firstValidRun())
75  id = LuminosityBlockID(RunID::firstValidRun().run(), id.luminosityBlock());
76  }

References edm::RunID::firstValidRun(), forcedRunOffset_, and writedatasetfile::run.

◆ overrideRunNumber() [3/3]

void edm::SetRunHelper::overrideRunNumber ( RunID run)
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 66 of file RunHelper.cc.

66  {
67  id = RunID(id.run() + forcedRunOffset_);
68  if (id < RunID::firstValidRun())
69  id = RunID::firstValidRun();
70  }

References edm::RunID::firstValidRun(), forcedRunOffset_, and writedatasetfile::run.

◆ setForcedRunOffset()

void edm::SetRunHelper::setForcedRunOffset ( RunNumber_t  firstRun)
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 53 of file RunHelper.cc.

53  {
54  if (firstTime_ && setRun_ != 0) {
56  if (forcedRunOffset_ < 0) {
58  << "The value of the 'setRunNumber' parameter must not be\n"
59  << "less than the first run number in the first input file.\n"
60  << "'setRunNumber' was " << setRun_ << ", while the first run was " << firstRun << ".\n";
61  }
62  }
63  firstTime_ = false;
64  }

References edm::errors::Configuration, Exception, dataset::firstRun, firstTime_, forcedRunOffset_, and setRun_.

Member Data Documentation

◆ firstTime_

bool edm::SetRunHelper::firstTime_
private

Definition at line 62 of file RunHelper.h.

Referenced by setForcedRunOffset().

◆ forcedRunOffset_

int edm::SetRunHelper::forcedRunOffset_
private

Definition at line 61 of file RunHelper.h.

Referenced by checkRunConsistency(), overrideRunNumber(), and setForcedRunOffset().

◆ setRun_

RunNumber_t edm::SetRunHelper::setRun_
private

Definition at line 60 of file RunHelper.h.

Referenced by setForcedRunOffset().

dataset.firstRun
firstRun
Definition: dataset.py:940
edm::SetRunHelper::firstTime_
bool firstTime_
Definition: RunHelper.h:62
cms::cuda::assert
assert(be >=bs)
edm::SetRunHelper::forcedRunOffset_
int forcedRunOffset_
Definition: RunHelper.h:61
edm::RunID::firstValidRun
static RunID firstValidRun()
Definition: RunID.h:58
edm::RunHelperBase::RunHelperBase
RunHelperBase()=default
edmPickEvents.event
event
Definition: edmPickEvents.py:273
edm::SetRunHelper::setRun_
RunNumber_t setRun_
Definition: RunHelper.h:60
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:245
edm::LuminosityBlockID::firstValidLuminosityBlock
static LuminosityBlockID firstValidLuminosityBlock()
Definition: LuminosityBlockID.h:86
edm::errors::Configuration
Definition: EDMException.h:36
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27