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 (RunID &run) override
 
void overrideRunNumber (LuminosityBlockID &lumi) 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) {}
RunHelperBase()=default
std::vector< RunNumber_t > setRunNumberForEachLumi_
Definition: RunHelper.h:85

◆ ~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.

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

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  }

◆ 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.

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

162  {
164  }
assert(be >=bs)
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:135

◆ fakeNewRun()

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

Reimplemented from edm::RunHelperBase.

Definition at line 76 of file RunHelper.h.

References fakeNewRun_.

76 { return 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.

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

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  }
unsigned int RunNumber_t
std::vector< RunNumber_t > setRunNumberForEachLumi_
Definition: RunHelper.h:85

◆ overrideRunNumber() [1/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 154 of file RunHelper.cc.

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

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  }
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:135

◆ overrideRunNumber() [2/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 148 of file RunHelper.cc.

References runNumberToUseForThisLumi().

148 { id = RunID(runNumberToUseForThisLumi()); }
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:135

◆ overrideRunNumber() [3/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 150 of file RunHelper.cc.

References runNumberToUseForThisLumi().

150  {
151  id = LuminosityBlockID(runNumberToUseForThisLumi(), id.luminosityBlock());
152  }
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:135

◆ runNumberToUseForThisLumi()

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

Reimplemented from edm::RunHelperBase.

Definition at line 135 of file RunHelper.cc.

References indexOfNextRunNumber_, and setRunNumberForEachLumi_.

Referenced by checkRunConsistency(), and overrideRunNumber().

135  {
137  }
std::vector< RunNumber_t > setRunNumberForEachLumi_
Definition: RunHelper.h:85

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().