CMS 3D CMS Logo

EcalTPGDBCopy.cc
Go to the documentation of this file.
3 
5 
8 
28 
48 
49 #include "EcalTPGDBCopy.h"
50 
51 #include <vector>
52 
54  : m_timetype(iConfig.getParameter<std::string>("timetype")), m_cacheIDs(), m_records() {
55  std::string container;
58  typedef std::vector<edm::ParameterSet> Parameters;
59  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
60  for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) {
61  container = i->getParameter<std::string>("container");
62  record = i->getParameter<std::string>("record");
63  m_cacheIDs.insert(std::make_pair(container, 0));
64  m_records.insert(std::make_pair(container, record));
65  }
66 }
67 
69 
70 void EcalTPGDBCopy::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
71  std::string container;
73  typedef std::map<std::string, std::string>::const_iterator recordIter;
74  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
75  container = (*i).first;
76  record = (*i).second;
77  if (shouldCopy(evtSetup, container)) {
78  copyToDB(evtSetup, container);
79  }
80  }
81 }
82 
83 bool EcalTPGDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container) {
84  unsigned long long cacheID = 0;
85 
86  if (container == "EcalTPGPedestals") {
87  cacheID = evtSetup.get<EcalTPGPedestalsRcd>().cacheIdentifier();
88  } else if (container == "EcalTPGLinearizationConst") {
89  cacheID = evtSetup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier();
90  } else if (container == "EcalTPGSlidingWindow") {
91  cacheID = evtSetup.get<EcalTPGSlidingWindowRcd>().cacheIdentifier();
92  } else if (container == "EcalTPGFineGrainEBIdMap") {
93  cacheID = evtSetup.get<EcalTPGFineGrainEBIdMapRcd>().cacheIdentifier();
94  } else if (container == "EcalTPGFineGrainStripEE") {
95  cacheID = evtSetup.get<EcalTPGFineGrainStripEERcd>().cacheIdentifier();
96  } else if (container == "EcalTPGFineGrainTowerEE") {
97  cacheID = evtSetup.get<EcalTPGFineGrainTowerEERcd>().cacheIdentifier();
98  } else if (container == "EcalTPGLutIdMap") {
99  cacheID = evtSetup.get<EcalTPGLutIdMapRcd>().cacheIdentifier();
100  } else if (container == "EcalTPGWeightIdMap") {
101  cacheID = evtSetup.get<EcalTPGWeightIdMapRcd>().cacheIdentifier();
102  } else if (container == "EcalTPGWeightGroup") {
103  cacheID = evtSetup.get<EcalTPGWeightGroupRcd>().cacheIdentifier();
104  } else if (container == "EcalTPGOddWeightIdMap") {
105  cacheID = evtSetup.get<EcalTPGOddWeightIdMapRcd>().cacheIdentifier();
106  } else if (container == "EcalTPGOddWeightGroup") {
107  cacheID = evtSetup.get<EcalTPGOddWeightGroupRcd>().cacheIdentifier();
108  } else if (container == "EcalTPGTPMode") {
109  cacheID = evtSetup.get<EcalTPGTPModeRcd>().cacheIdentifier();
110  } else if (container == "EcalTPGLutGroup") {
111  cacheID = evtSetup.get<EcalTPGLutGroupRcd>().cacheIdentifier();
112  } else if (container == "EcalTPGFineGrainEBGroup") {
113  cacheID = evtSetup.get<EcalTPGFineGrainEBGroupRcd>().cacheIdentifier();
114  } else if (container == "EcalTPGPhysicsConst") {
115  cacheID = evtSetup.get<EcalTPGPhysicsConstRcd>().cacheIdentifier();
116  } else if (container == "EcalTPGCrystalStatus") {
117  cacheID = evtSetup.get<EcalTPGCrystalStatusRcd>().cacheIdentifier();
118  } else if (container == "EcalTPGTowerStatus") {
119  cacheID = evtSetup.get<EcalTPGTowerStatusRcd>().cacheIdentifier();
120  } else if (container == "EcalTPGSpike") {
121  cacheID = evtSetup.get<EcalTPGSpikeRcd>().cacheIdentifier();
122  } else if (container == "EcalTPGStripStatus") {
123  cacheID = evtSetup.get<EcalTPGStripStatusRcd>().cacheIdentifier();
124  } else {
125  throw cms::Exception("Unknown container");
126  }
127 
128  if (m_cacheIDs[container] == cacheID) {
129  return false;
130  } else {
131  m_cacheIDs[container] = cacheID;
132  return true;
133  }
134 }
135 
136 void EcalTPGDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) {
138  if (!dbOutput.isAvailable()) {
139  throw cms::Exception("PoolDBOutputService is not available");
140  }
141 
142  std::string recordName = m_records[container];
143 
144  if (container == "EcalTPGPedestals") {
146  evtSetup.get<EcalTPGPedestalsRcd>().get(handle);
147  const EcalTPGPedestals* obj = handle.product();
148  dbOutput->createNewIOV<const EcalTPGPedestals>(
149  new EcalTPGPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
150 
151  } else if (container == "EcalTPGLinearizationConst") {
154  const EcalTPGLinearizationConst* obj = handle.product();
155 
156  dbOutput->createNewIOV<const EcalTPGLinearizationConst>(
157  new EcalTPGLinearizationConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
158 
159  } else if (container == "EcalTPGSlidingWindow") {
161  evtSetup.get<EcalTPGSlidingWindowRcd>().get(handle);
162  const EcalTPGSlidingWindow* obj = handle.product();
163 
164  dbOutput->createNewIOV<const EcalTPGSlidingWindow>(
165  new EcalTPGSlidingWindow(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
166 
167  } else if (container == "EcalTPGFineGrainEBIdMap") {
170  const EcalTPGFineGrainEBIdMap* obj = handle.product();
171  dbOutput->createNewIOV<const EcalTPGFineGrainEBIdMap>(
172  new EcalTPGFineGrainEBIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
173 
174  } else if (container == "EcalTPGFineGrainStripEE") {
177  const EcalTPGFineGrainStripEE* obj = handle.product();
178  dbOutput->createNewIOV<const EcalTPGFineGrainStripEE>(
179  new EcalTPGFineGrainStripEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
180 
181  } else if (container == "EcalTPGFineGrainTowerEE") {
184  const EcalTPGFineGrainTowerEE* obj = handle.product();
185  dbOutput->createNewIOV<const EcalTPGFineGrainTowerEE>(
186  new EcalTPGFineGrainTowerEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
187 
188  } else if (container == "EcalTPGLutIdMap") {
190  evtSetup.get<EcalTPGLutIdMapRcd>().get(handle);
191  const EcalTPGLutIdMap* obj = handle.product();
192  dbOutput->createNewIOV<const EcalTPGLutIdMap>(
193  new EcalTPGLutIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
194 
195  } else if (container == "EcalTPGWeightIdMap") {
197  evtSetup.get<EcalTPGWeightIdMapRcd>().get(handle);
198  const EcalTPGWeightIdMap* obj = handle.product();
199  dbOutput->createNewIOV<const EcalTPGWeightIdMap>(
200  new EcalTPGWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
201 
202  } else if (container == "EcalTPGWeightGroup") {
204  evtSetup.get<EcalTPGWeightGroupRcd>().get(handle);
205  const EcalTPGWeightGroup* obj = handle.product();
206  dbOutput->createNewIOV<const EcalTPGWeightGroup>(
207  new EcalTPGWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
208 
209  } else if (container == "EcalTPGOddWeightIdMap") {
211  evtSetup.get<EcalTPGOddWeightIdMapRcd>().get(handle);
212  const EcalTPGOddWeightIdMap* obj = handle.product();
213  dbOutput->createNewIOV<const EcalTPGOddWeightIdMap>(
214  new EcalTPGOddWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
215 
216  } else if (container == "EcalTPGOddWeightGroup") {
218  evtSetup.get<EcalTPGOddWeightGroupRcd>().get(handle);
219  const EcalTPGOddWeightGroup* obj = handle.product();
220  dbOutput->createNewIOV<const EcalTPGOddWeightGroup>(
221  new EcalTPGOddWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
222 
223  } else if (container == "EcalTPGTPMode") {
225  evtSetup.get<EcalTPGTPModeRcd>().get(handle);
226  const EcalTPGTPMode* obj = handle.product();
227  dbOutput->createNewIOV<const EcalTPGTPMode>(
228  new EcalTPGTPMode(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
229 
230  } else if (container == "EcalTPGLutGroup") {
232  evtSetup.get<EcalTPGLutGroupRcd>().get(handle);
233  const EcalTPGLutGroup* obj = handle.product();
234  dbOutput->createNewIOV<const EcalTPGLutGroup>(
235  new EcalTPGLutGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
236 
237  } else if (container == "EcalTPGFineGrainEBGroup") {
240 
241  const EcalTPGFineGrainEBGroup* obj = handle.product();
242 
243  dbOutput->createNewIOV<const EcalTPGFineGrainEBGroup>(
244  new EcalTPGFineGrainEBGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
245 
246  } else if (container == "EcalTPGPhysicsConst") {
248  evtSetup.get<EcalTPGPhysicsConstRcd>().get(handle);
249  const EcalTPGPhysicsConst* obj = handle.product();
250  dbOutput->createNewIOV<const EcalTPGPhysicsConst>(
251  new EcalTPGPhysicsConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
252 
253  } else if (container == "EcalTPGCrystalStatus") {
255  evtSetup.get<EcalTPGCrystalStatusRcd>().get(handle);
256  const EcalTPGCrystalStatus* obj = handle.product();
257  dbOutput->createNewIOV<const EcalTPGCrystalStatus>(
258  new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
259 
260  } else if (container == "EcalTPGTowerStatus") {
262  evtSetup.get<EcalTPGTowerStatusRcd>().get(handle);
263  const EcalTPGTowerStatus* obj = handle.product();
264  dbOutput->createNewIOV<const EcalTPGTowerStatus>(
265  new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
266 
267  } else if (container == "EcalTPGSpike") {
269  evtSetup.get<EcalTPGSpikeRcd>().get(handle);
270  const EcalTPGSpike* obj = handle.product();
271 
272  dbOutput->createNewIOV<const EcalTPGSpike>(
273  new EcalTPGSpike(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
274 
275  } else if (container == "EcalTPGStripStatus") {
277  evtSetup.get<EcalTPGStripStatusRcd>().get(handle);
278  const EcalTPGStripStatus* obj = handle.product();
279  dbOutput->createNewIOV<const EcalTPGStripStatus>(
280  new EcalTPGStripStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
281 
282  }
283 
284  else {
285  throw cms::Exception("Unknown container");
286  }
287 
288  std::cout << "EcalTPGDBCopy wrote " << recordName << std::endl;
289 }
EcalTPGLutGroupRcd.h
EcalTPGWeightIdMap
Definition: EcalTPGWeightIdMap.h:10
mps_fire.i
i
Definition: mps_fire.py:428
EcalTPGTPMode
Definition: EcalTPGTPMode.h:12
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
EcalTPGFineGrainTowerEERcd
Definition: EcalTPGFineGrainTowerEERcd.h:5
EcalTPGStripStatusRcd.h
ESHandle.h
EcalTPGLinearizationConstRcd.h
patZpeak.handle
handle
Definition: patZpeak.py:23
EcalTPGSpikeRcd.h
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
EcalTPGPedestals
EcalTPGPedestalsMap EcalTPGPedestals
Definition: EcalTPGPedestals.h:19
EcalTPGCrystalStatusRcd
Definition: EcalTPGCrystalStatusRcd.h:5
EcalTPGFineGrainEBIdMap.h
EcalTPGFineGrainEBIdMap
Definition: EcalTPGFineGrainEBIdMap.h:10
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
EcalTPGPedestalsRcd
Definition: EcalTPGPedestalsRcd.h:5
EcalTPGCrystalStatusRcd.h
EcalTPGTPModeRcd.h
EcalTPGOddWeightIdMapRcd.h
EcalTPGDBCopy::shouldCopy
bool shouldCopy(const edm::EventSetup &evtSetup, std::string container)
Definition: EcalTPGDBCopy.cc:83
EcalTPGWeightGroup
Definition: EcalTPGWeightGroup.h:8
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
EcalTPGFineGrainStripEERcd
Definition: EcalTPGFineGrainStripEERcd.h:5
EcalTPGLutGroup
Definition: EcalTPGLutGroup.h:13
EcalTPGFineGrainTowerEE.h
EcalTPGFineGrainStripEE.h
EcalTPGDBCopy::m_records
std::map< std::string, std::string > m_records
Definition: EcalTPGDBCopy.h:31
EcalTPGStripStatusRcd
Definition: EcalTPGStripStatusRcd.h:5
EcalTPGDBCopy.h
EcalTPGSlidingWindow
Definition: EcalTPGSlidingWindow.h:9
EcalTPGFineGrainTowerEE
Definition: EcalTPGFineGrainTowerEE.h:9
EcalTPGSpike.h
EcalTPGLutIdMap.h
PoolDBOutputService.h
EcalTPGOddWeightIdMap.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
EcalTPGOddWeightIdMap
Definition: EcalTPGOddWeightIdMap.h:10
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
Service.h
EcalTPGTPMode.h
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
EcalTPGWeightIdMapRcd.h
EcalTPGSlidingWindowRcd.h
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
EcalTPGFineGrainEBGroupRcd.h
EcalTPGLutIdMap
Definition: EcalTPGLutIdMap.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalTPGOddWeightGroupRcd
Definition: EcalTPGOddWeightGroupRcd.h:5
EcalTPGTPModeRcd
Definition: EcalTPGTPModeRcd.h:11
EcalTPGWeightGroup.h
EcalTPGLutGroup.h
EcalTPGDBCopy::~EcalTPGDBCopy
~EcalTPGDBCopy() override
Definition: EcalTPGDBCopy.cc:68
edm::ParameterSet
Definition: ParameterSet.h:47
EcalTPGDBCopy::EcalTPGDBCopy
EcalTPGDBCopy(const edm::ParameterSet &iConfig)
Definition: EcalTPGDBCopy.cc:53
EcalTPGLinearizationConst.h
EcalTPGFineGrainEBGroup
Definition: EcalTPGFineGrainEBGroup.h:13
EcalTPGDBCopy::analyze
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: EcalTPGDBCopy.cc:70
EcalTPGDBCopy::copyToDB
void copyToDB(const edm::EventSetup &evtSetup, std::string container)
Definition: EcalTPGDBCopy.cc:136
EcalTPGFineGrainEBIdMapRcd
Definition: EcalTPGFineGrainEBIdMapRcd.h:5
edm::Service< cond::service::PoolDBOutputService >
EcalTPGFineGrainEBGroup.h
EcalTPGPedestals.h
EcalTPGOddWeightGroupRcd.h
edm::EventSetup
Definition: EventSetup.h:58
EcalTPGStripStatus.h
get
#define get
EcalTPGTowerStatus.h
EcalTPGFineGrainEBIdMapRcd.h
EcalTPGFineGrainTowerEERcd.h
EcalTPGWeightGroupRcd
Definition: EcalTPGWeightGroupRcd.h:5
EcalTPGPhysicsConst
Definition: EcalTPGPhysicsConst.h:9
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
EcalTPGCrystalStatus
EcalTPGCrystalStatusMap EcalTPGCrystalStatus
Definition: EcalTPGCrystalStatus.h:19
EcalTPGLutIdMapRcd
Definition: EcalTPGLutIdMapRcd.h:5
EcalTPGTowerStatus
Definition: EcalTPGTowerStatus.h:9
std
Definition: JetResolutionObject.h:76
EcalTPGSlidingWindow.h
EcalTPGWeightIdMapRcd
Definition: EcalTPGWeightIdMapRcd.h:5
EcalTPGSlidingWindowRcd
Definition: EcalTPGSlidingWindowRcd.h:5
Exception
Definition: hltDiff.cc:245
EcalTPGLutIdMapRcd.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalTPGCrystalStatus.h
EcalTPGTowerStatusRcd.h
EcalTPGWeightGroupRcd.h
EcalTPGStripStatus
Definition: EcalTPGStripStatus.h:9
EcalTPGPhysicsConst.h
EcalTPGPedestalsRcd.h
ParameterSet.h
EcalTPGLutGroupRcd
Definition: EcalTPGLutGroupRcd.h:5
EcalTPGPhysicsConstRcd.h
edm::Event
Definition: Event.h:73
EcalTPGOddWeightGroup.h
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
EcalTPGOddWeightIdMapRcd
Definition: EcalTPGOddWeightIdMapRcd.h:5
EcalTPGWeightIdMap.h
EcalTPGOddWeightGroup
Definition: EcalTPGOddWeightGroup.h:13
EcalTPGFineGrainStripEERcd.h