CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::EventSetupCacheIdentifierChecker Class Reference
Inheritance diagram for edm::EventSetupCacheIdentifierChecker:
edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 EventSetupCacheIdentifierChecker (const edm::ParameterSet &)
 
 ~EventSetupCacheIdentifierChecker () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const 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
 
bool wantsStreamRuns () const
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void check (edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void initialize ()
 

Private Attributes

unsigned int m_index
 
ParameterSet m_pset
 
std::map< eventsetup::EventSetupRecordKey, std::vector< unsigned int > > m_recordKeysToExpectedCacheIdentifiers
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase 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)
 
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 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<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 43 of file EventSetupCacheIdentifierChecker.cc.

Constructor & Destructor Documentation

◆ EventSetupCacheIdentifierChecker()

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

Definition at line 81 of file EventSetupCacheIdentifierChecker.cc.

82  : m_pset(iConfig), m_index(0) {
83  //now do what ever initialization is needed
84 }

◆ ~EventSetupCacheIdentifierChecker()

EventSetupCacheIdentifierChecker::~EventSetupCacheIdentifierChecker ( )
override

Definition at line 86 of file EventSetupCacheIdentifierChecker.cc.

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

Member Function Documentation

◆ analyze()

void EventSetupCacheIdentifierChecker::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 96 of file EventSetupCacheIdentifierChecker.cc.

References check().

96  {
97  check(iSetup);
98 }

◆ beginLuminosityBlock()

void EventSetupCacheIdentifierChecker::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 122 of file EventSetupCacheIdentifierChecker.cc.

References check().

123  {
124  check(iSetup);
125 }

◆ beginRun()

void EventSetupCacheIdentifierChecker::beginRun ( edm::Run const &  ,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 113 of file EventSetupCacheIdentifierChecker.cc.

References check().

113 { check(iSetup); }

◆ check()

void EventSetupCacheIdentifierChecker::check ( edm::EventSetup const &  iSetup)
private

Definition at line 133 of file EventSetupCacheIdentifierChecker.cc.

References Exception, edm::EventSetup::find(), initialize(), m_index, and m_recordKeysToExpectedCacheIdentifiers.

Referenced by analyze(), beginLuminosityBlock(), and beginRun().

133  {
135  initialize();
136  }
137  using namespace edm::eventsetup;
138 
140  it != itEnd;
141  ++it) {
142  auto pRecord = iSetup.find(it->first);
143  if (not pRecord) {
144  edm::LogWarning("RecordNotInIOV") << "The EventSetup Record '" << it->first.name()
145  << "' is not available for this IOV.";
146  }
147  if (it->second.size() <= m_index) {
148  throw cms::Exception("TooFewCacheIDs")
149  << "The vector of cacheIdentifiers for the record " << it->first.name() << " is too short";
150  }
151  if (pRecord && pRecord->cacheIdentifier() != it->second[m_index]) {
152  throw cms::Exception("IncorrectCacheID")
153  << "The Record " << it->first.name() << " was supposed to have cacheIdentifier: " << it->second[m_index]
154  << " but instead has " << pRecord->cacheIdentifier();
155  }
156  }
157  ++m_index;
158 }
std::map< eventsetup::EventSetupRecordKey, std::vector< unsigned int > > m_recordKeysToExpectedCacheIdentifiers
Log< level::Warning, false > LogWarning

◆ endLuminosityBlock()

void edm::EventSetupCacheIdentifierChecker::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivate

Definition at line 59 of file EventSetupCacheIdentifierChecker.cc.

59 {}

◆ endRun()

void edm::EventSetupCacheIdentifierChecker::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivate

Definition at line 57 of file EventSetupCacheIdentifierChecker.cc.

57 {}

◆ fillDescriptions()

void EventSetupCacheIdentifierChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 178 of file EventSetupCacheIdentifierChecker.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

178  {
179  //The following says we do not know what parameters are allowed so do no validation
180  // Please change this to state exactly what you do use, even if it is no parameters
182  desc.addWildcardUntracked<std::vector<unsigned int> >("*")->setComment(
183  "The label is the name of an EventSetup Record while the vector contains the expected cacheIdentifier values for "
184  "each beginRun, beginLuminosityBlock and event transition");
185  descriptions.addDefault(desc);
186 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ initialize()

void EventSetupCacheIdentifierChecker::initialize ( )
private

Definition at line 160 of file EventSetupCacheIdentifierChecker.cc.

References edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::ParameterSet::getParameterNamesForType(), edm::ParameterSet::getUntrackedParameter(), m_pset, m_recordKeysToExpectedCacheIdentifiers, Skims_PA_cff::name, and edm::eventsetup::EventSetupRecordKey::type().

Referenced by check().

160  {
161  std::vector<std::string> recordNames{m_pset.getParameterNamesForType<std::vector<unsigned int> >(false)};
162 
163  for (auto const& name : recordNames) {
165  if (recordKey.type() == eventsetup::EventSetupRecordKey::TypeTag()) {
166  //record not found
167  edm::LogWarning("DataGetter") << "Record \"" << name << "\" does not exist " << std::endl;
168 
169  continue;
170  }
171 
173  std::make_pair(recordKey, m_pset.getUntrackedParameter<std::vector<unsigned int> >(name)));
174  }
175 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< eventsetup::EventSetupRecordKey, std::vector< unsigned int > > m_recordKeysToExpectedCacheIdentifiers
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
heterocontainer::HCTypeTag TypeTag
Log< level::Warning, false > LogWarning
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:121

Member Data Documentation

◆ m_index

unsigned int edm::EventSetupCacheIdentifierChecker::m_index
private

Definition at line 66 of file EventSetupCacheIdentifierChecker.cc.

Referenced by check().

◆ m_pset

ParameterSet edm::EventSetupCacheIdentifierChecker::m_pset
private

Definition at line 64 of file EventSetupCacheIdentifierChecker.cc.

Referenced by initialize().

◆ m_recordKeysToExpectedCacheIdentifiers

std::map<eventsetup::EventSetupRecordKey, std::vector<unsigned int> > edm::EventSetupCacheIdentifierChecker::m_recordKeysToExpectedCacheIdentifiers
private

Definition at line 65 of file EventSetupCacheIdentifierChecker.cc.

Referenced by check(), and initialize().