CMS 3D CMS Logo

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

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

Inheritance diagram for EventIDChecker:
edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 EventIDChecker (edm::ParameterSet const &)
 
 ~EventIDChecker () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

std::vector< edm::EventIDids_
 
unsigned int index_
 
unsigned int multiProcessSequentialEvents_
 
bool mustSearch_
 
unsigned int numberOfEventsLeftBeforeSearch_
 
edm::LuminosityBlockNumber_t presentLumi_ = 0
 
edm::RunNumber_t presentRun_ = 0
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase 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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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 37 of file EventIDChecker.cc.

Constructor & Destructor Documentation

◆ EventIDChecker()

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

Definition at line 74 of file EventIDChecker.cc.

75  : ids_(iConfig.getUntrackedParameter<std::vector<edm::EventID> >("eventSequence")),
76  index_(0),
77  multiProcessSequentialEvents_(iConfig.getUntrackedParameter<unsigned int>("multiProcessSequentialEvents")),
79  mustSearch_(false) {
80  //now do what ever initialization is needed
81 }
unsigned int multiProcessSequentialEvents_
unsigned int index_
std::vector< edm::EventID > ids_
unsigned int numberOfEventsLeftBeforeSearch_

◆ ~EventIDChecker()

EventIDChecker::~EventIDChecker ( )
override

Definition at line 83 of file EventIDChecker.cc.

83  {
84  // do anything here that needs to be done at desctruction time
85  // (e.g. close files, deallocate resources etc.)
86 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 103 of file EventIDChecker.cc.

References Exception, ids_, iEvent, index_, multiProcessSequentialEvents_, mustSearch_, numberOfEventsLeftBeforeSearch_, presentLumi_, and presentRun_.

103  {
104  if (mustSearch_) {
107  //the event must be after the last event in our list since multicore doesn't go backwards
108  std::vector<edm::EventID>::iterator itFind =
109  std::find_if(ids_.begin() + index_, ids_.end(), CompareWithoutLumi(iEvent.id()));
110  if (itFind == ids_.end()) {
111  throw cms::Exception("MissedEvent") << "The event " << iEvent.id() << "is not in the list.\n";
112  }
113  index_ = itFind - ids_.begin();
114  }
116  }
117 
118  if (index_ >= ids_.size()) {
119  throw cms::Exception("TooManyEvents")
120  << "Was passes " << ids_.size() << " EventIDs but have processed more events than that\n";
121  }
122  if (iEvent.id().run() != ids_[index_].run() || iEvent.id().event() != ids_[index_].event()) {
123  throw cms::Exception("WrongEvent") << "Was expecting event " << ids_[index_] << " but was given " << iEvent.id()
124  << "\n";
125  }
126 
127  if (presentRun_ != iEvent.run()) {
128  throw cms::Exception("MissingRunTransitionForEvent")
129  << "at event expected Run " << presentRun_ << " but got " << iEvent.run();
130  }
131  if (presentLumi_ != iEvent.luminosityBlock()) {
132  throw cms::Exception("MissingLuminosityBlockTransitionForEvent")
133  << "expected LuminosityBlock " << presentLumi_ << " but got " << iEvent.luminosityBlock();
134  }
135 
136  ++index_;
137 }
unsigned int multiProcessSequentialEvents_
int iEvent
Definition: GenABIO.cc:224
unsigned int index_
edm::RunNumber_t presentRun_
std::vector< edm::EventID > ids_
unsigned int numberOfEventsLeftBeforeSearch_
edm::LuminosityBlockNumber_t presentLumi_

◆ beginJob()

void EventIDChecker::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 165 of file EventIDChecker.cc.

165 {}

◆ beginLuminosityBlock()

void EventIDChecker::beginLuminosityBlock ( edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &   
)
overrideprivate

Definition at line 140 of file EventIDChecker.cc.

References Exception, edm::LuminosityBlockBase::luminosityBlock(), presentLumi_, presentRun_, and edm::LuminosityBlockBase::run().

140  {
141  if (presentRun_ != iLumi.run()) {
142  throw cms::Exception("WrongRunForLuminosityBlock")
143  << "at beginLuminosityBlock expected Run " << presentRun_ << " but got " << iLumi.run();
144  }
145  presentLumi_ = iLumi.luminosityBlock();
146 }
edm::RunNumber_t presentRun_
edm::LuminosityBlockNumber_t presentLumi_

◆ beginRun()

void EventIDChecker::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivate

Definition at line 139 of file EventIDChecker.cc.

References presentRun_, and edm::RunBase::run().

139 { presentRun_ = iRun.run(); }
edm::RunNumber_t presentRun_

◆ endJob()

void EventIDChecker::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 168 of file EventIDChecker.cc.

168 {}

◆ endLuminosityBlock()

void EventIDChecker::endLuminosityBlock ( edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &   
)
overrideprivate

Definition at line 148 of file EventIDChecker.cc.

References Exception, edm::LuminosityBlockBase::luminosityBlock(), presentLumi_, presentRun_, and edm::LuminosityBlockBase::run().

148  {
149  if (presentRun_ != iLumi.run()) {
150  throw cms::Exception("WrongRunForLuminosityBlock")
151  << "at endLuminosityBlock expected Run " << presentRun_ << " but got " << iLumi.run();
152  }
153  if (presentLumi_ != iLumi.luminosityBlock()) {
154  throw cms::Exception("WrongEndLuminosityBlock")
155  << "expected LuminosityBlock " << presentLumi_ << " but got " << iLumi.luminosityBlock();
156  }
157 }
edm::RunNumber_t presentRun_
edm::LuminosityBlockNumber_t presentLumi_

◆ endRun()

void EventIDChecker::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivate

Definition at line 158 of file EventIDChecker.cc.

References Exception, presentRun_, and edm::RunBase::run().

158  {
159  if (presentRun_ != iRun.run()) {
160  throw cms::Exception("WrongEndRun") << "expected Run " << presentRun_ << " but got " << iRun.run();
161  }
162 }
edm::RunNumber_t presentRun_

◆ fillDescriptions()

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

Definition at line 171 of file EventIDChecker.cc.

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

171  {
173  desc.addUntracked<std::vector<edm::EventID> >("eventSequence");
174  desc.addUntracked<unsigned int>("multiProcessSequentialEvents", 0U);
175  descriptions.add("eventIDChecker", desc);
176 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ ids_

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

Definition at line 53 of file EventIDChecker.cc.

Referenced by analyze().

◆ index_

unsigned int EventIDChecker::index_
private

Definition at line 54 of file EventIDChecker.cc.

Referenced by analyze().

◆ multiProcessSequentialEvents_

unsigned int EventIDChecker::multiProcessSequentialEvents_
private

Definition at line 58 of file EventIDChecker.cc.

Referenced by analyze().

◆ mustSearch_

bool EventIDChecker::mustSearch_
private

Definition at line 60 of file EventIDChecker.cc.

Referenced by analyze().

◆ numberOfEventsLeftBeforeSearch_

unsigned int EventIDChecker::numberOfEventsLeftBeforeSearch_
private

Definition at line 59 of file EventIDChecker.cc.

Referenced by analyze().

◆ presentLumi_

edm::LuminosityBlockNumber_t EventIDChecker::presentLumi_ = 0
private

Definition at line 56 of file EventIDChecker.cc.

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

◆ presentRun_

edm::RunNumber_t EventIDChecker::presentRun_ = 0
private

Definition at line 55 of file EventIDChecker.cc.

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