CMS 3D CMS Logo

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

edm::PrintEventSetupDataRetrieval Class Reference

#include <PrintEventSetupDataRetrieval.h>

List of all members.

Public Member Functions

void postBeginLumi (LuminosityBlock const &, EventSetup const &)
void postBeginRun (Run const &, EventSetup const &)
void postProcessEvent (Event const &, EventSetup const &)
 PrintEventSetupDataRetrieval (const ParameterSet &, ActivityRegistry &)

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Types

typedef std::map
< eventsetup::EventSetupRecordKey,
std::pair< unsigned long long,
std::map< eventsetup::DataKey,
bool > > > 
RetrievedDataMap

Private Member Functions

void check (EventSetup const &)
const
PrintEventSetupDataRetrieval
operator= (const PrintEventSetupDataRetrieval &)
 PrintEventSetupDataRetrieval (const PrintEventSetupDataRetrieval &)

Private Attributes

bool m_printProviders
std::vector
< eventsetup::EventSetupRecordKey
m_recordKeys
RetrievedDataMap m_retrievedDataMap

Detailed Description

Definition at line 35 of file PrintEventSetupDataRetrieval.h.


Member Typedef Documentation

typedef std::map<eventsetup::EventSetupRecordKey, std::pair<unsigned long long, std::map<eventsetup::DataKey,bool> > > edm::PrintEventSetupDataRetrieval::RetrievedDataMap [private]

Definition at line 57 of file PrintEventSetupDataRetrieval.h.


Constructor & Destructor Documentation

PrintEventSetupDataRetrieval::PrintEventSetupDataRetrieval ( const ParameterSet iPS,
ActivityRegistry iRegistry 
)

Definition at line 37 of file PrintEventSetupDataRetrieval.cc.

References edm::ParameterSet::getUntrackedParameter(), postBeginLumi(), postBeginRun(), postProcessEvent(), edm::ActivityRegistry::watchPostBeginLumi(), edm::ActivityRegistry::watchPostBeginRun(), and edm::ActivityRegistry::watchPostProcessEvent().

                                                                                         :
   m_printProviders(iPS.getUntrackedParameter<bool>("printProviders"))
   {
      if(iPS.getUntrackedParameter<bool>("checkAfterBeginRun")) {
         iRegistry.watchPostBeginRun(this, &PrintEventSetupDataRetrieval::postBeginRun);
      }
      if(iPS.getUntrackedParameter<bool>("checkAfterBeginLumi")) {
         iRegistry.watchPostBeginLumi(this, &PrintEventSetupDataRetrieval::postBeginLumi);
      }
      if(iPS.getUntrackedParameter<bool>("checkAfterEvent")) {
         iRegistry.watchPostProcessEvent(this, &PrintEventSetupDataRetrieval::postProcessEvent);
      }
   }
edm::PrintEventSetupDataRetrieval::PrintEventSetupDataRetrieval ( const PrintEventSetupDataRetrieval ) [private]

Member Function Documentation

void PrintEventSetupDataRetrieval::check ( EventSetup const &  iES) [private]

Definition at line 105 of file PrintEventSetupDataRetrieval.cc.

References edm::eventsetup::EventSetupRecord::cacheIdentifier(), edm::EventSetup::fillAvailableRecordKeys(), edm::eventsetup::EventSetupRecord::fillRegisteredDataKeys(), edm::EventSetup::find(), relativeConstraints::keys, edm::eventsetup::ComponentDescription::label_, m_printProviders, m_recordKeys, m_retrievedDataMap, edm::eventsetup::EventSetupRecord::providerDescription(), alignCSCRings::r, edm::eventsetup::ComponentDescription::type_, and edm::eventsetup::EventSetupRecord::wasGotten().

