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::one::EDAnalyzer<> edm::one::EDAnalyzerBase 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::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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)
 

Private Member Functions

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

Private Attributes

const edm::ESGetToken< ESADCToGeVConstant, ESADCToGeVConstantRcdesADCToGeVConstantToken_
 
const edm::ESGetToken< ESChannelStatus, ESChannelStatusRcdesChannelStatusToken_
 
const edm::ESGetToken< ESIntercalibConstants, ESIntercalibConstantsRcdesIntercalibConstantsToken_
 
const edm::ESGetToken< ESPedestals, ESPedestalsRcdesPedestalsToken_
 
const edm::ESGetToken< ESTBWeights, ESTBWeightsRcdesTBWeightsToken_
 
const edm::ESGetToken< ESWeightStripGroups, ESWeightStripGroupsRcdesWeightStripGroupsToken_
 
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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 31 of file ESDBCopy.h.

Constructor & Destructor Documentation

◆ ESDBCopy()

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

Definition at line 11 of file ESDBCopy.cc.

References edm::ParameterSet::getParameter(), m_cacheIDs, m_records, AlCaHarvesting_cff::record, and AlCaHLTBitMon_QueryRunRegistry::string.

12  : m_timetype(iConfig.getParameter<std::string>("timetype")),
13  m_cacheIDs(),
14  m_records(),
21  std::string container;
23  typedef std::vector<edm::ParameterSet> Parameters;
24  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
25  for (const auto& iparam : toCopy) {
26  container = iparam.getParameter<std::string>("container");
27  record = iparam.getParameter<std::string>("record");
28  m_cacheIDs.emplace(container, 0);
29  m_records.emplace(container, record);
30  }
31 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::map< std::string, unsigned long long > m_cacheIDs
Definition: ESDBCopy.h:43
const edm::ESGetToken< ESPedestals, ESPedestalsRcd > esPedestalsToken_
Definition: ESDBCopy.h:46
const edm::ESGetToken< ESWeightStripGroups, ESWeightStripGroupsRcd > esWeightStripGroupsToken_
Definition: ESDBCopy.h:50
const edm::ESGetToken< ESIntercalibConstants, ESIntercalibConstantsRcd > esIntercalibConstantsToken_
Definition: ESDBCopy.h:49
const edm::ESGetToken< ESChannelStatus, ESChannelStatusRcd > esChannelStatusToken_
Definition: ESDBCopy.h:48
std::map< std::string, std::string > m_records
Definition: ESDBCopy.h:44
std::vector< AlignmentParameters * > Parameters
Definition: Utilities.h:32
const edm::ESGetToken< ESADCToGeVConstant, ESADCToGeVConstantRcd > esADCToGeVConstantToken_
Definition: ESDBCopy.h:47
const edm::ESGetToken< ESTBWeights, ESTBWeightsRcd > esTBWeightsToken_
Definition: ESDBCopy.h:51
std::string m_timetype
Definition: ESDBCopy.h:42

◆ ~ESDBCopy()

ESDBCopy::~ESDBCopy ( )
override

Definition at line 33 of file ESDBCopy.cc.

33 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 35 of file ESDBCopy.cc.

References copyToDB(), m_records, and shouldCopy().

35  {
36  for (const auto& irec : m_records) {
37  if (shouldCopy(evtSetup, irec.first)) {
38  copyToDB(evtSetup, irec.first);
39  }
40  }
41 }
bool shouldCopy(const edm::EventSetup &evtSetup, const std::string &container)
Definition: ESDBCopy.cc:43
void copyToDB(const edm::EventSetup &evtSetup, const std::string &container)
Definition: ESDBCopy.cc:69
std::map< std::string, std::string > m_records
Definition: ESDBCopy.h:44

◆ copyToDB()

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

Definition at line 69 of file ESDBCopy.cc.

References cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createOneIOV(), esADCToGeVConstantToken_, esChannelStatusToken_, esIntercalibConstantsToken_, esPedestalsToken_, esTBWeightsToken_, esWeightStripGroupsToken_, Exception, edm::EventSetup::getData(), edm::Service< T >::isAvailable(), m_records, getGTfromDQMFile::obj, align_cfg::recordName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

