CMS 3D CMS Logo

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

#include <RunHelper.h>

Inheritance diagram for edm::FirstLuminosityBlockForEachRunHelper:
edm::RunHelperBase

Public Member Functions

void checkForNewRun (RunNumber_t run, LuminosityBlockNumber_t nextLumi) override
 
void checkRunConsistency (RunNumber_t run, RunNumber_t originalRun) const override
 
bool fakeNewRun () const override
 
 FirstLuminosityBlockForEachRunHelper (ParameterSet const &pset)
 
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
 
- 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 Member Functions

RunNumber_t findRunFromLumi (LuminosityBlockNumber_t) const
 

Private Attributes

bool fakeNewRun_
 
RunNumber_t lastUsedRunNumber_
 
std::vector< edm::LuminosityBlockID > const lumiToRun_
 
RunNumber_t realRunNumber_
 

Additional Inherited Members

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

Detailed Description

Definition at line 92 of file RunHelper.h.

Constructor & Destructor Documentation

◆ FirstLuminosityBlockForEachRunHelper()

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

Definition at line 166 of file RunHelper.cc.

167  : lumiToRun_(pset.getUntrackedParameter<std::vector<edm::LuminosityBlockID>>("firstLuminosityBlockForEachRun")),
168  realRunNumber_{0},
170  fakeNewRun_{false} {}
std::vector< edm::LuminosityBlockID > const lumiToRun_
Definition: RunHelper.h:112

Member Function Documentation

◆ checkForNewRun()

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

Reimplemented from edm::RunHelperBase.

Definition at line 194 of file RunHelper.cc.

References Exception, fakeNewRun_, findRunFromLumi(), lastUsedRunNumber_, edm::errors::MismatchedInputFiles, realRunNumber_, and writedatasetfile::run.

194  {
195  if (realRunNumber_ != 0 && run != realRunNumber_) {
196  throw Exception(errors::MismatchedInputFiles, "PoolSource::checkForNewRun")
197  << " Parameter 'firstLuminosityBlockForEachRun' can only process a single run.\n"
198  << "but this job is processing more than one run.\n";
199  }
202  fakeNewRun_ = false;
203  }
RunNumber_t findRunFromLumi(LuminosityBlockNumber_t) const
Definition: RunHelper.cc:223

◆ checkRunConsistency()

void edm::FirstLuminosityBlockForEachRunHelper::checkRunConsistency ( RunNumber_t  run,
RunNumber_t  originalRun 
) const
overridevirtual

Reimplemented from edm::RunHelperBase.

Definition at line 219 of file RunHelper.cc.

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

219  {
221  }
assert(be >=bs)
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:192

◆ fakeNewRun()

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

Reimplemented from edm::RunHelperBase.

Definition at line 102 of file RunHelper.h.

References fakeNewRun_.

◆ findRunFromLumi()

RunNumber_t edm::FirstLuminosityBlockForEachRunHelper::findRunFromLumi ( LuminosityBlockNumber_t  iLumi) const
private

Definition at line 223 of file RunHelper.cc.

References edm::errors::Configuration, Exception, lumiToRun_, and writedatasetfile::run.

Referenced by checkForNewRun(), and nextItemType().

223  {
224  RunNumber_t run = 0;
225  for (auto const& lumiID : lumiToRun_) {
226  if (lumiID.luminosityBlock() > iLumi) {
227  break;
228  }
229  run = lumiID.run();
230  }
231  if (0 == run) {
232  throw Exception(errors::Configuration, "FirstLuminosityBlockForEachRunHelper::findRunFromLumi()")
233  << "The 'firstLuminosityBlockForEachRun' parameter does not have a matching Run number for LuminosityBlock "
234  "number: "
235  << iLumi << ".\n";
236  }
237  return run;
238  }
std::vector< edm::LuminosityBlockID > const lumiToRun_
Definition: RunHelper.h:112
unsigned int RunNumber_t

◆ nextItemType()

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

Reimplemented from edm::RunHelperBase.

Definition at line 172 of file RunHelper.cc.

References edm::errors::Configuration, Exception, fakeNewRun_, findRunFromLumi(), edm::InputSource::IsLumi, edm::InputSource::IsRun, lastUsedRunNumber_, and writedatasetfile::run.

176  {
177  if (newItemType == InputSource::IsLumi && previousItemType != InputSource::IsRun) {
178  auto run = findRunFromLumi(iLumi);
179  if (run == 0) {
180  throw Exception(errors::Configuration, "PoolSource")
181  << "'firstLuminosityBlockForEachRun' contains an illegal run number of '0'.\n";
182  }
183  if (lastUsedRunNumber_ != run) {
184  fakeNewRun_ = true;
186  return InputSource::IsRun;
187  }
188  }
189  return newItemType;
190  }
RunNumber_t findRunFromLumi(LuminosityBlockNumber_t) const
Definition: RunHelper.cc:223

◆ overrideRunNumber() [1/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 211 of file RunHelper.cc.

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

211  {
212  if (isRealData) {
213  throw Exception(errors::Configuration, "FirstLuminosityBlockForEachRunHelper::overrideRunNumber()")
214  << "The 'firstLuminosityBlockForEachRun' parameter of PoolSource cannot be used with real data.\n";
215  }
216  id = EventID(runNumberToUseForThisLumi(), id.luminosityBlock(), id.event());
217  }
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:192

◆ overrideRunNumber() [2/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 205 of file RunHelper.cc.

References runNumberToUseForThisLumi().

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

◆ overrideRunNumber() [3/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 207 of file RunHelper.cc.

References runNumberToUseForThisLumi().

207  {
208  id = LuminosityBlockID(runNumberToUseForThisLumi(), id.luminosityBlock());
209  }
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:192

◆ runNumberToUseForThisLumi()

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

Reimplemented from edm::RunHelperBase.

Definition at line 192 of file RunHelper.cc.

References lastUsedRunNumber_.

Referenced by checkRunConsistency(), and overrideRunNumber().

Member Data Documentation

◆ fakeNewRun_

bool edm::FirstLuminosityBlockForEachRunHelper::fakeNewRun_
private

Definition at line 115 of file RunHelper.h.

Referenced by checkForNewRun(), fakeNewRun(), and nextItemType().

◆ lastUsedRunNumber_

RunNumber_t edm::FirstLuminosityBlockForEachRunHelper::lastUsedRunNumber_
private

Definition at line 114 of file RunHelper.h.

Referenced by checkForNewRun(), nextItemType(), and runNumberToUseForThisLumi().

◆ lumiToRun_

std::vector<edm::LuminosityBlockID> const edm::FirstLuminosityBlockForEachRunHelper::lumiToRun_
private

Definition at line 112 of file RunHelper.h.

Referenced by findRunFromLumi().

◆ realRunNumber_

RunNumber_t edm::FirstLuminosityBlockForEachRunHelper::realRunNumber_
private

Definition at line 113 of file RunHelper.h.

Referenced by checkForNewRun().