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 () 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_
 
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 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: 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 65 of file AbortOnEventIDAnalyzer.cc.

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

Definition at line 71 of file AbortOnEventIDAnalyzer.cc.

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

71  {
72  // do anything here that needs to be done at desctruction time
73  // (e.g. close files, deallocate resources etc.)
74 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 91 of file AbortOnEventIDAnalyzer.cc.

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

91  {
92  std::vector<edm::EventID>::iterator itFind = std::find_if(ids_.begin(), ids_.end(), CompareWithoutLumi(iEvent.id()));
93  if (itFind != ids_.end()) {
94  if (throwException_) {
95  throw cms::Exception("AbortEvent") << "Found event " << iEvent.id() << "\n";
96  } else {
97  abort();
98  }
99  }
100 }
std::vector< edm::EventID > ids_
int iEvent
Definition: GenABIO.cc:224
void AbortOnEventIDAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 103 of file AbortOnEventIDAnalyzer.cc.

103 {}
void AbortOnEventIDAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 106 of file AbortOnEventIDAnalyzer.cc.

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

Definition at line 109 of file AbortOnEventIDAnalyzer.cc.

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

109  {
111  desc.addUntracked<std::vector<edm::EventID> >("eventsToAbort");
112  desc.addUntracked<bool>("throwExceptionInsteadOfAbort", false);
113  descriptions.add("abortOnEventID", desc);
114 }
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 50 of file AbortOnEventIDAnalyzer.cc.

Referenced by analyze().

bool AbortOnEventIDAnalyzer::throwException_
private

Definition at line 51 of file AbortOnEventIDAnalyzer.cc.

Referenced by analyze().