69  {
71  if (!dbOutput.isAvailable()) {
72  throw cms::Exception("PoolDBOutputService is not available");
73  }
74 
75  std::string recordName = m_records[container];
76 
77  if (container == "ESPedestals") {
78  const auto& obj = evtSetup.getData(esPedestalsToken_);
79  edm::LogInfo("ESDBCopy") << "ped pointer is: " << &obj;
80  dbOutput->createOneIOV<const ESPedestals>(obj, dbOutput->beginOfTime(), recordName);
81 
82  } else if (container == "ESADCToGeVConstant") {
83  const auto& obj = evtSetup.getData(esADCToGeVConstantToken_);
84  edm::LogInfo("ESDBCopy") << "adc pointer is: " << &obj;
85  dbOutput->createOneIOV<const ESADCToGeVConstant>(obj, dbOutput->beginOfTime(), recordName);
86 
87  } else if (container == "ESChannelStatus") {
88  const auto& obj = evtSetup.getData(esChannelStatusToken_);
89  edm::LogInfo("ESDBCopy") << "channel status pointer is: " << &obj;
90  dbOutput->createOneIOV<const ESChannelStatus>(obj, dbOutput->beginOfTime(), recordName);
91 
92  } else if (container == "ESIntercalibConstants") {
93  const auto& obj = evtSetup.getData(esIntercalibConstantsToken_);
94  edm::LogInfo("ESDBCopy") << "inter pointer is: " << &obj;
95  dbOutput->createOneIOV<const ESIntercalibConstants>(obj, dbOutput->beginOfTime(), recordName);
96 
97  } else if (container == "ESWeightStripGroups") {
98  const auto& obj = evtSetup.getData(esWeightStripGroupsToken_);
99  edm::LogInfo("ESDBCopy") << "weight pointer is: " << &obj;
100  dbOutput->createOneIOV<const ESWeightStripGroups>(obj, dbOutput->beginOfTime(), recordName);
101 
102  } else if (container == "ESTBWeights") {
103  const auto& obj = evtSetup.getData(esTBWeightsToken_);
104  edm::LogInfo("ESDBCopy") << "tbweight pointer is: " << &obj;
105  dbOutput->createOneIOV<const ESTBWeights>(obj, dbOutput->beginOfTime(), recordName);
106 
107  } else {
108  throw cms::Exception("Unknown container");
109  }
110 
111  edm::LogInfo("ESDBCopy") << "ESDBCopy wrote " << recordName;
112 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< ESPedestals, ESPedestalsRcd > esPedestalsToken_
Definition: ESDBCopy.h:46
const edm::ESGetToken< ESWeightStripGroups, ESWeightStripGroupsRcd > esWeightStripGroupsToken_
Definition: ESDBCopy.h:50
const edm::ESGetToken< ESIntercalibConstants, ESIntercalibConstantsRcd > esIntercalibConstantsToken_
Definition: ESDBCopy.h:49
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
const edm::ESGetToken< ESChannelStatus, ESChannelStatusRcd > esChannelStatusToken_
Definition: ESDBCopy.h:48
Log< level::Info, false > LogInfo
std::map< std::string, std::string > m_records
Definition: ESDBCopy.h:44
const edm::ESGetToken< ESADCToGeVConstant, ESADCToGeVConstantRcd > esADCToGeVConstantToken_
Definition: ESDBCopy.h:47
const edm::ESGetToken< ESTBWeights, ESTBWeightsRcd > esTBWeightsToken_
Definition: ESDBCopy.h:51
bool isAvailable() const
Definition: Service.h:40

◆ shouldCopy()

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

Definition at line 43 of file ESDBCopy.cc.

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

Referenced by analyze().

43  {
44  unsigned long long cacheID = 0;
45  if (container == "ESPedestals") {
46  cacheID = evtSetup.get<ESPedestalsRcd>().cacheIdentifier();
47  } else if (container == "ESADCToGeVConstant") {
48  cacheID = evtSetup.get<ESADCToGeVConstantRcd>().cacheIdentifier();
49  } else if (container == "ESIntercalibConstants") {
50  cacheID = evtSetup.get<ESIntercalibConstantsRcd>().cacheIdentifier();
51  } else if (container == "ESWeightStripGroups") {
52  cacheID = evtSetup.get<ESWeightStripGroupsRcd>().cacheIdentifier();
53  } else if (container == "ESTBWeights") {
54  cacheID = evtSetup.get<ESTBWeightsRcd>().cacheIdentifier();
55  } else if (container == "ESChannelStatus") {
56  cacheID = evtSetup.get<ESChannelStatusRcd>().cacheIdentifier();
57  } else {
58  throw cms::Exception("Unknown container");
59  }
60 
61  if (m_cacheIDs[container] == cacheID) {
62  return false;
63  } else {
64  m_cacheIDs[container] = cacheID;
65  return true;
66  }
67 }
std::map< std::string, unsigned long long > m_cacheIDs
Definition: ESDBCopy.h:43
T get() const
Definition: EventSetup.h:79

Member Data Documentation

◆ esADCToGeVConstantToken_

const edm::ESGetToken<ESADCToGeVConstant, ESADCToGeVConstantRcd> ESDBCopy::esADCToGeVConstantToken_
private

Definition at line 47 of file ESDBCopy.h.

Referenced by copyToDB().

◆ esChannelStatusToken_

const edm::ESGetToken<ESChannelStatus, ESChannelStatusRcd> ESDBCopy::esChannelStatusToken_
private

Definition at line 48 of file ESDBCopy.h.

Referenced by copyToDB().

◆ esIntercalibConstantsToken_

const edm::ESGetToken<ESIntercalibConstants, ESIntercalibConstantsRcd> ESDBCopy::esIntercalibConstantsToken_
private

Definition at line 49 of file ESDBCopy.h.

Referenced by copyToDB().

◆ esPedestalsToken_

const edm::ESGetToken<ESPedestals, ESPedestalsRcd> ESDBCopy::esPedestalsToken_
private

Definition at line 46 of file ESDBCopy.h.

Referenced by copyToDB().

◆ esTBWeightsToken_

const edm::ESGetToken<ESTBWeights, ESTBWeightsRcd> ESDBCopy::esTBWeightsToken_
private

Definition at line 51 of file ESDBCopy.h.

Referenced by copyToDB().

◆ esWeightStripGroupsToken_

const edm::ESGetToken<ESWeightStripGroups, ESWeightStripGroupsRcd> ESDBCopy::esWeightStripGroupsToken_
private

Definition at line 50 of file ESDBCopy.h.

Referenced by copyToDB().

◆ m_cacheIDs

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

Definition at line 43 of file ESDBCopy.h.

Referenced by ESDBCopy(), and shouldCopy().

◆ m_records

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

Definition at line 44 of file ESDBCopy.h.

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

◆ m_timetype

std::string ESDBCopy::m_timetype
private

Definition at line 42 of file ESDBCopy.h.