Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:50

0001 // How to run:
0002 //root -b -q -l RemoteMonitoringMAP.C+
0003 //root -b -q -l 'RemoteMonitoringMAP.C+("/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LED_214513.root","/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LED_214512.root")'
0004 //root -b -q -l 'RemoteMonitoringMAP.C+(" /afs/cern.ch/work/d/dtlisov/private/Monitoring/histos/LED_211659.root","/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LED_214512.root")'
0005 //
0006 //
0007 //
0008 #include "LogEleMapdb.h"
0009 
0010 #include <iostream>
0011 #include <fstream>
0012 
0013 #include "TH1.h"
0014 #include "TH2.h"
0015 #include "TCanvas.h"
0016 #include "TROOT.h"
0017 #include <TMath.h>
0018 #include "TStyle.h"
0019 #include "TSystem.h"
0020 #include "TLegend.h"
0021 #include "TText.h"
0022 #include "TAxis.h"
0023 #include "TFile.h"
0024 #include "TLine.h"
0025 #include "TGraph.h"
0026 #include <TPaveText.h>
0027 
0028 //
0029 // https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT
0030 // https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/HcalRemoteMonitoring/GlobalRMT
0031 
0032 using namespace std;
0033 //inline void HERE(const char *msg) { std::cout << msg << std::endl; }
0034 
0035 int main(int argc, char *argv[]) {
0036   gROOT->Reset();
0037   gROOT->SetStyle("Plain");
0038   gStyle->SetOptStat(0);
0039   gStyle->SetOptTitle(1);
0040 
0041   if (argc < 2)
0042     return 1;
0043   char fname[300];
0044   char refname[300];
0045   sprintf(fname, "%s", argv[1]);
0046   sprintf(refname, "%s", argv[2]);
0047 
0048   cout << fname << " " << refname << std::endl;
0049 
0050   //
0051 
0052   //======================================================================
0053   // Connect the input files, parameters and get the 2-d histogram in memory
0054   //    TFile *hfile= new TFile("GlobalHist.root", "READ");
0055   string promt = (string)fname;
0056   string runnumber = "";
0057   for (unsigned int i = promt.size() - 11; i < promt.size() - 5; i++)
0058     runnumber += fname[i];
0059   string refrunnumber = "";
0060   promt = (string)refname;
0061   for (unsigned int i = promt.size() - 11; i < promt.size() - 5; i++)
0062     refrunnumber += refname[i];
0063 
0064   TFile *hfile = new TFile(fname, "READ");
0065   TFile *hreffile = new TFile(refname, "READ");
0066   //megatile channels
0067   //CUTS:    [test][subdetector]                                  ADC amplitude  Am      Width  for Wm             Ratio cut for Rm             TS mean for TNm           TS max  for TXm
0068   double MIN_M[7][5] = {{0., 0., 0., 0., 0.},
0069                         {0., 0., 0., 0., 0.},
0070                         {0, 0., 0., 0., 0.},
0071                         {0, 1.0, 1.0, 0.2, 0.1},
0072                         {0, 0.10, 0.10, 0.18, 0.30},
0073                         {0, 0.8, 0.8, 0.8, 0.1},
0074                         {0, -0.5, -0.5, -0.5, -0.5}};
0075   double MAX_M[7][5] = {{0., 0., 0., 0., 0.},
0076                         {0., 0., 0., 0., 0.},
0077                         {0, 900, 900, 9000, 3000},
0078                         {0, 3.9, 3.9, 4.4, 2.0},
0079                         {0, 0.95, 0.98, 0.96, 1.04},
0080                         {0, 8.0, 8.0, 8.0, 2.8},
0081                         {0, 6.5, 6.5, 6.5, 3.5}};
0082 
0083   // calibration channels:
0084   double MIN_C[7][5] = {{0., 0., 0., 0., 0.},
0085                         {0., 0., 0., 0., 0.},
0086                         {0, 120., 120., 120., 60.},
0087                         {0, 1.0, 1.0, 0.50, 0.2},
0088                         {0, 0.6, 0.64, 0.25, 0.25},
0089                         {0, 1.0, 1.0, 1.0, 1.0},
0090                         {0, 0.5, 0.5, 0.5, 0.5}};
0091   double MAX_C[7][5] = {{0., 0., 0., 0., 0.},
0092                         {0., 0., 0., 0., 0.},
0093                         {0, 1E20, 1E20, 1E20, 1E20},
0094                         {0, 2.3, 2.3, 3.0, 2.3},
0095                         {0, 1., 1., 1., 1.00},
0096                         {0, 5.5, 5.5, 3.5, 5.2},
0097                         {0, 8.5, 8.5, 8.5, 9.5}};
0098   double porog[5] = {0., 2., 2., 5., 1.};  // Cut for GS test in pro cents
0099   //    double porog[5] = {0., 200., 200., 100., 100.}; // Cut for GS test in pro cents
0100   double Pedest[2][5] = {{0., 0.2, 0.9, 0.1, 0.2}, {0., 0.2, 0.2, 0.1, 0.16}};  //Cuts for Pedestal  and pedestal  Width
0101   //======================================================================
0102   //======================================================================
0103   // Prepare histograms and plot them to .png files
0104 
0105   //TCanvas *cHB = new TCanvas("cHB","cHB",1000,500);
0106   TCanvas *cHB = new TCanvas("cHB", "cHB", 1000, 1000);
0107   //TCanvas *cHE = new TCanvas("cHE","cHE",1500,500);
0108   TCanvas *cHE = new TCanvas("cHE", "cHE", 1500, 1500);
0109   //  TCanvas *cONE = new TCanvas("cONE","cONE",500,500);
0110   TCanvas *cONE = new TCanvas("cONE", "cONE", 1500, 500);
0111   TCanvas *cPED = new TCanvas("cPED", "cPED", 1000, 500);
0112   //TCanvas *cHF = new TCanvas("cHF","cHF",1000,1000);
0113   TCanvas *cHF = new TCanvas("cHF", "cHF", 1000, 1000);
0114 
0115   char *str = (char *)alloca(10000);
0116 
0117   // before upgrade 2017:
0118   // depth: HB depth1,2; HE depth1,2,3; HO depth4; HF depth1,2
0119   // 5 depthes:  0(empty),   1,2,3,4
0120 
0121   // upgrade 2017:
0122   // depth: HB depth1,2; HE depth1,2,3,4,5,6,7; HO depth4; HF depth1,2,3,4
0123   // 8 depthes:  0(empty),   1,2,3,4,5,6,7
0124 
0125   // upgrade 2019:
0126   // depth: HB depth1,2,3,4; HE depth1,2,3,4,5,6,7; HO depth4; HF depth1,2,3,4
0127   // 10 depthes:  0(empty),   1,2,3,4,5,6,7,8,9
0128 
0129   //  Int_t ALLDEPTH = 5;
0130   //  Int_t ALLDEPTH = 8;
0131   Int_t ALLDEPTH = 10;
0132 
0133   int k_min[5] = {0, 1, 1, 4, 1};  // minimum depth for each subdet
0134 
0135   //int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0136   //int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0137   int k_max[5] = {0, 4, 7, 4, 4};  // maximum depth for each subdet
0138 
0139   TH2F *Map_Ampl[33][5][ALLDEPTH];       // 2D histogramm for test,subdet,depth
0140   TH2F *Map_SUB[5][ALLDEPTH];            // 2d histogramm for subdet, depth
0141   TH1F *HistAmplDepth[22][5][ALLDEPTH];  // 1d histogramm for test,subdet, depth
0142   TH1F *HistAmpl[22][5];                 // 1d histogramm for test,subdet
0143 
0144   TH1F *HistPed[3][5][4];           // 1d  histogramm for test,subdet, CapID
0145   TH2F *Map_Ped[3][5];              // 2d  histogramm for test,subdet -> test 33
0146   TH1F *hist_GoodTSshape[5];        // 1d  histogramm for TS shape subdet -> test 41
0147   TH1F *hist_GoodTSshape0[5];       // 1d  histogramm for TS shape subdet -> test 41
0148   TH1F *hist_BadTSshape[5];         // 1d  histogramm for TS shape subdet -> test 41
0149   TH1F *hist_BadTSshape0[5];        // 1d  histogramm for TS shape subdet -> test 41
0150   TH1F *hist_ADC_All[5];            // 1d  histogramm for TS shape subdet -> test 42
0151   TH1F *hist_ADC_DS[5][ALLDEPTH];   // 1d  histogramm for TS shape subdet, depth -> test 42
0152   TH1F *hist_SumADC[5][ALLDEPTH];   // 1d  histogramm for TS shape subdet, depth -> test 43
0153   TH1F *hist_SumADC0[5][ALLDEPTH];  // 1d  histogramm for TS shape subdet, depth -> test 43
0154   TH1F *hist_SumADC1[5][ALLDEPTH];  // 1d  histogramm for TS shape subdet, depth -> test 43
0155 
0156   Map_SUB[1][1] = (TH2F *)hfile->Get("h_mapDepth1_HB");
0157   Map_SUB[1][2] = (TH2F *)hfile->Get("h_mapDepth2_HB");
0158   Map_SUB[2][1] = (TH2F *)hfile->Get("h_mapDepth1_HE");
0159   Map_SUB[2][2] = (TH2F *)hfile->Get("h_mapDepth2_HE");
0160   Map_SUB[2][3] = (TH2F *)hfile->Get("h_mapDepth3_HE");
0161   Map_SUB[3][4] = (TH2F *)hfile->Get("h_mapDepth4_HO");
0162   Map_SUB[4][1] = (TH2F *)hfile->Get("h_mapDepth1_HF");
0163   Map_SUB[4][2] = (TH2F *)hfile->Get("h_mapDepth2_HF");
0164 
0165   Map_SUB[2][4] = (TH2F *)hfile->Get("h_mapDepth4_HE");
0166   Map_SUB[2][5] = (TH2F *)hfile->Get("h_mapDepth5_HE");
0167   Map_SUB[2][6] = (TH2F *)hfile->Get("h_mapDepth6_HE");
0168   Map_SUB[2][7] = (TH2F *)hfile->Get("h_mapDepth7_HE");
0169   Map_SUB[4][3] = (TH2F *)hfile->Get("h_mapDepth3_HF");
0170   Map_SUB[4][4] = (TH2F *)hfile->Get("h_mapDepth4_HF");
0171 
0172   Map_SUB[1][3] = (TH2F *)hfile->Get("h_mapDepth3_HB");
0173   Map_SUB[1][4] = (TH2F *)hfile->Get("h_mapDepth4_HB");
0174   //+++++++++++++++++++++++++++++
0175   //Test 0 Entries
0176   //+++++++++++++++++++++++++++++
0177 
0178   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0179                                         //     if (sub==1) cHB->Divide(2,1);
0180     if (sub == 1)
0181       cHB->Divide(2, 2);
0182     //     if (sub==2) cHE->Divide(3,1);
0183     if (sub == 2)
0184       cHE->Divide(3, 3);
0185     if (sub == 3)
0186       cONE->Divide(1, 1);
0187     //     if (sub==4) cHF->Divide(2,1);
0188     if (sub == 4)
0189       cHF->Divide(2, 2);
0190     //     int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0191     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0192     //     int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0193     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0194       if (sub == 1)
0195         cHB->cd(k);
0196       if (sub == 2)
0197         cHE->cd(k);
0198       if (sub == 3)
0199         cONE->cd(k - 3);
0200       if (sub == 4)
0201         cHF->cd(k);
0202       gPad->SetGridy();
0203       gPad->SetGridx();
0204       gPad->SetLogz();
0205       if (sub == 1)
0206         sprintf(str, "HB, Depth%d \b", k);
0207       if (sub == 2)
0208         sprintf(str, "HE, Depth%d \b", k);
0209       if (sub == 3)
0210         sprintf(str, "HO, Depth%d \b", k);
0211       if (sub == 4)
0212         sprintf(str, "HF, Depth%d \b", k);
0213       Map_SUB[sub][k]->SetTitle(str);
0214       Map_SUB[sub][k]->SetXTitle("#eta \b");
0215       Map_SUB[sub][k]->SetYTitle("#phi \b");
0216       Map_SUB[sub][k]->SetZTitle("Number of events \b");
0217       if (sub == 3)
0218         Map_SUB[sub][k]->SetTitleOffset(0.8, "Z");
0219       Map_SUB[sub][k]->Draw("COLZ");
0220       Map_SUB[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0221       //            Map_SUB[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0222       if (sub == 1) {
0223         cHB->Modified();
0224         cHB->Update();
0225       }
0226       if (sub == 2) {
0227         cHE->Modified();
0228         cHE->Update();
0229       }
0230       if (sub == 3) {
0231         cONE->Modified();
0232         cONE->Update();
0233       }
0234       if (sub == 4) {
0235         cHF->Modified();
0236         cHF->Update();
0237       }
0238     }  //end depth
0239 
0240     if (sub == 1) {
0241       cHB->Print("MapRateEntryHB.png");
0242       cHB->Clear();
0243     }
0244     if (sub == 2) {
0245       cHE->Print("MapRateEntryHE.png");
0246       cHE->Clear();
0247     }
0248     if (sub == 3) {
0249       cONE->Print("MapRateEntryHO.png");
0250       cONE->Clear();
0251     }
0252     if (sub == 4) {
0253       cHF->Print("MapRateEntryHF.png");
0254       cHF->Clear();
0255     }
0256   }  // end sub
0257 
0258   //+++++++++++++++++++++++++++++
0259   //Test 1 (Cm) Rate of Cap ID errors
0260   //+++++++++++++++++++++++++++++
0261 
0262   Map_Ampl[1][1][1] = (TH2F *)hfile->Get("h_mapDepth1Error_HB");
0263   Map_Ampl[1][1][2] = (TH2F *)hfile->Get("h_mapDepth2Error_HB");
0264   Map_Ampl[1][2][1] = (TH2F *)hfile->Get("h_mapDepth1Error_HE");
0265   Map_Ampl[1][2][2] = (TH2F *)hfile->Get("h_mapDepth2Error_HE");
0266   Map_Ampl[1][2][3] = (TH2F *)hfile->Get("h_mapDepth3Error_HE");
0267   Map_Ampl[1][3][4] = (TH2F *)hfile->Get("h_mapDepth4Error_HO");
0268   Map_Ampl[1][4][1] = (TH2F *)hfile->Get("h_mapDepth1Error_HF");
0269   Map_Ampl[1][4][2] = (TH2F *)hfile->Get("h_mapDepth2Error_HF");
0270 
0271   Map_Ampl[1][2][4] = (TH2F *)hfile->Get("h_mapDepth4Error_HE");
0272   Map_Ampl[1][2][5] = (TH2F *)hfile->Get("h_mapDepth5Error_HE");
0273   Map_Ampl[1][2][6] = (TH2F *)hfile->Get("h_mapDepth6Error_HE");
0274   Map_Ampl[1][2][7] = (TH2F *)hfile->Get("h_mapDepth7Error_HE");
0275   Map_Ampl[1][4][3] = (TH2F *)hfile->Get("h_mapDepth3Error_HF");
0276   Map_Ampl[1][4][4] = (TH2F *)hfile->Get("h_mapDepth4Error_HF");
0277 
0278   Map_Ampl[1][1][3] = (TH2F *)hfile->Get("h_mapDepth3Error_HB");
0279   Map_Ampl[1][1][4] = (TH2F *)hfile->Get("h_mapDepth4Error_HB");
0280 
0281   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0282                                         //     if (sub==1) cHB->Divide(2,1);
0283     if (sub == 1)
0284       cHB->Divide(2, 2);
0285     //     if (sub==2) cHE->Divide(3,1);
0286     if (sub == 2)
0287       cHE->Divide(3, 3);
0288     if (sub == 3)
0289       cONE->Divide(1, 1);
0290     //     if (sub==4) cHF->Divide(2,1);
0291     if (sub == 4)
0292       cHF->Divide(2, 2);
0293     //     int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0294     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0295     //     int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0296     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0297       if (sub == 1)
0298         cHB->cd(k);
0299       if (sub == 2)
0300         cHE->cd(k);
0301       if (sub == 3)
0302         cONE->cd(k - 3);
0303       if (sub == 4)
0304         cHF->cd(k);
0305       Map_Ampl[1][sub][k]->Divide(Map_Ampl[1][sub][k], Map_SUB[sub][k], 1, 1, "B");
0306       gPad->SetGridy();
0307       gPad->SetGridx();
0308       gPad->SetLogz();
0309       if (sub == 1)
0310         sprintf(str, "HB, Depth%d \b", k);
0311       if (sub == 2)
0312         sprintf(str, "HE, Depth%d \b", k);
0313       if (sub == 3)
0314         sprintf(str, "HO, Depth%d \b", k);
0315       if (sub == 4)
0316         sprintf(str, "HF, Depth%d \b", k);
0317       Map_Ampl[1][sub][k]->SetTitle(str);
0318       Map_Ampl[1][sub][k]->SetXTitle("#eta \b");
0319       Map_Ampl[1][sub][k]->SetYTitle("#phi \b");
0320       Map_Ampl[1][sub][k]->SetZTitle("Rate \b");
0321       if (sub == 3)
0322         Map_Ampl[1][sub][k]->SetTitleOffset(0.8, "Z");
0323       Map_Ampl[1][sub][k]->Draw("COLZ");
0324       Map_Ampl[1][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0325       Map_Ampl[1][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0326       if (sub == 1) {
0327         cHB->Modified();
0328         cHB->Update();
0329       }
0330       if (sub == 2) {
0331         cHE->Modified();
0332         cHE->Update();
0333       }
0334       if (sub == 3) {
0335         cONE->Modified();
0336         cONE->Update();
0337       }
0338       if (sub == 4) {
0339         cHF->Modified();
0340         cHF->Update();
0341       }
0342     }  //end depth
0343 
0344     if (sub == 1) {
0345       cHB->Print("MapRateCapIDHB.png");
0346       cHB->Clear();
0347     }
0348     if (sub == 2) {
0349       cHE->Print("MapRateCapIDHE.png");
0350       cHE->Clear();
0351     }
0352     if (sub == 3) {
0353       cONE->Print("MapRateCapIDHO.png");
0354       cONE->Clear();
0355     }
0356     if (sub == 4) {
0357       cHF->Print("MapRateCapIDHF.png");
0358       cHF->Clear();
0359     }
0360   }  // end sub
0361 
0362   //+++++++++++++++++++++++++++++
0363   //Test 2 (Am) ADC amplitude
0364   //+++++++++++++++++++++++++++++
0365 
0366   Map_Ampl[2][1][1] = (TH2F *)hfile->Get("h_mapDepth1ADCAmpl225_HB");
0367   Map_Ampl[2][1][2] = (TH2F *)hfile->Get("h_mapDepth2ADCAmpl225_HB");
0368   Map_Ampl[2][2][1] = (TH2F *)hfile->Get("h_mapDepth1ADCAmpl225_HE");
0369   Map_Ampl[2][2][2] = (TH2F *)hfile->Get("h_mapDepth2ADCAmpl225_HE");
0370   Map_Ampl[2][2][3] = (TH2F *)hfile->Get("h_mapDepth3ADCAmpl225_HE");
0371   Map_Ampl[2][3][4] = (TH2F *)hfile->Get("h_mapDepth4ADCAmpl225_HO");
0372   Map_Ampl[2][4][1] = (TH2F *)hfile->Get("h_mapDepth1ADCAmpl225_HF");
0373   Map_Ampl[2][4][2] = (TH2F *)hfile->Get("h_mapDepth2ADCAmpl225_HF");
0374 
0375   Map_Ampl[2][2][4] = (TH2F *)hfile->Get("h_mapDepth4ADCAmpl225_HE");
0376   Map_Ampl[2][2][5] = (TH2F *)hfile->Get("h_mapDepth5ADCAmpl225_HE");
0377   Map_Ampl[2][2][6] = (TH2F *)hfile->Get("h_mapDepth6ADCAmpl225_HE");
0378   Map_Ampl[2][2][7] = (TH2F *)hfile->Get("h_mapDepth7ADCAmpl225_HE");
0379   Map_Ampl[2][4][3] = (TH2F *)hfile->Get("h_mapDepth3ADCAmpl225_HF");
0380   Map_Ampl[2][4][4] = (TH2F *)hfile->Get("h_mapDepth4ADCAmpl225_HF");
0381 
0382   Map_Ampl[2][1][3] = (TH2F *)hfile->Get("h_mapDepth3ADCAmpl225_HB");
0383   Map_Ampl[2][1][4] = (TH2F *)hfile->Get("h_mapDepth4ADCAmpl225_HB");
0384 
0385   HistAmpl[2][1] = (TH1F *)hfile->Get("h_ADCAmpl_HB");
0386   HistAmpl[2][2] = (TH1F *)hfile->Get("h_ADCAmpl_HE");
0387   HistAmpl[2][3] = (TH1F *)hfile->Get("h_ADCAmpl_HO");
0388   HistAmpl[2][4] = (TH1F *)hfile->Get("h_ADCAmpl_HF");
0389 
0390   //+++++++++++++++++++++++++++++
0391   //Test 3 (Wm) Rate of RMS
0392   //+++++++++++++++++++++++++++++
0393 
0394   Map_Ampl[3][1][1] = (TH2F *)hfile->Get("h_mapDepth1Amplitude225_HB");
0395   Map_Ampl[3][1][2] = (TH2F *)hfile->Get("h_mapDepth2Amplitude225_HB");
0396   Map_Ampl[3][2][1] = (TH2F *)hfile->Get("h_mapDepth1Amplitude225_HE");
0397   Map_Ampl[3][2][2] = (TH2F *)hfile->Get("h_mapDepth2Amplitude225_HE");
0398   Map_Ampl[3][2][3] = (TH2F *)hfile->Get("h_mapDepth3Amplitude225_HE");
0399   Map_Ampl[3][3][4] = (TH2F *)hfile->Get("h_mapDepth4Amplitude225_HO");
0400   Map_Ampl[3][4][1] = (TH2F *)hfile->Get("h_mapDepth1Amplitude225_HF");
0401   Map_Ampl[3][4][2] = (TH2F *)hfile->Get("h_mapDepth2Amplitude225_HF");
0402 
0403   Map_Ampl[3][2][4] = (TH2F *)hfile->Get("h_mapDepth4Amplitude225_HE");
0404   Map_Ampl[3][2][5] = (TH2F *)hfile->Get("h_mapDepth5Amplitude225_HE");
0405   Map_Ampl[3][2][6] = (TH2F *)hfile->Get("h_mapDepth6Amplitude225_HE");
0406   Map_Ampl[3][2][7] = (TH2F *)hfile->Get("h_mapDepth7Amplitude225_HE");
0407   Map_Ampl[3][4][3] = (TH2F *)hfile->Get("h_mapDepth3Amplitude225_HF");
0408   Map_Ampl[3][4][4] = (TH2F *)hfile->Get("h_mapDepth4Amplitude225_HF");
0409 
0410   Map_Ampl[3][1][3] = (TH2F *)hfile->Get("h_mapDepth3Amplitude225_HB");
0411   Map_Ampl[3][1][4] = (TH2F *)hfile->Get("h_mapDepth4Amplitude225_HB");
0412 
0413   HistAmpl[3][1] = (TH1F *)hfile->Get("h_Amplitude_HB");
0414   HistAmpl[3][2] = (TH1F *)hfile->Get("h_Amplitude_HE");
0415   HistAmpl[3][3] = (TH1F *)hfile->Get("h_Amplitude_HO");
0416   HistAmpl[3][4] = (TH1F *)hfile->Get("h_Amplitude_HF");
0417 
0418   //+++++++++++++++++++++++++++++
0419   //Test 4 (Rm) Rate of ratio 4 near max TS/ All TS
0420   //+++++++++++++++++++++++++++++
0421 
0422   Map_Ampl[4][1][1] = (TH2F *)hfile->Get("h_mapDepth1Ampl047_HB");
0423   Map_Ampl[4][1][2] = (TH2F *)hfile->Get("h_mapDepth2Ampl047_HB");
0424   Map_Ampl[4][2][1] = (TH2F *)hfile->Get("h_mapDepth1Ampl047_HE");
0425   Map_Ampl[4][2][2] = (TH2F *)hfile->Get("h_mapDepth2Ampl047_HE");
0426   Map_Ampl[4][2][3] = (TH2F *)hfile->Get("h_mapDepth3Ampl047_HE");
0427   Map_Ampl[4][3][4] = (TH2F *)hfile->Get("h_mapDepth4Ampl047_HO");
0428   Map_Ampl[4][4][1] = (TH2F *)hfile->Get("h_mapDepth1Ampl047_HF");
0429   Map_Ampl[4][4][2] = (TH2F *)hfile->Get("h_mapDepth2Ampl047_HF");
0430 
0431   Map_Ampl[4][2][4] = (TH2F *)hfile->Get("h_mapDepth4Ampl047_HE");
0432   Map_Ampl[4][2][5] = (TH2F *)hfile->Get("h_mapDepth5Ampl047_HE");
0433   Map_Ampl[4][2][6] = (TH2F *)hfile->Get("h_mapDepth6Ampl047_HE");
0434   Map_Ampl[4][2][7] = (TH2F *)hfile->Get("h_mapDepth7Ampl047_HE");
0435   Map_Ampl[4][4][3] = (TH2F *)hfile->Get("h_mapDepth3Ampl047_HF");
0436   Map_Ampl[4][4][4] = (TH2F *)hfile->Get("h_mapDepth4Ampl047_HF");
0437 
0438   Map_Ampl[4][1][3] = (TH2F *)hfile->Get("h_mapDepth3Ampl047_HB");
0439   Map_Ampl[4][1][4] = (TH2F *)hfile->Get("h_mapDepth4Ampl047_HB");
0440 
0441   HistAmpl[4][1] = (TH1F *)hfile->Get("h_Ampl_HB");
0442   HistAmpl[4][2] = (TH1F *)hfile->Get("h_Ampl_HE");
0443   HistAmpl[4][3] = (TH1F *)hfile->Get("h_Ampl_HO");
0444   HistAmpl[4][4] = (TH1F *)hfile->Get("h_Ampl_HF");
0445 
0446   //+++++++++++++++++++++++++++++
0447   //Test 5 (TNm) Mean position in 1-8 TS range
0448   //+++++++++++++++++++++++++++++
0449 
0450   Map_Ampl[5][1][1] = (TH2F *)hfile->Get("h_mapDepth1TSmeanA225_HB");
0451   Map_Ampl[5][1][2] = (TH2F *)hfile->Get("h_mapDepth2TSmeanA225_HB");
0452   Map_Ampl[5][2][1] = (TH2F *)hfile->Get("h_mapDepth1TSmeanA225_HE");
0453   Map_Ampl[5][2][2] = (TH2F *)hfile->Get("h_mapDepth2TSmeanA225_HE");
0454   Map_Ampl[5][2][3] = (TH2F *)hfile->Get("h_mapDepth3TSmeanA225_HE");
0455   Map_Ampl[5][3][4] = (TH2F *)hfile->Get("h_mapDepth4TSmeanA225_HO");
0456   Map_Ampl[5][4][1] = (TH2F *)hfile->Get("h_mapDepth1TSmeanA225_HF");
0457   Map_Ampl[5][4][2] = (TH2F *)hfile->Get("h_mapDepth2TSmeanA225_HF");
0458 
0459   Map_Ampl[5][2][4] = (TH2F *)hfile->Get("h_mapDepth4TSmeanA225_HE");
0460   Map_Ampl[5][2][5] = (TH2F *)hfile->Get("h_mapDepth5TSmeanA225_HE");
0461   Map_Ampl[5][2][6] = (TH2F *)hfile->Get("h_mapDepth6TSmeanA225_HE");
0462   Map_Ampl[5][2][7] = (TH2F *)hfile->Get("h_mapDepth7TSmeanA225_HE");
0463   Map_Ampl[5][4][3] = (TH2F *)hfile->Get("h_mapDepth3TSmeanA225_HF");
0464   Map_Ampl[5][4][4] = (TH2F *)hfile->Get("h_mapDepth4TSmeanA225_HF");
0465 
0466   Map_Ampl[5][1][3] = (TH2F *)hfile->Get("h_mapDepth3TSmeanA225_HB");
0467   Map_Ampl[5][1][4] = (TH2F *)hfile->Get("h_mapDepth4TSmeanA225_HB");
0468 
0469   HistAmpl[5][1] = (TH1F *)hfile->Get("h_TSmeanA_HB");
0470   HistAmpl[5][2] = (TH1F *)hfile->Get("h_TSmeanA_HE");
0471   HistAmpl[5][3] = (TH1F *)hfile->Get("h_TSmeanA_HO");
0472   HistAmpl[5][4] = (TH1F *)hfile->Get("h_TSmeanA_HF");
0473 
0474   //+++++++++++++++++++++++++++++
0475   //Test 6 (TXm) Maximum position in 1-8 TS range
0476   //+++++++++++++++++++++++++++++
0477 
0478   Map_Ampl[6][1][1] = (TH2F *)hfile->Get("h_mapDepth1TSmaxA225_HB");
0479   Map_Ampl[6][1][2] = (TH2F *)hfile->Get("h_mapDepth2TSmaxA225_HB");
0480   Map_Ampl[6][2][1] = (TH2F *)hfile->Get("h_mapDepth1TSmaxA225_HE");
0481   Map_Ampl[6][2][2] = (TH2F *)hfile->Get("h_mapDepth2TSmaxA225_HE");
0482   Map_Ampl[6][2][3] = (TH2F *)hfile->Get("h_mapDepth3TSmaxA225_HE");
0483   Map_Ampl[6][3][4] = (TH2F *)hfile->Get("h_mapDepth4TSmaxA225_HO");
0484   Map_Ampl[6][4][1] = (TH2F *)hfile->Get("h_mapDepth1TSmaxA225_HF");
0485   Map_Ampl[6][4][2] = (TH2F *)hfile->Get("h_mapDepth2TSmaxA225_HF");
0486 
0487   Map_Ampl[6][2][4] = (TH2F *)hfile->Get("h_mapDepth4TSmaxA225_HE");
0488   Map_Ampl[6][2][5] = (TH2F *)hfile->Get("h_mapDepth5TSmaxA225_HE");
0489   Map_Ampl[6][2][6] = (TH2F *)hfile->Get("h_mapDepth6TSmaxA225_HE");
0490   Map_Ampl[6][2][7] = (TH2F *)hfile->Get("h_mapDepth7TSmaxA225_HE");
0491   Map_Ampl[6][4][3] = (TH2F *)hfile->Get("h_mapDepth3TSmaxA225_HF");
0492   Map_Ampl[6][4][4] = (TH2F *)hfile->Get("h_mapDepth4TSmaxA225_HF");
0493 
0494   Map_Ampl[6][1][3] = (TH2F *)hfile->Get("h_mapDepth3TSmaxA225_HB");
0495   Map_Ampl[6][1][4] = (TH2F *)hfile->Get("h_mapDepth4TSmaxA225_HB");
0496 
0497   HistAmpl[6][1] = (TH1F *)hfile->Get("h_TSmaxA_HB");
0498   HistAmpl[6][2] = (TH1F *)hfile->Get("h_TSmaxA_HE");
0499   HistAmpl[6][3] = (TH1F *)hfile->Get("h_TSmaxA_HO");
0500   HistAmpl[6][4] = (TH1F *)hfile->Get("h_TSmaxA_HF");
0501 
0502   for (int test = 2; test <= 6; test++) {  //Test: 2-Am, 3-Wm, 4-Rm, 5-TNm, 6-TXm,
0503     for (int sub = 1; sub <= 4; sub++) {   //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0504                                            //        if (sub==1) cHB->Divide(2,1);
0505       if (sub == 1)
0506         cHB->Divide(2, 2);
0507       //        if (sub==2) cHE->Divide(3,1);
0508       if (sub == 2)
0509         cHE->Divide(3, 3);
0510       if (sub == 3)
0511         cONE->Divide(1, 1);
0512       //        if (sub==4) cHF->Divide(2,1);
0513       if (sub == 4)
0514         cHF->Divide(2, 2);
0515       //        int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0516       //        int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0517       //        int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0518       for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0519         if (sub == 1)
0520           cHB->cd(k);
0521         if (sub == 2)
0522           cHE->cd(k);
0523         if (sub == 3)
0524           cONE->cd(k - 3);
0525         if (sub == 4)
0526           cHF->cd(k);
0527         Map_Ampl[test][sub][k]->Divide(Map_Ampl[test][sub][k], Map_SUB[sub][k], 1, 1, "B");
0528         gPad->SetGridy();
0529         gPad->SetGridx();
0530         gPad->SetLogz();
0531         if (sub == 1)
0532           sprintf(str, "HB, Depth%d \b", k);
0533         if (sub == 2)
0534           sprintf(str, "HE, Depth%d \b", k);
0535         if (sub == 3)
0536           sprintf(str, "HO, Depth%d \b", k);
0537         if (sub == 4)
0538           sprintf(str, "HF, Depth%d \b", k);
0539         Map_Ampl[test][sub][k]->SetTitle(str);
0540         Map_Ampl[test][sub][k]->SetXTitle("#eta \b");
0541         Map_Ampl[test][sub][k]->SetYTitle("#phi \b");
0542         Map_Ampl[test][sub][k]->SetZTitle("Rate \b");
0543         if (sub == 3)
0544           Map_Ampl[test][sub][k]->SetTitleOffset(0.8, "Z");
0545         Map_Ampl[test][sub][k]->Draw("COLZ");
0546         Map_Ampl[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0547         Map_Ampl[test][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0548         if (sub == 1) {
0549           cHB->Modified();
0550           cHB->Update();
0551         }
0552         if (sub == 2) {
0553           cHE->Modified();
0554           cHE->Update();
0555         }
0556         if (sub == 3) {
0557           cONE->Modified();
0558           cONE->Update();
0559         }
0560         if (sub == 4) {
0561           cHF->Modified();
0562           cHF->Update();
0563         }
0564       }  //end depth
0565       if (test == 2) {
0566         if (sub == 1) {
0567           cHB->Print("MapRateAmplHB.png");
0568           cHB->Clear();
0569         }
0570         if (sub == 2) {
0571           cHE->Print("MapRateAmplHE.png");
0572           cHE->Clear();
0573         }
0574         if (sub == 3) {
0575           cONE->Print("MapRateAmplHO.png");
0576           cONE->Clear();
0577         }
0578         if (sub == 4) {
0579           cHF->Print("MapRateAmplHF.png");
0580           cHF->Clear();
0581         }
0582       }
0583       if (test == 3) {
0584         if (sub == 1) {
0585           cHB->Print("MapRateRMSHB.png");
0586           cHB->Clear();
0587         }
0588         if (sub == 2) {
0589           cHE->Print("MapRateRMSHE.png");
0590           cHE->Clear();
0591         }
0592         if (sub == 3) {
0593           cONE->Print("MapRateRMSHO.png");
0594           cONE->Clear();
0595         }
0596         if (sub == 4) {
0597           cHF->Print("MapRateRMSHF.png");
0598           cHF->Clear();
0599         }
0600       }
0601       if (test == 4) {
0602         if (sub == 1) {
0603           cHB->Print("MapRate43TStoAllTSHB.png");
0604           cHB->Clear();
0605         }
0606         if (sub == 2) {
0607           cHE->Print("MapRate43TStoAllTSHE.png");
0608           cHE->Clear();
0609         }
0610         if (sub == 3) {
0611           cONE->Print("MapRate43TStoAllTSHO.png");
0612           cONE->Clear();
0613         }
0614         if (sub == 4) {
0615           cHF->Print("MapRate43TStoAllTSHF.png");
0616           cHF->Clear();
0617         }
0618       }
0619       if (test == 5) {
0620         if (sub == 1) {
0621           cHB->Print("MapRateMeanPosHB.png");
0622           cHB->Clear();
0623         }
0624         if (sub == 2) {
0625           cHE->Print("MapRateMeanPosHE.png");
0626           cHE->Clear();
0627         }
0628         if (sub == 3) {
0629           cONE->Print("MapRateMeanPosHO.png");
0630           cONE->Clear();
0631         }
0632         if (sub == 4) {
0633           cHF->Print("MapRateMeanPosHF.png");
0634           cHF->Clear();
0635         }
0636       }
0637       if (test == 6) {
0638         if (sub == 1) {
0639           cHB->Print("MapRateMaxPosHB.png");
0640           cHB->Clear();
0641         }
0642         if (sub == 2) {
0643           cHE->Print("MapRateMaxPosHE.png");
0644           cHE->Clear();
0645         }
0646         if (sub == 3) {
0647           cONE->Print("MapRateMaxPosHO.png");
0648           cONE->Clear();
0649         }
0650         if (sub == 4) {
0651           cHF->Print("MapRateMaxPosHF.png");
0652           cHF->Clear();
0653         }
0654       }
0655 
0656       //          cONE->Divide(1,1);
0657       /*
0658           cONE->Divide(2,1);
0659       if(test == 2 && sub == 2 ) {
0660         cONE->cd(2);
0661         TH1F *kjkjkhj2= (TH1F*)hfile->Get("h_ADCAmpl_HE");kjkjkhj2->Draw("");kjkjkhj2->SetTitle("HE, All Depth: shunt6");
0662       }
0663       if(test == 2 && sub == 1 ) {
0664         cONE->cd(2);
0665         TH1F *kjkjkhj1= (TH1F*)hfile->Get("h_ADCAmpl_HB");kjkjkhj1->Draw("");kjkjkhj1->SetTitle("HB, All Depth: shunt6");
0666       }
0667 */
0668 
0669       cONE->Divide(3, 1);
0670       if (test == 2 && sub == 2) {
0671         cONE->cd(2);
0672         TH1F *kjkjkhj2 = (TH1F *)hfile->Get("h_AmplitudeHEtest1");
0673         kjkjkhj2->Draw("");
0674         kjkjkhj2->SetTitle("HE, All Depth: shunt1");
0675         cONE->cd(3);
0676         TH1F *kjkjkhj3 = (TH1F *)hfile->Get("h_AmplitudeHEtest6");
0677         kjkjkhj3->Draw("");
0678         kjkjkhj3->SetTitle("HE, All Depth: shunt6");
0679       }
0680       if (test == 2 && sub == 1) {
0681         cONE->cd(2);
0682         TH1F *kjkjkhb2 = (TH1F *)hfile->Get("h_AmplitudeHBtest1");
0683         kjkjkhb2->Draw("");
0684         kjkjkhb2->SetTitle("HB, All Depth: shunt1");
0685         cONE->cd(3);
0686         TH1F *kjkjkhb3 = (TH1F *)hfile->Get("h_AmplitudeHBtest6");
0687         kjkjkhb3->Draw("");
0688         kjkjkhb3->SetTitle("HB, All Depth: shunt6");
0689       }
0690 
0691       cONE->cd(1);
0692       gPad->SetGridy();
0693       gPad->SetGridx();
0694       gPad->SetLogy();
0695       if (sub == 1)
0696         HistAmpl[test][sub]->SetTitle("HB, All Depth: shunt6");
0697       if (sub == 2)
0698         HistAmpl[test][sub]->SetTitle("HE, All Depth: shunt6");
0699       if (sub == 3)
0700         HistAmpl[test][sub]->SetTitle("HO, All Depth");
0701       if (sub == 4)
0702         HistAmpl[test][sub]->SetTitle("HF, All Depth");
0703       if (test == 2)
0704         HistAmpl[test][sub]->SetXTitle("ADC Amlitude in each event & cell \b");
0705       if (test == 3)
0706         HistAmpl[test][sub]->SetXTitle("RMS in each event & cell \b");
0707       if (test == 4)
0708         HistAmpl[test][sub]->SetXTitle("Ratio in each event & cell \b");
0709       if (test == 5)
0710         HistAmpl[test][sub]->SetXTitle("Mean TS position in each event & cell \b");
0711       if (test == 6)
0712         HistAmpl[test][sub]->SetXTitle("Max TS position in each event & cell \b");
0713       HistAmpl[test][sub]->SetYTitle("Number of cell-events \b");
0714       HistAmpl[test][sub]->SetLineColor(4);
0715       HistAmpl[test][sub]->SetLineWidth(2);
0716       HistAmpl[test][sub]->SetTitleOffset(1.4, "Y");
0717       HistAmpl[test][sub]->Draw("");
0718       // //        HistAmpl[test][sub]->GetYaxis()->SetRangeUser(1., 100.);
0719       //          if (test==2) {gPad->SetLogx(); HistAmpl[test][sub]->GetXaxis()->SetRangeUser(1., 10000.);}
0720       if (test == 2) {
0721         gPad->SetLogx();
0722       }
0723       if (test == 3)
0724         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 5.);  // width
0725       if (test == 4)
0726         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 1.);  // R
0727       if (test == 5)
0728         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);  // Tn
0729       if (test == 6)
0730         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);  // Tx
0731       cONE->Modified();
0732       cONE->Update();
0733       double min_x[] = {MIN_M[test][sub], MIN_M[test][sub]};
0734       double min_y[] = {0., 100000000.};
0735       TGraph *MIN = new TGraph(2, min_x, min_y);
0736       MIN->SetLineStyle(2);
0737       MIN->SetLineColor(2);
0738       MIN->SetLineWidth(2 + 100 * 100);
0739       MIN->SetFillStyle(3005);
0740       MIN->SetFillColor(2);
0741       MIN->Draw("L");
0742       double max_x[] = {MAX_M[test][sub], MAX_M[test][sub]};
0743       double max_y[] = {0., 100000000.};
0744       TGraph *MAX = new TGraph(2, max_x, max_y);
0745       MAX->SetLineStyle(2);
0746       MAX->SetLineColor(2);
0747       MAX->SetLineWidth(-2 - 100 * 100);
0748       MAX->SetFillStyle(3004);
0749       MAX->SetFillColor(2);
0750       MAX->Draw("L");
0751       if (test == 2) {
0752         if (sub == 1) {
0753           cONE->Print("HistAmplHB.png");
0754           cONE->Clear();
0755         }
0756         if (sub == 2) {
0757           cONE->Print("HistAmplHE.png");
0758           cONE->Clear();
0759         }
0760         if (sub == 3) {
0761           cONE->Print("HistAmplHO.png");
0762           cONE->Clear();
0763         }
0764         if (sub == 4) {
0765           cONE->Print("HistAmplHF.png");
0766           cONE->Clear();
0767         }
0768       }
0769       if (test == 3) {
0770         if (sub == 1) {
0771           cONE->Print("HistRMSHB.png");
0772           cONE->Clear();
0773         }
0774         if (sub == 2) {
0775           cONE->Print("HistRMSHE.png");
0776           cONE->Clear();
0777         }
0778         if (sub == 3) {
0779           cONE->Print("HistRMSHO.png");
0780           cONE->Clear();
0781         }
0782         if (sub == 4) {
0783           cONE->Print("HistRMSHF.png");
0784           cONE->Clear();
0785         }
0786       }
0787       if (test == 4) {
0788         if (sub == 1) {
0789           cONE->Print("Hist43TStoAllTSHB.png");
0790           cONE->Clear();
0791         }
0792         if (sub == 2) {
0793           cONE->Print("Hist43TStoAllTSHE.png");
0794           cONE->Clear();
0795         }
0796         if (sub == 3) {
0797           cONE->Print("Hist43TStoAllTSHO.png");
0798           cONE->Clear();
0799         }
0800         if (sub == 4) {
0801           cONE->Print("Hist43TStoAllTSHF.png");
0802           cONE->Clear();
0803         }
0804       }
0805       if (test == 5) {
0806         if (sub == 1) {
0807           cONE->Print("HistMeanPosHB.png");
0808           cONE->Clear();
0809         }
0810         if (sub == 2) {
0811           cONE->Print("HistMeanPosHE.png");
0812           cONE->Clear();
0813         }
0814         if (sub == 3) {
0815           cONE->Print("HistMeanPosHO.png");
0816           cONE->Clear();
0817         }
0818         if (sub == 4) {
0819           cONE->Print("HistMeanPosHF.png");
0820           cONE->Clear();
0821         }
0822       }
0823       if (test == 6) {
0824         if (sub == 1) {
0825           cONE->Print("HistMaxPosHB.png");
0826           cONE->Clear();
0827         }
0828         if (sub == 2) {
0829           cONE->Print("HistMaxPosHE.png");
0830           cONE->Clear();
0831         }
0832         if (sub == 3) {
0833           cONE->Print("HistMaxPosHO.png");
0834           cONE->Clear();
0835         }
0836         if (sub == 4) {
0837           cONE->Print("HistMaxPosHF.png");
0838           cONE->Clear();
0839         }
0840       }
0841     }  // end sub
0842   }    //end test
0843 
0844   TH2F *Map_Calib[5][5];  // 2d histogramm for subdet, depth
0845 
0846   Map_Calib[1][1] = (TH2F *)hfile->Get("h_map_HB");
0847   Map_Calib[1][2] = (TH2F *)hfile->Get("h_map_HB");
0848   Map_Calib[2][1] = (TH2F *)hfile->Get("h_map_HE");
0849   Map_Calib[2][2] = (TH2F *)hfile->Get("h_map_HE");
0850   Map_Calib[2][3] = (TH2F *)hfile->Get("h_map_HE");
0851   Map_Calib[3][4] = (TH2F *)hfile->Get("h_map_HO");
0852   Map_Calib[4][1] = (TH2F *)hfile->Get("h_map_HF");
0853   Map_Calib[4][2] = (TH2F *)hfile->Get("h_map_HF");
0854 
0855   //+++++++++++++++++++++++++++++
0856   //Test 0 Entries
0857   //+++++++++++++++++++++++++++++
0858 
0859   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0860                                         //       if (sub==1) cHB->Divide(2,1);
0861                                         //       if (sub==2) cHE->Divide(3,1);
0862     cONE->Divide(1, 1);
0863     //      if (sub==4) cHB->Divide(2,1);
0864     //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0865     //       int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0866     //       for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depth
0867     int k = 1;
0868     cONE->cd(k);
0869     //          if (sub==1) cHB->cd(k);
0870     //          if (sub==2) cHE->cd(k);
0871     if (sub == 3)
0872       k = 4;
0873     //      if (sub==4) cHB->cd(k);
0874     gPad->SetGridy();
0875     gPad->SetGridx();
0876     gPad->SetLogz();
0877     if (sub == 1)
0878       sprintf(str, "HB");
0879     if (sub == 2)
0880       sprintf(str, "HE");
0881     if (sub == 3)
0882       sprintf(str, "HO");
0883     if (sub == 4)
0884       sprintf(str, "HF");
0885     Map_Calib[sub][k]->SetTitle(str);
0886     Map_Calib[sub][k]->SetXTitle("#eta \b");
0887     Map_Calib[sub][k]->SetYTitle("#phi \b");
0888     Map_Calib[sub][k]->SetZTitle("Number of events\b");
0889     if (sub == 3)
0890       Map_Calib[sub][k]->SetTitleOffset(0.8, "Z");
0891     Map_Calib[sub][k]->Draw("COLZ");
0892     Map_Calib[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0893     //            Map_Calib[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0894     //            if (sub==1) {cHB->Modified(); cHB->Update();}
0895     //            if (sub==2) {cHE->Modified(); cHE->Update();}
0896     cONE->Modified();
0897     cONE->Update();
0898     //            if (sub==4) {cHB->Modified(); cHB->Update();}
0899     //       }//end depth
0900 
0901     if (sub == 1) {
0902       cONE->Print("MapRateCalibEntryHB.png");
0903       cONE->Clear();
0904     }
0905     if (sub == 2) {
0906       cONE->Print("MapRateCalibEntryHE.png");
0907       cONE->Clear();
0908     }
0909     if (sub == 3) {
0910       cONE->Print("MapRateCalibEntryHO.png");
0911       cONE->Clear();
0912     }
0913     if (sub == 4) {
0914       cONE->Print("MapRateCalibEntryHF.png");
0915       cONE->Clear();
0916     }
0917   }  // end sub
0918 
0919   //+++++++++++++++++++++++++++++
0920   //Test 11 (Cc) Rate of Cap ID errors for calibration channels
0921   //+++++++++++++++++++++++++++++
0922 
0923   Map_Ampl[11][1][1] = (TH2F *)hfile->Get("h_mapCapCalib047_HB");
0924   Map_Ampl[11][1][2] = (TH2F *)hfile->Get("h_mapCapCalib047_HB");
0925   Map_Ampl[11][2][1] = (TH2F *)hfile->Get("h_mapCapCalib047_HE");
0926   Map_Ampl[11][2][2] = (TH2F *)hfile->Get("h_mapCapCalib047_HE");
0927   Map_Ampl[11][2][3] = (TH2F *)hfile->Get("h_mapCapCalib047_HE");
0928   Map_Ampl[11][3][4] = (TH2F *)hfile->Get("h_mapCapCalib047_HO");
0929   Map_Ampl[11][4][1] = (TH2F *)hfile->Get("h_mapCapCalib047_HF");
0930   Map_Ampl[11][4][2] = (TH2F *)hfile->Get("h_mapCapCalib047_HF");
0931 
0932   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0933                                         //       if (sub==1) cHB->Divide(2,1);
0934                                         //       if (sub==2) cHE->Divide(3,1);
0935     cONE->Divide(1, 1);
0936     //      if (sub==4) cHB->Divide(2,1);
0937     //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0938     //       int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0939     //       for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depth
0940     int k = 1;
0941     cONE->cd(k);
0942     //          if (sub==1) cHB->cd(k);
0943     //          if (sub==2) cHE->cd(k);
0944     if (sub == 3)
0945       k = 4;
0946     //      if (sub==4) cHB->cd(k);
0947     Map_Ampl[11][sub][k]->Divide(Map_Ampl[11][sub][k], Map_Calib[sub][k], 1, 1, "B");
0948     gPad->SetGridy();
0949     gPad->SetGridx();
0950     gPad->SetLogz();
0951     if (sub == 1)
0952       sprintf(str, "HB");
0953     if (sub == 2)
0954       sprintf(str, "HE");
0955     if (sub == 3)
0956       sprintf(str, "HO");
0957     if (sub == 4)
0958       sprintf(str, "HF");
0959     Map_Ampl[11][sub][k]->SetTitle(str);
0960     Map_Ampl[11][sub][k]->SetXTitle("#eta \b");
0961     Map_Ampl[11][sub][k]->SetYTitle("#phi \b");
0962     Map_Ampl[11][sub][k]->SetZTitle("Rate \b");
0963     Map_Ampl[11][sub][k]->SetTitleOffset(0.75, "Z");
0964     Map_Ampl[11][sub][k]->Draw("COLZ");
0965     Map_Ampl[11][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0966     Map_Ampl[11][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0967     //            if (sub==1) {cHB->Modified(); cHB->Update();}
0968     //            if (sub==2) {cHE->Modified(); cHE->Update();}
0969     cONE->Modified();
0970     cONE->Update();
0971     //            if (sub==4) {cHB->Modified(); cHB->Update();}
0972     //       }//end depth
0973 
0974     if (sub == 1) {
0975       cONE->Print("MapRateCapCalibHB.png");
0976       cONE->Clear();
0977     }
0978     if (sub == 2) {
0979       cONE->Print("MapRateCapCalibHE.png");
0980       cONE->Clear();
0981     }
0982     if (sub == 3) {
0983       cONE->Print("MapRateCapCalibHO.png");
0984       cONE->Clear();
0985     }
0986     if (sub == 4) {
0987       cONE->Print("MapRateCapCalibHF.png");
0988       cONE->Clear();
0989     }
0990   }  // end sub
0991 
0992   //+++++++++++++++++++++++++++++
0993   //Test 12 (Ac) ADC amplitude for calibration chanels
0994   //+++++++++++++++++++++++++++++
0995 
0996   Map_Ampl[12][1][1] = (TH2F *)hfile->Get("h_mapADCCalib047_HB");
0997   Map_Ampl[12][1][2] = (TH2F *)hfile->Get("h_mapADCCalib047_HB");
0998   Map_Ampl[12][2][1] = (TH2F *)hfile->Get("h_mapADCCalib047_HE");
0999   Map_Ampl[12][2][2] = (TH2F *)hfile->Get("h_mapADCCalib047_HE");
1000   Map_Ampl[12][2][3] = (TH2F *)hfile->Get("h_mapADCCalib047_HE");
1001   Map_Ampl[12][3][4] = (TH2F *)hfile->Get("h_mapADCCalib047_HO");
1002   Map_Ampl[12][4][1] = (TH2F *)hfile->Get("h_mapADCCalib047_HF");
1003   Map_Ampl[12][4][2] = (TH2F *)hfile->Get("h_mapADCCalib047_HF");
1004 
1005   HistAmpl[12][1] = (TH1F *)hfile->Get("h_ADCCalib_HB");
1006   HistAmpl[12][2] = (TH1F *)hfile->Get("h_ADCCalib_HE");
1007   HistAmpl[12][3] = (TH1F *)hfile->Get("h_ADCCalib_HO");
1008   HistAmpl[12][4] = (TH1F *)hfile->Get("h_ADCCalib_HF");
1009 
1010   //+++++++++++++++++++++++++++++
1011   //Test 13 (Wc) Rate of RMS
1012   //+++++++++++++++++++++++++++++
1013 
1014   Map_Ampl[13][1][1] = (TH2F *)hfile->Get("h_mapWidthCalib047_HB");
1015   Map_Ampl[13][1][2] = (TH2F *)hfile->Get("h_mapWidthCalib047_HB");
1016   Map_Ampl[13][2][1] = (TH2F *)hfile->Get("h_mapWidthCalib047_HE");
1017   Map_Ampl[13][2][2] = (TH2F *)hfile->Get("h_mapWidthCalib047_HE");
1018   Map_Ampl[13][2][3] = (TH2F *)hfile->Get("h_mapWidthCalib047_HE");
1019   Map_Ampl[13][3][4] = (TH2F *)hfile->Get("h_mapWidthCalib047_HO");
1020   Map_Ampl[13][4][1] = (TH2F *)hfile->Get("h_mapWidthCalib047_HF");
1021   Map_Ampl[13][4][2] = (TH2F *)hfile->Get("h_mapWidthCalib047_HF");
1022 
1023   HistAmpl[13][1] = (TH1F *)hfile->Get("h_WidthCalib_HB");
1024   HistAmpl[13][2] = (TH1F *)hfile->Get("h_WidthCalib_HE");
1025   HistAmpl[13][3] = (TH1F *)hfile->Get("h_WidthCalib_HO");
1026   HistAmpl[13][4] = (TH1F *)hfile->Get("h_WidthCalib_HF");
1027 
1028   //+++++++++++++++++++++++++++++
1029   //Test 14 (Rc) Rate of ratio 4 near max TS/ All TS
1030   //+++++++++++++++++++++++++++++
1031 
1032   Map_Ampl[14][1][1] = (TH2F *)hfile->Get("h_mapRatioCalib047_HB");
1033   Map_Ampl[14][1][2] = (TH2F *)hfile->Get("h_mapRatioCalib047_HB");
1034   Map_Ampl[14][2][1] = (TH2F *)hfile->Get("h_mapRatioCalib047_HE");
1035   Map_Ampl[14][2][2] = (TH2F *)hfile->Get("h_mapRatioCalib047_HE");
1036   Map_Ampl[14][2][3] = (TH2F *)hfile->Get("h_mapRatioCalib047_HE");
1037   Map_Ampl[14][3][4] = (TH2F *)hfile->Get("h_mapRatioCalib047_HO");
1038   Map_Ampl[14][4][1] = (TH2F *)hfile->Get("h_mapRatioCalib047_HF");
1039   Map_Ampl[14][4][2] = (TH2F *)hfile->Get("h_mapRatioCalib047_HF");
1040 
1041   HistAmpl[14][1] = (TH1F *)hfile->Get("h_RatioCalib_HB");
1042   HistAmpl[14][2] = (TH1F *)hfile->Get("h_RatioCalib_HE");
1043   HistAmpl[14][3] = (TH1F *)hfile->Get("h_RatioCalib_HO");
1044   HistAmpl[14][4] = (TH1F *)hfile->Get("h_RatioCalib_HF");
1045 
1046   //+++++++++++++++++++++++++++++
1047   //Test 15 (TNc) Mean position in 1-8 TS range
1048   //+++++++++++++++++++++++++++++
1049 
1050   Map_Ampl[15][1][1] = (TH2F *)hfile->Get("h_mapTSmeanCalib047_HB");
1051   Map_Ampl[15][1][2] = (TH2F *)hfile->Get("h_mapTSmeanCalib047_HB");
1052   Map_Ampl[15][2][1] = (TH2F *)hfile->Get("h_mapTSmeanCalib047_HE");
1053   Map_Ampl[15][2][2] = (TH2F *)hfile->Get("h_mapTSmeanCalib047_HE");
1054   Map_Ampl[15][2][3] = (TH2F *)hfile->Get("h_mapTSmeanCalib047_HE");
1055   Map_Ampl[15][3][4] = (TH2F *)hfile->Get("h_mapTSmeanCalib047_HO");
1056   Map_Ampl[15][4][1] = (TH2F *)hfile->Get("h_mapTSmeanCalib047_HF");
1057   Map_Ampl[15][4][2] = (TH2F *)hfile->Get("h_mapTSmeanCalib047_HF");
1058 
1059   HistAmpl[15][1] = (TH1F *)hfile->Get("h_TSmeanCalib_HB");
1060   HistAmpl[15][2] = (TH1F *)hfile->Get("h_TSmeanCalib_HE");
1061   HistAmpl[15][3] = (TH1F *)hfile->Get("h_TSmeanCalib_HO");
1062   HistAmpl[15][4] = (TH1F *)hfile->Get("h_TSmeanCalib_HF");
1063 
1064   //+++++++++++++++++++++++++++++
1065   //Test 16 (TXc) Maximum position in 1-8 TS range
1066   //+++++++++++++++++++++++++++++
1067 
1068   Map_Ampl[16][1][1] = (TH2F *)hfile->Get("h_mapTSmaxCalib047_HB");
1069   Map_Ampl[16][1][2] = (TH2F *)hfile->Get("h_mapTSmaxCalib047_HB");
1070   Map_Ampl[16][2][1] = (TH2F *)hfile->Get("h_mapTSmaxCalib047_HE");
1071   Map_Ampl[16][2][2] = (TH2F *)hfile->Get("h_mapTSmaxCalib047_HE");
1072   Map_Ampl[16][2][3] = (TH2F *)hfile->Get("h_mapTSmaxCalib047_HE");
1073   Map_Ampl[16][3][4] = (TH2F *)hfile->Get("h_mapTSmaxCalib047_HO");
1074   Map_Ampl[16][4][1] = (TH2F *)hfile->Get("h_mapTSmaxCalib047_HF");
1075   Map_Ampl[16][4][2] = (TH2F *)hfile->Get("h_mapTSmaxCalib047_HF");
1076 
1077   HistAmpl[16][1] = (TH1F *)hfile->Get("h_TSmaxCalib_HB");
1078   HistAmpl[16][2] = (TH1F *)hfile->Get("h_TSmaxCalib_HE");
1079   HistAmpl[16][3] = (TH1F *)hfile->Get("h_TSmaxCalib_HO");
1080   HistAmpl[16][4] = (TH1F *)hfile->Get("h_TSmaxCalib_HF");
1081 
1082   for (int test = 12; test <= 16; test++) {  //Test: 2-Am, 3-Wm, 4-Rm, 5-TNm, 6-TXm,
1083     for (int sub = 1; sub <= 4; sub++) {     //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1084       if (sub == 1)
1085         cONE->Divide(1, 1);  //cHB->Divide(2,1);
1086       if (sub == 2)
1087         cONE->Divide(1, 1);  //cHE->Divide(3,1);
1088       if (sub == 3)
1089         cONE->Divide(1, 1);
1090       if (sub == 4)
1091         cONE->Divide(1, 1);  //cHB->Divide(2,1);
1092                              //          int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1093                              //          int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1094                              //          for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depth
1095       int k = 1;
1096       if (sub == 1) {
1097         k = 1;
1098         cONE->cd(k);
1099       }  //cHB->cd(k); }
1100       if (sub == 2) {
1101         k = 1;
1102         cONE->cd(k);
1103       }  //cHE->cd(k); }
1104       if (sub == 3) {
1105         k = 4;
1106         cONE->cd(k - 3);
1107       }
1108       if (sub == 4) {
1109         k = 1;
1110         cONE->cd(k);
1111       }  //cHB->cd(k); }
1112       Map_Ampl[test][sub][k]->Divide(Map_Ampl[test][sub][k], Map_Calib[sub][k], 1, 1, "B");
1113       gPad->SetGridy();
1114       gPad->SetGridx();
1115       gPad->SetLogz();
1116       if (sub == 1)
1117         sprintf(str, "HB");
1118       if (sub == 2)
1119         sprintf(str, "HE");
1120       if (sub == 3)
1121         sprintf(str, "HO");
1122       if (sub == 4)
1123         sprintf(str, "HF");
1124       Map_Ampl[test][sub][k]->SetTitle(str);
1125       Map_Ampl[test][sub][k]->SetXTitle("#eta \b");
1126       Map_Ampl[test][sub][k]->SetYTitle("#phi \b");
1127       Map_Ampl[test][sub][k]->SetZTitle("Rate \b");
1128       Map_Ampl[test][sub][k]->SetTitleOffset(0.8, "Z");
1129       Map_Ampl[test][sub][k]->Draw("COLZ");
1130       Map_Ampl[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1131       Map_Ampl[test][sub][k]->GetZaxis()->SetRangeUser(0.00001, 1.);
1132       //              if (sub==1) {cHB->Modified(); cHB->Update();}
1133       //              if (sub==2) {cHE->Modified(); cHE->Update();}
1134       cONE->Modified();
1135       cONE->Update();
1136       //              if (sub==4) {cHB->Modified(); cHB->Update();}
1137       //          }//end depth
1138       if (test == 12) {
1139         if (sub == 1) {
1140           cONE->Print("MapRateAmplCalibHB.png");
1141           cONE->Clear();
1142         }
1143         if (sub == 2) {
1144           cONE->Print("MapRateAmplCalibHE.png");
1145           cONE->Clear();
1146         }
1147         if (sub == 3) {
1148           cONE->Print("MapRateAmplCalibHO.png");
1149           cONE->Clear();
1150         }
1151         if (sub == 4) {
1152           cONE->Print("MapRateAmplCalibHF.png");
1153           cONE->Clear();
1154         }
1155       }
1156       if (test == 13) {
1157         if (sub == 1) {
1158           cONE->Print("MapRateRMSCalibHB.png");
1159           cONE->Clear();
1160         }
1161         if (sub == 2) {
1162           cONE->Print("MapRateRMSCalibHE.png");
1163           cONE->Clear();
1164         }
1165         if (sub == 3) {
1166           cONE->Print("MapRateRMSCalibHO.png");
1167           cONE->Clear();
1168         }
1169         if (sub == 4) {
1170           cONE->Print("MapRateRMSCalibHF.png");
1171           cONE->Clear();
1172         }
1173       }
1174       if (test == 14) {
1175         if (sub == 1) {
1176           cONE->Print("MapRate43TStoAllTSCalibHB.png");
1177           cONE->Clear();
1178         }
1179         if (sub == 2) {
1180           cONE->Print("MapRate43TStoAllTSCalibHE.png");
1181           cONE->Clear();
1182         }
1183         if (sub == 3) {
1184           cONE->Print("MapRate43TStoAllTSCalibHO.png");
1185           cONE->Clear();
1186         }
1187         if (sub == 4) {
1188           cONE->Print("MapRate43TStoAllTSCalibHF.png");
1189           cONE->Clear();
1190         }
1191       }
1192       if (test == 15) {
1193         if (sub == 1) {
1194           cONE->Print("MapRateMeanPosCalibHB.png");
1195           cONE->Clear();
1196         }
1197         if (sub == 2) {
1198           cONE->Print("MapRateMeanPosCalibHE.png");
1199           cONE->Clear();
1200         }
1201         if (sub == 3) {
1202           cONE->Print("MapRateMeanPosCalibHO.png");
1203           cONE->Clear();
1204         }
1205         if (sub == 4) {
1206           cONE->Print("MapRateMeanPosCalibHF.png");
1207           cONE->Clear();
1208         }
1209       }
1210       if (test == 16) {
1211         if (sub == 1) {
1212           cONE->Print("MapRateMaxPosCalibHB.png");
1213           cONE->Clear();
1214         }
1215         if (sub == 2) {
1216           cONE->Print("MapRateMaxPosCalibHE.png");
1217           cONE->Clear();
1218         }
1219         if (sub == 3) {
1220           cONE->Print("MapRateMaxPosCalibHO.png");
1221           cONE->Clear();
1222         }
1223         if (sub == 4) {
1224           cONE->Print("MapRateMaxPosCalibHF.png");
1225           cONE->Clear();
1226         }
1227       }
1228 
1229       cONE->Divide(1, 1);
1230       cONE->cd(1);
1231       gPad->SetGridy();
1232       gPad->SetGridx();
1233       gPad->SetLogy();
1234       if (sub == 1)
1235         HistAmpl[test][sub]->SetTitle("HB, All Depth");
1236       if (sub == 2)
1237         HistAmpl[test][sub]->SetTitle("HE, All Depth");
1238       if (sub == 3)
1239         HistAmpl[test][sub]->SetTitle("HO, All Depth");
1240       if (sub == 4)
1241         HistAmpl[test][sub]->SetTitle("HF, All Depth");
1242       if (test == 12)
1243         HistAmpl[test][sub]->SetXTitle("ADC Amlitude in each event & cell \b");
1244       if (test == 13)
1245         HistAmpl[test][sub]->SetXTitle("Amplitude RMS in each event & cell \b");
1246       if (test == 14)
1247         HistAmpl[test][sub]->SetXTitle("Ratio in each event & cell \b");
1248       if (test == 15)
1249         HistAmpl[test][sub]->SetXTitle("Mean TS position in each event & cell \b");
1250       if (test == 16)
1251         HistAmpl[test][sub]->SetXTitle("Max TS position in each event & cell \b");
1252       HistAmpl[test][sub]->SetYTitle("Number of cell-events \b");
1253       HistAmpl[test][sub]->SetLineColor(4);
1254       HistAmpl[test][sub]->SetLineWidth(2);
1255       HistAmpl[test][sub]->SetTitleOffset(1.4, "Y");
1256       HistAmpl[test][sub]->Draw("");
1257       //        HistAmpl[test][sub]->GetYaxis()->SetRangeUser(1., 100.);
1258       if (test == 12) {
1259         gPad->SetLogx();
1260         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(1., 10000.);
1261       }
1262       if (test == 13)
1263         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 5.);
1264       if (test == 14)
1265         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 1.);
1266       if (test == 15)
1267         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);
1268       if (test == 16)
1269         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);
1270       cONE->Modified();
1271       cONE->Update();
1272       double min_x[] = {MIN_C[test - 10][sub], MIN_C[test - 10][sub]};
1273       double min_y[] = {0., 100000000.};
1274       TGraph *MIN = new TGraph(2, min_x, min_y);
1275       MIN->SetLineStyle(2);
1276       MIN->SetLineColor(2);
1277       MIN->SetLineWidth(2 + 100 * 100);
1278       MIN->SetFillStyle(3005);
1279       MIN->SetFillColor(2);
1280       MIN->Draw("L");
1281       double max_x[] = {MAX_C[test - 10][sub], MAX_C[test - 10][sub]};
1282       double max_y[] = {0., 100000000.};
1283       TGraph *MAX = new TGraph(2, max_x, max_y);
1284       MAX->SetLineStyle(2);
1285       MAX->SetLineColor(2);
1286       MAX->SetLineWidth(-2 - 100 * 100);
1287       MAX->SetFillStyle(3004);
1288       MAX->SetFillColor(2);
1289       MAX->Draw("L");
1290       if (test == 12) {
1291         if (sub == 1) {
1292           cONE->Print("HistAmplCalibHB.png");
1293           cONE->Clear();
1294         }
1295         if (sub == 2) {
1296           cONE->Print("HistAmplCalibHE.png");
1297           cONE->Clear();
1298         }
1299         if (sub == 3) {
1300           cONE->Print("HistAmplCalibHO.png");
1301           cONE->Clear();
1302         }
1303         if (sub == 4) {
1304           cONE->Print("HistAmplCalibHF.png");
1305           cONE->Clear();
1306         }
1307       }
1308       if (test == 13) {
1309         if (sub == 1) {
1310           cONE->Print("HistRMSCalibHB.png");
1311           cONE->Clear();
1312         }
1313         if (sub == 2) {
1314           cONE->Print("HistRMSCalibHE.png");
1315           cONE->Clear();
1316         }
1317         if (sub == 3) {
1318           cONE->Print("HistRMSCalibHO.png");
1319           cONE->Clear();
1320         }
1321         if (sub == 4) {
1322           cONE->Print("HistRMSCalibHF.png");
1323           cONE->Clear();
1324         }
1325       }
1326       if (test == 14) {
1327         if (sub == 1) {
1328           cONE->Print("Hist43TStoAllTSCalibHB.png");
1329           cONE->Clear();
1330         }
1331         if (sub == 2) {
1332           cONE->Print("Hist43TStoAllTSCalibHE.png");
1333           cONE->Clear();
1334         }
1335         if (sub == 3) {
1336           cONE->Print("Hist43TStoAllTSCalibHO.png");
1337           cONE->Clear();
1338         }
1339         if (sub == 4) {
1340           cONE->Print("Hist43TStoAllTSCalibHF.png");
1341           cONE->Clear();
1342         }
1343       }
1344       if (test == 15) {
1345         if (sub == 1) {
1346           cONE->Print("HistMeanPosCalibHB.png");
1347           cONE->Clear();
1348         }
1349         if (sub == 2) {
1350           cONE->Print("HistMeanPosCalibHE.png");
1351           cONE->Clear();
1352         }
1353         if (sub == 3) {
1354           cONE->Print("HistMeanPosCalibHO.png");
1355           cONE->Clear();
1356         }
1357         if (sub == 4) {
1358           cONE->Print("HistMeanPosCalibHF.png");
1359           cONE->Clear();
1360         }
1361       }
1362       if (test == 16) {
1363         if (sub == 1) {
1364           cONE->Print("HistMaxPosCalibHB.png");
1365           cONE->Clear();
1366         }
1367         if (sub == 2) {
1368           cONE->Print("HistMaxPosCalibHE.png");
1369           cONE->Clear();
1370         }
1371         if (sub == 3) {
1372           cONE->Print("HistMaxPosCalibHO.png");
1373           cONE->Clear();
1374         }
1375         if (sub == 4) {
1376           cONE->Print("HistMaxPosCalibHF.png");
1377           cONE->Clear();
1378         }
1379       }
1380     }  // end sub
1381   }    //end test
1382 
1383   //+++++++++++++++++++++++++++++
1384   //Test 21 (GS) Amplitude drift
1385   //+++++++++++++++++++++++++++++
1386 
1387   Map_Ampl[21][1][1] = (TH2F *)hfile->Get("h_mapDepth1AmplE34_HB");
1388   Map_Ampl[21][1][2] = (TH2F *)hfile->Get("h_mapDepth2AmplE34_HB");
1389   Map_Ampl[21][1][3] = (TH2F *)hfile->Get("h_mapDepth3AmplE34_HB");
1390   Map_Ampl[21][1][4] = (TH2F *)hfile->Get("h_mapDepth4AmplE34_HB");
1391   Map_Ampl[21][2][1] = (TH2F *)hfile->Get("h_mapDepth1AmplE34_HE");
1392   Map_Ampl[21][2][2] = (TH2F *)hfile->Get("h_mapDepth2AmplE34_HE");
1393   Map_Ampl[21][2][3] = (TH2F *)hfile->Get("h_mapDepth3AmplE34_HE");
1394   Map_Ampl[21][2][4] = (TH2F *)hfile->Get("h_mapDepth4AmplE34_HE");
1395   Map_Ampl[21][2][5] = (TH2F *)hfile->Get("h_mapDepth5AmplE34_HE");
1396   Map_Ampl[21][2][6] = (TH2F *)hfile->Get("h_mapDepth6AmplE34_HE");
1397   Map_Ampl[21][2][7] = (TH2F *)hfile->Get("h_mapDepth7AmplE34_HE");
1398   Map_Ampl[21][3][4] = (TH2F *)hfile->Get("h_mapDepth4AmplE34_HO");
1399   Map_Ampl[21][4][1] = (TH2F *)hfile->Get("h_mapDepth1AmplE34_HF");
1400   Map_Ampl[21][4][2] = (TH2F *)hfile->Get("h_mapDepth2AmplE34_HF");
1401   Map_Ampl[21][4][3] = (TH2F *)hfile->Get("h_mapDepth3AmplE34_HF");
1402   Map_Ampl[21][4][4] = (TH2F *)hfile->Get("h_mapDepth4AmplE34_HF");
1403 
1404   TH2F *Map_RefAmpl[5][ALLDEPTH];  // 2D histogramm for subdet, depth
1405   TH2F *Map_RefSUB[5][ALLDEPTH];   // 2d histogramm for subdet, depth
1406 
1407   Map_RefAmpl[1][1] = (TH2F *)hreffile->Get("h_mapDepth1AmplE34_HB");
1408   Map_RefAmpl[1][2] = (TH2F *)hreffile->Get("h_mapDepth2AmplE34_HB");
1409   Map_RefAmpl[1][3] = (TH2F *)hreffile->Get("h_mapDepth3AmplE34_HB");
1410   Map_RefAmpl[1][4] = (TH2F *)hreffile->Get("h_mapDepth4AmplE34_HB");
1411   Map_RefAmpl[2][1] = (TH2F *)hreffile->Get("h_mapDepth1AmplE34_HE");
1412   Map_RefAmpl[2][2] = (TH2F *)hreffile->Get("h_mapDepth2AmplE34_HE");
1413   Map_RefAmpl[2][3] = (TH2F *)hreffile->Get("h_mapDepth3AmplE34_HE");
1414   Map_RefAmpl[2][4] = (TH2F *)hreffile->Get("h_mapDepth4AmplE34_HE");
1415   Map_RefAmpl[2][5] = (TH2F *)hreffile->Get("h_mapDepth5AmplE34_HE");
1416   Map_RefAmpl[2][6] = (TH2F *)hreffile->Get("h_mapDepth6AmplE34_HE");
1417   Map_RefAmpl[2][7] = (TH2F *)hreffile->Get("h_mapDepth7AmplE34_HE");
1418   Map_RefAmpl[3][4] = (TH2F *)hreffile->Get("h_mapDepth4AmplE34_HO");
1419   Map_RefAmpl[4][1] = (TH2F *)hreffile->Get("h_mapDepth1AmplE34_HF");
1420   Map_RefAmpl[4][2] = (TH2F *)hreffile->Get("h_mapDepth2AmplE34_HF");
1421   Map_RefAmpl[4][3] = (TH2F *)hreffile->Get("h_mapDepth3AmplE34_HF");
1422   Map_RefAmpl[4][4] = (TH2F *)hreffile->Get("h_mapDepth4AmplE34_HF");
1423 
1424   Map_RefSUB[1][1] = (TH2F *)hreffile->Get("h_mapDepth1_HB");
1425   Map_RefSUB[1][2] = (TH2F *)hreffile->Get("h_mapDepth2_HB");
1426   Map_RefSUB[1][3] = (TH2F *)hreffile->Get("h_mapDepth3_HB");
1427   Map_RefSUB[1][4] = (TH2F *)hreffile->Get("h_mapDepth4_HB");
1428   Map_RefSUB[2][1] = (TH2F *)hreffile->Get("h_mapDepth1_HE");
1429   Map_RefSUB[2][2] = (TH2F *)hreffile->Get("h_mapDepth2_HE");
1430   Map_RefSUB[2][3] = (TH2F *)hreffile->Get("h_mapDepth3_HE");
1431   Map_RefSUB[2][4] = (TH2F *)hreffile->Get("h_mapDepth4_HE");
1432   Map_RefSUB[2][5] = (TH2F *)hreffile->Get("h_mapDepth5_HE");
1433   Map_RefSUB[2][6] = (TH2F *)hreffile->Get("h_mapDepth6_HE");
1434   Map_RefSUB[2][7] = (TH2F *)hreffile->Get("h_mapDepth7_HE");
1435   Map_RefSUB[3][4] = (TH2F *)hreffile->Get("h_mapDepth4_HO");
1436   Map_RefSUB[4][1] = (TH2F *)hreffile->Get("h_mapDepth1_HF");
1437   Map_RefSUB[4][2] = (TH2F *)hreffile->Get("h_mapDepth2_HF");
1438   Map_RefSUB[4][3] = (TH2F *)hreffile->Get("h_mapDepth3_HF");
1439   Map_RefSUB[4][4] = (TH2F *)hreffile->Get("h_mapDepth4_HF");
1440 
1441   HistAmplDepth[21][1][1] = new TH1F("diffAmpl_Depth1_HB", "", 100, -10., 10.);
1442   HistAmplDepth[21][1][2] = new TH1F("diffAmpl_Depth2_HB", "", 100, -10., 10.);
1443   HistAmplDepth[21][1][3] = new TH1F("diffAmpl_Depth3_HB", "", 100, -10., 10.);
1444   HistAmplDepth[21][1][4] = new TH1F("diffAmpl_Depth4_HB", "", 100, -10., 10.);
1445   HistAmplDepth[21][2][1] = new TH1F("diffAmpl_Depth1_HE", "", 100, -10., 10.);
1446   HistAmplDepth[21][2][2] = new TH1F("diffAmpl_Depth2_HE", "", 100, -10., 10.);
1447   HistAmplDepth[21][2][3] = new TH1F("diffAmpl_Depth3_HE", "", 100, -10., 10.);
1448   HistAmplDepth[21][2][4] = new TH1F("diffAmpl_Depth4_HE", "", 100, -10., 10.);
1449   HistAmplDepth[21][2][5] = new TH1F("diffAmpl_Depth5_HE", "", 100, -10., 10.);
1450   HistAmplDepth[21][2][6] = new TH1F("diffAmpl_Depth6_HE", "", 100, -10., 10.);
1451   HistAmplDepth[21][2][7] = new TH1F("diffAmpl_Depth7_HE", "", 100, -10., 10.);
1452   HistAmplDepth[21][3][4] = new TH1F("diffAmpl_Depth4_HO", "", 100, -10., 10.);
1453   HistAmplDepth[21][4][1] = new TH1F("diffAmpl_Depth1_HF", "", 100, -10., 10.);
1454   HistAmplDepth[21][4][2] = new TH1F("diffAmpl_Depth2_HF", "", 100, -10., 10.);
1455   HistAmplDepth[21][4][3] = new TH1F("diffAmpl_Depth3_HF", "", 100, -10., 10.);
1456   HistAmplDepth[21][4][4] = new TH1F("diffAmpl_Depth4_HF", "", 100, -10., 10.);
1457 
1458   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1459                                         //     if (sub==1) cHB->Divide(2,1);
1460     if (sub == 1)
1461       cHB->Divide(2, 2);
1462     //     if (sub==2) cHE->Divide(3,1);
1463     if (sub == 2)
1464       cHE->Divide(3, 3);
1465     if (sub == 3)
1466       cONE->Divide(1, 1);
1467     //     if (sub==4) cHF->Divide(2,1);
1468     if (sub == 4)
1469       cHF->Divide(2, 2);
1470     //     int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1471     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1472     //     int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
1473     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1474       if (sub == 1)
1475         cHB->cd(k);
1476       if (sub == 2)
1477         cHE->cd(k);
1478       if (sub == 3)
1479         cONE->cd(k - 3);
1480       if (sub == 4)
1481         cHF->cd(k);
1482       Map_Ampl[21][sub][k]->Divide(Map_Ampl[21][sub][k], Map_SUB[sub][k], 1, 1, "B");
1483       gPad->SetGridy();
1484       gPad->SetGridx();
1485       gPad->SetLogz();
1486       if (sub == 1)
1487         sprintf(str, "HB, Depth%d \b", k);
1488       if (sub == 2)
1489         sprintf(str, "HE, Depth%d \b", k);
1490       if (sub == 3)
1491         sprintf(str, "HO, Depth%d \b", k);
1492       if (sub == 4)
1493         sprintf(str, "HF, Depth%d \b", k);
1494       Map_Ampl[21][sub][k]->SetTitle(str);
1495       Map_Ampl[21][sub][k]->SetXTitle("#eta \b");
1496       Map_Ampl[21][sub][k]->SetYTitle("#phi \b");
1497       Map_Ampl[21][sub][k]->SetZTitle("Response \b");
1498       Map_Ampl[21][sub][k]->SetTitleOffset(1.1, "Z");
1499       Map_Ampl[21][sub][k]->Draw("COLZ");
1500       Map_Ampl[21][sub][k]->GetYaxis()->SetRangeUser(0, 71.);
1501       //            Map_Ampl[21][sub][k]->GetZaxis()->SetRangeUser(1., 10.);
1502       if (sub == 1) {
1503         cHB->Modified();
1504         cHB->Update();
1505       }
1506       if (sub == 2) {
1507         cHE->Modified();
1508         cHE->Update();
1509       }
1510       if (sub == 3) {
1511         cONE->Modified();
1512         cONE->Update();
1513       }
1514       if (sub == 4) {
1515         cHF->Modified();
1516         cHF->Update();
1517       }
1518     }  //end depth
1519     if (sub == 1) {
1520       cHB->Print("MapRateAmpl1HB.png");
1521       cHB->Clear();
1522     }
1523     if (sub == 2) {
1524       cHE->Print("MapRateAmpl1HE.png");
1525       cHE->Clear();
1526     }
1527     if (sub == 3) {
1528       cONE->Print("MapRateAmpl1HO.png");
1529       cONE->Clear();
1530     }
1531     if (sub == 4) {
1532       cHF->Print("MapRateAmpl1HF.png");
1533       cHF->Clear();
1534     }
1535 
1536     //     if (sub==1) cHB->Divide(2,1);
1537     if (sub == 1)
1538       cHB->Divide(2, 2);
1539     //     if (sub==2) cHE->Divide(3,1);
1540     if (sub == 2)
1541       cHE->Divide(3, 3);
1542     if (sub == 3)
1543       cONE->Divide(1, 1);
1544     //     if (sub==4) cHF->Divide(2,1);
1545     if (sub == 4)
1546       cHF->Divide(2, 2);
1547 
1548     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1549       if (sub == 1)
1550         cHB->cd(k);
1551       if (sub == 2)
1552         cHE->cd(k);
1553       if (sub == 3)
1554         cONE->cd(k - 3);
1555       if (sub == 4)
1556         cHF->cd(k);
1557       Map_RefAmpl[sub][k]->Divide(Map_RefAmpl[sub][k], Map_RefSUB[sub][k], 1, 1, "B");
1558       gPad->SetGridy();
1559       gPad->SetGridx();
1560       gPad->SetLogz();
1561       if (sub == 1)
1562         sprintf(str, "HB, Depth%d \b", k);
1563       if (sub == 2)
1564         sprintf(str, "HE, Depth%d \b", k);
1565       if (sub == 3)
1566         sprintf(str, "HO, Depth%d \b", k);
1567       if (sub == 4)
1568         sprintf(str, "HF, Depth%d \b", k);
1569       Map_RefAmpl[sub][k]->SetTitle(str);
1570       Map_RefAmpl[sub][k]->SetXTitle("#eta \b");
1571       Map_RefAmpl[sub][k]->SetYTitle("#phi \b");
1572       Map_RefAmpl[sub][k]->SetZTitle("Response\b");
1573       Map_RefAmpl[sub][k]->SetTitleOffset(1.1, "Z");
1574       Map_RefAmpl[sub][k]->Draw("COLZ");
1575       Map_RefAmpl[sub][k]->GetYaxis()->SetRangeUser(0, 71.);
1576       //            Map_RefAmpl[21][sub][k]->GetZaxis()->SetRangeUser(1., 10.);
1577       if (sub == 1) {
1578         cHB->Modified();
1579         cHB->Update();
1580       }
1581       if (sub == 2) {
1582         cHE->Modified();
1583         cHE->Update();
1584       }
1585       if (sub == 3) {
1586         cONE->Modified();
1587         cONE->Update();
1588       }
1589       if (sub == 4) {
1590         cHF->Modified();
1591         cHF->Update();
1592       }
1593     }  //end depth
1594     if (sub == 1) {
1595       cHB->Print("MapRateAmpl2HB.png");
1596       cHB->Clear();
1597     }
1598     if (sub == 2) {
1599       cHE->Print("MapRateAmpl2HE.png");
1600       cHE->Clear();
1601     }
1602     if (sub == 3) {
1603       cONE->Print("MapRateAmpl2HO.png");
1604       cONE->Clear();
1605     }
1606     if (sub == 4) {
1607       cHF->Print("MapRateAmpl2HF.png");
1608       cHF->Clear();
1609     }
1610 
1611     //     if (sub==1) cHB->Divide(2,1);
1612     if (sub == 1)
1613       cHB->Divide(2, 2);
1614     //     if (sub==2) cHE->Divide(3,1);
1615     if (sub == 2)
1616       cHE->Divide(3, 3);
1617     if (sub == 3)
1618       cONE->Divide(1, 1);
1619     //     if (sub==4) cHF->Divide(2,1);
1620     if (sub == 4)
1621       cHF->Divide(2, 2);
1622 
1623     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1624       if (sub == 1)
1625         cHB->cd(k);
1626       if (sub == 2)
1627         cHE->cd(k);
1628       if (sub == 3)
1629         cONE->cd(k - 3);
1630       if (sub == 4)
1631         cHF->cd(k);
1632       TH2F *TTT = new TH2F("Map", "Map", 82, -41, 40, 72, 0, 71);
1633       for (int x = 1; x <= Map_Ampl[21][sub][k]->GetXaxis()->GetNbins(); x++) {
1634         for (int y = 1; y <= Map_Ampl[21][sub][k]->GetYaxis()->GetNbins(); y++) {
1635           if (Map_Ampl[21][sub][k]->GetBinContent(x, y) != 0 && Map_RefAmpl[sub][k]->GetBinContent(x, y) != 0) {
1636             double ccc1 = Map_Ampl[21][sub][k]->GetBinContent(x, y) - Map_RefAmpl[sub][k]->GetBinContent(x, y);
1637             ccc1 = 100. * ccc1 / Map_Ampl[21][sub][k]->GetBinContent(x, y);  // in %
1638             HistAmplDepth[21][sub][k]->Fill(ccc1);
1639             Map_Ampl[21][sub][k]->SetBinContent(x, y, fabs(ccc1));
1640             if (fabs(ccc1) > porog[sub])
1641               TTT->SetBinContent(x, y, fabs(ccc1));
1642             else
1643               TTT->SetBinContent(x, y, 0);
1644           }
1645         }  //end y
1646       }    //esnd x
1647       gPad->SetGridy();
1648       gPad->SetGridx();
1649       //            gPad->SetLogz();
1650       if (sub == 1)
1651         sprintf(str, "HB, Depth%d \b", k);
1652       if (sub == 2)
1653         sprintf(str, "HE, Depth%d \b", k);
1654       if (sub == 3)
1655         sprintf(str, "HO, Depth%d \b", k);
1656       if (sub == 4)
1657         sprintf(str, "HF, Depth%d \b", k);
1658       TTT->SetTitle(str);
1659       TTT->SetXTitle("#eta \b");
1660       TTT->SetYTitle("#phi \b");
1661       TTT->SetZTitle("Relative difference, % \b");
1662       TTT->SetTitleOffset(0.9, "Z");
1663       TTT->Draw("COLZ");
1664       TTT->GetYaxis()->SetRangeUser(0, 71.);
1665       TTT->GetZaxis()->SetRangeUser(0, 10.);
1666       if (sub == 1) {
1667         cHB->Modified();
1668         cHB->Update();
1669       }
1670       if (sub == 2) {
1671         cHE->Modified();
1672         cHE->Update();
1673       }
1674       if (sub == 3) {
1675         cONE->Modified();
1676         cONE->Update();
1677       }
1678       if (sub == 4) {
1679         cHF->Modified();
1680         cHF->Update();
1681       }
1682     }  //end depth
1683 
1684     if (sub == 1) {
1685       cHB->Print("MapRateAmplDriftHB.png");
1686       cHB->Clear();
1687     }
1688     if (sub == 2) {
1689       cHE->Print("MapRateAmplDriftHE.png");
1690       cHE->Clear();
1691     }
1692     if (sub == 3) {
1693       cONE->Print("MapRateAmplDriftHO.png");
1694       cONE->Clear();
1695     }
1696     if (sub == 4) {
1697       cHF->Print("MapRateAmplDriftHF.png");
1698       cHF->Clear();
1699     }
1700     ////////////////////////////////////////////////////////////////////////////////////
1701 
1702     //     if (sub==1) cHB->Divide(2,1);
1703     if (sub == 1)
1704       cHB->Divide(2, 2);
1705     //     if (sub==2) cHE->Divide(3,1);
1706     if (sub == 2)
1707       cHE->Divide(3, 3);
1708     if (sub == 3)
1709       cONE->Divide(1, 1);
1710     //     if (sub==4) cHF->Divide(2,1);
1711     if (sub == 4)
1712       cHF->Divide(2, 2);
1713 
1714     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1715       if (sub == 1)
1716         cHB->cd(k);
1717       if (sub == 2)
1718         cHE->cd(k);
1719       if (sub == 3)
1720         cONE->cd(k - 3);
1721       if (sub == 4)
1722         cHF->cd(k);
1723       gPad->SetGridy();
1724       gPad->SetGridx();
1725       gPad->SetLogy();
1726       if (sub == 1)
1727         sprintf(str, "HB, Depth%d \b", k);
1728       if (sub == 2)
1729         sprintf(str, "HE, Depth%d \b", k);
1730       if (sub == 3)
1731         sprintf(str, "HO, Depth%d \b", k);
1732       if (sub == 4)
1733         sprintf(str, "HF, Depth%d \b", k);
1734       HistAmplDepth[21][sub][k]->SetTitle(str);
1735       HistAmplDepth[21][sub][k]->SetYTitle("Number of cell-events \b");
1736       HistAmplDepth[21][sub][k]->SetXTitle("Per cent \b");
1737       HistAmplDepth[21][sub][k]->SetLineColor(4);
1738       HistAmplDepth[21][sub][k]->SetLineWidth(2);
1739       HistAmplDepth[21][sub][k]->SetTitleOffset(1.4, "Y");
1740       HistAmplDepth[21][sub][k]->Draw();
1741       //          HistAmplDepth[21][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1742       HistAmplDepth[21][sub][k]->GetXaxis()->SetRangeUser(-10., 10.);
1743       if (sub == 1) {
1744         cHB->Modified();
1745         cHB->Update();
1746       }
1747       if (sub == 2) {
1748         cHE->Modified();
1749         cHE->Update();
1750       }
1751       if (sub == 3) {
1752         cONE->Modified();
1753         cONE->Update();
1754       }
1755       if (sub == 4) {
1756         cHF->Modified();
1757         cHF->Update();
1758       }
1759       double min_x[] = {-1 * porog[sub], -1 * porog[sub]};
1760       double min_y[] = {0., 100000000.};
1761       TGraph *MIN = new TGraph(2, min_x, min_y);
1762       MIN->SetLineStyle(2);
1763       MIN->SetLineColor(2);
1764       MIN->SetLineWidth(2 + 100 * 100);
1765       MIN->SetFillStyle(3005);
1766       MIN->SetFillColor(2);
1767       MIN->Draw("L");
1768       double max_x[] = {porog[sub], porog[sub]};
1769       double max_y[] = {0., 100000000.};
1770       TGraph *MAX = new TGraph(2, max_x, max_y);
1771       MAX->SetLineStyle(2);
1772       MAX->SetLineColor(2);
1773       MAX->SetLineWidth(-2 - 100 * 100);
1774       MAX->SetFillStyle(3004);
1775       MAX->SetFillColor(2);
1776       MAX->Draw("L");
1777     }  // end depth
1778     if (sub == 1) {
1779       cHB->Print("HistAmplDriftDepthHB.png");
1780       cHB->Clear();
1781     }
1782     if (sub == 2) {
1783       cHE->Print("HistAmplDriftDepthHE.png");
1784       cHE->Clear();
1785     }
1786     if (sub == 3) {
1787       cONE->Print("HistAmplDriftDepthHO.png");
1788       cONE->Clear();
1789     }
1790     if (sub == 4) {
1791       cHF->Print("HistAmplDriftDepthHF.png");
1792       cHF->Clear();
1793     }
1794   }  //end sub
1795 
1796   //+++++++++++++++++++++++++++++++++++
1797   //Test 31, 32 Pedestal, pedestalWidths
1798   //++++++++++++++++++++++++++++++++++++
1799 
1800   Map_Ampl[31][1][1] = (TH2F *)hfile->Get("h_mapDepth1pedestal_HB");
1801   Map_Ampl[31][1][2] = (TH2F *)hfile->Get("h_mapDepth2pedestal_HB");
1802   Map_Ampl[31][1][3] = (TH2F *)hfile->Get("h_mapDepth3pedestal_HB");
1803   Map_Ampl[31][1][4] = (TH2F *)hfile->Get("h_mapDepth4pedestal_HB");
1804   Map_Ampl[31][2][1] = (TH2F *)hfile->Get("h_mapDepth1pedestal_HE");
1805   Map_Ampl[31][2][2] = (TH2F *)hfile->Get("h_mapDepth2pedestal_HE");
1806   Map_Ampl[31][2][3] = (TH2F *)hfile->Get("h_mapDepth3pedestal_HE");
1807   Map_Ampl[31][2][4] = (TH2F *)hfile->Get("h_mapDepth4pedestal_HE");
1808   Map_Ampl[31][2][5] = (TH2F *)hfile->Get("h_mapDepth5pedestal_HE");
1809   Map_Ampl[31][2][6] = (TH2F *)hfile->Get("h_mapDepth6pedestal_HE");
1810   Map_Ampl[31][2][7] = (TH2F *)hfile->Get("h_mapDepth7pedestal_HE");
1811   Map_Ampl[31][3][4] = (TH2F *)hfile->Get("h_mapDepth4pedestal_HO");
1812   Map_Ampl[31][4][1] = (TH2F *)hfile->Get("h_mapDepth1pedestal_HF");
1813   Map_Ampl[31][4][2] = (TH2F *)hfile->Get("h_mapDepth2pedestal_HF");
1814   Map_Ampl[31][4][3] = (TH2F *)hfile->Get("h_mapDepth3pedestal_HF");
1815   Map_Ampl[31][4][4] = (TH2F *)hfile->Get("h_mapDepth4pedestal_HF");
1816 
1817   Map_Ampl[32][1][1] = (TH2F *)hfile->Get("h_mapDepth1pedestalw_HB");
1818   Map_Ampl[32][1][2] = (TH2F *)hfile->Get("h_mapDepth2pedestalw_HB");
1819   Map_Ampl[32][1][3] = (TH2F *)hfile->Get("h_mapDepth3pedestalw_HB");
1820   Map_Ampl[32][1][4] = (TH2F *)hfile->Get("h_mapDepth4pedestalw_HB");
1821   Map_Ampl[32][2][1] = (TH2F *)hfile->Get("h_mapDepth1pedestalw_HE");
1822   Map_Ampl[32][2][2] = (TH2F *)hfile->Get("h_mapDepth2pedestalw_HE");
1823   Map_Ampl[32][2][3] = (TH2F *)hfile->Get("h_mapDepth3pedestalw_HE");
1824   Map_Ampl[32][2][4] = (TH2F *)hfile->Get("h_mapDepth4pedestalw_HE");
1825   Map_Ampl[32][2][5] = (TH2F *)hfile->Get("h_mapDepth5pedestalw_HE");
1826   Map_Ampl[32][2][6] = (TH2F *)hfile->Get("h_mapDepth6pedestalw_HE");
1827   Map_Ampl[32][2][7] = (TH2F *)hfile->Get("h_mapDepth7pedestalw_HE");
1828   Map_Ampl[32][3][4] = (TH2F *)hfile->Get("h_mapDepth4pedestalw_HO");
1829   Map_Ampl[32][4][1] = (TH2F *)hfile->Get("h_mapDepth1pedestalw_HF");
1830   Map_Ampl[32][4][2] = (TH2F *)hfile->Get("h_mapDepth2pedestalw_HF");
1831   Map_Ampl[32][4][3] = (TH2F *)hfile->Get("h_mapDepth3pedestalw_HF");
1832   Map_Ampl[32][4][4] = (TH2F *)hfile->Get("h_mapDepth4pedestalw_HF");
1833 
1834   HistPed[1][1][0] = (TH1F *)hfile->Get("h_pedestal0_HB");
1835   HistPed[1][1][1] = (TH1F *)hfile->Get("h_pedestal1_HB");
1836   HistPed[1][1][2] = (TH1F *)hfile->Get("h_pedestal2_HB");
1837   HistPed[1][1][3] = (TH1F *)hfile->Get("h_pedestal3_HB");
1838   HistPed[2][1][0] = (TH1F *)hfile->Get("h_pedestalw0_HB");
1839   HistPed[2][1][1] = (TH1F *)hfile->Get("h_pedestalw1_HB");
1840   HistPed[2][1][2] = (TH1F *)hfile->Get("h_pedestalw2_HB");
1841   HistPed[2][1][3] = (TH1F *)hfile->Get("h_pedestalw3_HB");
1842 
1843   HistPed[1][2][0] = (TH1F *)hfile->Get("h_pedestal0_HE");
1844   HistPed[1][2][1] = (TH1F *)hfile->Get("h_pedestal1_HE");
1845   HistPed[1][2][2] = (TH1F *)hfile->Get("h_pedestal2_HE");
1846   HistPed[1][2][3] = (TH1F *)hfile->Get("h_pedestal3_HE");
1847   HistPed[2][2][0] = (TH1F *)hfile->Get("h_pedestalw0_HE");
1848   HistPed[2][2][1] = (TH1F *)hfile->Get("h_pedestalw1_HE");
1849   HistPed[2][2][2] = (TH1F *)hfile->Get("h_pedestalw2_HE");
1850   HistPed[2][2][3] = (TH1F *)hfile->Get("h_pedestalw3_HE");
1851 
1852   HistPed[1][3][0] = (TH1F *)hfile->Get("h_pedestal0_HO");
1853   HistPed[1][3][1] = (TH1F *)hfile->Get("h_pedestal1_HO");
1854   HistPed[1][3][2] = (TH1F *)hfile->Get("h_pedestal2_HO");
1855   HistPed[1][3][3] = (TH1F *)hfile->Get("h_pedestal3_HO");
1856   HistPed[2][3][0] = (TH1F *)hfile->Get("h_pedestalw0_HO");
1857   HistPed[2][3][1] = (TH1F *)hfile->Get("h_pedestalw1_HO");
1858   HistPed[2][3][2] = (TH1F *)hfile->Get("h_pedestalw2_HO");
1859   HistPed[2][3][3] = (TH1F *)hfile->Get("h_pedestalw3_HO");
1860 
1861   HistPed[1][4][0] = (TH1F *)hfile->Get("h_pedestal0_HF");
1862   HistPed[1][4][1] = (TH1F *)hfile->Get("h_pedestal1_HF");
1863   HistPed[1][4][2] = (TH1F *)hfile->Get("h_pedestal2_HF");
1864   HistPed[1][4][3] = (TH1F *)hfile->Get("h_pedestal3_HF");
1865   HistPed[2][4][0] = (TH1F *)hfile->Get("h_pedestalw0_HF");
1866   HistPed[2][4][1] = (TH1F *)hfile->Get("h_pedestalw1_HF");
1867   HistPed[2][4][2] = (TH1F *)hfile->Get("h_pedestalw2_HF");
1868   HistPed[2][4][3] = (TH1F *)hfile->Get("h_pedestalw3_HF");
1869 
1870   for (int test = 31; test <= 32; test++) {  //Test: 31-Pedestals, 32-pedestal Widths,
1871     for (int sub = 1; sub <= 4; sub++) {     //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1872                                              //        if (sub==1) cHB->Divide(2,1);
1873       if (sub == 1)
1874         cHB->Divide(2, 2);
1875       //        if (sub==2) cHE->Divide(3,1);
1876       if (sub == 2)
1877         cHE->Divide(3, 3);
1878       if (sub == 3)
1879         cONE->Divide(1, 1);
1880       //        if (sub==4) cHF->Divide(2,1);
1881       if (sub == 4)
1882         cHF->Divide(2, 2);
1883       //        int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1884       //        int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1885       //        int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
1886       for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depths
1887         if (sub == 1)
1888           cHB->cd(k);
1889         if (sub == 2)
1890           cHE->cd(k);
1891         if (sub == 3)
1892           cONE->cd(k - 3);
1893         if (sub == 4)
1894           cHF->cd(k);
1895         Map_Ampl[test][sub][k]->Divide(Map_Ampl[test][sub][k], Map_SUB[sub][k], 1, 1, "B");
1896         gPad->SetGridy();
1897         gPad->SetGridx();
1898         gPad->SetLogz();
1899         if (sub == 1)
1900           sprintf(str, "HB, Depth%d \b", k);
1901         if (sub == 2)
1902           sprintf(str, "HE, Depth%d \b", k);
1903         if (sub == 3)
1904           sprintf(str, "HO, Depth%d \b", k);
1905         if (sub == 4)
1906           sprintf(str, "HF, Depth%d \b", k);
1907         Map_Ampl[test][sub][k]->SetTitle(str);
1908         Map_Ampl[test][sub][k]->SetXTitle("#eta \b");
1909         Map_Ampl[test][sub][k]->SetYTitle("#phi \b");
1910         Map_Ampl[test][sub][k]->SetZTitle("Rate \b");
1911         if (sub == 3)
1912           Map_Ampl[test][sub][k]->SetTitleOffset(0.8, "Z");
1913         Map_Ampl[test][sub][k]->Draw("COLZ");
1914         Map_Ampl[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1915         Map_Ampl[test][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
1916         if (sub == 1) {
1917           cHB->Modified();
1918           cHB->Update();
1919         }
1920         if (sub == 2) {
1921           cHE->Modified();
1922           cHE->Update();
1923         }
1924         if (sub == 3) {
1925           cONE->Modified();
1926           cONE->Update();
1927         }
1928         if (sub == 4) {
1929           cHF->Modified();
1930           cHF->Update();
1931         }
1932       }  //end depth
1933       if (test == 31) {
1934         if (sub == 1) {
1935           cHB->Print("MapRatePedHB.png");
1936           cHB->Clear();
1937         }
1938         if (sub == 2) {
1939           cHE->Print("MapRatePedHE.png");
1940           cHE->Clear();
1941         }
1942         if (sub == 3) {
1943           cONE->Print("MapRatePedHO.png");
1944           cONE->Clear();
1945         }
1946         if (sub == 4) {
1947           cHF->Print("MapRatePedHF.png");
1948           cHF->Clear();
1949         }
1950       }
1951       if (test == 32) {
1952         if (sub == 1) {
1953           cHB->Print("MapRatePedWidthsHB.png");
1954           cHB->Clear();
1955         }
1956         if (sub == 2) {
1957           cHE->Print("MapRatePedWidthsHE.png");
1958           cHE->Clear();
1959         }
1960         if (sub == 3) {
1961           cONE->Print("MapRatePedWidthsHO.png");
1962           cONE->Clear();
1963         }
1964         if (sub == 4) {
1965           cHF->Print("MapRatePedWidthsHF.png");
1966           cHF->Clear();
1967         }
1968       }
1969 
1970       ///////////////////////////////////////////////
1971 
1972       cPED->Divide(2, 2);
1973       for (int cap = 0; cap <= 3; cap++) {
1974         cPED->cd(cap + 1);
1975         gPad->SetGridy();
1976         gPad->SetGridx();
1977         gPad->SetLogy();
1978 
1979         if (sub == 1)
1980           sprintf(str, "HB, Cap%d, all depth\b", cap);
1981         if (sub == 2)
1982           sprintf(str, "HE, Cap%d, all depth\b", cap);
1983         if (sub == 3)
1984           sprintf(str, "HO, Cap%d, all depth\b", cap);
1985         if (sub == 4)
1986           sprintf(str, "HF, Cap%d, all depth\b", cap);
1987 
1988         HistPed[test - 30][sub][cap]->SetTitle(str);
1989 
1990         if (test == 31)
1991           HistPed[test - 30][sub][cap]->SetXTitle("Pedestals in each event & cell \b");
1992         if (test == 32)
1993           HistPed[test - 30][sub][cap]->SetXTitle("Pedestal Widths in each event & cell \b");
1994 
1995         HistPed[test - 30][sub][cap]->SetYTitle("Number of channel-events \b");
1996         HistPed[test - 30][sub][cap]->SetLineColor(4);
1997         HistPed[test - 30][sub][cap]->SetLineWidth(2);
1998         HistPed[test - 30][sub][cap]->SetTitleOffset(1.4, "Y");
1999         HistPed[test - 30][sub][cap]->Draw("");
2000         //            HistPed[test-30][sub][cap]->GetYaxis()->SetRangeUser(1., 100.);
2001         //            if (test==31) {gPad->SetLogx(); HistPed[test-30][sub][cap]->GetXaxis()->SetRangeUser(1., 10000.);}
2002         //            if (test==32) HistPed[test-30][sub][cap]->GetXaxis()->SetRangeUser(0., 5.);
2003 
2004         cPED->Modified();
2005         cPED->Update();
2006         double min_x[] = {Pedest[test - 31][sub], Pedest[test - 31][sub]};
2007         double min_y[] = {0., 100000000.};
2008         TGraph *MIN = new TGraph(2, min_x, min_y);
2009         MIN->SetLineStyle(2);
2010         MIN->SetLineColor(2);
2011         MIN->SetLineWidth(2 + 100 * 100);
2012         MIN->SetFillStyle(3005);
2013         MIN->SetFillColor(2);
2014         MIN->Draw("L");
2015       }
2016       if (test == 31) {
2017         if (sub == 1) {
2018           cPED->Print("HistPedestalsHB.png");
2019           cPED->Clear();
2020         }
2021         if (sub == 2) {
2022           cPED->Print("HistPedestalsHE.png");
2023           cPED->Clear();
2024         }
2025         if (sub == 3) {
2026           cPED->Print("HistPedestalsHO.png");
2027           cPED->Clear();
2028         }
2029         if (sub == 4) {
2030           cPED->Print("HistPedestalsHF.png");
2031           cPED->Clear();
2032         }
2033       }
2034       if (test == 32) {
2035         if (sub == 1) {
2036           cPED->Print("HistPedestalWidthsHB.png");
2037           cPED->Clear();
2038         }
2039         if (sub == 2) {
2040           cPED->Print("HistPedestalWidthsHE.png");
2041           cPED->Clear();
2042         }
2043         if (sub == 3) {
2044           cPED->Print("HistPedestalWidthsHO.png");
2045           cPED->Clear();
2046         }
2047         if (sub == 4) {
2048           cPED->Print("HistPedestalWidthsHF.png");
2049           cPED->Clear();
2050         }
2051       }
2052     }  // end sub
2053   }    //end test 31,32
2054 
2055   //+++++++++++++++++++++++++++++++++++
2056   //Test 33 Correlation of Pedestal, pedestalWidths Vs fullAmplitude
2057   //++++++++++++++++++++++++++++++++++++
2058 
2059   cPED->Clear();
2060   Map_Ped[1][1] = (TH2F *)hfile->Get("h2_pedvsampl_HB");
2061   Map_Ped[1][2] = (TH2F *)hfile->Get("h2_pedvsampl_HE");
2062   Map_Ped[1][3] = (TH2F *)hfile->Get("h2_pedvsampl_HO");
2063   Map_Ped[1][4] = (TH2F *)hfile->Get("h2_pedvsampl_HF");
2064   Map_Ped[2][1] = (TH2F *)hfile->Get("h2_pedwvsampl_HB");
2065   Map_Ped[2][2] = (TH2F *)hfile->Get("h2_pedwvsampl_HE");
2066   Map_Ped[2][3] = (TH2F *)hfile->Get("h2_pedwvsampl_HO");
2067   Map_Ped[2][4] = (TH2F *)hfile->Get("h2_pedwvsampl_HF");
2068   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2069     cPED->Divide(2, 1);
2070     for (int test = 1; test <= 2; test++) {
2071       cPED->cd(test);
2072       gPad->SetGridy();
2073       gPad->SetGridx();
2074       gPad->SetLogz();
2075       if (test == 1)
2076         Map_Ped[test][sub]->SetXTitle("Pedestal, fC \b");
2077       if (test == 2)
2078         Map_Ped[test][sub]->SetXTitle("pedestal Width, fC \b");
2079       Map_Ped[test][sub]->SetYTitle("Amplitude, fC \b");
2080       Map_Ped[test][sub]->SetZTitle("entries  \b");
2081       if (test == 1)
2082         sprintf(str, "Cap0 Pedestal vs Amplitude \b");
2083       if (test == 2)
2084         sprintf(str, "Cap0 pedestalWidth vs Amplitude \b");
2085       Map_Ped[test][sub]->SetTitle(str);
2086       Map_Ped[test][sub]->Draw("COLZ");
2087       // Map_Ped[test][sub]->GetYaxis()->SetRangeUser(0, 72.);
2088       //      Map_Ped[test][sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
2089       cPED->Modified();
2090       cPED->Update();
2091     }  // test 1,2
2092     if (sub == 1) {
2093       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHB.png");
2094       cPED->Clear();
2095     }
2096     if (sub == 2) {
2097       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHE.png");
2098       cPED->Clear();
2099     }
2100     if (sub == 3) {
2101       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHO.png");
2102       cPED->Clear();
2103     }
2104     if (sub == 4) {
2105       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHF.png");
2106       cPED->Clear();
2107     }
2108   }  // end sub
2109 
2110   //+++++++++++++++++++++++++++++++++++
2111   //Test 41 Time Slices shape for good and bad channels
2112   //++++++++++++++++++++++++++++++++++++
2113 
2114   cONE->Clear();
2115   hist_GoodTSshape[1] = (TH1F *)hfile->Get("h_shape_good_channels_HB");
2116   hist_GoodTSshape[2] = (TH1F *)hfile->Get("h_shape_good_channels_HE");
2117   hist_GoodTSshape[3] = (TH1F *)hfile->Get("h_shape_good_channels_HO");
2118   hist_GoodTSshape[4] = (TH1F *)hfile->Get("h_shape_good_channels_HF");
2119 
2120   hist_GoodTSshape0[1] = (TH1F *)hfile->Get("h_shape0_good_channels_HB");
2121   hist_GoodTSshape0[2] = (TH1F *)hfile->Get("h_shape0_good_channels_HE");
2122   hist_GoodTSshape0[3] = (TH1F *)hfile->Get("h_shape0_good_channels_HO");
2123   hist_GoodTSshape0[4] = (TH1F *)hfile->Get("h_shape0_good_channels_HF");
2124 
2125   hist_BadTSshape[1] = (TH1F *)hfile->Get("h_shape_bad_channels_HB");
2126   hist_BadTSshape[2] = (TH1F *)hfile->Get("h_shape_bad_channels_HE");
2127   hist_BadTSshape[3] = (TH1F *)hfile->Get("h_shape_bad_channels_HO");
2128   hist_BadTSshape[4] = (TH1F *)hfile->Get("h_shape_bad_channels_HF");
2129 
2130   hist_BadTSshape0[1] = (TH1F *)hfile->Get("h_shape0_bad_channels_HB");
2131   hist_BadTSshape0[2] = (TH1F *)hfile->Get("h_shape0_bad_channels_HE");
2132   hist_BadTSshape0[3] = (TH1F *)hfile->Get("h_shape0_bad_channels_HO");
2133   hist_BadTSshape0[4] = (TH1F *)hfile->Get("h_shape0_bad_channels_HF");
2134 
2135   cONE->cd(1);
2136 
2137   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2138 
2139     gPad->SetGridy();
2140     gPad->SetGridx();
2141     gPad->SetLogz();
2142     hist_GoodTSshape[sub]->Divide(hist_GoodTSshape[sub], hist_GoodTSshape0[sub], 1, 1, "B");
2143     hist_GoodTSshape[sub]->SetXTitle("Time slice \b");
2144     hist_GoodTSshape[sub]->SetYTitle("ADC counts \b");
2145     sprintf(str, "Mean ADC Shape \b");
2146     hist_GoodTSshape[sub]->SetTitle(str);
2147     hist_GoodTSshape[sub]->Draw("");
2148     // hist_GoodTSshape[sub]->GetYaxis()->SetRangeUser(0, 72.);
2149     // hist_GoodTSshape[sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
2150     cONE->Modified();
2151     cONE->Update();
2152     if (sub == 1) {
2153       cONE->Print("HistGoodTSshapesHB.png");
2154       cONE->Clear();
2155     }
2156     if (sub == 2) {
2157       cONE->Print("HistGoodTSshapesHE.png");
2158       cONE->Clear();
2159     }
2160     if (sub == 3) {
2161       cONE->Print("HistGoodTSshapesHO.png");
2162       cONE->Clear();
2163     }
2164     if (sub == 4) {
2165       cONE->Print("HistGoodTSshapesHF.png");
2166       cONE->Clear();
2167     }
2168   }  // end sub
2169 
2170   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2171 
2172     gPad->SetGridy();
2173     gPad->SetGridx();
2174     gPad->SetLogz();
2175     hist_BadTSshape[sub]->Divide(hist_BadTSshape[sub], hist_BadTSshape0[sub], 1, 1, "B");
2176     hist_BadTSshape[sub]->SetXTitle("Time slice \b");
2177     hist_BadTSshape[sub]->SetYTitle("ADC counts \b");
2178     sprintf(str, "Mean ADC Shape \b");
2179     hist_BadTSshape[sub]->SetTitle(str);
2180     hist_BadTSshape[sub]->Draw("");
2181     // hist_BadTSshape[sub]->GetYaxis()->SetRangeUser(0, 72.);
2182     // hist_BadTSshape[sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
2183     cONE->Modified();
2184     cONE->Update();
2185     if (sub == 1) {
2186       cONE->Print("HistBadTSshapesHB.png");
2187       cONE->Clear();
2188     }
2189     if (sub == 2) {
2190       cONE->Print("HistBadTSshapesHE.png");
2191       cONE->Clear();
2192     }
2193     if (sub == 3) {
2194       cONE->Print("HistBadTSshapesHO.png");
2195       cONE->Clear();
2196     }
2197     if (sub == 4) {
2198       cONE->Print("HistBadTSshapesHF.png");
2199       cONE->Clear();
2200     }
2201   }  // end sub
2202 
2203   /*
2204  //+++++++++++++++++++++++++++++++++++  
2205 //Test 42 ADC in TS distributions   
2206 //++++++++++++++++++++++++++++++++++++
2207  
2208 std::cout<<" We are here to print ADC "<<std::endl; 
2209 
2210   hist_ADC_All[1] = (TH1F*)hfile->Get("h_ADC_HB");
2211   hist_ADC_All[2] = (TH1F*)hfile->Get("h_ADC_HE");
2212   hist_ADC_All[3] = (TH1F*)hfile->Get("h_ADC_HO");
2213   hist_ADC_All[4] = (TH1F*)hfile->Get("h_ADC_HF");
2214 
2215 
2216   hist_ADC_DS[1][1] = (TH1F*)hfile->Get("h_ADC_HBdepth1");
2217   hist_ADC_DS[1][2] = (TH1F*)hfile->Get("h_ADC_HBdepth2");
2218   hist_ADC_DS[2][1] = (TH1F*)hfile->Get("h_ADC_HEdepth1");
2219   hist_ADC_DS[2][2] = (TH1F*)hfile->Get("h_ADC_HEdepth2");
2220   hist_ADC_DS[2][3] = (TH1F*)hfile->Get("h_ADC_HEdepth3");
2221   hist_ADC_DS[3][4] = (TH1F*)hfile->Get("h_ADC_HOdepth4");
2222   hist_ADC_DS[4][1] = (TH1F*)hfile->Get("h_ADC_HFdepth1");
2223   hist_ADC_DS[4][2] = (TH1F*)hfile->Get("h_ADC_HFdepth2");
2224 
2225 
2226   cONE->Clear();   
2227   cONE->Divide(1,1);
2228   cONE->cd(1);
2229 
2230   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF         
2231       gPad->SetGridy();
2232       gPad->SetGridx();
2233       gPad->SetLogy();
2234       hist_ADC_All[sub]->SetXTitle("ADC counts \b");
2235       hist_ADC_All[sub]->SetYTitle("Number of channels-events \b");
2236       if (sub==1) sprintf(str,"ADC counts Distribution HB\b");
2237       if (sub==2) sprintf(str,"ADC counts Distribution HE\b");
2238       if (sub==3) sprintf(str,"ADC counts Distribution HO\b");
2239       if (sub==4) sprintf(str,"ADC counts Distribution HF\b");
2240       hist_ADC_All[sub]->SetTitle(str);
2241       hist_ADC_All[sub]->Draw("");
2242       // hist_ADC_All[sub]->GetYaxis()->SetRangeUser(0, 72.);
2243       hist_ADC_All[sub]->GetXaxis()->SetRangeUser(0.000, 1000.);
2244       cONE->Modified(); cONE->Update();
2245       if (sub==1) {cONE->Print("Hist_ADC_HB_All.png"); cONE->Clear();} 
2246       if (sub==2) {cONE->Print("Hist_ADC_HE_All.png"); cONE->Clear();}
2247       if (sub==3) {cONE->Print("Hist_ADC_HO_All.png"); cONE->Clear();}
2248       if (sub==4) {cONE->Print("Hist_ADC_HF_All.png"); cONE->Clear();} 
2249   }// end sub      
2250   
2251 
2252   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2253           if (sub==1) cHB->Divide(2,1);
2254           if (sub==2) cHE->Divide(3,1);
2255           if (sub==3) cONE->Divide(1,1);
2256           if (sub==4) cHB->Divide(2,1);
2257           int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2258           int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet    
2259           for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depths 
2260               if (sub==1) cHB->cd(k); 
2261               if (sub==2) cHE->cd(k);
2262           if (sub==3) cONE->cd(k-3);
2263           if (sub==4) cHB->cd(k); 
2264               gPad->SetGridy();
2265               gPad->SetGridx();
2266               gPad->SetLogy();
2267               hist_ADC_DS[sub][k]->SetXTitle("ADC counts \b");
2268               hist_ADC_DS[sub][k]->SetYTitle("Number of channels-events \b");
2269               if (sub==1) sprintf(str,"HB, Depth%d \b", k);
2270               if (sub==2) sprintf(str,"HE, Depth%d \b", k);
2271               if (sub==3) sprintf(str,"HO, Depth%d \b", k);
2272               if (sub==4) sprintf(str,"HF, Depth%d \b", k); 
2273               hist_ADC_DS[sub][k]->SetTitle(str);
2274               hist_ADC_DS[sub][k]->Draw("");
2275            // hist_ADC_DS[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2276               hist_ADC_DS[sub][k]->GetXaxis()->SetRangeUser(0.000, 1000.);
2277               if (sub==1) {cHB->Modified(); cHB->Update();} 
2278               if (sub==2) {cHE->Modified(); cHE->Update();}
2279               if (sub==3) {cONE->Modified();cONE->Update();}
2280               if (sub==4) {cHB->Modified(); cHB->Update();} 
2281           }//end depth    
2282       if (sub==1) {cHB->Print("Hist_ADC_HB_DS.png"); cHB->Clear();} 
2283           if (sub==2) {cHE->Print("Hist_ADC_HE_DS.png"); cHE->Clear();}
2284           if (sub==3) {cONE->Print("Hist_ADC_HO_DS.png"); cONE->Clear();}
2285           if (sub==4) {cHB->Print("Hist_ADC_HF_DS.png"); cHB->Clear();} 
2286   }// end sub
2287 
2288 
2289  //+++++++++++++++++++++++++++++++++++  
2290 //Test 43 Sum ADC in TS distributions   
2291 //++++++++++++++++++++++++++++++++++++
2292 
2293   hist_SumADC[1][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HB");
2294   hist_SumADC[1][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HB");
2295   hist_SumADC[2][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HE");
2296   hist_SumADC[2][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HE");
2297   hist_SumADC[2][3] = (TH1F*)hfile->Get("h_sumamplitude_depth3_HE");
2298   hist_SumADC[3][4] = (TH1F*)hfile->Get("h_sumamplitude_depth4_HO");
2299   hist_SumADC[4][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HF");
2300   hist_SumADC[4][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HF");
2301 
2302   hist_SumADC0[1][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HB0");
2303   hist_SumADC0[1][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HB0");
2304   hist_SumADC0[2][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HE0");
2305   hist_SumADC0[2][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HE0");
2306   hist_SumADC0[2][3] = (TH1F*)hfile->Get("h_sumamplitude_depth3_HE0");
2307   hist_SumADC0[3][4] = (TH1F*)hfile->Get("h_sumamplitude_depth4_HO0");
2308   hist_SumADC0[4][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HF0");
2309   hist_SumADC0[4][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HF0");
2310 
2311   hist_SumADC1[1][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HB1");
2312   hist_SumADC1[1][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HB1");
2313   hist_SumADC1[2][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HE1");
2314   hist_SumADC1[2][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HE1");
2315   hist_SumADC1[2][3] = (TH1F*)hfile->Get("h_sumamplitude_depth3_HE1");
2316   hist_SumADC1[3][4] = (TH1F*)hfile->Get("h_sumamplitude_depth4_HO1");
2317   hist_SumADC1[4][1] = (TH1F*)hfile->Get("h_sumamplitude_depth1_HF1");
2318   hist_SumADC1[4][2] = (TH1F*)hfile->Get("h_sumamplitude_depth2_HF1");
2319 
2320   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2321           if (sub==1) cHB->Divide(2,1);
2322           if (sub==2) cHE->Divide(3,1);
2323           if (sub==3) cONE->Divide(1,1);
2324           if (sub==4) cHB->Divide(2,1);
2325           int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2326           int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet    
2327           for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depths 
2328               if (sub==1) cHB->cd(k); 
2329               if (sub==2) cHE->cd(k);
2330           if (sub==3) cONE->cd(k-3);
2331           if (sub==4) cHB->cd(k); 
2332               gPad->SetGridy();
2333               gPad->SetGridx();
2334               gPad->SetLogy();
2335               hist_SumADC[sub][k]->SetXTitle("ADC sum \b");
2336               hist_SumADC[sub][k]->SetYTitle("Number of channels-events \b");
2337               if (sub==1) sprintf(str,"HB, Depth%d \b", k);
2338               if (sub==2) sprintf(str,"HE, Depth%d \b", k);
2339               if (sub==3) sprintf(str,"HO, Depth%d \b", k);
2340               if (sub==4) sprintf(str,"HF, Depth%d \b", k); 
2341               hist_SumADC[sub][k]->SetTitle(str);
2342               hist_SumADC[sub][k]->Draw("");
2343            // hist_SumADC[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2344            // hist_SumADC[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
2345               if (sub==1) {cHB->Modified(); cHB->Update();} 
2346               if (sub==2) {cHE->Modified(); cHE->Update();}
2347               if (sub==3) {cONE->Modified();cONE->Update();}
2348               if (sub==4) {cHB->Modified(); cHB->Update();} 
2349           }//end depth    
2350       if (sub==1) {cHB->Print("Hist_SumADC_HB.png"); cHB->Clear();} 
2351           if (sub==2) {cHE->Print("Hist_SumADC_HE.png"); cHE->Clear();}
2352           if (sub==3) {cONE->Print("Hist_SumADC_HO.png"); cONE->Clear();}
2353           if (sub==4) {cHB->Print("Hist_SumADC_HF.png"); cHB->Clear();} 
2354   }// end sub
2355 
2356 
2357   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2358           if (sub==1) cHB->Divide(2,1);
2359           if (sub==2) cHE->Divide(3,1);
2360           if (sub==3) cONE->Divide(1,1);
2361           if (sub==4) cHB->Divide(2,1);
2362           int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2363           int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet    
2364           for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depths 
2365               if (sub==1) cHB->cd(k); 
2366               if (sub==2) cHE->cd(k);
2367           if (sub==3) cONE->cd(k-3);
2368           if (sub==4) cHB->cd(k); 
2369               gPad->SetGridy();
2370               gPad->SetGridx();
2371               gPad->SetLogy();
2372               hist_SumADC0[sub][k]->SetXTitle("ADC sum \b");
2373               hist_SumADC0[sub][k]->SetYTitle("Number of channels-events \b");
2374               if (sub==1) sprintf(str,"HB, Depth%d \b", k);
2375               if (sub==2) sprintf(str,"HE, Depth%d \b", k);
2376               if (sub==3) sprintf(str,"HO, Depth%d \b", k);
2377               if (sub==4) sprintf(str,"HF, Depth%d \b", k); 
2378               hist_SumADC0[sub][k]->SetTitle(str);
2379               hist_SumADC0[sub][k]->Draw("");
2380            // hist_SumADC0[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2381            // hist_SumADC0[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
2382               if (sub==1) {cHB->Modified(); cHB->Update();} 
2383               if (sub==2) {cHE->Modified(); cHE->Update();}
2384               if (sub==3) {cONE->Modified();cONE->Update();}
2385               if (sub==4) {cHB->Modified(); cHB->Update();} 
2386           }//end depth    
2387       if (sub==1) {cHB->Print("Hist_SumADC_HB0.png"); cHB->Clear();} 
2388           if (sub==2) {cHE->Print("Hist_SumADC_HE0.png"); cHE->Clear();}
2389           if (sub==3) {cONE->Print("Hist_SumADC_HO0.png"); cONE->Clear();}
2390           if (sub==4) {cHB->Print("Hist_SumADC_HF0.png"); cHB->Clear();} 
2391   }// end sub
2392 
2393   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2394           if (sub==1) cHB->Divide(2,1);
2395           if (sub==2) cHE->Divide(3,1);
2396           if (sub==3) cONE->Divide(1,1);
2397           if (sub==4) cHB->Divide(2,1);
2398           int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2399           int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet    
2400           for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depths 
2401               if (sub==1) cHB->cd(k); 
2402               if (sub==2) cHE->cd(k);
2403           if (sub==3) cONE->cd(k-3);
2404           if (sub==4) cHB->cd(k); 
2405               gPad->SetGridy();
2406               gPad->SetGridx();
2407               gPad->SetLogy();
2408               hist_SumADC1[sub][k]->SetXTitle("ADC sum \b");
2409               hist_SumADC1[sub][k]->SetYTitle("Number of channels-events \b");
2410               if (sub==1) sprintf(str,"HB, Depth%d \b", k);
2411               if (sub==2) sprintf(str,"HE, Depth%d \b", k);
2412               if (sub==3) sprintf(str,"HO, Depth%d \b", k);
2413               if (sub==4) sprintf(str,"HF, Depth%d \b", k); 
2414               hist_SumADC1[sub][k]->SetTitle(str);
2415               hist_SumADC1[sub][k]->Draw("");
2416            // hist_SumADC1[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2417            // hist_SumADC1[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
2418               if (sub==1) {cHB->Modified(); cHB->Update();} 
2419               if (sub==2) {cHE->Modified(); cHE->Update();}
2420               if (sub==3) {cONE->Modified();cONE->Update();}
2421               if (sub==4) {cHB->Modified(); cHB->Update();} 
2422           }//end depth    
2423       if (sub==1) {cHB->Print("Hist_SumADC_HB1.png"); cHB->Clear();} 
2424           if (sub==2) {cHE->Print("Hist_SumADC_HE1.png"); cHE->Clear();}
2425           if (sub==3) {cONE->Print("Hist_SumADC_HO1.png"); cONE->Clear();}
2426           if (sub==4) {cHB->Print("Hist_SumADC_HF1.png"); cHB->Clear();} 
2427   }// end sub
2428 
2429 */
2430 
2431   //======================================================================
2432 
2433   std::cout << " We are here to print 2017 MAPs (do not use for run3 )" << std::endl;
2434 
2435   //======================================================================
2436   /*
2437 
2438   //======================================================================
2439   /// Prepare maps of good/bad channels:
2440 
2441   TH2F *Map_ALL = new TH2F("Map_All", "Map_all", 82, -41, 40, 72, 0, 71);
2442   int nx = Map_ALL->GetXaxis()->GetNbins();
2443   int ny = Map_ALL->GetYaxis()->GetNbins();
2444   int NBad = 0;
2445   int NWarn = 0;
2446   int NCalib = 0;
2447   int NPed = 0;
2448   //    int Eta[3][10000]={0};
2449   int Eta[4][10000] = {0};
2450   int Phi[4][10000] = {0};
2451   int Sub[4][10000] = {0};
2452   int Depth[4][10000] = {0};
2453   string Comment[4][10000] = {""};
2454   string Text[33] = {"", "Cm", "Am", "Wm", "Rm", "TNm", "TXm", "", "", "", "", "Cc", "Ac", "Wc", "Rc", "TNc", "TXc",
2455                      "", "",   "",   "",   "GS", "",    "",    "", "", "", "", "",   "",   "",   "Pm", "pWm"};
2456   int flag_W = 0;
2457   int flag_B = 0;
2458   int flag_P = 0;
2459 
2460   for (int i = 1; i <= nx; i++) {           //Eta
2461     for (int j = 1; j <= ny; j++) {         // Phi
2462       for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2463                                             //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2464         //       int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
2465         //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
2466         for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
2467           if (Map_SUB[sub][k]->GetBinContent(i, j) != 0) {
2468             Map_SUB[sub][k]->SetBinContent(i, j, 0.5);
2469             Map_ALL->SetBinContent(i, j, 0.5);
2470           }
2471         }
2472       }
2473     }
2474   }
2475 
2476   for (int i = 1; i <= nx; i++) {           //Eta
2477     for (int j = 1; j <= ny; j++) {         // Phi
2478       for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
2479                                             //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2480         //       int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
2481         //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
2482         for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
2483           flag_W = 0;
2484           flag_B = 0;
2485           flag_P = 0;
2486           for (int test = 1; test <= 6; test++) {  //Test: 1-Wm, 2-Rm, etc
2487                                                    //Bad
2488             if (Map_Ampl[test][sub][k]->GetBinContent(i, j) >
2489                 0.1) {  //Rate 0.1 for displaying  on whole detector map and subdetector map
2490               Map_ALL->SetBinContent(i, j, 1.);
2491               Map_SUB[sub][k]->SetBinContent(i, j, 1.);
2492               if (flag_B == 0) {
2493                 NBad += 1;
2494                 Eta[2][NBad] = i - 41;
2495                 Phi[2][NBad] = j - 1;
2496                 Sub[2][NBad] = sub;
2497                 Depth[2][NBad] = k;
2498                 Comment[2][NBad] = Text[test];
2499               } else
2500                 Comment[2][NBad] += ", " + Text[test];
2501               flag_B = 1;
2502               //              cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
2503             }
2504             //Warning
2505 // to be commented from this
2506 //                   if ((Map_Ampl[test][sub][k]->GetBinContent(i,j) != 0.)&&(Map_Ampl[test][sub][k]->GetBinContent(i,j) < 0.001) )  {
2507 //                if (Map_SUB[sub][k]->GetBinContent(i,j)!=1.) Map_SUB[sub][k]->SetBinContent(i,j,0.75);
2508 //            if (Map_ALL->GetBinContent(i,j)!=1.) Map_ALL->SetBinContent(i,j,0.75);
2509 //            if (flag_W == 0) {
2510 //               NWarn +=1; 
2511 //               Eta[1][NWarn]=i-41;
2512 //               Phi[1][NWarn]=j-1;
2513 //           Sub[1][NWarn]=sub;
2514 //               Depth[1][NWarn]=k;
2515 //               Comment[1][NWarn]=Text[test]; 
2516 //            } 
2517 //            else Comment[1][NWarn]+=", "+Text[test];
2518 //            flag_W = 1;                    
2519 //            cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
2520 //                   }         
2521 // to this
2522 
2523           }  //end test
2524 
2525           //Calib
2526          for (int test=11;test<=16;test++) { //Test: 1-2.E, 2-2.F, etc
2527                    if (Map_Ampl[test][sub][k]->GetBinContent(i,j) != 0.)  {
2528 //                if (Map_SUB[sub][k]->GetBinContent(i,j)!=1.0) Map_SUB[sub][k]->SetBinContent(i,j,0.3);
2529 //            if (Map_ALL->GetBinContent(i,j)!=1.) Map_ALL->SetBinContent(i,j,0.3);
2530               if (flag_W == 0) {
2531                  NWarn +=1; 
2532                  Eta[1][NWarn]=i-41;
2533                  Phi[1][NWarn]=j-1;
2534              Sub[1][NWarn]=sub;
2535                  Depth[1][NWarn]=k;
2536                  Comment[1][NWarn]=Text[test]; 
2537               } 
2538               else Comment[1][NWarn]+=", "+Text[test];
2539               flag_W = 1;                    
2540 //            cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
2541                   } 
2542         } //end test
2543 
2544           //Gain stabil
2545           
2546          for (int test=21;test<=21;test++) {
2547                    if (abs(Map_Ampl[test][sub][k]->GetBinContent(i,j)) > porog[sub])  {
2548                               if (Map_SUB[sub][k]->GetBinContent(i,j)!=1.0) Map_SUB[sub][k]->SetBinContent(i,j,0.75);
2549                           if (Map_ALL->GetBinContent(i,j)!=1.) {
2550                               Map_ALL->SetBinContent(i,j,0.75);           
2551                   if (flag_W == 0) {
2552                               NWarn +=1; 
2553                       Eta[1][NWarn]=i-41;
2554                       Phi[1][NWarn]=j-1;
2555                   Sub[1][NWarn]=sub;
2556                       Depth[1][NWarn]=k;
2557                       Comment[1][NWarn]=Text[test]; 
2558                   } 
2559                   else Comment[1][NWarn]+=", "+Text[test];
2560                   flag_W = 1;
2561                                  
2562               cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
2563                       }     
2564                   } 
2565         } //end test
2566 
2567           //Pedestals
2568           for (int test = 31; test <= 32; test++) {
2569             if (Map_Ampl[test][sub][k]->GetBinContent(i, j) > 0.1) {
2570               //                  if (Map_SUB[sub][k]->GetBinContent(i,j)!=1.0) Map_SUB[sub][k]->SetBinContent(i,j,0.75);
2571               //              if (Map_ALL->GetBinContent(i,j)!=1.)  Map_ALL->SetBinContent(i,j,0.75);
2572               if (flag_P == 0) {
2573                 NPed += 1;
2574                 Eta[3][NPed] = i - 41;
2575                 Phi[3][NPed] = j - 1;
2576                 Sub[3][NPed] = sub;
2577                 Depth[3][NPed] = k;
2578                 Comment[3][NPed] = Text[test];
2579               } else
2580                 Comment[3][NPed] += ", " + Text[test];
2581               flag_P = 1;
2582 
2583               //              cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
2584             }
2585           }  //end test
2586 
2587         }  //end Depth
2588       }    //end Sub
2589     }      //end Phi
2590   }        //end Eta
2591 
2592   // subdet maps
2593   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
2594 
2595     std::cout << " 2017 MAPS_SUB " << sub << std::endl;
2596     //     if (sub==1) cHB->Divide(2,1);
2597     if (sub == 1)
2598       cHB->Divide(2, 2);
2599     //     if (sub==2) cHE->Divide(3,1);
2600     if (sub == 2)
2601       cHE->Divide(3, 3);
2602     if (sub == 3)
2603       cONE->Divide(1, 1);
2604     //     if (sub==4) cHB->Divide(2,1);
2605     if (sub == 4)
2606       cHF->Divide(2, 2);
2607     //     int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2608     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
2609     //     int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
2610     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
2611       if (sub == 1)
2612         cHB->cd(k);
2613       if (sub == 2)
2614         cHE->cd(k);
2615       if (sub == 3)
2616         cONE->cd(k - 3);
2617       if (sub == 4)
2618         cHF->cd(k);
2619       gPad->SetGridy();
2620       gPad->SetGridx();
2621       //          gPad->SetLogz();
2622       //          gStyle->SetTitleOffset(0.5, "Y");
2623       if (sub == 1)
2624         sprintf(str, "HB, Depth%d \b", k);
2625       if (sub == 2)
2626         sprintf(str, "HE, Depth%d \b", k);
2627       if (sub == 3)
2628         sprintf(str, "HO, Depth%d \b", k);
2629       if (sub == 4)
2630         sprintf(str, "HF, Depth%d \b", k);
2631       Map_SUB[sub][k]->SetTitle(str);
2632       Map_SUB[sub][k]->SetXTitle("#eta \b");
2633       Map_SUB[sub][k]->SetYTitle("#phi \b");
2634       Map_SUB[sub][k]->Draw("COL");
2635       Map_SUB[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2636       Map_SUB[sub][k]->GetZaxis()->SetRangeUser(0., 1.);
2637       if (sub == 1) {
2638         cHB->Modified();
2639         cHB->Update();
2640       }
2641       if (sub == 2) {
2642         cHE->Modified();
2643         cHE->Update();
2644       }
2645       if (sub == 3) {
2646         cONE->Modified();
2647         cONE->Update();
2648       }
2649       if (sub == 4) {
2650         cHF->Modified();
2651         cHF->Update();
2652       }
2653     }  //end depth
2654     if (sub == 1) {
2655       cHB->Print("MAPHB.png");
2656       cHB->Clear();
2657     }
2658     if (sub == 2) {
2659       cHE->Print("MAPHE.png");
2660       cHE->Clear();
2661     }
2662     if (sub == 3) {
2663       cONE->Print("MAPHO.png");
2664       cONE->Clear();
2665     }
2666     if (sub == 4) {
2667       cHF->Print("MAPHF.png");
2668       cHF->Clear();
2669     }
2670   }
2671 */
2672   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2673   /*
2674   TCanvas *cmain1 = new TCanvas("cmain1", "MAP", 200, 10, 1400, 1800);
2675   cmain1->Divide(2, 2);
2676 
2677   cmain1->cd(1);
2678   TH1F *JDBEYESJ0 = (TH1F *)hfile->Get("h_totalAmplitudeHBperEvent");
2679   JDBEYESJ0->SetStats(0);
2680   JDBEYESJ0->SetMarkerStyle(20);
2681   JDBEYESJ0->SetMarkerSize(0.8);
2682   JDBEYESJ0->GetYaxis()->SetLabelSize(0.04);
2683   JDBEYESJ0->SetXTitle("iEvent \b");
2684   JDBEYESJ0->SetYTitle("totalAmplitude perEvent \b");
2685   JDBEYESJ0->SetTitle("HB \b");
2686   JDBEYESJ0->SetMarkerColor(2);
2687   JDBEYESJ0->SetLineColor(1);
2688   JDBEYESJ0->SetMinimum(0.8);
2689   JDBEYESJ0->Draw("HIST same P0");
2690 
2691   cmain1->cd(2);
2692   TH1F *JDBEYESJ1 = (TH1F *)hfile->Get("h_totalAmplitudeHEperEvent");
2693   JDBEYESJ1->SetStats(0);
2694   JDBEYESJ1->SetMarkerStyle(20);
2695   JDBEYESJ1->SetMarkerSize(0.8);
2696   JDBEYESJ1->GetYaxis()->SetLabelSize(0.04);
2697   JDBEYESJ1->SetXTitle("iEvent \b");
2698   JDBEYESJ1->SetYTitle("totalAmplitude perEvent \b");
2699   JDBEYESJ1->SetTitle("HE \b");
2700   JDBEYESJ1->SetMarkerColor(2);
2701   JDBEYESJ1->SetLineColor(1);
2702   JDBEYESJ1->SetMinimum(0.8);
2703   JDBEYESJ1->Draw("HIST same P0");
2704 
2705   cmain1->cd(3);
2706   TH1F *JDBEYESJ2 = (TH1F *)hfile->Get("h_totalAmplitudeHFperEvent");
2707   JDBEYESJ2->SetStats(0);
2708   JDBEYESJ2->SetMarkerStyle(20);
2709   JDBEYESJ2->SetMarkerSize(0.8);
2710   JDBEYESJ2->GetYaxis()->SetLabelSize(0.04);
2711   JDBEYESJ2->SetXTitle("iEvent \b");
2712   JDBEYESJ2->SetYTitle("totalAmplitude perEvent \b");
2713   JDBEYESJ2->SetTitle("HF \b");
2714   JDBEYESJ2->SetMarkerColor(2);
2715   JDBEYESJ2->SetLineColor(1);
2716   JDBEYESJ2->SetMinimum(0.8);
2717   JDBEYESJ2->Draw("HIST same P0");
2718 
2719   cmain1->cd(4);
2720   TH1F *JDBEYESJ3 = (TH1F *)hfile->Get("h_totalAmplitudeHOperEvent");
2721   JDBEYESJ3->SetStats(0);
2722   JDBEYESJ3->SetMarkerStyle(20);
2723   JDBEYESJ3->SetMarkerSize(0.8);
2724   JDBEYESJ3->GetYaxis()->SetLabelSize(0.04);
2725   JDBEYESJ3->SetXTitle("iEvent \b");
2726   JDBEYESJ3->SetYTitle("totalAmplitude perEvent \b");
2727   JDBEYESJ3->SetTitle("HO \b");
2728   JDBEYESJ3->SetMarkerColor(2);
2729   JDBEYESJ3->SetLineColor(1);
2730   JDBEYESJ3->SetMinimum(0.8);
2731   JDBEYESJ3->Draw("HIST same P0");
2732 
2733   cmain1->Modified();
2734   cmain1->Update();
2735   cmain1->Print("EVENTDEPENDENCE.png");
2736 
2737   std::cout << " EVENTDEPENDENCE " << std::endl;
2738 
2739   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2740   // ALL SubDet
2741   gStyle->SetOptTitle(0);
2742   TCanvas *cmain = new TCanvas("cmain", "MAP", 1000, 1000);
2743   gPad->SetGridy();
2744   gPad->SetGridx();
2745   //   gPad->SetLogz();
2746   Map_ALL->SetTitleOffset(1.3, "Y");
2747   Map_ALL->SetXTitle("#eta \b");
2748   Map_ALL->SetYTitle("#phi \b");
2749   Map_ALL->Draw("COL");
2750   Map_ALL->GetYaxis()->SetRangeUser(0, 72.);
2751   Map_ALL->GetZaxis()->SetRangeUser(0, 1.);
2752   cmain->Modified();
2753   cmain->Update();
2754   cmain->Print("MAP.png");
2755 
2756   std::cout << " MAP_ALL " << std::endl;
2757 */
2758   //======================================================================
2759 
2760   //====================================================================== html pages  CREATING:
2761   //======================================================================
2762   // Creating each test kind for each subdet html pages:
2763   std::string raw_class, raw_class1, raw_class2, raw_class3;
2764   int ind = 0;
2765 
2766   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2767     ofstream htmlFileT, htmlFileC, htmlFileD, htmlFileP, htmlFileS;
2768     if (sub == 1) {
2769       htmlFileT.open("HB_Tile.html");
2770       htmlFileC.open("HB_Calib.html");
2771       htmlFileD.open("HB_Drift.html");
2772       htmlFileP.open("HB_Pedestals.html");
2773       htmlFileS.open("HB_Shapes.html");
2774     }
2775     if (sub == 2) {
2776       htmlFileT.open("HE_Tile.html");
2777       htmlFileC.open("HE_Calib.html");
2778       htmlFileD.open("HE_Drift.html");
2779       htmlFileP.open("HE_Pedestals.html");
2780       htmlFileS.open("HE_Shapes.html");
2781     }
2782     if (sub == 3) {
2783       htmlFileT.open("HO_Tile.html");
2784       htmlFileC.open("HO_Calib.html");
2785       htmlFileD.open("HO_Drift.html");
2786       htmlFileP.open("HO_Pedestals.html");
2787       htmlFileS.open("HO_Shapes.html");
2788     }
2789     if (sub == 4) {
2790       htmlFileT.open("HF_Tile.html");
2791       htmlFileC.open("HF_Calib.html");
2792       htmlFileD.open("HF_Drift.html");
2793       htmlFileP.open("HF_Pedestals.html");
2794       htmlFileS.open("HF_Shapes.html");
2795     }
2796 
2797     // Megatile channels
2798     htmlFileT << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
2799     htmlFileT << "<head>" << std::endl;
2800     htmlFileT << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
2801     htmlFileT << "<title> Remote Monitoring Tool Global</title>" << std::endl;
2802     htmlFileT << "<style type=\"text/css\">" << std::endl;
2803     htmlFileT << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
2804               << std::endl;
2805     htmlFileT << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
2806     htmlFileT << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
2807                  "text-align: center;}"
2808               << std::endl;
2809     htmlFileT << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
2810     htmlFileT << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
2811     htmlFileT << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
2812     htmlFileT << "</style>" << std::endl;
2813     htmlFileT << "<body>" << std::endl;
2814 
2815     if (sub == 1)
2816       htmlFileT << "<h1> Criteria for megatile channels for HB, RUN = " << runnumber << " </h1>" << std::endl;
2817     if (sub == 2)
2818       htmlFileT << "<h1> Criteria for megatile channels for HE, RUN = " << runnumber << " </h1>" << std::endl;
2819     if (sub == 3)
2820       htmlFileT << "<h1> Criteria for megatile channels for HO, RUN = " << runnumber << " </h1>" << std::endl;
2821     if (sub == 4)
2822       htmlFileT << "<h1> Criteria for megatile channels for HF, RUN = " << runnumber << " </h1>" << std::endl;
2823     htmlFileT << "<br>" << std::endl;
2824 
2825     // Test Entries
2826 
2827     htmlFileT << "<h2> 0. Entries for each channel.</h3>" << std::endl;
2828     htmlFileT << "<h3> 0.A. Entries in each channel for each depth.</h3>" << std::endl;
2829     htmlFileT << "<h4> Channel legend: color is number of hits in digi collection </h4>" << std::endl;
2830     if (sub == 1)
2831       htmlFileT << " <img src=\"MapRateEntryHB.png\" />" << std::endl;
2832     if (sub == 2)
2833       htmlFileT << " <img src=\"MapRateEntryHE.png\" />" << std::endl;
2834     if (sub == 3)
2835       htmlFileT << " <img src=\"MapRateEntryHO.png\" />" << std::endl;
2836     if (sub == 4)
2837       htmlFileT << " <img src=\"MapRateEntryHF.png\" />" << std::endl;
2838     htmlFileT << "<br>" << std::endl;
2839 
2840     // Test Cm
2841     htmlFileT << "<h2> 1. Cm criterion: CapID errors for each channel.</h3>" << std::endl;
2842     htmlFileT << "<h3> 1.A. Rate of CapId failures in each channel for each depth.</h3>" << std::endl;
2843     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
2844     if (sub == 1)
2845       htmlFileT << " <img src=\"MapRateCapIDHB.png\" />" << std::endl;
2846     if (sub == 2)
2847       htmlFileT << " <img src=\"MapRateCapIDHE.png\" />" << std::endl;
2848     if (sub == 3)
2849       htmlFileT << " <img src=\"MapRateCapIDHO.png\" />" << std::endl;
2850     if (sub == 4)
2851       htmlFileT << " <img src=\"MapRateCapIDHF.png\" />" << std::endl;
2852     htmlFileT << "<br>" << std::endl;
2853 
2854     // Am
2855     htmlFileT << "<h2> 2. Am criterion: ADC amplitude collected over all TSs(Full Amplitude) for each channel. </h3>"
2856               << std::endl;
2857     htmlFileT << "<h3> 2.A. Full ADC amplitude distribution over all events, channels and depths.</h3>" << std::endl;
2858     htmlFileT << "<h4> Legend: Bins less " << MIN_M[2][sub] << " correpond to bad ADC amplitude </h4>" << std::endl;
2859     if (sub == 1)
2860       htmlFileT << " <img src=\"HistAmplHB.png\" />" << std::endl;
2861     if (sub == 2)
2862       htmlFileT << " <img src=\"HistAmplHE.png\" />" << std::endl;
2863     if (sub == 3)
2864       htmlFileT << " <img src=\"HistAmplHO.png\" />" << std::endl;
2865     if (sub == 4)
2866       htmlFileT << " <img src=\"HistAmplHF.png\" />" << std::endl;
2867     htmlFileT << "<br>" << std::endl;
2868     htmlFileT << "<h3> 2.B. Rate of bad ADC amplitude (<" << MIN_M[2][sub] << ") in each channel for each depth. </h3>"
2869               << std::endl;
2870     htmlFileT << "<h4> Channel legend: white - good, other colours - bad. </h4>" << std::endl;
2871     if (sub == 1)
2872       htmlFileT << " <img src=\"MapRateAmplHB.png\" />" << std::endl;
2873     if (sub == 2)
2874       htmlFileT << " <img src=\"MapRateAmplHE.png\" />" << std::endl;
2875     if (sub == 3)
2876       htmlFileT << " <img src=\"MapRateAmplHO.png\" />" << std::endl;
2877     if (sub == 4)
2878       htmlFileT << " <img src=\"MapRateAmplHF.png\" />" << std::endl;
2879     htmlFileT << "<br>" << std::endl;
2880 
2881     // Test Wm
2882     htmlFileT << "<h2> 3. Wm criterion: RMS (width) of ADC amplutude for each channel.</h3>" << std::endl;
2883     htmlFileT << "<h3> 3.A. RMS distribution over all events, channel and depth.</h3>" << std::endl;
2884     htmlFileT << "<h4> Legend: Bins less " << MIN_M[3][sub] << " and more " << MAX_M[3][sub]
2885               << " correpond to bad RMS </h4>" << std::endl;
2886     if (sub == 1)
2887       htmlFileT << " <img src=\"HistRMSHB.png\" />" << std::endl;
2888     if (sub == 2)
2889       htmlFileT << " <img src=\"HistRMSHE.png\" />" << std::endl;
2890     if (sub == 3)
2891       htmlFileT << " <img src=\"HistRMSHO.png\" />" << std::endl;
2892     if (sub == 4)
2893       htmlFileT << " <img src=\"HistRMSHF.png\" />" << std::endl;
2894     htmlFileT << "<br>" << std::endl;
2895     htmlFileT << "<h3> 3.B. Rate of bad RMS (<" << MIN_M[3][sub] << ",>" << MAX_M[3][sub]
2896               << ") in each channel for each depth.</h3>" << std::endl;
2897     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
2898     if (sub == 1)
2899       htmlFileT << " <img src=\"MapRateRMSHB.png\" />" << std::endl;
2900     if (sub == 2)
2901       htmlFileT << " <img src=\"MapRateRMSHE.png\" />" << std::endl;
2902     if (sub == 3)
2903       htmlFileT << " <img src=\"MapRateRMSHO.png\" />" << std::endl;
2904     if (sub == 4)
2905       htmlFileT << " <img src=\"MapRateRMSHF.png\" />" << std::endl;
2906     htmlFileT << "<br>" << std::endl;
2907 
2908     // Rm
2909     htmlFileT << "<h2> 4. Rm criterion: Ratio ADC value sum over four near maximum (-2, -1, max, +1) TS to ADC value "
2910                  "sum over all TS for each channel. </h3>"
2911               << std::endl;
2912     htmlFileT << "<h3> 4.A. Ratio distribution over all events, channels and depths.</h3>" << std::endl;
2913     htmlFileT << "<h4> Legend: Bins less " << MIN_M[4][sub] << " and more " << MAX_M[4][sub]
2914               << " correpond to bad ratio </h4>" << std::endl;
2915     if (sub == 1)
2916       htmlFileT << " <img src=\"Hist43TStoAllTSHB.png\" />" << std::endl;
2917     if (sub == 2)
2918       htmlFileT << " <img src=\"Hist43TStoAllTSHE.png\" />" << std::endl;
2919     if (sub == 3)
2920       htmlFileT << " <img src=\"Hist43TStoAllTSHO.png\" />" << std::endl;
2921     if (sub == 4)
2922       htmlFileT << " <img src=\"Hist43TStoAllTSHF.png\" />" << std::endl;
2923     htmlFileT << "<br>" << std::endl;
2924     htmlFileT << "<h3> 4.B. Rate of bad ratio (<" << MIN_M[4][sub] << ", >" << MAX_M[4][sub]
2925               << ") in each channel for each depth.</h3>" << std::endl;
2926     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
2927     if (sub == 1)
2928       htmlFileT << " <img src=\"MapRate43TStoAllTSHB.png\" />" << std::endl;
2929     if (sub == 2)
2930       htmlFileT << " <img src=\"MapRate43TStoAllTSHE.png\" />" << std::endl;
2931     if (sub == 3)
2932       htmlFileT << " <img src=\"MapRate43TStoAllTSHO.png\" />" << std::endl;
2933     if (sub == 4)
2934       htmlFileT << " <img src=\"MapRate43TStoAllTSHF.png\" />" << std::endl;
2935     htmlFileT << "<br>" << std::endl;
2936 
2937     // TNm
2938     htmlFileT << "<h2> 5. TNm criterion: Mean TS position for each channel.</h3>" << std::endl;
2939     htmlFileT << "<h3> 5.A. TN position distribution over all events, channels and depths.</h3>" << std::endl;
2940     htmlFileT << "<h4> Legend: Bins less " << MIN_M[5][sub] << " and more " << MAX_M[5][sub]
2941               << " correpond to bad mean position </h4>" << std::endl;
2942     if (sub == 1)
2943       htmlFileT << " <img src=\"HistMeanPosHB.png\" />" << std::endl;
2944     if (sub == 2)
2945       htmlFileT << " <img src=\"HistMeanPosHE.png\" />" << std::endl;
2946     if (sub == 3)
2947       htmlFileT << " <img src=\"HistMeanPosHO.png\" />" << std::endl;
2948     if (sub == 4)
2949       htmlFileT << " <img src=\"HistMeanPosHF.png\" />" << std::endl;
2950     htmlFileT << "<br>" << std::endl;
2951     htmlFileT << "<h3> 5.B. Rate of bad TN position  (<" << MIN_M[5][sub] << ", >" << MAX_M[5][sub]
2952               << ") in each channel for each depth. </h3>" << std::endl;
2953     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
2954     if (sub == 1)
2955       htmlFileT << " <img src=\"MapRateMeanPosHB.png\" />" << std::endl;
2956     if (sub == 2)
2957       htmlFileT << " <img src=\"MapRateMeanPosHE.png\" />" << std::endl;
2958     if (sub == 3)
2959       htmlFileT << " <img src=\"MapRateMeanPosHO.png\" />" << std::endl;
2960     if (sub == 4)
2961       htmlFileT << " <img src=\"MapRateMeanPosHF.png\" />" << std::endl;
2962     htmlFileT << "<br>" << std::endl;
2963 
2964     // TXm
2965     htmlFileT << "<h2> 6.TXm criterion: Maximum TS position for each channel.</h3>" << std::endl;
2966     htmlFileT << "<h3> 6.A. TX position distribution over all events, channel and depth.</h3>" << std::endl;
2967     htmlFileT << "<h4> Legend: Bins less " << MIN_M[6][sub] << " and more " << MAX_M[6][sub]
2968               << " correpond to bad position </h4>" << std::endl;
2969     if (sub == 1)
2970       htmlFileT << " <img src=\"HistMaxPosHB.png\" />" << std::endl;
2971     if (sub == 2)
2972       htmlFileT << " <img src=\"HistMaxPosHE.png\" />" << std::endl;
2973     if (sub == 3)
2974       htmlFileT << " <img src=\"HistMaxPosHO.png\" />" << std::endl;
2975     if (sub == 4)
2976       htmlFileT << " <img src=\"HistMaxPosHF.png\" />" << std::endl;
2977     htmlFileT << "<br>" << std::endl;
2978     htmlFileT << "<h3> 6.B. Rate of bad TX position  (<" << MIN_M[6][sub] << ", >" << MAX_M[6][sub]
2979               << ") in each channel for each depth. </h3>" << std::endl;
2980     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
2981     if (sub == 1)
2982       htmlFileT << " <img src=\"MapRateMaxPosHB.png\" />" << std::endl;
2983     if (sub == 2)
2984       htmlFileT << " <img src=\"MapRateMaxPosHE.png\" />" << std::endl;
2985     if (sub == 3)
2986       htmlFileT << " <img src=\"MapRateMaxPosHO.png\" />" << std::endl;
2987     if (sub == 4)
2988       htmlFileT << " <img src=\"MapRateMaxPosHF.png\" />" << std::endl;
2989     htmlFileT << "<br>" << std::endl;
2990 
2991     htmlFileT << "</body> " << std::endl;
2992     htmlFileT << "</html> " << std::endl;
2993     htmlFileT.close();
2994 
2995     //Calibration channels
2996     htmlFileC << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
2997     htmlFileC << "<head>" << std::endl;
2998     htmlFileC << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
2999     htmlFileC << "<title> Raw Data Analyser </title>" << std::endl;
3000     htmlFileC << "<style type=\"text/css\">" << std::endl;
3001     htmlFileC << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
3002               << std::endl;
3003     htmlFileC << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
3004     htmlFileC << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
3005                  "text-align: center;}"
3006               << std::endl;
3007     htmlFileC << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
3008     htmlFileC << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
3009     htmlFileC << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
3010     htmlFileC << "</style>" << std::endl;
3011     htmlFileC << "<body>" << std::endl;
3012 
3013     if (sub == 1)
3014       htmlFileC << "<h1> Criteria for calibration channels for HB, RUN = " << runnumber << " </h1>" << std::endl;
3015     if (sub == 2)
3016       htmlFileC << "<h1> Criteria for calibration channels for HE, RUN = " << runnumber << " </h1>" << std::endl;
3017     if (sub == 3)
3018       htmlFileC << "<h1> Criteria for calibration channels for HO, RUN = " << runnumber << " </h1>" << std::endl;
3019     if (sub == 4)
3020       htmlFileC << "<h1> Criteria for calibration channels for HF, RUN = " << runnumber << " </h1>" << std::endl;
3021     htmlFileC << "<br>" << std::endl;
3022 
3023     // Test Cc
3024     htmlFileC << "<h2> 1.Cc criterion: CapID errors for each channel.</h3>" << std::endl;
3025     htmlFileC << "<h3> 1.A. Rate of CapId failures in each channel for each depth.</h3>" << std::endl;
3026     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
3027     if (sub == 1)
3028       htmlFileC << " <img src=\"MapRateCapCalibHB.png\" />" << std::endl;
3029     if (sub == 2)
3030       htmlFileC << " <img src=\"MapRateCapCalibHE.png\" />" << std::endl;
3031     if (sub == 3)
3032       htmlFileC << " <img src=\"MapRateCapCalibHO.png\" />" << std::endl;
3033     if (sub == 4)
3034       htmlFileC << " <img src=\"MapRateCapCalibHF.png\" />" << std::endl;
3035     htmlFileC << "<br>" << std::endl;
3036 
3037     // Ac
3038     htmlFileC << "<h2> 2. Ac criterion: ADC amplitude collected over all TSs(Full Amplitude) for each channel. </h3>"
3039               << std::endl;
3040     htmlFileC << "<h3> 2.A. Full ADC amplitude distribution over all events, channels and depths.</h3>" << std::endl;
3041     htmlFileC << "<h4> Legend: Bins less " << MIN_C[2][sub] << " correpond to bad ADC amplitude </h4>" << std::endl;
3042     if (sub == 1)
3043       htmlFileC << " <img src=\"HistAmplCalibHB.png\" />" << std::endl;
3044     if (sub == 2)
3045       htmlFileC << " <img src=\"HistAmplCalibHE.png\" />" << std::endl;
3046     if (sub == 3)
3047       htmlFileC << " <img src=\"HistAmplCalibHO.png\" />" << std::endl;
3048     if (sub == 4)
3049       htmlFileC << " <img src=\"HistAmplCalibHF.png\" />" << std::endl;
3050     htmlFileC << "<br>" << std::endl;
3051     htmlFileC << "<h3> 2.B. Rate of bad ADC amplitude (<" << MIN_C[2][sub] << ") in each channel for each depth. </h3>"
3052               << std::endl;
3053     htmlFileC << "<h4> Channel legend: white - good, other colours - bad. </h4>" << std::endl;
3054     if (sub == 1)
3055       htmlFileC << " <img src=\"MapRateAmplCalibHB.png\" />" << std::endl;
3056     if (sub == 2)
3057       htmlFileC << " <img src=\"MapRateAmplCalibHE.png\" />" << std::endl;
3058     if (sub == 3)
3059       htmlFileC << " <img src=\"MapRateAmplCalibHO.png\" />" << std::endl;
3060     if (sub == 4)
3061       htmlFileC << " <img src=\"MapRateAmplCalibHF.png\" />" << std::endl;
3062     htmlFileC << "<br>" << std::endl;
3063 
3064     // Test Wc
3065     htmlFileC << "<h2> 3. Wc criterion: RMS (width) of ADC amplutude for each channel.</h3>" << std::endl;
3066     htmlFileC << "<h3> 3.A. W distribution over all events, channel and depth.</h3>" << std::endl;
3067     htmlFileC << "<h4> Legend: Bins less " << MIN_C[3][sub] << " and more " << MAX_C[3][sub]
3068               << " correpond to bad RMS </h4>" << std::endl;
3069     if (sub == 1)
3070       htmlFileC << " <img src=\"HistRMSCalibHB.png\" />" << std::endl;
3071     if (sub == 2)
3072       htmlFileC << " <img src=\"HistRMSCalibHE.png\" />" << std::endl;
3073     if (sub == 3)
3074       htmlFileC << " <img src=\"HistRMSCalibHO.png\" />" << std::endl;
3075     if (sub == 4)
3076       htmlFileC << " <img src=\"HistRMSCalibHF.png\" />" << std::endl;
3077     htmlFileC << "<br>" << std::endl;
3078     htmlFileC << "<h3> 3.B. Rate of bad W (<" << MIN_C[3][sub] << ",>" << MAX_C[3][sub]
3079               << ") in each channel for each depth.</h3>" << std::endl;
3080     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
3081     if (sub == 1)
3082       htmlFileC << " <img src=\"MapRateRMSCalibHB.png\" />" << std::endl;
3083     if (sub == 2)
3084       htmlFileC << " <img src=\"MapRateRMSCalibHE.png\" />" << std::endl;
3085     if (sub == 3)
3086       htmlFileC << " <img src=\"MapRateRMSCalibHO.png\" />" << std::endl;
3087     if (sub == 4)
3088       htmlFileC << " <img src=\"MapRateRMSCalibHF.png\" />" << std::endl;
3089     htmlFileC << "<br>" << std::endl;
3090 
3091     // Rc
3092     htmlFileC << "<h2> 4. Rc criterion: Ratio ADC value sum over five near maximum (-2, -1, max, +1, +2) TS to ADC "
3093                  "value sum over all TS for each channel. </h3>"
3094               << std::endl;
3095     htmlFileC << "<h3> 4.A. Ratio distribution over all events, channels and depths.</h3>" << std::endl;
3096     htmlFileC << "<h4> Legend: Bins less " << MIN_C[4][sub] << " and more " << MAX_C[4][sub]
3097               << " correpond to bad ratio </h4>" << std::endl;
3098     if (sub == 1)
3099       htmlFileC << " <img src=\"Hist43TStoAllTSCalibHB.png\" />" << std::endl;
3100     if (sub == 2)
3101       htmlFileC << " <img src=\"Hist43TStoAllTSCalibHE.png\" />" << std::endl;
3102     if (sub == 3)
3103       htmlFileC << " <img src=\"Hist43TStoAllTSCalibHO.png\" />" << std::endl;
3104     if (sub == 4)
3105       htmlFileC << " <img src=\"Hist43TStoAllTSCalibHF.png\" />" << std::endl;
3106     htmlFileC << "<br>" << std::endl;
3107     htmlFileC << "<h3> 4.B. Rate of bad Ratio (<" << MIN_C[4][sub] << ", >" << MAX_C[4][sub]
3108               << ") in each channel for each depth.</h3>" << std::endl;
3109     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
3110     if (sub == 1)
3111       htmlFileC << " <img src=\"MapRate43TStoAllTSCalibHB.png\" />" << std::endl;
3112     if (sub == 2)
3113       htmlFileC << " <img src=\"MapRate43TStoAllTSCalibHE.png\" />" << std::endl;
3114     if (sub == 3)
3115       htmlFileC << " <img src=\"MapRate43TStoAllTSCalibHO.png\" />" << std::endl;
3116     if (sub == 4)
3117       htmlFileC << " <img src=\"MapRate43TStoAllTSCalibHF.png\" />" << std::endl;
3118     htmlFileC << "<br>" << std::endl;
3119 
3120     // TNc
3121     htmlFileC << "<h2> 5. TNc criterion: Mean TS position for each channel.</h3>" << std::endl;
3122     htmlFileC << "<h3> 5.A. TN position distribution over all events, channels and depths.</h3>" << std::endl;
3123     htmlFileC << "<h4> Legend: Bins less " << MIN_C[5][sub] << " and more " << MAX_C[5][sub]
3124               << " correpond to bad position </h4>" << std::endl;
3125     if (sub == 1)
3126       htmlFileC << " <img src=\"HistMeanPosCalibHB.png\" />" << std::endl;
3127     if (sub == 2)
3128       htmlFileC << " <img src=\"HistMeanPosCalibHE.png\" />" << std::endl;
3129     if (sub == 3)
3130       htmlFileC << " <img src=\"HistMeanPosCalibHO.png\" />" << std::endl;
3131     if (sub == 4)
3132       htmlFileC << " <img src=\"HistMeanPosCalibHF.png\" />" << std::endl;
3133     htmlFileC << "<br>" << std::endl;
3134     htmlFileC << "<h3> 5.B. Rate of bad TN position  (<" << MIN_C[5][sub] << ", >" << MAX_C[5][sub]
3135               << ") in each channel for each depth. </h3>" << std::endl;
3136     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
3137     if (sub == 1)
3138       htmlFileC << " <img src=\"MapRateMeanPosCalibHB.png\" />" << std::endl;
3139     if (sub == 2)
3140       htmlFileC << " <img src=\"MapRateMeanPosCalibHE.png\" />" << std::endl;
3141     if (sub == 3)
3142       htmlFileC << " <img src=\"MapRateMeanPosCalibHO.png\" />" << std::endl;
3143     if (sub == 4)
3144       htmlFileC << " <img src=\"MapRateMeanPosCalibHF.png\" />" << std::endl;
3145     htmlFileC << "<br>" << std::endl;
3146 
3147     // TXm
3148     htmlFileC << "<h2> 6.TXc criterion: Maximum TS position for each channel.</h3>" << std::endl;
3149     htmlFileC << "<h3> 6.A. TX position distribution over all events, channel and depth.</h3>" << std::endl;
3150     htmlFileC << "<h4> Legend: Bins less " << MIN_C[6][sub] << " and more " << MAX_C[6][sub]
3151               << " correpond to bad position </h4>" << std::endl;
3152     if (sub == 1)
3153       htmlFileC << " <img src=\"HistMaxPosCalibHB.png\" />" << std::endl;
3154     if (sub == 2)
3155       htmlFileC << " <img src=\"HistMaxPosCalibHE.png\" />" << std::endl;
3156     if (sub == 3)
3157       htmlFileC << " <img src=\"HistMaxPosCalibHO.png\" />" << std::endl;
3158     if (sub == 4)
3159       htmlFileC << " <img src=\"HistMaxPosCalibHF.png\" />" << std::endl;
3160     htmlFileC << "<br>" << std::endl;
3161     htmlFileC << "<h3> 6.B. Rate of bad TX position  (<" << MIN_C[6][sub] << ", >" << MAX_C[6][sub]
3162               << ") in each channel for each depth. </h3>" << std::endl;
3163     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
3164     if (sub == 1)
3165       htmlFileC << " <img src=\"MapRateMaxPosCalibHB.png\" />" << std::endl;
3166     if (sub == 2)
3167       htmlFileC << " <img src=\"MapRateMaxPosCalibHE.png\" />" << std::endl;
3168     if (sub == 3)
3169       htmlFileC << " <img src=\"MapRateMaxPosCalibHO.png\" />" << std::endl;
3170     if (sub == 4)
3171       htmlFileC << " <img src=\"MapRateMaxPosCalibHF.png\" />" << std::endl;
3172     htmlFileC << "<br>" << std::endl;
3173 
3174     htmlFileC << "</body> " << std::endl;
3175     htmlFileC << "</html> " << std::endl;
3176     htmlFileC.close();
3177 
3178     //Response drift
3179     htmlFileD << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
3180     htmlFileD << "<head>" << std::endl;
3181     htmlFileD << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
3182     htmlFileD << "<title> Remote Monitoring Tool Global </title>" << std::endl;
3183     htmlFileD << "<style type=\"text/css\">" << std::endl;
3184     htmlFileD << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
3185               << std::endl;
3186     htmlFileD << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
3187     htmlFileD << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
3188                  "text-align: center;}"
3189               << std::endl;
3190     htmlFileD << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
3191     htmlFileD << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
3192     htmlFileD << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
3193     htmlFileD << "</style>" << std::endl;
3194     htmlFileD << "<body>" << std::endl;
3195 
3196     if (sub == 1)
3197       htmlFileD << "<h1> Response drift for HB: Current RUN = " << runnumber << ", Reference RUN = " << refrunnumber
3198                 << " </h1>" << std::endl;
3199     if (sub == 2)
3200       htmlFileD << "<h1> Response drift for HE: Current RUN = " << runnumber << ", Reference RUN = " << refrunnumber
3201                 << " </h1>" << std::endl;
3202     if (sub == 3)
3203       htmlFileD << "<h1> Response drift for HO: Current RUN = " << runnumber << ", Reference RUN = " << refrunnumber
3204                 << " </h1>" << std::endl;
3205     if (sub == 4)
3206       htmlFileD << "<h1> Response drift for HF: Current RUN = " << runnumber << ", Reference RUN = " << refrunnumber
3207                 << " </h1>" << std::endl;
3208     htmlFileD << "<br>" << std::endl;
3209 
3210     // test GS
3211     htmlFileD << "<h2> 1. Gain Stability (GS) </h3>" << std::endl;
3212     htmlFileD << "<h3> 1.A. Averaged channel response, collected over all TS, for Current run in each channel for each "
3213                  "depth.</h3>"
3214               << std::endl;
3215     htmlFileD << "<h4> Channel legend: colour means cooresponding value of mean response. </h4>" << std::endl;
3216     if (sub == 1)
3217       htmlFileD << " <img src=\"MapRateAmpl1HB.png\" />" << std::endl;
3218     if (sub == 2)
3219       htmlFileD << " <img src=\"MapRateAmpl1HE.png\" />" << std::endl;
3220     if (sub == 3)
3221       htmlFileD << " <img src=\"MapRateAmpl1HO.png\" />" << std::endl;
3222     if (sub == 4)
3223       htmlFileD << " <img src=\"MapRateAmpl1HF.png\" />" << std::endl;
3224     htmlFileD << "<br>" << std::endl;
3225     htmlFileD << "<h3> 1.B. Averaged channel response, collected over all TS, for Reference run in each channel for "
3226                  "each depth.</h3>"
3227               << std::endl;
3228     htmlFileD << "<h4> Channel legend: colour means cooresponding value of mean response. </h4>" << std::endl;
3229     if (sub == 1)
3230       htmlFileD << " <img src=\"MapRateAmpl2HB.png\" />" << std::endl;
3231     if (sub == 2)
3232       htmlFileD << " <img src=\"MapRateAmpl2HE.png\" />" << std::endl;
3233     if (sub == 3)
3234       htmlFileD << " <img src=\"MapRateAmpl2HO.png\" />" << std::endl;
3235     if (sub == 4)
3236       htmlFileD << " <img src=\"MapRateAmpl2HF.png\" />" << std::endl;
3237     htmlFileD << "<br>" << std::endl;
3238     htmlFileD << "<h3> 1.C. Relative difference between Current run and Current run distribution over all events, "
3239                  "channels for each depth.</h3>"
3240               << std::endl;
3241     htmlFileD << "<h4>  Legend: Bins less -" << porog[sub] << "% and more +" << porog[sub]
3242               << "% correpond to bad relative difference position </h4>" << std::endl;
3243     if (sub == 1)
3244       htmlFileD << " <img src=\"HistAmplDriftDepthHB.png\" />" << std::endl;
3245     if (sub == 2)
3246       htmlFileD << " <img src=\"HistAmplDriftDepthHE.png\" />" << std::endl;
3247     if (sub == 3)
3248       htmlFileD << " <img src=\"HistAmplDriftDepthHO.png\" />" << std::endl;
3249     if (sub == 4)
3250       htmlFileD << " <img src=\"HistAmplDriftDepthHF.png\" />" << std::endl;
3251     htmlFileD << "<br>" << std::endl;
3252     htmlFileD << "<h3> 1.D. Rate of bad relative difference  (<-" << porog[sub] << ", >+" << porog[sub]
3253               << ") in each channel for each depth.</h3>" << std::endl;
3254     htmlFileD << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
3255     if (sub == 1)
3256       htmlFileD << " <img src=\"MapRateAmplDriftHB.png\" />" << std::endl;
3257     if (sub == 2)
3258       htmlFileD << " <img src=\"MapRateAmplDriftHE.png\" />" << std::endl;
3259     if (sub == 3)
3260       htmlFileD << " <img src=\"MapRateAmplDriftHO.png\" />" << std::endl;
3261     if (sub == 4)
3262       htmlFileD << " <img src=\"MapRateAmplDriftHF.png\" />" << std::endl;
3263     htmlFileD << "<br>" << std::endl;
3264 
3265     htmlFileD << "</body> " << std::endl;
3266     htmlFileD << "</html> " << std::endl;
3267     htmlFileD.close();
3268 
3269     // Pedestals
3270     htmlFileP << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
3271     htmlFileP << "<head>" << std::endl;
3272     htmlFileP << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
3273     htmlFileP << "<title> Remote Monitoring Tool Global</title>" << std::endl;
3274     htmlFileP << "<style type=\"text/css\">" << std::endl;
3275     htmlFileP << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
3276               << std::endl;
3277     htmlFileP << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
3278     htmlFileP << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
3279                  "text-align: center;}"
3280               << std::endl;
3281     htmlFileP << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
3282     htmlFileP << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
3283     htmlFileP << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
3284     htmlFileP << "</style>" << std::endl;
3285     htmlFileP << "<body>" << std::endl;
3286 
3287     if (sub == 1)
3288       htmlFileP << "<h1> Pedestals for HB, RUN = " << runnumber << " </h1>" << std::endl;
3289     if (sub == 2)
3290       htmlFileP << "<h1> Pedestals for HE, RUN = " << runnumber << " </h1>" << std::endl;
3291     if (sub == 3)
3292       htmlFileP << "<h1> Pedestals for HO, RUN = " << runnumber << " </h1>" << std::endl;
3293     if (sub == 4)
3294       htmlFileP << "<h1> Pedestals for HF, RUN = " << runnumber << " </h1>" << std::endl;
3295     htmlFileP << "<br>" << std::endl;
3296 
3297     // Pedestal:
3298     htmlFileP << "<h2> 1.Pm criterion: Pedestals for each CapID .</h3>" << std::endl;
3299     htmlFileP << "<h3> 1.A. Pedestal distribution over all events, channels for each CapID and all depths.</h3>"
3300               << std::endl;
3301     htmlFileP << "<h4> Legend: Bins less " << Pedest[0][sub] << " correpond to bad Pedestals </h4>" << std::endl;
3302     if (sub == 1)
3303       htmlFileP << " <img src=\"HistPedestalsHB.png\" />" << std::endl;
3304     if (sub == 2)
3305       htmlFileP << " <img src=\"HistPedestalsHE.png\" />" << std::endl;
3306     if (sub == 3)
3307       htmlFileP << " <img src=\"HistPedestalsHO.png\" />" << std::endl;
3308     if (sub == 4)
3309       htmlFileP << " <img src=\"HistPedestalsHF.png\" />" << std::endl;
3310     htmlFileP << "<br>" << std::endl;
3311     htmlFileP << "<h3> 1.B. Rate of channels at very low Pedestals at least in one CapID for each depth.</h3>"
3312               << std::endl;
3313     htmlFileP << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
3314     if (sub == 1)
3315       htmlFileP << " <img src=\"MapRatePedHB.png\" />" << std::endl;
3316     if (sub == 2)
3317       htmlFileP << " <img src=\"MapRatePedHE.png\" />" << std::endl;
3318     if (sub == 3)
3319       htmlFileP << " <img src=\"MapRatePedHO.png\" />" << std::endl;
3320     if (sub == 4)
3321       htmlFileP << " <img src=\"MapRatePedHF.png\" />" << std::endl;
3322 
3323     // PedestalWidth:
3324     htmlFileP << "<h2> 2.pWm criterion: Pedestal Widths for each CapID .</h3>" << std::endl;
3325     htmlFileP << "<h3> 2.A. Pedestal Widths distribution over all events, channels for each CapID and all depths.</h3>"
3326               << std::endl;
3327     htmlFileP << "<h4> Legend: Bins less " << Pedest[1][sub] << " correpond to bad Pedestal Widths </h4>" << std::endl;
3328     if (sub == 1)
3329       htmlFileP << " <img src=\"HistPedestalWidthsHB.png\" />" << std::endl;
3330     if (sub == 2)
3331       htmlFileP << " <img src=\"HistPedestalWidthsHE.png\" />" << std::endl;
3332     if (sub == 3)
3333       htmlFileP << " <img src=\"HistPedestalWidthsHO.png\" />" << std::endl;
3334     if (sub == 4)
3335       htmlFileP << " <img src=\"HistPedestalWidthsHF.png\" />" << std::endl;
3336     htmlFileP << "<br>" << std::endl;
3337     htmlFileP << "<h3> 2.B. Rate of channels at very low Pedestal Widths at least in one CapID for each depth.</h3>"
3338               << std::endl;
3339     htmlFileP << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
3340     if (sub == 1)
3341       htmlFileP << " <img src=\"MapRatePedWidthsHB.png\" />" << std::endl;
3342     if (sub == 2)
3343       htmlFileP << " <img src=\"MapRatePedWidthsHE.png\" />" << std::endl;
3344     if (sub == 3)
3345       htmlFileP << " <img src=\"MapRatePedWidthsHO.png\" />" << std::endl;
3346     if (sub == 4)
3347       htmlFileP << " <img src=\"MapRatePedWidthsHF.png\" />" << std::endl;
3348 
3349     // Correlations of Pedestal(Width) and fullAmplitude:
3350     htmlFileP << "<h2> 3.Pedestal and pedestalWidths vs Amplitude .</h3>" << std::endl;
3351     htmlFileP << "<h3> 3.A. Correlation of Pedestal(pedestalWidths) and Amplitude over all channels and events .</h3>"
3352               << std::endl;
3353     htmlFileP << "<h4> Legend: colour - entries </h4>" << std::endl;
3354     if (sub == 1)
3355       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHB.png\" />" << std::endl;
3356     if (sub == 2)
3357       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHE.png\" />" << std::endl;
3358     if (sub == 3)
3359       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHO.png\" />" << std::endl;
3360     if (sub == 4)
3361       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHF.png\" />" << std::endl;
3362     htmlFileP << "<br>" << std::endl;
3363 
3364     // TSs Shapes:
3365 
3366     htmlFileS << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
3367     htmlFileS << "<head>" << std::endl;
3368     htmlFileS << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
3369     htmlFileS << "<title> Remote Monitoring Tool Global</title>" << std::endl;
3370     htmlFileS << "<style type=\"text/css\">" << std::endl;
3371     htmlFileS << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
3372               << std::endl;
3373     htmlFileS << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
3374     htmlFileS << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
3375                  "text-align: center;}"
3376               << std::endl;
3377     htmlFileS << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
3378     htmlFileS << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
3379     htmlFileS << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
3380     htmlFileS << "</style>" << std::endl;
3381     htmlFileS << "<body>" << std::endl;
3382 
3383     if (sub == 1)
3384       htmlFileS << "<h1> ADC Shape for HB, RUN = " << runnumber << " </h1>" << std::endl;
3385     if (sub == 2)
3386       htmlFileS << "<h1> ADC Shape for HE, RUN = " << runnumber << " </h1>" << std::endl;
3387     if (sub == 3)
3388       htmlFileS << "<h1> ADC Shape for HO, RUN = " << runnumber << " </h1>" << std::endl;
3389     if (sub == 4)
3390       htmlFileS << "<h1> ADC Shape for HF, RUN = " << runnumber << " </h1>" << std::endl;
3391     htmlFileP << "<br>" << std::endl;
3392 
3393     htmlFileS << "<h2> 1.Mean ADC Shape </h3>" << std::endl;
3394     htmlFileS << "<h3> 1.A. ADC shape averaged over all good channels, depth and events.</h3>" << std::endl;
3395     //     htmlFileS << "<h4> Legend: Bins less "<<Pedest[0][sub]<<" correpond to bad Pedestals </h4>"<< std::endl;
3396     if (sub == 1)
3397       htmlFileS << " <img src=\"HistGoodTSshapesHB.png\" />" << std::endl;
3398     if (sub == 2)
3399       htmlFileS << " <img src=\"HistGoodTSshapesHE.png\" />" << std::endl;
3400     if (sub == 3)
3401       htmlFileS << " <img src=\"HistGoodTSshapesHO.png\" />" << std::endl;
3402     if (sub == 4)
3403       htmlFileS << " <img src=\"HistGoodTSshapesHF.png\" />" << std::endl;
3404     htmlFileS << "<br>" << std::endl;
3405     htmlFileS << "<h3> 1.B. ADC shape averaged over all bad channels, depth and events. Bad channels are selected by 5 "
3406                  "criteria: CapId, A, W, P, Pw</h3>"
3407               << std::endl;
3408     //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
3409     if (sub == 1)
3410       htmlFileS << " <img src=\"HistBadTSshapesHB.png\" />" << std::endl;
3411     if (sub == 2)
3412       htmlFileS << " <img src=\"HistBadTSshapesHE.png\" />" << std::endl;
3413     if (sub == 3)
3414       htmlFileS << " <img src=\"HistBadTSshapesHO.png\" />" << std::endl;
3415     if (sub == 4)
3416       htmlFileS << " <img src=\"HistBadTSshapesHF.png\" />" << std::endl;
3417 
3418     htmlFileS << "<h2> 2. ADC in Time Slice </h3>" << std::endl;
3419     htmlFileS << "<h3> 2.A. ADC counts  histogrammed over all channels, depth and events.</h3>" << std::endl;
3420     //     htmlFileS << "<h4> Legend: Bins less "<<Pedest[0][sub]<<" correpond to bad Pedestals </h4>"<< std::endl;
3421     if (sub == 1)
3422       htmlFileS << " <img src=\"Hist_ADC_HB_All.png\" />" << std::endl;
3423     if (sub == 2)
3424       htmlFileS << " <img src=\"Hist_ADC_HE_All.png\" />" << std::endl;
3425     if (sub == 3)
3426       htmlFileS << " <img src=\"Hist_ADC_HO_All.png\" />" << std::endl;
3427     if (sub == 4)
3428       htmlFileS << " <img src=\"Hist_ADC_HF_All.png\" />" << std::endl;
3429     htmlFileS << "<br>" << std::endl;
3430     htmlFileS << "<h3> 2.B. ADC counts  histogrammed over all channels and events for each depth separately. </h3>"
3431               << std::endl;
3432     //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
3433     if (sub == 1)
3434       htmlFileS << " <img src=\"Hist_ADC_HB_DS.png\" />" << std::endl;
3435     if (sub == 2)
3436       htmlFileS << " <img src=\"Hist_ADC_HE_DS.png\" />" << std::endl;
3437     if (sub == 3)
3438       htmlFileS << " <img src=\"Hist_ADC_HO_DS.png\" />" << std::endl;
3439     if (sub == 4)
3440       htmlFileS << " <img src=\"Hist_ADC_HF_DS.png\" />" << std::endl;
3441 
3442     htmlFileS << "<h2> 3. ADC Sum in Time Slice </h3>" << std::endl;
3443     htmlFileS << "<h3> 3.A. ADC Sum over all channels histogrammed over all events for each depth separately. </h3>"
3444               << std::endl;
3445     //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
3446     if (sub == 1)
3447       htmlFileS << " <img src=\"Hist_SumADC_HB.png\" />" << std::endl;
3448     if (sub == 2)
3449       htmlFileS << " <img src=\"Hist_SumADC_HE.png\" />" << std::endl;
3450     if (sub == 3)
3451       htmlFileS << " <img src=\"Hist_SumADC_HO.png\" />" << std::endl;
3452     if (sub == 4)
3453       htmlFileS << " <img src=\"Hist_SumADC_HF.png\" />" << std::endl;
3454 
3455     htmlFileS << "<h3> 3.B. ADC Sum over all channels histogrammed over all events for each depth separately. </h3>"
3456               << std::endl;
3457     //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
3458     if (sub == 1)
3459       htmlFileS << " <img src=\"Hist_SumADC_HB0.png\" />" << std::endl;
3460     if (sub == 2)
3461       htmlFileS << " <img src=\"Hist_SumADC_HE0.png\" />" << std::endl;
3462     if (sub == 3)
3463       htmlFileS << " <img src=\"Hist_SumADC_HO0.png\" />" << std::endl;
3464     if (sub == 4)
3465       htmlFileS << " <img src=\"Hist_SumADC_HF0.png\" />" << std::endl;
3466 
3467     htmlFileS << "<h3> 3.C. ADC Sum over all channels histogrammed over all events for each depth separately. </h3>"
3468               << std::endl;
3469     //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
3470     if (sub == 1)
3471       htmlFileS << " <img src=\"Hist_SumADC_HB1.png\" />" << std::endl;
3472     if (sub == 2)
3473       htmlFileS << " <img src=\"Hist_SumADC_HE1.png\" />" << std::endl;
3474     if (sub == 3)
3475       htmlFileS << " <img src=\"Hist_SumADC_HO1.png\" />" << std::endl;
3476     if (sub == 4)
3477       htmlFileS << " <img src=\"Hist_SumADC_HF1.png\" />" << std::endl;
3478 
3479     htmlFileS.close();
3480   }  // end sub
3481 
3482   //======================================================================
3483 
3484   //======================================================================
3485   // Creating subdet  html pages:
3486 
3487   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
3488     ofstream htmlFile;
3489     if (sub == 1)
3490       htmlFile.open("HB.html");
3491     if (sub == 2)
3492       htmlFile.open("HE.html");
3493     if (sub == 3)
3494       htmlFile.open("HO.html");
3495     if (sub == 4)
3496       htmlFile.open("HF.html");
3497 
3498     htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
3499     htmlFile << "<head>" << std::endl;
3500     htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
3501     htmlFile << "<title> Remote Monitoring Tool </title>" << std::endl;
3502     htmlFile << "<style type=\"text/css\">" << std::endl;
3503     htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
3504              << std::endl;
3505     htmlFile << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
3506     htmlFile << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
3507                 "text-align: center;}"
3508              << std::endl;
3509     htmlFile << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
3510     htmlFile << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
3511     htmlFile << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
3512     htmlFile << "   td.s5 { font-family: arial, arial ce, helvetica; background-color: #FF00FF; }" << std::endl;
3513     htmlFile << "   td.s6 { font-family: arial, arial ce, helvetica; background-color: #9ACD32; }" << std::endl;
3514     htmlFile << "   td.s7 { font-family: arial, arial ce, helvetica; background-color: #32CD32; }" << std::endl;
3515     htmlFile << "   td.s8 { font-family: arial, arial ce, helvetica; background-color: #00FFFF; }" << std::endl;
3516     htmlFile << "   td.s9 { font-family: arial, arial ce, helvetica; background-color: #FFE4E1; }" << std::endl;
3517     htmlFile << "   td.s10 { font-family: arial, arial ce, helvetica; background-color: #A0522D; }" << std::endl;
3518     htmlFile << "   td.s11 { font-family: arial, arial ce, helvetica; background-color: #1E90FF; }" << std::endl;
3519     htmlFile << "   td.s12 { font-family: arial, arial ce, helvetica; background-color: #00BFFF; }" << std::endl;
3520     htmlFile << "   td.s13 { font-family: arial, arial ce, helvetica; background-color: #FFFF00; }" << std::endl;
3521     htmlFile << "   td.s14 { font-family: arial, arial ce, helvetica; background-color: #B8860B; }" << std::endl;
3522     htmlFile << "</style>" << std::endl;
3523     htmlFile << "<body>" << std::endl;
3524     if (sub == 1)
3525       htmlFile << "<h1> HCAL BARREL, RUN = " << runnumber << " </h1>" << std::endl;
3526     if (sub == 2)
3527       htmlFile << "<h1> HCAL ENDCAP, RUN = " << runnumber << " </h1>" << std::endl;
3528     if (sub == 3)
3529       htmlFile << "<h1> HCAL OUTER, RUN = " << runnumber << " </h1>" << std::endl;
3530     if (sub == 4)
3531       htmlFile << "<h1> HCAL FORWARD, RUN = " << runnumber << " </h1>" << std::endl;
3532     htmlFile << "<br>" << std::endl;
3533 
3534     htmlFile << "<a name=\"Top\"></a>\n";
3535     htmlFile << "<b>Contents:<br>\n";
3536     htmlFile << "1. <a href=\"#AnalysisResults\">Analysis results</a><br>\n";
3537     htmlFile << "2. <a href=\"#Status\">Status</a><br>\n";
3538     htmlFile << "2A. <a href=\"#ChannelMap\">Channel map</a><br>\n";
3539     //   htmlFile << "2B. <a href=\"#BadChannels\">List of bad channels</a><br>\n";
3540     //   htmlFile << "2C. <a href=\"#BadPedestals\">List of channels with bad pedestals</a><br>\n";
3541 
3542     htmlFile << "<a name=\"AnalysisResults\"></a>\n";
3543     if (sub == 1)
3544       htmlFile << "<h2> 1. Analysis results for HB</h2>" << std::endl;
3545     if (sub == 2)
3546       htmlFile << "<h2> 1. Analysis results for HE</h2>" << std::endl;
3547     if (sub == 3)
3548       htmlFile << "<h2> 1. Analysis results for HO</h2>" << std::endl;
3549     if (sub == 4)
3550       htmlFile << "<h2> 1. Analysis results for HF</h2>" << std::endl;
3551     htmlFile << "<table width=\"400\">" << std::endl;
3552     htmlFile << "<tr>" << std::endl;
3553 
3554     if (sub == 1) {
3555       // AZ 12.03.2019
3556       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3557                << runnumber << "/HB_Tile.html\">Megatile Channels</a></td>" << std::endl;
3558       //     htmlFile << "  <td><a href=\"HB_Tile.html\">Megatile Channels</a></td>"<< std::endl;
3559 
3560       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HB_Calib.html\">Calibration Channels</a></td>"<< std::endl;
3561       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HB_Drift.html\">Gain Stability</a></td>"<< std::endl;
3562       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3563                << runnumber << "/HB_Pedestals.html\">Pedestals</a></td>" << std::endl;
3564       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3565                << runnumber << "/HB_Shapes.html\">ADC Shapes</a></td>" << std::endl;
3566     }
3567     if (sub == 2) {
3568       // AZ 12.03.2019
3569       htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3570                << runnumber << "/HE_Tile.html\">Megatile Channels</a></td>" << std::endl;
3571       //     htmlFile << "  <td><a href=\"HE_Tile.html\">Megatile Channels</a></td>"<< std::endl;
3572 
3573       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HE_Calib.html\">Calibration Channels</a></td>"<< std::endl;
3574       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HE_Drift.html\">Gain Stability</a></td>"<< std::endl;
3575       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3576                << runnumber << "/HE_Pedestals.html\">Pedestals</a></td>" << std::endl;
3577       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3578                << runnumber << "/HE_Shapes.html\">ADC Shapes</a></td>" << std::endl;
3579     }
3580     if (sub == 3) {
3581       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3582                << runnumber << "/HO_Tile.html\">Megatile Channels</a></td>" << std::endl;
3583       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HO_Calib.html\">Calibration Channels</a></td>"<< std::endl;
3584       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HO_Drift.html\">Gain Stability</a></td>"<< std::endl;
3585       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3586                << runnumber << "/HO_Pedestals.html\">Pedestals</a></td>" << std::endl;
3587       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3588                << runnumber << "/HO_Shapes.html\">ADC Shapes</a></td>" << std::endl;
3589     }
3590     if (sub == 4) {
3591       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3592                << runnumber << "/HF_Tile.html\">Megatile Channels</a></td>" << std::endl;
3593       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HF_Calib.html\">Calibration Channels</a></td>"<< std::endl;
3594       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HF_Drift.html\">Gain Stability</a></td>"<< std::endl;
3595       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3596                << runnumber << "/HF_Pedestals.html\">Pedestals</a></td>" << std::endl;
3597       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
3598                << runnumber << "/HF_Shapes.html\">ADC Shapes</a></td>" << std::endl;
3599     }
3600 
3601     htmlFile << "</tr>" << std::endl;
3602     htmlFile << "</table>" << std::endl;
3603     htmlFile << "<br>" << std::endl;
3604 
3605     htmlFile << "<a name=\"Status\"></a>\n";
3606     if (sub == 1)
3607       htmlFile << "<h2> 2.Status HB over all criteria </h2>" << std::endl;
3608     if (sub == 2)
3609       htmlFile << "<h2> 2.Status HE over all criteria </h2>" << std::endl;
3610     if (sub == 3)
3611       htmlFile << "<h2> 2.Status HO over all criteria </h2>" << std::endl;
3612     if (sub == 4)
3613       htmlFile << "<h2> 2.Status HF over all criteria </h2>" << std::endl;
3614 
3615     htmlFile << "<a name=\"ChannelMap\"></a>\n";
3616     htmlFile << "<h3> 2.A.Channel map for each Depth </h3>" << std::endl;
3617     htmlFile << "<h4> Channel legend: green - good, not yellow - suspicious(rate of failures at least 0.1), white - "
3618                 "not applicable or out of range </h4>"
3619              << std::endl;
3620     if (sub == 1)
3621       htmlFile << " <img src=\"MAPHB.png\" />" << std::endl;
3622     if (sub == 2)
3623       htmlFile << " <img src=\"MAPHE.png\" />" << std::endl;
3624     if (sub == 3)
3625       htmlFile << " <img src=\"MAPHO.png\" />" << std::endl;
3626     if (sub == 4)
3627       htmlFile << " <img src=\"MAPHF.png\" />" << std::endl;
3628     htmlFile << "<br>" << std::endl;
3629     htmlFile << "<a href=\"#Top\">to top</a><br>\n";
3630 
3631     /////////////////////////////////////////////////////////////////   AZ 19.03
3632     /*     
3633 //     htmlFile << "<h3> 2.B.List of Bad channels (rate > 0.1) and its rates for each RMT criteria (for GS - %) </h3>"<< std::endl;
3634 
3635      htmlFile << "<a name=\"BadChannels\"></a>\n";
3636      htmlFile << "<h3> 2.B.List of Bad channels (rate > 0.1) and its rates for each RMT criteria </h3>"<< std::endl;
3637 
3638      //htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
3639      //   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
3640   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
3641 
3642      htmlFile << "<table>"<< std::endl;     
3643      htmlFile << "<tr>";
3644      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
3645      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
3646      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
3647      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
3648      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
3649      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
3650      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
3651      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
3652      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
3653      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
3654      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
3655      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
3656      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
3657      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
3658      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
3659      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
3660      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
3661      htmlFile << "<td class=\"s5\" align=\"center\">Cm</td>"   << std::endl;
3662      htmlFile << "<td class=\"s5\" align=\"center\">Am</td>"   << std::endl;
3663      htmlFile << "<td class=\"s5\" align=\"center\">Wm</td>"   << std::endl;
3664      htmlFile << "<td class=\"s5\" align=\"center\">Rm</td>"   << std::endl;
3665      htmlFile << "<td class=\"s5\" align=\"center\">TNm</td>"   << std::endl;
3666      htmlFile << "<td class=\"s5\" align=\"center\">TXm</td>"   << std::endl;
3667 //     htmlFile << "<td class=\"s8\" align=\"center\">Cc</td>"   << std::endl;
3668 //     htmlFile << "<td class=\"s8\" align=\"center\">Ac</td>"   << std::endl;
3669 //     htmlFile << "<td class=\"s8\" align=\"center\">Wc</td>"   << std::endl;
3670 //     htmlFile << "<td class=\"s8\" align=\"center\">Rc</td>"   << std::endl;
3671 //     htmlFile << "<td class=\"s8\" align=\"center\">TNc</td>"   << std::endl;
3672 //     htmlFile << "<td class=\"s8\" align=\"center\">TXc</td>"   << std::endl; 
3673 //     htmlFile << "<td class=\"s9\" align=\"center\">GS (%)</td>"   << std::endl;
3674      htmlFile << "<td class=\"s4\" align=\"center\">Pm</td>"   << std::endl;
3675      htmlFile << "<td class=\"s4\" align=\"center\">pWm</td>"   << std::endl;
3676      htmlFile << "</tr>"   << std::endl;     
3677    
3678      for (int i=1;i<=NBad;i++) {
3679         if((ind%2)==1){
3680            raw_class="<td class=\"s2\" align=\"center\">";
3681        raw_class1="<td class=\"s6\" align=\"center\">";
3682        raw_class2="<td class=\"s11\" align=\"center\">";
3683        raw_class3="<td class=\"s13\" align=\"center\">";
3684        
3685         }else{
3686            raw_class="<td class=\"s3\" align=\"center\">";
3687        raw_class1="<td class=\"s7\" align=\"center\">";
3688        raw_class2="<td class=\"s12\" align=\"center\">";
3689        raw_class3="<td class=\"s14\" align=\"center\">";
3690         }
3691         const CellDB db;
3692         CellDB ce;
3693     if ((ce.size()>=1)&&(Sub[2][i]==sub)) {
3694     // AZ 19.03.2018
3695     
3696 // AZ 19           if (Sub[2][i]==1) {
3697 // AZ 19          ce = db.find("subdet", "HB").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
3698 // AZ 19          if (ce.size()==0) {cout<<"Error: No such HB, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl; continue;}
3699 // AZ 19          else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HB, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;}
3700 // AZ 19          }
3701 // AZ 19       if (Sub[2][i]==2) {
3702 // AZ 19          ce = db.find("subdet", "HE").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
3703 // AZ 19          if (ce.size()==0) {cout<<"Error: No such HE, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;continue;}
3704 // AZ 19          else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HE, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;}    
3705 // AZ 19          }
3706 // AZ 19       if (Sub[2][i]==3) {
3707 // AZ 19          ce = db.find("subdet", "HO").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
3708 // AZ 19          if (ce.size()==0) {cout<<"Error: No such HO, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;continue;}
3709 // AZ 19          else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HO, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;}    
3710 // AZ 19          }    
3711 // AZ 19       if (Sub[2][i]==4) {
3712 // AZ 19          ce = db.find("subdet", "HF").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
3713 // AZ 19          if (ce.size()==0) {cout<<"Error: No such HF, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;continue;}
3714 // AZ 19          else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HF, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;}    
3715 // AZ 19          }
3716     
3717        htmlFile << "<tr>"<< std::endl;
3718            htmlFile << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
3719            htmlFile << raw_class<< Eta[2][i]<<"</td>"<< std::endl;
3720            htmlFile << raw_class<< Phi[2][i]<<"</td>"<< std::endl;
3721            htmlFile << raw_class<< Depth[2][i] <<"</td>"<< std::endl;
3722            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
3723            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
3724            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
3725            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
3726            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
3727            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
3728            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
3729            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
3730            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
3731            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
3732            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
3733            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
3734            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
3735        htmlFile << raw_class1<< Map_Ampl[1][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3736            htmlFile << raw_class1<< Map_Ampl[2][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3737        htmlFile << raw_class1<< Map_Ampl[3][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3738        htmlFile << raw_class1<< Map_Ampl[4][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3739        htmlFile << raw_class1<< Map_Ampl[5][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3740        htmlFile << raw_class1<< Map_Ampl[6][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3741 //     htmlFile << raw_class2<< Map_Ampl[11][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3742 //         htmlFile << raw_class2<< Map_Ampl[12][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;  
3743 //     htmlFile << raw_class2<< Map_Ampl[13][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3744 //     htmlFile << raw_class2<< Map_Ampl[14][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3745 //     htmlFile << raw_class2<< Map_Ampl[15][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3746 //     htmlFile << raw_class2<< Map_Ampl[16][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3747 //     htmlFile << raw_class3<< Map_Ampl[21][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3748        htmlFile << raw_class<< Map_Ampl[31][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3749        htmlFile << raw_class<< Map_Ampl[32][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
3750        htmlFile << "</tr>" << std::endl;
3751 
3752         ind+=1;
3753     }
3754      } 
3755      htmlFile << "</table>" << std::endl;
3756      htmlFile << "<br>"<< std::endl;
3757      htmlFile << "<a href=\"#Top\">to top</a><br>\n";
3758 
3759     
3760      htmlFile << "<h3> 2.C.List of Gain unstable channels and its value in % (for other criterias - rate)</h3>"<< std::endl;
3761      htmlFile << "<table>"<< std::endl;         
3762      htmlFile << "<tr>";
3763      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
3764      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
3765      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
3766      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
3767      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
3768      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
3769      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
3770      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
3771      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
3772      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
3773      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
3774      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
3775      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
3776      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
3777      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
3778      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
3779      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
3780      htmlFile << "<td class=\"s5\" align=\"center\">Cm</td>"   << std::endl;
3781      htmlFile << "<td class=\"s5\" align=\"center\">Am</td>"   << std::endl;
3782      htmlFile << "<td class=\"s5\" align=\"center\">Wm</td>"   << std::endl;
3783      htmlFile << "<td class=\"s5\" align=\"center\">Rm</td>"   << std::endl;
3784      htmlFile << "<td class=\"s5\" align=\"center\">TNm</td>"   << std::endl;
3785      htmlFile << "<td class=\"s5\" align=\"center\">TXm</td>"   << std::endl;
3786 //     htmlFile << "<td class=\"s8\" align=\"center\">Cc</td>"   << std::endl;
3787 //     htmlFile << "<td class=\"s8\" align=\"center\">Ac</td>"   << std::endl;
3788 //     htmlFile << "<td class=\"s8\" align=\"center\">Wc</td>"   << std::endl;
3789 //     htmlFile << "<td class=\"s8\" align=\"center\">Rc</td>"   << std::endl;
3790 //     htmlFile << "<td class=\"s8\" align=\"center\">TNc</td>"   << std::endl;
3791 //     htmlFile << "<td class=\"s8\" align=\"center\">TXc</td>"   << std::endl; 
3792 //     htmlFile << "<td class=\"s9\" align=\"center\">GS(%)</td>"   << std::endl;
3793      htmlFile << "<td class=\"s4\" align=\"center\">Pm</td>"   << std::endl;
3794      htmlFile << "<td class=\"s4\" align=\"center\">pWm</td>"   << std::endl;
3795      htmlFile << "</tr>"   << std::endl;     
3796    
3797      for (int i=1;i<=NWarn;i++) {
3798         if((ind%2)==1){
3799            raw_class="<td class=\"s2\" align=\"center\">";
3800        raw_class1="<td class=\"s6\" align=\"center\">";
3801        raw_class2="<td class=\"s11\" align=\"center\">";
3802        raw_class3="<td class=\"s13\" align=\"center\">";
3803        
3804         }else{
3805            raw_class="<td class=\"s3\" align=\"center\">";
3806        raw_class1="<td class=\"s7\" align=\"center\">";
3807        raw_class2="<td class=\"s12\" align=\"center\">";
3808        raw_class3="<td class=\"s14\" align=\"center\">";
3809         }
3810         const CellDB db;
3811         CellDB ce;
3812     if ((ce.size()>=1)&&(Sub[1][i]==sub)) {
3813            if (Sub[1][i]==1) {
3814           ce = db.find("subdet", "HB").find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
3815           if (ce.size()==0) {cout<<"Error: No such HB, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
3816           else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HB, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
3817           }
3818        if (Sub[1][i]==2) {
3819           ce = db.find("subdet", "HE").find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
3820           if (ce.size()==0) {cout<<"Error: No such HE, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
3821           else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HE, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}    
3822           }
3823        if (Sub[1][i]==3) {
3824           ce = db.find("subdet", "HO").find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
3825           if (ce.size()==0) {cout<<"Error: No such HO, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
3826           else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HO, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}    
3827           }    
3828        if (Sub[1][i]==4) {
3829           ce = db.find("subdet", "HF").find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
3830           if (ce.size()==0) {cout<<"Error: No such HF, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
3831           else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HF, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}    
3832           } 
3833            htmlFile << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
3834            htmlFile << raw_class<< Eta[1][i]<<"</td>"<< std::endl;
3835            htmlFile << raw_class<< Phi[1][i]<<"</td>"<< std::endl;
3836            htmlFile << raw_class<< Depth[1][i] <<"</td>"<< std::endl;
3837            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
3838            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
3839            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
3840            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
3841            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
3842            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
3843            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
3844            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
3845            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
3846            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
3847            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
3848            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
3849            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
3850        htmlFile << raw_class1<< Map_Ampl[1][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3851            htmlFile << raw_class1<< Map_Ampl[2][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3852        htmlFile << raw_class1<< Map_Ampl[3][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3853        htmlFile << raw_class1<< Map_Ampl[4][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3854        htmlFile << raw_class1<< Map_Ampl[5][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3855        htmlFile << raw_class1<< Map_Ampl[6][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3856 //     htmlFile << raw_class2<< Map_Ampl[11][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3857 //           htmlFile << raw_class2<< Map_Ampl[12][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;    
3858 //     htmlFile << raw_class2<< Map_Ampl[13][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3859 //     htmlFile << raw_class2<< Map_Ampl[14][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3860 //     htmlFile << raw_class2<< Map_Ampl[15][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3861 //     htmlFile << raw_class2<< Map_Ampl[16][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3862 //     htmlFile << raw_class3<< Map_Ampl[21][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3863        htmlFile << raw_class<< Map_Ampl[31][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3864        htmlFile << raw_class<< Map_Ampl[32][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
3865        htmlFile << "</tr>" << std::endl;
3866        htmlFile << "</tr>" << std::endl;
3867            ind+=1;
3868     }
3869      } 
3870      htmlFile << "</table>" << std::endl; 
3871      htmlFile << "<br>"<< std::endl;
3872     
3873      
3874 //     htmlFile << "<h3> 2.D.List of channels with Bad Pedestals (rate > 0.1) and its rates (for GS - %)</h3>"<< std::endl;
3875      htmlFile << "<a name=\"BadPedestals\"></a>\n";
3876      htmlFile << "<h3> 2.C.List of channels with Bad Pedestals (rate > 0.1) and its rates </h3>"<< std::endl;
3877      htmlFile << "<table>"<< std::endl;         
3878      htmlFile << "<tr>";
3879      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
3880      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
3881      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
3882      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
3883      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
3884      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
3885      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
3886      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
3887      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
3888      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
3889      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
3890      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
3891      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
3892      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
3893      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
3894      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
3895      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
3896      htmlFile << "<td class=\"s5\" align=\"center\">Cm</td>"   << std::endl;
3897      htmlFile << "<td class=\"s5\" align=\"center\">Am</td>"   << std::endl;
3898      htmlFile << "<td class=\"s5\" align=\"center\">Wm</td>"   << std::endl;
3899      htmlFile << "<td class=\"s5\" align=\"center\">Rm</td>"   << std::endl;
3900      htmlFile << "<td class=\"s5\" align=\"center\">TNm</td>"   << std::endl;
3901      htmlFile << "<td class=\"s5\" align=\"center\">TXm</td>"   << std::endl;
3902 //     htmlFile << "<td class=\"s8\" align=\"center\">Cc</td>"   << std::endl;
3903 //     htmlFile << "<td class=\"s8\" align=\"center\">Ac</td>"   << std::endl;
3904 //     htmlFile << "<td class=\"s8\" align=\"center\">Wc</td>"   << std::endl;
3905 //     htmlFile << "<td class=\"s8\" align=\"center\">Rc</td>"   << std::endl;
3906 //     htmlFile << "<td class=\"s8\" align=\"center\">TNc</td>"   << std::endl;
3907 //     htmlFile << "<td class=\"s8\" align=\"center\">TXc</td>"   << std::endl; 
3908 //     htmlFile << "<td class=\"s9\" align=\"center\">GS(%)</td>"   << std::endl;
3909      htmlFile << "<td class=\"s4\" align=\"center\">Pm</td>"   << std::endl;
3910      htmlFile << "<td class=\"s4\" align=\"center\">pWm</td>"   << std::endl;
3911      htmlFile << "</tr>"   << std::endl;     
3912    
3913      for (int i=1;i<=NPed;i++) {
3914         if((ind%2)==1){
3915            raw_class="<td class=\"s2\" align=\"center\">";
3916        raw_class1="<td class=\"s6\" align=\"center\">";
3917        raw_class2="<td class=\"s11\" align=\"center\">";
3918        raw_class3="<td class=\"s13\" align=\"center\">";
3919        
3920         }else{
3921            raw_class="<td class=\"s3\" align=\"center\">";
3922        raw_class1="<td class=\"s7\" align=\"center\">";
3923        raw_class2="<td class=\"s12\" align=\"center\">";
3924        raw_class3="<td class=\"s14\" align=\"center\">";
3925         }
3926         const CellDB db;
3927         CellDB ce;
3928     if ((ce.size()>=1)&&(Sub[3][i]==sub)) {
3929     
3930     // AZ 19.03.2018
3931 // AZ 19           if (Sub[3][i]==1) {
3932 // AZ 19          ce = db.find("subdet", "HB").find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
3933 // AZ 19          if (ce.size()==0) {cout<<"Error: No such HB, Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;continue;}
3934 // AZ 19          else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HB, Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;}
3935 // AZ 19          }
3936 // AZ 19       if (Sub[3][i]==2) {
3937 // AZ 19          ce = db.find("subdet", "HE").find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
3938 // AZ 19          if (ce.size()==0) {cout<<"Error: No such HE, Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;continue;}
3939 // AZ 19          else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HE, Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;}    
3940 // AZ 19          }
3941 // AZ 19       if (Sub[3][i]==3) {
3942 // AZ 19          ce = db.find("subdet", "HO").find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
3943 // AZ 19          if (ce.size()==0) {cout<<"Error: No such HO, Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;continue;}
3944 // AZ 19          else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HO, Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;}    
3945 // AZ 19          }    
3946 // AZ 19       if (Sub[3][i]==4) {
3947 // AZ 19          ce = db.find("subdet", "HF").find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
3948 // AZ 19          if (ce.size()==0) {cout<<"Error: No such HF, Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;continue;}
3949 // AZ 19          else if (ce.size()>1) {cout<<"Warning: More than one line correspond to such HF, Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;}    
3950 // AZ 19          } 
3951        
3952            htmlFile << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
3953            htmlFile << raw_class<< Eta[3][i]<<"</td>"<< std::endl;
3954            htmlFile << raw_class<< Phi[3][i]<<"</td>"<< std::endl;
3955            htmlFile << raw_class<< Depth[3][i] <<"</td>"<< std::endl;
3956            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
3957            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
3958            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
3959            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
3960            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
3961            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
3962            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
3963            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
3964            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
3965            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
3966            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
3967            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
3968            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
3969        htmlFile << raw_class1<< Map_Ampl[1][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3970            htmlFile << raw_class1<< Map_Ampl[2][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3971        htmlFile << raw_class1<< Map_Ampl[3][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3972        htmlFile << raw_class1<< Map_Ampl[4][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3973        htmlFile << raw_class1<< Map_Ampl[5][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3974        htmlFile << raw_class1<< Map_Ampl[6][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3975 //     htmlFile << raw_class2<< Map_Ampl[11][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3976 //         htmlFile << raw_class2<< Map_Ampl[12][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;  
3977 //     htmlFile << raw_class2<< Map_Ampl[13][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3978 //     htmlFile << raw_class2<< Map_Ampl[14][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3979 //     htmlFile << raw_class2<< Map_Ampl[15][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3980 //     htmlFile << raw_class2<< Map_Ampl[16][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3981 //     htmlFile << raw_class3<< Map_Ampl[21][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3982        htmlFile << raw_class<< Map_Ampl[31][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3983        htmlFile << raw_class<< Map_Ampl[32][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
3984        htmlFile << "</tr>" << std::endl;
3985        htmlFile << "</tr>" << std::endl;
3986            ind+=1;
3987     }
3988      } 
3989      htmlFile << "</table><br>" << std::endl;
3990      htmlFile << "<a href=\"#Top\">to top</a><br>\n";
3991 */
3992     ///////////////////////////////////////////////////////////////   AZ 19.03.2018
3993 
3994     htmlFile << "</body> " << std::endl;
3995     htmlFile << "</html> " << std::endl;
3996     htmlFile.close();
3997   }
3998 
3999   //======================================================================
4000   // Creating description html file:
4001   ofstream htmlFile;
4002 
4003   //======================================================================
4004   /*
4005      htmlFile.open("HELP.html");  
4006      htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< std::endl;
4007      htmlFile << "<head>"<< std::endl;
4008      htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< std::endl;
4009      htmlFile << "<title> Remote Monitoring Tool </title>"<< std::endl;
4010      htmlFile << "<style type=\"text/css\">"<< std::endl;
4011      htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< std::endl;
4012      htmlFile << "   td.s0 { font-family: arial, arial ce, helvetica; }"<< std::endl;
4013      htmlFile << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
4014      htmlFile << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< std::endl;
4015      htmlFile << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< std::endl;
4016      htmlFile << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< std::endl;
4017      htmlFile << "</style>"<< std::endl;
4018      htmlFile << "<body>"<< std::endl;
4019      htmlFile << "<h1>  Description of Remote Monitoring Tool criteria for bad channel selection</h1>"<< std::endl;
4020      htmlFile << "<br>"<< std::endl;
4021      htmlFile << "<h3> - C means CAPID Errors assuming we inspect CAPID non-rotation,error & validation bits, and for this criterion - no need to apply any cuts to select bcs.</h3> "<< std::endl;
4022      htmlFile << "<br>"<< std::endl;
4023      htmlFile << "<h3> - A means full amplitude, collected over all time slices </h3> "<< std::endl;
4024      htmlFile << "<h3> - R means ratio criterion where we define as a bad, the channels, for which the signal portion in 4 middle TSs(plus one, minus two around TS with maximal amplitude) is out of some range of reasonable values </h3> "<< std::endl;
4025      htmlFile << "<br>"<< std::endl;
4026      htmlFile << "<h3> - W means width of shape distribution. Width is defined as square root from dispersion. </h3> "<< std::endl;
4027      htmlFile << "<br>"<< std::endl;
4028      htmlFile << "<h3> - TN means mean time position of adc signal. </h3> "<< std::endl;
4029      htmlFile << "<br>"<< std::endl;
4030      htmlFile << "<h3> - TX means TS number of maximum signal </h3> "<< std::endl;
4031      htmlFile << "<br>"<< std::endl;     
4032      htmlFile << "<h3> - m means megatile channels. For example Am means Amplitude criteria for megatile channels </h3> "<< std::endl;
4033      htmlFile << "<br>"<< std::endl;
4034      htmlFile << "<h3> - c means calibration channels. For example Ac means Amplitude criteria for calibration channels </h3> "<< std::endl;
4035      htmlFile << "<br>"<< std::endl;
4036      htmlFile << "<h3> - Pm means Pedestals. </h3> "<< std::endl;
4037      htmlFile << "<br>"<< std::endl;  
4038      htmlFile << "<h3> - pWm  means pedestal Width. </h3> "<< std::endl;
4039      htmlFile << "<br>"<< std::endl;
4040      htmlFile << "</body> " << std::endl;
4041      htmlFile << "</html> " << std::endl; 
4042      htmlFile.close();
4043 */
4044   //======================================================================
4045 
4046   //======================================================================
4047   // Creating main html file:
4048   htmlFile.open("MAP.html");
4049   htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
4050   htmlFile << "<head>" << std::endl;
4051   htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
4052   htmlFile << "<title> Remote Monitoring Tool </title>" << std::endl;
4053   htmlFile << "<style type=\"text/css\">" << std::endl;
4054   htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
4055            << std::endl;
4056   htmlFile << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
4057   htmlFile << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
4058               "text-align: center;}"
4059            << std::endl;
4060   htmlFile << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
4061   htmlFile << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
4062   htmlFile << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
4063   htmlFile << "   td.s5 { font-family: arial, arial ce, helvetica; background-color: #FF00FF; }" << std::endl;
4064   htmlFile << "   td.s6 { font-family: arial, arial ce, helvetica; background-color: #9ACD32; }" << std::endl;
4065   htmlFile << "   td.s7 { font-family: arial, arial ce, helvetica; background-color: #32CD32; }" << std::endl;
4066   htmlFile << "</style>" << std::endl;
4067   htmlFile << "<body>" << std::endl;
4068 
4069   htmlFile << "<h1> Remote Monitoring Tool, RUN = " << runnumber << ". </h1>" << std::endl;
4070   htmlFile << "<br>" << std::endl;
4071 
4072   htmlFile << "<h2> 1. Analysis results for subdetectors </h2>" << std::endl;
4073   htmlFile << "<table width=\"400\">" << std::endl;
4074   htmlFile << "<tr>" << std::endl;
4075 
4076   // AZ 12.03.2019
4077   /*
4078      htmlFile << "  <td><a href=\"HB.html\">HB</a></td>"<< std::endl;
4079      htmlFile << "  <td><a href=\"HE.html\">HE</a></td>"<< std::endl;
4080      htmlFile << "  <td><a href=\"HO.html\">HO</a></td>"<< std::endl;
4081      htmlFile << "  <td><a href=\"HF.html\">HF</a></td>"<< std::endl;    
4082 */
4083 
4084   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
4085            << runnumber << "/HB.html\">HB</a></td>" << std::endl;
4086   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
4087            << runnumber << "/HE.html\">HE</a></td>" << std::endl;
4088   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
4089            << runnumber << "/HO.html\">HO</a></td>" << std::endl;
4090   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
4091            << runnumber << "/HF.html\">HF</a></td>" << std::endl;
4092 
4093   htmlFile << "</tr>" << std::endl;
4094   htmlFile << "</table>" << std::endl;
4095   htmlFile << "<br>" << std::endl;
4096 
4097   htmlFile << "<h2> 2. HCAL status over all criteria and subdetectors </h2>" << std::endl;
4098   htmlFile << "<h3> 2.A. Channels in detector space </h3>" << std::endl;
4099   htmlFile << "<h4> Legend for channel status: green - good, others - may be a problems, white - not applicable or out "
4100               "of range </h4>"
4101            << std::endl;
4102   htmlFile << " <img src=\"MAP.png\" />" << std::endl;
4103   htmlFile << "<br>" << std::endl;
4104 
4105   htmlFile << "<h3> 2.B. List of Bad channels </h3>" << std::endl;
4106 
4107   //htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
4108   //   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
4109   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/HELP.html\"> "
4110               "Description of criteria for bad channel selection</a></td>"
4111            << std::endl;
4112 
4113   htmlFile << "<table>" << std::endl;
4114   htmlFile << "<tr>";
4115   htmlFile << "<td class=\"s4\" align=\"center\">#</td>" << std::endl;
4116   htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>" << std::endl;
4117   htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>" << std::endl;
4118   htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>" << std::endl;
4119   htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>" << std::endl;
4120   htmlFile << "<td class=\"s1\" align=\"center\">RM</td>" << std::endl;
4121   htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>" << std::endl;
4122   htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>" << std::endl;
4123   htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>" << std::endl;
4124   htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>" << std::endl;
4125   htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>" << std::endl;
4126   htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>" << std::endl;
4127   htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>" << std::endl;
4128   htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>" << std::endl;
4129   htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>" << std::endl;
4130   htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>" << std::endl;
4131   htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>" << std::endl;
4132   htmlFile << "<td class=\"s5\" align=\"center\">RMT-criteria</td>" << std::endl;
4133   htmlFile << "</tr>" << std::endl;
4134 
4135   ind = 0;
4136   // AZ 19.03.2018
4137   /*     
4138      for (int i=1;i<=NBad;i++) {
4139         if((ind%2)==1){
4140            raw_class="<td class=\"s2\" align=\"center\">";
4141        raw_class1="<td class=\"s6\" align=\"center\">";
4142         }else{
4143            raw_class="<td class=\"s3\" align=\"center\">";
4144        raw_class1="<td class=\"s7\" align=\"center\">";
4145         }
4146         const CellDB db;
4147         const CellDB ce = db.find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
4148     //           if (ce.size()==0) {cout<<"Error: No such Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;continue;}
4149 //  else if (ce.size()>1) { cout<<"Warning: More than one line correspond to such Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;}
4150     
4151     if (ce.size()>=1) {
4152        htmlFile << "<tr>"<< std::endl;
4153            htmlFile << "<td class=\"s1\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
4154            htmlFile << raw_class<< Eta[2][i]<<"</td>"<< std::endl;
4155            htmlFile << raw_class<< Phi[2][i]<<"</td>"<< std::endl;
4156            htmlFile << raw_class<< Depth[2][i] <<"</td>"<< std::endl;
4157            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
4158            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
4159            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
4160            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
4161            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
4162            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
4163            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
4164            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
4165            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
4166            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
4167            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
4168            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
4169            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
4170            htmlFile << raw_class1<< Comment[2][i]<<"</td>"<< std::endl;
4171        htmlFile << "</tr>" << std::endl;
4172 
4173         ind+=1;
4174     }
4175      } /// end loop
4176 */
4177   htmlFile << "</table>" << std::endl;
4178   htmlFile << "<br>" << std::endl;
4179   /*     
4180      htmlFile << "<h3> 2.C.List of Gain unstable channels </h3>"<< std::endl;
4181      //htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
4182      //   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
4183   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
4184 
4185      htmlFile << "<table>"<< std::endl;     
4186      htmlFile << "<tr>";
4187      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
4188      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
4189      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
4190      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
4191      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
4192      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
4193      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
4194      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
4195      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
4196      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
4197      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
4198      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
4199      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
4200      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
4201      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
4202      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
4203      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
4204      htmlFile << "<td class=\"s5\" align=\"center\">Failed criteria</td>"   << std::endl;
4205      htmlFile << "</tr>"   << std::endl;     
4206    
4207      for (int i=1;i<=NWarn;i++) {
4208         if((ind%2)==1){
4209            raw_class="<td class=\"s2\" align=\"center\">";
4210        raw_class1="<td class=\"s6\" align=\"center\">";
4211         }else{
4212            raw_class="<td class=\"s3\" align=\"center\">";
4213        raw_class1="<td class=\"s7\" align=\"center\">";
4214         }
4215         const CellDB db;
4216         const CellDB ce = db.find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
4217     //      if (ce.size()==0) {cout<<"Error: No such Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;continue;}
4218 //  else if (ce.size()>1) { cout<<"Warning: More than one line correspond to such Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
4219     
4220     if (ce.size()>=1) {
4221        htmlFile << "<tr>"<< std::endl;
4222            htmlFile << "<td class=\"s1\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
4223            htmlFile << raw_class<< Eta[1][i]<<"</td>"<< std::endl;
4224            htmlFile << raw_class<< Phi[1][i]<<"</td>"<< std::endl;
4225            htmlFile << raw_class<< Depth[1][i] <<"</td>"<< std::endl;
4226            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
4227            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
4228            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
4229            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
4230            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
4231            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
4232            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
4233            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
4234            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
4235            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
4236            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
4237            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
4238            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
4239            htmlFile << raw_class1<< Comment[1][i]<<"</td>"<< std::endl;
4240        htmlFile << "</tr>" << std::endl;
4241 
4242            ind+=1;
4243     }
4244      } 
4245     
4246    
4247      htmlFile << "</table>" << std::endl;
4248      htmlFile << "<br>"<< std::endl;
4249      
4250      
4251      htmlFile << "<h3> 2.D.List of channels with bad Pedestals </h3>"<< std::endl;
4252      // htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
4253      //   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
4254   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
4255 
4256      htmlFile << "<table>"<< std::endl;     
4257      htmlFile << "<tr>";
4258      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
4259      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
4260      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
4261      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
4262      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
4263      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
4264      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
4265      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
4266      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
4267      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
4268      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
4269      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
4270      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
4271      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
4272      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
4273      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
4274      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
4275      htmlFile << "<td class=\"s5\" align=\"center\">Failed criteria</td>"   << std::endl;
4276      htmlFile << "</tr>"   << std::endl;     
4277    
4278      for (int i=1;i<=NPed;i++) {
4279         if((ind%2)==1){
4280            raw_class="<td class=\"s2\" align=\"center\">";
4281        raw_class1="<td class=\"s6\" align=\"center\">";
4282         }else{
4283            raw_class="<td class=\"s3\" align=\"center\">";
4284        raw_class1="<td class=\"s7\" align=\"center\">";
4285         }
4286         const CellDB db;
4287         const CellDB ce = db.find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
4288     //      if (ce.size()==0) {cout<<"Error: No such Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;continue;}
4289 //  else if (ce.size()>1) { cout<<"Warning: More than one line correspond to such Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
4290     
4291     if (ce.size()>=1) {
4292        htmlFile << "<tr>"<< std::endl;
4293            htmlFile << "<td class=\"s1\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
4294            htmlFile << raw_class<< Eta[3][i]<<"</td>"<< std::endl;
4295            htmlFile << raw_class<< Phi[3][i]<<"</td>"<< std::endl;
4296            htmlFile << raw_class<< Depth[3][i] <<"</td>"<< std::endl;
4297            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
4298            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
4299            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
4300            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
4301            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
4302            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
4303            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
4304            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
4305            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
4306            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
4307            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
4308            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
4309            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
4310            htmlFile << raw_class1<< Comment[3][i]<<"</td>"<< std::endl;
4311        htmlFile << "</tr>" << std::endl;
4312 
4313            ind+=1;
4314     }
4315      } 
4316     
4317    
4318      htmlFile << "</table>" << std::endl;
4319 */
4320   htmlFile << "</body> " << std::endl;
4321   htmlFile << "</html> " << std::endl;
4322   htmlFile.close();
4323   //======================================================================
4324 
4325   //======================================================================
4326   // Close and delete all possible things:
4327   hfile->Close();
4328   //  hfile->Delete();
4329   //  Exit Root
4330   gSystem->Exit(0);
4331   //======================================================================
4332 }