CMS 3D CMS Logo

EcalTestDevDB.cc
Go to the documentation of this file.
3 
7 
9 
13 
15 
17 
19 
20 #include <map>
21 #include <vector>
22 
23 using namespace std;
24 
26  : m_timetype(iConfig.getParameter<std::string>("timetype")), m_cacheIDs(), m_records() {
27  std::string container;
30 
31  m_firstRun = static_cast<unsigned long>(atoi(iConfig.getParameter<std::string>("firstRun").c_str()));
32  m_lastRun = static_cast<unsigned long>(atoi(iConfig.getParameter<std::string>("lastRun").c_str()));
33  m_interval = static_cast<unsigned long>(atoi(iConfig.getParameter<std::string>("interval").c_str()));
34 
35  typedef std::vector<edm::ParameterSet> Parameters;
36  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
37  for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) {
38  container = i->getParameter<std::string>("container");
39  record = i->getParameter<std::string>("record");
40  m_cacheIDs.insert(std::make_pair(container, 0));
41  m_records.insert(std::make_pair(container, record));
42  }
43 }
44 
46 
47 void EcalTestDevDB::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
49  if (!dbOutput.isAvailable()) {
50  throw cms::Exception("PoolDBOutputService is not available");
51  }
52 
53  std::string container;
55  typedef std::map<std::string, std::string>::const_iterator recordIter;
56  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
57  container = (*i).first;
58  record = (*i).second;
59 
60  std::string recordName = m_records[container];
61 
62  // Loop through each of the runs
63 
64  unsigned long nrec = (m_lastRun - m_firstRun) / m_interval + 1;
65  unsigned long nstart = 0;
66  if (m_firstRun == 0 && m_lastRun == 0) {
67  // it should do at least once the loop
68  nstart = 0;
69  nrec = 1;
70  }
71 
72  for (unsigned long i = nstart; i < nrec; i++) {
73  unsigned long irun = m_firstRun + i * m_interval;
74 
75  // Arguments 0 0 mean infinite IOV
76  if (m_firstRun == 0 && m_lastRun == 0) {
77  std::cout << "Infinite IOV mode" << std::endl;
79  }
80 
81  std::cout << "Starting Transaction for run " << irun << "..." << std::flush;
82 
83  if (container == "EcalPedestals") {
84  EcalPedestals* condObject = generateEcalPedestals();
85 
86  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
87  // create new
88  std::cout << "First One " << std::endl;
89  dbOutput->createNewIOV<const EcalPedestals>(
90  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
91  } else {
92  // append
93  std::cout << "Old One " << std::endl;
94  dbOutput->appendSinceTime<const EcalPedestals>(condObject, irun, recordName);
95  }
96 
97  } else if (container == "EcalADCToGeVConstant") {
99  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
100  // create new
101  std::cout << "First One " << std::endl;
102  dbOutput->createNewIOV<const EcalADCToGeVConstant>(
103  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
104  } else {
105  // append
106  std::cout << "Old One " << std::endl;
107  dbOutput->appendSinceTime<const EcalADCToGeVConstant>(condObject, irun, recordName);
108  }
109 
110  } else if (container == "EcalIntercalibConstants") {
112  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
113  // create new
114  std::cout << "First One " << std::endl;
115  dbOutput->createNewIOV<const EcalIntercalibConstants>(
116  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
117  } else {
118  // append
119  std::cout << "Old One " << std::endl;
120  dbOutput->appendSinceTime<const EcalIntercalibConstants>(condObject, irun, recordName);
121  }
122  } else if (container == "EcalLinearCorrections") {
124  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
125  // create new
126  std::cout << "First One " << std::endl;
127  dbOutput->createNewIOV<const EcalLinearCorrections>(
128  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
129  } else {
130  // append
131  std::cout << "Old One " << std::endl;
132  dbOutput->appendSinceTime<const EcalLinearCorrections>(condObject, irun, recordName);
133  }
134 
135  } else if (container == "EcalGainRatios") {
136  EcalGainRatios* condObject = generateEcalGainRatios();
137  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
138  // create new
139  std::cout << "First One " << std::endl;
140  dbOutput->createNewIOV<const EcalGainRatios>(
141  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
142  } else {
143  // append
144  std::cout << "Old One " << std::endl;
145  dbOutput->appendSinceTime<const EcalGainRatios>(condObject, irun, recordName);
146  }
147 
148  } else if (container == "EcalWeightXtalGroups") {
150  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
151  // create new
152  std::cout << "First One " << std::endl;
153  dbOutput->createNewIOV<const EcalWeightXtalGroups>(
154  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
155  } else {
156  // append
157  std::cout << "Old One " << std::endl;
158  dbOutput->appendSinceTime<const EcalWeightXtalGroups>(condObject, irun, recordName);
159  }
160 
161  } else if (container == "EcalTBWeights") {
162  EcalTBWeights* condObject = generateEcalTBWeights();
163  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
164  // create new
165  std::cout << "First One " << std::endl;
166  dbOutput->createNewIOV<const EcalTBWeights>(
167  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
168  } else {
169  // append
170  std::cout << "Old One " << std::endl;
171  dbOutput->appendSinceTime<const EcalTBWeights>(condObject, irun, recordName);
172  }
173 
174  } else if (container == "EcalLaserAPDPNRatios") {
176  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
177  // create new
178  std::cout << "First One " << std::endl;
179  dbOutput->createNewIOV<const EcalLaserAPDPNRatios>(
180  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
181  } else {
182  // append
183  std::cout << "Old One " << std::endl;
184  dbOutput->appendSinceTime<const EcalLaserAPDPNRatios>(condObject, irun, recordName);
185  }
186  } else if (container == "EcalLaserAPDPNRatiosRef") {
188  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
189  // create new
190  std::cout << "First One " << std::endl;
191  dbOutput->createNewIOV<const EcalLaserAPDPNRatiosRef>(
192  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
193  } else {
194  // append
195  std::cout << "Old One " << std::endl;
196  dbOutput->appendSinceTime<const EcalLaserAPDPNRatiosRef>(condObject, irun, recordName);
197  }
198  } else if (container == "EcalLaserAlphas") {
200  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
201  // create new
202  std::cout << "First One " << std::endl;
203  dbOutput->createNewIOV<const EcalLaserAlphas>(
204  condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
205  } else {
206  // append
207  std::cout << "Old One " << std::endl;
208  dbOutput->appendSinceTime<const EcalLaserAlphas>(condObject, irun, recordName);
209  }
210  } else {
211  std::cout << "it does not work yet for " << container << "..." << std::flush;
212  }
213  }
214  }
215 }
216 
217 //-------------------------------------------------------------
219  //-------------------------------------------------------------
220 
221  EcalPedestals* peds = new EcalPedestals();
223  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
224  if (iEta == 0)
225  continue;
226  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
227  item.mean_x1 = 200. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
228  item.rms_x1 = (double)std::rand() / (double(RAND_MAX) + double(1));
229  item.mean_x6 = 1200. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
230  item.rms_x6 = 6. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
231  item.mean_x12 = 2400. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
232  item.rms_x12 = 12. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
233 
234  EBDetId ebdetid(iEta, iPhi);
235  peds->insert(std::make_pair(ebdetid.rawId(), item));
236  }
237  }
238  return peds;
239 }
240 
241 //-------------------------------------------------------------
243  //-------------------------------------------------------------
244 
245  double r = (double)std::rand() / (double(RAND_MAX) + double(1));
246  EcalADCToGeVConstant* agc = new EcalADCToGeVConstant(36. + r * 4., 60. + r * 4);
247  return agc;
248 }
249 
250 //-------------------------------------------------------------
252  //-------------------------------------------------------------
253 
255 
256  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
257  if (ieta == 0)
258  continue;
259  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
260  EBDetId ebid(ieta, iphi);
261 
262  double r = (double)std::rand() / (double(RAND_MAX) + double(1));
263  ical->setValue(ebid.rawId(), 0.85 + r * 0.3);
264  } // loop over phi
265  } // loop over eta
266  return ical;
267 }
268 
269 //-------------------------------------------------------------
271  //-------------------------------------------------------------
272 
274 
275  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
276  if (ieta == 0)
277  continue;
278  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
279  if (EBDetId::validDetId(ieta, iphi)) {
280  EBDetId ebid(ieta, iphi);
281 
283  pairAPDPN.p1 = 1.0;
284  pairAPDPN.p2 = 1.0;
285  pairAPDPN.p3 = 1.0;
286  ical->setValue(ebid, pairAPDPN);
287  }
288  }
289  }
290 
291  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
292  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
293  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
294  if (EEDetId::validDetId(iX, iY, 1)) {
295  EEDetId eedetidpos(iX, iY, 1);
296 
298  pairAPDPN.p1 = 1.0;
299  pairAPDPN.p2 = 1.0;
300  pairAPDPN.p3 = 1.0;
301 
302  ical->setValue(eedetidpos, pairAPDPN);
303  }
304 
305  if (EEDetId::validDetId(iX, iY, -1)) {
306  EEDetId eedetidneg(iX, iY, -1);
307 
309  pairAPDPN.p1 = 1.0;
310  pairAPDPN.p2 = 1.0;
311  pairAPDPN.p3 = 1.0;
312 
313  ical->setValue(eedetidneg, pairAPDPN);
314  }
315  }
316  }
317 
319  for (int i = 0; i < 92; i++) {
320  TimeStamp.t1 = edm::Timestamp(0);
323 
324  ical->setTime(i, TimeStamp);
325  }
326 
327  return ical;
328 }
329 
330 //-------------------------------------------------------------
332  //-------------------------------------------------------------
333 
334  // create gain ratios
335  EcalGainRatios* gratio = new EcalGainRatios;
336 
337  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
338  if (ieta == 0)
339  continue;
340  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
341  EBDetId ebid(ieta, iphi);
342 
343  double r = (double)std::rand() / (double(RAND_MAX) + double(1));
344 
346  gr.setGain12Over6(1.9 + r * 0.2);
347  gr.setGain6Over1(5.9 + r * 0.2);
348 
349  gratio->setValue(ebid.rawId(), gr);
350 
351  } // loop over phi
352  } // loop over eta
353  return gratio;
354 }
355 
356 //-------------------------------------------------------------
358  //-------------------------------------------------------------
359 
360  EcalWeightXtalGroups* xtalGroups = new EcalWeightXtalGroups();
361  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
362  if (ieta == 0)
363  continue;
364  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
365  EBDetId ebid(ieta, iphi);
366  xtalGroups->setValue(ebid.rawId(), EcalXtalGroupId(ieta)); // define rings in eta
367  }
368  }
369  return xtalGroups;
370 }
371 
372 //-------------------------------------------------------------
374  //-------------------------------------------------------------
375 
376  EcalTBWeights* tbwgt = new EcalTBWeights();
377 
378  // create weights for each distinct group ID
379  int nMaxTDC = 10;
380  for (int igrp = -EBDetId::MAX_IETA; igrp <= EBDetId::MAX_IETA; ++igrp) {
381  if (igrp == 0)
382  continue;
383  for (int itdc = 1; itdc <= nMaxTDC; ++itdc) {
384  // generate random number
385  double r = (double)std::rand() / (double(RAND_MAX) + double(1));
386 
387  // make a new set of weights
388  EcalWeightSet wgt;
391 
392  for (size_t i = 0; i < 3; ++i) {
393  for (size_t j = 0; j < 10; ++j) {
394  double ww = igrp * itdc * r + i * 10. + j;
395  //std::cout << "row: " << i << " col: " << j << " - val: " << ww << std::endl;
396  mat1(i, j) = ww;
397  mat2(i, j) = 100 + ww;
398  }
399  }
400 
401  // fill the chi2 matrcies
402  r = (double)std::rand() / (double(RAND_MAX) + double(1));
405  for (size_t i = 0; i < 10; ++i) {
406  for (size_t j = 0; j < 10; ++j) {
407  double ww = igrp * itdc * r + i * 10. + j;
408  mat3(i, j) = 1000 + ww;
409  mat4(i, j) = 1000 + 100 + ww;
410  }
411  }
412 
413  // put the weight in the container
414  tbwgt->setValue(std::make_pair(igrp, itdc), wgt);
415  }
416  }
417  return tbwgt;
418 }
419 
420 //--------------------------------------------------------------
422  //--------------------------------------------------------------
423 
425 
428 
429  // if((m_firstRun == 0 && i_run == 0) || (m_firstRun == 1 && i_run == 1)){
430 
431  std::cout << "First & last run: " << i_run << " " << m_firstRun << " " << m_lastRun << " " << std::endl;
432  if (m_firstRun == i_run && (i_run == 0 || i_run == 1)) {
433  APDPNpair.p1 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10)))) / double(2);
434  APDPNpair.p2 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10) + double(10)))) / double(2);
435  APDPNpair.p3 = double(0);
436  std::cout << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2 << std::endl;
437 
438  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
439  if (iEta == 0)
440  continue;
441  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
442  //APDPNpair.p1= double(1);
443  //APDPNpair.p2= double(1);
444 
445  EBDetId ebid(iEta, iPhi);
446  int hi = ebid.hashedIndex();
447 
448  if (hi < static_cast<int>(laser->getLaserMap().size())) {
449  laser->setValue(hi, APDPNpair);
450  } else {
451  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
452  continue;
453  }
454  }
455  }
456 
457  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
458  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
459  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
460 
461  if (!EEDetId::validDetId(iX, iY, 1))
462  continue;
463 
464  EEDetId eedetidpos(iX, iY, 1);
465  //APDPNpair.p1 = double(1);
466  //APDPNpair.p2 = double(1);
467 
468  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
469  if (hi < static_cast<int>(laser->getLaserMap().size())) {
470  laser->setValue(hi, APDPNpair);
471  } else {
472  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
473  continue;
474  }
475 
476  if (!EEDetId::validDetId(iX, iY, -1))
477  continue;
478 
479  EEDetId eedetidneg(iX, iY, -1);
480  //APDPNpair.p1 = double(1);
481  //APDPNpair.p2 = double(1);
482  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
483  if (hi < static_cast<int>(laser->getLaserMap().size())) {
484  laser->setValue(hi, APDPNpair);
485  } else {
486  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
487  continue;
488  }
489  }
490  }
491 
492  std::cout << std::endl;
493  for (int i = 0; i < 92; i++) {
494  if (i < static_cast<int>(laser->getTimeMap().size())) {
495  TimeStamp.t1 = edm::Timestamp(1380 * (i_run - m_firstRun) + 15 * i);
496  TimeStamp.t2 = edm::Timestamp(1380 * (i_run - m_firstRun + 1) + 15 * i);
497  laser->setTime(i, TimeStamp);
498  //std::cout << " Timestamp for " << i << " : " << TimeStamp.t1.value() << " , " << TimeStamp.t2.value() << std::endl;
499  } else {
500  edm::LogError("EcalTestDevDB") << "error with laser Map (time)!" << std::endl;
501  continue;
502  }
503  }
504 
505  } else {
506  APDPNpair.p1 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10)))) / double(2);
507  APDPNpair.p2 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10) + double(10)))) / double(2);
508  APDPNpair.p3 = double(0);
509  std::cout << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2 << std::endl;
510 
511  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
512  if (iEta == 0)
513  continue;
514  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
515  EBDetId ebid(iEta, iPhi);
516  int hi = ebid.hashedIndex();
517 
518  if (hi < static_cast<int>(laser->getLaserMap().size())) {
519  laser->setValue(hi, APDPNpair);
520  } else {
521  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
522  }
523  }
524  }
525  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
526  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
527  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
528 
529  if (!EEDetId::validDetId(iX, iY, 1))
530  continue;
531 
532  EEDetId eedetidpos(iX, iY, 1);
533  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
534  if (hi < static_cast<int>(laser->getLaserMap().size())) {
535  laser->setValue(hi, APDPNpair);
536  } else {
537  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
538  continue;
539  }
540 
541  if (!EEDetId::validDetId(iX, iY, -1))
542  continue;
543 
544  EEDetId eedetidneg(iX, iY, -1);
545  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
546  if (hi < static_cast<int>(laser->getLaserMap().size())) {
547  laser->setValue(hi, APDPNpair);
548  } else {
549  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
550  continue;
551  }
552  }
553  }
554 
555  std::cout << std::endl;
556  for (int i = 0; i < 92; i++) {
557  if (i < static_cast<int>(laser->getTimeMap().size())) {
558  TimeStamp.t1 = edm::Timestamp(1380 * (i_run - m_firstRun) + 15 * i);
559  TimeStamp.t2 = edm::Timestamp(1380 * (i_run - m_firstRun + 1) + 15 * i);
560  laser->setTime(i, TimeStamp);
561  //std::cout << " Timestamp for " << i << " : " << TimeStamp.t1.value() << " , " << TimeStamp.t2.value() << std::endl;
562  } else {
563  edm::LogError("EcalTestDevDB") << "error with laser Map (time)!" << std::endl;
564  continue;
565  }
566  }
567  }
568 
569  return laser;
570 }
571 
572 //--------------------------------------------------------------
574  //--------------------------------------------------------------
575 
577 
578  EcalLaserAPDPNref APDPNref;
579 
580  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
581  if (iEta == 0)
582  continue;
583  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
584  APDPNref = double(1.5);
585  EBDetId ebid(iEta, iPhi);
586 
587  int hi = ebid.hashedIndex();
588  if (hi < static_cast<int>(laser->getMap().size())) {
589  laser->setValue(hi, APDPNref);
590  } else {
591  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl;
592  }
593  }
594  }
595 
596  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
597  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
598  if (!EEDetId::validDetId(iX, iY, 1))
599  continue;
600 
601  EEDetId eedetidpos(iX, iY, 1);
602  APDPNref = double(1.5);
603 
604  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
605  if (hi < static_cast<int>(laser->getMap().size())) {
606  laser->setValue(hi, APDPNref);
607  } else {
608  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl;
609  }
610 
611  if (!EEDetId::validDetId(iX, iY, -1))
612  continue;
613 
614  EEDetId eedetidneg(iX, iY, -1);
615  APDPNref = double(1.5);
616 
617  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
618  if (hi < static_cast<int>(laser->getMap().size())) {
619  laser->setValue(hi, APDPNref);
620  } else {
621  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl;
622  }
623  }
624  }
625 
626  return laser;
627 }
628 
629 //--------------------------------------------------------------
631  //--------------------------------------------------------------
632 
634 
636 
637  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
638  if (iEta == 0)
639  continue;
640  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
641  Alpha = double(1.55);
642  EBDetId ebid(iEta, iPhi);
643 
644  int hi = ebid.hashedIndex();
645  if (hi < static_cast<int>(laser->getMap().size())) {
646  laser->setValue(hi, Alpha);
647  } else {
648  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl;
649  }
650  }
651  }
652 
653  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
654  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
655  if (!EEDetId::validDetId(iX, iY, 1))
656  continue;
657 
658  EEDetId eedetidpos(iX, iY, 1);
659  Alpha = double(1.55);
660 
661  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
662  if (hi < static_cast<int>(laser->getMap().size())) {
663  laser->setValue(hi, Alpha);
664  } else {
665  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl;
666  }
667 
668  if (!EEDetId::validDetId(iX, iY, -1))
669  continue;
670  EEDetId eedetidneg(iX, iY, -1);
671  Alpha = double(1.55);
672 
673  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
674  if (hi < static_cast<int>(laser->getMap().size())) {
675  laser->setValue(hi, Alpha);
676  } else {
677  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl;
678  }
679  }
680  }
681 
682  return laser;
683 }
EcalTestDevDB::generateEcalWeightXtalGroups
EcalWeightXtalGroups * generateEcalWeightXtalGroups()
Definition: EcalTestDevDB.cc:357
EcalTimeDependentCorrections::Values
Definition: EcalTimeDependentCorrections.h:16
EBDetId::hashedIndex
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1
float p1
Definition: EcalLaserAPDPNRatios.h:18
EcalTestDevDB::generateEcalTBWeights
EcalTBWeights * generateEcalTBWeights()
Definition: EcalTestDevDB.cc:373
Handle.h
VtxSmearedParameters_cfi.Alpha
Alpha
Definition: VtxSmearedParameters_cfi.py:115
mps_fire.i
i
Definition: mps_fire.py:428
EcalTimeDependentCorrections::Times::t2
edm::Timestamp t2
Definition: EcalTimeDependentCorrections.h:27
EcalLaserAPDPNRatiosRef
EcalLaserAPDPNRatiosRefMap EcalLaserAPDPNRatiosRef
Definition: EcalLaserAPDPNRatiosRef.h:13
MessageLogger.h
EcalMGPAGainRatio::setGain6Over1
void setGain6Over1(const float &g)
Definition: EcalMGPAGainRatio.h:23
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
ESHandle.h
EcalTestDevDB.h
EcalTestDevDB::m_records
std::map< std::string, std::string > m_records
Definition: EcalTestDevDB.h:61
EcalLaserAlphas
EcalLaserAlphaMap EcalLaserAlphas
Definition: EcalLaserAlphas.h:12
EBDetId
Definition: EBDetId.h:17
align_cfg.recordName
recordName
Definition: align_cfg.py:66
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:141
EcalLaserAlpha
float EcalLaserAlpha
Definition: EcalLaserAlphas.h:10
EEDetId::IX_MIN
static const int IX_MIN
Definition: EEDetId.h:290
EcalADCToGeVConstant
Definition: EcalADCToGeVConstant.h:13
EEDetId::IY_MIN
static const int IY_MIN
Definition: EEDetId.h:294
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalGainRatios
EcalGainRatioMap EcalGainRatios
Definition: EcalGainRatios.h:12
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
EcalTestDevDB::generateEcalLinearCorrections
EcalLinearCorrections * generateEcalLinearCorrections()
Definition: EcalTestDevDB.cc:270
EcalXtalGroupId
Definition: EcalXtalGroupId.h:11
EcalTimeDependentCorrections::Values::p3
float p3
Definition: EcalTimeDependentCorrections.h:20
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
EcalTestDevDB::EcalTestDevDB
EcalTestDevDB(const edm::ParameterSet &iConfig)
Definition: EcalTestDevDB.cc:25
EcalWeightSet::EcalWeightMatrix
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
EcalTimeDependentCorrections::Values::p1
float p1
Definition: EcalTimeDependentCorrections.h:18
EcalTestDevDB::generateEcalLaserAPDPNRatiosRef
EcalLaserAPDPNRatiosRef * generateEcalLaserAPDPNRatiosRef()
Definition: EcalTestDevDB.cc:573
MakerMacros.h
EcalTimeDependentCorrections::Times::t3
edm::Timestamp t3
Definition: EcalTimeDependentCorrections.h:28
PoolDBOutputService.h
EcalTBWeights::setValue
void setValue(const EcalXtalGroupId &groupId, const EcalTDCId &tdcId, const EcalWeightSet &weight)
Definition: EcalTBWeights.cc:15
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
Service.h
EcalTimeDependentCorrections::setValue
void setValue(uint32_t rawId, const Values &value)
Definition: EcalTimeDependentCorrections.h:39
EcalTestDevDB::m_lastRun
unsigned long m_lastRun
Definition: EcalTestDevDB.h:63
EcalTestDevDB::generateEcalLaserAPDPNRatios
EcalLaserAPDPNRatios * generateEcalLaserAPDPNRatios(uint32_t i_run)
Definition: EcalTestDevDB.cc:421
EBDetId::MAX_IPHI
static const int MAX_IPHI
Definition: EBDetId.h:137
EEDetId::IY_MAX
static const int IY_MAX
Definition: EEDetId.h:302
EcalIntercalibConstants
EcalIntercalibConstantMap EcalIntercalibConstants
Definition: EcalIntercalibConstants.h:12
EcalWeightSet::getWeightsAfterGainSwitch
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
EEDetId
Definition: EEDetId.h:14
EcalLaserAPDPNref
float EcalLaserAPDPNref
Definition: EcalLaserAPDPNRatiosRef.h:11
EcalPedestals
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:50
EcalMGPAGainRatio::setGain12Over6
void setGain12Over6(const float &g)
Definition: EcalMGPAGainRatio.h:22
mat4
Definition: mat4.h:9
EcalWeightSet::getWeightsBeforeGainSwitch
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:26
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
EcalCondObjectContainer::setValue
void setValue(const uint32_t id, const Item &item)
Definition: EcalCondObjectContainer.h:76
edm::IOVSyncValue::eventID
const EventID & eventID() const
Definition: IOVSyncValue.h:40
EcalLaserAPDPNRatios::EcalLaserAPDPNpair
Definition: EcalLaserAPDPNRatios.h:16
edm::ParameterSet
Definition: ParameterSet.h:47
EcalTimeDependentCorrections::Values::p2
float p2
Definition: EcalTimeDependentCorrections.h:19
Timestamp.h
Event.h
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
EcalCondObjectContainer::Item
T Item
Definition: EcalCondObjectContainer.h:15
EcalWeightXtalGroups
EcalCondObjectContainer< EcalXtalGroupId > EcalWeightXtalGroups
Definition: EcalWeightXtalGroups.h:12
EcalTestDevDB::m_cacheIDs
std::map< std::string, unsigned long long > m_cacheIDs
Definition: EcalTestDevDB.h:60
EcalTimeDependentCorrections::setTime
void setTime(int hashedIndex, const Times &value)
Definition: EcalTimeDependentCorrections.h:42
EcalWeightSet::EcalChi2WeightMatrix
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
Definition: EcalWeightSet.h:20
EcalLinearCorrections
EcalTimeDependentCorrections EcalLinearCorrections
Definition: EcalLinearCorrections.h:10
EcalLaserAPDPNRatios::EcalLaserTimeStamp::t1
edm::Timestamp t1
Definition: EcalLaserAPDPNRatios.h:26
EEDetId::hashedIndex
int hashedIndex() const
Definition: EEDetId.h:183
EEDetId::IX_MAX
static const int IX_MAX
Definition: EEDetId.h:298
EcalWeightSet::getChi2WeightsAfterGainSwitch
EcalChi2WeightMatrix & getChi2WeightsAfterGainSwitch()
Definition: EcalWeightSet.h:29
edm::Service< cond::service::PoolDBOutputService >
edm::Timestamp::endOfTime
static Timestamp endOfTime()
Definition: Timestamp.h:83
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::EventSetup
Definition: EventSetup.h:58
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
EBDetId::MAX_HASH
static const int MAX_HASH
Definition: EBDetId.h:150
EcalTestDevDB::generateEcalIntercalibConstants
EcalIntercalibConstants * generateEcalIntercalibConstants()
Definition: EcalTestDevDB.cc:251
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalTestDevDB::generateEcalLaserAlphas
EcalLaserAlphas * generateEcalLaserAlphas()
Definition: EcalTestDevDB.cc:630
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
alignCSCRings.r
r
Definition: alignCSCRings.py:93
EcalWeightSet
Definition: EcalWeightSet.h:17
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
EcalTestDevDB::generateEcalADCToGeVConstant
EcalADCToGeVConstant * generateEcalADCToGeVConstant()
Definition: EcalTestDevDB.cc:242
hi
Definition: EPCuts.h:4
EcalTestDevDB::m_firstRun
unsigned long m_firstRun
Definition: EcalTestDevDB.h:62
EcalTestDevDB::analyze
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: EcalTestDevDB.cc:47
EcalTestDevDB::generateEcalGainRatios
EcalGainRatios * generateEcalGainRatios()
Definition: EcalTestDevDB.cc:331
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalTimeDependentCorrections::Times::t1
edm::Timestamp t1
Definition: EcalTimeDependentCorrections.h:26
EcalCondObjectContainer::insert
void insert(std::pair< uint32_t, Item > const &a)
Definition: EcalCondObjectContainer.h:38
EcalTestDevDB::~EcalTestDevDB
~EcalTestDevDB() override
Definition: EcalTestDevDB.cc:45
EcalTimeDependentCorrections::Times
Definition: EcalTimeDependentCorrections.h:24
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
EventSetup.h
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
EcalLaserAPDPNRatios
Definition: EcalLaserAPDPNRatios.h:14
ParameterSet.h
EventSetupRecordKey.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
EcalWeightSet::getChi2WeightsBeforeGainSwitch
EcalChi2WeightMatrix & getChi2WeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:28
edm::Event
Definition: Event.h:73
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
EcalTestDevDB::m_interval
unsigned int m_interval
Definition: EcalTestDevDB.h:64
EcalLaserAPDPNRatios::EcalLaserTimeStamp
Definition: EcalLaserAPDPNRatios.h:24
EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2
float p2
Definition: EcalLaserAPDPNRatios.h:19
EcalCondDBWriter_cfi.laser
laser
Definition: EcalCondDBWriter_cfi.py:46
EBDetId::MAX_IETA
static const int MAX_IETA
Definition: EBDetId.h:136
EcalTBWeights
Definition: EcalTBWeights.h:15
EcalMGPAGainRatio
Definition: EcalMGPAGainRatio.h:13
EcalTestDevDB::generateEcalPedestals
EcalPedestals * generateEcalPedestals()
Definition: EcalTestDevDB.cc:218
EcalTimeDependentCorrections
Definition: EcalTimeDependentCorrections.h:14
EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p3
float p3
Definition: EcalLaserAPDPNRatios.h:20
EBDetId::MIN_IPHI
static const int MIN_IPHI
Definition: EBDetId.h:135
EcalLaserAPDPNRatios::EcalLaserTimeStamp::t2
edm::Timestamp t2
Definition: EcalLaserAPDPNRatios.h:27
edm::Timestamp
Definition: Timestamp.h:30