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 (LuminosityBlockID &lumi) override
 
void overrideRunNumber (RunID &run) 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_
 
const std::vector< edm::LuminosityBlockIDlumiToRun_
 
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} {}

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.

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  }

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

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

219  {
221  }

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

◆ fakeNewRun()

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

Reimplemented from edm::RunHelperBase.

Definition at line 102 of file RunHelper.h.

102 { return fakeNewRun_; }

References fakeNewRun_.

◆ findRunFromLumi()

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

Definition at line 223 of file RunHelper.cc.

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  }

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

Referenced by checkForNewRun(), and nextItemType().

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

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  }

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

◆ overrideRunNumber() [1/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 211 of file RunHelper.cc.

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  }

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

◆ overrideRunNumber() [2/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 207 of file RunHelper.cc.

207  {
208  id = LuminosityBlockID(runNumberToUseForThisLumi(), id.luminosityBlock());
209  }

References runNumberToUseForThisLumi().

◆ overrideRunNumber() [3/3]

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

Reimplemented from edm::RunHelperBase.

Definition at line 205 of file RunHelper.cc.

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

References runNumberToUseForThisLumi().

◆ runNumberToUseForThisLumi()

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

Reimplemented from edm::RunHelperBase.

Definition at line 192 of file RunHelper.cc.

192 { return lastUsedRunNumber_; }

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_

const std::vector<edm::LuminosityBlockID> 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().

edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
edm::FirstLuminosityBlockForEachRunHelper::lastUsedRunNumber_
RunNumber_t lastUsedRunNumber_
Definition: RunHelper.h:114
edm::errors::MismatchedInputFiles
Definition: EDMException.h:52
edm::FirstLuminosityBlockForEachRunHelper::lumiToRun_
const std::vector< edm::LuminosityBlockID > lumiToRun_
Definition: RunHelper.h:112
cms::cuda::assert
assert(be >=bs)
edm::FirstLuminosityBlockForEachRunHelper::fakeNewRun_
bool fakeNewRun_
Definition: RunHelper.h:115
edm::FirstLuminosityBlockForEachRunHelper::findRunFromLumi
RunNumber_t findRunFromLumi(LuminosityBlockNumber_t) const
Definition: RunHelper.cc:223
edm::FirstLuminosityBlockForEachRunHelper::runNumberToUseForThisLumi
RunNumber_t runNumberToUseForThisLumi() const override
Definition: RunHelper.cc:192
edm::InputSource::IsRun
Definition: InputSource.h:78
edm::FirstLuminosityBlockForEachRunHelper::realRunNumber_
RunNumber_t realRunNumber_
Definition: RunHelper.h:113
edm::InputSource::IsLumi
Definition: InputSource.h:78
edmPickEvents.event
event
Definition: edmPickEvents.py:273
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:246
edm::errors::Configuration
Definition: EDMException.h:36
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27