Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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