CMS 3D CMS Logo

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

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
 PrintEventSetupDataRetrieval (edm::ParameterSet const &)
 
- 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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 Types

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

Private Member Functions

void check (EventSetup const &)
 

Private Attributes

const bool m_checkDuringBeginLumi
 
const bool m_checkDuringBeginRun
 
const bool m_checkDuringEvent
 
const bool m_printProviders
 
std::vector< eventsetup::EventSetupRecordKeym_recordKeys
 
RetrievedDataMap m_retrievedDataMap
 

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 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 32 of file PrintEventSetupDataRetrieval.cc.

Member Typedef Documentation

◆ RetrievedDataMap

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

Definition at line 52 of file PrintEventSetupDataRetrieval.cc.

Constructor & Destructor Documentation

◆ PrintEventSetupDataRetrieval()

edm::PrintEventSetupDataRetrieval::PrintEventSetupDataRetrieval ( edm::ParameterSet const &  iPS)

Definition at line 72 of file PrintEventSetupDataRetrieval.cc.

73  : m_printProviders(iPS.getUntrackedParameter<bool>("printProviders")),
74  m_checkDuringBeginRun(iPS.getUntrackedParameter<bool>("checkDuringBeginRun")),
75  m_checkDuringBeginLumi(iPS.getUntrackedParameter<bool>("checkDuringBeginLumi")),
76  m_checkDuringEvent(iPS.getUntrackedParameter<bool>("checkDuringEvent")) {}

Member Function Documentation

◆ analyze()

void edm::PrintEventSetupDataRetrieval::analyze ( edm::Event const &  ,
edm::EventSetup const &  iES 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 116 of file PrintEventSetupDataRetrieval.cc.

References check(), and m_checkDuringEvent.

116  {
117  if (m_checkDuringEvent) {
118  check(iES);
119  }
120  }

◆ beginLuminosityBlock()

void edm::PrintEventSetupDataRetrieval::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &  iES 
)
override

Definition at line 130 of file PrintEventSetupDataRetrieval.cc.

References check(), and m_checkDuringBeginLumi.

130  {
132  check(iES);
133  }
134  }

◆ beginRun()

void edm::PrintEventSetupDataRetrieval::beginRun ( edm::Run const &  ,
edm::EventSetup const &  iES 
)
override

Definition at line 122 of file PrintEventSetupDataRetrieval.cc.

References check(), and m_checkDuringBeginRun.

122  {
123  if (m_checkDuringBeginRun) {
124  check(iES);
125  }
126  }

◆ check()

void edm::PrintEventSetupDataRetrieval::check ( EventSetup const &  iES)
private

Definition at line 138 of file PrintEventSetupDataRetrieval.cc.

References cms::cuda::assert(), ztail::d, edm::EventSetup::fillAvailableRecordKeys(), edm::EventSetup::find(), relativeConstraints::keys, m_printProviders, m_recordKeys, m_retrievedDataMap, and mps_check::msg.

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

