CMS 3D CMS Logo

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

#include <EcalTPGDBCopy.h>

Inheritance diagram for EcalTPGDBCopy:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
 EcalTPGDBCopy (const edm::ParameterSet &iConfig)
 
 ~EcalTPGDBCopy () 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
 
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 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 EcalTPGDBCopy.h.

Constructor & Destructor Documentation

◆ EcalTPGDBCopy()

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

Definition at line 47 of file EcalTPGDBCopy.cc.

48  : m_timetype(iConfig.getParameter<std::string>("timetype")), m_cacheIDs(), m_records() {
49  std::string container;
52  typedef std::vector<edm::ParameterSet> Parameters;
53  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
54  for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) {
55  container = i->getParameter<std::string>("container");
56  record = i->getParameter<std::string>("record");
57  m_cacheIDs.insert(std::make_pair(container, 0));
58  m_records.insert(std::make_pair(container, record));
59  }
60 }

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.

◆ ~EcalTPGDBCopy()

EcalTPGDBCopy::~EcalTPGDBCopy ( )
override

Definition at line 62 of file EcalTPGDBCopy.cc.

62 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 64 of file EcalTPGDBCopy.cc.

64  {
65  std::string container;
67  typedef std::map<std::string, std::string>::const_iterator recordIter;
68  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
69  container = (*i).first;
70  record = (*i).second;
71  if (shouldCopy(evtSetup, container)) {
72  copyToDB(evtSetup, container);
73  }
74  }
75 }

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

◆ copyToDB()

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

Definition at line 124 of file EcalTPGDBCopy.cc.

