CMS 3D CMS Logo

EcalPedestalsHandler.cc
Go to the documentation of this file.
2 
5 
6 #include <string.h>
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;
14 
16  : m_name(ps.getUntrackedParameter<std::string>("name","EcalPedestalsHandler")) {
17 
18  std::cout << "EcalPedestals Source handler constructor\n" << std::endl;
19  m_firstRun=static_cast<unsigned int>(atoi( ps.getParameter<std::string>("firstRun").c_str()));
20  m_lastRun=static_cast<unsigned int>(atoi( ps.getParameter<std::string>("lastRun").c_str()));
21  m_sid= ps.getParameter<std::string>("OnlineDBSID");
22  m_user= ps.getParameter<std::string>("OnlineDBUser");
23  m_pass= ps.getParameter<std::string>("OnlineDBPassword");
24  m_locationsource= ps.getParameter<std::string>("LocationSource");
25  m_location=ps.getParameter<std::string>("Location");
26  m_gentag=ps.getParameter<std::string>("GenTag");
27  m_runtag=ps.getParameter<std::string>("RunTag");
28  m_filename = ps.getUntrackedParameter<std::string>("filename","EcalPedestals.txt");
29  m_runtype = ps.getUntrackedParameter<int>("RunType",1);
30 
31  std::cout << m_sid<<"/"<<m_user<<"/"<<m_pass<<"/"<<m_location<<"/"<<m_gentag << std::endl;
32 
33 
34 }
35 
37 
38 
40  std::cout << "------- Ecal - > getNewObjects\n";
41  if(m_locationsource=="H2") {
43  } else if(m_locationsource=="P5") {
45  }
46  else if(m_locationsource=="File") {
48  }
49  else if(m_locationsource=="Tree") {
51  }
52  else if(m_locationsource=="Timestamp") {
54  }
55  else if(m_locationsource=="2017") {
57  }
58  else {
59  std::cout << " unknown location " << m_locationsource << " give up " << std::endl;
60  exit(-1);
61  }
62 }
63 
64 
66  // true means all is standard and OK
67  bool result=true;
68  if(item->rms_x12 >3 || item->rms_x12<=0) result=false;
69  if(item->rms_x6 >2 || item->rms_x6<=0) result=false;
70  if(item->rms_x1 >1 || item->rms_x1<=0) result=false;
71  if(item->mean_x12>300 || item->mean_x12<=100) result=false;
72  if(item->mean_x1>300 || item->mean_x1<=100) result=false;
73  if(item->mean_x6>300 || item->mean_x6<=100) result=false;
74  return result;
75 }
76 
78  std::ostringstream ss;
79  ss<<"ECAL ";
80 
81  unsigned int max_since=0;
82  max_since=static_cast<unsigned int>(tagInfo().lastInterval.first);
83  std::cout << "max_since : " << max_since << std::endl;
84  Ref ped_db = lastPayload();
85 
86  // we copy the last valid record to a temporary object peds
87  EcalPedestals* peds = new EcalPedestals();
88  std::cout << "retrieved last payload " << std::endl;
89 
90  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
91  if(iEta==0) continue;
92  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
93  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
94  if (EBDetId::validDetId(iEta,iPhi)) {
95  EBDetId ebdetid(iEta,iPhi,EBDetId::ETAPHIMODE);
96  EcalPedestals::const_iterator it =ped_db->find(ebdetid.rawId());
97  EcalPedestals::Item aped = (*it);
98 
99  // here I copy the last valid value in the peds object
100  EcalPedestals::Item item;
101  item.mean_x1 = aped.mean_x1;
102  item.rms_x1 = aped.rms_x1;
103  item.mean_x6 = aped.mean_x6;
104  item.rms_x6 = aped.rms_x6;
105  item.mean_x12 = aped.mean_x12;
106  item.rms_x12 = aped.rms_x12;
107 
108  peds->insert(std::make_pair(ebdetid.rawId(),item));
109  }
110  }
111  }
112 
113  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
114  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
115  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
116  if (EEDetId::validDetId(iX,iY,1)) {
117  EEDetId eedetidpos(iX,iY,1);
118 
119  EcalPedestals::const_iterator it =ped_db->find(eedetidpos.rawId());
120  EcalPedestals::Item aped = (*it);
121 
122  // unsigned int hiee = eedetidpos.hashedIndex();
123  // EcalPedestals::Item aped= ped_db->endcap(hiee);
124 
125  // here I copy the last valid value in the peds object
126  EcalPedestals::Item item;
127  item.mean_x1 = aped.mean_x1;
128  item.rms_x1 = aped.rms_x1;
129  item.mean_x6 = aped.mean_x6;
130  item.rms_x6 = aped.rms_x6;
131  item.mean_x12 = aped.mean_x12;
132  item.rms_x12 = aped.rms_x12;
133  peds->insert(std::make_pair(eedetidpos.rawId(),item));
134  }
135  if(EEDetId::validDetId(iX,iY,-1)) {
136  EEDetId eedetidneg(iX,iY,-1);
137 
138  EcalPedestals::const_iterator it =ped_db->find(eedetidneg.rawId());
139  EcalPedestals::Item aped = (*it);
140  // unsigned int hiee = eedetidneg.hashedIndex();
141  // EcalPedestals::Item aped= ped_db->endcap(hiee);
142 
143  // here I copy the last valid value in the peds object
144  EcalPedestals::Item item;
145  item.mean_x1 = aped.mean_x1;
146  item.rms_x1 = aped.rms_x1;
147  item.mean_x6 = aped.mean_x6;
148  item.rms_x6 = aped.rms_x6;
149  item.mean_x12 = aped.mean_x12;
150  item.rms_x12 = aped.rms_x12;
151  peds->insert(std::make_pair(eedetidneg.rawId(),item));
152  }
153  }
154  }
155 
156  // here we retrieve all the runs after the last from online DB
157 
158  std::cout << "Retrieving run list from ONLINE DB ... " << std::endl;
160  std::cout << "Connection done" << std::endl;
161 
162  // these are the online conditions DB classes
163  RunList my_runlist ;
164  RunTag my_runtag;
165  LocationDef my_locdef;
166  RunTypeDef my_rundef;
167 
168  my_locdef.setLocation(m_location);
169  // my_rundef.setRunType("PEDESTAL"); // 2017
170  my_rundef.setRunType(m_runtag);
171  my_runtag.setLocationDef(my_locdef);
172  my_runtag.setRunTypeDef(my_rundef);
173  my_runtag.setGeneralTag(m_gentag);
174 
175  // here we retrieve the Monitoring run records
176 
177  MonVersionDef monverdef;
178  monverdef.setMonitoringVersion("test01");
179 
180  MonRunTag mon_tag;
181  // mon_tag.setGeneralTag("CMSSW");
182  mon_tag.setGeneralTag("CMSSW-offline-private");
183  mon_tag.setMonVersionDef(monverdef);
184  MonRunList mon_list;
185  mon_list.setMonRunTag(mon_tag);
186  mon_list.setRunTag(my_runtag);
187  // mon_list=econn->fetchMonRunList(my_runtag, mon_tag);
188  unsigned int min_run=0;
189  if(m_firstRun<max_since) {
190  min_run=max_since+1; // we have to add 1 to the last transferred one
191  } else {
192  min_run=m_firstRun;
193  }
194 
195  unsigned int max_run=m_lastRun;
196  mon_list=econn->fetchMonRunList(my_runtag, mon_tag,min_run,max_run );
197 
198  std::vector<MonRunIOV> mon_run_vec= mon_list.getRuns();
199  int mon_runs = mon_run_vec.size();
200  std::cout <<"number of Mon runs is : "<< mon_runs<< std::endl;
201 
202  if(mon_runs > 0) {
203  int krmax = std::min(mon_runs, 30);
204  for(int kr = 0; kr < krmax; kr++){
205  std::cout << "-kr------: "<<kr<<std::endl;
206 
207  unsigned int irun=static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().getRunNumber());
208  std::cout << "retrieve the data for run number: "<< mon_run_vec[kr].getRunIOV().getRunNumber() << std::endl;
209  if (mon_run_vec[kr].getSubRunNumber() <=1){
210 
211  // retrieve the data for a given run
212  RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
213  // retrieve the pedestals from OMDS for this run
214  std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
215  econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
216  std::cout <<"OMDS record for run "<<irun <<" is made of "<< dataset_mon.size() << std::endl;
217  int nEB = 0, nEE = 0, nEBbad = 0, nEEbad =0;
218  typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
219  EcalLogicID ecid_xt;
220  MonPedestalsDat rd_ped;
221 
222  // this to validate ...
223  int nbad=0;
224  for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) {
225  ecid_xt = p->first;
226  rd_ped = p->second;
227  int sm_num=ecid_xt.getID1();
228  int xt_num=ecid_xt.getID2();
229  int yt_num=ecid_xt.getID3();
230 
231  EcalPedestals::Item item;
232  item.mean_x1 =rd_ped.getPedMeanG1() ;
233  item.rms_x1 =rd_ped.getPedRMSG1();
234  item.mean_x6 =rd_ped.getPedMeanG6();
235  item.rms_x6 =rd_ped.getPedRMSG6() ;
236  item.mean_x12 =rd_ped.getPedMeanG12();
237  item.rms_x12 =rd_ped.getPedRMSG12();
238  /*
239  if(irun != 280216 && irun != 280218 && irun != 280259 && irun != 280261 && irun != 280392 && irun != 280394
240  && irun != 280762 && irun != 280765 && irun != 280936 && irun != 280939 && irun != 281756 && irun != 281757) {
241  */
242  if(ecid_xt.getName()=="EB_crystal_number") {
243  nEB++;
244  if(!checkPedestal(&item) ) nEBbad++;
245  }
246  else {
247  nEE++;
248  if(!checkPedestal(&item) ) nEEbad++;
249  }
250 
251  // here we check and count how many bad channels we have
252 
253  if(!checkPedestal(&item) ){
254  nbad++;
255  if(nbad < 10) std::cout <<"BAD LIST: channel " << sm_num << "/" << xt_num << "/"<< yt_num
256  << "ped/rms "<<item.mean_x12<< "/"<< item.rms_x12 << std::endl;
257  }
258  /*
259  }
260  else { // only gain 12 in these runs
261  if(ecid_xt.getName()=="EB_crystal_number") {
262  nEB++;
263  if(item.mean_x12 <= 100 || item.mean_x12 > 300 || item.rms_x12 > 3 || item.rms_x12 <= 0) {
264  nbad++;
265  nEBbad++;
266  }
267  }
268  else {
269  nEE++;
270  if(item.mean_x12 <= 100 || item.mean_x12 > 300 || item.rms_x12 > 3 || item.rms_x12 <= 0) {
271  nbad++;
272  nEEbad++;
273  }
274  }
275  } // only gain 12 in these runs
276  */
277  } // loop over all channels
278 
279  // ok or bad?
280  // a bad run is for more than 5% bad channels
281 
282  // if(nbad<(dataset_mon.size()*0.1)){
283  if(nbad<(dataset_mon.size()*0.05) && (nEB > 10200 || nEE > 2460)) {
284 
285  for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) {
286  ecid_xt = p->first;
287  rd_ped = p->second;
288  int sm_num=ecid_xt.getID1();
289  int xt_num=ecid_xt.getID2();
290  int yt_num=ecid_xt.getID3();
291 
292  EcalPedestals::Item item;
293  item.mean_x1 =rd_ped.getPedMeanG1() ;
294  item.rms_x1 =rd_ped.getPedRMSG1();
295  item.mean_x6 =rd_ped.getPedMeanG6();
296  item.rms_x6 =rd_ped.getPedRMSG6() ;
297  item.mean_x12 =rd_ped.getPedMeanG12();
298  item.rms_x12 =rd_ped.getPedRMSG12();
299 
300  if(ecid_xt.getName()=="EB_crystal_number") {
301  // Barrel channel
302  EBDetId ebdetid(sm_num,xt_num,EBDetId::SMCRYSTALMODE);
303 
304  // individual objects check
305  if(item.mean_x1==-1 || item.rms_x1 ==-1 || item.mean_x6==-1 ||
306  item.rms_x6==-1 || item.mean_x12==-1 || item.rms_x12==-1 ||
307  item.mean_x1==0 || item.rms_x1 ==0 || item.mean_x6==0 ||
308  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) item.mean_x1 =previous_ped.mean_x1;
314  if(item.rms_x1==-1 || item.rms_x1==0) item.rms_x1 =previous_ped.rms_x1;
315  if(item.mean_x6==-1 || item.mean_x6==0) item.mean_x6 =previous_ped.mean_x6;
316  if(item.rms_x6==-1 || item.rms_x6==0) item.rms_x6 =previous_ped.rms_x6;
317  if(item.mean_x12==-1 || item.mean_x12==0)item.mean_x12=previous_ped.mean_x12;
318  if(item.rms_x12==-1 || item.rms_x12==0) item.rms_x12 =previous_ped.rms_x12;
319  }
320 
321  // here we change in the peds object only the channels that are available in the online DB
322  // otherwise we keep the previous value
323  peds->insert(std::make_pair(ebdetid.rawId(),item));
324  } else {
325  // Endcap channel
326  // in this case xt_num is x
327  // yt_num is y and sm_num is the side +/- 1
328  if(EEDetId::validDetId(xt_num,yt_num,sm_num)){
329  EEDetId eedetid(xt_num,yt_num,sm_num);
330 
331  // individual objects check
332  if(item.mean_x1==-1 || item.rms_x1 ==-1 || item.mean_x6==-1 ||
333  item.rms_x6==-1 || item.mean_x12==-1 || item.rms_x12==-1 ||
334  item.mean_x1==0 || item.rms_x1 ==0 || item.mean_x6==0 ||
335  item.rms_x6==0 || item.mean_x12==0 || item.rms_x12==0 ) {
336  // if one is bad we
337  // retrieve the old valid value
338  unsigned int hiee = eedetid.hashedIndex();
339  EcalPedestals::Item previous_ped= peds->endcap(hiee);
340  if(item.mean_x1==-1 || item.mean_x1==0) item.mean_x1 =previous_ped.mean_x1;
341  if(item.rms_x1==-1 || item.rms_x1==0) item.rms_x1 =previous_ped.rms_x1;
342  if(item.mean_x6==-1 || item.mean_x6==0) item.mean_x6 =previous_ped.mean_x6;
343  if(item.rms_x6==-1 || item.rms_x6==0) item.rms_x6 =previous_ped.rms_x6;
344  if(item.mean_x12==-1 || item.mean_x12==0)item.mean_x12=previous_ped.mean_x12;
345  if(item.rms_x12==-1 || item.rms_x12==0) item.rms_x12 =previous_ped.rms_x12;
346  }
347  // here we change in the peds object only the channels that are available in the online DB
348  // otherwise we keep the previous value
349  peds->insert(std::make_pair(eedetid.rawId(),item));
350  }
351  }
352  }
353 
354  std::cout << "Generating popcon record for run " << irun << "..." << std::flush;
355  // now I copy peds in pedtemp and I ship pedtemp to popcon
356  // if I use always the same peds I always overwrite
357  // so I really have to create new objects for each new run
358  // popcon deletes everything for me
359 
360  EcalPedestals* pedtemp = new EcalPedestals();
361  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
362  if(iEta==0) continue;
363  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
364  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
365  if (EBDetId::validDetId(iEta,iPhi)) {
366  EBDetId ebdetid(iEta,iPhi);
367  unsigned int hiee = ebdetid.hashedIndex();
368  EcalPedestals::Item aped= peds->barrel(hiee);
369 
370  // here I copy the last valid value in the peds object
371  EcalPedestals::Item item;
372  item.mean_x1 = aped.mean_x1;
373  item.rms_x1 = aped.rms_x1;
374  item.mean_x6 = aped.mean_x6;
375  item.rms_x6 = aped.rms_x6;
376  item.mean_x12 = aped.mean_x12;
377  item.rms_x12 = aped.rms_x12;
378  // here I copy the last valid value in the pedtemp object
379  pedtemp->insert(std::make_pair(ebdetid.rawId(),item));
380  if((iEta==-1 || iEta==1) && iPhi==20){
381  float x=aped.mean_x12 ;
382  std::cout<< "channel:" <<iEta<<"/"<<iPhi<< "/" << hiee << " ped mean 12="<< x << std::endl;
383  }
384  }
385  }
386  }
387  // endcaps
388  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
389  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
390  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
391  if (EEDetId::validDetId(iX,iY,1)) {
392  EEDetId eedetid(iX,iY,1);
393  unsigned int hiee = eedetid.hashedIndex();
394  EcalPedestals::Item aped= peds->endcap(hiee);
395  // here I copy the last valid value in the peds object
396  EcalPedestals::Item item;
397  item.mean_x1 = aped.mean_x1;
398  item.rms_x1 = aped.rms_x1;
399  item.mean_x6 = aped.mean_x6;
400  item.rms_x6 = aped.rms_x6;
401  item.mean_x12 = aped.mean_x12;
402  item.rms_x12 = aped.rms_x12;
403  // here I copy the last valid value in the pedtemp object
404  pedtemp->insert(std::make_pair(eedetid.rawId(),item));
405  }
406  if (EEDetId::validDetId(iX,iY,-1)) {
407  EEDetId eedetid(iX,iY,-1);
408  unsigned int hiee = eedetid.hashedIndex();
409  EcalPedestals::Item aped= peds->endcap(hiee);
410  // here I copy the last valid value in the peds object
411  EcalPedestals::Item item;
412  item.mean_x1 = aped.mean_x1;
413  item.rms_x1 = aped.rms_x1;
414  item.mean_x6 = aped.mean_x6;
415  item.rms_x6 = aped.rms_x6;
416  item.mean_x12 = aped.mean_x12;
417  item.rms_x12 = aped.rms_x12;
418  // here I copy the last valid value in the pedtemp object
419  pedtemp->insert(std::make_pair(eedetid.rawId(),item));
420  }
421  }
422  }
423 
424  Time_t snc= (Time_t) irun ;
425  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedtemp,snc));
426 
427  ss << "Run=" << irun << "_WAS_GOOD_"<<std::endl;
428  m_userTextLog = ss.str()+";";
429  } // good run : write in DB
430  else {
431  std::cout << "Run " << irun << " was BAD !!!! not sent to the DB";
432  if(nbad >= (dataset_mon.size()*0.05))
433  std::cout << " number of bad channels = " << nbad;
434  if(nEB <= 10200)
435  std::cout << " number of EB channels = " << nEB;
436  if(nEE <= 2440)
437  std::cout << " number of EE channels = " << nEE;
438  std::cout << std::endl;
439  ss << "Run=" << irun << "_WAS_BAD_"<<std::endl;
440  m_userTextLog = ss.str()+";";
441  } // bad run : do not write in DB
442  } // SubRunNumber
443  } // loop over runs
444 
445  delete econn;
446  delete peds; // this is the only one that popcon does not delete
447  } // runs to analyze ?
448  std::cout << "Ecal - > end of getNewObjects -----------\n";
449 }
450 
451 
453  unsigned int max_since=0;
454  max_since=static_cast<unsigned int>(tagInfo().lastInterval.first);
455  std::cout << "max_since : " << max_since << std::endl;
456  Ref ped_db = lastPayload();
457 
458  std::cout << "retrieved last payload " << std::endl;
459 
460 
461  // we copy the last valid record to a temporary object peds
462  EcalPedestals* peds = new EcalPedestals();
463 
464  // get from offline DB the last valid pedestal set ped_db
465  // edm::ESHandle<EcalPedestals> pedestals;
466  // esetup.get<EcalPedestalsRcd>().get(pedestals);
467 
468 
469  // only positive endcap side and
470  // x from 86 to 95
471  // y from 46 to 55
472  int ixmin=86; int ixmax=95;
473  int iymin=46; int iymax=55;
474  for(int iX=ixmin; iX<=ixmax ;++iX) {
475  for(int iY=iymin; iY<=iymax; ++iY) {
476 
477  if (EEDetId::validDetId(iX,iY,1)) {
478  EEDetId eedetidpos(iX,iY,1);
479  unsigned int hiee = eedetidpos.hashedIndex();
480  EcalPedestals::Item aped= ped_db->endcap(hiee);
481 
482  // here I copy the last valid value in the peds object
483  EcalPedestals::Item item;
484  item.mean_x1 = aped.mean_x1;
485  item.rms_x1 = aped.rms_x1;
486  item.mean_x6 = aped.mean_x6;
487  item.rms_x6 = aped.rms_x6;
488  item.mean_x12 = aped.mean_x12;
489  item.rms_x12 = aped.rms_x12;
490  peds->insert(std::make_pair(eedetidpos.rawId(),item));
491  if(iX==ixmin && iY==iymin) std::cout<<"ped12 " << item.mean_x12<< std::endl;
492 
493  }
494  }
495  }
496 
497 
498  std::cout <<"WOW: we just retrieved the last valid record from DB "<< std::endl;
499 
500 
501  // here we retrieve all the runs after the last from online DB
502 
503  std::cout << "Retrieving run list from ONLINE DB ... " << std::endl;
504 
505  std::cout << "Making connection..." << std::flush;
507  std::cout << "Done." << std::endl;
508 
509  if (!econn)
510  {
511  std::cout << " connection parameters " <<m_sid <<"/"<<m_user<<"/"<<m_pass<<std::endl;
512  throw cms::Exception("OMDS not available");
513  }
514 
515  // these are the online conditions DB classes
516  RunList my_runlist ;
517  RunTag my_runtag;
518  LocationDef my_locdef;
519  RunTypeDef my_rundef;
520 
521  my_locdef.setLocation("H2_07");
522  my_rundef.setRunType("PEDESTAL");
523  my_runtag.setLocationDef(my_locdef);
524  my_runtag.setRunTypeDef(my_rundef);
525  my_runtag.setGeneralTag("LOCAL");
526 
527 
528  // here we retrieve the Monitoring run records
529 
530  MonVersionDef monverdef;
531  monverdef.setMonitoringVersion("test01");
532 
533  MonRunTag mon_tag;
534  mon_tag.setGeneralTag("CMSSW");
535  mon_tag.setMonVersionDef(monverdef);
536  MonRunList mon_list;
537  mon_list.setMonRunTag(mon_tag);
538  mon_list.setRunTag(my_runtag);
539  // mon_list=econn->fetchMonRunList(my_runtag, mon_tag);
540  unsigned int min_run=max_since+1; // we have to add 1 to the last transferred one
541 
542  unsigned int max_run=m_lastRun;
543  mon_list=econn->fetchMonRunList(my_runtag, mon_tag,min_run,max_run );
544 
545  std::vector<MonRunIOV> mon_run_vec= mon_list.getRuns();
546  size_t mon_runs=mon_run_vec.size();
547  std::cout <<"number of Mon runs is : "<< mon_runs<< std::endl;
548 
549  if(mon_runs>0){
550 
551  for(size_t kr=0; kr<mon_runs; kr++){
552 
553  unsigned int irun=static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().getRunNumber());
554 
555  std::cout << "here is first sub run : "<< mon_run_vec[kr].getSubRunNumber() << std::endl;
556  std::cout << "here is the run number: "<< mon_run_vec[kr].getRunIOV().getRunNumber() << std::endl;
557 
558  std::cout <<" retrieve the data for a given run"<< std::endl;
559 
560  if (mon_run_vec[kr].getSubRunNumber() <=1){
561 
562 
563  // retrieve the data for a given run
564  RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
565 
566  // retrieve the pedestals from OMDS for this run
567  std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
568  econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
569  std::cout <<"OMDS record for run "<<irun <<" is made of "<< dataset_mon.size() << std::endl;
570  typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
571  EcalLogicID ecid_xt;
572  MonPedestalsDat rd_ped;
573 
574  //int iEta=0;
575  //int iPhi=0;
576  int ix=0;
577  int iy=0;
578 
579  for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) {
580  ecid_xt = p->first;
581  rd_ped = p->second;
582  //int sm_num=ecid_xt.getID1();
583  int xt_num=ecid_xt.getID2(); // careful here !!! we number the channels from 1 to 1700
584 
585  //iEta=(xt_num/20)+1;
586  //iPhi=20-(xt_num-(iEta-1)*20);
587 
588  ix=95-(xt_num-1)/20;
589  iy=46+(xt_num-1)%20;
590 
591 
592  EcalPedestals::Item item;
593  item.mean_x1 =rd_ped.getPedMeanG1() ;
594  item.rms_x1 =rd_ped.getPedRMSG1();
595  item.mean_x6 =rd_ped.getPedMeanG6();
596  item.rms_x6 =rd_ped.getPedRMSG6() ;
597  item.mean_x12 =rd_ped.getPedMeanG12();
598  item.rms_x12 =rd_ped.getPedRMSG12();
599 
600  EEDetId eedetidpos(ix,iy,1);
601  // EBDetId ebdetid(iEta,iPhi);
602 
603  // here we change in the peds object only the values that are available in the online DB
604  // otherwise we keep the old value
605 
606  peds->insert(std::make_pair(eedetidpos.rawId(),item));
607  if(ix==ixmin && iy==iymin) std::cout<<"ped12 " << item.mean_x12<< std::endl;
608  }
609 
610  std::cout << "Generating popcon record for run " << irun << "..." << std::flush;
611 
612 
613  // now I copy peds in pedtemp and I ship pedtemp to popcon
614  // if I use always the same peds I always overwrite
615  // so I really have to create new objects for each new run
616  // popcon deletes everything for me
617 
618  EcalPedestals* pedtemp = new EcalPedestals();
619 
620 
621  for(int iX=ixmin; iX<=ixmax ;++iX) {
622  for(int iY=iymin; iY<=iymax; ++iY) {
623 
624  if (EEDetId::validDetId(iX,iY,1))
625  {
626  EEDetId eedetidpos(iX,iY,1);
627  unsigned int hiee = eedetidpos.hashedIndex();
628  EcalPedestals::Item aped = peds->endcap(hiee);
629 
630  EcalPedestals::Item item;
631  item.mean_x1 = aped.mean_x1;
632  item.rms_x1 = aped.rms_x1;
633  item.mean_x6 = aped.mean_x6;
634  item.rms_x6 = aped.rms_x6;
635  item.mean_x12 = aped.mean_x12;
636  item.rms_x12 = aped.rms_x12;
637  // here I copy the last valid value in the pedtemp object
638  pedtemp->insert(std::make_pair(eedetidpos.rawId(),item));
639  if(iX==ixmin && iY==iymin) std::cout<<"ped12 " << item.mean_x12<< std::endl;
640  }
641  }
642  }
643 
644 
645 
646  Time_t snc= (Time_t) irun ;
647 
648  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedtemp,snc));
649 
650  std::cout << "Ecal - > end of getNewObjectsH2 -----------\n";
651 
652  }
653  }
654  }
655  delete econn;
656  delete peds; // this is the only one that popcon does not delete
657 }
658 
660  std::cout << " reading the input file " << m_filename << std::endl;
661  std::ifstream fInput;
662  fInput.open(m_filename);
663  if(!fInput.is_open()) {
664  std::cout << "ERROR : cannot open file " << m_filename << std::endl;
665  exit (1);
666  }
667  // string pos, dummyLine;
668  int hashedId;
669  float EBmean12[kEBChannels], EBrms12[kEBChannels], EBmean6[kEBChannels], EBrms6[kEBChannels], EBmean1[kEBChannels], EBrms1[kEBChannels];
670  //***************** barrel
671  // getline(fInput, dummyLine); // skip first line
672  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
673  fInput >> hashedId >> EBmean12[iChannel] >> EBrms12[iChannel] >> EBmean6[iChannel] >> EBrms6[iChannel]
674  >> EBmean1[iChannel] >> EBrms1[iChannel];
675  if(hashedId != iChannel + 1) {
676  std::cout << m_filename << " strange hash " << hashedId << " while iChannel " << iChannel << std::endl;
677  exit(-1);
678  }
679  }
680 
681  // ***************** now EE *****************
682  float EEmean12[kEEChannels], EErms12[kEEChannels], EEmean6[kEEChannels], EErms6[kEEChannels], EEmean1[kEEChannels], 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  std::cout << m_filename << " strange hash " << hashedId << " while iChannel " << iChannel << std::endl;
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) continue;
697  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
698  if (EBDetId::validDetId(iEta,iPhi)) {
699  EBDetId ebdetid(iEta,iPhi);
700  unsigned int hieb = ebdetid.hashedIndex();
701  EcalPedestals::Item item;
702  item.mean_x1 = EBmean1[hieb];
703  item.rms_x1 = EBrms1[hieb];
704  item.mean_x6 = EBmean6[hieb];
705  item.rms_x6 = EBrms6[hieb];
706  item.mean_x12 = EBmean12[hieb];
707  item.rms_x12 = EBrms12[hieb];
708  ped->insert(std::make_pair(ebdetid.rawId(),item));
709  } // valid EBId
710  } // loop over phi
711  } // loop over eta
712  // endcaps
713  // std::ofstream fout;
714  // fout.open("Pedestal.check");
715  for(int iz = -1; iz < 2; iz = iz + 2) { // z : -1 and +1
716  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
717  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
718  if (EEDetId::validDetId(iX, iY, iz)) {
719  EEDetId eedetid(iX, iY, iz);
720  unsigned int hiee = eedetid.hashedIndex();
721  // fout << hiee << " mean 12 " << EEmean12[hiee] << std::endl;
722  EcalPedestals::Item item;
723  item.mean_x1 = EEmean1[hiee];
724  item.rms_x1 = EErms1[hiee];
725  item.mean_x6 = EEmean6[hiee];
726  item.rms_x6 = EErms6[hiee];
727  item.mean_x12 = EEmean12[hiee];
728  item.rms_x12 = EErms12[hiee];
729  ped->insert(std::make_pair(eedetid.rawId(),item));
730  } // val EEId
731  } // loop over y
732  } // loop over x
733  } // loop over z
734  // fout.close();
735 
736  unsigned int irun = m_firstRun;
737  Time_t snc= (Time_t) irun ;
738  m_to_transfer.push_back(std::make_pair((EcalPedestals*)ped,snc));
739 
740  std::cout << "Ecal - > end of readPedestalFile -----------\n";
741 }
742 
744  bool debug = false;
745  std::cout << " reading local Pedestal run (2017 way)! " << m_filename << std::endl;
746 
747  // First we copy the last valid record to a temporary object peds
748  Ref ped_db = lastPayload();
749  EcalPedestals* peds = new EcalPedestals();
750  std::cout << "retrieved last payload " << std::endl;
751 
752  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
753  if(iEta==0) continue;
754  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
755  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
756  if (EBDetId::validDetId(iEta,iPhi)) {
757  EBDetId ebdetid(iEta,iPhi,EBDetId::ETAPHIMODE);
758  EcalPedestals::const_iterator it = ped_db->find(ebdetid.rawId());
759  EcalPedestals::Item aped = (*it);
760  // here I copy the last valid value in the peds object
761  EcalPedestals::Item item;
762  item.mean_x1 = aped.mean_x1;
763  item.rms_x1 = aped.rms_x1;
764  item.mean_x6 = aped.mean_x6;
765  item.rms_x6 = aped.rms_x6;
766  item.mean_x12 = aped.mean_x12;
767  item.rms_x12 = aped.rms_x12;
768  peds->insert(std::make_pair(ebdetid.rawId(),item));
769  }
770  }
771  }
772  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
773  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
774  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
775  if (EEDetId::validDetId(iX,iY,1)) {
776  EEDetId eedetidpos(iX,iY,1);
777  EcalPedestals::const_iterator it = ped_db->find(eedetidpos.rawId());
778  EcalPedestals::Item aped = (*it);
779  // here I copy the last valid value in the peds object
780  EcalPedestals::Item item;
781  item.mean_x1 = aped.mean_x1;
782  item.rms_x1 = aped.rms_x1;
783  item.mean_x6 = aped.mean_x6;
784  item.rms_x6 = aped.rms_x6;
785  item.mean_x12 = aped.mean_x12;
786  item.rms_x12 = aped.rms_x12;
787  peds->insert(std::make_pair(eedetidpos.rawId(),item));
788  }
789  if(EEDetId::validDetId(iX,iY,-1)) {
790  EEDetId eedetidneg(iX,iY,-1);
791  EcalPedestals::const_iterator it = ped_db->find(eedetidneg.rawId());
792  EcalPedestals::Item aped = (*it);
793  // here I copy the last valid value in the peds object
794  EcalPedestals::Item item;
795  item.mean_x1 = aped.mean_x1;
796  item.rms_x1 = aped.rms_x1;
797  item.mean_x6 = aped.mean_x6;
798  item.rms_x6 = aped.rms_x6;
799  item.mean_x12 = aped.mean_x12;
800  item.rms_x12 = aped.rms_x12;
801  peds->insert(std::make_pair(eedetidneg.rawId(),item));
802  }
803  }
804  }
805 
806  std::cout << " reading the input file " << m_filename << std::endl;
807  std::ifstream fInput;
808  fInput.open(m_filename);
809  if(!fInput.is_open()) {
810  std::cout << "ERROR : cannot open file " << m_filename << std::endl;
811  exit (1);
812  }
813  // string pos, dummyLine;
814  int hashedId;
815  float EBmean12[kEBChannels], EBrms12[kEBChannels], EBmean6[kEBChannels], EBrms6[kEBChannels], EBmean1[kEBChannels], EBrms1[kEBChannels];
816  //***************** barrel
817  // getline(fInput, dummyLine); // skip first line
818  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
819  fInput >> hashedId >> EBmean12[iChannel] >> EBrms12[iChannel] >> EBmean6[iChannel] >> EBrms6[iChannel]
820  >> EBmean1[iChannel] >> EBrms1[iChannel];
821  if(hashedId != iChannel + 1) {
822  std::cout << m_filename << " strange hash " << hashedId << " while iChannel " << iChannel << std::endl;
823  exit(-1);
824  }
825  }
826 
827  // ***************** now EE *****************
828  float EEmean12[kEEChannels], EErms12[kEEChannels], EEmean6[kEEChannels], EErms6[kEEChannels], EEmean1[kEEChannels], EErms1[kEEChannels];
829  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
830  fInput >> hashedId >> EEmean12[iChannel] >> EErms12[iChannel] >> EEmean6[iChannel] >> EErms6[iChannel]
831  >> EEmean1[iChannel] >> EErms1[iChannel];
832  if(hashedId != iChannel + kEBChannels + 1) {
833  std::cout << m_filename << " strange hash " << hashedId << " while iChannel " << iChannel << std::endl;
834  exit(-1);
835  }
836  }
837  fInput.close();
838 
839  EcalPedestals* ped = new EcalPedestals();
840  // barrel
841  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
842  if(iEta==0) continue;
843  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
844  if (EBDetId::validDetId(iEta,iPhi)) {
845  EBDetId ebdetid(iEta,iPhi);
846  unsigned int hieb = ebdetid.hashedIndex();
847  EcalPedestals::Item item;
848  EcalPedestals::Item previous_ped = peds->barrel(hieb);
849  if(debug & (EBmean12[hieb] == -999. || EBrms12[hieb] == -999. || EBmean6[hieb] == -999. || EBrms6[hieb] == -999. ||
850  EBmean1[hieb] == -999. || EBrms1[hieb] == -999.))
851  std::cout << " bad EB channel eta " << iEta << " phi " << iPhi << " " << EBmean12[hieb] << " " << EBrms12[hieb]
852  << " " << EBmean6[hieb] << " " << EBrms6[hieb] << " " << EBmean1[hieb] << " " << EBrms1[hieb] << std::endl;
853  if(EBmean1[hieb] != -999.) item.mean_x1 = EBmean1[hieb];
854  else item.mean_x1 = previous_ped.mean_x1;
855  if(EBrms1[hieb] != -999.) item.rms_x1 = EBrms1[hieb];
856  else item.rms_x1 = previous_ped.rms_x1;
857  if(EBmean6[hieb] != -999.) item.mean_x6 = EBmean6[hieb];
858  else item.mean_x6 = previous_ped.mean_x6;
859  if(EBrms6[hieb] != -999.) item.rms_x6 = EBrms6[hieb];
860  else item.rms_x6 = previous_ped.rms_x6;
861  if(EBmean12[hieb] != -999.) item.mean_x12 = EBmean12[hieb];
862  else item.mean_x12 = previous_ped.mean_x12;
863  if(EBrms12[hieb] != -999.) item.rms_x12 = EBrms12[hieb];
864  else item.rms_x12 = previous_ped.rms_x12;
865  ped->insert(std::make_pair(ebdetid.rawId(),item));
866  } // valid EBId
867  } // loop over phi
868  } // loop over eta
869  // endcaps
870  // std::ofstream fout;
871  // fout.open("Pedestal.check");
872  for(int iz = -1; iz < 2; iz = iz + 2) { // z : -1 and +1
873  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
874  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
875  if (EEDetId::validDetId(iX, iY, iz)) {
876  EEDetId eedetid(iX, iY, iz);
877  unsigned int hiee = eedetid.hashedIndex();
878  // fout << hiee << " mean 12 " << EEmean12[hiee] << std::endl;
879  EcalPedestals::Item item;
880  EcalPedestals::Item previous_ped= peds->endcap(hiee);
881  if(debug & (EEmean12[hiee] == -999. || EErms12[hiee] == -999. || EEmean6[hiee] == -999. || EErms6[hiee] == -999. ||
882  EEmean1[hiee] == -999. || EErms1[hiee] == -999.))
883  std::cout << " bad EE channel x " << iX << " y " << iY << " z" << iz << " " << EEmean12[hiee] << " " << EErms12[hiee]
884  << " " <<EEmean6[hiee] << " " << EErms6[hiee] << " " << EEmean1[hiee] << " " << EErms1[hiee] << std::endl;
885  if(EEmean1[hiee] != -999.) item.mean_x1 = EEmean1[hiee];
886  else item.mean_x1 = previous_ped.mean_x1;
887  if(EErms1[hiee] != -999.) item.rms_x1 = EErms1[hiee];
888  else item.rms_x1 = previous_ped.rms_x1;
889  if(EEmean6[hiee] != -999.) item.mean_x6 = EEmean6[hiee];
890  else item.mean_x6 = previous_ped.mean_x6;
891  if(EErms6[hiee] != -999.) item.rms_x6 = EErms6[hiee];
892  else item.rms_x6 = previous_ped.rms_x6;
893  if(EEmean12[hiee] != -999.) item.mean_x12 = EEmean12[hiee];
894  else item.mean_x12 = previous_ped.mean_x12;
895  if(EErms12[hiee] != -999.) item.rms_x12 = EErms12[hiee];
896  else item.rms_x12 = previous_ped.rms_x12;
897  ped->insert(std::make_pair(eedetid.rawId(),item));
898  } // val EEId
899  } // loop over y
900  } // loop over x
901  } // loop over z
902  // fout.close();
903 
904  unsigned int irun = m_firstRun;
905  Time_t snc= (Time_t) irun ;
906  m_to_transfer.push_back(std::make_pair((EcalPedestals*)ped,snc));
907 
908  std::cout << "Ecal - > end of readPedestalFile -----------\n";
909 }
910 
912  std::cout << " reading the root file " << m_filename << std::endl;
913  TFile * hfile = new TFile(m_filename.c_str());
914 
915  TTree *treeChan = (TTree*)hfile->Get("PedChan");
916  int iChannel = 0, ix = 0, iy = 0, iz = 0;
917  treeChan->SetBranchAddress("Channels", &iChannel);
918  treeChan->SetBranchAddress("x", &ix);
919  treeChan->SetBranchAddress("y", &iy);
920  treeChan->SetBranchAddress("z", &iz);
921  int neventsChan = (int)treeChan->GetEntries();
922  std::cout << "PedChan nb entries " << neventsChan << std::endl;
923  int ringEB[kEBChannels], sideEB[kEBChannels], ixEE[kEEChannels], iyEE[kEEChannels], izEE[kEEChannels];
924  for(int entry = 0; entry < neventsChan; entry++) {
925  treeChan->GetEntry(entry);
926  if(entry < kEBChannels) {
927  ringEB[iChannel] = (abs(ix) -1)/5; // -85...-1, 1...85 give 0...16
928  sideEB[iChannel] = 1;
929  if(ix < 0) sideEB[iChannel] = 0;
930  if(entry%10000 == 0) std::cout << " EB channel " << iChannel << " eta " << ix << " phi " << iy
931  << " side " << sideEB[iChannel] << " ring " << ringEB[iChannel] << std::endl;
932  }
933  else {
934  ixEE[iChannel] = ix;
935  iyEE[iChannel] = iy;
936  izEE[iChannel] = iz;
937  if(entry%1000 == 0) std::cout << " EE channel " << iChannel << " x " << ixEE[iChannel] << " y " << iyEE[iChannel] << " z " << izEE[iChannel] << std::endl;
938  }
939  }
940  Int_t pedxml[26] = {271948, 273634, 273931, 274705, 275403, 276108, 276510, 277169, 278123, 278183,
941  278246, 278389, 278499, 278693, 278858, 278888, 278931, 279728, 280129, 280263,
942  280941, 281753, 282631, 282833, 283199, 283766};
943  Int_t run16Index = 0;
944 
945  Int_t fed[kChannels], chan[kChannels], id, run, run_type, seq_id, las_id, fill_num, run_num_infill, run_time, run_time_stablebeam, nxt, time[54];
946  Float_t ped[kChannels], pedrms[kChannels], lumi, bfield;
947  TTree *tree = (TTree*)hfile->Get("T");
948  tree->Print();
949  tree->SetBranchAddress("id", &id);
950  tree->SetBranchAddress("run", &run);
951  tree->SetBranchAddress("run_type", &run_type);
952  tree->SetBranchAddress("seq_id", &seq_id);
953  tree->SetBranchAddress("las_id", &las_id);
954  tree->SetBranchAddress("fill_num", &fill_num);
955  tree->SetBranchAddress("run_num_infill", &run_num_infill);
956  tree->SetBranchAddress("run_time", &run_time);
957  tree->SetBranchAddress("run_time_stablebeam", &run_time_stablebeam);
958  tree->SetBranchAddress("lumi", &lumi);
959  tree->SetBranchAddress("bfield", &bfield);
960  tree->SetBranchAddress("nxt", &nxt); // nb of filled Crystals
961  tree->SetBranchAddress("time", time);
962  tree->SetBranchAddress("fed", fed);
963  tree->SetBranchAddress("chan", chan);
964  tree->SetBranchAddress("ped", ped);
965  tree->SetBranchAddress("pedrms", pedrms);
966  int nevents = (int)tree->GetEntries();
967  std::cout << " nb entries " << nevents << std::endl;
968  std::ofstream fout;
969  fout.open("copyTreePedestals.txt");
970  if(!fout.is_open()) {
971  std::cout << "ERROR : cannot open file copyTreePedestals.txt" << std::endl;
972  exit (1);
973  }
974  Double_t EAmean1[kChannels], EArms1[kChannels], EAmean6[kChannels], EArms6[kChannels], EAmean12[kChannels], EArms12[kChannels];
975  Int_t RunEntry = 0, EAentry[kChannels];
976  for(int ich = 0; ich < kChannels; ich++) {
977  EAmean12[ich] = 0;
978  EArms12[ich] = 0;
979  EAentry[ich] = 0;
980  }
981  tree->GetEntry(0);
982  fout << " first run " << run << " fill " << fill_num << " B field " << bfield << " run type " << run_type << " seq_id " << seq_id
983  << " las_id " << las_id << " run_num_infill " << run_num_infill << " lumi "<< lumi << " nb of Crystals " << nxt << std::endl;
984  for(int ich = 0; ich < kChannels; ich++) {
985  if(ped[ich] != 0.) {
986  if(ich < kEBChannels)
987  fout << " channel " << ich << " FED " << fed[ich] << " chan " << chan[ich] << " pedestal " << ped[ich] << " RMS " << pedrms[ich] << std::endl;
988  else // EE
989  fout << " channel " << ich << " EE channel " << ich - kEBChannels << " FED " << fed[ich] << " chan " << chan[ich]
990  << " pedestal " << ped[ich] << " RMS " << pedrms[ich] << std::endl;
991  }
992  }
993 
994  int run_type_kept = m_runtype; // 1 collision 2 cosmics 3 circulating 4 test
995  int first_run_kept = (int)m_firstRun; // m_firstRun is unsigned!
996  int runold = run;
997  int firsttimeFED = -1;
998  // int timeold = -1;
999  for(int entry = 0; entry < nevents; entry++) {
1000  tree->GetEntry(entry);
1001  if(run < first_run_kept) {
1002  runold = run;
1003  continue;
1004  }
1005  if(run_type != run_type_kept) continue; // use only wanted type runs
1006  if(nxt != kChannels) {
1007  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1008  << " *********** Number of channels " << nxt << std::endl;
1009  continue;
1010  }
1011  if(bfield < 3.79) {
1012  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1013  << " *********** bfield = " << bfield << std::endl;
1014  // continue; keep these runs
1015  }
1016  if(run_type_kept == 1) { // for collision runs, keep only sequences after stable beam
1017  int time_seq = 0;
1018  for(int ifed = 0; ifed < 54; ifed++) {
1019  if(time[ifed] < run_time_stablebeam) {
1020  if(time_seq == 0)
1021  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1022  << " *********** sequence before stable beam at " << run_time_stablebeam << " FED " << ifed << " : " << time[ifed];
1023  else
1024  fout << " FED " << ifed << " : " << time[ifed];
1025  time_seq++;
1026  }
1027  }
1028  if(time_seq != 0) {
1029  fout << " total nb " << time_seq << std::endl;
1030  continue;
1031  }
1032  } // only collision runs
1033  // if(idtime != timeold) {
1034  // std::cout << " entry "<< entry << " run " << run << " time " << idtime << " run type " << run_type << std::endl;
1035  // timeold = idtime;
1036  // }
1037  if(run == runold) {
1038  RunEntry++;
1039  for(int ich = 0; ich < kChannels; ich++) {
1040  if(ped[ich] < 300 && ped[ich] > 100) {
1041  EAmean12[ich] += ped[ich];
1042  EArms12[ich] += pedrms[ich];
1043  EAentry[ich]++;
1044  }
1045  }
1046  }
1047  else {
1048  // new run. Write the previous one
1049  // std::cout << " entry "<< entry << " fill " << fill_num << " run " << runold << " nb of events " << RunEntry
1050  // << " time " << run_time << " " << run_time_stablebeam << " " << time[0] << " run type " << run_type << std::endl;
1051  if(RunEntry == 0 || (run_type_kept == 2 && RunEntry < 6)) fout << " skiped run " << runold << " not enough entries : " << RunEntry << std::endl;
1052  else {
1053  fout << " entry "<< entry -1 << " run " << runold << " nb of events " << RunEntry;
1054  firsttimeFED = time[0];
1055  for(int ifed = 0; ifed < 54; ifed++) {
1056  fout << " " << time[ifed];
1057  if(firsttimeFED < time[ifed]) firsttimeFED = time[ifed];
1058  }
1059  fout << std::endl;
1060 
1061  // get gain 1 and 6 results
1062  bool foundNew = false;
1063  for(int i = run16Index; i < 26; i++) {
1064  if(runold > pedxml[i]) {
1065  fout << " found a new gain 1, 6 file " << pedxml[i] << " at index " << i << std::endl;
1066  run16Index++;
1067  foundNew = true;
1068  if(runold < pedxml[i + 1]) break;
1069  }
1070  }
1071  if(foundNew) {
1072  int Indexxml = run16Index -1;
1073  fout << " opening Pedestals_" << pedxml[Indexxml] << ".xml at index " << Indexxml << std::endl;
1074  std::ifstream fxml;
1075  fxml.open(Form("Pedestals_%i.xml",pedxml[Indexxml]));
1076  if(!fxml.is_open()) {
1077  std::cout << "ERROR : cannot open file Pedestals_" << pedxml[Indexxml] << ".xml" << std::endl;
1078  exit (1);
1079  }
1080  std::string dummyLine, mean12, rms12, bid;
1081  for(int i = 0; i < 9; i++) std::getline(fxml, dummyLine); // skip first lines
1082  // Barrel
1083  for (int iEBChannel = 0; iEBChannel < kEBChannels; iEBChannel++) {
1084  fxml >> mean12 >> rms12 >> bid;
1085  // std::string stt = bid.std::substr(10,15);
1086  // istringstream ii(stt);
1087  // ii >> EBmean12[iEBChannel];
1088  // fxml >> bid;
1089  // stt = bid.substr(9,15);
1090  // istringstream r12(stt);
1091  // r12 >> EBrms12[iEBChannel];
1092  // fxml >> bid;
1093  std::string stt = bid.substr(9,15);
1094  std::istringstream m6(stt);
1095  m6 >> EAmean6[iEBChannel];
1096  fxml >> bid;
1097  stt = bid.substr(8,15);
1098  std::istringstream r6(stt);
1099  r6 >> EArms6[iEBChannel];
1100  fxml >> bid;
1101  stt = bid.substr(9,15);
1102  std::istringstream m1(stt);
1103  m1 >> EAmean1[iEBChannel];
1104  fxml >> bid;
1105  stt = bid.substr(8,15);
1106  std::istringstream r1(stt);
1107  r1 >> EArms1[iEBChannel];
1108  if(iEBChannel%10000 == 0) fout << " EB channel " << iEBChannel << " " << mean12 << " " << rms12
1109  << " " << EAmean6[iEBChannel] << " " << EArms6[iEBChannel]
1110  << " " << EAmean1[iEBChannel] << " " << EArms1[iEBChannel] << std::endl;
1111  for(int i = 0; i < 3; i++) std::getline(fxml, dummyLine); // skip lines
1112  }
1113  for(int i = 0; i < 6; i++) std::getline(fxml, dummyLine); // skip lines
1114  for (int iEEChannel = 0; iEEChannel < kEEChannels; iEEChannel++) {
1115  int ich = iEEChannel + kEBChannels;
1116  fxml >> mean12 >> rms12 >> bid;
1117  std::string stt = bid.substr(9,15);
1118  std::istringstream m6(stt);
1119  m6 >> EAmean6[ich];
1120  fxml >> bid;
1121  stt = bid.substr(8,15);
1122  std::istringstream r6(stt);
1123  r6 >> EArms6[ich];
1124  fxml >> bid;
1125  stt = bid.substr(9,15);
1126  std::istringstream m1(stt);
1127  m1 >> EAmean1[ich];
1128  fxml >> bid;
1129  stt = bid.substr(8,15);
1130  std::istringstream r1(stt);
1131  r1 >> EArms1[ich];
1132  if(iEEChannel%1000 == 0) fout << " EE channel " << iEEChannel << " " << mean12 << " " << rms12
1133  << " " << EAmean6[ich] << " " << EArms6[ich]
1134  << " " << EAmean1[ich] << " " << EArms1[ich] << std::endl;
1135  for(int i = 0; i < 3; i++) std::getline(fxml, dummyLine); // skip lines
1136  }
1137 
1138  fxml.close();
1139  }
1140  // end gain 1 and 6 results
1141 
1143  EcalPedestals::Item item;
1144  for(int ich = 0; ich < kChannels; ich++) {
1145  if(EAentry[ich] != 0) {
1146  EAmean12[ich] /= EAentry[ich];
1147  EArms12[ich] /= EAentry[ich];
1148  }
1149  else {
1150  EAmean12[ich] = 200.;
1151  EArms12[ich] = 0.;
1152  }
1153  if(ich%10000 == 0) fout << " channel " << ich << " ped " << EAmean12[ich] << " RMS " << EArms12[ich] << std::endl;
1154  //
1155  item.mean_x1 = EAmean1[ich];
1156  item.rms_x1 = EArms1[ich];
1157  item.mean_x6 = EAmean6[ich];
1158  item.rms_x6 = EArms6[ich];
1159  item.mean_x12 = EAmean12[ich];
1160  item.rms_x12 = EArms12[ich];
1161  if(ich < kEBChannels) {
1162  // EBDetId ebdetid(fed, chan, EBDetId::SMCRYSTALMODE);
1163  EBDetId ebdetid = EBDetId::unhashIndex(ich);
1164  pedestal->insert(std::make_pair(ebdetid.rawId(),item));
1165  }
1166  else {
1167  // EEDetId eedetid(iX, iY, iz);
1168  int iChannel = ich - kEBChannels;
1169  EEDetId eedetid = EEDetId::unhashIndex(iChannel);
1170  pedestal->insert(std::make_pair(eedetid.rawId(),item));
1171  }
1172  } // end loop over all channels
1173  Time_t snc= (Time_t) runold;
1174  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedestal, snc));
1175  } // skip too short cosmics runs
1176 
1177  runold = run;
1178  RunEntry = 1;
1179  for(int ich = 0; ich < kChannels; ich++) {
1180  if(ped[ich] < 300 && ped[ich] > 100) {
1181  EAmean12[ich] = ped[ich];
1182  EArms12[ich] = pedrms[ich];
1183  EAentry[ich] = 1;
1184  }
1185  else {
1186  EAmean12[ich] = 0;
1187  EArms12[ich] = 0;
1188  EAentry[ich] = 0;
1189  }
1190  }
1191  } // new run
1192  } // end loop over all entries
1193  // write also the last run
1194  fout << " last entry fill " << fill_num << " run " << runold << " nb of events " << RunEntry
1195  << " time " << run_time << " " << run_time_stablebeam << " " << time[0] << " run type " << run_type << std::endl;
1196  for(int ifed = 0; ifed < 54; ifed++)
1197  fout << " " << time[ifed];
1198  fout << std::endl;
1200  EcalPedestals::Item item;
1201  for(int ich = 0; ich < kChannels; ich++) {
1202  if(EAentry[ich] != 0) {
1203  EAmean12[ich] /= EAentry[ich];
1204  EArms12[ich] /= EAentry[ich];
1205  }
1206  else {
1207  EAmean12[ich] = 200.;
1208  EArms12[ich] = 0.;
1209  }
1210  if(ich%10000 == 0) fout << " channel " << ich << " ped " << EAmean12[ich] << " RMS " << EArms12[ich] << std::endl;
1211  // get gain 1 and 6 results
1212  // ...
1213  //
1214  item.mean_x1 = EAmean1[ich];
1215  item.rms_x1 = EArms1[ich];
1216  item.mean_x6 = EAmean6[ich];
1217  item.rms_x6 = EArms6[ich];
1218  item.mean_x12 = EAmean12[ich];
1219  item.rms_x12 = EArms12[ich];
1220  if(ich < kEBChannels) {
1221  // EBDetId ebdetid(fed, chan, EBDetId::SMCRYSTALMODE);
1222  EBDetId ebdetid = EBDetId::unhashIndex(ich);
1223  pedestal->insert(std::make_pair(ebdetid.rawId(),item));
1224  }
1225  else {
1226  // EEDetId eedetid(iX, iY, iz);
1227  int iChannel = ich - kEBChannels;
1228  EEDetId eedetid = EEDetId::unhashIndex(iChannel);
1229  pedestal->insert(std::make_pair(eedetid.rawId(),item));
1230  }
1231  } // end loop over all channels
1232  Time_t snc= (Time_t) runold;
1233  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedestal,snc)); // run based IOV
1234  std::cout << "Ecal - > end of readPedestalTree -----------\n";
1235 }
1236 
1238  bool debug = false;
1239  std::cout << " reading the root file " << m_filename << std::endl;
1240  TFile * hfile = new TFile(m_filename.c_str());
1241 
1242  TTree *treeChan = (TTree*)hfile->Get("PedChan");
1243  int iChannel = 0, ix = 0, iy = 0, iz = 0;
1244  treeChan->SetBranchAddress("Channels", &iChannel);
1245  treeChan->SetBranchAddress("x", &ix);
1246  treeChan->SetBranchAddress("y", &iy);
1247  treeChan->SetBranchAddress("z", &iz);
1248  int neventsChan = (int)treeChan->GetEntries();
1249  std::cout << "PedChan nb entries " << neventsChan << std::endl;
1250  int ringEB[kEBChannels], sideEB[kEBChannels], ixEE[kEEChannels], iyEE[kEEChannels], izEE[kEEChannels];
1251  for(int entry = 0; entry < neventsChan; entry++) {
1252  treeChan->GetEntry(entry);
1253  if(entry < kEBChannels) {
1254  ringEB[iChannel] = (abs(ix) -1)/5; // -85...-1, 1...85 give 0...16
1255  sideEB[iChannel] = 1;
1256  if(ix < 0) sideEB[iChannel] = 0;
1257  if(debug && entry%10000 == 0) std::cout << " EB channel " << iChannel << " eta " << ix << " phi " << iy
1258  << " side " << sideEB[iChannel] << " ring " << ringEB[iChannel] << std::endl;
1259  }
1260  else {
1261  ixEE[iChannel] = ix;
1262  iyEE[iChannel] = iy;
1263  izEE[iChannel] = iz;
1264  if(debug && entry%1000 == 0) std::cout << " EE channel " << iChannel << " x " << ixEE[iChannel] << " y "
1265  << iyEE[iChannel] << " z " << izEE[iChannel] << std::endl;
1266  }
1267  }
1268  Int_t pedxml[26] = {271948, 273634, 273931, 274705, 275403, 276108, 276510, 277169, 278123, 278183,
1269  278246, 278389, 278499, 278693, 278858, 278888, 278931, 279728, 280129, 280263,
1270  280941, 281753, 282631, 282833, 283199, 283766};
1271  Int_t run16Index = 0;
1272 
1273  Int_t fed[kChannels], chan[kChannels], id, run, run_type, seq_id, las_id, fill_num, run_num_infill, run_time, run_time_stablebeam, nxt, time[54];
1274  Float_t ped[kChannels], pedrms[kChannels], lumi, bfield;
1275  TTree *tree = (TTree*)hfile->Get("T");
1276  tree->Print();
1277  tree->SetBranchAddress("id", &id);
1278  tree->SetBranchAddress("run", &run);
1279  tree->SetBranchAddress("run_type", &run_type);
1280  tree->SetBranchAddress("seq_id", &seq_id);
1281  tree->SetBranchAddress("las_id", &las_id);
1282  tree->SetBranchAddress("fill_num", &fill_num);
1283  tree->SetBranchAddress("run_num_infill", &run_num_infill);
1284  tree->SetBranchAddress("run_time", &run_time);
1285  tree->SetBranchAddress("run_time_stablebeam", &run_time_stablebeam);
1286  tree->SetBranchAddress("lumi", &lumi);
1287  tree->SetBranchAddress("bfield", &bfield);
1288  tree->SetBranchAddress("nxt", &nxt); // nb of filled Crystals
1289  tree->SetBranchAddress("time", time);
1290  tree->SetBranchAddress("fed", fed);
1291  tree->SetBranchAddress("chan", chan);
1292  tree->SetBranchAddress("ped", ped);
1293  tree->SetBranchAddress("pedrms", pedrms);
1294  int nevents = (int)tree->GetEntries();
1295  std::cout << " nb entries " << nevents << std::endl;
1296  std::ofstream fout;
1297  fout.open("copyTimestampPedestals.txt");
1298  if(!fout.is_open()) {
1299  std::cout << "ERROR : cannot open file copyTimestampPedestals.txt" << std::endl;
1300  exit (1);
1301  }
1302  Double_t EAmean1[kChannels], EArms1[kChannels], EAmean6[kChannels], EArms6[kChannels], EAmean12[kChannels], EArms12[kChannels];
1303  for(int ich = 0; ich < kChannels; ich++) {
1304  EAmean12[ich] = 200.;
1305  EArms12[ich] = 0.;
1306  }
1307  tree->GetEntry(0);
1308  fout << " first run " << run << " fill " << fill_num << " B field " << bfield << " run type " << run_type << " seq_id " << seq_id
1309  << " las_id " << las_id << " run_num_infill " << run_num_infill << " lumi "<< lumi << " nb of Crystals " << nxt << std::endl;
1310  if(debug) {
1311  for(int ich = 0; ich < kChannels; ich++) {
1312  if(ped[ich] != 0.) {
1313  if(ich < kEBChannels)
1314  fout << " channel " << ich << " FED " << fed[ich] << " chan " << chan[ich] << " pedestal " << ped[ich] << " RMS " << pedrms[ich] << std::endl;
1315  else // EE
1316  fout << " channel " << ich << " EE channel " << ich - kEBChannels << " FED " << fed[ich] << " chan " << chan[ich]
1317  << " pedestal " << ped[ich] << " RMS " << pedrms[ich] << std::endl;
1318  }
1319  }
1320  } // debug
1321 
1322  int runold = -1, fillold = -1, firsttimeFEDold = -1;
1323  int firsttimeFED = -1;
1324  bool firstSeqAfterStable = false;
1325  for(int entry = 0; entry < nevents; entry++) {
1326  tree->GetEntry(entry);
1327  if(nxt != kChannels) {
1328  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1329  << " *********** Number of channels " << nxt;
1330  if(seq_id == 0) {
1331  fout << " rejected" << std::endl;
1332  continue;
1333  }
1334  else fout << std::endl;
1335  }
1336  if(las_id != 447) {
1337  fout << " entry " << entry << " run " << run << " sequence " << seq_id
1338  << " *********** laser wave length = " << las_id << std::endl;
1339  continue;
1340  }
1341  if(bfield < 3.79) {
1342  fout << " entry " << entry << " run " << run << " sequence " << seq_id << " run_time " << run_time
1343  << " *********** bfield = " << bfield << std::endl;
1344  // continue; keep these runs
1345  }
1346  fout << " entry "<< entry << " run " << run << " sequence " << seq_id;
1347  if(run_type == 1) fout << " stable " << run_time_stablebeam;
1348  firsttimeFED = time[0];
1349  for(int ifed = 0; ifed < 54; ifed++) {
1350  // fout << " " << time[ifed];
1351  if(time[ifed] > firsttimeFEDold && firsttimeFED < time[ifed]) firsttimeFED = time[ifed]; // take the first AFTER the previous sequence one!...
1352  }
1353  fout << " time " << firsttimeFED << std::endl;
1354  if(firsttimeFED <= firsttimeFEDold) {
1355  std::cout << " Problem finding the IOV : old one " << firsttimeFEDold << " new one " << firsttimeFED << std::endl;
1356  for(int ifed = 0; ifed < 54; ifed++)
1357  std::cout << " " << time[ifed];
1358  std::cout << std::endl << " ignore this entry " << std::endl;
1359  continue;
1360  }
1361  firsttimeFEDold = firsttimeFED;
1362 
1363  // if(run != runold) firstSeqAfterStable = false;
1364  if(fill_num != fillold) firstSeqAfterStable = false;
1365  if(run_type == 1) {
1366  if(firsttimeFED > run_time_stablebeam) {
1367  if(!firstSeqAfterStable) {
1368  firstSeqAfterStable = true;
1369  firsttimeFED = run_time_stablebeam;
1370  fout << " first sequence after stable; change the IOV " << firsttimeFED << std::endl;
1371  }
1372  }
1373  } // only collision runs
1374 
1375  for(int ich = 0; ich < kChannels; ich++) {
1376  if(ped[ich] < 300 && ped[ich] > 100) {
1377  EAmean12[ich] = ped[ich];
1378  EArms12[ich] = pedrms[ich];
1379  }
1380  }
1381  // get gain 1 and 6 results
1382  bool foundNew = false;
1383  if(run != runold) {
1384  for(int i = run16Index; i < 26; i++) {
1385  if(run > pedxml[i]) {
1386  fout << " found a new gain 1, 6 file " << pedxml[i] << " at index " << i << std::endl;
1387  run16Index++;
1388  foundNew = true;
1389  if(runold < pedxml[i + 1]) break;
1390  }
1391  }
1392  if(foundNew) {
1393  int Indexxml = run16Index -1;
1394  fout << " opening Pedestals_" << pedxml[Indexxml] << ".xml at index " << Indexxml << std::endl;
1395  std::ifstream fxml;
1396  fxml.open(Form("Pedestals_%i.xml",pedxml[Indexxml]));
1397  if(!fxml.is_open()) {
1398  std::cout << "ERROR : cannot open file Pedestals_" << pedxml[Indexxml] << ".xml" << std::endl;
1399  exit (1);
1400  }
1401  std::string dummyLine, mean12, rms12, bid;
1402  for(int i = 0; i < 9; i++) std::getline(fxml, dummyLine); // skip first lines
1403  // Barrel
1404  for (int iEBChannel = 0; iEBChannel < kEBChannels; iEBChannel++) {
1405  fxml >> mean12 >> rms12 >> bid;
1406  std::string stt = bid.substr(9,15);
1407  std::istringstream m6(stt);
1408  m6 >> EAmean6[iEBChannel];
1409  fxml >> bid;
1410  stt = bid.substr(8,15);
1411  std::istringstream r6(stt);
1412  r6 >> EArms6[iEBChannel];
1413  fxml >> bid;
1414  stt = bid.substr(9,15);
1415  std::istringstream m1(stt);
1416  m1 >> EAmean1[iEBChannel];
1417  fxml >> bid;
1418  stt = bid.substr(8,15);
1419  std::istringstream r1(stt);
1420  r1 >> EArms1[iEBChannel];
1421  if(debug && iEBChannel%10000 == 0) fout << " EB channel " << iEBChannel << " " << mean12 << " " << rms12
1422  << " " << EAmean6[iEBChannel] << " " << EArms6[iEBChannel]
1423  << " " << EAmean1[iEBChannel] << " " << EArms1[iEBChannel] << std::endl;
1424  for(int i = 0; i < 3; i++) std::getline(fxml, dummyLine); // skip lines
1425  }
1426  for(int i = 0; i < 6; i++) std::getline(fxml, dummyLine); // skip lines
1427  for (int iEEChannel = 0; iEEChannel < kEEChannels; iEEChannel++) {
1428  int ich = iEEChannel + kEBChannels;
1429  fxml >> mean12 >> rms12 >> bid;
1430  std::string stt = bid.substr(9,15);
1431  std::istringstream m6(stt);
1432  m6 >> EAmean6[ich];
1433  fxml >> bid;
1434  stt = bid.substr(8,15);
1435  std::istringstream r6(stt);
1436  r6 >> EArms6[ich];
1437  fxml >> bid;
1438  stt = bid.substr(9,15);
1439  std::istringstream m1(stt);
1440  m1 >> EAmean1[ich];
1441  fxml >> bid;
1442  stt = bid.substr(8,15);
1443  std::istringstream r1(stt);
1444  r1 >> EArms1[ich];
1445  if(debug && iEEChannel%1000 == 0) fout << " EE channel " << iEEChannel << " " << mean12 << " " << rms12
1446  << " " << EAmean6[ich] << " " << EArms6[ich]
1447  << " " << EAmean1[ich] << " " << EArms1[ich] << std::endl;
1448  for(int i = 0; i < 3; i++) std::getline(fxml, dummyLine); // skip lines
1449  }
1450  fxml.close();
1451  } // found a new gain 1 6 file
1452  } // check gain 1 and 6 results only for new runs
1453 
1455  EcalPedestals::Item item;
1456  for(int ich = 0; ich < kChannels; ich++) {
1457  if(debug && ich%10000 == 0) fout << " channel " << ich << " ped " << EAmean12[ich] << " RMS " << EArms12[ich] << std::endl;
1458  //
1459  item.mean_x1 = EAmean1[ich];
1460  item.rms_x1 = EArms1[ich];
1461  item.mean_x6 = EAmean6[ich];
1462  item.rms_x6 = EArms6[ich];
1463  item.mean_x12 = EAmean12[ich];
1464  item.rms_x12 = EArms12[ich];
1465  if(ich < kEBChannels) {
1466  // EBDetId ebdetid(fed, chan, EBDetId::SMCRYSTALMODE);
1467  EBDetId ebdetid = EBDetId::unhashIndex(ich);
1468  pedestal->insert(std::make_pair(ebdetid.rawId(),item));
1469  }
1470  else {
1471  // EEDetId eedetid(iX, iY, iz);
1472  int iChannel = ich - kEBChannels;
1473  EEDetId eedetid = EEDetId::unhashIndex(iChannel);
1474  pedestal->insert(std::make_pair(eedetid.rawId(),item));
1475  }
1476  } // end loop over all channels
1477  uint64_t iov = (uint64_t)firsttimeFED << 32;
1478  Time_t snc = (Time_t) iov;
1479  m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedestal, snc)); // time based IOV
1480  fout << " m_to_transfer " << firsttimeFED << std::endl;
1481  runold = run;
1482  fillold = fill_num;
1483  } // end loop over all entries
1484 
1485  std::cout << "Ecal - > end of readPedestalTimestamp -----------\n";
1486 }
bool checkPedestal(EcalPedestals::Item *item)
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
Definition: RunTag.cc:70
T getUntrackedParameter(std::string const &, T const &) const
const Int_t kEBChannels
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
static const int MIN_IPHI
Definition: EBDetId.h:142
Definition: RunTag.h:13
float getPedRMSG1() const
EcalPedestalsHandler(edm::ParameterSet const &)
MonRunList fetchMonRunList(const RunTag &tag, const MonRunTag &monruntag) noexcept(false)
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:99
void setGeneralTag(std::string tag)
Definition: MonRunTag.cc:33
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
static const int IX_MIN
Definition: EEDetId.h:294
static const int IY_MIN
Definition: EEDetId.h:298
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
void setRunTag(const RunTag &tag)
Definition: MonRunList.cc:23
int getID2() const
Definition: EcalLogicID.cc:51
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
T x() const
Cartesian x coordinate.
cond::ValidityInterval lastInterval
Definition: Types.h:75
std::string getName() const
Definition: EcalLogicID.cc:36
float getPedMeanG12() const
float getPedRMSG12() const
const Int_t kEEChannels
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int getID1() const
Definition: EcalLogicID.cc:46
T min(T a, T b)
Definition: MathUtil.h:58
void setMonVersionDef(const MonVersionDef &ver)
Definition: MonRunTag.cc:49
static const int ETAPHIMODE
Definition: EBDetId.h:166
void setLocationDef(const LocationDef &locDef)
Definition: RunTag.cc:53
void insert(std::pair< uint32_t, Item > const &a)
static const int IX_MAX
Definition: EEDetId.h:302
std::vector< MonRunIOV > getRuns()
Definition: MonRunList.cc:46
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:53
#define debug
Definition: HDRShower.cc:19
int hashedIndex() const
Definition: EEDetId.h:182
static const int MAX_IPHI
Definition: EBDetId.h:144
unsigned long long uint64_t
Definition: Time.h:15
void setRunType(std::string runtype)
Definition: RunTypeDef.cc:33
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:143
void setMonRunTag(const MonRunTag &tag)
Definition: MonRunList.cc:29
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
float getPedMeanG1() const
void setMonitoringVersion(std::string ver)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:114
float getPedMeanG6() const
void setLocation(std::string loc)
Definition: LocationDef.cc:33
static const int IY_MAX
Definition: EEDetId.h:306
const Item & barrel(size_t hashedIndex) const
Definition: tree.py:1
int getID3() const
Definition: EcalLogicID.cc:56
void setGeneralTag(std::string tag)
Definition: RunTag.cc:36
static const int SMCRYSTALMODE
Definition: EBDetId.h:167
const Item & endcap(size_t hashedIndex) const
Definition: RunIOV.h:13
float getPedRMSG6() const
const Int_t kChannels