CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edmtest::WhatsItAnalyzer Class Reference
Inheritance diagram for edmtest::WhatsItAnalyzer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 WhatsItAnalyzer (const edm::ParameterSet &)
 
 ~WhatsItAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void getAndTest (edm::EventSetup const &, edm::ESGetToken< WhatsIt, GadgetRcd > token, int expectedValue, const char *label)
 

Private Attributes

std::vector< int > expectedValues_
 
unsigned int index_
 
std::vector< std::pair< edm::ESGetToken< WhatsIt, GadgetRcd >, const char * > > tokenAndLabel_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 42 of file WhatsItAnalyzer.cc.

Constructor & Destructor Documentation

◆ WhatsItAnalyzer()

WhatsItAnalyzer::WhatsItAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 72 of file WhatsItAnalyzer.cc.

References edm::EDConsumerBase::esConsumes(), mps_fire::i, MainPageGenerator::l, and tokenAndLabel_.

73  : expectedValues_(iConfig.getUntrackedParameter<std::vector<int>>("expectedValues", std::vector<int>())),
74  tokenAndLabel_(5),
75  index_(0) {
76  //now do what ever initialization is needed
77  int i = 0;
78  for (auto l : std::vector<const char*>({"", "A", "B", "C", "D"})) {
80  tokenAndLabel_[i++].second = l;
81  }
82  }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > expectedValues_
std::vector< std::pair< edm::ESGetToken< WhatsIt, GadgetRcd >, const char * > > tokenAndLabel_

◆ ~WhatsItAnalyzer()

WhatsItAnalyzer::~WhatsItAnalyzer ( )
override

Definition at line 84 of file WhatsItAnalyzer.cc.

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

Member Function Documentation

◆ analyze()

void WhatsItAnalyzer::analyze ( const edm::Event ,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 94 of file WhatsItAnalyzer.cc.

References expectedValues_, getAndTest(), index_, and tokenAndLabel_.

94  {
95  if (index_ < expectedValues_.size()) {
96  int expectedValue = expectedValues_.at(index_);
97  for (auto const& tl : tokenAndLabel_) {
98  getAndTest(iSetup, tl.first, expectedValue, tl.second);
99  }
100  ++index_;
101  }
102  }
std::vector< int > expectedValues_
void getAndTest(edm::EventSetup const &, edm::ESGetToken< WhatsIt, GadgetRcd > token, int expectedValue, const char *label)
std::vector< std::pair< edm::ESGetToken< WhatsIt, GadgetRcd >, const char * > > tokenAndLabel_

◆ getAndTest()

void WhatsItAnalyzer::getAndTest ( edm::EventSetup const &  iSetup,
edm::ESGetToken< WhatsIt, GadgetRcd token,
int  expectedValue,
const char *  label 
)
private

Definition at line 104 of file WhatsItAnalyzer.cc.

References Exception, edm::EventSetup::getData(), label, unpackBuffers-CaloStage2::token, and findQualityFiles::v.

Referenced by analyze().

107  {
108  auto const& v = iSetup.getData(token);
109  if (expectedValue != v.a) {
110  throw cms::Exception("TestFail") << label << ": expected value " << expectedValue << " but got " << v.a;
111  }
112  }
char const * label

Member Data Documentation

◆ expectedValues_

std::vector<int> edmtest::WhatsItAnalyzer::expectedValues_
private

Definition at line 56 of file WhatsItAnalyzer.cc.

Referenced by analyze().

◆ index_

unsigned int edmtest::WhatsItAnalyzer::index_
private

Definition at line 58 of file WhatsItAnalyzer.cc.

Referenced by analyze().

◆ tokenAndLabel_

std::vector<std::pair<edm::ESGetToken<WhatsIt, GadgetRcd>, const char*> > edmtest::WhatsItAnalyzer::tokenAndLabel_
private

Definition at line 57 of file WhatsItAnalyzer.cc.

Referenced by analyze(), and WhatsItAnalyzer().