CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
calibXMLwriter.cc
Go to the documentation of this file.
2 #include <string>
3 #include <cstdio>
4 
6  char filename[128];
7  if (subdet_ == EcalEndcap) {
8  sprintf(filename, "endcap_iniCalib.xml");
9  } else {
10  sprintf(filename, "barrel_iniCalib.xml");
11  }
12  FILENAME = fopen(filename, "w");
13  fprintf(FILENAME, "<?xml version=\"1.0\" ?>\n");
14  fprintf(FILENAME, "<CalibrationConstants>\n");
15  if (subdet == EcalEndcap) {
16  fprintf(FILENAME, "<EcalEndcap>\n");
17  } else {
18  fprintf(FILENAME, "<EcalBarrel>\n");
19  }
20 }
21 
23  if (subdet_ == EcalEndcap) {
24  fprintf(FILENAME, "<EcalEndcap>\n");
25  } else {
26  fprintf(FILENAME, "<EcalBarrel>\n");
27  }
28  fprintf(FILENAME, "</CalibrationConstants>\n");
29  fclose(FILENAME);
30 }
31 
32 void calibXMLwriter::writeLine(EBDetId const& det, float calib) {
33  int eta = det.ieta();
34  int phi = det.iphi();
35  fprintf(FILENAME, "<Cell eta_index=\"%d\" phi_index=\"%d\" scale_factor=\"%f\"/>\n", eta, phi, calib);
36 }
37 
38 void calibXMLwriter::writeLine(EEDetId const& det, float calib) {
39  int x = det.ix();
40  int y = det.iy();
41  int z = det.zside();
42  fprintf(FILENAME, "<Cell x_index=\"%d\" y_index=\"%d\" z_index=\"%d\" scale_factor=\"%f\"/>\n", x, y, z, calib);
43 }
int ix() const
Definition: EEDetId.h:77
EcalSubdetector subdet_
calibXMLwriter(EcalSubdetector=EcalBarrel)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
int zside() const
Definition: EEDetId.h:71
int iy() const
Definition: EEDetId.h:83
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
void writeLine(EBDetId const &, float)
tuple filename
Definition: lut2db_cfg.py:20
EcalSubdetector