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

Public Member Functions

 EventIDChecker (edm::ParameterSet const &)
 
 ~EventIDChecker () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
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
 
ESProxyIndex const * esGetTokenIndices (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::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)
 
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::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 endJob () override
 

Private Attributes

std::vector< edm::EventIDids_
 
unsigned int index_
 
unsigned int multiProcessSequentialEvents_
 
bool mustSearch_
 
unsigned int numberOfEventsLeftBeforeSearch_
 

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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 37 of file EventIDChecker.cc.

Constructor & Destructor Documentation

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

Definition at line 68 of file EventIDChecker.cc.

69  : ids_(iConfig.getUntrackedParameter<std::vector<edm::EventID> >("eventSequence")),
70  index_(0),
71  multiProcessSequentialEvents_(iConfig.getUntrackedParameter<unsigned int>("multiProcessSequentialEvents")),
73  mustSearch_(false) {
74  //now do what ever initialization is needed
75 }
unsigned int multiProcessSequentialEvents_
unsigned int index_
std::vector< edm::EventID > ids_
unsigned int numberOfEventsLeftBeforeSearch_
EventIDChecker::~EventIDChecker ( )
override

Definition at line 77 of file EventIDChecker.cc.

References edm::EventID::event(), and edm::EventID::run().

77  {
78  // do anything here that needs to be done at desctruction time
79  // (e.g. close files, deallocate resources etc.)
80 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 97 of file EventIDChecker.cc.

References edm::EventID::event(), Exception, edm::EventBase::id(), ids_, index_, multiProcessSequentialEvents_, mustSearch_, numberOfEventsLeftBeforeSearch_, and edm::EventID::run().

97  {
98  if (mustSearch_) {
101  //the event must be after the last event in our list since multicore doesn't go backwards
102  std::vector<edm::EventID>::iterator itFind =
103  std::find_if(ids_.begin() + index_, ids_.end(), CompareWithoutLumi(iEvent.id()));
104  if (itFind == ids_.end()) {
105  throw cms::Exception("MissedEvent") << "The event " << iEvent.id() << "is not in the list.\n";
106  }
107  index_ = itFind - ids_.begin();
108  }
110  }
111 
112  if (index_ >= ids_.size()) {
113  throw cms::Exception("TooManyEvents")
114  << "Was passes " << ids_.size() << " EventIDs but have processed more events than that\n";
115  }
116  if (iEvent.id().run() != ids_[index_].run() || iEvent.id().event() != ids_[index_].event()) {
117  throw cms::Exception("WrongEvent") << "Was expecting event " << ids_[index_] << " but was given " << iEvent.id()
118  << "\n";
119  }
120  ++index_;
121 }
unsigned int multiProcessSequentialEvents_
int iEvent
Definition: GenABIO.cc:224
unsigned int index_
std::vector< edm::EventID > ids_
unsigned int numberOfEventsLeftBeforeSearch_
void EventIDChecker::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file EventIDChecker.cc.

124 {}
void EventIDChecker::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 127 of file EventIDChecker.cc.

127 {}
void EventIDChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 130 of file EventIDChecker.cc.

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

130  {
132  desc.addUntracked<std::vector<edm::EventID> >("eventSequence");
133  desc.addUntracked<unsigned int>("multiProcessSequentialEvents", 0U);
134  descriptions.add("eventIDChecker", desc);
135 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

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

Definition at line 49 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::index_
private

Definition at line 50 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::multiProcessSequentialEvents_
private

Definition at line 52 of file EventIDChecker.cc.

Referenced by analyze().

bool EventIDChecker::mustSearch_
private

Definition at line 54 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::numberOfEventsLeftBeforeSearch_
private

Definition at line 53 of file EventIDChecker.cc.

Referenced by analyze().