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::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 RunLumiEventChecker (edm::ParameterSet const &)
 
 ~RunLumiEventChecker () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &es) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &es) override
 
void check (edm::EventID const &iID, bool isEvent)
 
void endJob () override
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &es) override
 
void endRun (edm::Run const &run, edm::EventSetup const &es) override
 

Private Attributes

std::vector< edm::EventIDids_
 
unsigned int index_
 
std::map< edm::EventID, unsigned int > seenIDs_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, 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 43 of file RunLumiEventChecker.cc.

Constructor & Destructor Documentation

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

Definition at line 80 of file RunLumiEventChecker.cc.

80  :
81  ids_(iConfig.getUntrackedParameter<std::vector<edm::EventID> >("eventSequence")),
82  index_(0)
83 {
84  //now do what ever initialization is needed
85 }
std::vector< edm::EventID > ids_
RunLumiEventChecker::~RunLumiEventChecker ( )
override

Definition at line 88 of file RunLumiEventChecker.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 110 of file RunLumiEventChecker.cc.

References check(), and edm::EventBase::id().

110  {
111  check(iEvent.id(), true);
112 }
int iEvent
Definition: GenABIO.cc:230
void check(edm::EventID const &iID, bool isEvent)
void RunLumiEventChecker::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file RunLumiEventChecker.cc.

136  {
137 }
void RunLumiEventChecker::beginLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  es 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file RunLumiEventChecker.cc.

References check(), edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and edm::LuminosityBlockID::run().

124  {
125  check(edm::EventID(lumi.id().run(), lumi.id().luminosityBlock(), 0), false);
126 }
void check(edm::EventID const &iID, bool isEvent)
void RunLumiEventChecker::beginRun ( edm::Run const &  run,
edm::EventSetup const &  es 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file RunLumiEventChecker.cc.

References check(), edm::RunBase::id(), and edm::RunID::run().

115  {
116  check(edm::EventID(run.id().run(), 0, 0), false);
117 }
void check(edm::EventID const &iID, bool isEvent)
void RunLumiEventChecker::check ( edm::EventID const &  iID,
bool  isEvent 
)
private

Definition at line 98 of file RunLumiEventChecker.cc.

References Exception, ids_, and index_.

Referenced by analyze(), beginLuminosityBlock(), beginRun(), endLuminosityBlock(), and endRun().

98  {
99  if(index_ >= ids_.size()) {
100  throw cms::Exception("TooManyEvents") << "Was passes " << ids_.size() << " EventIDs but have processed more events than that\n";
101  }
102  if(iEventID != ids_[index_]) {
103  throw cms::Exception("WrongEvent") << "Was expecting event " << ids_[index_] << " but was given " << iEventID << "\n";
104  }
105  ++index_;
106 }
std::vector< edm::EventID > ids_
void RunLumiEventChecker::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 141 of file RunLumiEventChecker.cc.

References Exception, ids_, and index_.

141  {
142  if(index_ != ids_.size()) {
143  throw cms::Exception("WrongNumberOfEvents")<<"Saw "<<index_<<" events but was supposed to see "<<ids_.size()<<"\n";
144  }
145 }
std::vector< edm::EventID > ids_
void RunLumiEventChecker::endLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  es 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 129 of file RunLumiEventChecker.cc.

References check(), edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and edm::LuminosityBlockID::run().

129  {
130  check(edm::EventID(lumi.id().run(), lumi.id().luminosityBlock(), 0), false);
131 }
void check(edm::EventID const &iID, bool isEvent)
void RunLumiEventChecker::endRun ( edm::Run const &  run,
edm::EventSetup const &  es 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 119 of file RunLumiEventChecker.cc.

References check(), edm::RunBase::id(), and edm::RunID::run().

119  {
120  check(edm::EventID(run.id().run(), 0, 0), false);
121 }
void check(edm::EventID const &iID, bool isEvent)
void RunLumiEventChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 149 of file RunLumiEventChecker.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and DEFINE_FWK_MODULE.

149  {
151  desc.addUntracked<std::vector<edm::EventID> >("eventSequence");
152  descriptions.add("runLumiEventIDChecker", desc);
153 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

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

Definition at line 63 of file RunLumiEventChecker.cc.

Referenced by check(), and endJob().

unsigned int RunLumiEventChecker::index_
private

Definition at line 64 of file RunLumiEventChecker.cc.

Referenced by check(), and endJob().

std::map<edm::EventID, unsigned int> RunLumiEventChecker::seenIDs_
private

Definition at line 65 of file RunLumiEventChecker.cc.