CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/Calibration/Tools/src/calibXMLwriter.cc

Go to the documentation of this file.
00001 #include "Calibration/Tools/interface/calibXMLwriter.h"
00002 #include <string>
00003 #include <cstdio>
00004 
00005 calibXMLwriter::calibXMLwriter(EcalSubdetector subdet) : subdet_(subdet)
00006 {
00007     
00008     char filename[128];
00009     if (subdet_==EcalEndcap) {
00010       sprintf(filename,"endcap_iniCalib.xml");
00011     } else {
00012       sprintf(filename,"barrel_iniCalib.xml");
00013     }
00014     FILENAME = fopen(filename,"w");
00015     fprintf(FILENAME,"<?xml version=\"1.0\" ?>\n");
00016     fprintf(FILENAME,"<CalibrationConstants>\n");
00017     if (subdet==EcalEndcap) {
00018       fprintf(FILENAME,"<EcalEndcap>\n");
00019     } else {
00020       fprintf(FILENAME,"<EcalBarrel>\n");
00021     }
00022 
00023 }
00024 
00025 calibXMLwriter::~calibXMLwriter()
00026 {
00027     if (subdet_==EcalEndcap) {
00028       fprintf(FILENAME,"<EcalEndcap>\n");
00029     } else {
00030       fprintf(FILENAME,"<EcalBarrel>\n");
00031     }
00032     fprintf(FILENAME,"</CalibrationConstants>\n");
00033     fclose(FILENAME);
00034 }
00035 
00036 void calibXMLwriter::writeLine(EBDetId const & det, float calib)
00037 {
00038 int eta=det.ieta();
00039 int phi=det.iphi();
00040 fprintf(FILENAME,"<Cell eta_index=\"%d\" phi_index=\"%d\" scale_factor=\"%f\"/>\n",eta,phi,calib);
00041 }
00042 
00043 
00044 void calibXMLwriter::writeLine(EEDetId const & det, float calib)
00045 {
00046 int x=det.ix();
00047 int y=det.iy();
00048 int z=det.zside();
00049 fprintf(FILENAME,"<Cell x_index=\"%d\" y_index=\"%d\" z_index=\"%d\" scale_factor=\"%f\"/>\n",x,y,z,calib);
00050 }
00051