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 ()
 
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
 
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 &)
 

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

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

Definition at line 81 of file EventIDChecker.cc.

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

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 106 of file EventIDChecker.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file EventIDChecker.cc.

131  {
132 }
void EventIDChecker::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file EventIDChecker.cc.

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

Definition at line 141 of file EventIDChecker.cc.

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

141  {
143  desc.addUntracked<std::vector<edm::EventID> >("eventSequence");
144  desc.addUntracked<unsigned int>("multiProcessSequentialEvents", 0U);
145  descriptions.add("eventIDChecker", desc);
146 }
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 50 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::index_
private

Definition at line 51 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::multiProcessSequentialEvents_
private

Definition at line 53 of file EventIDChecker.cc.

Referenced by analyze().

bool EventIDChecker::mustSearch_
private

Definition at line 55 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::numberOfEventsLeftBeforeSearch_
private

Definition at line 54 of file EventIDChecker.cc.

Referenced by analyze().