Referenced by postBeginLumi(), postBeginRun(), and postProcessEvent().

                                                                 {
      //std::cout <<"postProcessEvent"<<std::endl;
      m_recordKeys.clear();
      iES.fillAvailableRecordKeys(m_recordKeys);
      
      for(std::vector<eventsetup::EventSetupRecordKey>::const_iterator it = m_recordKeys.begin(), itEnd = m_recordKeys.end();
          it != itEnd;
          ++it) {
         //std::cout <<"  "<<it->name()<<std::endl;
         const eventsetup::EventSetupRecord* r = iES.find(*it);
         assert(r != 0);
         
         RetrievedDataMap::iterator itRetrievedData =  m_retrievedDataMap.find(*it);
         if(itRetrievedData == m_retrievedDataMap.end()) {
            itRetrievedData = m_retrievedDataMap.insert(std::make_pair(*it,std::pair<unsigned long long, std::map<eventsetup::DataKey,bool> >())).first;
            itRetrievedData->second.first = r->cacheIdentifier();
            std::vector<eventsetup::DataKey> keys;
            r->fillRegisteredDataKeys(keys);
            for(std::vector<eventsetup::DataKey>::const_iterator itData = keys.begin(), itDataEnd = keys.end();
                itData != itDataEnd;
                ++itData) {
               itRetrievedData->second.second.insert(std::make_pair(*itData,false));
            }
         }
         RetrievedDataMap::value_type& retrievedData = *itRetrievedData;
         if(itRetrievedData->second.first != r->cacheIdentifier()) {
            itRetrievedData->second.first = r->cacheIdentifier();
            for(std::map<eventsetup::DataKey,bool>::iterator itDatum = retrievedData.second.second.begin(), itDatumEnd = retrievedData.second.second.end();
                itDatum != itDatumEnd;
                ++itDatum) {
               itDatum->second = false;
            }
         }
         
         for(std::map<eventsetup::DataKey,bool>::iterator itDatum = retrievedData.second.second.begin(), itDatumEnd = retrievedData.second.second.end();
             itDatum != itDatumEnd;
             ++itDatum) {
            bool wasGotten = r->wasGotten(itDatum->first);
            //std::cout <<"     "<<itDatum->first.type().name()<<" "<<wasGotten<<std::endl;
            if(wasGotten != itDatum->second) {
               itDatum->second = wasGotten;
               if(m_printProviders) {
                  const edm::eventsetup::ComponentDescription* d = r->providerDescription(itDatum->first);
                  assert(0!=d);
                  edm::LogSystem("PrintEventSetupDataRetrieval")<<"Retrieved> Record:"<<it->name()<<" data:"<<itDatum->first.type().name()<<" '"<<itDatum->first.name().value()
                  <<"' provider:"<<d->type_<<" '"<<d->label_<<"'";
               } else {
                  edm::LogSystem("PrintEventSetupDataRetrieval")<<"Retrieved> Record:"<<it->name()<<" data:"<<itDatum->first.type().name()<<" '"<<itDatum->first.name().value()<<"'";
               }
               //std::cout <<"CHANGED"<<std::endl;
            }
         }
      }
   }
void PrintEventSetupDataRetrieval::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Definition at line 61 of file PrintEventSetupDataRetrieval.cc.

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

                                                                                                  {
      edm::ParameterSetDescription desc;
      desc.addUntracked<bool>("printProviders",false)->setComment(
      "If 'true' also print which ES module provides the data");
      desc.addUntracked<bool>("checkAfterBeginRun",false)->setComment(
       "If 'true' check for retrieved data after each begin run is processed");
      desc.addUntracked<bool>("checkAfterBeginLumi",false)->setComment(
       "If 'true' check for retrieved data after each begin lumi is processed");
      desc.addUntracked<bool>("checkAfterEvent",true)->setComment(
       "If 'true' check for retrieved data after an event is processed");
      descriptions.add("PrintEventSetupDataRetrieval", desc);
      descriptions.setComment("This service reports when EventSetup data is retrieved by a module in the job.");
   }
const PrintEventSetupDataRetrieval& edm::PrintEventSetupDataRetrieval::operator= ( const PrintEventSetupDataRetrieval ) [private]
void PrintEventSetupDataRetrieval::postBeginLumi ( LuminosityBlock const &  ,
EventSetup const &  iES 
)

Definition at line 101 of file PrintEventSetupDataRetrieval.cc.

References check().

Referenced by PrintEventSetupDataRetrieval().

                                                                                            {
      check(iES);
   }
void PrintEventSetupDataRetrieval::postBeginRun ( Run const &  ,
EventSetup const &  iES 
)

Definition at line 96 of file PrintEventSetupDataRetrieval.cc.

References check().

Referenced by PrintEventSetupDataRetrieval().

                                                                               {
      check(iES);
   }
void PrintEventSetupDataRetrieval::postProcessEvent ( Event const &  ,
EventSetup const &  iES 
)

Definition at line 91 of file PrintEventSetupDataRetrieval.cc.

References check().

Referenced by PrintEventSetupDataRetrieval().

                                                                                     {
      check(iES);
   }

Member Data Documentation

Definition at line 60 of file PrintEventSetupDataRetrieval.h.

Referenced by check().

Definition at line 59 of file PrintEventSetupDataRetrieval.h.

Referenced by check().

Definition at line 58 of file PrintEventSetupDataRetrieval.h.

Referenced by check().