CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

edm::EventSetupCacheIdentifierChecker Class Reference

Inheritance diagram for edm::EventSetupCacheIdentifierChecker:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EventSetupCacheIdentifierChecker (const edm::ParameterSet &)
 ~EventSetupCacheIdentifierChecker ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

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

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.

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

}
EventSetupCacheIdentifierChecker::~EventSetupCacheIdentifierChecker ( )

Definition at line 92 of file EventSetupCacheIdentifierChecker.cc.

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

}

Member Function Documentation

void EventSetupCacheIdentifierChecker::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 107 of file EventSetupCacheIdentifierChecker.cc.

References check().

{
  check(iSetup);
}
void EventSetupCacheIdentifierChecker::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &  iSetup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 140 of file EventSetupCacheIdentifierChecker.cc.

References check().

{
  check(iSetup);
}
void EventSetupCacheIdentifierChecker::beginRun ( edm::Run const &  ,
edm::EventSetup const &  iSetup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 127 of file EventSetupCacheIdentifierChecker.cc.

References check().

{
  check(iSetup);
}
void EventSetupCacheIdentifierChecker::check ( edm::EventSetup const &  iSetup) [private]

Definition at line 152 of file EventSetupCacheIdentifierChecker.cc.

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

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

{
  if(0==m_recordKeysToExpectedCacheIdentifiers.size()) {
    initialize();
  }
  using namespace edm::eventsetup;

  
  for(auto it = m_recordKeysToExpectedCacheIdentifiers.begin(), itEnd = m_recordKeysToExpectedCacheIdentifiers.end();
      it != itEnd;
      ++it) {
    EventSetupRecord const* pRecord = iSetup.find(it->first);
    if(0 == pRecord) {
      edm::LogWarning("RecordNotInIOV") <<"The EventSetup Record '"<<it->first.name()<<"' is not available for this IOV.";
    }
    if(it->second.size() <= m_index) {
      throw cms::Exception("TooFewCacheIDs")<<"The vector of cacheIdentifiers for the record "<<it->first.name()<<" is too short";
    }
    if(0 != pRecord && pRecord->cacheIdentifier() != it->second[m_index]) {
      throw cms::Exception("IncorrectCacheID")<<"The Record "<<it->first.name()<<" was supposed to have cacheIdentifier: "<<it->second[m_index]<<" but instead has "<<pRecord->cacheIdentifier();
    }
  }
  ++m_index;
}
void EventSetupCacheIdentifierChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDAnalyzer.

Definition at line 197 of file EventSetupCacheIdentifierChecker.cc.

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

                                                                                             {
  //The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  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");
  descriptions.addDefault(desc);
}
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().

{
  std::vector<std::string> recordNames{m_pset.getParameterNamesForType<std::vector<unsigned int> >(false)};

  for(auto const& name: recordNames) {
    eventsetup::EventSetupRecordKey recordKey(eventsetup::EventSetupRecordKey::TypeTag::findType(name));
    if(recordKey.type() == eventsetup::EventSetupRecordKey::TypeTag()) {
      //record not found
      edm::LogWarning("DataGetter") <<"Record \""<< name <<"\" does not exist "<<std::endl;
      
      continue;
    }
    
    m_recordKeysToExpectedCacheIdentifiers.insert(std::make_pair(recordKey, m_pset.getUntrackedParameter<std::vector<unsigned int> >(name)));
  }
}

Member Data Documentation

Definition at line 68 of file EventSetupCacheIdentifierChecker.cc.

Referenced by check().

Definition at line 66 of file EventSetupCacheIdentifierChecker.cc.

Referenced by initialize().

Definition at line 67 of file EventSetupCacheIdentifierChecker.cc.

Referenced by check(), and initialize().