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 Types | Private Member Functions | Private Attributes
edm::PrintEventSetupDataRetrieval Class Reference

#include <PrintEventSetupDataRetrieval.h>

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().

38  :
39  m_printProviders(iPS.getUntrackedParameter<bool>("printProviders"))
40  {
41  if(iPS.getUntrackedParameter<bool>("checkAfterBeginRun")) {
42  iRegistry.watchPostBeginRun(this, &PrintEventSetupDataRetrieval::postBeginRun);
43  }
44  if(iPS.getUntrackedParameter<bool>("checkAfterBeginLumi")) {
45  iRegistry.watchPostBeginLumi(this, &PrintEventSetupDataRetrieval::postBeginLumi);
46  }
47  if(iPS.getUntrackedParameter<bool>("checkAfterEvent")) {
48  iRegistry.watchPostProcessEvent(this, &PrintEventSetupDataRetrieval::postProcessEvent);
49  }
50  }
void postBeginLumi(LuminosityBlock const &, EventSetup const &)
void postBeginRun(Run const &, EventSetup const &)
void postProcessEvent(Event const &, EventSetup const &)
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().

105  {
106  //std::cout <<"postProcessEvent"<<std::endl;
107  m_recordKeys.clear();
108  iES.fillAvailableRecordKeys(m_recordKeys);
109 
110  for(std::vector<eventsetup::EventSetupRecordKey>::const_iterator it = m_recordKeys.begin(), itEnd = m_recordKeys.end();
111  it != itEnd;
112  ++it) {
113  //std::cout <<" "<<it->name()<<std::endl;
114  const eventsetup::EventSetupRecord* r = iES.find(*it);
115  assert(r != 0);
116 
117  RetrievedDataMap::iterator itRetrievedData = m_retrievedDataMap.find(*it);
118  if(itRetrievedData == m_retrievedDataMap.end()) {
119  itRetrievedData = m_retrievedDataMap.insert(std::make_pair(*it,std::pair<unsigned long long, std::map<eventsetup::DataKey,bool> >())).first;
120  itRetrievedData->second.first = r->cacheIdentifier();
121  std::vector<eventsetup::DataKey> keys;
122  r->fillRegisteredDataKeys(keys);
123  for(std::vector<eventsetup::DataKey>::const_iterator itData = keys.begin(), itDataEnd = keys.end();
124  itData != itDataEnd;
125  ++itData) {
126  itRetrievedData->second.second.insert(std::make_pair(*itData,false));
127  }
128  }
129  RetrievedDataMap::value_type& retrievedData = *itRetrievedData;
130  if(itRetrievedData->second.first != r->cacheIdentifier()) {
131  itRetrievedData->second.first = r->cacheIdentifier();
132  for(std::map<eventsetup::DataKey,bool>::iterator itDatum = retrievedData.second.second.begin(), itDatumEnd = retrievedData.second.second.end();
133  itDatum != itDatumEnd;
134  ++itDatum) {
135  itDatum->second = false;
136  }
137  }
138 
139  for(std::map<eventsetup::DataKey,bool>::iterator itDatum = retrievedData.second.second.begin(), itDatumEnd = retrievedData.second.second.end();
140  itDatum != itDatumEnd;
141  ++itDatum) {
142  bool wasGotten = r->wasGotten(itDatum->first);
143  //std::cout <<" "<<itDatum->first.type().name()<<" "<<wasGotten<<std::endl;
144  if(wasGotten != itDatum->second) {
145  itDatum->second = wasGotten;
146  if(m_printProviders) {
147  const edm::eventsetup::ComponentDescription* d = r->providerDescription(itDatum->first);
148  assert(0!=d);
149  edm::LogSystem("PrintEventSetupDataRetrieval")<<"Retrieved> Record:"<<it->name()<<" data:"<<itDatum->first.type().name()<<" '"<<itDatum->first.name().value()
150  <<"' provider:"<<d->type_<<" '"<<d->label_<<"'";
151  } else {
152  edm::LogSystem("PrintEventSetupDataRetrieval")<<"Retrieved> Record:"<<it->name()<<" data:"<<itDatum->first.type().name()<<" '"<<itDatum->first.name().value()<<"'";
153  }
154  //std::cout <<"CHANGED"<<std::endl;
155  }
156  }
157  }
158  }
std::vector< eventsetup::EventSetupRecordKey > m_recordKeys
Container::value_type value_type
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().

61  {
63  desc.addUntracked<bool>("printProviders",false)->setComment(
64  "If 'true' also print which ES module provides the data");
65  desc.addUntracked<bool>("checkAfterBeginRun",false)->setComment(
66  "If 'true' check for retrieved data after each begin run is processed");
67  desc.addUntracked<bool>("checkAfterBeginLumi",false)->setComment(
68  "If 'true' check for retrieved data after each begin lumi is processed");
69  desc.addUntracked<bool>("checkAfterEvent",true)->setComment(
70  "If 'true' check for retrieved data after an event is processed");
71  descriptions.add("PrintEventSetupDataRetrieval", desc);
72  descriptions.setComment("This service reports when EventSetup data is retrieved by a module in the job.");
73  }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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().

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

Definition at line 96 of file PrintEventSetupDataRetrieval.cc.

References check().

Referenced by PrintEventSetupDataRetrieval().

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

Definition at line 91 of file PrintEventSetupDataRetrieval.cc.

References check().

Referenced by PrintEventSetupDataRetrieval().

91  {
92  check(iES);
93  }

Member Data Documentation

bool edm::PrintEventSetupDataRetrieval::m_printProviders
private

Definition at line 60 of file PrintEventSetupDataRetrieval.h.

Referenced by check().

std::vector<eventsetup::EventSetupRecordKey> edm::PrintEventSetupDataRetrieval::m_recordKeys
private

Definition at line 59 of file PrintEventSetupDataRetrieval.h.

Referenced by check().

RetrievedDataMap edm::PrintEventSetupDataRetrieval::m_retrievedDataMap
private

Definition at line 58 of file PrintEventSetupDataRetrieval.h.

Referenced by check().