CMS 3D CMS Logo

EcalPedestalsHandler.cc
Go to the documentation of this file.
2 
5 
6 #include <cstring>
7 #include <iostream>
8 #include <fstream>
9 
10 #include "TFile.h"
11 #include "TTree.h"
12 
13 const Int_t kChannels = 75848, kEBChannels = 61200, kEEChannels = 14648, kGains = 3;
14 const Int_t Nbpedxml = 81; // Number of Gain1 Gain6 files in 2016 (26), 2017 (25), 2018 (30) : L1248 and L1600
15 const Int_t gainValues[kGains] = {12, 6, 1};
16 
18  : m_name(ps.getUntrackedParameter<std::string>("name", "EcalPedestalsHandler")) {
19  edm::LogInfo("EcalPedestals Source handler constructor\n");
20  m_firstRun = static_cast<unsigned int>(atoi(ps.getParameter<std::string>("firstRun").c_str()));
21  m_lastRun = static_cast<unsigned int>(atoi(ps.getParameter<std::string>("lastRun").c_str()));
22  m_sid = ps.getParameter<std::string>("OnlineDBSID");
23  m_user = ps.getParameter<std::string>("OnlineDBUser");
24  m_pass = ps.getParameter<std::string>("OnlineDBPassword");
25  m_locationsource = ps.getParameter<std::string>("LocationSource");
26  m_location = ps.getParameter<std::string>("Location");
27  m_gentag = ps.getParameter<std::string>("GenTag");
28  m_runtag = ps.getParameter<std::string>("RunTag");
29  m_filename = ps.getUntrackedParameter<std::string>("filename", "EcalPedestals.txt");
30  m_runtype = ps.getUntrackedParameter<int>("RunType", 1);
31  m_corrected = ps.getUntrackedParameter<bool>("corrected", false);
32 
33  edm::LogInfo("EcalPedestalsHandler") << m_sid << "/"
34  << "/" << m_location << "/" << m_gentag;
35 }
36 
38 
40  edm::LogInfo("------- Ecal - > getNewObjects\n");
41  if (m_locationsource == "P5") {
42  getNewObjectsP5();
43  } else if (m_locationsource == "H2") {
44  getNewObjectsH2();
45  } else if (m_locationsource == "File") {
46  readPedestalFile();
47  } else if (m_locationsource == "MC") {
48  readPedestalMC();
49  } else if (m_locationsource == "2017") {
50  readPedestal2017();
51  } else if (m_locationsource == "Tree") {
52  readPedestalTree();
53  } else if (m_locationsource == "Timestamp") {
54  readPedestalTimestamp();
55  } else {
56  edm::LogInfo(" unknown location ") << m_locationsource << " give up ";
57  exit(-1);
58  }
59 }
60 
62  // true means all is standard and OK
63  bool result = true;
64  if (item->rms_x12 > 3 || item->rms_x12 <= 0)
65  result = false;
66  if (item->rms_x6 > 2 || item->rms_x6 <= 0)
67  result = false;
68  if (item->rms_x1 > 1 || item->rms_x1 <= 0)
69  result = false;
70  if (item->mean_x12 > 300 || item->mean_x12 <= 100)
71  result = false;
72  if (item->mean_x1 > 300 || item->mean_x1 <= 100)
73  result = false;
74  if (item->mean_x6 > 300 || item->mean_x6 <= 100)
75  result = false;
76  return result;
77 }
78 
80 
82  std::ostringstream ss;
83  ss << "ECAL ";
84 
85  unsigned int max_since = 0;
86  max_since = static_cast<unsigned int>(tagInfo().lastInterval.since);
87  edm::LogInfo("max_since : ") << max_since;
88  Ref ped_db = lastPayload();
89 
90  // we copy the last valid record to a temporary object peds
91  EcalPedestals* peds = new EcalPedestals();
92  edm::LogInfo("retrieved last payload ");
93 
94  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
95  if (iEta == 0)
96  continue;
97  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
98  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
99  if (EBDetId::validDetId(iEta, iPhi)) {
100  EBDetId ebdetid(iEta, iPhi, EBDetId::ETAPHIMODE);
101  EcalPedestals::const_iterator it = ped_db->find(ebdetid.rawId());
102  EcalPedestals::Item aped = (*it);
103 
104  // here I copy the last valid value in the peds object
106  item.mean_x1 = aped.mean_x1;
107  item.rms_x1 = aped.rms_x1;
108  item.mean_x6 = aped.mean_x6;
109  item.rms_x6 = aped.rms_x6;
110  item.mean_x12 = aped.mean_x12;
111  item.rms_x12 = aped.rms_x12;
112 
113  peds->insert(std::make_pair(ebdetid.rawId(), item));
114  }
115  }
116  }
117 
118  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
119  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
120  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
121  if (EEDetId::validDetId(iX, iY, 1)) {
122  EEDetId eedetidpos(iX, iY, 1);
123 
124  EcalPedestals::const_iterator it = ped_db->find(eedetidpos.rawId());
125  EcalPedestals::Item aped = (*it);
126 
127  // unsigned int hiee = eedetidpos.hashedIndex();
128  // EcalPedestals::Item aped= ped_db->endcap(hiee);
129 
130  // here I copy the last valid value in the peds object
132  item.mean_x1 = aped.mean_x1;
133  item.rms_x1 = aped.rms_x1;
134  item.mean_x6 = aped.mean_x6;
135  item.rms_x6 = aped.rms_x6;
136  item.mean_x12 = aped.mean_x12;
137  item.rms_x12 = aped.rms_x12;
138  peds->insert(std::make_pair(eedetidpos.rawId(), item));
139  }
140  if (EEDetId::validDetId(iX, iY, -1)) {
141  EEDetId eedetidneg(iX, iY, -1);
142 
143  EcalPedestals::const_iterator it = ped_db->find(eedetidneg.rawId());
144  EcalPedestals::Item aped = (*it);
145  // unsigned int hiee = eedetidneg.hashedIndex();
146  // EcalPedestals::Item aped= ped_db->endcap(hiee);
147 
148  // here I copy the last valid value in the peds object
150  item.mean_x1 = aped.mean_x1;
151  item.rms_x1 = aped.rms_x1;
152  item.mean_x6 = aped.mean_x6;
153  item.rms_x6 = aped.rms_x6;
154  item.mean_x12 = aped.mean_x12;
155  item.rms_x12 = aped.rms_x12;
156  peds->insert(std::make_pair(eedetidneg.rawId(), item));
157  }
158  }
159  }
160 
161  // here we retrieve all the runs after the last from online DB
162 
163  edm::LogInfo("Retrieving run list from ONLINE DB ... ");
164  econn = new EcalCondDBInterface(m_sid, m_user, m_pass);
165  edm::LogInfo("Connection done");
166 
167  // these are the online conditions DB classes
168  RunList my_runlist;
169  RunTag my_runtag;
172 
173  my_locdef.setLocation(m_location);
174  // my_rundef.setRunType("PEDESTAL"); // 2017
175  my_rundef.setRunType(m_runtag);
176  my_runtag.setLocationDef(my_locdef);
177  my_runtag.setRunTypeDef(my_rundef);
178  my_runtag.setGeneralTag(m_gentag);
179 
180  // here we retrieve the Monitoring run records
181 
182  MonVersionDef monverdef;
183  monverdef.setMonitoringVersion("test01");
184 
185  MonRunTag mon_tag;
186  // mon_tag.setGeneralTag("CMSSW");
187  mon_tag.setGeneralTag("CMSSW-offline-private");
188  mon_tag.setMonVersionDef(monverdef);
189  MonRunList mon_list;
190  mon_list.setMonRunTag(mon_tag);
191  mon_list.setRunTag(my_runtag);
192  // mon_list=econn->fetchMonRunList(my_runtag, mon_tag);
193  unsigned int min_run = 0;
194  if (m_firstRun < max_since) {
195  min_run = max_since + 1; // we have to add 1 to the last transferred one
196  } else {
197  min_run = m_firstRun;
198  }
199 
200  unsigned int max_run = m_lastRun;
201  mon_list = econn->fetchMonRunList(my_runtag, mon_tag, min_run, max_run);
202 
203  std::vector<MonRunIOV> mon_run_vec = mon_list.getRuns();
204  int mon_runs = mon_run_vec.size();
205  edm::LogInfo("number of Mon runs is : ") << mon_runs;
206 
207  if (mon_runs > 0) {
208  int krmax = std::min(mon_runs, 30);
209  for (int kr = 0; kr < krmax; kr++) {
210  edm::LogInfo("-kr------: ") << kr;
211 
212  unsigned int irun = static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().getRunNumber());
213  edm::LogInfo("retrieve the data for run number: ") << mon_run_vec[kr].getRunIOV().getRunNumber();
214  if (mon_run_vec[kr].getSubRunNumber() <= 1) {
215  // retrieve the data for a given run
216  RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
217  // retrieve the pedestals from OMDS for this run
218  std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
219  econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
220  edm::LogInfo("OMDS record for run ") << irun << " is made of " << dataset_mon.size();
221  int nEB = 0, nEE = 0;
222  typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
223  EcalLogicID ecid_xt;
224  MonPedestalsDat rd_ped;
225 
226  // this to validate ...
227  int nbad = 0;
228  for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) {
229  ecid_xt = p->first;
230  rd_ped = p->second;
231  int sm_num = ecid_xt.getID1();
232  int xt_num = ecid_xt.getID2();
233  int yt_num = ecid_xt.getID3();
234 
236  item.mean_x1 = rd_ped.getPedMeanG1();
237  item.rms_x1 = rd_ped.getPedRMSG1();
238  item.mean_x6 = rd_ped.getPedMeanG6();
239  item.rms_x6 = rd_ped.getPedRMSG6();
240  item.mean_x12 = rd_ped.getPedMeanG12();
241  item.rms_x12 = rd_ped.getPedRMSG12();
242  /*
243  if(irun != 280216 && irun != 280218 && irun != 280259 && irun != 280261 && irun != 280392 && irun != 280394
244  && irun != 280762 && irun != 280765 && irun != 280936 && irun != 280939 && irun != 281756 && irun != 281757) {
245  */
246  if (ecid_xt.getName() == "EB_crystal_number") {
247  nEB++;
248  } else {
249  nEE++;
250  }
251 
252  // here we check and count how many bad channels we have
253 
254  if (!checkPedestal(&item)) {
255  nbad++;
256  if (nbad < 10)
257  std::cout << "BAD LIST: channel " << sm_num << "/" << xt_num << "/" << yt_num << "ped/rms "
258  << item.mean_x12 << "/" << item.rms_x12 << std::endl;
259  }
260  /*
261  }
262  else { // only gain 12 in these runs
263  if(ecid_xt.getName()=="EB_crystal_number") {
264  nEB++;
265  if(item.mean_x12 <= 100 || item.mean_x12 > 300 || item.rms_x12 > 3 || item.rms_x12 <= 0) {
266  nbad++;
267  nEBbad++;
268  }
269  }
270  else {
271  nEE++;
272  if(item.mean_x12 <= 100 || item.mean_x12 > 300 || item.rms_x12 > 3 || item.rms_x12 <= 0) {
273  nbad++;
274  nEEbad++;
275  }
276  }
277  } // only gain 12 in these runs
278  */
279  } // loop over all channels
280 
281  // ok or bad?
282  // a bad run is for more than 5% bad channels
283 
284  // if(nbad<(dataset_mon.size()*0.1)){
285  if (nbad < (dataset_mon.size() * 0.05) && (nEB > 10200 || nEE > 2460)) {
286  for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) {
287  ecid_xt = p->first;
288  rd_ped = p->second;
289  int sm_num = ecid_xt.getID1();
290  int xt_num = ecid_xt.getID2();
291  int yt_num = ecid_xt.getID3();
292 
294  item.mean_x1 = rd_ped.getPedMeanG1();
295  item.rms_x1 = rd_ped.getPedRMSG1();
296  item.mean_x6 = rd_ped.getPedMeanG6();
297  item.rms_x6 = rd_ped.getPedRMSG6();
298  item.mean_x12 = rd_ped.getPedMeanG12();
299  item.rms_x12 = rd_ped.getPedRMSG12();
300 
301  if (ecid_xt.getName() == "EB_crystal_number") {
302  // Barrel channel
303  EBDetId ebdetid(sm_num, xt_num, EBDetId::SMCRYSTALMODE);
304 
305  // individual objects check
306  if (item.mean_x1 == -1 || item.rms_x1 == -1 || item.mean_x6 == -1 || item.rms_x6 == -1 ||
307  item.mean_x12 == -1 || item.rms_x12 == -1 || item.mean_x1 == 0 || item.rms_x1 == 0 ||
308  item.mean_x6 == 0 || item.rms_x6 == 0 || item.mean_x12 == 0 || item.rms_x12 == 0) {
309  // if one is bad we
310  // retrieve the old valid value
311  unsigned int hieb = ebdetid.hashedIndex();
312  EcalPedestals::Item previous_ped = peds->barrel(hieb);
313  if (item.mean_x1 == -1 || item.mean_x1 == 0)
314  item.mean_x1 = previous_ped.mean_x1;
315  if (item.rms_x1 == -1 || item.rms_x1 == 0)
316  item.rms_x1 = previous_ped.rms_x1;
317  if (item.mean_x6 == -1 || item.mean_x6 == 0)
318  item.mean_x6 = previous_ped.mean_x6;
319  if (item.rms_x6 == -1 || item.rms_x6 == 0)
320  item.rms_x6 = previous_ped.rms_x6;
321  if (item.mean_x12 == -1 || item.mean_x12 == 0)
322  item.mean_x12 = previous_ped.mean_x12;
323  if (item.rms_x12 == -1 || item.rms_x12 == 0)
324  item.rms_x12 = previous_ped.rms_x12;
325  }
326 
327  // here we change in the peds object only the channels that are available in the online DB
328  // otherwise we keep the previous value
329  peds->insert(std::make_pair(ebdetid.rawId(), item));
330  } else {
331  // Endcap channel
332  // in this case xt_num is x
333  // yt_num is y and sm_num is the side +/- 1
334  if (EEDetId::validDetId(xt_num, yt_num, sm_num)) {
335  EEDetId eedetid(xt_num, yt_num, sm_num);
336 
337  // individual objects check
338  if (item.mean_x1 == -1 || item.rms_x1 == -1 || item.mean_x6 == -1 || item.rms_x6 == -1 ||
339  item.mean_x12 == -1 || item.rms_x12 == -1 || item.mean_x1 == 0 || item.rms_x1 == 0 ||
340  item.mean_x6 == 0 || item.rms_x6 == 0 || item.mean_x12 == 0 || item.rms_x12 == 0) {
341  // if one is bad we
342  // retrieve the old valid value
343  unsigned int hiee = eedetid.hashedIndex();
344  EcalPedestals::Item previous_ped = peds->endcap(hiee);
345  if (item.mean_x1 == -1 || item.mean_x1 == 0)
346  item.mean_x1 = previous_ped.mean_x1;
347  if (item.rms_x1 == -1 || item.rms_x1 == 0)
348  item.rms_x1 = previous_ped.rms_x1;
349  if (item.mean_x6 == -1 || item.mean_x6 == 0)
350  item.mean_x6 = previous_ped.mean_x6;
351  if (item.rms_x6 == -1 || item.rms_x6 == 0)
352  item.rms_x6 = previous_ped.rms_x6;
353  if (item.mean_x12 == -1 || item.mean_x12 == 0)
354  item.mean_x12 = previous_ped.mean_x12;
355  if (item.rms_x12 == -1 || item.rms_x12 == 0)
356  item.rms_x12 = previous_ped.rms_x12;
357  }
358  // here we change in the peds object only the channels that are available in the online DB
359  // otherwise we keep the previous value
360  peds->insert(std::make_pair(eedetid.rawId(), item));
361  }
362  }
363  }
364 
365  edm::LogInfo("Generating popcon record for run ") << irun << "..." << std::flush;
366  // now I copy peds in pedtemp and I ship pedtemp to popcon
367  // if I use always the same peds I always overwrite
368  // so I really have to create new objects for each new run
369  // popcon deletes everything for me
370 
371  EcalPedestals* pedtemp = new EcalPedestals();
372  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
373  if (iEta == 0)
374  continue;
375  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
376  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
377  if (EBDetId::validDetId(iEta, iPhi)) {
378  EBDetId ebdetid(iEta, iPhi);
379  unsigned int hiee = ebdetid.hashedIndex();
380  EcalPedestals::Item aped = peds->barrel(hiee);
381 
382  // here I copy the last valid value in the peds object
384  item.mean_x1 = aped.mean_x1;
385  item.rms_x1 = aped.rms_x1;
386  item.mean_x6 = aped.mean_x6;
387  item.rms_x6 = aped.rms_x6;
388  item.mean_x12 = aped.mean_x12;
389  item.rms_x12 = aped.rms_x12;
390  // here I copy the last valid value in the pedtemp object
391  pedtemp->insert(std::make_pair(ebdetid.rawId(), item));
392  if ((iEta == -1 || iEta == 1) && iPhi == 20) {
393  float x = aped.mean_x12;
394  edm::LogInfo("channel:") << iEta << "/" << iPhi << "/" << hiee << " ped mean 12=" << x;
395  }
396  }
397  }
398  }
399  // endcaps
400  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
401  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
402  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
403  if (EEDetId::validDetId(iX, iY, 1)) {
404  EEDetId eedetid(iX, iY, 1);
405  unsigned int hiee = eedetid.hashedIndex();
406  EcalPedestals::Item aped = peds->endcap(hiee);
407  // here I copy the last valid value in the peds object
409  item.mean_x1 = aped.mean_x1;
410  item.rms_x1 = aped.rms_x1;
411  item.mean_x6 = aped.mean_x6;
412  item.rms_x6 = aped.rms_x6;
413  item.mean_x12 = aped.mean_x12;
414  item.rms_x12 = aped.rms_x12;
415  // here I copy the last valid value in the pedtemp object
416  pedtemp->insert(std::make_pair(eedetid.rawId(), item));
417  }
418  if (EEDetId::validDetId(iX, iY, -1)) {
419  EEDetId eedetid(iX, iY, -1);
420  unsigned int hiee = eedetid.hashedIndex();
421  EcalPedestals::Item aped = peds->endcap(hiee);
422  // here I copy the last valid value in the peds object
424  item.mean_x1 = aped.mean_x1;
425  item.rms_x1 = aped.rms_x1;
426  item.mean_x6 = aped.mean_x6;
427  item.rms_x6 = aped.rms_x6;
428  item.mean_x12 = aped.mean_x12;
429  item.rms_x12 = aped.rms_x12;
430  // here I copy the last valid value in the pedtemp object
431  pedtemp->insert(std::make_pair(eedetid.rawId(), item));
432  }
433  }
434  }
435 
436  Time_t snc = (Time_t)irun;
437  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedtemp, snc));
438 
439  ss << "Run=" << irun << "_WAS_GOOD_" << std::endl;
440  m_userTextLog = ss.str() + ";";
441  } // good run : write in DB
442  else {
443  edm::LogInfo("Run ") << irun << " was BAD !!!! not sent to the DB";
444  if (nbad >= (dataset_mon.size() * 0.05))
445  edm::LogInfo(" number of bad channels = ") << nbad;
446  if (nEB <= 10200)
447  edm::LogInfo(" number of EB channels = ") << nEB;
448  if (nEE <= 2440)
449  edm::LogInfo(" number of EE channels = ") << nEE;
450  ss << "Run=" << irun << "_WAS_BAD_" << std::endl;
451  m_userTextLog = ss.str() + ";";
452  } // bad run : do not write in DB
453  } // SubRunNumber
454  } // loop over runs
455 
456  delete econn;
457  delete peds; // this is the only one that popcon does not delete
458  } // runs to analyze ?
459  edm::LogInfo("Ecal - > end of getNewObjects -----------\n");
460 }
461 
463 
465  unsigned int max_since = 0;
466  max_since = static_cast<unsigned int>(tagInfo().lastInterval.since);
467  edm::LogInfo("max_since : ") << max_since;
468  Ref ped_db = lastPayload();
469 
470  edm::LogInfo("retrieved last payload ");
471 
472  // we copy the last valid record to a temporary object peds
473  EcalPedestals* peds = new EcalPedestals();
474 
475  // get from offline DB the last valid pedestal set ped_db
476  // edm::ESHandle<EcalPedestals> pedestals;
477  // esetup.get<EcalPedestalsRcd>().get(pedestals);
478 
479  // only positive endcap side and
480  // x from 86 to 95
481  // y from 46 to 55
482  int ixmin = 86;
483  int ixmax = 95;
484  int iymin = 46;
485  int iymax = 55;
486  for (int iX = ixmin; iX <= ixmax; ++iX) {
487  for (int iY = iymin; iY <= iymax; ++iY) {
488  if (EEDetId::validDetId(iX, iY, 1)) {
489  EEDetId eedetidpos(iX, iY, 1);
490  unsigned int hiee = eedetidpos.hashedIndex();
491  EcalPedestals::Item aped = ped_db->endcap(hiee);
492 
493  // here I copy the last valid value in the peds object
495  item.mean_x1 = aped.mean_x1;
496  item.rms_x1 = aped.rms_x1;
497  item.mean_x6 = aped.mean_x6;
498  item.rms_x6 = aped.rms_x6;
499  item.mean_x12 = aped.mean_x12;
500  item.rms_x12 = aped.rms_x12;
501  peds->insert(std::make_pair(eedetidpos.rawId(), item));
502  if (iX == ixmin && iY == iymin)
503  std::cout << "ped12 " << item.mean_x12 << std::endl;
504  }
505  }
506  }
507 
508  edm::LogInfo("We just retrieved the last valid record from DB ");
509 
510  // here we retrieve all the runs after the last from online DB
511 
512  edm::LogInfo("Retrieving run list from ONLINE DB ... ");
513 
514  edm::LogInfo("Making connection...") << std::flush;
515  econn = new EcalCondDBInterface(m_sid, m_user, m_pass);
516  edm::LogInfo("Done.");
517 
518  if (!econn) {
519  edm::LogInfo(" connection parameters ") << m_sid;
520  throw cms::Exception("OMDS not available");
521  }
522 
523  // these are the online conditions DB classes
524  RunList my_runlist;
525  RunTag my_runtag;
528 
529  my_locdef.setLocation("H2_07");
530  my_rundef.setRunType("PEDESTAL");
531  my_runtag.setLocationDef(my_locdef);
532  my_runtag.setRunTypeDef(my_rundef);
533  my_runtag.setGeneralTag("LOCAL");
534 
535  // here we retrieve the Monitoring run records
536 
537  MonVersionDef monverdef;
538  monverdef.setMonitoringVersion("test01");
539 
540  MonRunTag mon_tag;
541  mon_tag.setGeneralTag("CMSSW");
542  mon_tag.setMonVersionDef(monverdef);
543  MonRunList mon_list;
544  mon_list.setMonRunTag(mon_tag);
545  mon_list.setRunTag(my_runtag);
546  // mon_list=econn->fetchMonRunList(my_runtag, mon_tag);
547  unsigned int min_run = max_since + 1; // we have to add 1 to the last transferred one
548 
549  unsigned int max_run = m_lastRun;
550  mon_list = econn->fetchMonRunList(my_runtag, mon_tag, min_run, max_run);
551 
552  std::vector<MonRunIOV> mon_run_vec = mon_list.getRuns();
553  size_t mon_runs = mon_run_vec.size();
554  edm::LogInfo("number of Mon runs is : ") << mon_runs;
555 
556  if (mon_runs > 0) {
557  for (size_t kr = 0; kr < mon_runs; kr++) {
558  unsigned int irun = static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().getRunNumber());
559 
560  edm::LogInfo("here is first sub run : ") << mon_run_vec[kr].getSubRunNumber();
561  edm::LogInfo("here is the run number: ") << mon_run_vec[kr].getRunIOV().getRunNumber();
562 
563  edm::LogInfo(" retrieve the data for a given run");
564 
565  if (mon_run_vec[kr].getSubRunNumber() <= 1) {
566  // retrieve the data for a given run
567  RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
568 
569  // retrieve the pedestals from OMDS for this run
570  std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
571  econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
572  std::cout << "OMDS record for run " << irun << " is made of " << dataset_mon.size() << std::endl;
573  typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
574  EcalLogicID ecid_xt;
575  MonPedestalsDat rd_ped;
576 
577  //int iEta=0;
578  //int iPhi=0;
579  int ix = 0;
580  int iy = 0;
581 
582  for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) {
583  ecid_xt = p->first;
584  rd_ped = p->second;
585  //int sm_num=ecid_xt.getID1();
586  int xt_num = ecid_xt.getID2(); // careful here !!! we number the channels from 1 to 1700
587 
588  //iEta=(xt_num/20)+1;
589  //iPhi=20-(xt_num-(iEta-1)*20);
590 
591  ix = 95 - (xt_num - 1) / 20;
592  iy = 46 + (xt_num - 1) % 20;
593 
595  item.mean_x1 = rd_ped.getPedMeanG1();
596  item.rms_x1 = rd_ped.getPedRMSG1();
597  item.mean_x6 = rd_ped.getPedMeanG6();
598  item.rms_x6 = rd_ped.getPedRMSG6();
599  item.mean_x12 = rd_ped.getPedMeanG12();
600  item.rms_x12 = rd_ped.getPedRMSG12();
601 
602  EEDetId eedetidpos(ix, iy, 1);
603  // EBDetId ebdetid(iEta,iPhi);
604 
605  // here we change in the peds object only the values that are available in the online DB
606  // otherwise we keep the old value
607 
608  peds->insert(std::make_pair(eedetidpos.rawId(), item));
609  if (ix == ixmin && iy == iymin)
610  std::cout << "ped12 " << item.mean_x12 << std::endl;
611  }
612 
613  edm::LogInfo("Generating popcon record for run ") << irun << "..." << std::flush;
614 
615  // now I copy peds in pedtemp and I ship pedtemp to popcon
616  // if I use always the same peds I always overwrite
617  // so I really have to create new objects for each new run
618  // popcon deletes everything for me
619 
620  EcalPedestals* pedtemp = new EcalPedestals();
621 
622  for (int iX = ixmin; iX <= ixmax; ++iX) {
623  for (int iY = iymin; iY <= iymax; ++iY) {
624  if (EEDetId::validDetId(iX, iY, 1)) {
625  EEDetId eedetidpos(iX, iY, 1);
626  unsigned int hiee = eedetidpos.hashedIndex();
627  EcalPedestals::Item aped = peds->endcap(hiee);
628 
630  item.mean_x1 = aped.mean_x1;
631  item.rms_x1 = aped.rms_x1;
632  item.mean_x6 = aped.mean_x6;
633  item.rms_x6 = aped.rms_x6;
634  item.mean_x12 = aped.mean_x12;
635  item.rms_x12 = aped.rms_x12;
636  // here I copy the last valid value in the pedtemp object
637  pedtemp->insert(std::make_pair(eedetidpos.rawId(), item));
638  if (iX == ixmin && iY == iymin)
639  std::cout << "ped12 " << item.mean_x12 << std::endl;
640  }
641  }
642  }
643 
644  Time_t snc = (Time_t)irun;
645 
646  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedtemp, snc));
647 
648  edm::LogInfo("Ecal - > end of getNewObjectsH2 -----------\n");
649  }
650  }
651  }
652  delete econn;
653  delete peds; // this is the only one that popcon does not delete
654 }
656 
658  edm::LogInfo(" reading the input file ") << m_filename;
659  std::ifstream fInput;
660  fInput.open(m_filename);
661  if (!fInput.is_open()) {
662  edm::LogInfo("ERROR : cannot open file ") << m_filename;
663  exit(1);
664  }
665  // string pos, dummyLine;
666  int hashedId;
667  float EBmean12[kEBChannels], EBrms12[kEBChannels], EBmean6[kEBChannels], EBrms6[kEBChannels], EBmean1[kEBChannels],
668  EBrms1[kEBChannels];
669  //***************** barrel
670  // getline(fInput, dummyLine); // skip first line
671  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
672  fInput >> hashedId >> EBmean12[iChannel] >> EBrms12[iChannel] >> EBmean6[iChannel] >> EBrms6[iChannel] >>
673  EBmean1[iChannel] >> EBrms1[iChannel];
674  if (hashedId != iChannel + 1) {
675  edm::LogInfo("File") << m_filename << " strange hash " << hashedId << " while iChannel " << iChannel;
676  exit(-1);
677  }
678  }
679 
680  // ***************** now EE *****************
681  float EEmean12[kEEChannels], EErms12[kEEChannels], EEmean6[kEEChannels], EErms6[kEEChannels], EEmean1[kEEChannels],
682  EErms1[kEEChannels];
683  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
684  fInput >> hashedId >> EEmean12[iChannel] >> EErms12[iChannel] >> EEmean6[iChannel] >> EErms6[iChannel] >>
685  EEmean1[iChannel] >> EErms1[iChannel];
686  if (hashedId != iChannel + kEBChannels + 1) {
687  edm::LogInfo("File") << m_filename << " strange hash " << hashedId << " while iChannel " << iChannel;
688  exit(-1);
689  }
690  }
691  fInput.close();
692 
693  EcalPedestals* ped = new EcalPedestals();
694  // barrel
695  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
696  if (iEta == 0)
697  continue;
698  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
699  if (EBDetId::validDetId(iEta, iPhi)) {
700  EBDetId ebdetid(iEta, iPhi);
701  unsigned int hieb = ebdetid.hashedIndex();
703  item.mean_x1 = EBmean1[hieb];
704  item.rms_x1 = EBrms1[hieb];
705  item.mean_x6 = EBmean6[hieb];
706  item.rms_x6 = EBrms6[hieb];
707  item.mean_x12 = EBmean12[hieb];
708  item.rms_x12 = EBrms12[hieb];
709  ped->insert(std::make_pair(ebdetid.rawId(), item));
710  } // valid EBId
711  } // loop over phi
712  } // loop over eta
713  // endcaps
714  // std::ofstream fout;
715  // fout.open("Pedestal.check");
716  for (int iz = -1; iz < 2; iz = iz + 2) { // z : -1 and +1
717  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
718  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
719  if (EEDetId::validDetId(iX, iY, iz)) {
720  EEDetId eedetid(iX, iY, iz);
721  unsigned int hiee = eedetid.hashedIndex();
722  // fout << hiee << " mean 12 " << EEmean12[hiee] << std::endl;
724  item.mean_x1 = EEmean1[hiee];
725  item.rms_x1 = EErms1[hiee];
726  item.mean_x6 = EEmean6[hiee];
727  item.rms_x6 = EErms6[hiee];
728  item.mean_x12 = EEmean12[hiee];
729  item.rms_x12 = EErms12[hiee];
730  ped->insert(std::make_pair(eedetid.rawId(), item));
731  } // val EEId
732  } // loop over y
733  } // loop over x
734  } // loop over z
735  // fout.close();
736 
737  unsigned int irun = m_firstRun;
738  Time_t snc = (Time_t)irun;
739  m_to_transfer.push_back(std::make_pair((EcalPedestals*)ped, snc));
740 
741  edm::LogInfo("Ecal - > end of readPedestalFile -----------\n");
742 }
744 
746  edm::LogInfo(" reading the input file ") << m_filename;
747  std::ifstream fxml;
748  fxml.open(m_filename);
749  if (!fxml.is_open()) {
750  edm::LogInfo("ERROR : cannot open file ") << m_filename;
751  exit(1);
752  }
753  std::ofstream fout;
754  fout.open("Pedestal.check");
755  // int hashedId;
756  float EBmean12[kEBChannels], EBrms12[kEBChannels], EBmean6[kEBChannels], EBrms6[kEBChannels], EBmean1[kEBChannels],
757  EBrms1[kEBChannels];
758  // int ringEB[kEBChannels], ringEE[kEEChannels];
759  double RingMean[28][2][3], RingRMS[28][2][3];
760  int NbVal[28][2][3];
761  for (int ring = 0; ring < 28; ring++) {
762  for (int side = 0; side < 2; side++) {
763  for (int igain = 0; igain < kGains; igain++) {
764  RingMean[ring][side][igain] = 0.;
765  RingRMS[ring][side][igain] = 0.;
766  NbVal[ring][side][igain] = 0;
767  }
768  }
769  }
770  std::string dummyLine, mean12, rms12, bid;
771  for (int i = 0; i < 9; i++)
772  std::getline(fxml, dummyLine); // skip first lines
773  // Barrel
774  for (int iEBChannel = 0; iEBChannel < kEBChannels; iEBChannel++) {
775  EBDetId ebdetid = EBDetId::unhashIndex(iEBChannel);
776  int ieta = ebdetid.ieta();
777  int ring = (abs(ieta) - 1) / 5;
778  if (ring < 0 || ring > 16)
779  edm::LogInfo("EB channel ") << iEBChannel << " ring " << ring;
780  int izz = 0;
781  if (ieta > 0)
782  izz = 1;
783  fxml >> bid;
784  std::string stt = bid.substr(10, 15);
785  std::istringstream m12(stt);
786  m12 >> EBmean12[iEBChannel];
787  fxml >> bid;
788  stt = bid.substr(9, 15);
789  std::istringstream r12(stt);
790  r12 >> EBrms12[iEBChannel];
791  if (EBrms12[iEBChannel] != 0. && EBrms12[iEBChannel] < 5.) {
792  RingMean[ring][izz][0] += EBrms12[iEBChannel];
793  RingRMS[ring][izz][0] += EBrms12[iEBChannel] * EBrms12[iEBChannel];
794  NbVal[ring][izz][0]++;
795  }
796  fxml >> bid;
797  stt = bid.substr(9, 15);
798  std::istringstream m6(stt);
799  m6 >> EBmean6[iEBChannel];
800  fxml >> bid;
801  stt = bid.substr(8, 15);
802  std::istringstream r6(stt);
803  r6 >> EBrms6[iEBChannel];
804  if (EBrms6[iEBChannel] != 0. && EBrms6[iEBChannel] < 5.) {
805  RingMean[ring][izz][1] += EBrms6[iEBChannel];
806  RingRMS[ring][izz][1] += EBrms6[iEBChannel] * EBrms6[iEBChannel];
807  NbVal[ring][izz][1]++;
808  }
809  fxml >> bid;
810  stt = bid.substr(9, 15);
811  std::istringstream m1(stt);
812  m1 >> EBmean1[iEBChannel];
813  fxml >> bid;
814  stt = bid.substr(8, 15);
815  std::istringstream r1(stt);
816  r1 >> EBrms1[iEBChannel];
817  if (EBrms1[iEBChannel] != 0. && EBrms1[iEBChannel] < 5.) {
818  RingMean[ring][izz][2] += EBrms1[iEBChannel];
819  RingRMS[ring][izz][2] += EBrms1[iEBChannel] * EBrms1[iEBChannel];
820  NbVal[ring][izz][2]++;
821  }
822  if (iEBChannel % 10000 == 0)
823  fout << " EB channel " << iEBChannel << " " << EBmean12[iEBChannel] << " " << EBrms12[iEBChannel] << " "
824  << EBmean6[iEBChannel] << " " << EBrms6[iEBChannel] << " " << EBmean1[iEBChannel] << " "
825  << EBrms1[iEBChannel] << std::endl;
826  for (int i = 0; i < 3; i++)
827  std::getline(fxml, dummyLine); // skip lines
828  }
829 
830  // ***************** now EE *****************
831  std::ifstream fCrystal;
832  fCrystal.open("Crystal");
833  if (!fCrystal.is_open()) {
834  edm::LogInfo("ERROR : cannot open file Crystal");
835  exit(1);
836  }
837  int ringEE[kEEChannels];
838  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
839  fCrystal >> ringEE[iChannel];
840  int ring = abs(ringEE[iChannel]) - 1;
841  if (ring < 17 || ring > 27) {
842  edm::LogInfo(" EE channel ") << iChannel << " ring " << ringEE[iChannel];
843  exit(-1);
844  }
845  }
846  fCrystal.close();
847 
848  float EEmean12[kEEChannels], EErms12[kEEChannels], EEmean6[kEEChannels], EErms6[kEEChannels], EEmean1[kEEChannels],
849  EErms1[kEEChannels];
850  for (int i = 0; i < 6; i++)
851  std::getline(fxml, dummyLine); // skip lines
852  for (int iEEChannel = 0; iEEChannel < kEEChannels; iEEChannel++) {
853  // int ich = iEEChannel + kEBChannels;
854  fxml >> bid;
855  std::string stt = bid.substr(10, 15);
856  std::istringstream m12(stt);
857  m12 >> EEmean12[iEEChannel];
858  int ring = abs(ringEE[iEEChannel]) - 1;
859  if (ring < 17 || ring > 27)
860  edm::LogInfo("EE channel ") << iEEChannel << " ring " << ring;
861  int izz = 1;
862  if (iEEChannel < 7324)
863  izz = 0;
864  fxml >> bid;
865  stt = bid.substr(9, 15);
866  std::istringstream r12(stt);
867  r12 >> EErms12[iEEChannel];
868  if (EErms12[iEEChannel] != 0. && EErms12[iEEChannel] < 5.) {
869  RingMean[ring][izz][0] += EErms12[iEEChannel];
870  RingRMS[ring][izz][0] += EErms12[iEEChannel] * EErms12[iEEChannel];
871  NbVal[ring][izz][0]++;
872  }
873  fxml >> bid;
874  stt = bid.substr(9, 15);
875  std::istringstream m6(stt);
876  m6 >> EEmean6[iEEChannel];
877  fxml >> bid;
878  stt = bid.substr(8, 15);
879  std::istringstream r6(stt);
880  r6 >> EErms6[iEEChannel];
881  if (EErms6[iEEChannel] != 0. && EErms6[iEEChannel] < 5.) {
882  RingMean[ring][izz][1] += EErms6[iEEChannel];
883  RingRMS[ring][izz][1] += EErms6[iEEChannel] * EErms6[iEEChannel];
884  NbVal[ring][izz][1]++;
885  }
886  fxml >> bid;
887  stt = bid.substr(9, 15);
888  std::istringstream m1(stt);
889  m1 >> EEmean1[iEEChannel];
890  fxml >> bid;
891  stt = bid.substr(8, 15);
892  std::istringstream r1(stt);
893  r1 >> EErms1[iEEChannel];
894  if (EErms1[iEEChannel] != 0. && EErms1[iEEChannel] < 5.) {
895  RingMean[ring][izz][2] += EErms1[iEEChannel];
896  RingRMS[ring][izz][2] += EErms1[iEEChannel] * EErms1[iEEChannel];
897  NbVal[ring][izz][2]++;
898  }
899  if (iEEChannel % 1000 == 0)
900  fout << " EE channel " << iEEChannel << " " << EEmean12[iEEChannel] << " " << EErms12[iEEChannel] << " "
901  << EEmean6[iEEChannel] << " " << EErms6[iEEChannel] << " " << EEmean1[iEEChannel] << " "
902  << EErms1[iEEChannel] << std::endl;
903  for (int i = 0; i < 3; i++)
904  std::getline(fxml, dummyLine); // skip lines
905  }
906 
907  fxml.close();
908 
909  for (int gain = 0; gain < kGains; gain++) {
910  fout << "\n"
911  << "**** Gain **** " << gainValues[gain] << "\n";
912  for (int ring = 0; ring < 28; ring++) {
913  for (int side = 0; side < 2; side++) {
914  if (NbVal[ring][side][gain] <= 0) {
915  edm::LogInfo(" No entry for ring ") << ring;
916  exit(-1);
917  }
918  RingMean[ring][side][gain] /= (double)NbVal[ring][side][gain];
919  double x = RingMean[ring][side][gain];
920  RingRMS[ring][side][gain] /= (double)NbVal[ring][side][gain];
921  double rms = sqrt(RingRMS[ring][side][gain] - x * x);
922  RingRMS[ring][side][gain] = rms;
923  fout << " ring " << ring + 1 << " mean " << x << " rms " << rms << " ";
924  } // loop over sides
925  fout << std::endl;
926  if (ring == 16)
927  fout << "***** End caps ***** EE- EE+" << std::endl;
928  } // loop over rings
929  } // loop over gains
930 
931  // read also the ring value from Crystal file
932 
933  EcalPedestals* ped = new EcalPedestals();
934  // barrel
935  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
936  if (iEta == 0)
937  continue;
938  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
939  if (EBDetId::validDetId(iEta, iPhi)) {
940  EBDetId ebdetid(iEta, iPhi);
941  unsigned int hieb = ebdetid.hashedIndex();
943  item.mean_x1 = 200.;
944  item.mean_x6 = 200.;
945  item.mean_x12 = 200.;
946  if (m_corrected) {
947  int ring = (abs(iEta) - 1) / 5;
948  if (ring < 0 || ring > 16)
949  edm::LogInfo("EB channel ") << hieb << " ring " << ring;
950  int side = 0;
951  if (iEta > 0)
952  side = 1;
953  if (EBrms1[hieb] == 0 || EBrms1[hieb] > RingMean[ring][side][2] + 3 * RingRMS[ring][side][2]) {
954  fout << " EB channel " << hieb << " eta " << iEta << " phi " << iPhi << " ring " << ring + 1
955  << " gain 1 rms " << EBrms1[hieb] << " replaced by " << RingMean[ring][side][2] << std::endl;
956  item.rms_x1 = RingMean[ring][side][2];
957  } else
958  item.rms_x1 = EBrms1[hieb];
959  if (EBrms6[hieb] == 0 || EBrms6[hieb] > RingMean[ring][side][1] + 3 * RingRMS[ring][side][1]) {
960  fout << " EB channel " << hieb << " eta " << iEta << " phi " << iPhi << " ring " << ring + 1
961  << " gain 6 rms " << EBrms6[hieb] << " replaced by " << RingMean[ring][side][1] << std::endl;
962  item.rms_x6 = RingMean[ring][side][1];
963  } else
964  item.rms_x6 = EBrms6[hieb];
965  if (EBrms12[hieb] == 0 || EBrms12[hieb] > RingMean[ring][side][0] + 3 * RingRMS[ring][side][0]) {
966  fout << " EB channel " << hieb << " eta " << iEta << " phi " << iPhi << " ring " << ring + 1
967  << " gain 12 rms " << EBrms12[hieb] << " replaced by " << RingMean[ring][side][0] << std::endl;
968  item.rms_x12 = RingMean[ring][side][0];
969  } else
970  item.rms_x12 = EBrms12[hieb];
971  if (hieb > 4534 && hieb < 4540)
972  edm::LogInfo(" Channel ") << hieb << " ring " << ring << " 12 " << EBrms12[hieb] << " mean "
973  << RingMean[ring][side][0] << " rms " << RingRMS[ring][side][0] << " 6 "
974  << EBrms6[hieb] << " mean " << RingMean[ring][side][1] << " rms "
975  << RingRMS[ring][side][1] << " 1 " << EBrms1[hieb] << " mean "
976  << RingMean[ring][side][2] << " rms " << RingRMS[ring][side][2];
977  } // if corrected
978  else {
979  item.rms_x1 = EBrms1[hieb];
980  item.rms_x6 = EBrms6[hieb];
981  item.rms_x12 = EBrms12[hieb];
982  }
983  if (item.rms_x1 > 4. || item.rms_x6 > 4. || item.rms_x12 > 4.)
984  edm::LogInfo(" Channel ") << hieb << " 12 " << item.rms_x12 << " 6 " << item.rms_x6 << " 1 " << item.rms_x1;
985  ped->insert(std::make_pair(ebdetid.rawId(), item));
986  } // valid EBId
987  } // loop over phi
988  } // loop over eta
989 
990  // endcaps
991  for (int iz = -1; iz < 2; iz = iz + 2) { // z : -1 and +1
992  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
993  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
994  if (EEDetId::validDetId(iX, iY, iz)) {
995  EEDetId eedetid(iX, iY, iz);
996  unsigned int hiee = eedetid.hashedIndex();
997  // fout << hiee << " mean 12 " << EEmean12[hiee] << std::endl;
999  item.mean_x1 = 200.;
1000  item.mean_x6 = 200.;
1001  item.mean_x12 = 200.;
1002  if (m_corrected) {
1003  int ring = abs(ringEE[hiee]) - 1;
1004  if (ring < 17 || ring > 27)
1005  edm::LogInfo("EE channel ") << hiee << " ring " << ring;
1006  if (EErms1[hiee] == 0 || EErms1[hiee] > RingMean[ring][iz][2] + 3 * RingRMS[ring][iz][2]) {
1007  fout << " EE channel " << hiee << " x " << iX << " y " << iY << " z " << iz << " ring " << ring + 1
1008  << " gain 1 rms " << EErms1[hiee] << " replaced by " << RingMean[ring][iz][2] << std::endl;
1009  item.rms_x1 = RingMean[ring][iz][2];
1010  } else
1011  item.rms_x1 = EErms1[hiee];
1012  if (EErms6[hiee] == 0 || EErms6[hiee] > RingMean[ring][iz][1] + 3 * RingRMS[ring][iz][1]) {
1013  fout << " EE channel " << hiee << " x " << iX << " y " << iY << " z " << iz << " ring " << ring + 1
1014  << " gain 6 rms " << EErms6[hiee] << " replaced by " << RingMean[ring][iz][1] << std::endl;
1015  item.rms_x6 = RingMean[ring][iz][1];
1016  } else
1017  item.rms_x6 = EErms6[hiee];
1018  if (EErms12[hiee] == 0 || EErms12[hiee] > RingMean[ring][iz][0] + 3 * RingRMS[ring][iz][0]) {
1019  fout << " EE channel " << hiee << " x " << iX << " y " << iY << " z " << iz << " ring " << ring + 1
1020  << " gain 12 rms " << EErms12[hiee] << " replaced by " << RingMean[ring][iz][0] << std::endl;
1021  item.rms_x12 = RingMean[ring][iz][0];
1022  } else
1023  item.rms_x12 = EErms12[hiee];
1024  } // if corrected
1025  else {
1026  item.rms_x1 = EErms1[hiee];
1027  item.rms_x6 = EErms6[hiee];
1028  item.rms_x12 = EErms12[hiee];
1029  }
1030  ped->insert(std::make_pair(eedetid.rawId(), item));
1031  } // val EEId
1032  } // loop over y
1033  } // loop over x
1034  } // loop over z
1035  fout.close();
1036 
1037  unsigned int irun = m_firstRun;
1038  Time_t snc = (Time_t)irun;
1039  m_to_transfer.push_back(std::make_pair((EcalPedestals*)ped, snc));
1040 
1041  edm::LogInfo("Ecal - > end of readPedestalMC -----------\n");
1042 }
1043 
1045 
1047  bool debug = false;
1048  edm::LogInfo(" reading local Pedestal run (2017 way)! ") << m_filename;
1049 
1050  // First we copy the last valid record to a temporary object peds
1051  Ref ped_db = lastPayload();
1052  EcalPedestals* peds = new EcalPedestals();
1053  edm::LogInfo("retrieved last payload ");
1054 
1055  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
1056  if (iEta == 0)
1057  continue;
1058  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
1059  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
1060  if (EBDetId::validDetId(iEta, iPhi)) {
1061  EBDetId ebdetid(iEta, iPhi, EBDetId::ETAPHIMODE);
1062  EcalPedestals::const_iterator it = ped_db->find(ebdetid.rawId());
1063  EcalPedestals::Item aped = (*it);
1064  // here I copy the last valid value in the peds object
1066  item.mean_x1 = aped.mean_x1;
1067  item.rms_x1 = aped.rms_x1;
1068  item.mean_x6 = aped.mean_x6;
1069  item.rms_x6 = aped.rms_x6;
1070  item.mean_x12 = aped.mean_x12;
1071  item.rms_x12 = aped.rms_x12;
1072  peds->insert(std::make_pair(ebdetid.rawId(), item));
1073  }
1074  }
1075  }
1076  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
1077  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
1078  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
1079  if (EEDetId::validDetId(iX, iY, 1)) {
1080  EEDetId eedetidpos(iX, iY, 1);
1081  EcalPedestals::const_iterator it = ped_db->find(eedetidpos.rawId());
1082  EcalPedestals::Item aped = (*it);
1083  // here I copy the last valid value in the peds object
1085  item.mean_x1 = aped.mean_x1;
1086  item.rms_x1 = aped.rms_x1;
1087  item.mean_x6 = aped.mean_x6;
1088  item.rms_x6 = aped.rms_x6;
1089  item.mean_x12 = aped.mean_x12;
1090  item.rms_x12 = aped.rms_x12;
1091  peds->insert(std::make_pair(eedetidpos.rawId(), item));
1092  }
1093  if (EEDetId::validDetId(iX, iY, -1)) {
1094  EEDetId eedetidneg(iX, iY, -1);
1095  EcalPedestals::const_iterator it = ped_db->find(eedetidneg.rawId());
1096  EcalPedestals::Item aped = (*it);
1097  // here I copy the last valid value in the peds object
1099  item.mean_x1 = aped.mean_x1;
1100  item.rms_x1 = aped.rms_x1;
1101  item.mean_x6 = aped.mean_x6;
1102  item.rms_x6 = aped.rms_x6;
1103  item.mean_x12 = aped.mean_x12;
1104  item.rms_x12 = aped.rms_x12;
1105  peds->insert(std::make_pair(eedetidneg.rawId(), item));
1106  }
1107  }
1108  }
1109 
1110  edm::LogInfo(" reading the input file ") << m_filename;
1111  std::ifstream fInput;
1112  fInput.open(m_filename);
1113  if (!fInput.is_open()) {
1114  edm::LogInfo("ERROR : cannot open file ") << m_filename;
1115  exit(1);
1116  }
1117  // string pos, dummyLine;
1118  int hashedId;
1119  float EBmean12[kEBChannels], EBrms12[kEBChannels], EBmean6[kEBChannels], EBrms6[kEBChannels], EBmean1[kEBChannels],
1120  EBrms1[kEBChannels];
1121  //***************** barrel
1122  // getline(fInput, dummyLine); // skip first line
1123  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
1124  fInput >> hashedId >> EBmean12[iChannel] >> EBrms12[iChannel] >> EBmean6[iChannel] >> EBrms6[iChannel] >>
1125  EBmean1[iChannel] >> EBrms1[iChannel];
1126  if (hashedId != iChannel + 1) {
1127  edm::LogInfo("File ") << m_filename << " strange hash " << hashedId << " while iChannel " << iChannel;
1128  exit(-1);
1129  }
1130  }
1131 
1132  // ***************** now EE *****************
1133  float EEmean12[kEEChannels], EErms12[kEEChannels], EEmean6[kEEChannels], EErms6[kEEChannels], EEmean1[kEEChannels],
1134  EErms1[kEEChannels];
1135  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
1136  fInput >> hashedId >> EEmean12[iChannel] >> EErms12[iChannel] >> EEmean6[iChannel] >> EErms6[iChannel] >>
1137  EEmean1[iChannel] >> EErms1[iChannel];
1138  if (hashedId != iChannel + kEBChannels + 1) {
1139  edm::LogInfo("File ") << m_filename << " strange hash " << hashedId << " while iChannel " << iChannel;
1140  exit(-1);
1141  }
1142  }
1143  fInput.close();
1144 
1145  EcalPedestals* ped = new EcalPedestals();
1146  // barrel
1147  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
1148  if (iEta == 0)
1149  continue;
1150  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
1151  if (EBDetId::validDetId(iEta, iPhi)) {
1152  EBDetId ebdetid(iEta, iPhi);
1153  unsigned int hieb = ebdetid.hashedIndex();
1155  EcalPedestals::Item previous_ped = peds->barrel(hieb);
1156  if (debug & (EBmean12[hieb] == -999. || EBrms12[hieb] == -999. || EBmean6[hieb] == -999. ||
1157  EBrms6[hieb] == -999. || EBmean1[hieb] == -999. || EBrms1[hieb] == -999.))
1158  edm::LogInfo(" bad EB channel eta ")
1159  << iEta << " phi " << iPhi << " " << EBmean12[hieb] << " " << EBrms12[hieb] << " " << EBmean6[hieb] << " "
1160  << EBrms6[hieb] << " " << EBmean1[hieb] << " " << EBrms1[hieb];
1161  if (EBmean1[hieb] != -999.)
1162  item.mean_x1 = EBmean1[hieb];
1163  else
1164  item.mean_x1 = previous_ped.mean_x1;
1165  if (EBrms1[hieb] != -999.)
1166  item.rms_x1 = EBrms1[hieb];
1167  else
1168  item.rms_x1 = previous_ped.rms_x1;
1169  if (EBmean6[hieb] != -999.)
1170  item.mean_x6 = EBmean6[hieb];
1171  else
1172  item.mean_x6 = previous_ped.mean_x6;
1173  if (EBrms6[hieb] != -999.)
1174  item.rms_x6 = EBrms6[hieb];
1175  else
1176  item.rms_x6 = previous_ped.rms_x6;
1177  if (EBmean12[hieb] != -999.)
1178  item.mean_x12 = EBmean12[hieb];
1179  else
1180  item.mean_x12 = previous_ped.mean_x12;
1181  if (EBrms12[hieb] != -999.)
1182  item.rms_x12 = EBrms12[hieb];
1183  else
1184  item.rms_x12 = previous_ped.rms_x12;
1185  ped->insert(std::make_pair(ebdetid.rawId(), item));
1186  } // valid EBId
1187  } // loop over phi
1188  } // loop over eta
1189  // endcaps
1190  // std::ofstream fout;
1191  // fout.open("Pedestal.check");
1192  for (int iz = -1; iz < 2; iz = iz + 2) { // z : -1 and +1
1193  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
1194  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
1195  if (EEDetId::validDetId(iX, iY, iz)) {
1196  EEDetId eedetid(iX, iY, iz);
1197  unsigned int hiee = eedetid.hashedIndex();
1198  // fout << hiee << " mean 12 " << EEmean12[hiee] << std::endl;
1200  EcalPedestals::Item previous_ped = peds->endcap(hiee);
1201  if (debug & (EEmean12[hiee] == -999. || EErms12[hiee] == -999. || EEmean6[hiee] == -999. ||
1202  EErms6[hiee] == -999. || EEmean1[hiee] == -999. || EErms1[hiee] == -999.))
1203  edm::LogInfo(" bad EE channel x ")
1204  << iX << " y " << iY << " z" << iz << " " << EEmean12[hiee] << " " << EErms12[hiee] << " "
1205  << EEmean6[hiee] << " " << EErms6[hiee] << " " << EEmean1[hiee] << " " << EErms1[hiee];
1206  if (EEmean1[hiee] != -999.)
1207  item.mean_x1 = EEmean1[hiee];
1208  else
1209  item.mean_x1 = previous_ped.mean_x1;
1210  if (EErms1[hiee] != -999.)
1211  item.rms_x1 = EErms1[hiee];
1212  else
1213  item.rms_x1 = previous_ped.rms_x1;
1214  if (EEmean6[hiee] != -999.)
1215  item.mean_x6 = EEmean6[hiee];
1216  else
1217  item.mean_x6 = previous_ped.mean_x6;
1218  if (EErms6[hiee] != -999.)
1219  item.rms_x6 = EErms6[hiee];
1220  else
1221  item.rms_x6 = previous_ped.rms_x6;
1222  if (EEmean12[hiee] != -999.)
1223  item.mean_x12 = EEmean12[hiee];
1224  else
1225  item.mean_x12 = previous_ped.mean_x12;
1226  if (EErms12[hiee] != -999.)
1227  item.rms_x12 = EErms12[hiee];
1228  else
1229  item.rms_x12 = previous_ped.rms_x12;
1230  ped->insert(std::make_pair(eedetid.rawId(), item));
1231  } // val EEId
1232  } // loop over y
1233  } // loop over x
1234  } // loop over z
1235  // fout.close();
1236 
1237  unsigned int irun = m_firstRun;
1238  Time_t snc = (Time_t)irun;
1239  m_to_transfer.push_back(std::make_pair((EcalPedestals*)ped, snc));
1240 
1241  edm::LogInfo("Ecal - > end of readPedestal2017 -----------\n");
1242 }
1244 
1246  edm::LogInfo(" reading the root file ") << m_filename;
1247  TFile* hfile = new TFile(m_filename.c_str());
1248 
1249  TTree* treeChan = (TTree*)hfile->Get("PedChan");
1250  int iChannel = 0, ix = 0, iy = 0, iz = 0;
1251  treeChan->SetBranchAddress("Channels", &iChannel);
1252  treeChan->SetBranchAddress("x", &ix);
1253  treeChan->SetBranchAddress("y", &iy);
1254  treeChan->SetBranchAddress("z", &iz);
1255  int neventsChan = (int)treeChan->GetEntries();
1256  edm::LogInfo("PedChan nb entries ") << neventsChan;
1257  int ringEB[kEBChannels], sideEB[kEBChannels], ixEE[kEEChannels], iyEE[kEEChannels], izEE[kEEChannels];
1258  for (int entry = 0; entry < neventsChan; entry++) {
1259  treeChan->GetEntry(entry);
1260  if (entry < kEBChannels) {
1261  ringEB[iChannel] = (abs(ix) - 1) / 5; // -85...-1, 1...85 give 0...16
1262  sideEB[iChannel] = 1;
1263  if (ix < 0)
1264  sideEB[iChannel] = 0;
1265  if (entry % 10000 == 0)
1266  edm::LogInfo(" EB channel ") << iChannel << " eta " << ix << " phi " << iy << " side " << sideEB[iChannel]
1267  << " ring " << ringEB[iChannel];
1268  } else {
1269  ixEE[iChannel] = ix;
1270  iyEE[iChannel] = iy;
1271  izEE[iChannel] = iz;
1272  if (entry % 1000 == 0)
1273  edm::LogInfo(" EE channel ") << iChannel << " x " << ixEE[iChannel] << " y " << iyEE[iChannel] << " z "
1274  << izEE[iChannel];
1275  }
1276  }
1277  // 2016 : 26
1278  Int_t pedxml[Nbpedxml] = {271948,
1279  273634,
1280  273931,
1281  274705,
1282  275403,
1283  276108,
1284  276510,
1285  277169,
1286  278123,
1287  278183,
1288  278246,
1289  278389,
1290  278499,
1291  278693,
1292  278858,
1293  278888,
1294  278931,
1295  279728,
1296  280129,
1297  280263,
1298  280941,
1299  281753,
1300  282631,
1301  282833,
1302  283199,
1303  283766,
1304  // 2017 : 25
1305  286535,
1306  293513,
1307  293632,
1308  293732,
1309  295507,
1310  295672,
1311  296391,
1312  296917,
1313  297388,
1314  298481,
1315  299279,
1316  299710,
1317  300186,
1318  300581,
1319  301191,
1320  302006,
1321  302293,
1322  302605,
1323  303436,
1324  303848,
1325  304211,
1326  304680,
1327  305117,
1328  305848,
1329  306176,
1330  // 2018 : 30
1331  313760,
1332  315434,
1333  315831,
1334  316299,
1335  316694,
1336  316963,
1337  317399,
1338  317669,
1339  318249,
1340  318747,
1341  319111,
1342  319365,
1343  319700,
1344  320098,
1345  320515,
1346  320905,
1347  321184,
1348  321480,
1349  321855,
1350  322151,
1351  322653,
1352  323261,
1353  323802,
1354  324250,
1355  324632,
1356  325909,
1357  326038,
1358  326652,
1359  326979,
1360  327271};
1361 
1362  Int_t run16Index = 0;
1363 
1364  Int_t fed[kChannels], chan[kChannels], id, run, run_type, seq_id, las_id, fill_num, run_num_infill, run_time,
1365  run_time_stablebeam, nxt, time[54];
1366  Float_t ped[kChannels], pedrms[kChannels], lumi, bfield;
1367  TTree* tree = (TTree*)hfile->Get("T");
1368  tree->Print();
1369  tree->SetBranchAddress("id", &id);
1370  tree->SetBranchAddress("run", &run);
1371  tree->SetBranchAddress("run_type", &run_type);
1372  tree->SetBranchAddress("seq_id", &seq_id);
1373  tree->SetBranchAddress("las_id", &las_id);
1374  tree->SetBranchAddress("fill_num", &fill_num);
1375  tree->SetBranchAddress("run_num_infill", &run_num_infill);
1376  tree->SetBranchAddress("run_time", &run_time);
1377  tree->SetBranchAddress("run_time_stablebeam", &run_time_stablebeam);
1378  tree->SetBranchAddress("lumi", &lumi);
1379  tree->SetBranchAddress("bfield", &bfield);
1380  tree->SetBranchAddress("nxt", &nxt); // nb of filled Crystals
1381  tree->SetBranchAddress("time", time);
1382  tree->SetBranchAddress("fed", fed);
1383  tree->SetBranchAddress("chan", chan);
1384  tree->SetBranchAddress("ped", ped);
1385  tree->SetBranchAddress("pedrms", pedrms);
1386  int nevents = (int)tree->GetEntries();
1387  edm::LogInfo(" nb entries ") << nevents;
1388  std::ofstream fout;
1389  fout.open("copyTreePedestals.txt");
1390  if (!fout.is_open()) {
1391  edm::LogInfo("ERROR : cannot open file copyTreePedestals.txt");
1392  exit(1);
1393  }
1394  Double_t EAmean1[kChannels], EArms1[kChannels], EAmean6[kChannels], EArms6[kChannels], EAmean12[kChannels],
1395  EArms12[kChannels];
1396  Int_t RunEntry = 0, EAentry[kChannels];
1397  for (int ich = 0; ich < kChannels; ich++) {
1398  EAmean12[ich] = 0;
1399  EArms12[ich] = 0;
1400  EAentry[ich] = 0;
1401  }
1402  tree->GetEntry(0);
1403  fout << " first run " << run << " fill " << fill_num << " B field " << bfield << " run type " << run_type
1404  << " seq_id " << seq_id << " las_id " << las_id << " run_num_infill " << run_num_infill << " lumi " << lumi
1405  << " nb of Crystals " << nxt << std::endl;
1406  for (int ich = 0; ich < kChannels; ich++) {
1407  if (ped[ich] != 0.) {
1408  if (ich < kEBChannels)
1409  fout << " channel " << ich << " FED " << fed[ich] << " chan " << chan[ich] << " pedestal " << ped[ich]
1410  << " RMS " << pedrms[ich] << std::endl;
1411  else // EE
1412  fout << " channel " << ich << " EE channel " << ich - kEBChannels << " FED " << fed[ich] << " chan "
1413  << chan[ich] << " pedestal " << ped[ich] << " RMS " << pedrms[ich] << std::endl;
1414  }
1415  }
1416 
1417  int run_type_kept = m_runtype; // 1 collision 2 cosmics 3 circulating 4 test
1418  int first_run_kept = (int)m_firstRun; // m_firstRun is unsigned!
1419  int last_run_kept = (int)m_lastRun; // m_lastRun is unsigned!
1420  int runold = run;
1421  int firsttimeFED = -1;
1422  // int timeold = -1;
1423  for (int entry = 0; entry < nevents; entry++) {
1424  tree->GetEntry(entry);
1425  if (run < first_run_kept) {
1426  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1427  << " before first wanted " << m_firstRun << std::endl;
1428  runold = run;
1429  continue;
1430  }
1431  if (run > last_run_kept) {
1432  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1433  << " after last wanted " << m_lastRun << std::endl;
1434  runold = run;
1435  break;
1436  }
1437  if (run_type != run_type_kept) {
1438  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time << " run type "
1439  << run_type << std::endl;
1440  continue; // use only wanted type runs
1441  }
1442  if (nxt != kChannels) {
1443  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1444  << " *********** Number of channels " << nxt << std::endl;
1445  continue;
1446  }
1447  if (bfield < 3.79) {
1448  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1449  << " *********** bfield = " << bfield << std::endl;
1450  // continue; keep these runs
1451  }
1452  if (run_type_kept == 1) { // for collision runs, keep only sequences after stable beam
1453  int time_seq = 0;
1454  for (int ifed = 0; ifed < 54; ifed++) {
1455  if (time[ifed] < run_time_stablebeam) {
1456  if (time_seq == 0)
1457  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1458  << " *********** sequence before stable beam at " << run_time_stablebeam << " FED " << ifed << " : "
1459  << time[ifed];
1460  else
1461  fout << " FED " << ifed << " : " << time[ifed];
1462  time_seq++;
1463  }
1464  }
1465  if (time_seq != 0) {
1466  fout << " total nb " << time_seq << std::endl;
1467  continue;
1468  }
1469  } // only collision runs
1470  // if(idtime != timeold) {
1471  // edm::LogInfo(" entry ")<< entry << " run " << run << " time " << idtime << " run type " << run_type;
1472  // timeold = idtime;
1473  // }
1474  if (run == runold) {
1475  RunEntry++;
1476  for (int ich = 0; ich < kChannels; ich++) {
1477  if (ped[ich] < 300 && ped[ich] > 100) {
1478  EAmean12[ich] += ped[ich];
1479  EArms12[ich] += pedrms[ich];
1480  EAentry[ich]++;
1481  }
1482  }
1483  } else {
1484  // new run. Write the previous one
1485  // edm::LogInfo(" entry ")<< entry << " fill " << fill_num << " run " << runold << " nb of events " << RunEntry
1486  // << " time " << run_time << " " << run_time_stablebeam << " " << time[0] << " run type " << run_type;
1487  if (RunEntry == 0 || (run_type_kept == 2 && RunEntry < 6))
1488  fout << " skiped run " << runold << " not enough entries : " << RunEntry << std::endl;
1489  else {
1490  fout << " entry " << entry - 1 << " run " << runold << " nb of events " << RunEntry;
1491  firsttimeFED = time[0];
1492  for (int ifed = 0; ifed < 54; ifed++) {
1493  fout << " " << time[ifed];
1494  if (firsttimeFED < time[ifed])
1495  firsttimeFED = time[ifed];
1496  }
1497  fout << std::endl;
1498 
1499  // get gain 1 and 6 results
1500  bool foundNew = false;
1501  for (int i = run16Index; i < Nbpedxml; i++) {
1502  if (runold > pedxml[i]) {
1503  fout << " found a new gain 1, 6 file " << pedxml[i] << " at index " << i << std::endl;
1504  run16Index++;
1505  foundNew = true;
1506  if (runold < pedxml[i + 1])
1507  break;
1508  }
1509  }
1510  if (foundNew) {
1511  int Indexxml = run16Index - 1;
1512  fout << " opening Pedestals_" << pedxml[Indexxml] << ".xml at index " << Indexxml << std::endl;
1513  std::ifstream fxml;
1514  fxml.open(Form("Pedestals_%i.xml", pedxml[Indexxml]));
1515  if (!fxml.is_open()) {
1516  edm::LogInfo("ERROR : cannot open file Pedestals_") << pedxml[Indexxml] << ".xml";
1517  exit(1);
1518  }
1519  std::string dummyLine, mean12, rms12, bid;
1520  for (int i = 0; i < 9; i++)
1521  std::getline(fxml, dummyLine); // skip first lines
1522  // Barrel
1523  for (int iEBChannel = 0; iEBChannel < kEBChannels; iEBChannel++) {
1524  fxml >> mean12 >> rms12 >> bid;
1525  // std::string stt = bid.std::substr(10,15);
1526  // istringstream ii(stt);
1527  // ii >> EBmean12[iEBChannel];
1528  // fxml >> bid;
1529  // stt = bid.substr(9,15);
1530  // istringstream r12(stt);
1531  // r12 >> EBrms12[iEBChannel];
1532  // fxml >> bid;
1533  std::string stt = bid.substr(9, 15);
1534  std::istringstream m6(stt);
1535  m6 >> EAmean6[iEBChannel];
1536  fxml >> bid;
1537  stt = bid.substr(8, 15);
1538  std::istringstream r6(stt);
1539  r6 >> EArms6[iEBChannel];
1540  fxml >> bid;
1541  stt = bid.substr(9, 15);
1542  std::istringstream m1(stt);
1543  m1 >> EAmean1[iEBChannel];
1544  fxml >> bid;
1545  stt = bid.substr(8, 15);
1546  std::istringstream r1(stt);
1547  r1 >> EArms1[iEBChannel];
1548  if (iEBChannel % 10000 == 0)
1549  fout << " EB channel " << iEBChannel << " " << mean12 << " " << rms12 << " " << EAmean6[iEBChannel] << " "
1550  << EArms6[iEBChannel] << " " << EAmean1[iEBChannel] << " " << EArms1[iEBChannel] << std::endl;
1551  for (int i = 0; i < 3; i++)
1552  std::getline(fxml, dummyLine); // skip lines
1553  }
1554  for (int i = 0; i < 6; i++)
1555  std::getline(fxml, dummyLine); // skip lines
1556  for (int iEEChannel = 0; iEEChannel < kEEChannels; iEEChannel++) {
1557  int ich = iEEChannel + kEBChannels;
1558  fxml >> mean12 >> rms12 >> bid;
1559  std::string stt = bid.substr(9, 15);
1560  std::istringstream m6(stt);
1561  m6 >> EAmean6[ich];
1562  fxml >> bid;
1563  stt = bid.substr(8, 15);
1564  std::istringstream r6(stt);
1565  r6 >> EArms6[ich];
1566  fxml >> bid;
1567  stt = bid.substr(9, 15);
1568  std::istringstream m1(stt);
1569  m1 >> EAmean1[ich];
1570  fxml >> bid;
1571  stt = bid.substr(8, 15);
1572  std::istringstream r1(stt);
1573  r1 >> EArms1[ich];
1574  if (iEEChannel % 1000 == 0)
1575  fout << " EE channel " << iEEChannel << " " << mean12 << " " << rms12 << " " << EAmean6[ich] << " "
1576  << EArms6[ich] << " " << EAmean1[ich] << " " << EArms1[ich] << std::endl;
1577  for (int i = 0; i < 3; i++)
1578  std::getline(fxml, dummyLine); // skip lines
1579  }
1580 
1581  fxml.close();
1582  }
1583  // end gain 1 and 6 results
1584 
1587  for (int ich = 0; ich < kChannels; ich++) {
1588  if (EAentry[ich] != 0) {
1589  EAmean12[ich] /= EAentry[ich];
1590  EArms12[ich] /= EAentry[ich];
1591  } else {
1592  EAmean12[ich] = 200.;
1593  EArms12[ich] = 0.;
1594  }
1595  if (ich % 10000 == 0)
1596  fout << " channel " << ich << " ped " << EAmean12[ich] << " RMS " << EArms12[ich] << std::endl;
1597  //
1598  item.mean_x1 = EAmean1[ich];
1599  item.rms_x1 = EArms1[ich];
1600  item.mean_x6 = EAmean6[ich];
1601  item.rms_x6 = EArms6[ich];
1602  item.mean_x12 = EAmean12[ich];
1603  item.rms_x12 = EArms12[ich];
1604  if (ich < kEBChannels) {
1605  // EBDetId ebdetid(fed, chan, EBDetId::SMCRYSTALMODE);
1606  EBDetId ebdetid = EBDetId::unhashIndex(ich);
1607  pedestal->insert(std::make_pair(ebdetid.rawId(), item));
1608  } else {
1609  // EEDetId eedetid(iX, iY, iz);
1610  int iChannel = ich - kEBChannels;
1611  EEDetId eedetid = EEDetId::unhashIndex(iChannel);
1612  pedestal->insert(std::make_pair(eedetid.rawId(), item));
1613  }
1614  } // end loop over all channels
1615  Time_t snc = (Time_t)runold;
1616  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedestal, snc));
1617  } // skip too short cosmics runs
1618 
1619  runold = run;
1620  RunEntry = 1;
1621  for (int ich = 0; ich < kChannels; ich++) {
1622  if (ped[ich] < 300 && ped[ich] > 100) {
1623  EAmean12[ich] = ped[ich];
1624  EArms12[ich] = pedrms[ich];
1625  EAentry[ich] = 1;
1626  } else {
1627  EAmean12[ich] = 0;
1628  EArms12[ich] = 0;
1629  EAentry[ich] = 0;
1630  }
1631  }
1632  } // new run
1633  } // end loop over all entries
1634  // write also the last run
1635  fout << " last entry fill " << fill_num << " run " << runold << " nb of events " << RunEntry << " time " << run_time
1636  << " " << run_time_stablebeam << " " << time[0] << " run type " << run_type << std::endl;
1637  for (int ifed = 0; ifed < 54; ifed++)
1638  fout << " " << time[ifed];
1639  fout << std::endl;
1642  for (int ich = 0; ich < kChannels; ich++) {
1643  if (EAentry[ich] != 0) {
1644  EAmean12[ich] /= EAentry[ich];
1645  EArms12[ich] /= EAentry[ich];
1646  } else {
1647  EAmean12[ich] = 200.;
1648  EArms12[ich] = 0.;
1649  }
1650  if (ich % 10000 == 0)
1651  fout << " channel " << ich << " ped " << EAmean12[ich] << " RMS " << EArms12[ich] << std::endl;
1652  // get gain 1 and 6 results
1653  // ...
1654  //
1655  item.mean_x1 = EAmean1[ich];
1656  item.rms_x1 = EArms1[ich];
1657  item.mean_x6 = EAmean6[ich];
1658  item.rms_x6 = EArms6[ich];
1659  item.mean_x12 = EAmean12[ich];
1660  item.rms_x12 = EArms12[ich];
1661  if (ich < kEBChannels) {
1662  // EBDetId ebdetid(fed, chan, EBDetId::SMCRYSTALMODE);
1663  EBDetId ebdetid = EBDetId::unhashIndex(ich);
1664  pedestal->insert(std::make_pair(ebdetid.rawId(), item));
1665  } else {
1666  // EEDetId eedetid(iX, iY, iz);
1667  int iChannel = ich - kEBChannels;
1668  EEDetId eedetid = EEDetId::unhashIndex(iChannel);
1669  pedestal->insert(std::make_pair(eedetid.rawId(), item));
1670  }
1671  } // end loop over all channels
1672  Time_t snc = (Time_t)runold;
1673  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedestal, snc)); // run based IOV
1674  edm::LogInfo("Ecal - > end of readPedestalTree -----------\n");
1675 }
1677 
1679  bool debug = false;
1680  edm::LogInfo(" reading the root file ") << m_filename;
1681  TFile* hfile = new TFile(m_filename.c_str());
1682 
1683  TTree* treeChan = (TTree*)hfile->Get("PedChan");
1684  int iChannel = 0, ix = 0, iy = 0, iz = 0;
1685  treeChan->SetBranchAddress("Channels", &iChannel);
1686  treeChan->SetBranchAddress("x", &ix);
1687  treeChan->SetBranchAddress("y", &iy);
1688  treeChan->SetBranchAddress("z", &iz);
1689  int neventsChan = (int)treeChan->GetEntries();
1690  edm::LogInfo("PedChan nb entries ") << neventsChan;
1691  int ringEB[kEBChannels], sideEB[kEBChannels], ixEE[kEEChannels], iyEE[kEEChannels], izEE[kEEChannels];
1692  for (int entry = 0; entry < neventsChan; entry++) {
1693  treeChan->GetEntry(entry);
1694  if (entry < kEBChannels) {
1695  ringEB[iChannel] = (abs(ix) - 1) / 5; // -85...-1, 1...85 give 0...16
1696  sideEB[iChannel] = 1;
1697  if (ix < 0)
1698  sideEB[iChannel] = 0;
1699  if (debug && entry % 10000 == 0)
1700  edm::LogInfo(" EB channel ") << iChannel << " eta " << ix << " phi " << iy << " side " << sideEB[iChannel]
1701  << " ring " << ringEB[iChannel];
1702  } else {
1703  ixEE[iChannel] = ix;
1704  iyEE[iChannel] = iy;
1705  izEE[iChannel] = iz;
1706  if (debug && entry % 1000 == 0)
1707  edm::LogInfo(" EE channel ") << iChannel << " x " << ixEE[iChannel] << " y " << iyEE[iChannel] << " z "
1708  << izEE[iChannel];
1709  }
1710  }
1711  // 2016: 26
1712  Int_t pedxml[Nbpedxml] = {271948,
1713  273634,
1714  273931,
1715  274705,
1716  275403,
1717  276108,
1718  276510,
1719  277169,
1720  278123,
1721  278183,
1722  278246,
1723  278389,
1724  278499,
1725  278693,
1726  278858,
1727  278888,
1728  278931,
1729  279728,
1730  280129,
1731  280263,
1732  280941,
1733  281753,
1734  282631,
1735  282833,
1736  283199,
1737  283766,
1738  // 2017 : 25
1739  286535,
1740  293513,
1741  293632,
1742  293732,
1743  295507,
1744  295672,
1745  296391,
1746  296917,
1747  297388,
1748  298481,
1749  299279,
1750  299710,
1751  300186,
1752  300581,
1753  301191,
1754  302006,
1755  302293,
1756  302605,
1757  303436,
1758  303848,
1759  304211,
1760  304680,
1761  305117,
1762  305848,
1763  306176,
1764  // 2018 : 30
1765  313760,
1766  315434,
1767  315831,
1768  316299,
1769  316694,
1770  316963,
1771  317399,
1772  317669,
1773  318249,
1774  318747,
1775  319111,
1776  319365,
1777  319700,
1778  320098,
1779  320515,
1780  320905,
1781  321184,
1782  321480,
1783  321855,
1784  322151,
1785  322653,
1786  323261,
1787  323802,
1788  324250,
1789  324632,
1790  325909,
1791  326038,
1792  326652,
1793  326979,
1794  327271};
1795 
1796  Int_t run16Index = 0;
1797 
1798  Int_t fed[kChannels], chan[kChannels], id, run, run_type, seq_id, las_id, fill_num, run_num_infill, run_time,
1799  run_time_stablebeam, nxt, time[54];
1800  Float_t ped[kChannels], pedrms[kChannels], lumi, bfield;
1801  TTree* tree = (TTree*)hfile->Get("T");
1802  tree->Print();
1803  tree->SetBranchAddress("id", &id);
1804  tree->SetBranchAddress("run", &run);
1805  tree->SetBranchAddress("run_type", &run_type);
1806  tree->SetBranchAddress("seq_id", &seq_id);
1807  tree->SetBranchAddress("las_id", &las_id);
1808  tree->SetBranchAddress("fill_num", &fill_num);
1809  tree->SetBranchAddress("run_num_infill", &run_num_infill);
1810  tree->SetBranchAddress("run_time", &run_time);
1811  tree->SetBranchAddress("run_time_stablebeam", &run_time_stablebeam);
1812  tree->SetBranchAddress("lumi", &lumi);
1813  tree->SetBranchAddress("bfield", &bfield);
1814  tree->SetBranchAddress("nxt", &nxt); // nb of filled Crystals
1815  tree->SetBranchAddress("time", time);
1816  tree->SetBranchAddress("fed", fed);
1817  tree->SetBranchAddress("chan", chan);
1818  tree->SetBranchAddress("ped", ped);
1819  tree->SetBranchAddress("pedrms", pedrms);
1820  int nevents = (int)tree->GetEntries();
1821  edm::LogInfo(" nb entries ") << nevents;
1822  std::ofstream fout;
1823  fout.open("copyTimestampPedestals.txt");
1824  if (!fout.is_open()) {
1825  edm::LogInfo("ERROR : cannot open file copyTimestampPedestals.txt");
1826  exit(1);
1827  }
1828  Double_t EAmean1[kChannels], EArms1[kChannels], EAmean6[kChannels], EArms6[kChannels], EAmean12[kChannels],
1829  EArms12[kChannels];
1830  for (int ich = 0; ich < kChannels; ich++) {
1831  EAmean12[ich] = 200.;
1832  EArms12[ich] = 0.;
1833  }
1834  tree->GetEntry(0);
1835  fout << " first run " << run << " fill " << fill_num << " B field " << bfield << " run type " << run_type
1836  << " seq_id " << seq_id << " las_id " << las_id << " run_num_infill " << run_num_infill << " lumi " << lumi
1837  << " nb of Crystals " << nxt << std::endl;
1838  if (debug) {
1839  for (int ich = 0; ich < kChannels; ich++) {
1840  if (ped[ich] != 0.) {
1841  if (ich < kEBChannels)
1842  fout << " channel " << ich << " FED " << fed[ich] << " chan " << chan[ich] << " pedestal " << ped[ich]
1843  << " RMS " << pedrms[ich] << std::endl;
1844  else // EE
1845  fout << " channel " << ich << " EE channel " << ich - kEBChannels << " FED " << fed[ich] << " chan "
1846  << chan[ich] << " pedestal " << ped[ich] << " RMS " << pedrms[ich] << std::endl;
1847  }
1848  }
1849  } // debug
1850 
1851  int runold = -1, fillold = -1, firsttimeFEDold = -1;
1852  int firsttimeFED = -1, firstFillSequence = 0;
1853  bool firstSeqBeforeStable = false;
1854  int transfer = 0;
1855  int first_run_kept = (int)m_firstRun; // m_firstRun is unsigned!
1856  int last_run_kept = (int)m_lastRun; // m_lastRun is unsigned!
1857  for (int entry = 0; entry < nevents; entry++) {
1858  tree->GetEntry(entry);
1859  if (nxt != kChannels) {
1860  // fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1861  fout << " entry " << entry << " run " << run << " sequence " << seq_id // run_time always 0!
1862  << " *********** Number of channels " << nxt;
1863  // if(seq_id == 0) { corrected Sep 15 2017
1864  fout << " rejected" << std::endl;
1865  continue;
1866  // }
1867  // else fout << std::endl;
1868  }
1869  if (run_type != 1) {
1870  fout << " entry " << entry << " run " << run << " sequence " << seq_id
1871  << " *********** run_type ( 1 coll, 2 cosm, 3 circ, 4 test ) = " << run_type << std::endl;
1872  continue;
1873  }
1874  if (las_id != 447) { //447 = blue laser
1875  fout << " entry " << entry << " run " << run << " sequence " << seq_id
1876  << " *********** laser wave length = " << las_id << std::endl;
1877  continue;
1878  }
1879  // if(las_id != 527) { //527 = green laser
1880  // fout << " entry " << entry << " run " << run << " sequence " << seq_id
1881  // << " *********** laser wave length = " << las_id << std::endl;
1882  // continue;
1883  // }
1884  if (bfield < 3.79) {
1885  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " *********** bfield = " << bfield
1886  << std::endl;
1887  // continue; keep these runs
1888  }
1889  fout << " entry " << entry << " run " << run;
1890  if (run_type == 1)
1891  fout << " fill " << fill_num;
1892  fout << " sequence " << seq_id;
1893  if (run_type == 1) {
1894  fout << " stable " << run_time_stablebeam;
1895  if (run_time_stablebeam < first_run_kept) {
1896  fout << " before first wanted " << m_firstRun << std::endl;
1897  continue;
1898  }
1899  }
1900  firsttimeFED = time[0];
1901  for (int ifed = 0; ifed < 54; ifed++) {
1902  if (time[ifed] > firsttimeFEDold && time[ifed] < firsttimeFED)
1903  firsttimeFED = time[ifed]; // take the first AFTER the previous sequence one!...
1904  }
1905  if (firsttimeFED < first_run_kept) {
1906  fout << " time " << firsttimeFED << " before first wanted " << m_firstRun << std::endl;
1907  continue;
1908  }
1909  if (firsttimeFED > last_run_kept) {
1910  fout << " entry " << entry << " time " << firsttimeFED << " after last wanted " << m_lastRun << std::endl;
1911  break;
1912  }
1913  fout << " time " << firsttimeFED << std::endl;
1914  if (firsttimeFED <= firsttimeFEDold) {
1915  edm::LogInfo(" Problem finding the IOV : old one ") << firsttimeFEDold << " new one " << firsttimeFED;
1916  for (int ifed = 0; ifed < 54; ifed++)
1917  edm::LogInfo("Time ") << time[ifed] << " ignore this entry ";
1918  continue;
1919  }
1920  firsttimeFEDold = firsttimeFED;
1921 
1922  // if(run != runold) firstSeqBeforeStable = false;
1923  if (fill_num != fillold) {
1924  firstSeqBeforeStable = false;
1925  firstFillSequence = 0;
1926  } else
1927  firstFillSequence++;
1928  if (run_type == 1) {
1929  if (run_time_stablebeam > 0) {
1930  if (firsttimeFED < run_time_stablebeam) {
1931  fout << " data taken before stable beam, skip it" << std::endl;
1932  firstSeqBeforeStable = true;
1933  runold = run;
1934  fillold = fill_num;
1935  continue;
1936  }
1937  } else // problem with run_time_stablebeam
1938  fout << " *** entry " << entry << " run_time_stablebeam " << run_time_stablebeam << std::endl;
1939  if (firstSeqBeforeStable) { // this is the first fully filled entry after stable beam
1940  firstSeqBeforeStable = false;
1941  firsttimeFED = run_time_stablebeam;
1942  fout << " first full sequence after stable; change the IOV " << firsttimeFED << std::endl;
1943  }
1944  if (firstFillSequence == 0) { // first sequence in this fill
1945  if (firsttimeFED > run_time_stablebeam) {
1946  fout << " first full sequence " << firsttimeFED << " after stable " << run_time_stablebeam
1947  << "; change the IOV " << std::endl;
1948  firsttimeFED = run_time_stablebeam;
1949  }
1950  }
1951  } // only collision runs
1952 
1953  for (int ich = 0; ich < kChannels; ich++) {
1954  if (ped[ich] < 300 && ped[ich] > 100) {
1955  EAmean12[ich] = ped[ich];
1956  EArms12[ich] = pedrms[ich];
1957  }
1958  }
1959  // get gain 1 and 6 results
1960  bool foundNew = false;
1961  if (run != runold) {
1962  for (int i = run16Index; i < Nbpedxml; i++) {
1963  if (run > pedxml[i]) {
1964  fout << " found a new gain 1, 6 file " << pedxml[i] << " at index " << i << std::endl;
1965  run16Index++;
1966  foundNew = true;
1967  // if(runold < pedxml[i + 1]) break; why runold??
1968  if (run < pedxml[i + 1])
1969  break;
1970  }
1971  }
1972  if (foundNew) {
1973  int Indexxml = run16Index - 1;
1974  fout << " opening Pedestals_" << pedxml[Indexxml] << ".xml at index " << Indexxml << std::endl;
1975  std::ifstream fxml;
1976  fxml.open(Form("Pedestals_%i.xml", pedxml[Indexxml]));
1977  if (!fxml.is_open()) {
1978  edm::LogInfo("ERROR : cannot open file Pedestals_") << pedxml[Indexxml] << ".xml";
1979  exit(1);
1980  }
1981  std::string dummyLine, mean12, rms12, bid;
1982  for (int i = 0; i < 9; i++)
1983  std::getline(fxml, dummyLine); // skip first lines
1984  // Barrel
1985  for (int iEBChannel = 0; iEBChannel < kEBChannels; iEBChannel++) {
1986  fxml >> mean12 >> rms12 >> bid;
1987  std::string stt = bid.substr(9, 15);
1988  std::istringstream m6(stt);
1989  m6 >> EAmean6[iEBChannel];
1990  fxml >> bid;
1991  stt = bid.substr(8, 15);
1992  std::istringstream r6(stt);
1993  r6 >> EArms6[iEBChannel];
1994  fxml >> bid;
1995  stt = bid.substr(9, 15);
1996  std::istringstream m1(stt);
1997  m1 >> EAmean1[iEBChannel];
1998  fxml >> bid;
1999  stt = bid.substr(8, 15);
2000  std::istringstream r1(stt);
2001  r1 >> EArms1[iEBChannel];
2002  if (debug && iEBChannel % 10000 == 0)
2003  fout << " EB channel " << iEBChannel << " " << mean12 << " " << rms12 << " " << EAmean6[iEBChannel] << " "
2004  << EArms6[iEBChannel] << " " << EAmean1[iEBChannel] << " " << EArms1[iEBChannel] << std::endl;
2005  for (int i = 0; i < 3; i++)
2006  std::getline(fxml, dummyLine); // skip lines
2007  }
2008  for (int i = 0; i < 6; i++)
2009  std::getline(fxml, dummyLine); // skip lines
2010  for (int iEEChannel = 0; iEEChannel < kEEChannels; iEEChannel++) {
2011  int ich = iEEChannel + kEBChannels;
2012  fxml >> mean12 >> rms12 >> bid;
2013  std::string stt = bid.substr(9, 15);
2014  std::istringstream m6(stt);
2015  m6 >> EAmean6[ich];
2016  fxml >> bid;
2017  stt = bid.substr(8, 15);
2018  std::istringstream r6(stt);
2019  r6 >> EArms6[ich];
2020  fxml >> bid;
2021  stt = bid.substr(9, 15);
2022  std::istringstream m1(stt);
2023  m1 >> EAmean1[ich];
2024  fxml >> bid;
2025  stt = bid.substr(8, 15);
2026  std::istringstream r1(stt);
2027  r1 >> EArms1[ich];
2028  if (debug && iEEChannel % 1000 == 0)
2029  fout << " EE channel " << iEEChannel << " " << mean12 << " " << rms12 << " " << EAmean6[ich] << " "
2030  << EArms6[ich] << " " << EAmean1[ich] << " " << EArms1[ich] << std::endl;
2031  for (int i = 0; i < 3; i++)
2032  std::getline(fxml, dummyLine); // skip lines
2033  }
2034  fxml.close();
2035  } // found a new gain 1 6 file
2036  } // check gain 1 and 6 results only for new runs
2037 
2040  for (int ich = 0; ich < kChannels; ich++) {
2041  if (debug && ich % 10000 == 0)
2042  fout << " channel " << ich << " ped " << EAmean12[ich] << " RMS " << EArms12[ich] << std::endl;
2043  //
2044  item.mean_x1 = EAmean1[ich];
2045  item.rms_x1 = EArms1[ich];
2046  item.mean_x6 = EAmean6[ich];
2047  item.rms_x6 = EArms6[ich];
2048  item.mean_x12 = EAmean12[ich];
2049  item.rms_x12 = EArms12[ich];
2050  if (ich < kEBChannels) {
2051  // EBDetId ebdetid(fed, chan, EBDetId::SMCRYSTALMODE);
2052  EBDetId ebdetid = EBDetId::unhashIndex(ich);
2053  pedestal->insert(std::make_pair(ebdetid.rawId(), item));
2054  } else {
2055  // EEDetId eedetid(iX, iY, iz);
2056  int iChannel = ich - kEBChannels;
2057  EEDetId eedetid = EEDetId::unhashIndex(iChannel);
2058  pedestal->insert(std::make_pair(eedetid.rawId(), item));
2059  }
2060  } // end loop over all channels
2061  uint64_t iov = (uint64_t)firsttimeFED << 32;
2062  Time_t snc = (Time_t)iov;
2063  transfer++;
2064  fout << " entry " << entry << " transfer " << transfer << " iov " << iov << std::endl;
2065  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedestal, snc)); // time based IOV
2066  fout << " m_to_transfer " << firsttimeFED << std::endl;
2067  runold = run;
2068  fillold = fill_num;
2069  } // end loop over all entries
2070 
2071  edm::LogInfo("Ecal - > end of readPedestalTimestamp -----------\n");
2072 }
bool checkPedestal(EcalPedestals::Item *item)
void setRunTypeDef(const RunTypeDef &runTypeDef)
Definition: RunTag.cc:42
const Int_t kEBChannels
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static const int MIN_IPHI
Definition: EBDetId.h:135
int getID1() const
Definition: EcalLogicID.cc:30
std::string getName() const
Definition: EcalLogicID.cc:26
Definition: RunTag.h:13
int getID2() const
Definition: EcalLogicID.cc:32
float getPedRMSG6() const
EcalPedestalsHandler(edm::ParameterSet const &)
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
void setGeneralTag(std::string tag)
Definition: MonRunTag.cc:21
const Item & barrel(size_t hashedIndex) const
static const int IX_MIN
Definition: EEDetId.h:290
float getPedRMSG1() const
const Int_t gainValues[kGains]
static const int IY_MIN
Definition: EEDetId.h:294
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
void setRunTag(const RunTag &tag)
Definition: MonRunList.cc:18
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
T getUntrackedParameter(std::string const &, T const &) const
const Item & endcap(size_t hashedIndex) const
float getPedMeanG1() const
T sqrt(T t)
Definition: SSEVec.h:19
float getPedMeanG6() const
const Int_t kEEChannels
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void setMonVersionDef(const MonVersionDef &ver)
Definition: MonRunTag.cc:30
float getPedRMSG12() const
static const int ETAPHIMODE
Definition: EBDetId.h:158
void setLocationDef(const LocationDef &locDef)
Definition: RunTag.cc:33
void insert(std::pair< uint32_t, Item > const &a)
static const int IX_MAX
Definition: EEDetId.h:298
Log< level::Info, false > LogInfo
std::vector< MonRunIOV > getRuns()
Definition: MonRunList.cc:32
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:50
#define debug
Definition: HDRShower.cc:19
static const int MAX_IPHI
Definition: EBDetId.h:137
unsigned long long uint64_t
Definition: Time.h:13
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
std::vector< Item >::const_iterator const_iterator
static const int MAX_IETA
Definition: EBDetId.h:136
void setMonRunTag(const MonRunTag &tag)
Definition: MonRunList.cc:23
float getPedMeanG12() const
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
void setMonitoringVersion(std::string ver)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
cond::Time_t Time_t
Definition: Time.h:18
int getID3() const
Definition: EcalLogicID.cc:34
const Int_t Nbpedxml
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
static const int IY_MAX
Definition: EEDetId.h:302
Definition: tree.py:1
void setGeneralTag(std::string tag)
Definition: RunTag.cc:24
int hashedIndex() const
Definition: EEDetId.h:183
static const int SMCRYSTALMODE
Definition: EBDetId.h:159
Definition: RunIOV.h:13
def exit(msg="")
const Int_t kChannels
const Int_t kGains