124  {
126  if (!dbOutput.isAvailable()) {
127  throw cms::Exception("PoolDBOutputService is not available");
128  }
129 
130  std::string recordName = m_records[container];
131 
132  if (container == "EcalTPGPedestals") {
134  evtSetup.get<EcalTPGPedestalsRcd>().get(handle);
135  const EcalTPGPedestals* obj = handle.product();
136  dbOutput->createNewIOV<const EcalTPGPedestals>(
137  new EcalTPGPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
138 
139  } else if (container == "EcalTPGLinearizationConst") {
142  const EcalTPGLinearizationConst* obj = handle.product();
143 
144  dbOutput->createNewIOV<const EcalTPGLinearizationConst>(
145  new EcalTPGLinearizationConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
146 
147  } else if (container == "EcalTPGSlidingWindow") {
149  evtSetup.get<EcalTPGSlidingWindowRcd>().get(handle);
150  const EcalTPGSlidingWindow* obj = handle.product();
151 
152  dbOutput->createNewIOV<const EcalTPGSlidingWindow>(
153  new EcalTPGSlidingWindow(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
154 
155  } else if (container == "EcalTPGFineGrainEBIdMap") {
158  const EcalTPGFineGrainEBIdMap* obj = handle.product();
159  dbOutput->createNewIOV<const EcalTPGFineGrainEBIdMap>(
160  new EcalTPGFineGrainEBIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
161 
162  } else if (container == "EcalTPGFineGrainStripEE") {
165  const EcalTPGFineGrainStripEE* obj = handle.product();
166  dbOutput->createNewIOV<const EcalTPGFineGrainStripEE>(
167  new EcalTPGFineGrainStripEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
168 
169  } else if (container == "EcalTPGFineGrainTowerEE") {
172  const EcalTPGFineGrainTowerEE* obj = handle.product();
173  dbOutput->createNewIOV<const EcalTPGFineGrainTowerEE>(
174  new EcalTPGFineGrainTowerEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
175 
176  } else if (container == "EcalTPGLutIdMap") {
178  evtSetup.get<EcalTPGLutIdMapRcd>().get(handle);
179  const EcalTPGLutIdMap* obj = handle.product();
180  dbOutput->createNewIOV<const EcalTPGLutIdMap>(
181  new EcalTPGLutIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
182 
183  } else if (container == "EcalTPGWeightIdMap") {
185  evtSetup.get<EcalTPGWeightIdMapRcd>().get(handle);
186  const EcalTPGWeightIdMap* obj = handle.product();
187  dbOutput->createNewIOV<const EcalTPGWeightIdMap>(
188  new EcalTPGWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
189 
190  } else if (container == "EcalTPGWeightGroup") {
192  evtSetup.get<EcalTPGWeightGroupRcd>().get(handle);
193  const EcalTPGWeightGroup* obj = handle.product();
194  dbOutput->createNewIOV<const EcalTPGWeightGroup>(
195  new EcalTPGWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
196 
197  } else if (container == "EcalTPGLutGroup") {
199  evtSetup.get<EcalTPGLutGroupRcd>().get(handle);
200  const EcalTPGLutGroup* obj = handle.product();
201  dbOutput->createNewIOV<const EcalTPGLutGroup>(
202  new EcalTPGLutGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
203 
204  } else if (container == "EcalTPGFineGrainEBGroup") {
207 
208  const EcalTPGFineGrainEBGroup* obj = handle.product();
209 
210  dbOutput->createNewIOV<const EcalTPGFineGrainEBGroup>(
211  new EcalTPGFineGrainEBGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
212 
213  } else if (container == "EcalTPGPhysicsConst") {
215  evtSetup.get<EcalTPGPhysicsConstRcd>().get(handle);
216  const EcalTPGPhysicsConst* obj = handle.product();
217  dbOutput->createNewIOV<const EcalTPGPhysicsConst>(
218  new EcalTPGPhysicsConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
219 
220  } else if (container == "EcalTPGCrystalStatus") {
222  evtSetup.get<EcalTPGCrystalStatusRcd>().get(handle);
223  const EcalTPGCrystalStatus* obj = handle.product();
224  dbOutput->createNewIOV<const EcalTPGCrystalStatus>(
225  new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
226 
227  } else if (container == "EcalTPGTowerStatus") {
229  evtSetup.get<EcalTPGTowerStatusRcd>().get(handle);
230  const EcalTPGTowerStatus* obj = handle.product();
231  dbOutput->createNewIOV<const EcalTPGTowerStatus>(
232  new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
233 
234  } else if (container == "EcalTPGSpike") {
236  evtSetup.get<EcalTPGSpikeRcd>().get(handle);
237  const EcalTPGSpike* obj = handle.product();
238 
239  dbOutput->createNewIOV<const EcalTPGSpike>(
240  new EcalTPGSpike(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
241 
242  } else if (container == "EcalTPGStripStatus") {
244  evtSetup.get<EcalTPGStripStatusRcd>().get(handle);
245  const EcalTPGStripStatus* obj = handle.product();
246  dbOutput->createNewIOV<const EcalTPGStripStatus>(
247  new EcalTPGStripStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
248 
249  }
250 
251  else {
252  throw cms::Exception("Unknown container");
253  }
254 
255  std::cout << "EcalTPGDBCopy wrote " << recordName << std::endl;
256 }

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 EcalTPGDBCopy::shouldCopy ( const edm::EventSetup evtSetup,
std::string  container 
)
private

Definition at line 77 of file EcalTPGDBCopy.cc.

77  {
78  unsigned long long cacheID = 0;
79 
80  if (container == "EcalTPGPedestals") {
81  cacheID = evtSetup.get<EcalTPGPedestalsRcd>().cacheIdentifier();
82  } else if (container == "EcalTPGLinearizationConst") {
83  cacheID = evtSetup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier();
84  } else if (container == "EcalTPGSlidingWindow") {
85  cacheID = evtSetup.get<EcalTPGSlidingWindowRcd>().cacheIdentifier();
86  } else if (container == "EcalTPGFineGrainEBIdMap") {
87  cacheID = evtSetup.get<EcalTPGFineGrainEBIdMapRcd>().cacheIdentifier();
88  } else if (container == "EcalTPGFineGrainStripEE") {
89  cacheID = evtSetup.get<EcalTPGFineGrainStripEERcd>().cacheIdentifier();
90  } else if (container == "EcalTPGFineGrainTowerEE") {
91  cacheID = evtSetup.get<EcalTPGFineGrainTowerEERcd>().cacheIdentifier();
92  } else if (container == "EcalTPGLutIdMap") {
93  cacheID = evtSetup.get<EcalTPGLutIdMapRcd>().cacheIdentifier();
94  } else if (container == "EcalTPGWeightIdMap") {
95  cacheID = evtSetup.get<EcalTPGWeightIdMapRcd>().cacheIdentifier();
96  } else if (container == "EcalTPGWeightGroup") {
97  cacheID = evtSetup.get<EcalTPGWeightGroupRcd>().cacheIdentifier();
98  } else if (container == "EcalTPGLutGroup") {
99  cacheID = evtSetup.get<EcalTPGLutGroupRcd>().cacheIdentifier();
100  } else if (container == "EcalTPGFineGrainEBGroup") {
101  cacheID = evtSetup.get<EcalTPGFineGrainEBGroupRcd>().cacheIdentifier();
102  } else if (container == "EcalTPGPhysicsConst") {
103  cacheID = evtSetup.get<EcalTPGPhysicsConstRcd>().cacheIdentifier();
104  } else if (container == "EcalTPGCrystalStatus") {
105  cacheID = evtSetup.get<EcalTPGCrystalStatusRcd>().cacheIdentifier();
106  } else if (container == "EcalTPGTowerStatus") {
107  cacheID = evtSetup.get<EcalTPGTowerStatusRcd>().cacheIdentifier();
108  } else if (container == "EcalTPGSpike") {
109  cacheID = evtSetup.get<EcalTPGSpikeRcd>().cacheIdentifier();
110  } else if (container == "EcalTPGStripStatus") {
111  cacheID = evtSetup.get<EcalTPGStripStatusRcd>().cacheIdentifier();
112  } else {
113  throw cms::Exception("Unknown container");
114  }
115 
116  if (m_cacheIDs[container] == cacheID) {
117  return false;
118  } else {
119  m_cacheIDs[container] = cacheID;
120  return true;
121  }
122 }

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

Referenced by analyze().

Member Data Documentation

◆ m_cacheIDs

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

Definition at line 30 of file EcalTPGDBCopy.h.

Referenced by EcalTPGDBCopy(), and shouldCopy().

◆ m_records

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

Definition at line 31 of file EcalTPGDBCopy.h.

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

◆ m_timetype

std::string EcalTPGDBCopy::m_timetype
private

Definition at line 29 of file EcalTPGDBCopy.h.

EcalTPGWeightIdMap
Definition: EcalTPGWeightIdMap.h:10
mps_fire.i
i
Definition: mps_fire.py:355
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:187
EcalTPGFineGrainTowerEERcd
Definition: EcalTPGFineGrainTowerEERcd.h:5
patZpeak.handle
handle
Definition: patZpeak.py:23
EcalTPGSpike
Definition: EcalTPGSpike.h:9
align_cfg.recordName
recordName
Definition: align_cfg.py:66
EcalTPGFineGrainStripEE
Definition: EcalTPGFineGrainStripEE.h:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalTPGCrystalStatusRcd
Definition: EcalTPGCrystalStatusRcd.h:5
EcalTPGPedestals
EcalTPGPedestalsMap EcalTPGPedestals
Definition: EcalTPGPedestals.h:19
EcalTPGFineGrainEBIdMap
Definition: EcalTPGFineGrainEBIdMap.h:10
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
EcalTPGPedestalsRcd
Definition: EcalTPGPedestalsRcd.h:5
EcalTPGDBCopy::shouldCopy
bool shouldCopy(const edm::EventSetup &evtSetup, std::string container)
Definition: EcalTPGDBCopy.cc:77
EcalTPGWeightGroup
Definition: EcalTPGWeightGroup.h:13
EcalCondObjectContainer< EcalTPGPedestal >
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
EcalTPGFineGrainStripEERcd
Definition: EcalTPGFineGrainStripEERcd.h:5
EcalTPGLutGroup
Definition: EcalTPGLutGroup.h:13
EcalTPGDBCopy::m_records
std::map< std::string, std::string > m_records
Definition: EcalTPGDBCopy.h:31
EcalTPGStripStatusRcd
Definition: EcalTPGStripStatusRcd.h:5
EcalTPGSlidingWindow
Definition: EcalTPGSlidingWindow.h:9
EcalTPGFineGrainTowerEE
Definition: EcalTPGFineGrainTowerEE.h:9
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
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
EcalTPGDBCopy::m_cacheIDs
std::map< std::string, unsigned long long > m_cacheIDs
Definition: EcalTPGDBCopy.h:30
edm::ESHandle
Definition: DTSurvey.h:22
EcalTPGSpikeRcd
Definition: EcalTPGSpikeRcd.h:5
EcalTPGFineGrainEBGroupRcd
Definition: EcalTPGFineGrainEBGroupRcd.h:5
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
EcalTPGLutIdMap
Definition: EcalTPGLutIdMap.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalTPGFineGrainEBGroup
Definition: EcalTPGFineGrainEBGroup.h:13
EcalTPGDBCopy::m_timetype
std::string m_timetype
Definition: EcalTPGDBCopy.h:29
EcalTPGDBCopy::copyToDB
void copyToDB(const edm::EventSetup &evtSetup, std::string container)
Definition: EcalTPGDBCopy.cc:124
EcalTPGFineGrainEBIdMapRcd
Definition: EcalTPGFineGrainEBIdMapRcd.h:5
edm::Service< cond::service::PoolDBOutputService >
get
#define get
EcalTPGWeightGroupRcd
Definition: EcalTPGWeightGroupRcd.h:5
EcalTPGPhysicsConst
Definition: EcalTPGPhysicsConst.h:9
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:185
EcalTPGCrystalStatus
EcalTPGCrystalStatusMap EcalTPGCrystalStatus
Definition: EcalTPGCrystalStatus.h:19
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalTPGLutIdMapRcd
Definition: EcalTPGLutIdMapRcd.h:5
EcalTPGTowerStatus
Definition: EcalTPGTowerStatus.h:9
EcalTPGWeightIdMapRcd
Definition: EcalTPGWeightIdMapRcd.h:5
EcalTPGSlidingWindowRcd
Definition: EcalTPGSlidingWindowRcd.h:5
Exception
Definition: hltDiff.cc:246
EcalTPGStripStatus
Definition: EcalTPGStripStatus.h:9
EcalTPGLutGroupRcd
Definition: EcalTPGLutGroupRcd.h:5
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
EcalTPGTowerStatusRcd
Definition: EcalTPGTowerStatusRcd.h:5
EcalTPGLinearizationConstRcd
Definition: EcalTPGLinearizationConstRcd.h:5
EcalTPGLinearizationConst
EcalTPGLinearizationConstMap EcalTPGLinearizationConst
Definition: EcalTPGLinearizationConst.h:23
EcalTPGPhysicsConstRcd
Definition: EcalTPGPhysicsConstRcd.h:5