test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

virtual void analyze (edm::Event const &, edm::EventSetup const &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 
virtual void postForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren) 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 70 of file EventIDChecker.cc.

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

Definition at line 82 of file EventIDChecker.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 107 of file EventIDChecker.cc.

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

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 137 of file EventIDChecker.cc.

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

Definition at line 142 of file EventIDChecker.cc.

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

142  {
144  desc.addUntracked<std::vector<edm::EventID> >("eventSequence");
145  desc.addUntracked<unsigned int>("multiProcessSequentialEvents", 0U);
146  descriptions.add("eventIDChecker", desc);
147 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EventIDChecker::postForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 150 of file EventIDChecker.cc.

References mustSearch_.

150  {
151  mustSearch_ = true;
152 }

Member Data Documentation

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

Definition at line 51 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::index_
private

Definition at line 52 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::multiProcessSequentialEvents_
private

Definition at line 54 of file EventIDChecker.cc.

Referenced by analyze().

bool EventIDChecker::mustSearch_
private

Definition at line 56 of file EventIDChecker.cc.

Referenced by analyze(), and postForkReacquireResources().

unsigned int EventIDChecker::numberOfEventsLeftBeforeSearch_
private

Definition at line 55 of file EventIDChecker.cc.

Referenced by analyze().