Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-08 02:26:11

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   std::string dirnm = "Analyzer";
0037   gROOT->Reset();
0038   gROOT->SetStyle("Plain");
0039   gStyle->SetOptStat(0);
0040   gStyle->SetOptTitle(1);
0041 
0042   if (argc < 2)
0043     return 1;
0044   char fname[300];
0045   char refname[300];
0046   sprintf(fname, "%s", argv[1]);
0047   sprintf(refname, "%s", argv[2]);
0048 
0049   cout << fname << " " << refname << std::endl;
0050 
0051   //
0052 
0053   //======================================================================
0054   // Connect the input files, parameters and get the 2-d histogram in memory
0055   //    TFile *hfile= new TFile("GlobalHist.root", "READ");
0056   string promt = (string)fname;
0057   string runnumber = "";
0058   for (unsigned int i = promt.size() - 11; i < promt.size() - 5; i++)
0059     runnumber += fname[i];
0060   string refrunnumber = "";
0061   promt = (string)refname;
0062   for (unsigned int i = promt.size() - 11; i < promt.size() - 5; i++)
0063     refrunnumber += refname[i];
0064 
0065   TFile *hfile = new TFile(fname, "READ");
0066   hfile->ls();
0067   TDirectory *dir = (TDirectory *)hfile->FindObjectAny(dirnm.c_str());
0068   //TFile *hreffile = new TFile(refname, "READ");
0069   //megatile channels
0070   //CUTS:    [test][subdetector]             CapID(Test=1;  ADC amplitude Am(Test= 2);  Width for Wm(Test=3);     Ratio cut for Rm(Test=4);  TS mean for TNm(test=5);   TS max  for TXm(Test=6);
0071   double MIN_M[7][5] = {{0., 0., 0., 0., 0.},
0072                         {0., 0., 0., 0., 0.},
0073                         {0, 0., 0., 0., 0.},
0074                         {0, 1.0, 1.0, 0.2, 0.1},
0075                         {0, 0.10, 0.10, 0.18, 0.30},
0076                         {0, 0.8, 0.8, 0.8, 0.1},
0077                         {0, -0.5, -0.5, -0.5, -0.5}};
0078   double MAX_M[7][5] = {{0., 0., 0., 0., 0.},
0079                         {0., 0., 0., 0., 0.},
0080                         {0, 900, 900, 9000, 3000},
0081                         {0, 3.9, 3.9, 4.4, 2.0},
0082                         {0, 0.95, 0.98, 0.96, 1.04},
0083                         {0, 8.0, 8.0, 8.0, 2.8},
0084                         {0, 6.5, 6.5, 6.5, 3.5}};
0085 
0086   // calibration channels:
0087   double MIN_C[7][5] = {{0., 0., 0., 0., 0.},
0088                         {0., 0., 0., 0., 0.},
0089                         {0, 120., 120., 120., 60.},
0090                         {0, 1.0, 1.0, 0.50, 0.2},
0091                         {0, 0.6, 0.64, 0.25, 0.25},
0092                         {0, 1.0, 1.0, 1.0, 1.0},
0093                         {0, 0.5, 0.5, 0.5, 0.5}};
0094   double MAX_C[7][5] = {{0., 0., 0., 0., 0.},
0095                         {0., 0., 0., 0., 0.},
0096                         {0, 1E20, 1E20, 1E20, 1E20},
0097                         {0, 2.3, 2.3, 3.0, 2.3},
0098                         {0, 1., 1., 1., 1.00},
0099                         {0, 5.5, 5.5, 3.5, 5.2},
0100                         {0, 8.5, 8.5, 8.5, 9.5}};
0101   double porog[5] = {0., 2., 2., 5., 1.};  // Cut for GS test in pro cents
0102   //    double porog[5] = {0., 200., 200., 100., 100.}; // Cut for GS test in pro cents
0103   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
0104   //======================================================================
0105   // with TfileService implementation, change everywhere below:     hfile->Get     to     dir->FindObjectAny
0106   //======================================================================
0107   // Prepare histograms and plot them to .png files
0108 
0109   //TCanvas *cHB = new TCanvas("cHB","cHB",1000,500);
0110   TCanvas *cHB = new TCanvas("cHB", "cHB", 1000, 1000);
0111   //TCanvas *cHE = new TCanvas("cHE","cHE",1500,500);
0112   TCanvas *cHE = new TCanvas("cHE", "cHE", 1500, 1500);
0113   //  TCanvas *cONE = new TCanvas("cONE","cONE",500,500);
0114   TCanvas *cONE = new TCanvas("cONE", "cONE", 1500, 500);
0115   TCanvas *cPED = new TCanvas("cPED", "cPED", 1000, 500);
0116   //TCanvas *cHF = new TCanvas("cHF","cHF",1000,1000);
0117   TCanvas *cHF = new TCanvas("cHF", "cHF", 1000, 1000);
0118 
0119   char *str = (char *)alloca(10000);
0120 
0121   // before upgrade 2017:
0122   // depth: HB depth1,2; HE depth1,2,3; HO depth4; HF depth1,2
0123   // 5 depthes:  0(empty),   1,2,3,4
0124 
0125   // upgrade 2017:
0126   // depth: HB depth1,2; HE depth1,2,3,4,5,6,7; HO depth4; HF depth1,2,3,4
0127   // 8 depthes:  0(empty),   1,2,3,4,5,6,7
0128 
0129   // upgrade 2019:
0130   // depth: HB depth1,2,3,4; HE depth1,2,3,4,5,6,7; HO depth4; HF depth1,2,3,4
0131   // 10 depthes:  0(empty),   1,2,3,4,5,6,7,8,9
0132 
0133   //  Int_t ALLDEPTH = 5;
0134   //  Int_t ALLDEPTH = 8;
0135   Int_t ALLDEPTH = 10;
0136   //massive_indx=1  2  3  4  5
0137   //             0, HB,HE,HO,HF
0138   int k_min[5] = {0, 1, 1, 4, 1};  // minimum depth for each subdet
0139 
0140   //int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0141   //int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0142   int k_max[5] = {0, 4, 7, 4, 4};  // maximum depth for each subdet
0143 
0144   TH2F *Map_Ampl[33][5][ALLDEPTH];       // 2D histogramm for test,subdet,depth
0145   TH2F *Map_SUBGOOD[5][ALLDEPTH];        // 2d histogramm for subdet, depth
0146   TH2F *Map_SUB[5][ALLDEPTH];            // 2d histogramm for subdet, depth
0147   TH1F *HistAmplDepth[22][5][ALLDEPTH];  // 1d histogramm for test,subdet, depth
0148   TH1F *HistAmpl[22][5];                 // 1d histogramm for test,subdet
0149   TH2F *Map_SUBTS[5][ALLDEPTH];          // 2d histogramm for subdet, depth in different TSs
0150 
0151   TH1F *HistPed[3][5][4];           // 1d  histogramm for test,subdet, CapID
0152   TH2F *Map_Ped[3][5];              // 2d  histogramm for test,subdet -> test 33
0153   TH1F *hist_GoodTSshape[5];        // 1d  histogramm for TS shape subdet -> test 41
0154   TH1F *hist_GoodTSshape0[5];       // 1d  histogramm for TS shape subdet -> test 41
0155   TH1F *hist_BadTSshape[5];         // 1d  histogramm for TS shape subdet -> test 41
0156   TH1F *hist_BadTSshape0[5];        // 1d  histogramm for TS shape subdet -> test 41
0157   TH1F *hist_ADC_All[5];            // 1d  histogramm for TS shape subdet -> test 42
0158   TH1F *hist_ADC_DS[5][ALLDEPTH];   // 1d  histogramm for TS shape subdet, depth -> test 42
0159   TH1F *hist_SumADC[5][ALLDEPTH];   // 1d  histogramm for TS shape subdet, depth -> test 43
0160   TH1F *hist_SumADC0[5][ALLDEPTH];  // 1d  histogramm for TS shape subdet, depth -> test 43
0161   TH1F *hist_SumADC1[5][ALLDEPTH];  // 1d  histogramm for TS shape subdet, depth -> test 43
0162 
0163   Map_SUB[1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HB");
0164   Map_SUB[1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HB");
0165   Map_SUB[1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HB");
0166   Map_SUB[1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HB");
0167   Map_SUB[2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HE");
0168   Map_SUB[2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HE");
0169   Map_SUB[2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HE");
0170   Map_SUB[2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HE");
0171   Map_SUB[2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5_HE");
0172   Map_SUB[2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6_HE");
0173   Map_SUB[2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7_HE");
0174   Map_SUB[3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HO");
0175   Map_SUB[4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HF");
0176   Map_SUB[4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HF");
0177   Map_SUB[4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HF");
0178   Map_SUB[4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HF");
0179 
0180   Map_SUBGOOD[1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HB");
0181   Map_SUBGOOD[1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HB");
0182   Map_SUBGOOD[1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HB");
0183   Map_SUBGOOD[1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HB");
0184   Map_SUBGOOD[2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HE");
0185   Map_SUBGOOD[2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HE");
0186   Map_SUBGOOD[2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HE");
0187   Map_SUBGOOD[2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HE");
0188   Map_SUBGOOD[2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5_HE");
0189   Map_SUBGOOD[2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6_HE");
0190   Map_SUBGOOD[2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7_HE");
0191   Map_SUBGOOD[3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HO");
0192   Map_SUBGOOD[4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HF");
0193   Map_SUBGOOD[4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HF");
0194   Map_SUBGOOD[4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HF");
0195   Map_SUBGOOD[4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HF");
0196 
0197   //+++++++++++++++++++++++++++++
0198   //Test 0 Entries
0199   //+++++++++++++++++++++++++++++
0200 
0201   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0202                                         //     if (sub==1) cHB->Divide(2,1);
0203     if (sub == 1)
0204       cHB->Divide(2, 2);
0205     //     if (sub==2) cHE->Divide(3,1);
0206     if (sub == 2)
0207       cHE->Divide(3, 3);
0208     if (sub == 3)
0209       cONE->Divide(1, 1);
0210     //     if (sub==4) cHF->Divide(2,1);
0211     if (sub == 4)
0212       cHF->Divide(2, 2);
0213     //     int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0214     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0215     //     int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0216     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0217       if (sub == 1)
0218         cHB->cd(k);
0219       if (sub == 2)
0220         cHE->cd(k);
0221       if (sub == 3)
0222         cONE->cd(k - 3);
0223       if (sub == 4)
0224         cHF->cd(k);
0225       gPad->SetGridy();
0226       gPad->SetGridx();
0227       gPad->SetLogz();
0228       if (sub == 1)
0229         sprintf(str, "HB, Depth%d \b", k);
0230       if (sub == 2)
0231         sprintf(str, "HE, Depth%d \b", k);
0232       if (sub == 3)
0233         sprintf(str, "HO, Depth%d \b", k);
0234       if (sub == 4)
0235         sprintf(str, "HF, Depth%d \b", k);
0236       Map_SUB[sub][k]->SetTitle(str);
0237       Map_SUB[sub][k]->SetXTitle("#eta \b");
0238       Map_SUB[sub][k]->SetYTitle("#phi \b");
0239       Map_SUB[sub][k]->SetZTitle("Number of events \b");
0240       if (sub == 3)
0241         Map_SUB[sub][k]->SetTitleOffset(0.8, "Z");
0242       Map_SUB[sub][k]->Draw("COLZ");
0243       Map_SUB[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0244       //            Map_SUB[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0245       if (sub == 1) {
0246         cHB->Modified();
0247         cHB->Update();
0248       }
0249       if (sub == 2) {
0250         cHE->Modified();
0251         cHE->Update();
0252       }
0253       if (sub == 3) {
0254         cONE->Modified();
0255         cONE->Update();
0256       }
0257       if (sub == 4) {
0258         cHF->Modified();
0259         cHF->Update();
0260       }
0261     }  //end depth
0262 
0263     if (sub == 1) {
0264       cHB->Print("MapRateEntryHB.png");
0265       cHB->Clear();
0266     }
0267     if (sub == 2) {
0268       cHE->Print("MapRateEntryHE.png");
0269       cHE->Clear();
0270     }
0271     if (sub == 3) {
0272       cONE->Print("MapRateEntryHO.png");
0273       cONE->Clear();
0274     }
0275     if (sub == 4) {
0276       cHF->Print("MapRateEntryHF.png");
0277       cHF->Clear();
0278     }
0279   }  // end sub
0280 
0281   //+++++++++++++++++++++++++++++
0282   //Test 1 (Cm) Rate of Cap ID errors
0283   //+++++++++++++++++++++++++++++
0284 
0285   Map_Ampl[1][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HB");
0286   Map_Ampl[1][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HB");
0287   Map_Ampl[1][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HE");
0288   Map_Ampl[1][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HE");
0289   Map_Ampl[1][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Error_HE");
0290   Map_Ampl[1][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HO");
0291   Map_Ampl[1][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HF");
0292   Map_Ampl[1][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HF");
0293 
0294   Map_Ampl[1][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HE");
0295   Map_Ampl[1][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5Error_HE");
0296   Map_Ampl[1][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6Error_HE");
0297   Map_Ampl[1][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7Error_HE");
0298   Map_Ampl[1][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Error_HF");
0299   Map_Ampl[1][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HF");
0300 
0301   Map_Ampl[1][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Error_HB");
0302   Map_Ampl[1][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HB");
0303 
0304   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0305                                         //     if (sub==1) cHB->Divide(2,1);
0306     if (sub == 1)
0307       cHB->Divide(2, 2);
0308     //     if (sub==2) cHE->Divide(3,1);
0309     if (sub == 2)
0310       cHE->Divide(3, 3);
0311     if (sub == 3)
0312       cONE->Divide(1, 1);
0313     //     if (sub==4) cHF->Divide(2,1);
0314     if (sub == 4)
0315       cHF->Divide(2, 2);
0316     //     int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0317     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0318     //     int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0319     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0320       if (sub == 1)
0321         cHB->cd(k);
0322       if (sub == 2)
0323         cHE->cd(k);
0324       if (sub == 3)
0325         cONE->cd(k - 3);
0326       if (sub == 4)
0327         cHF->cd(k);
0328       Map_Ampl[1][sub][k]->Divide(Map_Ampl[1][sub][k], Map_SUB[sub][k], 1, 1, "B");
0329       gPad->SetGridy();
0330       gPad->SetGridx();
0331       gPad->SetLogz();
0332       if (sub == 1)
0333         sprintf(str, "HB, Depth%d \b", k);
0334       if (sub == 2)
0335         sprintf(str, "HE, Depth%d \b", k);
0336       if (sub == 3)
0337         sprintf(str, "HO, Depth%d \b", k);
0338       if (sub == 4)
0339         sprintf(str, "HF, Depth%d \b", k);
0340       Map_Ampl[1][sub][k]->SetTitle(str);
0341       Map_Ampl[1][sub][k]->SetXTitle("#eta \b");
0342       Map_Ampl[1][sub][k]->SetYTitle("#phi \b");
0343       Map_Ampl[1][sub][k]->SetZTitle("Rate \b");
0344       if (sub == 3)
0345         Map_Ampl[1][sub][k]->SetTitleOffset(0.8, "Z");
0346       Map_Ampl[1][sub][k]->Draw("COLZ");
0347       Map_Ampl[1][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0348       Map_Ampl[1][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0349       if (sub == 1) {
0350         cHB->Modified();
0351         cHB->Update();
0352       }
0353       if (sub == 2) {
0354         cHE->Modified();
0355         cHE->Update();
0356       }
0357       if (sub == 3) {
0358         cONE->Modified();
0359         cONE->Update();
0360       }
0361       if (sub == 4) {
0362         cHF->Modified();
0363         cHF->Update();
0364       }
0365     }  //end depth
0366 
0367     if (sub == 1) {
0368       cHB->Print("MapRateCapIDHB.png");
0369       cHB->Clear();
0370     }
0371     if (sub == 2) {
0372       cHE->Print("MapRateCapIDHE.png");
0373       cHE->Clear();
0374     }
0375     if (sub == 3) {
0376       cONE->Print("MapRateCapIDHO.png");
0377       cONE->Clear();
0378     }
0379     if (sub == 4) {
0380       cHF->Print("MapRateCapIDHF.png");
0381       cHF->Clear();
0382     }
0383   }  // end sub
0384 
0385   //+++++++++++++++++++++++++++++
0386   //Test 2 (Am) ADC amplitude
0387   //+++++++++++++++++++++++++++++
0388 
0389   Map_Ampl[2][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1ADCAmpl225_HB");
0390   Map_Ampl[2][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2ADCAmpl225_HB");
0391   Map_Ampl[2][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1ADCAmpl225_HE");
0392   Map_Ampl[2][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2ADCAmpl225_HE");
0393   Map_Ampl[2][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3ADCAmpl225_HE");
0394   Map_Ampl[2][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4ADCAmpl225_HO");
0395   Map_Ampl[2][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1ADCAmpl225_HF");
0396   Map_Ampl[2][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2ADCAmpl225_HF");
0397 
0398   Map_Ampl[2][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4ADCAmpl225_HE");
0399   Map_Ampl[2][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5ADCAmpl225_HE");
0400   Map_Ampl[2][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6ADCAmpl225_HE");
0401   Map_Ampl[2][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7ADCAmpl225_HE");
0402   Map_Ampl[2][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3ADCAmpl225_HF");
0403   Map_Ampl[2][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4ADCAmpl225_HF");
0404 
0405   Map_Ampl[2][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3ADCAmpl225_HB");
0406   Map_Ampl[2][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4ADCAmpl225_HB");
0407 
0408   HistAmpl[2][1] = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HB");
0409   HistAmpl[2][2] = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HE");
0410   HistAmpl[2][3] = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HO");
0411   HistAmpl[2][4] = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HF");
0412 
0413   //+++++++++++++++++++++++++++++
0414   //Test 3 (Wm) Rate of RMS
0415   //+++++++++++++++++++++++++++++
0416 
0417   Map_Ampl[3][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Amplitude225_HB");
0418   Map_Ampl[3][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Amplitude225_HB");
0419   Map_Ampl[3][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Amplitude225_HE");
0420   Map_Ampl[3][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Amplitude225_HE");
0421   Map_Ampl[3][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Amplitude225_HE");
0422   Map_Ampl[3][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Amplitude225_HO");
0423   Map_Ampl[3][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Amplitude225_HF");
0424   Map_Ampl[3][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Amplitude225_HF");
0425 
0426   Map_Ampl[3][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Amplitude225_HE");
0427   Map_Ampl[3][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5Amplitude225_HE");
0428   Map_Ampl[3][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6Amplitude225_HE");
0429   Map_Ampl[3][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7Amplitude225_HE");
0430   Map_Ampl[3][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Amplitude225_HF");
0431   Map_Ampl[3][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Amplitude225_HF");
0432 
0433   Map_Ampl[3][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Amplitude225_HB");
0434   Map_Ampl[3][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Amplitude225_HB");
0435 
0436   HistAmpl[3][1] = (TH1F *)dir->FindObjectAny("h_Amplitude_HB");
0437   HistAmpl[3][2] = (TH1F *)dir->FindObjectAny("h_Amplitude_HE");
0438   HistAmpl[3][3] = (TH1F *)dir->FindObjectAny("h_Amplitude_HO");
0439   HistAmpl[3][4] = (TH1F *)dir->FindObjectAny("h_Amplitude_HF");
0440 
0441   //+++++++++++++++++++++++++++++
0442   //Test 4 (Rm) Rate of ratio 4 near max TS/ All TS
0443   //+++++++++++++++++++++++++++++
0444 
0445   Map_Ampl[4][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Ampl047_HB");
0446   Map_Ampl[4][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Ampl047_HB");
0447   Map_Ampl[4][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Ampl047_HE");
0448   Map_Ampl[4][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Ampl047_HE");
0449   Map_Ampl[4][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Ampl047_HE");
0450   Map_Ampl[4][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Ampl047_HO");
0451   Map_Ampl[4][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Ampl047_HF");
0452   Map_Ampl[4][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Ampl047_HF");
0453 
0454   Map_Ampl[4][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Ampl047_HE");
0455   Map_Ampl[4][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5Ampl047_HE");
0456   Map_Ampl[4][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6Ampl047_HE");
0457   Map_Ampl[4][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7Ampl047_HE");
0458   Map_Ampl[4][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Ampl047_HF");
0459   Map_Ampl[4][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Ampl047_HF");
0460 
0461   Map_Ampl[4][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Ampl047_HB");
0462   Map_Ampl[4][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Ampl047_HB");
0463 
0464   HistAmpl[4][1] = (TH1F *)dir->FindObjectAny("h_Ampl_HB");
0465   HistAmpl[4][2] = (TH1F *)dir->FindObjectAny("h_Ampl_HE");
0466   HistAmpl[4][3] = (TH1F *)dir->FindObjectAny("h_Ampl_HO");
0467   HistAmpl[4][4] = (TH1F *)dir->FindObjectAny("h_Ampl_HF");
0468 
0469   //+++++++++++++++++++++++++++++
0470   //Test 5 (TNm) Mean position in 1-8 TS range
0471   //+++++++++++++++++++++++++++++
0472 
0473   Map_Ampl[5][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmeanA225_HB");
0474   Map_Ampl[5][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmeanA225_HB");
0475   Map_Ampl[5][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmeanA225_HE");
0476   Map_Ampl[5][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmeanA225_HE");
0477   Map_Ampl[5][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmeanA225_HE");
0478   Map_Ampl[5][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmeanA225_HO");
0479   Map_Ampl[5][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmeanA225_HF");
0480   Map_Ampl[5][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmeanA225_HF");
0481 
0482   Map_Ampl[5][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmeanA225_HE");
0483   Map_Ampl[5][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5TSmeanA225_HE");
0484   Map_Ampl[5][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6TSmeanA225_HE");
0485   Map_Ampl[5][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7TSmeanA225_HE");
0486   Map_Ampl[5][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmeanA225_HF");
0487   Map_Ampl[5][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmeanA225_HF");
0488 
0489   Map_Ampl[5][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmeanA225_HB");
0490   Map_Ampl[5][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmeanA225_HB");
0491 
0492   HistAmpl[5][1] = (TH1F *)dir->FindObjectAny("h_TSmeanA_HB");
0493   HistAmpl[5][2] = (TH1F *)dir->FindObjectAny("h_TSmeanA_HE");
0494   HistAmpl[5][3] = (TH1F *)dir->FindObjectAny("h_TSmeanA_HO");
0495   HistAmpl[5][4] = (TH1F *)dir->FindObjectAny("h_TSmeanA_HF");
0496 
0497   //+++++++++++++++++++++++++++++
0498   //Test 6 (TXm) Maximum position in 1-8 TS range
0499   //+++++++++++++++++++++++++++++
0500 
0501   Map_Ampl[6][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmaxA225_HB");
0502   Map_Ampl[6][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmaxA225_HB");
0503   Map_Ampl[6][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmaxA225_HE");
0504   Map_Ampl[6][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmaxA225_HE");
0505   Map_Ampl[6][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmaxA225_HE");
0506   Map_Ampl[6][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmaxA225_HO");
0507   Map_Ampl[6][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmaxA225_HF");
0508   Map_Ampl[6][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmaxA225_HF");
0509 
0510   Map_Ampl[6][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmaxA225_HE");
0511   Map_Ampl[6][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5TSmaxA225_HE");
0512   Map_Ampl[6][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6TSmaxA225_HE");
0513   Map_Ampl[6][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7TSmaxA225_HE");
0514   Map_Ampl[6][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmaxA225_HF");
0515   Map_Ampl[6][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmaxA225_HF");
0516 
0517   Map_Ampl[6][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmaxA225_HB");
0518   Map_Ampl[6][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmaxA225_HB");
0519 
0520   HistAmpl[6][1] = (TH1F *)dir->FindObjectAny("h_TSmaxA_HB");
0521   HistAmpl[6][2] = (TH1F *)dir->FindObjectAny("h_TSmaxA_HE");
0522   HistAmpl[6][3] = (TH1F *)dir->FindObjectAny("h_TSmaxA_HO");
0523   HistAmpl[6][4] = (TH1F *)dir->FindObjectAny("h_TSmaxA_HF");
0524 
0525   for (int test = 2; test <= 6; test++) {  //Test: 2-Am, 3-Wm, 4-Rm, 5-TNm, 6-TXm,
0526     for (int sub = 1; sub <= 4; sub++) {   //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0527                                            //        if (sub==1) cHB->Divide(2,1);
0528       if (sub == 1)
0529         cHB->Divide(2, 2);
0530       //        if (sub==2) cHE->Divide(3,1);
0531       if (sub == 2)
0532         cHE->Divide(3, 3);
0533       if (sub == 3)
0534         cONE->Divide(1, 1);
0535       //        if (sub==4) cHF->Divide(2,1);
0536       if (sub == 4)
0537         cHF->Divide(2, 2);
0538       //        int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0539       //        int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0540       //        int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0541       for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0542         if (sub == 1)
0543           cHB->cd(k);
0544         if (sub == 2)
0545           cHE->cd(k);
0546         if (sub == 3)
0547           cONE->cd(k - 3);
0548         if (sub == 4)
0549           cHF->cd(k);
0550         Map_Ampl[test][sub][k]->Divide(Map_Ampl[test][sub][k], Map_SUB[sub][k], 1, 1, "B");
0551         gPad->SetGridy();
0552         gPad->SetGridx();
0553         gPad->SetLogz();
0554         if (sub == 1)
0555           sprintf(str, "HB, Depth%d \b", k);
0556         if (sub == 2)
0557           sprintf(str, "HE, Depth%d \b", k);
0558         if (sub == 3)
0559           sprintf(str, "HO, Depth%d \b", k);
0560         if (sub == 4)
0561           sprintf(str, "HF, Depth%d \b", k);
0562         Map_Ampl[test][sub][k]->SetTitle(str);
0563         Map_Ampl[test][sub][k]->SetXTitle("#eta \b");
0564         Map_Ampl[test][sub][k]->SetYTitle("#phi \b");
0565         Map_Ampl[test][sub][k]->SetZTitle("Rate \b");
0566         if (sub == 3)
0567           Map_Ampl[test][sub][k]->SetTitleOffset(0.8, "Z");
0568         Map_Ampl[test][sub][k]->Draw("COLZ");
0569         Map_Ampl[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0570         Map_Ampl[test][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0571         if (sub == 1) {
0572           cHB->Modified();
0573           cHB->Update();
0574         }
0575         if (sub == 2) {
0576           cHE->Modified();
0577           cHE->Update();
0578         }
0579         if (sub == 3) {
0580           cONE->Modified();
0581           cONE->Update();
0582         }
0583         if (sub == 4) {
0584           cHF->Modified();
0585           cHF->Update();
0586         }
0587       }  //end depth
0588       if (test == 2) {
0589         if (sub == 1) {
0590           cHB->Print("MapRateAmplHB.png");
0591           cHB->Clear();
0592         }
0593         if (sub == 2) {
0594           cHE->Print("MapRateAmplHE.png");
0595           cHE->Clear();
0596         }
0597         if (sub == 3) {
0598           cONE->Print("MapRateAmplHO.png");
0599           cONE->Clear();
0600         }
0601         if (sub == 4) {
0602           cHF->Print("MapRateAmplHF.png");
0603           cHF->Clear();
0604         }
0605       }
0606       if (test == 3) {
0607         if (sub == 1) {
0608           cHB->Print("MapRateRMSHB.png");
0609           cHB->Clear();
0610         }
0611         if (sub == 2) {
0612           cHE->Print("MapRateRMSHE.png");
0613           cHE->Clear();
0614         }
0615         if (sub == 3) {
0616           cONE->Print("MapRateRMSHO.png");
0617           cONE->Clear();
0618         }
0619         if (sub == 4) {
0620           cHF->Print("MapRateRMSHF.png");
0621           cHF->Clear();
0622         }
0623       }
0624       if (test == 4) {
0625         if (sub == 1) {
0626           cHB->Print("MapRate43TStoAllTSHB.png");
0627           cHB->Clear();
0628         }
0629         if (sub == 2) {
0630           cHE->Print("MapRate43TStoAllTSHE.png");
0631           cHE->Clear();
0632         }
0633         if (sub == 3) {
0634           cONE->Print("MapRate43TStoAllTSHO.png");
0635           cONE->Clear();
0636         }
0637         if (sub == 4) {
0638           cHF->Print("MapRate43TStoAllTSHF.png");
0639           cHF->Clear();
0640         }
0641       }
0642       if (test == 5) {
0643         if (sub == 1) {
0644           cHB->Print("MapRateMeanPosHB.png");
0645           cHB->Clear();
0646         }
0647         if (sub == 2) {
0648           cHE->Print("MapRateMeanPosHE.png");
0649           cHE->Clear();
0650         }
0651         if (sub == 3) {
0652           cONE->Print("MapRateMeanPosHO.png");
0653           cONE->Clear();
0654         }
0655         if (sub == 4) {
0656           cHF->Print("MapRateMeanPosHF.png");
0657           cHF->Clear();
0658         }
0659       }
0660       if (test == 6) {
0661         if (sub == 1) {
0662           cHB->Print("MapRateMaxPosHB.png");
0663           cHB->Clear();
0664         }
0665         if (sub == 2) {
0666           cHE->Print("MapRateMaxPosHE.png");
0667           cHE->Clear();
0668         }
0669         if (sub == 3) {
0670           cONE->Print("MapRateMaxPosHO.png");
0671           cONE->Clear();
0672         }
0673         if (sub == 4) {
0674           cHF->Print("MapRateMaxPosHF.png");
0675           cHF->Clear();
0676         }
0677       }
0678 
0679       //          cONE->Divide(1,1);
0680       /*
0681           cONE->Divide(2,1);
0682       if(test == 2 && sub == 2 ) {
0683         cONE->cd(2);
0684         TH1F *kjkjkhj2= (TH1F*)dir->FindObjectAny("h_ADCAmpl_HE");kjkjkhj2->Draw("");kjkjkhj2->SetTitle("HE, All Depth: shunt6");
0685       }
0686       if(test == 2 && sub == 1 ) {
0687         cONE->cd(2);
0688         TH1F *kjkjkhj1= (TH1F*)dir->FindObjectAny("h_ADCAmpl_HB");kjkjkhj1->Draw("");kjkjkhj1->SetTitle("HB, All Depth: shunt6");
0689       }
0690 */
0691 
0692       cONE->Divide(3, 1);
0693       if (test == 2 && sub == 2) {
0694         cONE->cd(2);
0695         TH1F *kjkjkhj2 = (TH1F *)dir->FindObjectAny("h_AmplitudeHEtest1");
0696         kjkjkhj2->Draw("");
0697         kjkjkhj2->SetTitle("HE, All Depth: shunt1");
0698         cONE->cd(3);
0699         TH1F *kjkjkhj3 = (TH1F *)dir->FindObjectAny("h_AmplitudeHEtest6");
0700         kjkjkhj3->Draw("");
0701         kjkjkhj3->SetTitle("HE, All Depth: shunt6");
0702       }
0703       if (test == 2 && sub == 1) {
0704         cONE->cd(2);
0705         TH1F *kjkjkhb2 = (TH1F *)dir->FindObjectAny("h_AmplitudeHBtest1");
0706         kjkjkhb2->Draw("");
0707         kjkjkhb2->SetTitle("HB, All Depth: shunt1");
0708         cONE->cd(3);
0709         TH1F *kjkjkhb3 = (TH1F *)dir->FindObjectAny("h_AmplitudeHBtest6");
0710         kjkjkhb3->Draw("");
0711         kjkjkhb3->SetTitle("HB, All Depth: shunt6");
0712       }
0713 
0714       cONE->cd(1);
0715       gPad->SetGridy();
0716       gPad->SetGridx();
0717       gPad->SetLogy();
0718       if (sub == 1)
0719         HistAmpl[test][sub]->SetTitle("HB, All Depth: shunt6");
0720       if (sub == 2)
0721         HistAmpl[test][sub]->SetTitle("HE, All Depth: shunt6");
0722       if (sub == 3)
0723         HistAmpl[test][sub]->SetTitle("HO, All Depth");
0724       if (sub == 4)
0725         HistAmpl[test][sub]->SetTitle("HF, All Depth");
0726       if (test == 2)
0727         HistAmpl[test][sub]->SetXTitle("ADC Amlitude in each event & cell \b");
0728       if (test == 3)
0729         HistAmpl[test][sub]->SetXTitle("RMS in each event & cell \b");
0730       if (test == 4)
0731         HistAmpl[test][sub]->SetXTitle("Ratio in each event & cell \b");
0732       if (test == 5)
0733         HistAmpl[test][sub]->SetXTitle("Mean TS position in each event & cell \b");
0734       if (test == 6)
0735         HistAmpl[test][sub]->SetXTitle("Max TS position in each event & cell \b");
0736       HistAmpl[test][sub]->SetYTitle("Number of cell-events \b");
0737       HistAmpl[test][sub]->SetLineColor(4);
0738       HistAmpl[test][sub]->SetLineWidth(2);
0739       HistAmpl[test][sub]->SetTitleOffset(1.4, "Y");
0740       HistAmpl[test][sub]->Draw("");
0741       // //        HistAmpl[test][sub]->GetYaxis()->SetRangeUser(1., 100.);
0742       //          if (test==2) {gPad->SetLogx(); HistAmpl[test][sub]->GetXaxis()->SetRangeUser(1., 10000.);}
0743       if (test == 2) {
0744         gPad->SetLogx();
0745       }
0746       if (test == 3)
0747         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 5.);  // width
0748       if (test == 4)
0749         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 1.);  // R
0750       if (test == 5)
0751         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);  // Tn
0752       if (test == 6)
0753         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);  // Tx
0754       cONE->Modified();
0755       cONE->Update();
0756       double min_x[] = {MIN_M[test][sub], MIN_M[test][sub]};
0757       double min_y[] = {0., 100000000.};
0758       TGraph *MIN = new TGraph(2, min_x, min_y);
0759       MIN->SetLineStyle(2);
0760       MIN->SetLineColor(2);
0761       MIN->SetLineWidth(2 + 100 * 100);
0762       MIN->SetFillStyle(3005);
0763       MIN->SetFillColor(2);
0764       MIN->Draw("L");
0765       double max_x[] = {MAX_M[test][sub], MAX_M[test][sub]};
0766       double max_y[] = {0., 100000000.};
0767       TGraph *MAX = new TGraph(2, max_x, max_y);
0768       MAX->SetLineStyle(2);
0769       MAX->SetLineColor(2);
0770       MAX->SetLineWidth(-2 - 100 * 100);
0771       MAX->SetFillStyle(3004);
0772       MAX->SetFillColor(2);
0773       MAX->Draw("L");
0774       if (test == 2) {
0775         if (sub == 1) {
0776           cONE->Print("HistAmplHB.png");
0777           cONE->Clear();
0778         }
0779         if (sub == 2) {
0780           cONE->Print("HistAmplHE.png");
0781           cONE->Clear();
0782         }
0783         if (sub == 3) {
0784           cONE->Print("HistAmplHO.png");
0785           cONE->Clear();
0786         }
0787         if (sub == 4) {
0788           cONE->Print("HistAmplHF.png");
0789           cONE->Clear();
0790         }
0791       }
0792       if (test == 3) {
0793         if (sub == 1) {
0794           cONE->Print("HistRMSHB.png");
0795           cONE->Clear();
0796         }
0797         if (sub == 2) {
0798           cONE->Print("HistRMSHE.png");
0799           cONE->Clear();
0800         }
0801         if (sub == 3) {
0802           cONE->Print("HistRMSHO.png");
0803           cONE->Clear();
0804         }
0805         if (sub == 4) {
0806           cONE->Print("HistRMSHF.png");
0807           cONE->Clear();
0808         }
0809       }
0810       if (test == 4) {
0811         if (sub == 1) {
0812           cONE->Print("Hist43TStoAllTSHB.png");
0813           cONE->Clear();
0814         }
0815         if (sub == 2) {
0816           cONE->Print("Hist43TStoAllTSHE.png");
0817           cONE->Clear();
0818         }
0819         if (sub == 3) {
0820           cONE->Print("Hist43TStoAllTSHO.png");
0821           cONE->Clear();
0822         }
0823         if (sub == 4) {
0824           cONE->Print("Hist43TStoAllTSHF.png");
0825           cONE->Clear();
0826         }
0827       }
0828       if (test == 5) {
0829         if (sub == 1) {
0830           cONE->Print("HistMeanPosHB.png");
0831           cONE->Clear();
0832         }
0833         if (sub == 2) {
0834           cONE->Print("HistMeanPosHE.png");
0835           cONE->Clear();
0836         }
0837         if (sub == 3) {
0838           cONE->Print("HistMeanPosHO.png");
0839           cONE->Clear();
0840         }
0841         if (sub == 4) {
0842           cONE->Print("HistMeanPosHF.png");
0843           cONE->Clear();
0844         }
0845       }
0846       if (test == 6) {
0847         if (sub == 1) {
0848           cONE->Print("HistMaxPosHB.png");
0849           cONE->Clear();
0850         }
0851         if (sub == 2) {
0852           cONE->Print("HistMaxPosHE.png");
0853           cONE->Clear();
0854         }
0855         if (sub == 3) {
0856           cONE->Print("HistMaxPosHO.png");
0857           cONE->Clear();
0858         }
0859         if (sub == 4) {
0860           cONE->Print("HistMaxPosHF.png");
0861           cONE->Clear();
0862         }
0863       }
0864     }  // end sub
0865   }    //end test
0866 
0867   //+++++++++++++++++++++++++++++++++++
0868   //Test 31, 32 Pedestal, pedestalWidths
0869   //++++++++++++++++++++++++++++++++++++
0870 
0871   Map_Ampl[31][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestal_HB");
0872   Map_Ampl[31][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestal_HB");
0873   Map_Ampl[31][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestal_HB");
0874   Map_Ampl[31][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestal_HB");
0875   Map_Ampl[31][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestal_HE");
0876   Map_Ampl[31][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestal_HE");
0877   Map_Ampl[31][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestal_HE");
0878   Map_Ampl[31][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestal_HE");
0879   Map_Ampl[31][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5pedestal_HE");
0880   Map_Ampl[31][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6pedestal_HE");
0881   Map_Ampl[31][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7pedestal_HE");
0882   Map_Ampl[31][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestal_HO");
0883   Map_Ampl[31][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestal_HF");
0884   Map_Ampl[31][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestal_HF");
0885   Map_Ampl[31][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestal_HF");
0886   Map_Ampl[31][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestal_HF");
0887 
0888   Map_Ampl[32][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestalw_HB");
0889   Map_Ampl[32][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestalw_HB");
0890   Map_Ampl[32][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestalw_HB");
0891   Map_Ampl[32][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestalw_HB");
0892   Map_Ampl[32][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestalw_HE");
0893   Map_Ampl[32][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestalw_HE");
0894   Map_Ampl[32][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestalw_HE");
0895   Map_Ampl[32][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestalw_HE");
0896   Map_Ampl[32][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5pedestalw_HE");
0897   Map_Ampl[32][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6pedestalw_HE");
0898   Map_Ampl[32][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7pedestalw_HE");
0899   Map_Ampl[32][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestalw_HO");
0900   Map_Ampl[32][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestalw_HF");
0901   Map_Ampl[32][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestalw_HF");
0902   Map_Ampl[32][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestalw_HF");
0903   Map_Ampl[32][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestalw_HF");
0904 
0905   HistPed[1][1][0] = (TH1F *)dir->FindObjectAny("h_pedestal0_HB");
0906   HistPed[1][1][1] = (TH1F *)dir->FindObjectAny("h_pedestal1_HB");
0907   HistPed[1][1][2] = (TH1F *)dir->FindObjectAny("h_pedestal2_HB");
0908   HistPed[1][1][3] = (TH1F *)dir->FindObjectAny("h_pedestal3_HB");
0909   HistPed[2][1][0] = (TH1F *)dir->FindObjectAny("h_pedestalw0_HB");
0910   HistPed[2][1][1] = (TH1F *)dir->FindObjectAny("h_pedestalw1_HB");
0911   HistPed[2][1][2] = (TH1F *)dir->FindObjectAny("h_pedestalw2_HB");
0912   HistPed[2][1][3] = (TH1F *)dir->FindObjectAny("h_pedestalw3_HB");
0913 
0914   HistPed[1][2][0] = (TH1F *)dir->FindObjectAny("h_pedestal0_HE");
0915   HistPed[1][2][1] = (TH1F *)dir->FindObjectAny("h_pedestal1_HE");
0916   HistPed[1][2][2] = (TH1F *)dir->FindObjectAny("h_pedestal2_HE");
0917   HistPed[1][2][3] = (TH1F *)dir->FindObjectAny("h_pedestal3_HE");
0918   HistPed[2][2][0] = (TH1F *)dir->FindObjectAny("h_pedestalw0_HE");
0919   HistPed[2][2][1] = (TH1F *)dir->FindObjectAny("h_pedestalw1_HE");
0920   HistPed[2][2][2] = (TH1F *)dir->FindObjectAny("h_pedestalw2_HE");
0921   HistPed[2][2][3] = (TH1F *)dir->FindObjectAny("h_pedestalw3_HE");
0922 
0923   HistPed[1][3][0] = (TH1F *)dir->FindObjectAny("h_pedestal0_HO");
0924   HistPed[1][3][1] = (TH1F *)dir->FindObjectAny("h_pedestal1_HO");
0925   HistPed[1][3][2] = (TH1F *)dir->FindObjectAny("h_pedestal2_HO");
0926   HistPed[1][3][3] = (TH1F *)dir->FindObjectAny("h_pedestal3_HO");
0927   HistPed[2][3][0] = (TH1F *)dir->FindObjectAny("h_pedestalw0_HO");
0928   HistPed[2][3][1] = (TH1F *)dir->FindObjectAny("h_pedestalw1_HO");
0929   HistPed[2][3][2] = (TH1F *)dir->FindObjectAny("h_pedestalw2_HO");
0930   HistPed[2][3][3] = (TH1F *)dir->FindObjectAny("h_pedestalw3_HO");
0931 
0932   HistPed[1][4][0] = (TH1F *)dir->FindObjectAny("h_pedestal0_HF");
0933   HistPed[1][4][1] = (TH1F *)dir->FindObjectAny("h_pedestal1_HF");
0934   HistPed[1][4][2] = (TH1F *)dir->FindObjectAny("h_pedestal2_HF");
0935   HistPed[1][4][3] = (TH1F *)dir->FindObjectAny("h_pedestal3_HF");
0936   HistPed[2][4][0] = (TH1F *)dir->FindObjectAny("h_pedestalw0_HF");
0937   HistPed[2][4][1] = (TH1F *)dir->FindObjectAny("h_pedestalw1_HF");
0938   HistPed[2][4][2] = (TH1F *)dir->FindObjectAny("h_pedestalw2_HF");
0939   HistPed[2][4][3] = (TH1F *)dir->FindObjectAny("h_pedestalw3_HF");
0940 
0941   for (int test = 31; test <= 32; test++) {  //Test: 31-Pedestals, 32-pedestal Widths,
0942     for (int sub = 1; sub <= 4; sub++) {     //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
0943                                              //        if (sub==1) cHB->Divide(2,1);
0944       if (sub == 1)
0945         cHB->Divide(2, 2);
0946       //        if (sub==2) cHE->Divide(3,1);
0947       if (sub == 2)
0948         cHE->Divide(3, 3);
0949       if (sub == 3)
0950         cONE->Divide(1, 1);
0951       //        if (sub==4) cHF->Divide(2,1);
0952       if (sub == 4)
0953         cHF->Divide(2, 2);
0954       //        int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0955       //        int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0956       //        int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0957       for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depths
0958         if (sub == 1)
0959           cHB->cd(k);
0960         if (sub == 2)
0961           cHE->cd(k);
0962         if (sub == 3)
0963           cONE->cd(k - 3);
0964         if (sub == 4)
0965           cHF->cd(k);
0966         Map_Ampl[test][sub][k]->Divide(Map_Ampl[test][sub][k], Map_SUB[sub][k], 1, 1, "B");
0967         gPad->SetGridy();
0968         gPad->SetGridx();
0969         gPad->SetLogz();
0970         if (sub == 1)
0971           sprintf(str, "HB, Depth%d \b", k);
0972         if (sub == 2)
0973           sprintf(str, "HE, Depth%d \b", k);
0974         if (sub == 3)
0975           sprintf(str, "HO, Depth%d \b", k);
0976         if (sub == 4)
0977           sprintf(str, "HF, Depth%d \b", k);
0978         Map_Ampl[test][sub][k]->SetTitle(str);
0979         Map_Ampl[test][sub][k]->SetXTitle("#eta \b");
0980         Map_Ampl[test][sub][k]->SetYTitle("#phi \b");
0981         Map_Ampl[test][sub][k]->SetZTitle("Rate \b");
0982         if (sub == 3)
0983           Map_Ampl[test][sub][k]->SetTitleOffset(0.8, "Z");
0984         Map_Ampl[test][sub][k]->Draw("COLZ");
0985         Map_Ampl[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0986         Map_Ampl[test][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0987         if (sub == 1) {
0988           cHB->Modified();
0989           cHB->Update();
0990         }
0991         if (sub == 2) {
0992           cHE->Modified();
0993           cHE->Update();
0994         }
0995         if (sub == 3) {
0996           cONE->Modified();
0997           cONE->Update();
0998         }
0999         if (sub == 4) {
1000           cHF->Modified();
1001           cHF->Update();
1002         }
1003       }  //end depth
1004       if (test == 31) {
1005         if (sub == 1) {
1006           cHB->Print("MapRatePedHB.png");
1007           cHB->Clear();
1008         }
1009         if (sub == 2) {
1010           cHE->Print("MapRatePedHE.png");
1011           cHE->Clear();
1012         }
1013         if (sub == 3) {
1014           cONE->Print("MapRatePedHO.png");
1015           cONE->Clear();
1016         }
1017         if (sub == 4) {
1018           cHF->Print("MapRatePedHF.png");
1019           cHF->Clear();
1020         }
1021       }
1022       if (test == 32) {
1023         if (sub == 1) {
1024           cHB->Print("MapRatePedWidthsHB.png");
1025           cHB->Clear();
1026         }
1027         if (sub == 2) {
1028           cHE->Print("MapRatePedWidthsHE.png");
1029           cHE->Clear();
1030         }
1031         if (sub == 3) {
1032           cONE->Print("MapRatePedWidthsHO.png");
1033           cONE->Clear();
1034         }
1035         if (sub == 4) {
1036           cHF->Print("MapRatePedWidthsHF.png");
1037           cHF->Clear();
1038         }
1039       }
1040 
1041       ///////////////////////////////////////////////
1042 
1043       cPED->Divide(2, 2);
1044       for (int cap = 0; cap <= 3; cap++) {
1045         cPED->cd(cap + 1);
1046         gPad->SetGridy();
1047         gPad->SetGridx();
1048         gPad->SetLogy();
1049 
1050         if (sub == 1)
1051           sprintf(str, "HB, Cap%d, all depth\b", cap);
1052         if (sub == 2)
1053           sprintf(str, "HE, Cap%d, all depth\b", cap);
1054         if (sub == 3)
1055           sprintf(str, "HO, Cap%d, all depth\b", cap);
1056         if (sub == 4)
1057           sprintf(str, "HF, Cap%d, all depth\b", cap);
1058 
1059         HistPed[test - 30][sub][cap]->SetTitle(str);
1060 
1061         if (test == 31)
1062           HistPed[test - 30][sub][cap]->SetXTitle("Pedestals in each event & cell \b");
1063         if (test == 32)
1064           HistPed[test - 30][sub][cap]->SetXTitle("Pedestal Widths in each event & cell \b");
1065 
1066         HistPed[test - 30][sub][cap]->SetYTitle("Number of channel-events \b");
1067         HistPed[test - 30][sub][cap]->SetLineColor(4);
1068         HistPed[test - 30][sub][cap]->SetLineWidth(2);
1069         HistPed[test - 30][sub][cap]->SetTitleOffset(1.4, "Y");
1070         HistPed[test - 30][sub][cap]->Draw("");
1071         //            HistPed[test-30][sub][cap]->GetYaxis()->SetRangeUser(1., 100.);
1072         //            if (test==31) {gPad->SetLogx(); HistPed[test-30][sub][cap]->GetXaxis()->SetRangeUser(1., 10000.);}
1073         //            if (test==32) HistPed[test-30][sub][cap]->GetXaxis()->SetRangeUser(0., 5.);
1074 
1075         cPED->Modified();
1076         cPED->Update();
1077         double min_x[] = {Pedest[test - 31][sub], Pedest[test - 31][sub]};
1078         double min_y[] = {0., 100000000.};
1079         TGraph *MIN = new TGraph(2, min_x, min_y);
1080         MIN->SetLineStyle(2);
1081         MIN->SetLineColor(2);
1082         MIN->SetLineWidth(2 + 100 * 100);
1083         MIN->SetFillStyle(3005);
1084         MIN->SetFillColor(2);
1085         MIN->Draw("L");
1086       }
1087       if (test == 31) {
1088         if (sub == 1) {
1089           cPED->Print("HistPedestalsHB.png");
1090           cPED->Clear();
1091         }
1092         if (sub == 2) {
1093           cPED->Print("HistPedestalsHE.png");
1094           cPED->Clear();
1095         }
1096         if (sub == 3) {
1097           cPED->Print("HistPedestalsHO.png");
1098           cPED->Clear();
1099         }
1100         if (sub == 4) {
1101           cPED->Print("HistPedestalsHF.png");
1102           cPED->Clear();
1103         }
1104       }
1105       if (test == 32) {
1106         if (sub == 1) {
1107           cPED->Print("HistPedestalWidthsHB.png");
1108           cPED->Clear();
1109         }
1110         if (sub == 2) {
1111           cPED->Print("HistPedestalWidthsHE.png");
1112           cPED->Clear();
1113         }
1114         if (sub == 3) {
1115           cPED->Print("HistPedestalWidthsHO.png");
1116           cPED->Clear();
1117         }
1118         if (sub == 4) {
1119           cPED->Print("HistPedestalWidthsHF.png");
1120           cPED->Clear();
1121         }
1122       }
1123     }  // end sub
1124   }    //end test 31,32
1125 
1126   //+++++++++++++++++++++++++++++++++++
1127   //Test 33 Correlation of Pedestal, pedestalWidths Vs fullAmplitude
1128   //++++++++++++++++++++++++++++++++++++
1129 
1130   cPED->Clear();
1131   Map_Ped[1][1] = (TH2F *)dir->FindObjectAny("h2_pedvsampl_HB");
1132   Map_Ped[1][2] = (TH2F *)dir->FindObjectAny("h2_pedvsampl_HE");
1133   Map_Ped[1][3] = (TH2F *)dir->FindObjectAny("h2_pedvsampl_HO");
1134   Map_Ped[1][4] = (TH2F *)dir->FindObjectAny("h2_pedvsampl_HF");
1135   Map_Ped[2][1] = (TH2F *)dir->FindObjectAny("h2_pedwvsampl_HB");
1136   Map_Ped[2][2] = (TH2F *)dir->FindObjectAny("h2_pedwvsampl_HE");
1137   Map_Ped[2][3] = (TH2F *)dir->FindObjectAny("h2_pedwvsampl_HO");
1138   Map_Ped[2][4] = (TH2F *)dir->FindObjectAny("h2_pedwvsampl_HF");
1139   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1140     cPED->Divide(2, 1);
1141     for (int test = 1; test <= 2; test++) {
1142       cPED->cd(test);
1143       gPad->SetGridy();
1144       gPad->SetGridx();
1145       gPad->SetLogz();
1146       if (test == 1)
1147         Map_Ped[test][sub]->SetXTitle("Pedestal, fC \b");
1148       if (test == 2)
1149         Map_Ped[test][sub]->SetXTitle("pedestal Width, fC \b");
1150       Map_Ped[test][sub]->SetYTitle("Amplitude, fC \b");
1151       Map_Ped[test][sub]->SetZTitle("entries  \b");
1152       if (test == 1)
1153         sprintf(str, "Cap0 Pedestal vs Amplitude \b");
1154       if (test == 2)
1155         sprintf(str, "Cap0 pedestalWidth vs Amplitude \b");
1156       Map_Ped[test][sub]->SetTitle(str);
1157       Map_Ped[test][sub]->Draw("COLZ");
1158       // Map_Ped[test][sub]->GetYaxis()->SetRangeUser(0, 72.);
1159       //      Map_Ped[test][sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
1160       cPED->Modified();
1161       cPED->Update();
1162     }  // test 1,2
1163     if (sub == 1) {
1164       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHB.png");
1165       cPED->Clear();
1166     }
1167     if (sub == 2) {
1168       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHE.png");
1169       cPED->Clear();
1170     }
1171     if (sub == 3) {
1172       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHO.png");
1173       cPED->Clear();
1174     }
1175     if (sub == 4) {
1176       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHF.png");
1177       cPED->Clear();
1178     }
1179   }  // end sub
1180 
1181   //+++++++++++++++++++++++++++++++++++
1182   //Test 41 Time Slices shape for good and bad channels
1183   //++++++++++++++++++++++++++++++++++++
1184 
1185   cONE->Clear();
1186   hist_GoodTSshape[1] = (TH1F *)dir->FindObjectAny("h_shape_good_channels_HB");
1187   hist_GoodTSshape[2] = (TH1F *)dir->FindObjectAny("h_shape_good_channels_HE");
1188   hist_GoodTSshape[3] = (TH1F *)dir->FindObjectAny("h_shape_good_channels_HO");
1189   hist_GoodTSshape[4] = (TH1F *)dir->FindObjectAny("h_shape_good_channels_HF");
1190 
1191   hist_GoodTSshape0[1] = (TH1F *)dir->FindObjectAny("h_shape0_good_channels_HB");
1192   hist_GoodTSshape0[2] = (TH1F *)dir->FindObjectAny("h_shape0_good_channels_HE");
1193   hist_GoodTSshape0[3] = (TH1F *)dir->FindObjectAny("h_shape0_good_channels_HO");
1194   hist_GoodTSshape0[4] = (TH1F *)dir->FindObjectAny("h_shape0_good_channels_HF");
1195 
1196   hist_BadTSshape[1] = (TH1F *)dir->FindObjectAny("h_shape_bad_channels_HB");
1197   hist_BadTSshape[2] = (TH1F *)dir->FindObjectAny("h_shape_bad_channels_HE");
1198   hist_BadTSshape[3] = (TH1F *)dir->FindObjectAny("h_shape_bad_channels_HO");
1199   hist_BadTSshape[4] = (TH1F *)dir->FindObjectAny("h_shape_bad_channels_HF");
1200 
1201   hist_BadTSshape0[1] = (TH1F *)dir->FindObjectAny("h_shape0_bad_channels_HB");
1202   hist_BadTSshape0[2] = (TH1F *)dir->FindObjectAny("h_shape0_bad_channels_HE");
1203   hist_BadTSshape0[3] = (TH1F *)dir->FindObjectAny("h_shape0_bad_channels_HO");
1204   hist_BadTSshape0[4] = (TH1F *)dir->FindObjectAny("h_shape0_bad_channels_HF");
1205 
1206   cONE->cd(1);
1207 
1208   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1209 
1210     gPad->SetGridy();
1211     gPad->SetGridx();
1212     gPad->SetLogz();
1213     hist_GoodTSshape[sub]->Divide(hist_GoodTSshape[sub], hist_GoodTSshape0[sub], 1, 1, "B");
1214     hist_GoodTSshape[sub]->SetXTitle("Time slice \b");
1215     hist_GoodTSshape[sub]->SetYTitle("ADC counts \b");
1216     sprintf(str, "Mean ADC Shape \b");
1217     hist_GoodTSshape[sub]->SetTitle(str);
1218     hist_GoodTSshape[sub]->Draw("");
1219     // hist_GoodTSshape[sub]->GetYaxis()->SetRangeUser(0, 72.);
1220     // hist_GoodTSshape[sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
1221     cONE->Modified();
1222     cONE->Update();
1223     if (sub == 1) {
1224       cONE->Print("HistGoodTSshapesHB.png");
1225       cONE->Clear();
1226     }
1227     if (sub == 2) {
1228       cONE->Print("HistGoodTSshapesHE.png");
1229       cONE->Clear();
1230     }
1231     if (sub == 3) {
1232       cONE->Print("HistGoodTSshapesHO.png");
1233       cONE->Clear();
1234     }
1235     if (sub == 4) {
1236       cONE->Print("HistGoodTSshapesHF.png");
1237       cONE->Clear();
1238     }
1239   }  // end sub
1240 
1241   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1242 
1243     gPad->SetGridy();
1244     gPad->SetGridx();
1245     gPad->SetLogz();
1246     hist_BadTSshape[sub]->Divide(hist_BadTSshape[sub], hist_BadTSshape0[sub], 1, 1, "B");
1247     hist_BadTSshape[sub]->SetXTitle("Time slice \b");
1248     hist_BadTSshape[sub]->SetYTitle("ADC counts \b");
1249     sprintf(str, "Mean ADC Shape \b");
1250     hist_BadTSshape[sub]->SetTitle(str);
1251     hist_BadTSshape[sub]->Draw("");
1252     // hist_BadTSshape[sub]->GetYaxis()->SetRangeUser(0, 72.);
1253     // hist_BadTSshape[sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
1254     cONE->Modified();
1255     cONE->Update();
1256     if (sub == 1) {
1257       cONE->Print("HistBadTSshapesHB.png");
1258       cONE->Clear();
1259     }
1260     if (sub == 2) {
1261       cONE->Print("HistBadTSshapesHE.png");
1262       cONE->Clear();
1263     }
1264     if (sub == 3) {
1265       cONE->Print("HistBadTSshapesHO.png");
1266       cONE->Clear();
1267     }
1268     if (sub == 4) {
1269       cONE->Print("HistBadTSshapesHF.png");
1270       cONE->Clear();
1271     }
1272   }  // end sub
1273 
1274   //+++++++++++++++++++++++++++++
1275   //Entries in different TSs:
1276   //+++++++++++++++++++++++++++++
1277   Map_SUBTS[1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TS2_HB");
1278   Map_SUBTS[1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TS2_HB");
1279   Map_SUBTS[1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TS2_HB");
1280   Map_SUBTS[1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TS2_HB");
1281 
1282   Map_SUBTS[2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TS2_HE");
1283   Map_SUBTS[2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TS2_HE");
1284   Map_SUBTS[2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TS2_HE");
1285   Map_SUBTS[2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TS2_HE");
1286   Map_SUBTS[2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5TS2_HE");
1287   Map_SUBTS[2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6TS2_HE");
1288   Map_SUBTS[2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7TS2_HE");
1289 
1290   Map_SUBTS[3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TS012_HO");
1291 
1292   Map_SUBTS[4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TS1_HF");
1293   Map_SUBTS[4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TS1_HF");
1294   Map_SUBTS[4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TS1_HF");
1295   Map_SUBTS[4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TS1_HF");
1296 
1297   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1298                                         //     if (sub==1) cHB->Divide(2,1);
1299     if (sub == 1)
1300       cHB->Divide(2, 2);
1301     //     if (sub==2) cHE->Divide(3,1);
1302     if (sub == 2)
1303       cHE->Divide(3, 3);
1304     if (sub == 3)
1305       cONE->Divide(1, 1);
1306     //     if (sub==4) cHF->Divide(2,1);
1307     if (sub == 4)
1308       cHF->Divide(2, 2);
1309     //     int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1310     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1311     //     int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
1312     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1313       if (sub == 1)
1314         cHB->cd(k);
1315       if (sub == 2)
1316         cHE->cd(k);
1317       if (sub == 3)
1318         cONE->cd(k - 3);
1319       if (sub == 4)
1320         cHF->cd(k);
1321       Map_SUBTS[sub][k]->Divide(Map_SUBTS[sub][k], Map_SUB[sub][k], 1, 1, "B");
1322       gPad->SetGridy();
1323       gPad->SetGridx();
1324       gPad->SetLogz();
1325       if (sub == 1)
1326         sprintf(str, "HB, Depth%d \b", k);
1327       if (sub == 2)
1328         sprintf(str, "HE, Depth%d \b", k);
1329       if (sub == 3)
1330         sprintf(str, "HO, Depth%d \b", k);
1331       if (sub == 4)
1332         sprintf(str, "HF, Depth%d \b", k);
1333       Map_SUBTS[sub][k]->SetTitle(str);
1334       Map_SUBTS[sub][k]->SetXTitle("#eta \b");
1335       Map_SUBTS[sub][k]->SetYTitle("#phi \b");
1336       Map_SUBTS[sub][k]->SetZTitle("Number of events \b");
1337       if (sub == 3)
1338         Map_SUBTS[sub][k]->SetTitleOffset(0.8, "Z");
1339       Map_SUBTS[sub][k]->Draw("COLZ");
1340       Map_SUBTS[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1341       //            Map_SUBTS[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
1342       if (sub == 1) {
1343         cHB->Modified();
1344         cHB->Update();
1345       }
1346       if (sub == 2) {
1347         cHE->Modified();
1348         cHE->Update();
1349       }
1350       if (sub == 3) {
1351         cONE->Modified();
1352         cONE->Update();
1353       }
1354       if (sub == 4) {
1355         cHF->Modified();
1356         cHF->Update();
1357       }
1358     }  //end depth
1359 
1360     if (sub == 1) {
1361       cHB->Print("Hist_mapDepthAllTS2_HB.png");
1362       cHB->Clear();
1363     }
1364     if (sub == 2) {
1365       cHE->Print("Hist_mapDepthAllTS2_HE.png");
1366       cHE->Clear();
1367     }
1368     if (sub == 3) {
1369       cONE->Print("Hist_mapDepthAllTS012_HO.png");
1370       cONE->Clear();
1371     }
1372     if (sub == 4) {
1373       cHF->Print("Hist_mapDepthAllTS1_HF.png");
1374       cHF->Clear();
1375     }
1376   }  // end sub
1377 
1378   //======================================================================
1379 
1380   std::cout << " We are here to print general 2D MAP " << std::endl;
1381 
1382   //======================================================================
1383 
1384   //======================================================================
1385   /// Prepare maps of good/bad channels:
1386   // i - Eta; j - Phi
1387   //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1388   //         int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1389   //         int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet before upgrade
1390   //         int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
1391   //k-Depth
1392 
1393   //  TH2F *Map_ALL = new TH2F("Map_All", "Map_all", 82, -41, 40, 72, 0, 71);
1394   TH2F *Map_ALL = new TH2F("Map_All", "Map_all", 82, -41, 41, 72, 0, 72);
1395 
1396   int nx = Map_ALL->GetXaxis()->GetNbins();
1397   int ny = Map_ALL->GetYaxis()->GetNbins();
1398   cout << " nx= " << nx << " ny= " << ny << endl;
1399   //  int NBad = 0;
1400   //  int NWarn = 0;
1401   //  int NCalib = 0;
1402   //  int NPed = 0;
1403   //  //    int Eta[3][10000]={0};
1404   //  int Eta[4][10000] = {0};
1405   //  int Phi[4][10000] = {0};
1406   //  int Sub[4][10000] = {0};
1407   //  int Depth[4][10000] = {0};
1408   //  string Comment[4][10000] = {""};
1409   //  string Text[33] = {"", "Cm", "Am", "Wm", "Rm", "TNm", "TXm", "", "", "", "", "Cc", "Ac", "Wc", "Rc", "TNc", "TXc",
1410   //                     "", "",   "",   "",   "GS", "",    "",    "", "", "", "", "",   "",   "",   "Pm", "pWm"};
1411   //  int flag_W = 0;
1412   //  int flag_B = 0;
1413   //  int flag_P = 0;
1414   int fffffflag = 0;
1415   std::cout << " Map_ALL   SUBGOOD update " << std::endl;
1416   for (int sub = 1; sub <= 4; sub++) {
1417     for (int k = k_min[sub]; k <= k_max[sub]; k++) {
1418       for (int i = 1; i <= nx; i++) {
1419         for (int j = 1; j <= ny; j++) {
1420           if (Map_SUB[sub][k]->GetBinContent(i, j) != 0) {
1421             Map_SUBGOOD[sub][k]->SetBinContent(i, j, 0.5);
1422             Map_ALL->SetBinContent(i, j, 0.5);
1423           }
1424         }
1425       }
1426     }
1427   }
1428 
1429   std::cout << " Map_ALL   SUBGOOD filling............... " << std::endl;
1430   for (int sub = 1; sub <= 4; sub++) {
1431     for (int k = k_min[sub]; k <= k_max[sub]; k++) {
1432       for (int i = 1; i <= nx; i++) {
1433         for (int j = 1; j <= ny; j++) {
1434           //          flag_W = 0;
1435           //          flag_B = 0;
1436           //          flag_P = 0;
1437           //       CapID(Test=1;  ADC amplitude Am(Test= 2);  Width for Wm(Test=3);     Ratio cut for Rm(Test=4);  TS mean for TNm(test=5);   TS max  for TXm(Test=6);
1438           for (int test = 3; test <= 6; test++) {
1439             //      cout<<" test= "<<test<<" sbd= "<<sub<<" depth= "<<k<<" eta= "<<i<<" , phi= "<<j<<endl;
1440             //      cout<<" initial content Map_Ampl[test][sub][k]->GetBinContent(i, j)= "<<                  Map_Ampl[test][sub][k]->GetBinContent(i, j)       <<endl;
1441 
1442             //Bad
1443             //Rate 0.1 for displaying  on whole detector map and subdetector map
1444             if (Map_Ampl[test][sub][k]->GetBinContent(i, j) > 0.1) {
1445               Map_ALL->SetBinContent(i, j, 1.);
1446               Map_SUBGOOD[sub][k]->SetBinContent(i, j, 1.);
1447               fffffflag = 1;
1448               /*
1449               if (flag_B == 0) {
1450                 NBad += 1;
1451                 Eta[2][NBad] = i - 41;
1452                 Phi[2][NBad] = j - 1;
1453                 Sub[2][NBad] = sub;
1454                 Depth[2][NBad] = k;
1455                 Comment[2][NBad] = Text[test];
1456               }
1457           else {
1458                 Comment[2][NBad] += ", " + Text[test];
1459         flag_B = 1;
1460           }
1461 */
1462             }
1463 
1464             if ((Map_Ampl[test][sub][k]->GetBinContent(i, j) != 0.) &&
1465                 (Map_Ampl[test][sub][k]->GetBinContent(i, j) < 0.001)) {
1466               if (Map_SUBGOOD[sub][k]->GetBinContent(i, j) != 1.)
1467                 Map_SUBGOOD[sub][k]->SetBinContent(i, j, 0.75);
1468               if (Map_ALL->GetBinContent(i, j) != 1.)
1469                 Map_ALL->SetBinContent(i, j, 0.75);
1470               fffffflag = 2;
1471               /*
1472           if (flag_W == 0) {
1473         NWarn +=1; 
1474         Eta[1][NWarn]=i-41;
1475         Phi[1][NWarn]=j-1;
1476         Sub[1][NWarn]=sub;
1477         Depth[1][NWarn]=k;
1478         Comment[1][NWarn]=Text[test]; 
1479           } 
1480           else {Comment[1][NWarn]+=", "+Text[test];
1481         flag_W = 1;                  
1482           } 
1483 */
1484             }
1485 
1486             ////
1487 
1488             //      if(fffffflag != 0)   cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)  << "fffffflag = "<< fffffflag    <<endl;
1489 
1490           }  //end test
1491 
1492           //      std::cout << " RUN3 2022 MAPS_SUB: Pedestals......"<< std::endl;
1493           //Pedestals
1494           for (int test = 31; test <= 32; test++) {
1495             //      cout<<"Pedestals test= "<<test<<" sbd= "<<sub<<" depth= "<<k<<" eta= "<<i<<" , phi= "<<j<<endl;
1496             if (Map_Ampl[test][sub][k]->GetBinContent(i, j) > 0.9) {
1497               if (Map_SUBGOOD[sub][k]->GetBinContent(i, j) != 1.0)
1498                 Map_SUBGOOD[sub][k]->SetBinContent(i, j, 0.15);
1499               if (Map_ALL->GetBinContent(i, j) != 1.)
1500                 Map_ALL->SetBinContent(i, j, 0.15);
1501               /*          
1502           if (flag_P == 0) {
1503         NPed += 1;
1504         Eta[3][NPed] = i - 41;
1505         Phi[3][NPed] = j - 1;
1506         Sub[3][NPed] = sub;
1507         Depth[3][NPed] = k;
1508         Comment[3][NPed] = Text[test];
1509           }
1510           else {
1511         Comment[3][NPed] += ", " + Text[test];
1512         flag_P = 1;
1513           }
1514 */
1515             }
1516             //      cout<<"Pedestals Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
1517           }  //end test
1518         }
1519       }
1520     }
1521   }
1522 
1523   std::cout << " RUN3: 2022 Plots with MAPS_SUB: start ..............................." << std::endl;
1524   // subdet maps
1525   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1526 
1527     std::cout << " RUN3: 2022 MAPS_SUB= " << sub << std::endl;
1528     //     if (sub==1) cHB->Divide(2,1);
1529     if (sub == 1)
1530       cHB->Divide(2, 2);
1531     //     if (sub==2) cHE->Divide(3,1);
1532     if (sub == 2)
1533       cHE->Divide(3, 3);
1534     if (sub == 3)
1535       cONE->Divide(1, 1);
1536     //     if (sub==4) cHB->Divide(2,1);
1537     if (sub == 4)
1538       cHF->Divide(2, 2);
1539     //     int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1540     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1541     //     int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
1542     //k = Depth
1543     for (int k = k_min[sub]; k <= k_max[sub]; k++) {
1544       if (sub == 1)
1545         cHB->cd(k);
1546       if (sub == 2)
1547         cHE->cd(k);
1548       if (sub == 3)
1549         cONE->cd(k - 3);
1550       if (sub == 4)
1551         cHF->cd(k);
1552       gPad->SetGridy();
1553       gPad->SetGridx();
1554       gPad->SetLogz();
1555       //          gStyle->SetTitleOffset(0.5, "Y");
1556       if (sub == 1)
1557         sprintf(str, "HB, Depth%d \b", k);
1558       if (sub == 2)
1559         sprintf(str, "HE, Depth%d \b", k);
1560       if (sub == 3)
1561         sprintf(str, "HO, Depth%d \b", k);
1562       if (sub == 4)
1563         sprintf(str, "HF, Depth%d \b", k);
1564       Map_SUBGOOD[sub][k]->SetTitle(str);
1565       Map_SUBGOOD[sub][k]->SetXTitle("#eta \b");
1566       Map_SUBGOOD[sub][k]->SetYTitle("#phi \b");
1567       Map_SUBGOOD[sub][k]->Draw("COLZ");
1568       Map_SUBGOOD[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1569       Map_SUBGOOD[sub][k]->GetZaxis()->SetRangeUser(0., 1.);
1570 
1571       if (sub == 1) {
1572         cHB->Modified();
1573         cHB->Update();
1574       }
1575       if (sub == 2) {
1576         cHE->Modified();
1577         cHE->Update();
1578       }
1579       if (sub == 3) {
1580         cONE->Modified();
1581         cONE->Update();
1582       }
1583       if (sub == 4) {
1584         cHF->Modified();
1585         cHF->Update();
1586       }
1587     }  //end depth
1588     if (sub == 1) {
1589       cHB->Print("MAPHB.png");
1590       cHB->Clear();
1591     }
1592     if (sub == 2) {
1593       cHE->Print("MAPHE.png");
1594       cHE->Clear();
1595     }
1596     if (sub == 3) {
1597       cONE->Print("MAPHO.png");
1598       cONE->Clear();
1599     }
1600     if (sub == 4) {
1601       cHF->Print("MAPHF.png");
1602       cHF->Clear();
1603     }
1604   }  // end sub
1605 
1606   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1607 
1608   TCanvas *cmain1 = new TCanvas("cmain1", "MAP", 200, 10, 1400, 1800);
1609   cmain1->Divide(2, 2);
1610 
1611   cmain1->cd(1);
1612   TH1F *JDBEYESJ0 = (TH1F *)dir->FindObjectAny("h_totalAmplitudeHBperEvent");
1613   JDBEYESJ0->SetStats(0);
1614   JDBEYESJ0->SetMarkerStyle(20);
1615   JDBEYESJ0->SetMarkerSize(0.8);
1616   JDBEYESJ0->GetYaxis()->SetLabelSize(0.04);
1617   JDBEYESJ0->SetXTitle("iEvent \b");
1618   JDBEYESJ0->SetYTitle("totalAmplitude perEvent \b");
1619   JDBEYESJ0->SetTitle("HB \b");
1620   JDBEYESJ0->SetMarkerColor(2);
1621   JDBEYESJ0->SetLineColor(1);
1622   JDBEYESJ0->SetMinimum(0.8);
1623   JDBEYESJ0->Draw("HIST same P0");
1624   JDBEYESJ0->Clear();
1625 
1626   cmain1->cd(2);
1627   TH1F *JDBEYESJ1 = (TH1F *)dir->FindObjectAny("h_totalAmplitudeHEperEvent");
1628   JDBEYESJ1->SetStats(0);
1629   JDBEYESJ1->SetMarkerStyle(20);
1630   JDBEYESJ1->SetMarkerSize(0.8);
1631   JDBEYESJ1->GetYaxis()->SetLabelSize(0.04);
1632   JDBEYESJ1->SetXTitle("iEvent \b");
1633   JDBEYESJ1->SetYTitle("totalAmplitude perEvent \b");
1634   JDBEYESJ1->SetTitle("HE \b");
1635   JDBEYESJ1->SetMarkerColor(2);
1636   JDBEYESJ1->SetLineColor(1);
1637   JDBEYESJ1->SetMinimum(0.8);
1638   JDBEYESJ1->Draw("HIST same P0");
1639   JDBEYESJ1->Clear();
1640 
1641   cmain1->cd(3);
1642   TH1F *JDBEYESJ2 = (TH1F *)dir->FindObjectAny("h_totalAmplitudeHFperEvent");
1643   JDBEYESJ2->SetStats(0);
1644   JDBEYESJ2->SetMarkerStyle(20);
1645   JDBEYESJ2->SetMarkerSize(0.8);
1646   JDBEYESJ2->GetYaxis()->SetLabelSize(0.04);
1647   JDBEYESJ2->SetXTitle("iEvent \b");
1648   JDBEYESJ2->SetYTitle("totalAmplitude perEvent \b");
1649   JDBEYESJ2->SetTitle("HF \b");
1650   JDBEYESJ2->SetMarkerColor(2);
1651   JDBEYESJ2->SetLineColor(1);
1652   JDBEYESJ2->SetMinimum(0.8);
1653   JDBEYESJ2->Draw("HIST same P0");
1654   JDBEYESJ2->Clear();
1655 
1656   cmain1->cd(4);
1657   TH1F *JDBEYESJ3 = (TH1F *)dir->FindObjectAny("h_totalAmplitudeHOperEvent");
1658   JDBEYESJ3->SetStats(0);
1659   JDBEYESJ3->SetMarkerStyle(20);
1660   JDBEYESJ3->SetMarkerSize(0.8);
1661   JDBEYESJ3->GetYaxis()->SetLabelSize(0.04);
1662   JDBEYESJ3->SetXTitle("iEvent \b");
1663   JDBEYESJ3->SetYTitle("totalAmplitude perEvent \b");
1664   JDBEYESJ3->SetTitle("HO \b");
1665   JDBEYESJ3->SetMarkerColor(2);
1666   JDBEYESJ3->SetLineColor(1);
1667   JDBEYESJ3->SetMinimum(0.8);
1668   JDBEYESJ3->Draw("HIST same P0");
1669   JDBEYESJ3->Clear();
1670 
1671   cmain1->Modified();
1672   cmain1->Update();
1673   cmain1->Print("EVENTDEPENDENCE.png");
1674   cmain1->Clear();
1675 
1676   std::cout << " EVENTDEPENDENCE " << std::endl;
1677 
1678   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1679 
1680   // ALL SubDet
1681   gStyle->SetOptTitle(0);
1682   TCanvas *cmain = new TCanvas("cmain", "MAP", 1000, 1000);
1683   gPad->SetGridy();
1684   gPad->SetGridx();
1685   gPad->SetLogz();
1686   Map_ALL->SetTitleOffset(1.3, "Y");
1687   Map_ALL->SetXTitle("#eta \b");
1688   Map_ALL->SetYTitle("#phi \b");
1689   Map_ALL->Draw("COLZ");
1690   Map_ALL->GetYaxis()->SetRangeUser(0, 72.);
1691   Map_ALL->GetZaxis()->SetRangeUser(0, 1.);
1692   cmain->Modified();
1693   cmain->Update();
1694   cmain->Print("MAP.png");
1695   cmain->Clear();
1696 
1697   std::cout << " MAP_ALL " << std::endl;
1698   //======================================================================
1699 
1700   //====================================================================== html pages  CREATING:
1701   //======================================================================
1702   // Creating each test kind for each subdet html pages:
1703   std::string raw_class, raw_class1, raw_class2, raw_class3;
1704   int ind = 0;
1705 
1706   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1707     ofstream htmlFileT, htmlFileC, htmlFileD, htmlFileP, htmlFileS;
1708     if (sub == 1) {
1709       htmlFileT.open("HB_Tile.html");
1710       htmlFileC.open("HB_Calib.html");
1711       htmlFileD.open("HB_Drift.html");
1712       htmlFileP.open("HB_Pedestals.html");
1713       htmlFileS.open("HB_Shapes.html");
1714     }
1715     if (sub == 2) {
1716       htmlFileT.open("HE_Tile.html");
1717       htmlFileC.open("HE_Calib.html");
1718       htmlFileD.open("HE_Drift.html");
1719       htmlFileP.open("HE_Pedestals.html");
1720       htmlFileS.open("HE_Shapes.html");
1721     }
1722     if (sub == 3) {
1723       htmlFileT.open("HO_Tile.html");
1724       htmlFileC.open("HO_Calib.html");
1725       htmlFileD.open("HO_Drift.html");
1726       htmlFileP.open("HO_Pedestals.html");
1727       htmlFileS.open("HO_Shapes.html");
1728     }
1729     if (sub == 4) {
1730       htmlFileT.open("HF_Tile.html");
1731       htmlFileC.open("HF_Calib.html");
1732       htmlFileD.open("HF_Drift.html");
1733       htmlFileP.open("HF_Pedestals.html");
1734       htmlFileS.open("HF_Shapes.html");
1735     }
1736 
1737     // Megatile channels
1738     htmlFileT << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
1739     htmlFileT << "<head>" << std::endl;
1740     htmlFileT << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
1741     htmlFileT << "<title> Remote Monitoring Tool Global</title>" << std::endl;
1742     htmlFileT << "<style type=\"text/css\">" << std::endl;
1743     htmlFileT << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
1744               << std::endl;
1745     htmlFileT << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
1746     htmlFileT << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
1747                  "text-align: center;}"
1748               << std::endl;
1749     htmlFileT << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
1750     htmlFileT << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
1751     htmlFileT << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
1752     htmlFileT << "</style>" << std::endl;
1753     htmlFileT << "<body>" << std::endl;
1754 
1755     if (sub == 1)
1756       htmlFileT << "<h1> Criteria for megatile channels for HB, RUN = " << runnumber << " </h1>" << std::endl;
1757     if (sub == 2)
1758       htmlFileT << "<h1> Criteria for megatile channels for HE, RUN = " << runnumber << " </h1>" << std::endl;
1759     if (sub == 3)
1760       htmlFileT << "<h1> Criteria for megatile channels for HO, RUN = " << runnumber << " </h1>" << std::endl;
1761     if (sub == 4)
1762       htmlFileT << "<h1> Criteria for megatile channels for HF, RUN = " << runnumber << " </h1>" << std::endl;
1763     htmlFileT << "<br>" << std::endl;
1764 
1765     // Test Entries
1766 
1767     htmlFileT << "<h2> 0. Entries for each channel.</h3>" << std::endl;
1768     htmlFileT << "<h3> 0.A. Entries in each channel for each depth.</h3>" << std::endl;
1769     htmlFileT << "<h4> Channel legend: color is number of hits in digi collection </h4>" << std::endl;
1770     if (sub == 1)
1771       htmlFileT << " <img src=\"MapRateEntryHB.png\" />" << std::endl;
1772     if (sub == 2)
1773       htmlFileT << " <img src=\"MapRateEntryHE.png\" />" << std::endl;
1774     if (sub == 3)
1775       htmlFileT << " <img src=\"MapRateEntryHO.png\" />" << std::endl;
1776     if (sub == 4)
1777       htmlFileT << " <img src=\"MapRateEntryHF.png\" />" << std::endl;
1778     htmlFileT << "<br>" << std::endl;
1779 
1780     // Test Cm
1781     htmlFileT << "<h2> 1. Cm criterion: CapID errors for each channel.</h3>" << std::endl;
1782     htmlFileT << "<h3> 1.A. Rate of CapId failures in each channel for each depth.</h3>" << std::endl;
1783     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
1784     if (sub == 1)
1785       htmlFileT << " <img src=\"MapRateCapIDHB.png\" />" << std::endl;
1786     if (sub == 2)
1787       htmlFileT << " <img src=\"MapRateCapIDHE.png\" />" << std::endl;
1788     if (sub == 3)
1789       htmlFileT << " <img src=\"MapRateCapIDHO.png\" />" << std::endl;
1790     if (sub == 4)
1791       htmlFileT << " <img src=\"MapRateCapIDHF.png\" />" << std::endl;
1792     htmlFileT << "<br>" << std::endl;
1793 
1794     // Am
1795     htmlFileT << "<h2> 2. Am criterion: ADC amplitude collected over all TSs(Full Amplitude) for each channel. </h3>"
1796               << std::endl;
1797     htmlFileT << "<h3> 2.A. Full ADC amplitude distribution over all events, channels and depths.</h3>" << std::endl;
1798     htmlFileT << "<h4> Legend: Bins less " << MIN_M[2][sub] << " correpond to bad ADC amplitude </h4>" << std::endl;
1799     if (sub == 1)
1800       htmlFileT << " <img src=\"HistAmplHB.png\" />" << std::endl;
1801     if (sub == 2)
1802       htmlFileT << " <img src=\"HistAmplHE.png\" />" << std::endl;
1803     if (sub == 3)
1804       htmlFileT << " <img src=\"HistAmplHO.png\" />" << std::endl;
1805     if (sub == 4)
1806       htmlFileT << " <img src=\"HistAmplHF.png\" />" << std::endl;
1807     htmlFileT << "<br>" << std::endl;
1808     htmlFileT << "<h3> 2.B. Rate of bad ADC amplitude (<" << MIN_M[2][sub] << ") in each channel for each depth. </h3>"
1809               << std::endl;
1810     htmlFileT << "<h4> Channel legend: white - good, other colours - bad. </h4>" << std::endl;
1811     if (sub == 1)
1812       htmlFileT << " <img src=\"MapRateAmplHB.png\" />" << std::endl;
1813     if (sub == 2)
1814       htmlFileT << " <img src=\"MapRateAmplHE.png\" />" << std::endl;
1815     if (sub == 3)
1816       htmlFileT << " <img src=\"MapRateAmplHO.png\" />" << std::endl;
1817     if (sub == 4)
1818       htmlFileT << " <img src=\"MapRateAmplHF.png\" />" << std::endl;
1819     htmlFileT << "<br>" << std::endl;
1820 
1821     // Test Wm
1822     htmlFileT << "<h2> 3. Wm criterion: RMS (width) of ADC amplutude for each channel.</h3>" << std::endl;
1823     htmlFileT << "<h3> 3.A. RMS distribution over all events, channel and depth.</h3>" << std::endl;
1824     htmlFileT << "<h4> Legend: Bins less " << MIN_M[3][sub] << " and more " << MAX_M[3][sub]
1825               << " correpond to bad RMS </h4>" << std::endl;
1826     if (sub == 1)
1827       htmlFileT << " <img src=\"HistRMSHB.png\" />" << std::endl;
1828     if (sub == 2)
1829       htmlFileT << " <img src=\"HistRMSHE.png\" />" << std::endl;
1830     if (sub == 3)
1831       htmlFileT << " <img src=\"HistRMSHO.png\" />" << std::endl;
1832     if (sub == 4)
1833       htmlFileT << " <img src=\"HistRMSHF.png\" />" << std::endl;
1834     htmlFileT << "<br>" << std::endl;
1835     htmlFileT << "<h3> 3.B. Rate of bad RMS (<" << MIN_M[3][sub] << ",>" << MAX_M[3][sub]
1836               << ") in each channel for each depth.</h3>" << std::endl;
1837     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
1838     if (sub == 1)
1839       htmlFileT << " <img src=\"MapRateRMSHB.png\" />" << std::endl;
1840     if (sub == 2)
1841       htmlFileT << " <img src=\"MapRateRMSHE.png\" />" << std::endl;
1842     if (sub == 3)
1843       htmlFileT << " <img src=\"MapRateRMSHO.png\" />" << std::endl;
1844     if (sub == 4)
1845       htmlFileT << " <img src=\"MapRateRMSHF.png\" />" << std::endl;
1846     htmlFileT << "<br>" << std::endl;
1847 
1848     // Rm
1849     htmlFileT << "<h2> 4. Rm criterion: Ratio ADC value sum over four near maximum (-2, -1, max, +1) TS to ADC value "
1850                  "sum over all TS for each channel. </h3>"
1851               << std::endl;
1852     htmlFileT << "<h3> 4.A. Ratio distribution over all events, channels and depths.</h3>" << std::endl;
1853     htmlFileT << "<h4> Legend: Bins less " << MIN_M[4][sub] << " and more " << MAX_M[4][sub]
1854               << " correpond to bad ratio </h4>" << std::endl;
1855     if (sub == 1)
1856       htmlFileT << " <img src=\"Hist43TStoAllTSHB.png\" />" << std::endl;
1857     if (sub == 2)
1858       htmlFileT << " <img src=\"Hist43TStoAllTSHE.png\" />" << std::endl;
1859     if (sub == 3)
1860       htmlFileT << " <img src=\"Hist43TStoAllTSHO.png\" />" << std::endl;
1861     if (sub == 4)
1862       htmlFileT << " <img src=\"Hist43TStoAllTSHF.png\" />" << std::endl;
1863     htmlFileT << "<br>" << std::endl;
1864     htmlFileT << "<h3> 4.B. Rate of bad ratio (<" << MIN_M[4][sub] << ", >" << MAX_M[4][sub]
1865               << ") in each channel for each depth.</h3>" << std::endl;
1866     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
1867     if (sub == 1)
1868       htmlFileT << " <img src=\"MapRate43TStoAllTSHB.png\" />" << std::endl;
1869     if (sub == 2)
1870       htmlFileT << " <img src=\"MapRate43TStoAllTSHE.png\" />" << std::endl;
1871     if (sub == 3)
1872       htmlFileT << " <img src=\"MapRate43TStoAllTSHO.png\" />" << std::endl;
1873     if (sub == 4)
1874       htmlFileT << " <img src=\"MapRate43TStoAllTSHF.png\" />" << std::endl;
1875     htmlFileT << "<br>" << std::endl;
1876 
1877     // TNm
1878     htmlFileT << "<h2> 5. TNm criterion: Mean TS position for each channel.</h3>" << std::endl;
1879     htmlFileT << "<h3> 5.A. TN position distribution over all events, channels and depths.</h3>" << std::endl;
1880     htmlFileT << "<h4> Legend: Bins less " << MIN_M[5][sub] << " and more " << MAX_M[5][sub]
1881               << " correpond to bad mean position </h4>" << std::endl;
1882     if (sub == 1)
1883       htmlFileT << " <img src=\"HistMeanPosHB.png\" />" << std::endl;
1884     if (sub == 2)
1885       htmlFileT << " <img src=\"HistMeanPosHE.png\" />" << std::endl;
1886     if (sub == 3)
1887       htmlFileT << " <img src=\"HistMeanPosHO.png\" />" << std::endl;
1888     if (sub == 4)
1889       htmlFileT << " <img src=\"HistMeanPosHF.png\" />" << std::endl;
1890     htmlFileT << "<br>" << std::endl;
1891     htmlFileT << "<h3> 5.B. Rate of bad TN position  (<" << MIN_M[5][sub] << ", >" << MAX_M[5][sub]
1892               << ") in each channel for each depth. </h3>" << std::endl;
1893     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
1894     if (sub == 1)
1895       htmlFileT << " <img src=\"MapRateMeanPosHB.png\" />" << std::endl;
1896     if (sub == 2)
1897       htmlFileT << " <img src=\"MapRateMeanPosHE.png\" />" << std::endl;
1898     if (sub == 3)
1899       htmlFileT << " <img src=\"MapRateMeanPosHO.png\" />" << std::endl;
1900     if (sub == 4)
1901       htmlFileT << " <img src=\"MapRateMeanPosHF.png\" />" << std::endl;
1902     htmlFileT << "<br>" << std::endl;
1903 
1904     // TXm
1905     htmlFileT << "<h2> 6.TXm criterion: Maximum TS position for each channel.</h3>" << std::endl;
1906     htmlFileT << "<h3> 6.A. TX position distribution over all events, channel and depth.</h3>" << std::endl;
1907     htmlFileT << "<h4> Legend: Bins less " << MIN_M[6][sub] << " and more " << MAX_M[6][sub]
1908               << " correpond to bad position </h4>" << std::endl;
1909     if (sub == 1)
1910       htmlFileT << " <img src=\"HistMaxPosHB.png\" />" << std::endl;
1911     if (sub == 2)
1912       htmlFileT << " <img src=\"HistMaxPosHE.png\" />" << std::endl;
1913     if (sub == 3)
1914       htmlFileT << " <img src=\"HistMaxPosHO.png\" />" << std::endl;
1915     if (sub == 4)
1916       htmlFileT << " <img src=\"HistMaxPosHF.png\" />" << std::endl;
1917     htmlFileT << "<br>" << std::endl;
1918     htmlFileT << "<h3> 6.B. Rate of bad TX position  (<" << MIN_M[6][sub] << ", >" << MAX_M[6][sub]
1919               << ") in each channel for each depth. </h3>" << std::endl;
1920     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
1921     if (sub == 1)
1922       htmlFileT << " <img src=\"MapRateMaxPosHB.png\" />" << std::endl;
1923     if (sub == 2)
1924       htmlFileT << " <img src=\"MapRateMaxPosHE.png\" />" << std::endl;
1925     if (sub == 3)
1926       htmlFileT << " <img src=\"MapRateMaxPosHO.png\" />" << std::endl;
1927     if (sub == 4)
1928       htmlFileT << " <img src=\"MapRateMaxPosHF.png\" />" << std::endl;
1929     htmlFileT << "<br>" << std::endl;
1930 
1931     htmlFileT << "</body> " << std::endl;
1932     htmlFileT << "</html> " << std::endl;
1933     htmlFileT.close();
1934 
1935     // Pedestals
1936     htmlFileP << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
1937     htmlFileP << "<head>" << std::endl;
1938     htmlFileP << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
1939     htmlFileP << "<title> Remote Monitoring Tool Global</title>" << std::endl;
1940     htmlFileP << "<style type=\"text/css\">" << std::endl;
1941     htmlFileP << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
1942               << std::endl;
1943     htmlFileP << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
1944     htmlFileP << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
1945                  "text-align: center;}"
1946               << std::endl;
1947     htmlFileP << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
1948     htmlFileP << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
1949     htmlFileP << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
1950     htmlFileP << "</style>" << std::endl;
1951     htmlFileP << "<body>" << std::endl;
1952 
1953     if (sub == 1)
1954       htmlFileP << "<h1> Pedestals for HB, RUN = " << runnumber << " </h1>" << std::endl;
1955     if (sub == 2)
1956       htmlFileP << "<h1> Pedestals for HE, RUN = " << runnumber << " </h1>" << std::endl;
1957     if (sub == 3)
1958       htmlFileP << "<h1> Pedestals for HO, RUN = " << runnumber << " </h1>" << std::endl;
1959     if (sub == 4)
1960       htmlFileP << "<h1> Pedestals for HF, RUN = " << runnumber << " </h1>" << std::endl;
1961     htmlFileP << "<br>" << std::endl;
1962 
1963     // Pedestal:
1964     htmlFileP << "<h2> 1.Pm criterion: Pedestals for each CapID .</h3>" << std::endl;
1965     htmlFileP << "<h3> 1.A. Pedestal distribution over all events, channels for each CapID and all depths.</h3>"
1966               << std::endl;
1967     htmlFileP << "<h4> Legend: Bins less " << Pedest[0][sub] << " correpond to bad Pedestals </h4>" << std::endl;
1968     if (sub == 1)
1969       htmlFileP << " <img src=\"HistPedestalsHB.png\" />" << std::endl;
1970     if (sub == 2)
1971       htmlFileP << " <img src=\"HistPedestalsHE.png\" />" << std::endl;
1972     if (sub == 3)
1973       htmlFileP << " <img src=\"HistPedestalsHO.png\" />" << std::endl;
1974     if (sub == 4)
1975       htmlFileP << " <img src=\"HistPedestalsHF.png\" />" << std::endl;
1976     htmlFileP << "<br>" << std::endl;
1977     htmlFileP << "<h3> 1.B. Rate of channels at very low Pedestals at least in one CapID for each depth.</h3>"
1978               << std::endl;
1979     htmlFileP << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
1980     if (sub == 1)
1981       htmlFileP << " <img src=\"MapRatePedHB.png\" />" << std::endl;
1982     if (sub == 2)
1983       htmlFileP << " <img src=\"MapRatePedHE.png\" />" << std::endl;
1984     if (sub == 3)
1985       htmlFileP << " <img src=\"MapRatePedHO.png\" />" << std::endl;
1986     if (sub == 4)
1987       htmlFileP << " <img src=\"MapRatePedHF.png\" />" << std::endl;
1988 
1989     // PedestalWidth:
1990     htmlFileP << "<h2> 2.pWm criterion: Pedestal Widths for each CapID .</h3>" << std::endl;
1991     htmlFileP << "<h3> 2.A. Pedestal Widths distribution over all events, channels for each CapID and all depths.</h3>"
1992               << std::endl;
1993     htmlFileP << "<h4> Legend: Bins less " << Pedest[1][sub] << " correpond to bad Pedestal Widths </h4>" << std::endl;
1994     if (sub == 1)
1995       htmlFileP << " <img src=\"HistPedestalWidthsHB.png\" />" << std::endl;
1996     if (sub == 2)
1997       htmlFileP << " <img src=\"HistPedestalWidthsHE.png\" />" << std::endl;
1998     if (sub == 3)
1999       htmlFileP << " <img src=\"HistPedestalWidthsHO.png\" />" << std::endl;
2000     if (sub == 4)
2001       htmlFileP << " <img src=\"HistPedestalWidthsHF.png\" />" << std::endl;
2002     htmlFileP << "<br>" << std::endl;
2003     htmlFileP << "<h3> 2.B. Rate of channels at very low Pedestal Widths at least in one CapID for each depth.</h3>"
2004               << std::endl;
2005     htmlFileP << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
2006     if (sub == 1)
2007       htmlFileP << " <img src=\"MapRatePedWidthsHB.png\" />" << std::endl;
2008     if (sub == 2)
2009       htmlFileP << " <img src=\"MapRatePedWidthsHE.png\" />" << std::endl;
2010     if (sub == 3)
2011       htmlFileP << " <img src=\"MapRatePedWidthsHO.png\" />" << std::endl;
2012     if (sub == 4)
2013       htmlFileP << " <img src=\"MapRatePedWidthsHF.png\" />" << std::endl;
2014 
2015     // Correlations of Pedestal(Width) and fullAmplitude:
2016     htmlFileP << "<h2> 3.Pedestal and pedestalWidths vs Amplitude .</h3>" << std::endl;
2017     htmlFileP << "<h3> 3.A. Correlation of Pedestal(pedestalWidths) and Amplitude over all channels and events .</h3>"
2018               << std::endl;
2019     htmlFileP << "<h4> Legend: colour - entries </h4>" << std::endl;
2020     if (sub == 1)
2021       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHB.png\" />" << std::endl;
2022     if (sub == 2)
2023       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHE.png\" />" << std::endl;
2024     if (sub == 3)
2025       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHO.png\" />" << std::endl;
2026     if (sub == 4)
2027       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHF.png\" />" << std::endl;
2028     htmlFileP << "<br>" << std::endl;
2029 
2030     // TSs Shapes:
2031 
2032     htmlFileS << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
2033     htmlFileS << "<head>" << std::endl;
2034     htmlFileS << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
2035     htmlFileS << "<title> Remote Monitoring Tool Global</title>" << std::endl;
2036     htmlFileS << "<style type=\"text/css\">" << std::endl;
2037     htmlFileS << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
2038               << std::endl;
2039     htmlFileS << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
2040     htmlFileS << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
2041                  "text-align: center;}"
2042               << std::endl;
2043     htmlFileS << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
2044     htmlFileS << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
2045     htmlFileS << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
2046     htmlFileS << "</style>" << std::endl;
2047     htmlFileS << "<body>" << std::endl;
2048 
2049     if (sub == 1)
2050       htmlFileS << "<h1> ADC Shape for HB, RUN = " << runnumber << " </h1>" << std::endl;
2051     if (sub == 2)
2052       htmlFileS << "<h1> ADC Shape for HE, RUN = " << runnumber << " </h1>" << std::endl;
2053     if (sub == 3)
2054       htmlFileS << "<h1> ADC Shape for HO, RUN = " << runnumber << " </h1>" << std::endl;
2055     if (sub == 4)
2056       htmlFileS << "<h1> ADC Shape for HF, RUN = " << runnumber << " </h1>" << std::endl;
2057     htmlFileP << "<br>" << std::endl;
2058 
2059     htmlFileS << "<h2> 1.Mean ADC Shape </h3>" << std::endl;
2060     htmlFileS << "<h3> 1.A. ADC shape averaged over all good channels, depth and events.</h3>" << std::endl;
2061     //     htmlFileS << "<h4> Legend: Bins less "<<Pedest[0][sub]<<" correpond to bad Pedestals </h4>"<< std::endl;
2062     if (sub == 1)
2063       htmlFileS << " <img src=\"HistGoodTSshapesHB.png\" />" << std::endl;
2064     if (sub == 2)
2065       htmlFileS << " <img src=\"HistGoodTSshapesHE.png\" />" << std::endl;
2066     if (sub == 3)
2067       htmlFileS << " <img src=\"HistGoodTSshapesHO.png\" />" << std::endl;
2068     if (sub == 4)
2069       htmlFileS << " <img src=\"HistGoodTSshapesHF.png\" />" << std::endl;
2070     htmlFileS << "<br>" << std::endl;
2071     htmlFileS << "<h3> 1.B. ADC shape averaged over all bad channels, depth and events. Bad channels are selected by 5 "
2072                  "criteria: CapId, A, W, P, Pw</h3>"
2073               << std::endl;
2074     //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
2075     if (sub == 1)
2076       htmlFileS << " <img src=\"HistBadTSshapesHB.png\" />" << std::endl;
2077     if (sub == 2)
2078       htmlFileS << " <img src=\"HistBadTSshapesHE.png\" />" << std::endl;
2079     if (sub == 3)
2080       htmlFileS << " <img src=\"HistBadTSshapesHO.png\" />" << std::endl;
2081     if (sub == 4)
2082       htmlFileS << " <img src=\"HistBadTSshapesHF.png\" />" << std::endl;
2083 
2084     htmlFileS << "<h2> 2. Pattern of channels for Sub-Detector over depth,eta.phi </h3>" << std::endl;
2085     htmlFileS << "<h3> 2.A. reminder:.......................... for HBHE, TS=2;...................................... "
2086                  "for HF, TS=1;..................................... for HO, TS=0,1,2  </h3>"
2087               << std::endl;
2088     if (sub == 1)
2089       htmlFileS << " <img src=\"Hist_mapDepthAllTS2_HB.png\" />" << std::endl;
2090     if (sub == 2)
2091       htmlFileS << " <img src=\"Hist_mapDepthAllTS2_HE.png\" />" << std::endl;
2092     if (sub == 3)
2093       htmlFileS << " <img src=\"Hist_mapDepthAllTS012_HO.png\" />" << std::endl;
2094     if (sub == 4)
2095       htmlFileS << " <img src=\"Hist_mapDepthAllTS1_HF.png\" />" << std::endl;
2096     htmlFileS << "<br>" << std::endl;
2097 
2098     htmlFileS.close();
2099   }  // end sub
2100 
2101   //======================================================================
2102 
2103   //======================================================================
2104   // Creating subdet  html pages:
2105 
2106   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2107     ofstream htmlFile;
2108     if (sub == 1)
2109       htmlFile.open("HB.html");
2110     if (sub == 2)
2111       htmlFile.open("HE.html");
2112     if (sub == 3)
2113       htmlFile.open("HO.html");
2114     if (sub == 4)
2115       htmlFile.open("HF.html");
2116 
2117     htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
2118     htmlFile << "<head>" << std::endl;
2119     htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
2120     htmlFile << "<title> Remote Monitoring Tool </title>" << std::endl;
2121     htmlFile << "<style type=\"text/css\">" << std::endl;
2122     htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
2123              << std::endl;
2124     htmlFile << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
2125     htmlFile << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
2126                 "text-align: center;}"
2127              << std::endl;
2128     htmlFile << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
2129     htmlFile << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
2130     htmlFile << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
2131     htmlFile << "   td.s5 { font-family: arial, arial ce, helvetica; background-color: #FF00FF; }" << std::endl;
2132     htmlFile << "   td.s6 { font-family: arial, arial ce, helvetica; background-color: #9ACD32; }" << std::endl;
2133     htmlFile << "   td.s7 { font-family: arial, arial ce, helvetica; background-color: #32CD32; }" << std::endl;
2134     htmlFile << "   td.s8 { font-family: arial, arial ce, helvetica; background-color: #00FFFF; }" << std::endl;
2135     htmlFile << "   td.s9 { font-family: arial, arial ce, helvetica; background-color: #FFE4E1; }" << std::endl;
2136     htmlFile << "   td.s10 { font-family: arial, arial ce, helvetica; background-color: #A0522D; }" << std::endl;
2137     htmlFile << "   td.s11 { font-family: arial, arial ce, helvetica; background-color: #1E90FF; }" << std::endl;
2138     htmlFile << "   td.s12 { font-family: arial, arial ce, helvetica; background-color: #00BFFF; }" << std::endl;
2139     htmlFile << "   td.s13 { font-family: arial, arial ce, helvetica; background-color: #FFFF00; }" << std::endl;
2140     htmlFile << "   td.s14 { font-family: arial, arial ce, helvetica; background-color: #B8860B; }" << std::endl;
2141     htmlFile << "</style>" << std::endl;
2142     htmlFile << "<body>" << std::endl;
2143     if (sub == 1)
2144       htmlFile << "<h1> HCAL BARREL, RUN = " << runnumber << " </h1>" << std::endl;
2145     if (sub == 2)
2146       htmlFile << "<h1> HCAL ENDCAP, RUN = " << runnumber << " </h1>" << std::endl;
2147     if (sub == 3)
2148       htmlFile << "<h1> HCAL OUTER, RUN = " << runnumber << " </h1>" << std::endl;
2149     if (sub == 4)
2150       htmlFile << "<h1> HCAL FORWARD, RUN = " << runnumber << " </h1>" << std::endl;
2151     htmlFile << "<br>" << std::endl;
2152 
2153     htmlFile << "<a name=\"Top\"></a>\n";
2154     htmlFile << "<b>Contents:<br>\n";
2155     htmlFile << "1. <a href=\"#AnalysisResults\">Analysis results</a><br>\n";
2156     htmlFile << "2. <a href=\"#Status\">Status</a><br>\n";
2157     htmlFile << "2A. <a href=\"#ChannelMap\">Channel map</a><br>\n";
2158     //   htmlFile << "2B. <a href=\"#BadChannels\">List of bad channels</a><br>\n";
2159     //   htmlFile << "2C. <a href=\"#BadPedestals\">List of channels with bad pedestals</a><br>\n";
2160 
2161     htmlFile << "<a name=\"AnalysisResults\"></a>\n";
2162     if (sub == 1)
2163       htmlFile << "<h2> 1. Analysis results for HB</h2>" << std::endl;
2164     if (sub == 2)
2165       htmlFile << "<h2> 1. Analysis results for HE</h2>" << std::endl;
2166     if (sub == 3)
2167       htmlFile << "<h2> 1. Analysis results for HO</h2>" << std::endl;
2168     if (sub == 4)
2169       htmlFile << "<h2> 1. Analysis results for HF</h2>" << std::endl;
2170     htmlFile << "<table width=\"400\">" << std::endl;
2171     htmlFile << "<tr>" << std::endl;
2172 
2173     if (sub == 1) {
2174       // AZ 12.03.2019
2175       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2176                << runnumber << "/HB_Tile.html\">Megatile Channels</a></td>" << std::endl;
2177       //     htmlFile << "  <td><a href=\"HB_Tile.html\">Megatile Channels</a></td>"<< std::endl;
2178 
2179       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HB_Calib.html\">Calibration Channels</a></td>"<< std::endl;
2180       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HB_Drift.html\">Gain Stability</a></td>"<< std::endl;
2181       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2182                << runnumber << "/HB_Pedestals.html\">Pedestals</a></td>" << std::endl;
2183       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2184                << runnumber << "/HB_Shapes.html\">ADC Shapes</a></td>" << std::endl;
2185     }
2186     if (sub == 2) {
2187       // AZ 12.03.2019
2188       htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2189                << runnumber << "/HE_Tile.html\">Megatile Channels</a></td>" << std::endl;
2190       //     htmlFile << "  <td><a href=\"HE_Tile.html\">Megatile Channels</a></td>"<< std::endl;
2191 
2192       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HE_Calib.html\">Calibration Channels</a></td>"<< std::endl;
2193       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HE_Drift.html\">Gain Stability</a></td>"<< std::endl;
2194       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2195                << runnumber << "/HE_Pedestals.html\">Pedestals</a></td>" << std::endl;
2196       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2197                << runnumber << "/HE_Shapes.html\">ADC Shapes</a></td>" << std::endl;
2198     }
2199     if (sub == 3) {
2200       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2201                << runnumber << "/HO_Tile.html\">Megatile Channels</a></td>" << std::endl;
2202       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HO_Calib.html\">Calibration Channels</a></td>"<< std::endl;
2203       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HO_Drift.html\">Gain Stability</a></td>"<< std::endl;
2204       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2205                << runnumber << "/HO_Pedestals.html\">Pedestals</a></td>" << std::endl;
2206       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2207                << runnumber << "/HO_Shapes.html\">ADC Shapes</a></td>" << std::endl;
2208     }
2209     if (sub == 4) {
2210       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2211                << runnumber << "/HF_Tile.html\">Megatile Channels</a></td>" << std::endl;
2212       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HF_Calib.html\">Calibration Channels</a></td>"<< std::endl;
2213       //       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"<<runnumber<<"/HF_Drift.html\">Gain Stability</a></td>"<< std::endl;
2214       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2215                << runnumber << "/HF_Pedestals.html\">Pedestals</a></td>" << std::endl;
2216       htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2217                << runnumber << "/HF_Shapes.html\">ADC Shapes</a></td>" << std::endl;
2218     }
2219 
2220     htmlFile << "</tr>" << std::endl;
2221     htmlFile << "</table>" << std::endl;
2222     htmlFile << "<br>" << std::endl;
2223 
2224     htmlFile << "<a name=\"Status\"></a>\n";
2225     if (sub == 1)
2226       htmlFile << "<h2> 2.Status HB over all criteria </h2>" << std::endl;
2227     if (sub == 2)
2228       htmlFile << "<h2> 2.Status HE over all criteria </h2>" << std::endl;
2229     if (sub == 3)
2230       htmlFile << "<h2> 2.Status HO over all criteria </h2>" << std::endl;
2231     if (sub == 4)
2232       htmlFile << "<h2> 2.Status HF over all criteria </h2>" << std::endl;
2233 
2234     htmlFile << "<a name=\"ChannelMap\"></a>\n";
2235     htmlFile << "<h3> 2.A.Channel map for each Depth </h3>" << std::endl;
2236     htmlFile << "<h4> Channel legend: yellow - good, white - "
2237                 "not applicable or out of range </h4>"
2238              << std::endl;
2239     if (sub == 1)
2240       htmlFile << " <img src=\"MAPHB.png\" />" << std::endl;
2241     if (sub == 2)
2242       htmlFile << " <img src=\"MAPHE.png\" />" << std::endl;
2243     if (sub == 3)
2244       htmlFile << " <img src=\"MAPHO.png\" />" << std::endl;
2245     if (sub == 4)
2246       htmlFile << " <img src=\"MAPHF.png\" />" << std::endl;
2247     htmlFile << "<br>" << std::endl;
2248     htmlFile << "<a href=\"#Top\">to top</a><br>\n";
2249 
2250     /////////////////////////////////////////////////////////////////   AZ 19.03.2018
2251     /*     
2252 //     htmlFile << "<h3> 2.B.List of Bad channels (rate > 0.1) and its rates for each RMT criteria (for GS - %) </h3>"<< std::endl;
2253 
2254      htmlFile << "<a name=\"BadChannels\"></a>\n";
2255      htmlFile << "<h3> 2.B.List of Bad channels (rate > 0.1) and its rates for each RMT criteria </h3>"<< std::endl;
2256 
2257      //htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
2258      //   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;
2259   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;
2260 
2261      htmlFile << "<table>"<< std::endl;     
2262      htmlFile << "<tr>";
2263      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
2264      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
2265      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
2266      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
2267      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
2268      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
2269      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
2270      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
2271      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
2272      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
2273      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
2274      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
2275      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
2276      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
2277      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
2278      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
2279      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
2280      htmlFile << "<td class=\"s5\" align=\"center\">Cm</td>"   << std::endl;
2281      htmlFile << "<td class=\"s5\" align=\"center\">Am</td>"   << std::endl;
2282      htmlFile << "<td class=\"s5\" align=\"center\">Wm</td>"   << std::endl;
2283      htmlFile << "<td class=\"s5\" align=\"center\">Rm</td>"   << std::endl;
2284      htmlFile << "<td class=\"s5\" align=\"center\">TNm</td>"   << std::endl;
2285      htmlFile << "<td class=\"s5\" align=\"center\">TXm</td>"   << std::endl;
2286 //     htmlFile << "<td class=\"s8\" align=\"center\">Cc</td>"   << std::endl;
2287 //     htmlFile << "<td class=\"s8\" align=\"center\">Ac</td>"   << std::endl;
2288 //     htmlFile << "<td class=\"s8\" align=\"center\">Wc</td>"   << std::endl;
2289 //     htmlFile << "<td class=\"s8\" align=\"center\">Rc</td>"   << std::endl;
2290 //     htmlFile << "<td class=\"s8\" align=\"center\">TNc</td>"   << std::endl;
2291 //     htmlFile << "<td class=\"s8\" align=\"center\">TXc</td>"   << std::endl; 
2292 //     htmlFile << "<td class=\"s9\" align=\"center\">GS (%)</td>"   << std::endl;
2293      htmlFile << "<td class=\"s4\" align=\"center\">Pm</td>"   << std::endl;
2294      htmlFile << "<td class=\"s4\" align=\"center\">pWm</td>"   << std::endl;
2295      htmlFile << "</tr>"   << std::endl;     
2296    
2297      for (int i=1;i<=NBad;i++) {
2298         if((ind%2)==1){
2299            raw_class="<td class=\"s2\" align=\"center\">";
2300        raw_class1="<td class=\"s6\" align=\"center\">";
2301        raw_class2="<td class=\"s11\" align=\"center\">";
2302        raw_class3="<td class=\"s13\" align=\"center\">";
2303        
2304         }else{
2305            raw_class="<td class=\"s3\" align=\"center\">";
2306        raw_class1="<td class=\"s7\" align=\"center\">";
2307        raw_class2="<td class=\"s12\" align=\"center\">";
2308        raw_class3="<td class=\"s14\" align=\"center\">";
2309         }
2310         const CellDB db;
2311         CellDB ce;
2312     if ((ce.size()>=1)&&(Sub[2][i]==sub)) {
2313     // AZ 19.03.2018
2314     
2315 // AZ 19           if (Sub[2][i]==1) {
2316 // AZ 19          ce = db.find("subdet", "HB").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
2317 // 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;}
2318 // 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;}
2319 // AZ 19          }
2320 // AZ 19       if (Sub[2][i]==2) {
2321 // AZ 19          ce = db.find("subdet", "HE").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
2322 // 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;}
2323 // 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;}    
2324 // AZ 19          }
2325 // AZ 19       if (Sub[2][i]==3) {
2326 // AZ 19          ce = db.find("subdet", "HO").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
2327 // 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;}
2328 // 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;}    
2329 // AZ 19          }    
2330 // AZ 19       if (Sub[2][i]==4) {
2331 // AZ 19          ce = db.find("subdet", "HF").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
2332 // 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;}
2333 // 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;}    
2334 // AZ 19          }
2335     
2336        htmlFile << "<tr>"<< std::endl;
2337            htmlFile << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
2338            htmlFile << raw_class<< Eta[2][i]<<"</td>"<< std::endl;
2339            htmlFile << raw_class<< Phi[2][i]<<"</td>"<< std::endl;
2340            htmlFile << raw_class<< Depth[2][i] <<"</td>"<< std::endl;
2341            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
2342            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
2343            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
2344            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
2345            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
2346            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
2347            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
2348            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
2349            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
2350            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
2351            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
2352            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
2353            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
2354        htmlFile << raw_class1<< Map_Ampl[1][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2355            htmlFile << raw_class1<< Map_Ampl[2][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2356        htmlFile << raw_class1<< Map_Ampl[3][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2357        htmlFile << raw_class1<< Map_Ampl[4][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2358        htmlFile << raw_class1<< Map_Ampl[5][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2359        htmlFile << raw_class1<< Map_Ampl[6][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2360 //     htmlFile << raw_class2<< Map_Ampl[11][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2361 //         htmlFile << raw_class2<< Map_Ampl[12][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;  
2362 //     htmlFile << raw_class2<< Map_Ampl[13][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2363 //     htmlFile << raw_class2<< Map_Ampl[14][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2364 //     htmlFile << raw_class2<< Map_Ampl[15][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2365 //     htmlFile << raw_class2<< Map_Ampl[16][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2366 //     htmlFile << raw_class3<< Map_Ampl[21][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2367        htmlFile << raw_class<< Map_Ampl[31][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2368        htmlFile << raw_class<< Map_Ampl[32][Sub[2][i]][Depth[2][i]]->GetBinContent(Eta[2][i]+41,Phi[2][i]+1)<<"</td>"<< std::endl;
2369        htmlFile << "</tr>" << std::endl;
2370 
2371         ind+=1;
2372     }
2373      } 
2374      htmlFile << "</table>" << std::endl;
2375      htmlFile << "<br>"<< std::endl;
2376      htmlFile << "<a href=\"#Top\">to top</a><br>\n";
2377 
2378     
2379      htmlFile << "<h3> 2.C.List of Gain unstable channels and its value in % (for other criterias - rate)</h3>"<< std::endl;
2380      htmlFile << "<table>"<< std::endl;         
2381      htmlFile << "<tr>";
2382      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
2383      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
2384      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
2385      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
2386      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
2387      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
2388      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
2389      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
2390      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
2391      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
2392      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
2393      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
2394      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
2395      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
2396      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
2397      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
2398      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
2399      htmlFile << "<td class=\"s5\" align=\"center\">Cm</td>"   << std::endl;
2400      htmlFile << "<td class=\"s5\" align=\"center\">Am</td>"   << std::endl;
2401      htmlFile << "<td class=\"s5\" align=\"center\">Wm</td>"   << std::endl;
2402      htmlFile << "<td class=\"s5\" align=\"center\">Rm</td>"   << std::endl;
2403      htmlFile << "<td class=\"s5\" align=\"center\">TNm</td>"   << std::endl;
2404      htmlFile << "<td class=\"s5\" align=\"center\">TXm</td>"   << std::endl;
2405 //     htmlFile << "<td class=\"s8\" align=\"center\">Cc</td>"   << std::endl;
2406 //     htmlFile << "<td class=\"s8\" align=\"center\">Ac</td>"   << std::endl;
2407 //     htmlFile << "<td class=\"s8\" align=\"center\">Wc</td>"   << std::endl;
2408 //     htmlFile << "<td class=\"s8\" align=\"center\">Rc</td>"   << std::endl;
2409 //     htmlFile << "<td class=\"s8\" align=\"center\">TNc</td>"   << std::endl;
2410 //     htmlFile << "<td class=\"s8\" align=\"center\">TXc</td>"   << std::endl; 
2411 //     htmlFile << "<td class=\"s9\" align=\"center\">GS(%)</td>"   << std::endl;
2412      htmlFile << "<td class=\"s4\" align=\"center\">Pm</td>"   << std::endl;
2413      htmlFile << "<td class=\"s4\" align=\"center\">pWm</td>"   << std::endl;
2414      htmlFile << "</tr>"   << std::endl;     
2415    
2416      for (int i=1;i<=NWarn;i++) {
2417         if((ind%2)==1){
2418            raw_class="<td class=\"s2\" align=\"center\">";
2419        raw_class1="<td class=\"s6\" align=\"center\">";
2420        raw_class2="<td class=\"s11\" align=\"center\">";
2421        raw_class3="<td class=\"s13\" align=\"center\">";
2422        
2423         }else{
2424            raw_class="<td class=\"s3\" align=\"center\">";
2425        raw_class1="<td class=\"s7\" align=\"center\">";
2426        raw_class2="<td class=\"s12\" align=\"center\">";
2427        raw_class3="<td class=\"s14\" align=\"center\">";
2428         }
2429         const CellDB db;
2430         CellDB ce;
2431     if ((ce.size()>=1)&&(Sub[1][i]==sub)) {
2432            if (Sub[1][i]==1) {
2433           ce = db.find("subdet", "HB").find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
2434           if (ce.size()==0) {cout<<"Error: No such HB, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
2435           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;}
2436           }
2437        if (Sub[1][i]==2) {
2438           ce = db.find("subdet", "HE").find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
2439           if (ce.size()==0) {cout<<"Error: No such HE, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
2440           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;}    
2441           }
2442        if (Sub[1][i]==3) {
2443           ce = db.find("subdet", "HO").find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
2444           if (ce.size()==0) {cout<<"Error: No such HO, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
2445           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;}    
2446           }    
2447        if (Sub[1][i]==4) {
2448           ce = db.find("subdet", "HF").find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
2449           if (ce.size()==0) {cout<<"Error: No such HF, Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;}
2450           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;}    
2451           } 
2452            htmlFile << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
2453            htmlFile << raw_class<< Eta[1][i]<<"</td>"<< std::endl;
2454            htmlFile << raw_class<< Phi[1][i]<<"</td>"<< std::endl;
2455            htmlFile << raw_class<< Depth[1][i] <<"</td>"<< std::endl;
2456            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
2457            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
2458            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
2459            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
2460            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
2461            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
2462            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
2463            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
2464            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
2465            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
2466            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
2467            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
2468            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
2469        htmlFile << raw_class1<< Map_Ampl[1][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2470            htmlFile << raw_class1<< Map_Ampl[2][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2471        htmlFile << raw_class1<< Map_Ampl[3][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2472        htmlFile << raw_class1<< Map_Ampl[4][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2473        htmlFile << raw_class1<< Map_Ampl[5][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2474        htmlFile << raw_class1<< Map_Ampl[6][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2475 //     htmlFile << raw_class2<< Map_Ampl[11][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2476 //           htmlFile << raw_class2<< Map_Ampl[12][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;    
2477 //     htmlFile << raw_class2<< Map_Ampl[13][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2478 //     htmlFile << raw_class2<< Map_Ampl[14][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2479 //     htmlFile << raw_class2<< Map_Ampl[15][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2480 //     htmlFile << raw_class2<< Map_Ampl[16][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2481 //     htmlFile << raw_class3<< Map_Ampl[21][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2482        htmlFile << raw_class<< Map_Ampl[31][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2483        htmlFile << raw_class<< Map_Ampl[32][Sub[1][i]][Depth[1][i]]->GetBinContent(Eta[1][i]+41,Phi[1][i]+1)<<"</td>"<< std::endl;
2484        htmlFile << "</tr>" << std::endl;
2485        htmlFile << "</tr>" << std::endl;
2486            ind+=1;
2487     }
2488      } 
2489      htmlFile << "</table>" << std::endl; 
2490      htmlFile << "<br>"<< std::endl;
2491     
2492      
2493 //     htmlFile << "<h3> 2.D.List of channels with Bad Pedestals (rate > 0.1) and its rates (for GS - %)</h3>"<< std::endl;
2494      htmlFile << "<a name=\"BadPedestals\"></a>\n";
2495      htmlFile << "<h3> 2.C.List of channels with Bad Pedestals (rate > 0.1) and its rates </h3>"<< std::endl;
2496      htmlFile << "<table>"<< std::endl;         
2497      htmlFile << "<tr>";
2498      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
2499      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
2500      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
2501      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
2502      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
2503      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
2504      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
2505      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
2506      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
2507      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
2508      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
2509      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
2510      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
2511      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
2512      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
2513      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
2514      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
2515      htmlFile << "<td class=\"s5\" align=\"center\">Cm</td>"   << std::endl;
2516      htmlFile << "<td class=\"s5\" align=\"center\">Am</td>"   << std::endl;
2517      htmlFile << "<td class=\"s5\" align=\"center\">Wm</td>"   << std::endl;
2518      htmlFile << "<td class=\"s5\" align=\"center\">Rm</td>"   << std::endl;
2519      htmlFile << "<td class=\"s5\" align=\"center\">TNm</td>"   << std::endl;
2520      htmlFile << "<td class=\"s5\" align=\"center\">TXm</td>"   << std::endl;
2521 //     htmlFile << "<td class=\"s8\" align=\"center\">Cc</td>"   << std::endl;
2522 //     htmlFile << "<td class=\"s8\" align=\"center\">Ac</td>"   << std::endl;
2523 //     htmlFile << "<td class=\"s8\" align=\"center\">Wc</td>"   << std::endl;
2524 //     htmlFile << "<td class=\"s8\" align=\"center\">Rc</td>"   << std::endl;
2525 //     htmlFile << "<td class=\"s8\" align=\"center\">TNc</td>"   << std::endl;
2526 //     htmlFile << "<td class=\"s8\" align=\"center\">TXc</td>"   << std::endl; 
2527 //     htmlFile << "<td class=\"s9\" align=\"center\">GS(%)</td>"   << std::endl;
2528      htmlFile << "<td class=\"s4\" align=\"center\">Pm</td>"   << std::endl;
2529      htmlFile << "<td class=\"s4\" align=\"center\">pWm</td>"   << std::endl;
2530      htmlFile << "</tr>"   << std::endl;     
2531    
2532      for (int i=1;i<=NPed;i++) {
2533         if((ind%2)==1){
2534            raw_class="<td class=\"s2\" align=\"center\">";
2535        raw_class1="<td class=\"s6\" align=\"center\">";
2536        raw_class2="<td class=\"s11\" align=\"center\">";
2537        raw_class3="<td class=\"s13\" align=\"center\">";
2538        
2539         }else{
2540            raw_class="<td class=\"s3\" align=\"center\">";
2541        raw_class1="<td class=\"s7\" align=\"center\">";
2542        raw_class2="<td class=\"s12\" align=\"center\">";
2543        raw_class3="<td class=\"s14\" align=\"center\">";
2544         }
2545         const CellDB db;
2546         CellDB ce;
2547     if ((ce.size()>=1)&&(Sub[3][i]==sub)) {
2548     
2549     // AZ 19.03.2018
2550 // AZ 19           if (Sub[3][i]==1) {
2551 // AZ 19          ce = db.find("subdet", "HB").find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
2552 // 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;}
2553 // 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;}
2554 // AZ 19          }
2555 // AZ 19       if (Sub[3][i]==2) {
2556 // AZ 19          ce = db.find("subdet", "HE").find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
2557 // 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;}
2558 // 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;}    
2559 // AZ 19          }
2560 // AZ 19       if (Sub[3][i]==3) {
2561 // AZ 19          ce = db.find("subdet", "HO").find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
2562 // 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;}
2563 // 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;}    
2564 // AZ 19          }    
2565 // AZ 19       if (Sub[3][i]==4) {
2566 // AZ 19          ce = db.find("subdet", "HF").find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
2567 // 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;}
2568 // 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;}    
2569 // AZ 19          } 
2570        
2571            htmlFile << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
2572            htmlFile << raw_class<< Eta[3][i]<<"</td>"<< std::endl;
2573            htmlFile << raw_class<< Phi[3][i]<<"</td>"<< std::endl;
2574            htmlFile << raw_class<< Depth[3][i] <<"</td>"<< std::endl;
2575            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
2576            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
2577            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
2578            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
2579            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
2580            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
2581            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
2582            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
2583            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
2584            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
2585            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
2586            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
2587            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
2588        htmlFile << raw_class1<< Map_Ampl[1][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2589            htmlFile << raw_class1<< Map_Ampl[2][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2590        htmlFile << raw_class1<< Map_Ampl[3][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2591        htmlFile << raw_class1<< Map_Ampl[4][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2592        htmlFile << raw_class1<< Map_Ampl[5][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2593        htmlFile << raw_class1<< Map_Ampl[6][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2594 //     htmlFile << raw_class2<< Map_Ampl[11][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2595 //         htmlFile << raw_class2<< Map_Ampl[12][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;  
2596 //     htmlFile << raw_class2<< Map_Ampl[13][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2597 //     htmlFile << raw_class2<< Map_Ampl[14][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2598 //     htmlFile << raw_class2<< Map_Ampl[15][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2599 //     htmlFile << raw_class2<< Map_Ampl[16][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2600 //     htmlFile << raw_class3<< Map_Ampl[21][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2601        htmlFile << raw_class<< Map_Ampl[31][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2602        htmlFile << raw_class<< Map_Ampl[32][Sub[3][i]][Depth[3][i]]->GetBinContent(Eta[3][i]+41,Phi[3][i]+1)<<"</td>"<< std::endl;
2603        htmlFile << "</tr>" << std::endl;
2604        htmlFile << "</tr>" << std::endl;
2605            ind+=1;
2606     }
2607      } 
2608      htmlFile << "</table><br>" << std::endl;
2609      htmlFile << "<a href=\"#Top\">to top</a><br>\n";
2610 */
2611     ///////////////////////////////////////////////////////////////   AZ 19.03.2018
2612 
2613     htmlFile << "</body> " << std::endl;
2614     htmlFile << "</html> " << std::endl;
2615     htmlFile.close();
2616   }
2617 
2618   //======================================================================
2619   // Creating description html file:
2620   ofstream htmlFile;
2621 
2622   //======================================================================
2623   /*
2624      htmlFile.open("HELP.html");  
2625      htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< std::endl;
2626      htmlFile << "<head>"<< std::endl;
2627      htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< std::endl;
2628      htmlFile << "<title> Remote Monitoring Tool </title>"<< std::endl;
2629      htmlFile << "<style type=\"text/css\">"<< std::endl;
2630      htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< std::endl;
2631      htmlFile << "   td.s0 { font-family: arial, arial ce, helvetica; }"<< std::endl;
2632      htmlFile << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
2633      htmlFile << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< std::endl;
2634      htmlFile << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< std::endl;
2635      htmlFile << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< std::endl;
2636      htmlFile << "</style>"<< std::endl;
2637      htmlFile << "<body>"<< std::endl;
2638      htmlFile << "<h1>  Description of Remote Monitoring Tool criteria for bad channel selection</h1>"<< std::endl;
2639      htmlFile << "<br>"<< std::endl;
2640      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;
2641      htmlFile << "<br>"<< std::endl;
2642      htmlFile << "<h3> - A means full amplitude, collected over all time slices </h3> "<< std::endl;
2643      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;
2644      htmlFile << "<br>"<< std::endl;
2645      htmlFile << "<h3> - W means width of shape distribution. Width is defined as square root from dispersion. </h3> "<< std::endl;
2646      htmlFile << "<br>"<< std::endl;
2647      htmlFile << "<h3> - TN means mean time position of adc signal. </h3> "<< std::endl;
2648      htmlFile << "<br>"<< std::endl;
2649      htmlFile << "<h3> - TX means TS number of maximum signal </h3> "<< std::endl;
2650      htmlFile << "<br>"<< std::endl;     
2651      htmlFile << "<h3> - m means megatile channels. For example Am means Amplitude criteria for megatile channels </h3> "<< std::endl;
2652      htmlFile << "<br>"<< std::endl;
2653      htmlFile << "<h3> - c means calibration channels. For example Ac means Amplitude criteria for calibration channels </h3> "<< std::endl;
2654      htmlFile << "<br>"<< std::endl;
2655      htmlFile << "<h3> - Pm means Pedestals. </h3> "<< std::endl;
2656      htmlFile << "<br>"<< std::endl;  
2657      htmlFile << "<h3> - pWm  means pedestal Width. </h3> "<< std::endl;
2658      htmlFile << "<br>"<< std::endl;
2659      htmlFile << "</body> " << std::endl;
2660      htmlFile << "</html> " << std::endl; 
2661      htmlFile.close();
2662 */
2663   //======================================================================
2664 
2665   //======================================================================
2666   // Creating main html file:
2667   htmlFile.open("MAP.html");
2668   htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
2669   htmlFile << "<head>" << std::endl;
2670   htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
2671   htmlFile << "<title> Remote Monitoring Tool </title>" << std::endl;
2672   htmlFile << "<style type=\"text/css\">" << std::endl;
2673   htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
2674            << std::endl;
2675   htmlFile << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
2676   htmlFile << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
2677               "text-align: center;}"
2678            << std::endl;
2679   htmlFile << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
2680   htmlFile << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
2681   htmlFile << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
2682   htmlFile << "   td.s5 { font-family: arial, arial ce, helvetica; background-color: #FF00FF; }" << std::endl;
2683   htmlFile << "   td.s6 { font-family: arial, arial ce, helvetica; background-color: #9ACD32; }" << std::endl;
2684   htmlFile << "   td.s7 { font-family: arial, arial ce, helvetica; background-color: #32CD32; }" << std::endl;
2685   htmlFile << "</style>" << std::endl;
2686   htmlFile << "<body>" << std::endl;
2687 
2688   htmlFile << "<h1> Remote Monitoring Tool, RUN = " << runnumber << ". </h1>" << std::endl;
2689   htmlFile << "<br>" << std::endl;
2690 
2691   htmlFile << "<h2> 1. Analysis results for subdetectors </h2>" << std::endl;
2692   htmlFile << "<table width=\"400\">" << std::endl;
2693   htmlFile << "<tr>" << std::endl;
2694 
2695   // AZ 12.03.2019
2696   /*
2697      htmlFile << "  <td><a href=\"HB.html\">HB</a></td>"<< std::endl;
2698      htmlFile << "  <td><a href=\"HE.html\">HE</a></td>"<< std::endl;
2699      htmlFile << "  <td><a href=\"HO.html\">HO</a></td>"<< std::endl;
2700      htmlFile << "  <td><a href=\"HF.html\">HF</a></td>"<< std::endl;    
2701 */
2702 
2703   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2704            << runnumber << "/HB.html\">HB</a></td>" << std::endl;
2705   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2706            << runnumber << "/HE.html\">HE</a></td>" << std::endl;
2707   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2708            << runnumber << "/HO.html\">HO</a></td>" << std::endl;
2709   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/GLOBAL_"
2710            << runnumber << "/HF.html\">HF</a></td>" << std::endl;
2711 
2712   htmlFile << "</tr>" << std::endl;
2713   htmlFile << "</table>" << std::endl;
2714   htmlFile << "<br>" << std::endl;
2715 
2716   htmlFile << "<h2> 2. HCAL status over all criteria and subdetectors </h2>" << std::endl;
2717   htmlFile << "<h3> 2.A. Channels in detector space </h3>" << std::endl;
2718   htmlFile << "<h4> Legend for channel status: green - good, others - may be a problems, white - not applicable or out "
2719               "of range </h4>"
2720            << std::endl;
2721   htmlFile << " <img src=\"MAP.png\" />" << std::endl;
2722   htmlFile << "<br>" << std::endl;
2723 
2724   htmlFile << "<h3> 2.B. List of Bad channels </h3>" << std::endl;
2725 
2726   //htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
2727   //   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;
2728   htmlFile << "  <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/GlobalRMT/HELP.html\"> "
2729               "Description of criteria for bad channel selection</a></td>"
2730            << std::endl;
2731 
2732   htmlFile << "<table>" << std::endl;
2733   htmlFile << "<tr>";
2734   htmlFile << "<td class=\"s4\" align=\"center\">#</td>" << std::endl;
2735   htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>" << std::endl;
2736   htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>" << std::endl;
2737   htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>" << std::endl;
2738   htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>" << std::endl;
2739   htmlFile << "<td class=\"s1\" align=\"center\">RM</td>" << std::endl;
2740   htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>" << std::endl;
2741   htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>" << std::endl;
2742   htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>" << std::endl;
2743   htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>" << std::endl;
2744   htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>" << std::endl;
2745   htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>" << std::endl;
2746   htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>" << std::endl;
2747   htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>" << std::endl;
2748   htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>" << std::endl;
2749   htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>" << std::endl;
2750   htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>" << std::endl;
2751   htmlFile << "<td class=\"s5\" align=\"center\">RMT-criteria</td>" << std::endl;
2752   htmlFile << "</tr>" << std::endl;
2753 
2754   ind = 0;
2755   // AZ 19.03.2018
2756   /*     
2757      for (int i=1;i<=NBad;i++) {
2758         if((ind%2)==1){
2759            raw_class="<td class=\"s2\" align=\"center\">";
2760        raw_class1="<td class=\"s6\" align=\"center\">";
2761         }else{
2762            raw_class="<td class=\"s3\" align=\"center\">";
2763        raw_class1="<td class=\"s7\" align=\"center\">";
2764         }
2765         const CellDB db;
2766         const CellDB ce = db.find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
2767     //           if (ce.size()==0) {cout<<"Error: No such Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;continue;}
2768 //  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;}
2769     
2770     if (ce.size()>=1) {
2771        htmlFile << "<tr>"<< std::endl;
2772            htmlFile << "<td class=\"s1\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
2773            htmlFile << raw_class<< Eta[2][i]<<"</td>"<< std::endl;
2774            htmlFile << raw_class<< Phi[2][i]<<"</td>"<< std::endl;
2775            htmlFile << raw_class<< Depth[2][i] <<"</td>"<< std::endl;
2776            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
2777            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
2778            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
2779            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
2780            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
2781            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
2782            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
2783            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
2784            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
2785            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
2786            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
2787            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
2788            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
2789            htmlFile << raw_class1<< Comment[2][i]<<"</td>"<< std::endl;
2790        htmlFile << "</tr>" << std::endl;
2791 
2792         ind+=1;
2793     }
2794      } /// end loop
2795 */
2796   htmlFile << "</table>" << std::endl;
2797   htmlFile << "<br>" << std::endl;
2798   /*     
2799      htmlFile << "<h3> 2.C.List of Gain unstable channels </h3>"<< std::endl;
2800      //htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
2801      //   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;
2802   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;
2803 
2804      htmlFile << "<table>"<< std::endl;     
2805      htmlFile << "<tr>";
2806      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
2807      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
2808      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
2809      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
2810      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
2811      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
2812      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
2813      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
2814      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
2815      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
2816      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
2817      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
2818      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
2819      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
2820      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
2821      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
2822      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
2823      htmlFile << "<td class=\"s5\" align=\"center\">Failed criteria</td>"   << std::endl;
2824      htmlFile << "</tr>"   << std::endl;     
2825    
2826      for (int i=1;i<=NWarn;i++) {
2827         if((ind%2)==1){
2828            raw_class="<td class=\"s2\" align=\"center\">";
2829        raw_class1="<td class=\"s6\" align=\"center\">";
2830         }else{
2831            raw_class="<td class=\"s3\" align=\"center\">";
2832        raw_class1="<td class=\"s7\" align=\"center\">";
2833         }
2834         const CellDB db;
2835         const CellDB ce = db.find("Eta", Eta[1][i]).find("Phi", Phi[1][i]).find("Depth", Depth[1][i]);
2836     //      if (ce.size()==0) {cout<<"Error: No such Eta="<< Eta[1][i] <<", Phi="<< Phi[1][i] <<", Depth="<< Depth[1][i] <<" in database"<<endl;continue;}
2837 //  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;}
2838     
2839     if (ce.size()>=1) {
2840        htmlFile << "<tr>"<< std::endl;
2841            htmlFile << "<td class=\"s1\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
2842            htmlFile << raw_class<< Eta[1][i]<<"</td>"<< std::endl;
2843            htmlFile << raw_class<< Phi[1][i]<<"</td>"<< std::endl;
2844            htmlFile << raw_class<< Depth[1][i] <<"</td>"<< std::endl;
2845            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
2846            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
2847            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
2848            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
2849            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
2850            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
2851            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
2852            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
2853            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
2854            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
2855            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
2856            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
2857            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
2858            htmlFile << raw_class1<< Comment[1][i]<<"</td>"<< std::endl;
2859        htmlFile << "</tr>" << std::endl;
2860 
2861            ind+=1;
2862     }
2863      } 
2864     
2865    
2866      htmlFile << "</table>" << std::endl;
2867      htmlFile << "<br>"<< std::endl;
2868      
2869      
2870      htmlFile << "<h3> 2.D.List of channels with bad Pedestals </h3>"<< std::endl;
2871      // htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
2872      //   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;
2873   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;
2874 
2875      htmlFile << "<table>"<< std::endl;     
2876      htmlFile << "<tr>";
2877      htmlFile << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
2878      htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
2879      htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
2880      htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
2881      htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
2882      htmlFile << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
2883      htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
2884      htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
2885      htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
2886      htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
2887      htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
2888      htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
2889      htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
2890      htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
2891      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
2892      htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
2893      htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
2894      htmlFile << "<td class=\"s5\" align=\"center\">Failed criteria</td>"   << std::endl;
2895      htmlFile << "</tr>"   << std::endl;     
2896    
2897      for (int i=1;i<=NPed;i++) {
2898         if((ind%2)==1){
2899            raw_class="<td class=\"s2\" align=\"center\">";
2900        raw_class1="<td class=\"s6\" align=\"center\">";
2901         }else{
2902            raw_class="<td class=\"s3\" align=\"center\">";
2903        raw_class1="<td class=\"s7\" align=\"center\">";
2904         }
2905         const CellDB db;
2906         const CellDB ce = db.find("Eta", Eta[3][i]).find("Phi", Phi[3][i]).find("Depth", Depth[3][i]);
2907     //      if (ce.size()==0) {cout<<"Error: No such Eta="<< Eta[3][i] <<", Phi="<< Phi[3][i] <<", Depth="<< Depth[3][i] <<" in database"<<endl;continue;}
2908 //  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;}
2909     
2910     if (ce.size()>=1) {
2911        htmlFile << "<tr>"<< std::endl;
2912            htmlFile << "<td class=\"s1\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
2913            htmlFile << raw_class<< Eta[3][i]<<"</td>"<< std::endl;
2914            htmlFile << raw_class<< Phi[3][i]<<"</td>"<< std::endl;
2915            htmlFile << raw_class<< Depth[3][i] <<"</td>"<< std::endl;
2916            htmlFile << raw_class<< ce[0].RBX <<"</td>"<< std::endl;
2917            htmlFile << raw_class<< ce[0].RM <<"</td>"<< std::endl;
2918            htmlFile << raw_class<< ce[0].Pixel <<"</td>"<< std::endl;
2919            htmlFile << raw_class<< ce[0].RMfiber <<"</td>"<< std::endl;
2920            htmlFile << raw_class<< ce[0].FiberCh <<"</td>"<< std::endl;
2921            htmlFile << raw_class<< ce[0].QIE <<"</td>"<< std::endl;
2922            htmlFile << raw_class<< ce[0].ADC<<"</td>"<< std::endl;
2923            htmlFile << raw_class<< ce[0].VMECardID <<"</td>"<< std::endl;
2924            htmlFile << raw_class<< ce[0].dccID <<"</td>"<< std::endl;
2925            htmlFile << raw_class<< ce[0].Spigot <<"</td>"<< std::endl;
2926            htmlFile << raw_class<< ce[0].FiberIndex <<"</td>"<< std::endl;
2927            htmlFile << raw_class<< ce[0].HtrSlot <<"</td>"<< std::endl;
2928            htmlFile << raw_class<< ce[0].HtrTB <<"</td>"<< std::endl;
2929            htmlFile << raw_class1<< Comment[3][i]<<"</td>"<< std::endl;
2930        htmlFile << "</tr>" << std::endl;
2931 
2932            ind+=1;
2933     }
2934      } 
2935     
2936    
2937      htmlFile << "</table>" << std::endl;
2938 */
2939   htmlFile << "</body> " << std::endl;
2940   htmlFile << "</html> " << std::endl;
2941   htmlFile.close();
2942   //======================================================================
2943 
2944   //======================================================================
2945   // Close and delete all possible things:
2946   hfile->Close();
2947   //  hfile->Delete();
2948   //  Exit Root
2949   gSystem->Exit(0);
2950   //======================================================================
2951 }