CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ESDBCopy Class Reference

#include <ESDBCopy.h>

Inheritance diagram for ESDBCopy:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
 ESDBCopy (const edm::ParameterSet &iConfig)
 
 ~ESDBCopy () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void copyToDB (const edm::EventSetup &evtSetup, std::string container)
 
bool shouldCopy (const edm::EventSetup &evtSetup, std::string container)
 

Private Attributes

std::map< std::string, unsigned long long > m_cacheIDs
 
std::map< std::string, std::string > m_records
 
std::string m_timetype
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 18 of file ESDBCopy.h.

Constructor & Destructor Documentation

◆ ESDBCopy()

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

Definition at line 25 of file ESDBCopy.cc.

26  : m_timetype(iConfig.getParameter<std::string>("timetype")), m_cacheIDs(), m_records() {
27  std::string container;
30  typedef std::vector<edm::ParameterSet> Parameters;
31  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
32  for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) {
33  container = i->getParameter<std::string>("container");
34  record = i->getParameter<std::string>("record");
35  m_cacheIDs.insert(std::make_pair(container, 0));
36  m_records.insert(std::make_pair(container, record));
37  }
38 }

References edm::ParameterSet::getParameter(), mps_fire::i, m_cacheIDs, m_records, GlobalPosition_Frontier_DevDB_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

◆ ~ESDBCopy()

ESDBCopy::~ESDBCopy ( )
override

Definition at line 40 of file ESDBCopy.cc.

40 {}

Member Function Documentation

◆ analyze()

void ESDBCopy::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 42 of file ESDBCopy.cc.

42  {
43  std::string container;
45  typedef std::map<std::string, std::string>::const_iterator recordIter;
46  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
47  container = (*i).first;
48  record = (*i).second;
49  if (shouldCopy(evtSetup, container)) {
50  copyToDB(evtSetup, container);
51  }
52  }
53 }

