CMS 3D CMS Logo

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

#include <RunHelper.h>

Inheritance diagram for edm::SetRunForEachLumiHelper:
edm::RunHelperBase

Public Member Functions

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

Private Attributes

bool fakeNewRun_
 
bool firstTime_
 
size_t indexOfNextRunNumber_
 
RunNumber_t realRunNumber_
 
std::vector< RunNumber_tsetRunNumberForEachLumi_
 

Additional Inherited Members

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

Detailed Description

Definition at line 65 of file RunHelper.h.

Constructor & Destructor Documentation

◆ SetRunForEachLumiHelper()

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

Definition at line 94 of file RunHelper.cc.

95  : RunHelperBase(),
96  setRunNumberForEachLumi_(pset.getUntrackedParameter<std::vector<unsigned int>>("setRunNumberForEachLumi")),
98  realRunNumber_(0),
99  fakeNewRun_(false),
100  firstTime_(true) {}

◆ ~SetRunForEachLumiHelper()

edm::SetRunForEachLumiHelper::~SetRunForEachLumiHelper ( )
override

Definition at line 102 of file RunHelper.cc.

102 {}

Member Function Documentation

◆ checkForNewRun()

void edm::SetRunForEachLumiHelper::checkForNewRun ( RunNumber_t  run,
LuminosityBlockNumber_t  nextLumi 
)
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 139 of file RunHelper.cc.

139  {
140  if (realRunNumber_ != 0 && run != realRunNumber_) {
141  throw Exception(errors::MismatchedInputFiles, "PoolSource::checkForNewRun")
142  << " Parameter 'setRunNumberForEachLumi' can only process a single run.\n"
143  << "but this job is processing more than one run.\n";
144  }
146  }

References Exception, edm::errors::MismatchedInputFiles, realRunNumber_, and writedatasetfile::run.

◆ checkRunConsistency()

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

Reimplemented from edm::RunHelperBase.

Definition at line 162 of file RunHelper.cc.

162  {
164  }

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

◆ fakeNewRun()

bool edm::SetRunForEachLumiHelper::fakeNewRun ( ) const
inlineoverridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 76 of file RunHelper.h.

76 { return fakeNewRun_; }

References fakeNewRun_.

◆ nextItemType()

InputSource::ItemType edm::SetRunForEachLumiHelper::nextItemType ( InputSource::ItemType const &  previousItemType,
InputSource::ItemType const &  newIemType,
RunNumber_t  ,
LuminosityBlockNumber_t  ,
EventNumber_t   
)
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 104 of file RunHelper.cc.

108  {
109  if (newItemType == InputSource::IsRun ||
110  (newItemType == InputSource::IsLumi && previousItemType != InputSource::IsRun)) {
111  if (firstTime_) {
112  firstTime_ = false;
113  } else {
115  }
117  throw Exception(errors::MismatchedInputFiles, "PoolSource::getNextItemType")
118  << " Parameter 'setRunNumberForEachLumi' has " << setRunNumberForEachLumi_.size() << " entries\n"
119  << "but this job is processing more luminosity blocks than this.\n";
120  }
122  if (run == 0) {
123  throw Exception(errors::Configuration, "PoolSource")
124  << "'setRunNumberForEachLumi' contains an illegal run number of '0'.\n";
125  }
126  bool sameRunNumber = (indexOfNextRunNumber_ != 0U && run == setRunNumberForEachLumi_[indexOfNextRunNumber_ - 1]);
127  if (!sameRunNumber) {
128  fakeNewRun_ = (newItemType != InputSource::IsRun);
129  return InputSource::IsRun;
130  }
131  }
132  return newItemType;
133  }

References edm::errors::Configuration, Exception, fakeNewRun_, firstTime_, indexOfNextRunNumber_, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::errors::MismatchedInputFiles, writedatasetfile::run, setRunNumberForEachLumi_, and mitigatedMETSequence_cff::U.

◆ overrideRunNumber() [1/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 154 of file RunHelper.cc.

154  {
155  if (isRealData) {
156  throw Exception(errors::Configuration, "SetRunForEachLumiHelper::overrideRunNumber()")
157  << "The 'setRunNumberForEachLumi' parameter of PoolSource cannot be used with real data.\n";
158  }
159  id = EventID(runNumberToUseForThisLumi(), id.luminosityBlock(), id.event());
160  }

References edm::errors::Configuration, edmPickEvents::event, Exception, and runNumberToUseForThisLumi().

◆ overrideRunNumber() [2/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 150 of file RunHelper.cc.

150  {
151  id = LuminosityBlockID(runNumberToUseForThisLumi(), id.luminosityBlock());
152  }

References runNumberToUseForThisLumi().

◆ overrideRunNumber() [3/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 148 of file RunHelper.cc.

148 { id = RunID(runNumberToUseForThisLumi()); }

References runNumberToUseForThisLumi().

◆ runNumberToUseForThisLumi()

RunNumber_t edm::SetRunForEachLumiHelper::runNumberToUseForThisLumi ( ) const
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 135 of file RunHelper.cc.

135  {
137  }

References indexOfNextRunNumber_, and setRunNumberForEachLumi_.

Referenced by checkRunConsistency(), and overrideRunNumber().

Member Data Documentation

◆ fakeNewRun_

bool edm::SetRunForEachLumiHelper::fakeNewRun_
private

Definition at line 88 of file RunHelper.h.

Referenced by fakeNewRun(), and nextItemType().

◆ firstTime_

bool edm::SetRunForEachLumiHelper::firstTime_
private

Definition at line 89 of file RunHelper.h.

Referenced by nextItemType().

◆ indexOfNextRunNumber_

size_t edm::SetRunForEachLumiHelper::indexOfNextRunNumber_
private

Definition at line 86 of file RunHelper.h.

Referenced by nextItemType(), and runNumberToUseForThisLumi().

◆ realRunNumber_

RunNumber_t edm::SetRunForEachLumiHelper::realRunNumber_
private

Definition at line 87 of file RunHelper.h.

Referenced by checkForNewRun().

◆ setRunNumberForEachLumi_

std::vector<RunNumber_t> edm::SetRunForEachLumiHelper::setRunNumberForEachLumi_
private

Definition at line 85 of file RunHelper.h.

Referenced by nextItemType(), and runNumberToUseForThisLumi().

edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
edm::errors::MismatchedInputFiles
Definition: EDMException.h:52
cms::cuda::assert
assert(be >=bs)
edm::SetRunForEachLumiHelper::fakeNewRun_
bool fakeNewRun_
Definition: RunHelper.h:88
edm::InputSource::IsRun
Definition: InputSource.h:54
edm::SetRunForEachLumiHelper::setRunNumberForEachLumi_
std::vector< RunNumber_t > setRunNumberForEachLumi_
Definition: RunHelper.h:85
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::RunHelperBase::RunHelperBase
RunHelperBase()=default
edm::InputSource::IsLumi
Definition: InputSource.h:54
edmPickEvents.event
event
Definition: edmPickEvents.py:273
edm::SetRunForEachLumiHelper::indexOfNextRunNumber_
size_t indexOfNextRunNumber_
Definition: RunHelper.h:86
edm::SetRunForEachLumiHelper::runNumberToUseForThisLumi
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:135
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:245
edm::SetRunForEachLumiHelper::realRunNumber_
RunNumber_t realRunNumber_
Definition: RunHelper.h:87
edm::SetRunForEachLumiHelper::firstTime_
bool firstTime_
Definition: RunHelper.h:89
edm::errors::Configuration
Definition: EDMException.h:36
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27