138  {
139  //std::cout <<"postProcessEvent"<<std::endl;
140  m_recordKeys.clear();
141  iES.fillAvailableRecordKeys(m_recordKeys);
142 
143  std::unique_ptr<LogSystem> msg;
144  for (std::vector<eventsetup::EventSetupRecordKey>::const_iterator it = m_recordKeys.begin(),
145  itEnd = m_recordKeys.end();
146  it != itEnd;
147  ++it) {
148  //std::cout <<" "<<it->name()<<std::endl;
149  auto r = iES.find(*it);
150  assert(r);
151 
152  RetrievedDataMap::iterator itRetrievedData = m_retrievedDataMap.find(*it);
153  if (itRetrievedData == m_retrievedDataMap.end()) {
154  itRetrievedData =
156  .insert(std::make_pair(*it, std::pair<unsigned long long, std::map<eventsetup::DataKey, bool> >()))
157  .first;
158  itRetrievedData->second.first = r->cacheIdentifier();
159  std::vector<eventsetup::DataKey> keys;
160  r->fillRegisteredDataKeys(keys);
161  for (std::vector<eventsetup::DataKey>::const_iterator itData = keys.begin(), itDataEnd = keys.end();
162  itData != itDataEnd;
163  ++itData) {
164  itRetrievedData->second.second.insert(std::make_pair(*itData, false));
165  }
166  }
167  RetrievedDataMap::value_type& retrievedData = *itRetrievedData;
168  if (itRetrievedData->second.first != r->cacheIdentifier()) {
169  itRetrievedData->second.first = r->cacheIdentifier();
170  for (std::map<eventsetup::DataKey, bool>::iterator itDatum = retrievedData.second.second.begin(),
171  itDatumEnd = retrievedData.second.second.end();
172  itDatum != itDatumEnd;
173  ++itDatum) {
174  itDatum->second = false;
175  }
176  }
177 
178  for (std::map<eventsetup::DataKey, bool>::iterator itDatum = retrievedData.second.second.begin(),
179  itDatumEnd = retrievedData.second.second.end();
180  itDatum != itDatumEnd;
181  ++itDatum) {
182  bool wasGotten = r->wasGotten(itDatum->first);
183  if (wasGotten != itDatum->second) {
184  if (not msg)
185  msg = std::make_unique<LogSystem>("ESContent");
186  else
187  *msg << "\n";
188  itDatum->second = wasGotten;
189  *msg << "Retrieved> record:" << it->name() << " data:" << itDatum->first.type().name() << " '"
190  << itDatum->first.name().value() << "'";
191  if (m_printProviders) {
192  const edm::eventsetup::ComponentDescription* d = r->providerDescription(itDatum->first);
193  assert(nullptr != d);
194  *msg << " provider:" << d->type_ << " '" << d->label_ << "'";
195  }
196  }
197  }
198  }
199  }
assert(be >=bs)
std::vector< eventsetup::EventSetupRecordKey > m_recordKeys
d
Definition: ztail.py:151
tuple msg
Definition: mps_check.py:286

◆ endLuminosityBlock()

void edm::PrintEventSetupDataRetrieval::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
override

Definition at line 136 of file PrintEventSetupDataRetrieval.cc.

136 {}

◆ endRun()

void edm::PrintEventSetupDataRetrieval::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 128 of file PrintEventSetupDataRetrieval.cc.

128 {}

◆ fillDescriptions()

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

Definition at line 87 of file PrintEventSetupDataRetrieval.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and edm::ConfigurationDescriptions::setComment().

87  {
89  desc.addUntracked<bool>("printProviders", false)
90  ->setComment("If 'true' also print which ES module provides the data");
91  desc.addUntracked<bool>("checkDuringBeginRun", false)
92  ->setComment("If 'true' check for retrieved data during each begin run is processed");
93  desc.addUntracked<bool>("checkDuringBeginLumi", false)
94  ->setComment("If 'true' check for retrieved data during each begin lumi is processed");
95  desc.addUntracked<bool>("checkDuringEvent", true)
96  ->setComment("If 'true' check for retrieved data during an event is processed");
97  descriptions.add("PrintEventSetupDataRetrieval", desc);
98  descriptions.setComment("This analyzer reports when EventSetup data is retrieved by a module in the job.");
99  }
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ m_checkDuringBeginLumi

const bool edm::PrintEventSetupDataRetrieval::m_checkDuringBeginLumi
private

Definition at line 58 of file PrintEventSetupDataRetrieval.cc.

Referenced by beginLuminosityBlock().

◆ m_checkDuringBeginRun

const bool edm::PrintEventSetupDataRetrieval::m_checkDuringBeginRun
private

Definition at line 57 of file PrintEventSetupDataRetrieval.cc.

Referenced by beginRun().

◆ m_checkDuringEvent

const bool edm::PrintEventSetupDataRetrieval::m_checkDuringEvent
private

Definition at line 59 of file PrintEventSetupDataRetrieval.cc.

Referenced by analyze().

◆ m_printProviders

const bool edm::PrintEventSetupDataRetrieval::m_printProviders
private

Definition at line 56 of file PrintEventSetupDataRetrieval.cc.

Referenced by check().

◆ m_recordKeys

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

Definition at line 55 of file PrintEventSetupDataRetrieval.cc.

Referenced by check().

◆ m_retrievedDataMap

RetrievedDataMap edm::PrintEventSetupDataRetrieval::m_retrievedDataMap
private

Definition at line 54 of file PrintEventSetupDataRetrieval.cc.

Referenced by check().