CMS 3D CMS Logo

StoreEcalCondition.cc
Go to the documentation of this file.
2 
9 
10 #include <fstream>
11 #include <iostream>
12 #include <string>
13 #include <cstring>
14 #include <ctime>
15 #include <unistd.h>
16 
17 using std::cout;
18 using std::endl;
19 using std::string;
20 
22  prog_name_ = "StoreEcalCondition";
23 
24  logfile_ = iConfig.getParameter<std::string>("logfile");
25  sm_slot_ = iConfig.getUntrackedParameter<unsigned int>("smSlot", 1);
26 
27  typedef std::vector<edm::ParameterSet> Parameters;
28  Parameters toPut = iConfig.getParameter<Parameters>("toPut");
29  for (Parameters::iterator itToPut = toPut.begin(); itToPut != toPut.end(); ++itToPut) {
30  inpFileName_.push_back(itToPut->getUntrackedParameter<std::string>("inputFile"));
31  inpFileNameEE_.push_back(itToPut->getUntrackedParameter<std::string>("inputFileEE"));
32  objectName_.push_back(itToPut->getUntrackedParameter<std::string>("conditionType"));
33  since_.push_back(itToPut->getUntrackedParameter<unsigned int>("since"));
34  }
35 
36  sm_constr_ = -1;
37 }
38 
41  if (!mydbservice.isAvailable()) {
42  edm::LogError("StoreEcalCondition") << "PoolDBOutputService is unavailable" << std::endl;
43  return;
44  }
45 
46  bool toAppend = false;
47  // copy a string to the char *
48  std::string message = "finished OK\n";
49  size_t messageSize = message.size() + 1;
50  char* messChar = new char[messageSize];
51  strncpy(messChar, message.c_str(), messageSize);
52 
53  for (unsigned int i = 0; i < objectName_.size(); i++) {
54  cond::Time_t newTime;
55 
56  if (mydbservice->isNewTagRequest(objectName_[i] + std::string("Rcd"))) {
57  // This is the first object for this tag.
58  // Append mode should be off.
59  // newTime is the end of this new objects IOV.
60  newTime = mydbservice->beginOfTime();
61  } else {
62  // There should already be an object in the DB for this tag.
63  // Append IOV mode should be on.
64  // newTime is the beginning of this new objects IOV.
65  toAppend = true;
66  newTime = (cond::Time_t)since_[i];
67  }
68  edm::LogInfo("StoreEcalCondition") << "Reading " << objectName_[i] << " from file and writing to DB with newTime "
69  << newTime << endl;
70  std::cout << "Reading " << objectName_[i] << " from file and writing to DB with newTime " << newTime << endl;
71 
72  if (objectName_[i] == "EcalWeightXtalGroups") {
74  if (!toAppend) {
75  mydbservice->createNewIOV<EcalWeightXtalGroups>(
76  mycali, newTime, mydbservice->endOfTime(), "EcalWeightXtalGroupsRcd");
77  } else {
78  mydbservice->appendSinceTime<EcalWeightXtalGroups>(mycali, newTime, "EcalWeightXtalGroupsRcd");
79  }
80  } else if (objectName_[i] == "EcalTBWeights") {
82  if (!toAppend) {
83  mydbservice->createNewIOV<EcalTBWeights>(mycali, newTime, mydbservice->endOfTime(), "EcalTBWeightsRcd");
84  } else {
85  mydbservice->appendSinceTime<EcalTBWeights>(mycali, newTime, "EcalTBWeightsRcd");
86  }
87  } else if (objectName_[i] == "EcalADCToGeVConstant") {
89  if (!toAppend) {
90  mydbservice->createNewIOV<EcalADCToGeVConstant>(
91  mycali, newTime, mydbservice->endOfTime(), "EcalADCToGeVConstantRcd");
92  } else {
93  mydbservice->appendSinceTime<EcalADCToGeVConstant>(mycali, newTime, "EcalADCToGeVConstantRcd");
94  }
95  } else if (objectName_[i] == "EcalIntercalibConstants") {
96  EcalIntercalibConstants* mycali =
98  if (!toAppend) {
100  mycali, newTime, mydbservice->endOfTime(), "EcalIntercalibConstantsRcd");
101  } else {
102  mydbservice->appendSinceTime<EcalIntercalibConstants>(mycali, newTime, "EcalIntercalibConstantsRcd");
103  }
104  } else if (objectName_[i] == "EcalPFRecHitThresholds") {
105  EcalPFRecHitThresholds* mycali =
107  if (!toAppend) {
108  mydbservice->createNewIOV<EcalPFRecHitThresholds>(
109  mycali, newTime, mydbservice->endOfTime(), "EcalPFRecHitThresholdsRcd");
110  } else {
111  mydbservice->appendSinceTime<EcalPFRecHitThresholds>(mycali, newTime, "EcalPFRecHitThresholdsRcd");
112  }
113  } else if (objectName_[i] == "EcalIntercalibConstantsMC") {
114  EcalIntercalibConstantsMC* mycali =
116  if (!toAppend) {
118  mycali, newTime, mydbservice->endOfTime(), "EcalIntercalibConstantsMCRcd");
119  } else {
120  mydbservice->appendSinceTime<EcalIntercalibConstantsMC>(mycali, newTime, "EcalIntercalibConstantsMCRcd");
121  }
122  } else if (objectName_[i] == "EcalGainRatios") {
124  if (!toAppend) {
125  mydbservice->createNewIOV<EcalGainRatios>(mycali, newTime, mydbservice->endOfTime(), "EcalGainRatiosRcd");
126  } else {
127  mydbservice->appendSinceTime<EcalGainRatios>(mycali, newTime, "EcalGainRatiosRcd");
128  }
129  } else if (objectName_[i] == "EcalChannelStatus") {
131  if (!toAppend) {
132  mydbservice->createNewIOV<EcalChannelStatus>(mycali, newTime, mydbservice->endOfTime(), "EcalChannelStatusRcd");
133  } else {
134  mydbservice->appendSinceTime<EcalChannelStatus>(mycali, newTime, "EcalChannelStatusRcd");
135  }
136  } else {
137  edm::LogError("StoreEcalCondition")
138  << "Object " << objectName_[i] << " is not supported by this program." << endl;
139  }
140 
141  // writeToLogFile(objectName_[i], inpFileName_[i], since_[i]);
142  //writeToLogFileResults("finished OK\n");
143  writeToLogFileResults(messChar);
144 
145  edm::LogInfo("StoreEcalCondition") << "Finished endJob" << endl;
146  }
147 
148  delete[] messChar;
149 }
150 
152 
153 //-------------------------------------------------------------
154 void StoreEcalCondition::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
155  //-------------------------------------------------------------
156 }
157 
158 //------------------------------------------------------------
159 void StoreEcalCondition::writeToLogFile(string a, string b, unsigned long long since) {
160  //-------------------------------------------------------------
161 
162  FILE* outFile; // output log file for appending
163  outFile = fopen(logfile_.c_str(), "a");
164  if (!outFile) {
165  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << logfile_;
166  return;
167  }
168  char header[256];
170  char appendMode[10];
171  if (since != 0)
172  sprintf(appendMode, "append");
173  else
174  sprintf(appendMode, "create");
175 
176  fprintf(outFile,
177  "%s %s condition from file %s written into DB for SM %d (mapped to SM %d) in %s mode (since run %u)\n",
178  header,
179  a.c_str(),
180  b.c_str(),
181  sm_constr_,
182  sm_slot_,
183  appendMode,
184  (unsigned int)since);
185 
186  fclose(outFile); // close out file
187 }
188 //------------------------------------------------------------
190  //-------------------------------------------------------------
191 
192  FILE* outFile; // output log file for appending
193  outFile = fopen(logfile_.c_str(), "a");
194  if (!outFile) {
195  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << logfile_;
196  return;
197  }
198  char header[256];
200  fprintf(outFile, "%s %s\n", header, arg);
201  fclose(outFile); // close out file
202 }
203 
204 //------------------------------------------------------------
206 //------------------------------------------------------------
207 {
208  time_t rawtime;
209  struct tm* timeinfo;
210  time(&rawtime);
211  timeinfo = localtime(&rawtime);
212  char user[50];
213  sprintf(user, "%s", getlogin());
214  sprintf(header, "%s %s:", asctime(timeinfo), user);
215 }
216 
217 /*
218  * Format for ASCII groups & weights file
219  * Updated by Alex Zabi Imperial College
220  * 03/07/06: implementing final weights format
221  * Accepted format:
222  * groupId nSamples nTDCbins (introductory line)
223  * and then nTDCbins x (3 + nSamples) lines of nSamples numbers containing
224  * For TDCbin1
225  * gain 12 weights (before gain switch)
226  * ===========================================
227  * ampWeight[0] ampWeight[1] ............. |
228  * pedWeight[0] pedWeight[1] ............. |
229  * jitWeight[0] jitWeight[1] ............. |
230  * chi2Matri[0][0] chi2Matrix[0][1] .......... |
231  * chi2Matrix[1][0] chi2Matrix[1][1] .......... |
232  * ..... |
233  * chi2Matrix[nsamples-1][0] chi2Matrix[nsamples-1][1] .......... |
234  * gain 6 and 1 weights (after gain switch)
235  * ===========================================
236  * ampWeight[0] ampWeight[1] ............. |
237  * pedWeight[0] pedWeight[1] ............. |
238  * jitWeight[0] jitWeight[1] ............. |
239  * chi2Matri[0][0] chi2Matrix[0][1] .......... |
240  * chi2Matrix[1][0] chi2Matrix[1][1] .......... |
241  * ..... |
242  * chi2Matrix[nsamples-1][0] chi2Matrix[nsamples-1][1] .......... |
243  * ===========================================
244  * For TDCbin nTDCBins
245  * ............
246  */
247 
248 //-------------------------------------------------------------
250  //-------------------------------------------------------------
251 
252  // Code taken from EcalWeightTools/test/MakeOfflineDbFromAscii.cpp
253 
254  EcalWeightXtalGroups* xtalGroups = new EcalWeightXtalGroups();
255  std::ifstream groupid_in(inputFile);
256 
257  if (!groupid_in.is_open()) {
258  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
259  return nullptr;
260  }
261 
262  int smnumber = -99999;
263 
264  std::ostringstream str;
265  groupid_in >> smnumber;
266  if (smnumber == -99999) {
267  edm::LogError("StoreEcalCondition") << "ERROR: SM number not found in file" << endl;
268  return nullptr;
269  }
270  str << "sm= " << smnumber << endl;
271  sm_constr_ = smnumber;
272 
273  char temp[256];
274  //Reading the other 5 header lines containing various informations
275  for (int i = 0; i <= 5; i++) {
276  groupid_in.getline(temp, 255);
277  str << temp << endl;
278  }
279 
280  // Skip the nGroup/Mean line
281  groupid_in.getline(temp, 255);
282  str << temp << endl;
283 
284  edm::LogInfo("StoreEcalCondition") << "GROUPID file " << str.str();
285 
286  int xtals = 0;
287  int xtal, ietaf, iphif, groupID;
288  while (groupid_in.good()) {
289  groupid_in >> xtal >> ietaf >> iphif >> groupID;
290  if (groupid_in.eof()) {
291  break;
292  }
293 
294  LogDebug("StoreEcalCondition") << "XTAL=" << xtal << " ETA=" << ietaf << " PHI=" << iphif << " GROUP=" << groupID;
295 
296  //EBDetId ebid(ieta,iphi);
298  // xtalGroups->setValue(ebid.rawId(), EcalXtalGroupId( ebid.hashedIndex()) );
299  xtalGroups->setValue(ebid.rawId(), EcalXtalGroupId(groupID));
300  xtals++;
301  } //loop iphi
302 
303  if (xtals != 1700) {
304  edm::LogError("StoreEcalCondition") << "ERROR: GROUPID file did not contain data for 1700 crystals" << endl;
305  return nullptr;
306  }
307 
308  edm::LogInfo("StoreEcalCondition") << "Groups for " << xtals << " xtals written into DB";
309  sm_constr_ = smnumber;
310 
311  return xtalGroups;
312 }
313 
314 //-------------------------------------------------------------
316  //-------------------------------------------------------------
317 
318  // Zabi code to be written here
319 
320  EcalTBWeights* tbwgt = new EcalTBWeights();
321 
322  std::ifstream WeightsFileTB(inputFile);
323  if (!WeightsFileTB.is_open()) {
324  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
325  return nullptr;
326  }
327 
328  int smnumber = -99999;
329 
330  std::ostringstream str;
331  WeightsFileTB >> smnumber;
332  if (smnumber == -99999)
333  return nullptr;
334 
335  str << "sm= " << smnumber << endl;
336 
337  char temp[256];
338  //Reading the other 5 header lines containing various informations
339  for (int i = 0; i <= 5; i++) {
340  WeightsFileTB.getline(temp, 255);
341  str << temp << endl;
342  }
343 
344  edm::LogInfo("StoreEcalCondition") << "Weights file " << str.str();
345 
346  int ngroups = 0;
347  while (WeightsFileTB.good()) {
348  int igroup_ID = -99999;
349  int nSamples = -99999;
350  int nTdcBins = -99999;
351 
352  WeightsFileTB >> igroup_ID >> nSamples >> nTdcBins;
353  if (igroup_ID == -99999 || nSamples == -99999 || nTdcBins == -99999)
354  break;
355 
356  std::ostringstream str;
357  str << "Igroup=" << igroup_ID << " Nsamples=" << nSamples << " NTdcBins=" << nTdcBins << "\n";
358 
359  for (int iTdcBin = 0; iTdcBin < nTdcBins; iTdcBin++) {
360  EcalWeightSet wgt; // one set of weights
365 
366  // std::vector<EcalWeight> wamp, wped, wtime; //weights before gain switch
367  // std::vector<EcalWeight> wamp2, wped2, wtime2; //weights after gain switch
368 
369  //WEIGHTS BEFORE GAIN SWITCH
370  //Amplitude weights
371  for (int j = 0; j < nSamples; ++j) {
372  double ww = 0.0;
373  WeightsFileTB >> ww;
374  wgt1(0, j) = ww;
375  str << ww << " ";
376  } // loop Samples
377  str << std::endl;
378 
379  //Pedestal weights
380  for (int j = 0; j < nSamples; ++j) {
381  double ww = 0.0;
382  WeightsFileTB >> ww;
383  wgt1(1, j) = ww;
384  str << ww << " ";
385  } //loop Samples
386  str << std::endl;
387 
388  //Timing weights
389  for (int j = 0; j < nSamples; ++j) {
390  double ww = 0.0;
391  WeightsFileTB >> ww;
392  wgt1(2, j) = ww;
393  str << ww << " ";
394  } //loop Samples
395  str << std::endl;
396 
397  for (int j = 0; j < nSamples; ++j) {
398  // fill chi2 matrix
399  //std::vector<EcalWeight> vChi2; // row of chi2 matrix
400  for (int k = 0; k < nSamples; ++k) {
401  double ww = 0.0;
402  WeightsFileTB >> ww;
403  chisq1(j, k) = ww;
404  str << ww << " ";
405  } //loop samples
406  str << std::endl;
407  } //loop lines
408 
409  //WEIGHTS AFTER GAIN SWITCH
410  for (int j = 0; j < nSamples; ++j) {
411  double ww = 0.0;
412  WeightsFileTB >> ww;
413  wgt2(0, j) = ww;
414  str << ww << " ";
415  } // loop Samples
416  str << std::endl;
417 
418  //Pedestal weights
419  for (int j = 0; j < nSamples; ++j) {
420  double ww = 0.0;
421  WeightsFileTB >> ww;
422  wgt2(1, j) = ww;
423  str << ww << " ";
424  } //loop Samples
425  str << std::endl;
426 
427  //Timing weights
428  for (int j = 0; j < nSamples; ++j) {
429  double ww = 0.0;
430  WeightsFileTB >> ww;
431  wgt2(2, j) = ww;
432  str << ww << " ";
433  } //loop Samples
434  str << std::endl;
435 
436  for (int j = 0; j < nSamples; ++j) {
437  // fill chi2 matrix
438  //std::vector<EcalWeight> vChi2; // row of chi2 matrix
439  for (int k = 0; k < nSamples; ++k) {
440  double ww = 0.0;
441  WeightsFileTB >> ww;
442  chisq2(j, k) = ww;
443  str << ww << " ";
444  } //loop samples
445  str << std::endl;
446  } //loop lines
447 
448  LogDebug("StoreEcalCondition") << str.str();
449 
450  //modif-27-07-06 tdcid should start from 1
451  tbwgt->setValue(std::make_pair(igroup_ID, iTdcBin + 1), wgt);
452  } //loop Tdc bins
453  ngroups++;
454  } //loop groupID
455 
456  sm_constr_ = smnumber;
457 
458  edm::LogInfo("StoreEcalCondition") << "Weights for " << ngroups << " groups written into DB";
459  return tbwgt;
460 }
461 
462 //-------------------------------------------------------------
464  //-------------------------------------------------------------
465 
466  FILE* inpFile; // input file
467  inpFile = fopen(inputFile, "r");
468  if (!inpFile) {
469  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
470  return nullptr;
471  }
472 
473  char line[256];
474 
475  std::ostringstream str;
476 
477  fgets(line, 255, inpFile);
478  int sm_number = atoi(line);
479  str << "sm= " << sm_number << endl;
480 
481  fgets(line, 255, inpFile);
482  //int nevents=atoi(line); // not necessary here just for online conddb
483 
484  fgets(line, 255, inpFile);
485  string gen_tag = to_string(line);
486  str << "gen tag " << gen_tag << endl; // should I use this?
487 
488  fgets(line, 255, inpFile);
489  string cali_method = to_string(line);
490  str << "cali method " << cali_method << endl; // not important
491 
492  fgets(line, 255, inpFile);
493  string cali_version = to_string(line);
494  str << "cali version " << cali_version << endl; // not important
495 
496  fgets(line, 255, inpFile);
497  string cali_type = to_string(line);
498  str << "cali type " << cali_type << endl; // not important
499 
500  edm::LogInfo("StoreEcalCondition") << "ADCToGeV file " << str.str();
501 
502  fgets(line, 255, inpFile);
503  float adc_to_gev = 0;
504  sscanf(line, "%f", &adc_to_gev);
505  LogDebug("StoreEcalCondition") << " calib=" << adc_to_gev;
506  fgets(line, 255, inpFile);
507  float adc_to_gev_ee = 0;
508  sscanf(line, "%f", &adc_to_gev_ee);
509  LogDebug("StoreEcalCondition") << " calib=" << adc_to_gev_ee;
510 
511  fclose(inpFile); // close inp. file
512 
513  sm_constr_ = sm_number;
514 
515  // barrel and endcaps the same
516  EcalADCToGeVConstant* agc = new EcalADCToGeVConstant(adc_to_gev, adc_to_gev_ee);
517  edm::LogInfo("StoreEcalCondition") << "ADCtoGeV scale written into the DB";
518  return agc;
519 }
520 
521 //-------------------------------------------------------------
523  const char* inputFileEE) {
524  //-------------------------------------------------------------
525 
527 
528  FILE* inpFile; // input file
529  inpFile = fopen(inputFile, "r");
530  if (!inpFile) {
531  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
532  return nullptr;
533  }
534 
535  char line[256];
536 
537  int ieta = 0;
538  int iphi = 0;
539  int ix = 0;
540  int iy = 0;
541  int iz = 0;
542 
543  float thresh = 0;
544 
545  int ii = 0;
546  while (fgets(line, 255, inpFile)) {
547  sscanf(line, "%d %d %f ", &ieta, &iphi, &thresh);
548  if (ii == 0)
549  cout << "crystal " << ieta << "/" << iphi << " Thresh= " << thresh << endl;
550 
551  if (EBDetId::validDetId(ieta, iphi)) {
552  EBDetId ebid(ieta, iphi);
553  ical->setValue(ebid.rawId(), thresh);
554  ii++;
555  }
556  }
557 
558  // inf.close(); // close inp. file
559  fclose(inpFile); // close inp. file
560 
561  edm::LogInfo("StoreEcalCondition") << "Read PF RecHits for " << ii << " xtals ";
562 
563  cout << " I read the thresholds for " << ii << " crystals " << endl;
564 
565  FILE* inpFileEE; // input file
566  inpFileEE = fopen(inputFileEE, "r");
567  if (!inpFileEE) {
568  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFileEE;
569  return nullptr;
570  }
571  ii = 0;
572  while (fgets(line, 255, inpFileEE)) {
573  sscanf(line, "%d %d %d %f ", &ix, &iy, &iz, &thresh);
574  if (ii == 0)
575  cout << "crystal " << ix << "/" << iy << "/" << iz << " Thresh= " << thresh << endl;
576  if (EEDetId::validDetId(ix, iy, iz)) {
577  EEDetId eeid(ix, iy, iz);
578  ical->setValue(eeid.rawId(), thresh);
579  ii++;
580  }
581  }
582 
583  // inf.close(); // close inp. file
584  fclose(inpFileEE); // close inp. file
585 
586  cout << "loop on EE channels done - number of crystals =" << ii << std::endl;
587 
588  return ical;
589 }
590 //-------------------------------------------------------------
592  const char* inputFileEE) {
593  //-------------------------------------------------------------
594 
596 
597  FILE* inpFile; // input file
598  inpFile = fopen(inputFile, "r");
599  if (!inpFile) {
600  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
601  return nullptr;
602  }
603 
604  char line[256];
605 
606  std::ostringstream str;
607 
608  fgets(line, 255, inpFile);
609  string sm_or_all = to_string(line);
610  int sm_number = 0;
611  int nchan = 1700;
612  sm_number = atoi(line);
613  str << "sm= " << sm_number << endl;
614  if (sm_number != -1) {
615  nchan = 1700;
616  } else {
617  nchan = 61200;
618  }
619 
620  fgets(line, 255, inpFile);
621  //int nevents=atoi(line); // not necessary here just for online conddb
622 
623  fgets(line, 255, inpFile);
624  string gen_tag = to_string(line);
625  str << "gen tag " << gen_tag << endl; // should I use this?
626 
627  fgets(line, 255, inpFile);
628  string cali_method = to_string(line);
629  str << "cali method " << cali_method << endl; // not important
630 
631  fgets(line, 255, inpFile);
632  string cali_version = to_string(line);
633  str << "cali version " << cali_version << endl; // not important
634 
635  fgets(line, 255, inpFile);
636  string cali_type = to_string(line);
637  str << "cali type " << cali_type << endl; // not important
638 
639  edm::LogInfo("StoreEcalCondition") << "Intercalibration file " << str.str();
640 
641  int sm_num[61200] = {0};
642  int cry_num[61200] = {0};
643  float calib[61200] = {0};
644  float calib_rms[61200] = {0};
645  int calib_nevents[61200] = {0};
646  int calib_status[61200] = {0};
647 
648  int ii = 0;
649  if (sm_number != -1) {
650  while (fgets(line, 255, inpFile)) {
651  sscanf(line, "%d %f %f %d %d", &cry_num[ii], &calib[ii], &calib_rms[ii], &calib_nevents[ii], &calib_status[ii]);
652  // if(ii<10) { // print out only the first ten channels
653  // cout << "cry="<<cry_num[ii]<<" calib="<<calib[ii]<<endl;
654  // }
655  sm_num[ii] = sm_number;
656  ii++;
657  }
658  } else {
659  // this is for the whole Barrel
660  cout << "mode ALL BARREL" << endl;
661  while (fgets(line, 255, inpFile)) {
662  sscanf(line, "%d %d %f %f %d", &sm_num[ii], &cry_num[ii], &calib[ii], &calib_rms[ii], &calib_status[ii]);
663  if (ii == 0)
664  cout << "crystal " << cry_num[ii] << " of sm " << sm_num[ii] << " cali= " << calib[ii] << endl;
665  ii++;
666  }
667  }
668 
669  // inf.close(); // close inp. file
670  fclose(inpFile); // close inp. file
671 
672  edm::LogInfo("StoreEcalCondition") << "Read intercalibrations for " << ii << " xtals ";
673 
674  cout << " I read the calibrations for " << ii << " crystals " << endl;
675  if (ii != nchan)
676  edm::LogWarning("StoreEcalCondition") << "Some crystals missing. Missing channels will be set to 0" << endl;
677 
678  // Get channel ID
679 
680  sm_constr_ = sm_number;
681 
682  // Set the data
683  for (int i = 0; i < nchan; i++) {
684  // EBDetId(int index1, int index2, int mode = ETAPHIMODE)
685  // sm and crys index SMCRYSTALMODE index1 is SM index2 is crystal number a la H4
686 
687  int slot_num = convertFromConstructionSMToSlot(sm_num[i], -1);
688  EBDetId ebid(slot_num, cry_num[i], EBDetId::SMCRYSTALMODE);
689 
690  ical->setValue(ebid.rawId(), calib[i]);
691 
692  if (i == 0)
693  cout << "crystal " << cry_num[i] << " of sm " << sm_num[i] << " in slot " << slot_num << " calib= " << calib[i]
694  << endl;
695 
696  } // loop over channels
697 
698  cout << "loop on channels done" << endl;
699 
700  FILE* inpFileEE; // input file
701  inpFileEE = fopen(inputFileEE, "r");
702  if (!inpFileEE) {
703  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
704 
705  // dummy endcap data
706 
707  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
708  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
709  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
710  if (EEDetId::validDetId(iX, iY, 1)) {
711  EEDetId eedetidpos(iX, iY, 1);
712  ical->setValue(eedetidpos, 1.0);
713  }
714  if (EEDetId::validDetId(iX, iY, -1)) {
715  EEDetId eedetidneg(iX, iY, -1);
716  ical->setValue(eedetidneg, 1.0);
717  }
718  }
719  }
720 
721  } else {
722  cout << "... now reading EE file ..." << endl;
723 
724  int ii = 0;
725  while (fgets(line, 255, inpFileEE)) {
726  int iz, ix, iy;
727  float calibee;
728  sscanf(line, "%d %d %d %f", &iz, &ix, &iy, &calibee);
729  if (ii <= 0)
730  cout << "crystal " << iz << "/" << ix << "/" << iy << " cali=" << calibee << endl;
731 
732  if (EEDetId::validDetId(ix, iy, iz)) {
733  EEDetId eedetid(ix, iy, iz);
734  ical->setValue(eedetid, calibee);
735  }
736 
737  ii++;
738  }
739 
740  fclose(inpFileEE); // close inp. file
741  }
742 
743  cout << "loop on EE channels done" << endl;
744 
745  return ical;
746 }
747 
748 //-------------------------------------------------------------
750  const char* inputFileEE) {
751  //-------------------------------------------------------------
752 
754 
755  FILE* inpFile; // input file
756  inpFile = fopen(inputFile, "r");
757  if (!inpFile) {
758  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
759  return nullptr;
760  }
761 
762  char line[256];
763 
764  std::ostringstream str;
765 
766  fgets(line, 255, inpFile);
767  string sm_or_all = to_string(line);
768  int sm_number = 0;
769  int nchan = 1700;
770  sm_number = atoi(line);
771  str << "sm= " << sm_number << endl;
772  if (sm_number != -1) {
773  nchan = 1700;
774  } else {
775  nchan = 61200;
776  }
777 
778  fgets(line, 255, inpFile);
779  //int nevents=atoi(line); // not necessary here just for online conddb
780 
781  fgets(line, 255, inpFile);
782  string gen_tag = to_string(line);
783  str << "gen tag " << gen_tag << endl; // should I use this?
784 
785  fgets(line, 255, inpFile);
786  string cali_method = to_string(line);
787  str << "cali method " << cali_method << endl; // not important
788 
789  fgets(line, 255, inpFile);
790  string cali_version = to_string(line);
791  str << "cali version " << cali_version << endl; // not important
792 
793  fgets(line, 255, inpFile);
794  string cali_type = to_string(line);
795  str << "cali type " << cali_type << endl; // not important
796 
797  edm::LogInfo("StoreEcalCondition") << "Intercalibration file " << str.str();
798 
799  int sm_num[61200] = {0};
800  int cry_num[61200] = {0};
801  float calib[61200] = {0};
802  float calib_rms[61200] = {0};
803  int calib_nevents[61200] = {0};
804  int calib_status[61200] = {0};
805 
806  int ii = 0;
807  if (sm_number != -1) {
808  while (fgets(line, 255, inpFile)) {
809  sscanf(line, "%d %f %f %d %d", &cry_num[ii], &calib[ii], &calib_rms[ii], &calib_nevents[ii], &calib_status[ii]);
810  // if(ii<10) { // print out only the first ten channels
811  // cout << "cry="<<cry_num[ii]<<" calib="<<calib[ii]<<endl;
812  // }
813  sm_num[ii] = sm_number;
814  ii++;
815  }
816  } else {
817  // this is for the whole Barrel
818  cout << "mode ALL BARREL" << endl;
819  while (fgets(line, 255, inpFile)) {
820  sscanf(line, "%d %d %f %f %d", &sm_num[ii], &cry_num[ii], &calib[ii], &calib_rms[ii], &calib_status[ii]);
821  if (ii == 0)
822  cout << "crystal " << cry_num[ii] << " of sm " << sm_num[ii] << " cali= " << calib[ii] << endl;
823  ii++;
824  }
825  }
826 
827  // inf.close(); // close inp. file
828  fclose(inpFile); // close inp. file
829 
830  edm::LogInfo("StoreEcalCondition") << "Read intercalibrations for " << ii << " xtals ";
831 
832  cout << " I read the calibrations for " << ii << " crystals " << endl;
833  if (ii != nchan)
834  edm::LogWarning("StoreEcalCondition") << "Some crystals missing. Missing channels will be set to 0" << endl;
835 
836  // Get channel ID
837 
838  sm_constr_ = sm_number;
839 
840  // Set the data
841  for (int i = 0; i < nchan; i++) {
842  // EBDetId(int index1, int index2, int mode = ETAPHIMODE)
843  // sm and crys index SMCRYSTALMODE index1 is SM index2 is crystal number a la H4
844 
845  int slot_num = convertFromConstructionSMToSlot(sm_num[i], -1);
846  EBDetId ebid(slot_num, cry_num[i], EBDetId::SMCRYSTALMODE);
847 
848  ical->setValue(ebid.rawId(), calib[i]);
849 
850  if (i == 0)
851  cout << "crystal " << cry_num[i] << " of sm " << sm_num[i] << " in slot " << slot_num << " calib= " << calib[i]
852  << endl;
853 
854  } // loop over channels
855 
856  cout << "loop on channels done" << endl;
857 
858  FILE* inpFileEE; // input file
859  inpFileEE = fopen(inputFileEE, "r");
860  if (!inpFileEE) {
861  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
862 
863  // dummy endcap data
864 
865  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
866  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
867  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
868  if (EEDetId::validDetId(iX, iY, 1)) {
869  EEDetId eedetidpos(iX, iY, 1);
870  ical->setValue(eedetidpos, 1.0);
871  }
872  if (EEDetId::validDetId(iX, iY, -1)) {
873  EEDetId eedetidneg(iX, iY, -1);
874  ical->setValue(eedetidneg, 1.0);
875  }
876  }
877  }
878 
879  } else {
880  cout << "... now reading EE file ..." << endl;
881 
882  int ii = 0;
883  while (fgets(line, 255, inpFileEE)) {
884  int iz, ix, iy;
885  float calibee;
886  sscanf(line, "%d %d %d %f", &iz, &ix, &iy, &calibee);
887  if (ii <= 0)
888  cout << "crystal " << iz << "/" << ix << "/" << iy << " cali=" << calibee << endl;
889 
890  if (EEDetId::validDetId(ix, iy, iz)) {
891  EEDetId eedetid(ix, iy, iz);
892  ical->setValue(eedetid, calibee);
893  }
894 
895  ii++;
896  }
897 
898  fclose(inpFileEE); // close inp. file
899  }
900 
901  cout << "loop on EE channels done" << endl;
902 
903  return ical;
904 }
905 
906 //-------------------------------------------------------------
908  // input either cosntruction number or slot number and returns the other
909  // the slots are numbered first EB+ slot 1 ...18 then EB- 1... 18
910  // the slots start at 1 and the SM start at 0
911  //-------------------------------------------------------------
912  int slot_to_constr[37] = {-1, 12, 17, 10, 1, 8, 4, 27, 20, 23, 25, 6, 34, 35, 15, 18, 30, 21, 9,
913  24, 22, 13, 31, 26, 16, 2, 11, 5, 0, 29, 28, 14, 33, 32, 3, 7, 19};
914  int constr_to_slot[36] = {28, 4, 25, 34, 6, 27, 11, 35, 5, 18, 3, 26, 1, 21, 31, 14, 24, 2,
915  15, 36, 8, 17, 20, 9, 19, 10, 23, 7, 30, 29, 16, 22, 33, 32, 12, 13};
916 
917  int result = 0;
918  if (sm_constr != -1) {
919  result = constr_to_slot[sm_constr];
920  } else if (sm_slot != -1) {
921  result = slot_to_constr[sm_slot];
922  }
923  return result;
924 }
925 
926 //-------------------------------------------------------------
928  //-------------------------------------------------------------
929 
930  // create gain ratios
931  EcalGainRatios* gratio = new EcalGainRatios;
932 
933  FILE* inpFile; // input file
934  inpFile = fopen(inputFile, "r");
935  if (!inpFile) {
936  edm::LogError("StoreEcalCondition") << "*** Can not open file: " << inputFile;
937  return nullptr;
938  }
939 
940  char line[256];
941  std::ostringstream str;
942 
943  fgets(line, 255, inpFile);
944  string sm_or_all = to_string(line);
945  int sm_number = 0;
946  sm_number = atoi(line);
947  str << "sm= " << sm_number << endl;
948 
949  fgets(line, 255, inpFile);
950  //int nevents=atoi(line);
951 
952  fgets(line, 255, inpFile);
953  string gen_tag = to_string(line);
954  str << "gen tag " << gen_tag << endl;
955 
956  fgets(line, 255, inpFile);
957  string cali_method = to_string(line);
958  str << "cali method " << cali_method << endl;
959 
960  fgets(line, 255, inpFile);
961  string cali_version = to_string(line);
962  str << "cali version " << cali_version << endl;
963 
964  fgets(line, 255, inpFile);
965  string cali_type = to_string(line);
966 
967  str << "cali type " << cali_type << endl;
968 
969  edm::LogInfo("StoreEcalCondition") << "GainRatio file " << str.str();
970 
971  int cry_num[61200] = {0};
972  float g1_g12[61200] = {0};
973  float g6_g12[61200] = {0};
974  int calib_status[61200] = {0};
975  int dummy1 = 0;
976  int dummy2 = 0;
977  int hash1 = 0;
978 
979  int ii = 0;
980 
981  if (sm_number != -1) {
982  while (fgets(line, 255, inpFile)) {
983  sscanf(line, "%d %d %d %f %f %d", &dummy1, &dummy2, &cry_num[ii], &g1_g12[ii], &g6_g12[ii], &calib_status[ii]);
984  ii++;
985  }
986 
987  fclose(inpFile); // close inp. file
988 
989  edm::LogInfo("StoreEcalCondition") << "Read gainRatios for " << ii << " xtals ";
990  if (ii != 1700)
991  edm::LogWarning("StoreEcalCondition") << " Missing crystals:: missing channels will be set to 0" << endl;
992 
993  // Get channel ID
994  sm_constr_ = sm_number;
995 
996  for (int i = 0; i < 1700; i++) {
997  // EBDetId(int index1, int index2, int mode = ETAPHIMODE)
998  // sm and crys index SMCRYSTALMODE index1 is SM index2 is crystal number a la H4
999  EBDetId ebid(sm_slot_, cry_num[i], EBDetId::SMCRYSTALMODE);
1000  // cout << "ebid.rawId()"<< ebid.rawId()<< endl;
1001  EcalMGPAGainRatio gr;
1002  gr.setGain12Over6(g6_g12[i]);
1003  gr.setGain6Over1(g1_g12[i] / g6_g12[i]);
1004  gratio->setValue(ebid.rawId(), gr);
1005  } // loop over channels
1006 
1007  } else {
1008  // this is for the whole Barrel
1009  cout << "mode ALL BARREL" << endl;
1010  while (fgets(line, 255, inpFile)) {
1011  int eta = 0;
1012  int phi = 0;
1013  sscanf(line, "%d %d %d %f %f", &hash1, &eta, &phi, &g1_g12[ii], &g6_g12[ii]);
1014  if (ii < 20)
1015  cout << "crystal eta/phi=" << eta << "/" << phi << " g1_12/g6_12= " << g1_g12[ii] << "/" << g6_g12[ii] << endl;
1016 
1017  if (g1_g12[ii] < 9 || g1_g12[ii] > 15)
1018  g1_g12[ii] = 12.0;
1019  if (g6_g12[ii] < 1 || g6_g12[ii] > 3)
1020  g6_g12[ii] = 2.0;
1021 
1022  if (eta < -85 || eta > 85 || eta == 0)
1023  std::cout << "error!!!" << endl;
1024  if (phi < 1 || phi > 360)
1025  std::cout << "error!!!" << endl;
1026 
1028  EcalMGPAGainRatio gr;
1029  gr.setGain12Over6(g6_g12[ii]);
1030  gr.setGain6Over1(g1_g12[ii] / g6_g12[ii]);
1031  gratio->setValue(ebid.rawId(), gr);
1032 
1033  ii++;
1034  }
1035 
1036  fclose(inpFile); // close inp. file
1037  if (ii != 61200)
1038  edm::LogWarning("StoreEcalCondition") << " Missing crystals !!!!!!!" << endl;
1039 
1040  std::cout << "number of crystals read:" << ii << endl;
1041  }
1042 
1043  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
1044  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
1045  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
1046  EcalMGPAGainRatio gr;
1047  gr.setGain12Over6(2.);
1048  gr.setGain6Over1(6.);
1049 
1050  if (EEDetId::validDetId(iX, iY, 1)) {
1051  EEDetId eedetidpos(iX, iY, 1);
1052  gratio->setValue(eedetidpos.rawId(), gr);
1053  }
1054  if (EEDetId::validDetId(iX, iY, -1)) {
1055  EEDetId eedetidneg(iX, iY, -1);
1056  gratio->setValue(eedetidneg.rawId(), gr);
1057  }
1058  }
1059  }
1060 
1061  std::cout << " gratio pointer=" << gratio << endl;
1062 
1063  std::cout << "now leaving" << endl;
1064 
1065  return gratio;
1066 }
1067 
1070  // barrel
1071  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
1072  if (ieta == 0)
1073  continue;
1074  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
1075  if (EBDetId::validDetId(ieta, iphi)) {
1076  EBDetId ebid(ieta, iphi);
1077  status->setValue(ebid, 0);
1078  }
1079  }
1080  }
1081  // endcap
1082  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
1083  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
1084  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
1085  if (EEDetId::validDetId(iX, iY, 1)) {
1086  EEDetId eedetidpos(iX, iY, 1);
1087  status->setValue(eedetidpos, 0);
1088  }
1089  if (EEDetId::validDetId(iX, iY, -1)) {
1090  EEDetId eedetidneg(iX, iY, -1);
1091  status->setValue(eedetidneg, 0);
1092  }
1093  }
1094  }
1095 
1096  // edm::LogInfo("EcalTrivialConditionRetriever") << "Reading channel status from file " << edm::FileInPath(channelStatusFile_).fullPath().c_str() ;
1097  std::cout << "Reading channel status from file " << inputFile << std::endl;
1098  FILE* ifile = fopen(inputFile, "r");
1099  if (!ifile)
1100  throw cms::Exception("Cannot open ECAL channel status file");
1101 
1102  char line[256];
1103 
1104  fgets(line, 255, ifile);
1105  std::string gen_tag = line;
1106  std::cout << "Gen tag " << gen_tag << std::endl;
1107 
1108  fgets(line, 255, ifile);
1109  std::string comment = line;
1110  std::cout << "Gen comment " << comment << std::endl;
1111 
1112  int iovRunStart(0);
1113  fgets(line, 255, ifile);
1114  sscanf(line, "%d", &iovRunStart);
1115  std::cout << "IOV START " << iovRunStart << std::endl;
1116  //if -1 start of time
1117 
1118  int iovRunEnd(0);
1119  fgets(line, 255, ifile);
1120  sscanf(line, "%d", &iovRunEnd);
1121  std::cout << "IOV END " << iovRunEnd << std::endl;
1122  //if -1 end of time
1123 
1124  int ii = 0;
1125  while (fgets(line, 255, ifile)) {
1126  std::string EBorEE;
1127  int hashedIndex(0);
1128  int chStatus(0);
1129  std::stringstream aStrStream;
1130  aStrStream << line;
1131  aStrStream >> EBorEE >> hashedIndex >> chStatus;
1132  // if(ii==0)
1133  std::cout << EBorEE << " hashedIndex " << hashedIndex << " status " << chStatus << std::endl;
1134 
1135  if (EBorEE == "EB") {
1137  status->setValue(aEBDetId, chStatus);
1138  } else if (EBorEE == "EE") {
1139  // chStatus=1;
1141  status->setValue(aEEDetId, chStatus);
1142  } else if (EBorEE == "EBTT") {
1143  int ism = hashedIndex;
1144  int itt = chStatus;
1145 
1146  int ixtt = (itt - 1) % 4;
1147  int iytt = (itt - 1) / 4;
1148  int ixmin = ixtt * 5;
1149  int iymin = iytt * 5;
1150  int ixmax = (ixtt + 1) * 5 - 1;
1151  int iymax = (iytt + 1) * 5 - 1;
1152  for (int ieta = iymin; ieta <= iymax; ieta++) {
1153  for (int iphi = ixmin; iphi <= ixmax; iphi++) {
1154  int ixt = ieta * 20 + iphi + 1;
1155  std::cout << "killing crystal " << ism << "/" << ixt << endl;
1156  EBDetId ebid(ism, ixt, EBDetId::SMCRYSTALMODE);
1157  status->setValue(ebid, 1);
1158  }
1159  }
1160  }
1161 
1162  ii++;
1163  }
1164 
1165  fclose(ifile);
1166 
1167  /*
1168  std::cout <<"KILLING CHANNELS FOR CRAFT EB+16 AND EB+7"<<endl;
1169 
1170  int ism=7;
1171  for(int ixt=1; ixt<=500; ixt++) {
1172  EBDetId ebid(ism,ixt,EBDetId::SMCRYSTALMODE);
1173  status->setValue( ebid, 1 );
1174  }
1175  for(int ixt=501; ixt<=900; ixt++) {
1176  EBDetId ebid(ism,ixt,EBDetId::SMCRYSTALMODE);
1177  if( ((ixt)%20==0) || ((ixt)%20>10) ){
1178  status->setValue( ebid, 1 );
1179  }
1180  }
1181  ism=16;
1182  for(int ixt=501; ixt<=900; ixt++) {
1183  EBDetId ebid(ism,ixt,EBDetId::SMCRYSTALMODE);
1184  if( ((ixt)%20==0) || ((ixt)%20>10) ){
1185  status->setValue( ebid, 1 );
1186  }
1187  }
1188 
1189  */
1190 
1191  return status;
1192 }
StoreEcalCondition::sm_slot_
int sm_slot_
Definition: StoreEcalCondition.h:68
mps_fire.i
i
Definition: mps_fire.py:428
StoreEcalCondition::convertFromConstructionSMToSlot
int convertFromConstructionSMToSlot(int, int)
Definition: StoreEcalCondition.cc:907
MessageLogger.h
StoreEcalCondition::analyze
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: StoreEcalCondition.cc:154
EcalMGPAGainRatio::setGain6Over1
void setGain6Over1(const float &g)
Definition: EcalMGPAGainRatio.h:23
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
mps_update.status
status
Definition: mps_update.py:69
EBDetId
Definition: EBDetId.h:17
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
StoreEcalCondition::to_string
std::string to_string(char value[])
Definition: StoreEcalCondition.h:72
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:141
protons_cff.time
time
Definition: protons_cff.py:39
StoreEcalCondition::sm_constr_
int sm_constr_
Definition: StoreEcalCondition.h:67
EEDetId::IX_MIN
static const int IX_MIN
Definition: EEDetId.h:290
StoreEcalCondition::readEcalIntercalibConstantsMCFromFile
EcalIntercalibConstantsMC * readEcalIntercalibConstantsMCFromFile(const char *, const char *)
Definition: StoreEcalCondition.cc:749
EcalPFRecHitThresholds
EcalPFRecHitThresholdsMap EcalPFRecHitThresholds
Definition: EcalPFRecHitThresholds.h:12
EcalADCToGeVConstant
Definition: EcalADCToGeVConstant.h:13
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
StoreEcalCondition::readEcalGainRatiosFromFile
EcalGainRatios * readEcalGainRatiosFromFile(const char *)
Definition: StoreEcalCondition.cc:927
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
EEDetId::IY_MIN
static const int IY_MIN
Definition: EEDetId.h:294
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalGainRatios
EcalGainRatioMap EcalGainRatios
Definition: EcalGainRatios.h:12
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
StoreEcalCondition::logfile_
std::string logfile_
Definition: StoreEcalCondition.h:70
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
EcalXtalGroupId
Definition: EcalXtalGroupId.h:11
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
StoreEcalCondition.h
EcalWeightSet::EcalWeightMatrix
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
StoreEcalCondition::inpFileName_
std::vector< std::string > inpFileName_
Definition: StoreEcalCondition.h:64
PoolDBOutputService.h
StoreEcalCondition::readEcalTBWeightsFromFile
EcalTBWeights * readEcalTBWeightsFromFile(const char *)
Definition: StoreEcalCondition.cc:315
StoreEcalCondition::~StoreEcalCondition
~StoreEcalCondition() override
Definition: StoreEcalCondition.cc:151
StoreEcalCondition::writeToLogFile
void writeToLogFile(std::string, std::string, unsigned long long)
Definition: StoreEcalCondition.cc:159
EcalTBWeights::setValue
void setValue(const EcalXtalGroupId &groupId, const EcalTDCId &tdcId, const EcalWeightSet &weight)
Definition: EcalTBWeights.cc:15
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
Service.h
PVValHelper::eta
Definition: PVValidationHelpers.h:70
StoreEcalCondition::readEcalPFRecHitThresholdsFromFile
EcalPFRecHitThresholds * readEcalPFRecHitThresholdsFromFile(const char *, const char *)
Definition: StoreEcalCondition.cc:522
compare_using_db.ifile
ifile
Definition: compare_using_db.py:251
str
#define str(s)
Definition: TestProcessor.cc:52
StoreEcalCondition::inpFileNameEE_
std::vector< std::string > inpFileNameEE_
Definition: StoreEcalCondition.h:65
writeEcalDQMStatus.since
since
Definition: writeEcalDQMStatus.py:53
EBDetId::MAX_IPHI
static const int MAX_IPHI
Definition: EBDetId.h:137
EEDetId::IY_MAX
static const int IY_MAX
Definition: EEDetId.h:302
EcalIntercalibConstants
EcalIntercalibConstantMap EcalIntercalibConstants
Definition: EcalIntercalibConstants.h:12
dqmdumpme.k
k
Definition: dqmdumpme.py:60
EcalWeightSet::getWeightsAfterGainSwitch
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
b
double b
Definition: hdecay.h:118
StoreEcalCondition::prog_name_
std::string prog_name_
Definition: StoreEcalCondition.h:66
EEDetId
Definition: EEDetId.h:14
L1TdeCSCTF_cfi.outFile
outFile
Definition: L1TdeCSCTF_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
calib
Definition: CalibElectron.h:12
EcalMGPAGainRatio::setGain12Over6
void setGain12Over6(const float &g)
Definition: EcalMGPAGainRatio.h:22
EBDetId::ETAPHIMODE
static const int ETAPHIMODE
Definition: EBDetId.h:158
EcalWeightSet::getWeightsBeforeGainSwitch
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:26
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
EcalCondObjectContainer::setValue
void setValue(const uint32_t id, const Item &item)
Definition: EcalCondObjectContainer.h:76
Time.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
Event.h
StoreEcalCondition::fillHeader
void fillHeader(char *)
Definition: StoreEcalCondition.cc:205
StoreEcalCondition::endJob
void endJob() override
Definition: StoreEcalCondition.cc:39
EcalWeightXtalGroups
EcalCondObjectContainer< EcalXtalGroupId > EcalWeightXtalGroups
Definition: EcalWeightXtalGroups.h:12
EcalWeightSet::EcalChi2WeightMatrix
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
Definition: EcalWeightSet.h:20
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
StoreEcalCondition::since_
std::vector< unsigned long long > since_
Definition: StoreEcalCondition.h:69
EEDetId::IX_MAX
static const int IX_MAX
Definition: EEDetId.h:298
EcalWeightSet::getChi2WeightsAfterGainSwitch
EcalChi2WeightMatrix & getChi2WeightsAfterGainSwitch()
Definition: EcalWeightSet.h:29
nchan
int nchan
Definition: TauolaWrapper.h:80
StoreEcalCondition::StoreEcalCondition
StoreEcalCondition(const edm::ParameterSet &iConfig)
Definition: StoreEcalCondition.cc:21
StoreEcalCondition::readEcalADCToGeVConstantFromFile
EcalADCToGeVConstant * readEcalADCToGeVConstantFromFile(const char *)
Definition: StoreEcalCondition.cc:463
edm::Service< cond::service::PoolDBOutputService >
createfilelist.int
int
Definition: createfilelist.py:10
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
edm::EventSetup
Definition: EventSetup.h:58
DBConfiguration_cff.toPut
toPut
Definition: DBConfiguration_cff.py:25
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalChannelStatus
EcalChannelStatusMap EcalChannelStatus
Definition: EcalChannelStatus.h:13
EnviromentSettings.user
user
Definition: EnviromentSettings.py:30
GOODCOLL_filter_cfg.thresh
thresh
Definition: GOODCOLL_filter_cfg.py:74
EcalWeightSet
Definition: EcalWeightSet.h:17
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
StoreEcalCondition::readEcalChannelStatusFromFile
EcalChannelStatus * readEcalChannelStatusFromFile(const char *)
Definition: StoreEcalCondition.cc:1068
DDAxes::phi
ecalpyutils::ism
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:51
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
StoreEcalCondition::readEcalIntercalibConstantsFromFile
EcalIntercalibConstants * readEcalIntercalibConstantsFromFile(const char *, const char *)
Definition: StoreEcalCondition.cc:591
Exception
Definition: hltDiff.cc:245
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
funct::arg
A arg
Definition: Factorize.h:31
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
EcalWeightSet::getChi2WeightsBeforeGainSwitch
EcalChi2WeightMatrix & getChi2WeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:28
edm::Event
Definition: Event.h:73
mps_splice.line
line
Definition: mps_splice.py:76
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
StoreEcalCondition::readEcalWeightXtalGroupsFromFile
EcalWeightXtalGroups * readEcalWeightXtalGroupsFromFile(const char *)
Definition: StoreEcalCondition.cc:249
EBDetId::SMCRYSTALMODE
static const int SMCRYSTALMODE
Definition: EBDetId.h:159
ecalpyutils::hashedIndex
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:38
StoreEcalCondition::writeToLogFileResults
void writeToLogFileResults(char *)
Definition: StoreEcalCondition.cc:189
cuy.ii
ii
Definition: cuy.py:590
EcalIntercalibConstantsMC
EcalIntercalibConstantMCMap EcalIntercalibConstantsMC
Definition: EcalIntercalibConstantsMC.h:12
StoreEcalCondition::objectName_
std::vector< std::string > objectName_
Definition: StoreEcalCondition.h:62
EBDetId::MAX_IETA
static const int MAX_IETA
Definition: EBDetId.h:136
EcalTBWeights
Definition: EcalTBWeights.h:15
EcalMGPAGainRatio
Definition: EcalMGPAGainRatio.h:13
EBDetId::MIN_IPHI
static const int MIN_IPHI
Definition: EBDetId.h:135