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
edm::EventSetupCacheIdentifierChecker Class Reference
Inheritance diagram for edm::EventSetupCacheIdentifierChecker:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EventSetupCacheIdentifierChecker (const edm::ParameterSet &)
 
 ~EventSetupCacheIdentifierChecker ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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 (const edm::Event &, const edm::EventSetup &)
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
void check (edm::EventSetup const &)
 
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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

Definition at line 45 of file EventSetupCacheIdentifierChecker.cc.

Constructor & Destructor Documentation

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

Definition at line 83 of file EventSetupCacheIdentifierChecker.cc.

83  :
84 m_pset(iConfig),
85 m_index(0)
86 {
87  //now do what ever initialization is needed
88 
89 }
EventSetupCacheIdentifierChecker::~EventSetupCacheIdentifierChecker ( )

Definition at line 92 of file EventSetupCacheIdentifierChecker.cc.

93 {
94 
95  // do anything here that needs to be done at desctruction time
96  // (e.g. close files, deallocate resources etc.)
97 
98 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 107 of file EventSetupCacheIdentifierChecker.cc.

References check().

108 {
109  check(iSetup);
110 }
void EventSetupCacheIdentifierChecker::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &  iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 140 of file EventSetupCacheIdentifierChecker.cc.

References check().

141 {
142  check(iSetup);
143 }
void EventSetupCacheIdentifierChecker::beginRun ( edm::Run const &  ,
edm::EventSetup const &  iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 127 of file EventSetupCacheIdentifierChecker.cc.

References check().

128 {
129  check(iSetup);
130 }
void EventSetupCacheIdentifierChecker::check ( edm::EventSetup const &  iSetup)
private

Definition at line 152 of file EventSetupCacheIdentifierChecker.cc.

References edm::eventsetup::EventSetupRecord::cacheIdentifier(), edm::hlt::Exception, edm::EventSetup::find(), initialize(), m_index, and m_recordKeysToExpectedCacheIdentifiers.

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

153 {
155  initialize();
156  }
157  using namespace edm::eventsetup;
158 
159 
161  it != itEnd;
162  ++it) {
163  EventSetupRecord const* pRecord = iSetup.find(it->first);
164  if(0 == pRecord) {
165  edm::LogWarning("RecordNotInIOV") <<"The EventSetup Record '"<<it->first.name()<<"' is not available for this IOV.";
166  }
167  if(it->second.size() <= m_index) {
168  throw cms::Exception("TooFewCacheIDs")<<"The vector of cacheIdentifiers for the record "<<it->first.name()<<" is too short";
169  }
170  if(0 != pRecord && pRecord->cacheIdentifier() != it->second[m_index]) {
171  throw cms::Exception("IncorrectCacheID")<<"The Record "<<it->first.name()<<" was supposed to have cacheIdentifier: "<<it->second[m_index]<<" but instead has "<<pRecord->cacheIdentifier();
172  }
173  }
174  ++m_index;
175 }
unsigned long long cacheIdentifier() const
DataProxy const * find(DataKey const &aKey) const
std::map< eventsetup::EventSetupRecordKey, std::vector< unsigned int > > m_recordKeysToExpectedCacheIdentifiers
void EventSetupCacheIdentifierChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 197 of file EventSetupCacheIdentifierChecker.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::addWildcardUntracked().

197  {
198  //The following says we do not know what parameters are allowed so do no validation
199  // Please change this to state exactly what you do use, even if it is no parameters
201  desc.addWildcardUntracked<std::vector<unsigned int> >("*")->setComment("The label is the name of an EventSetup Record while the vector contains the expected cacheIdentifier values for each beginRun, beginLuminosityBlock and event transition");
202  descriptions.addDefault(desc);
203 }
ParameterWildcardBase * addWildcardUntracked(U const &pattern)
void addDefault(ParameterSetDescription const &psetDescription)
void EventSetupCacheIdentifierChecker::initialize ( )
private

Definition at line 178 of file EventSetupCacheIdentifierChecker.cc.

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

Referenced by check().

179 {
180  std::vector<std::string> recordNames{m_pset.getParameterNamesForType<std::vector<unsigned int> >(false)};
181 
182  for(auto const& name: recordNames) {
184  if(recordKey.type() == eventsetup::EventSetupRecordKey::TypeTag()) {
185  //record not found
186  edm::LogWarning("DataGetter") <<"Record \""<< name <<"\" does not exist "<<std::endl;
187 
188  continue;
189  }
190 
191  m_recordKeysToExpectedCacheIdentifiers.insert(std::make_pair(recordKey, m_pset.getUntrackedParameter<std::vector<unsigned int> >(name)));
192  }
193 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:195
std::map< eventsetup::EventSetupRecordKey, std::vector< unsigned int > > m_recordKeysToExpectedCacheIdentifiers
heterocontainer::HCTypeTag TypeTag
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:129

Member Data Documentation

unsigned int edm::EventSetupCacheIdentifierChecker::m_index
private

Definition at line 68 of file EventSetupCacheIdentifierChecker.cc.

Referenced by check().

ParameterSet edm::EventSetupCacheIdentifierChecker::m_pset
private

Definition at line 66 of file EventSetupCacheIdentifierChecker.cc.

Referenced by initialize().

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

Definition at line 67 of file EventSetupCacheIdentifierChecker.cc.

Referenced by check(), and initialize().