References copyToDB(), mps_fire::i, m_records, GlobalPosition_Frontier_DevDB_cff::record, shouldCopy(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ copyToDB()

void ESDBCopy::copyToDB ( const edm::EventSetup evtSetup,
std::string  container 
)
private

Definition at line 83 of file ESDBCopy.cc.

83  {
85  if (!dbOutput.isAvailable()) {
86  throw cms::Exception("PoolDBOutputService is not available");
87  }
88 
89  std::string recordName = m_records[container];
90 
91  if (container == "ESPedestals") {
93  evtSetup.get<ESPedestalsRcd>().get(handle);
94  const ESPedestals* obj = handle.product();
95  std::cout << "ped pointer is: " << obj << std::endl;
96  dbOutput->createNewIOV<const ESPedestals>(
97  new ESPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
98 
99  } else if (container == "ESADCToGeVConstant") {
101  evtSetup.get<ESADCToGeVConstantRcd>().get(handle);
102  const ESADCToGeVConstant* obj = handle.product();
103  std::cout << "adc pointer is: " << obj << std::endl;
104 
105  dbOutput->createNewIOV<const ESADCToGeVConstant>(
106  new ESADCToGeVConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
107 
108  } else if (container == "ESChannelStatus") {
110  evtSetup.get<ESChannelStatusRcd>().get(handle);
111  const ESChannelStatus* obj = handle.product();
112  std::cout << "channel status pointer is: " << obj << std::endl;
113 
114  dbOutput->createNewIOV<const ESChannelStatus>(
115  new ESChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
116 
117  } else if (container == "ESIntercalibConstants") {
119  evtSetup.get<ESIntercalibConstantsRcd>().get(handle);
120  const ESIntercalibConstants* obj = handle.product();
121  std::cout << "inter pointer is: " << obj << std::endl;
122  dbOutput->createNewIOV<const ESIntercalibConstants>(
123  new ESIntercalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
124 
125  } else if (container == "ESWeightStripGroups") {
127  evtSetup.get<ESWeightStripGroupsRcd>().get(handle);
128  const ESWeightStripGroups* obj = handle.product();
129  std::cout << "weight pointer is: " << obj << std::endl;
130  dbOutput->createNewIOV<const ESWeightStripGroups>(
131  new ESWeightStripGroups(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
132 
133  } else if (container == "ESTBWeights") {
135  evtSetup.get<ESTBWeightsRcd>().get(handle);
136  const ESTBWeights* obj = handle.product();
137  std::cout << "tbweight pointer is: " << obj << std::endl;
138  dbOutput->createNewIOV<const ESTBWeights>(
139  new ESTBWeights(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
140 
141  } else {
142  throw cms::Exception("Unknown container");
143  }
144 
145  std::cout << "ESDBCopy wrote " << recordName << std::endl;
146 }

References cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::endOfTime(), Exception, edm::EventSetup::get(), get, patZpeak::handle, edm::Service< T >::isAvailable(), m_records, getGTfromDQMFile::obj, align_cfg::recordName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

◆ shouldCopy()

bool ESDBCopy::shouldCopy ( const edm::EventSetup evtSetup,
std::string  container 
)
private

Definition at line 55 of file ESDBCopy.cc.

55  {
56  unsigned long long cacheID = 0;
57  if (container == "ESPedestals") {
58  cacheID = evtSetup.get<ESPedestalsRcd>().cacheIdentifier();
59  } else if (container == "ESADCToGeVConstant") {
60  cacheID = evtSetup.get<ESADCToGeVConstantRcd>().cacheIdentifier();
61  } else if (container == "ESIntercalibConstants") {
62  cacheID = evtSetup.get<ESIntercalibConstantsRcd>().cacheIdentifier();
63  } else if (container == "ESWeightStripGroups") {
64  cacheID = evtSetup.get<ESWeightStripGroupsRcd>().cacheIdentifier();
65  } else if (container == "ESTBWeights") {
66  cacheID = evtSetup.get<ESTBWeightsRcd>().cacheIdentifier();
67  } else if (container == "ESChannelStatus") {
68  cacheID = evtSetup.get<ESChannelStatusRcd>().cacheIdentifier();
69  }
70 
71  else {
72  throw cms::Exception("Unknown container");
73  }
74 
75  if (m_cacheIDs[container] == cacheID) {
76  return false;
77  } else {
78  m_cacheIDs[container] = cacheID;
79  return true;
80  }
81 }

References Exception, edm::EventSetup::get(), and m_cacheIDs.

Referenced by analyze().

Member Data Documentation

◆ m_cacheIDs

std::map<std::string, unsigned long long> ESDBCopy::m_cacheIDs
private

Definition at line 30 of file ESDBCopy.h.

Referenced by ESDBCopy(), and shouldCopy().

◆ m_records

std::map<std::string, std::string> ESDBCopy::m_records
private

Definition at line 31 of file ESDBCopy.h.

Referenced by analyze(), copyToDB(), and ESDBCopy().

◆ m_timetype

std::string ESDBCopy::m_timetype
private

Definition at line 29 of file ESDBCopy.h.

ESPedestalsRcd
Definition: ESPedestalsRcd.h:5
mps_fire.i
i
Definition: mps_fire.py:428
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:187
ESDBCopy::m_records
std::map< std::string, std::string > m_records
Definition: ESDBCopy.h:31
ESChannelStatusRcd
Definition: ESChannelStatusRcd.h:5
patZpeak.handle
handle
Definition: patZpeak.py:23
align_cfg.recordName
recordName
Definition: align_cfg.py:66
ESADCToGeVConstantRcd
Definition: ESADCToGeVConstantRcd.h:5
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ESTBWeightsRcd
Definition: ESTBWeightsRcd.h:5
ESADCToGeVConstant
Definition: ESADCToGeVConstant.h:7
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
ESDBCopy::m_timetype
std::string m_timetype
Definition: ESDBCopy.h:29
ESChannelStatus
ESChannelStatusMap ESChannelStatus
Definition: ESChannelStatus.h:7
ESWeightStripGroups
ESCondObjectContainer< ESStripGroupId > ESWeightStripGroups
Definition: ESWeightStripGroups.h:12
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:110
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::ESHandle
Definition: DTSurvey.h:22
ESDBCopy::shouldCopy
bool shouldCopy(const edm::EventSetup &evtSetup, std::string container)
Definition: ESDBCopy.cc:55
ESTBWeights
Definition: ESTBWeights.h:10
ESIntercalibConstantsRcd
Definition: ESIntercalibConstantsRcd.h:5
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Service< cond::service::PoolDBOutputService >
get
#define get
ESCondObjectContainer< ESPedestal >
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:185
ESWeightStripGroupsRcd
Definition: ESWeightStripGroupsRcd.h:5
Exception
Definition: hltDiff.cc:246
ESPedestals
ESPedestalsMap ESPedestals
Definition: ESPedestals.h:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ESIntercalibConstants
ESIntercalibConstantMap ESIntercalibConstants
Definition: ESIntercalibConstants.h:7
ESDBCopy::m_cacheIDs
std::map< std::string, unsigned long long > m_cacheIDs
Definition: ESDBCopy.h:30
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
ESDBCopy::copyToDB
void copyToDB(const edm::EventSetup &evtSetup, std::string container)
Definition: ESDBCopy.cc:83