CMS 3D CMS Logo

Pi0CalibXMLwriter.cc

Go to the documentation of this file.
00001 #include "Calibration/Tools/interface/Pi0CalibXMLwriter.h"
00002 #include <string>
00003 
00004 
00005 Pi0CalibXMLwriter::Pi0CalibXMLwriter(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 Pi0CalibXMLwriter::Pi0CalibXMLwriter(EcalSubdetector subdet, int loop) : subdet_(subdet), loop_(loop)
00026 {
00027     
00028     char filename[128];
00029     if (subdet_==EcalEndcap) {
00030       sprintf(filename,"endcap_calib_loop_%d.xml",loop);
00031     } else {
00032       sprintf(filename,"barrel_calib_loop_%d.xml",loop);
00033     }
00034     FILENAME = fopen(filename,"w");
00035     fprintf(FILENAME,"<?xml version=\"1.0\" ?>\n");
00036     fprintf(FILENAME,"<CalibrationConstants>\n");
00037     if (subdet==EcalEndcap) {
00038       fprintf(FILENAME,"<EcalEndcap>\n");
00039     } else {
00040       fprintf(FILENAME,"<EcalBarrel>\n");
00041     }
00042 
00043 }
00044 
00045 Pi0CalibXMLwriter::~Pi0CalibXMLwriter()
00046 {
00047     if (subdet_==EcalEndcap) {
00048       fprintf(FILENAME,"<EcalEndcap>\n");
00049     } else {
00050       fprintf(FILENAME,"<EcalBarrel>\n");
00051     }
00052     fprintf(FILENAME,"</CalibrationConstants>\n");
00053     fclose(FILENAME);
00054 }
00055 
00056 void Pi0CalibXMLwriter::writeLine(EBDetId const & det, float calib)
00057 {
00058 int eta=det.ieta();
00059 int phi=det.iphi();
00060 fprintf(FILENAME,"<Cell eta_index=\"%d\" phi_index=\"%d\" scale_factor=\"%f\"/>\n",eta,phi,calib);
00061 }
00062 
00063 
00064 void Pi0CalibXMLwriter::writeLine(EEDetId const & det, float calib)
00065 {
00066 int x=det.ix();
00067 int y=det.iy();
00068 int z=det.zside()>0 ? 1 : 0;
00069 fprintf(FILENAME,"<Cell x_index=\"%d\" y_index=\"%d\" z_index=\"%d\" scale_factor=\"%f\"/>\n",x,y,z,calib);
00070 }
00071 

Generated on Tue Jun 9 17:25:43 2009 for CMSSW by  doxygen 1.5.4