CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
RunLumiEventChecker Class Reference

#include <FWCore/Modules/src/RunLumiEventChecker.cc>

Inheritance diagram for RunLumiEventChecker:
edm::global::EDAnalyzer< edm::RunCache< rlec::Cache >, edm::LuminosityBlockCache< rlec::Cache > > edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 RunLumiEventChecker (edm::ParameterSet const &)
 
 ~RunLumiEventChecker () override
 
- Public Member Functions inherited from edm::global::EDAnalyzer< edm::RunCache< rlec::Cache >, edm::LuminosityBlockCache< rlec::Cache > >
 EDAnalyzer ()=default
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
 
void beginJob () override
 
void check (edm::EventID const &iID, bool isEvent) const
 
void endJob () override
 
std::shared_ptr< rlec::CacheglobalBeginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &es) const override
 
std::shared_ptr< rlec::CacheglobalBeginRun (edm::Run const &run, edm::EventSetup const &es) const override
 
void globalEndLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &es) const override
 
void globalEndRun (edm::Run const &run, edm::EventSetup const &es) const override
 

Private Attributes

std::vector< edm::EventIDids_
 
std::atomic< unsigned int > index_
 
bool unorderedEvents_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: Checks that the events passed to it come in the order specified in its configuration

Implementation: <Notes on="" implementation>="">

Definition at line 46 of file RunLumiEventChecker.cc.

Constructor & Destructor Documentation

◆ RunLumiEventChecker()

RunLumiEventChecker::RunLumiEventChecker ( edm::ParameterSet const &  iConfig)
explicit

Definition at line 84 of file RunLumiEventChecker.cc.

85  : ids_(iConfig.getUntrackedParameter<std::vector<edm::EventID>>("eventSequence")),
86  index_(0),
87  unorderedEvents_(iConfig.getUntrackedParameter<bool>("unorderedEvents")) {
88  //now do what ever initialization is needed
89 }

◆ ~RunLumiEventChecker()

RunLumiEventChecker::~RunLumiEventChecker ( )
override

Definition at line 91 of file RunLumiEventChecker.cc.

91  {
92  // do anything here that needs to be done at desctruction time
93  // (e.g. close files, deallocate resources etc.)
94 }

Member Function Documentation

◆ analyze()

void RunLumiEventChecker::analyze ( edm::StreamID  ,
edm::Event const &  iEvent,
edm::EventSetup const &   
) const
overrideprivatevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 120 of file RunLumiEventChecker.cc.

120  {
121  check(iEvent.id(), true);
122 }

References check(), and iEvent.

◆ beginJob()

void RunLumiEventChecker::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 143 of file RunLumiEventChecker.cc.

143 {}

◆ check()

void RunLumiEventChecker::check ( edm::EventID const &  iID,
bool  isEvent 
) const
private

Definition at line 100 of file RunLumiEventChecker.cc.

100  {
101  if (index_ >= ids_.size()) {
102  throw cms::Exception("TooManyEvents")
103  << "Was passes " << ids_.size() << " EventIDs but have processed more events than that\n";
104  }
105  if (unorderedEvents_) {
106  auto itFound = std::find(ids_.begin(), ids_.end(), iEventID);
107  if (itFound == ids_.end()) {
108  throw cms::Exception("UnexpecedEvent") << "The event " << iEventID << " was not expected.";
109  }
110  } else {
111  if (iEventID != ids_[index_]) {
112  throw cms::Exception("WrongEvent") << "Was expecting event " << ids_[index_] << " but was given " << iEventID
113  << "\n";
114  }
115  }
116  ++index_;
117 }

References Exception, spr::find(), ids_, index_, and unorderedEvents_.

Referenced by analyze(), globalBeginLuminosityBlock(), globalBeginRun(), globalEndLuminosityBlock(), and globalEndRun().

◆ endJob()

void RunLumiEventChecker::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 146 of file RunLumiEventChecker.cc.

146  {
147  if (index_ != ids_.size()) {
148  throw cms::Exception("WrongNumberOfEvents")
149  << "Saw " << index_ << " events but was supposed to see " << ids_.size() << "\n";
150  }
151 }

References Exception, ids_, and index_.

◆ fillDescriptions()

void RunLumiEventChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 154 of file RunLumiEventChecker.cc.

154  {
156  desc.addUntracked<std::vector<edm::EventID>>("eventSequence");
157  desc.addUntracked<bool>("unorderedEvents", false);
158  descriptions.add("runLumiEventIDChecker", desc);
159 }

References edm::ConfigurationDescriptions::add(), and submitPVResolutionJobs::desc.

◆ globalBeginLuminosityBlock()

std::shared_ptr< rlec::Cache > RunLumiEventChecker::globalBeginLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  es 
) const
overrideprivate

Definition at line 132 of file RunLumiEventChecker.cc.

133  {
134  check(edm::EventID(lumi.id().run(), lumi.id().luminosityBlock(), 0), false);
135  return std::shared_ptr<rlec::Cache>{};
136 }

References check().

◆ globalBeginRun()

std::shared_ptr< rlec::Cache > RunLumiEventChecker::globalBeginRun ( edm::Run const &  run,
edm::EventSetup const &  es 
) const
overrideprivate

Definition at line 124 of file RunLumiEventChecker.cc.

124  {
125  check(edm::EventID(run.id().run(), 0, 0), false);
126  return std::shared_ptr<rlec::Cache>{};
127 }

References check(), and writedatasetfile::run.

◆ globalEndLuminosityBlock()

void RunLumiEventChecker::globalEndLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  es 
) const
overrideprivate

Definition at line 138 of file RunLumiEventChecker.cc.

138  {
139  check(edm::EventID(lumi.id().run(), lumi.id().luminosityBlock(), 0), false);
140 }

References check().

◆ globalEndRun()

void RunLumiEventChecker::globalEndRun ( edm::Run const &  run,
edm::EventSetup const &  es 
) const
overrideprivate

Definition at line 128 of file RunLumiEventChecker.cc.

128  {
129  check(edm::EventID(run.id().run(), 0, 0), false);
130 }

References check(), and writedatasetfile::run.

Member Data Documentation

◆ ids_

std::vector<edm::EventID> RunLumiEventChecker::ids_
private

Definition at line 68 of file RunLumiEventChecker.cc.

Referenced by check(), and endJob().

◆ index_

std::atomic<unsigned int> RunLumiEventChecker::index_
mutableprivate

Definition at line 69 of file RunLumiEventChecker.cc.

Referenced by check(), and endJob().

◆ unorderedEvents_

bool RunLumiEventChecker::unorderedEvents_
private

Definition at line 70 of file RunLumiEventChecker.cc.

Referenced by check().

RunLumiEventChecker::check
void check(edm::EventID const &iID, bool isEvent) const
Definition: RunLumiEventChecker.cc:100
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
RunLumiEventChecker::ids_
std::vector< edm::EventID > ids_
Definition: RunLumiEventChecker.cc:68
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
RunLumiEventChecker::unorderedEvents_
bool unorderedEvents_
Definition: RunLumiEventChecker.cc:70
RunLumiEventChecker::index_
std::atomic< unsigned int > index_
Definition: RunLumiEventChecker.cc:69
iEvent
int iEvent
Definition: GenABIO.cc:224
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:245
edm::EventID
Definition: EventID.h:31
lumi
Definition: LumiSectionData.h:20