CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Pi0CalibXMLwriter Class Reference

#include <Pi0CalibXMLwriter.h>

Public Member Functions

 Pi0CalibXMLwriter (EcalSubdetector=EcalBarrel)
 
 Pi0CalibXMLwriter (EcalSubdetector=EcalBarrel, int=0)
 
void writeLine (EBDetId const &, float)
 
void writeLine (EEDetId const &, float)
 
 ~Pi0CalibXMLwriter ()
 

Private Attributes

FILE * FILENAME
 
int loop_
 
EcalSubdetector subdet_
 

Detailed Description

Definition at line 10 of file Pi0CalibXMLwriter.h.

Constructor & Destructor Documentation

◆ Pi0CalibXMLwriter() [1/2]

Pi0CalibXMLwriter::Pi0CalibXMLwriter ( EcalSubdetector  subdet = EcalBarrel)

Definition at line 5 of file Pi0CalibXMLwriter.cc.

5  : subdet_(subdet) {
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 }

References EcalEndcap, FILENAME, corrVsCorr::filename, and subdet_.

◆ Pi0CalibXMLwriter() [2/2]

Pi0CalibXMLwriter::Pi0CalibXMLwriter ( EcalSubdetector  subdet = EcalBarrel,
int  loop = 0 
)

Definition at line 22 of file Pi0CalibXMLwriter.cc.

22  : subdet_(subdet), loop_(loop) {
23  char filename[128];
24  if (subdet_ == EcalEndcap) {
25  sprintf(filename, "endcap_calib_loop_%d.xml", loop);
26  } else {
27  sprintf(filename, "barrel_calib_loop_%d.xml", loop);
28  }
29  FILENAME = fopen(filename, "w");
30  fprintf(FILENAME, "<?xml version=\"1.0\" ?>\n");
31  fprintf(FILENAME, "<CalibrationConstants>\n");
32  if (subdet == EcalEndcap) {
33  fprintf(FILENAME, "<EcalEndcap>\n");
34  } else {
35  fprintf(FILENAME, "<EcalBarrel>\n");
36  }
37 }

References EcalEndcap, FILENAME, corrVsCorr::filename, heppy_loop::loop, and subdet_.

◆ ~Pi0CalibXMLwriter()

Pi0CalibXMLwriter::~Pi0CalibXMLwriter ( )

Definition at line 39 of file Pi0CalibXMLwriter.cc.

39  {
40  if (subdet_ == EcalEndcap) {
41  fprintf(FILENAME, "<EcalEndcap>\n");
42  } else {
43  fprintf(FILENAME, "<EcalBarrel>\n");
44  }
45  fprintf(FILENAME, "</CalibrationConstants>\n");
46  fclose(FILENAME);
47 }

References EcalEndcap, FILENAME, and subdet_.

Member Function Documentation

◆ writeLine() [1/2]

void Pi0CalibXMLwriter::writeLine ( EBDetId const &  det,
float  calib 
)

Definition at line 49 of file Pi0CalibXMLwriter.cc.

49  {
50  int eta = det.ieta();
51  int phi = det.iphi();
52  fprintf(FILENAME, "<Cell eta_index=\"%d\" phi_index=\"%d\" scale_factor=\"%f\"/>\n", eta, phi, calib);
53 }

References PVValHelper::eta, FILENAME, EBDetId::ieta(), EBDetId::iphi(), and phi.

Referenced by Pi0FixedMassWindowCalibration::endOfJob(), and Pi0FixedMassWindowCalibration::endOfLoop().

◆ writeLine() [2/2]

void Pi0CalibXMLwriter::writeLine ( EEDetId const &  det,
float  calib 
)

Definition at line 55 of file Pi0CalibXMLwriter.cc.

55  {
56  int x = det.ix();
57  int y = det.iy();
58  int z = det.zside() > 0 ? 1 : 0;
59  fprintf(FILENAME, "<Cell x_index=\"%d\" y_index=\"%d\" z_index=\"%d\" scale_factor=\"%f\"/>\n", x, y, z, calib);
60 }

References FILENAME, EEDetId::ix(), EEDetId::iy(), x, y, z, and EEDetId::zside().

Member Data Documentation

◆ FILENAME

FILE* Pi0CalibXMLwriter::FILENAME
private

Definition at line 22 of file Pi0CalibXMLwriter.h.

Referenced by Pi0CalibXMLwriter(), writeLine(), and ~Pi0CalibXMLwriter().

◆ loop_

int Pi0CalibXMLwriter::loop_
private

Definition at line 21 of file Pi0CalibXMLwriter.h.

◆ subdet_

EcalSubdetector Pi0CalibXMLwriter::subdet_
private

Definition at line 20 of file Pi0CalibXMLwriter.h.

Referenced by Pi0CalibXMLwriter(), and ~Pi0CalibXMLwriter().

DDAxes::y
Pi0CalibXMLwriter::loop_
int loop_
Definition: Pi0CalibXMLwriter.h:21
Pi0CalibXMLwriter::subdet_
EcalSubdetector subdet_
Definition: Pi0CalibXMLwriter.h:20
DDAxes::x
PVValHelper::eta
Definition: PVValidationHelpers.h:70
DDAxes::z
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
calib
Definition: CalibElectron.h:12
EcalEndcap
Definition: EcalSubdetector.h:10
heppy_loop.loop
loop
Definition: heppy_loop.py:28
DDAxes::phi
Pi0CalibXMLwriter::FILENAME
FILE * FILENAME
Definition: Pi0CalibXMLwriter.h:22