CMS 3D CMS Logo

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 }
DDAxes::y
EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
calibXMLwriter::subdet_
EcalSubdetector subdet_
Definition: calibXMLwriter.h:24
EBDetId
Definition: EBDetId.h:17
calibXMLwriter::FILENAME
FILE * FILENAME
Definition: calibXMLwriter.h:25
EcalSubdetector
EcalSubdetector
Definition: EcalSubdetector.h:10
DDAxes::x
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
calibXMLwriter::writeLine
void writeLine(EBDetId const &, float)
Definition: calibXMLwriter.cc:32
PVValHelper::eta
Definition: PVValidationHelpers.h:69
DDAxes::z
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
calibXMLwriter.h
EEDetId::zside
int zside() const
Definition: EEDetId.h:71
EEDetId
Definition: EEDetId.h:14
calib
Definition: CalibElectron.h:12
EcalEndcap
Definition: EcalSubdetector.h:10
EEDetId::iy
int iy() const
Definition: EEDetId.h:83
DDAxes::phi
calibXMLwriter::calibXMLwriter
calibXMLwriter(EcalSubdetector=EcalBarrel)
Definition: calibXMLwriter.cc:5
EBDetId::iphi
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
calibXMLwriter::~calibXMLwriter
~calibXMLwriter()
Definition: calibXMLwriter.cc:22