CMS 3D CMS Logo

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

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

Inheritance diagram for AbortOnEventIDAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 AbortOnEventIDAnalyzer (edm::ParameterSet const &)
 
 ~AbortOnEventIDAnalyzer ()
 
- 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
 
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

virtual void analyze (edm::Event const &, edm::EventSetup const &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 

Private Attributes

std::vector< edm::EventIDids_
 
bool throwException_
 

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: Does a system abort when it seens the specified EventID. Useful for testing error handling.

Implementation: <Notes on="" implementation>="">

Definition at line 38 of file AbortOnEventIDAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 66 of file AbortOnEventIDAnalyzer.cc.

66  :
67  ids_(iConfig.getUntrackedParameter<std::vector<edm::EventID> >("eventsToAbort")),
68  throwException_(iConfig.getUntrackedParameter<bool>("throwExceptionInsteadOfAbort"))
69 {
70  //now do what ever initialization is needed
71 
72 }
std::vector< edm::EventID > ids_
AbortOnEventIDAnalyzer::~AbortOnEventIDAnalyzer ( )

Definition at line 75 of file AbortOnEventIDAnalyzer.cc.

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

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 100 of file AbortOnEventIDAnalyzer.cc.

References Exception, edm::EventBase::id(), ids_, and throwException_.

100  {
101  std::vector<edm::EventID>::iterator itFind= std::find_if(ids_.begin(), ids_.end(), CompareWithoutLumi(iEvent.id()));
102  if(itFind != ids_.end()) {
103  if (throwException_) {
104  throw cms::Exception("AbortEvent") << "Found event " << iEvent.id() << "\n";
105  } else {
106  abort();
107  }
108  }
109 }
std::vector< edm::EventID > ids_
int iEvent
Definition: GenABIO.cc:230
void AbortOnEventIDAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 113 of file AbortOnEventIDAnalyzer.cc.

113  {
114 }
void AbortOnEventIDAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file AbortOnEventIDAnalyzer.cc.

118  {
119 }
void AbortOnEventIDAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 123 of file AbortOnEventIDAnalyzer.cc.

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

123  {
125  desc.addUntracked<std::vector<edm::EventID> >("eventsToAbort");
126  desc.addUntracked<bool>("throwExceptionInsteadOfAbort", false);
127  descriptions.add("abortOnEventID", desc);
128 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

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

Definition at line 51 of file AbortOnEventIDAnalyzer.cc.

Referenced by analyze().

bool AbortOnEventIDAnalyzer::throwException_
private

Definition at line 52 of file AbortOnEventIDAnalyzer.cc.

Referenced by analyze().