Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // How to run:
0002 //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")'
0003 //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")'
0004 // ./RemoteMonitoringMAP.cc.exe root_file1  root_file_ref PEDESTAL
0005 //./RemoteMonitoringMAP.cc.exe root_file1  root_file_ref LASER
0006 
0007 //MapRateAmpl2HB
0008 
0009 #include "LogEleMapdb.h"
0010 
0011 #include <iostream>
0012 #include <fstream>
0013 
0014 #include "TH1.h"
0015 #include "TH2.h"
0016 #include "TCanvas.h"
0017 #include "TROOT.h"
0018 #include <TMath.h>
0019 #include "TStyle.h"
0020 #include "TSystem.h"
0021 #include "TLegend.h"
0022 #include "TText.h"
0023 #include "TAxis.h"
0024 #include "TFile.h"
0025 #include "TLine.h"
0026 #include "TGraph.h"
0027 
0028 using namespace std;
0029 // h_ADC_HBdepth1
0030 // ok change   Hist_ADC_HB_DS
0031 int main(int argc, char *argv[]) {
0032   std::string dirnm = "Analyzer";
0033   gROOT->Reset();
0034   gROOT->SetStyle("Plain");
0035   gStyle->SetOptStat(0);
0036   gStyle->SetOptTitle(1);
0037   // ok change
0038   if (argc < 3)
0039     return 1;
0040   char fname[300];
0041   char refname[300];
0042   char runtypeC[300];
0043   sprintf(fname, "%s", argv[1]);
0044   sprintf(refname, "%s", argv[2]);
0045   sprintf(runtypeC, "%s", argv[3]);
0046   std::cout << fname << " " << refname << " " << runtypeC << std::endl;
0047   // ok change
0048 
0049   //======================================================================
0050   // Connect the input files, parameters and get the 2-d histogram in memory
0051   //    TFile *hfile= new TFile("GlobalHist.root", "READ");
0052   string promt = (string)fname;
0053   string runtype = (string)runtypeC;
0054   string runnumber = "";
0055   for (unsigned int i = promt.size() - 11; i < promt.size() - 5; i++)
0056     runnumber += fname[i];
0057   string refrunnumber = "";
0058   promt = (string)refname;
0059   for (unsigned int i = promt.size() - 11; i < promt.size() - 5; i++)
0060     refrunnumber += refname[i];
0061 
0062   TFile *hfile = new TFile(fname, "READ");
0063   hfile->ls();
0064   TDirectory *dir = (TDirectory *)hfile->FindObjectAny(dirnm.c_str());
0065   TFile *hreffile = new TFile(refname, "READ");
0066   hreffile->ls();
0067   TDirectory *refdir = (TDirectory *)hreffile->FindObjectAny(dirnm.c_str());
0068 
0069   // with TfileService implementation, change everywhere below:     hreffile->Get     to     refdir->FindObjectAny
0070   // with TfileService implementation, change everywhere below:     hfile->Get     to     dir->FindObjectAny
0071 
0072   double MIN_M[7][5];
0073   double MAX_M[7][5];
0074   double MIN_C[7][5];
0075   double MAX_C[7][5];
0076   double porog[5];
0077   double Pedest[2][5];
0078 
0079   if (runtype == "LED") {
0080     //CUTS:    [test][subdetector]                                       ADC amplitude  Am      Width  for Wm             Ratio cut for Rm             TS mean for TNm           TS max  for TXm
0081     double MIN_M_LED[7][5] = {{0., 0., 0., 0., 0.},
0082                               {0., 0., 0., 0., 0.},
0083                               {0, 100., 70., 40., 40.},
0084                               {0, 0.7, 0.7, 0.1, 0.1},
0085                               {0, 0.7, 0.6, 0.40, 0.45},
0086                               {0, 2.5, 1.0, 1.0, 1.0},
0087                               {0, 1.5, 1.5, 0.5, 0.5}};
0088     double MAX_M_LED[7][5] = {{0., 0., 0., 0., 0.},
0089                               {0., 0., 0., 0., 0.},
0090                               {0, 3000, 500000, 3000, 150000},
0091                               {0, 2.5, 2.5, 2.8, 2.6},
0092                               {0, 0.94, 0.95, 1.04, 1.02},
0093                               {0, 5.5, 5.2, 4.8, 4.2},
0094                               {0, 6.5, 6.5, 8.5, 8.5}};
0095     double MIN_C_LED[7][5] = {{0., 0., 0., 0., 0.},
0096                               {0., 0., 0., 0., 0.},
0097                               {0, 1000., 1000., 1000., 100.},
0098                               {0, 1.3, 1.3, 0.7, 0.3},
0099                               {0, 0.76, 0.76, 0.85, 0.5},
0100                               {0, 2.4, 2.4, 1.5, 3.5},
0101                               {0, 1.5, 1.5, 1.5, 3.5}};
0102     double MAX_C_LED[7][5] = {{0., 0., 0., 0., 0.},
0103                               {0., 0., 0., 0., 0.},
0104                               {0, 1E20, 1E20, 1E20, 1E20},
0105                               {0, 1.9, 1.9, 1.65, 1.5},
0106                               {0, 0.94, 0.94, 0.99, 0.8},
0107                               {0, 3.7, 3.7, 2.7, 4.5},
0108                               {0, 2.5, 2.5, 2.5, 4.5}};
0109     double porog_LED[5] = {0., 2., 2., 2., 2.};  // Cut for GS test in pro cents
0110     double Pedest_LED[2][5] = {{0., 0.1, 0.6, 0.1, 0.8},
0111                                {0., 0.1, 0.1, 0.1, 0.4}};  //Cuts for Pedestal  and pedestal  Width
0112     for (int i = 0; i <= 6; i++)
0113       for (int j = 0; j <= 4; j++) {
0114         MIN_M[i][j] = MIN_M_LED[i][j];
0115         MAX_M[i][j] = MAX_M_LED[i][j];
0116         MIN_C[i][j] = MIN_C_LED[i][j];
0117         MAX_C[i][j] = MAX_C_LED[i][j];
0118       }
0119     for (int i = 0; i <= 4; i++) {
0120       porog[i] = porog_LED[i];
0121       Pedest[0][i] = Pedest_LED[0][i];
0122       Pedest[1][i] = Pedest_LED[1][i];
0123     }
0124   }
0125 
0126   if (runtype == "LASER") {
0127     //CUTS:    [test][subdetector]                                  ADC amplitude  Am      Width  for Wm             Ratio cut for Rm             TS mean for TNm           TS max  for TXm
0128     double MIN_M_LASER[7][5] = {{0., 0., 0., 0., 0.},
0129                                 {0., 0., 0., 0., 0.},
0130                                 {0, 40., 40., 100., 40.},
0131                                 {0, 0.3, 0.9, 0.2, 0.2},
0132                                 {0, 0.5, 0.55, 0.55, 0.60},
0133                                 {0, 5.0, 2.5, 1.1, 5.5},
0134                                 {0, 1.5, 1.5, 1.5, 1.5}};
0135     double MAX_M_LASER[7][5] = {{0., 0., 0., 0., 0.},
0136                                 {0., 0., 0., 0., 0.},
0137                                 {0, 3500, 350000, 3500, 150000},
0138                                 {0, 2.5, 3.6, 2.6, 2.1},
0139                                 {0, 1.00, 1.00, 1.04, 1.02},
0140                                 {0, 7.5, 6.5, 4.4, 8.5},
0141                                 {0, 8.5, 8.5, 6.5, 8.5}};
0142     double MIN_C_LASER[7][5] = {{0., 0., 0., 0., 0.},
0143                                 {0., 0., 0., 0., 0.},
0144                                 {0, 1000., 1000., 1000., 100.},
0145                                 {0, 1.3, 1.3, 0.7, 0.3},
0146                                 {0, 0.76, 0.76, 0.85, 0.5},
0147                                 {0, 2.4, 2.4, 1.5, 3.5},
0148                                 {0, 1.5, 1.5, 1.5, 3.5}};
0149     double MAX_C_LASER[7][5] = {{0., 0., 0., 0., 0.},
0150                                 {0., 0., 0., 0., 0.},
0151                                 {0, 1E20, 1E20, 1E20, 1E20},
0152                                 {0, 1.9, 1.9, 1.65, 1.5},
0153                                 {0, 0.94, 0.94, 1.0, 0.8},
0154                                 {0, 3.7, 3.7, 2.7, 4.5},
0155                                 {0, 2.5, 2.5, 2.5, 4.5}};
0156     double porog_LASER[5] = {0., 2., 2., 2., 2.};  // Cut for GS test in pro cents
0157     //     double porog_LASER[5] = {0., 200., 200., 100., 100.}; // Cut for GS test in pro cents
0158     double Pedest_LASER[2][5] = {{0., 0.1, 0.6, 0.1, 0.8},
0159                                  {0., 0.1, 0.1, 0.1, 0.4}};  //Cuts for Pedestal  and pedestal  Width
0160     for (int i = 0; i <= 6; i++)
0161       for (int j = 0; j <= 4; j++) {
0162         MIN_M[i][j] = MIN_M_LASER[i][j];
0163         MAX_M[i][j] = MAX_M_LASER[i][j];
0164         MIN_C[i][j] = MIN_C_LASER[i][j];
0165         MAX_C[i][j] = MAX_C_LASER[i][j];
0166       }
0167     for (int i = 0; i <= 4; i++) {
0168       porog[i] = porog_LASER[i];
0169       Pedest[0][i] = Pedest_LASER[0][i];
0170       Pedest[1][i] = Pedest_LASER[1][i];
0171     }
0172   }
0173   if (runtype == "PEDESTAL") {
0174     //CUTS:    [test][subdetector]                                  ADC amplitude  Am      Width  for Wm             Ratio cut for Rm             TS mean for TNm           TS max  for TXm
0175     double MIN_M_PEDESTAL[7][5] = {{0., 0., 0., 0., 0.},
0176                                    {0., 0., 0., 0., 0.},
0177                                    {0, 10., 10., 200., 5.},
0178                                    {0, 2.7, 2.7, 2.7, 0.2},
0179                                    {0, 0.31, 0.31, 0.05, 0.15},
0180                                    {0, 4.5, 4.5, 4.5, 2.0},
0181                                    {0, 0.5, 0.5, 0.5, 0.5}};
0182     double MAX_M_PEDESTAL[7][5] = {{0., 0., 0., 0., 0.},
0183                                    {0., 0., 0., 0., 0.},
0184                                    {0, 2500., 250000., 2500., 150000.},
0185                                    {0, 3.0, 3.0, 5.0, 3.0},
0186                                    {0, 0.95, 0.95, 1.00, 0.98},
0187                                    {0, 4.6, 4.6, 4.6, 7.0},
0188                                    {0, 9.5, 9.5, 8.5, 8.5}};
0189     double MIN_C_PEDESTAL[7][5] = {{0., 0., 0., 0., 0.},
0190                                    {0., 0., 0., 0., 0.},
0191                                    {0, 1000., 1000., 1000., 100.},
0192                                    {0, 1.3, 1.3, 0.7, 0.3},
0193                                    {0, 0.76, 0.76, 0.85, 0.5},
0194                                    {0, 2.4, 2.4, 1.5, 3.5},
0195                                    {0, 1.5, 1.5, 1.5, 3.5}};
0196     double MAX_C_PEDESTAL[7][5] = {{0., 0., 0., 0., 0.},
0197                                    {0., 0., 0., 0., 0.},
0198                                    {0, 1E20, 1E20, 1E20, 1E20},
0199                                    {0, 1.9, 1.9, 1.65, 1.5},
0200                                    {0, 0.94, 0.94, 1.0, 0.8},
0201                                    {0, 3.7, 3.7, 2.7, 4.5},
0202                                    {0, 2.5, 2.5, 2.5, 4.5}};
0203     double porog_PEDESTAL[5] = {0., 2., 2., 2., 2.};  // Cut for GS test in pro cents
0204     //     double porog_PEDESTAL[5] = {0., 200., 200., 100., 100.}; // Cut for GS test in pro cents
0205     double Pedest_PEDESTAL[2][5] = {{0., 0.1, 0.6, 0.1, 0.8},
0206                                     {0., 0.1, 0.1, 0.1, 0.4}};  //Cuts for Pedestal  and pedestal  Width
0207     for (int i = 0; i <= 6; i++)
0208       for (int j = 0; j <= 4; j++) {
0209         MIN_M[i][j] = MIN_M_PEDESTAL[i][j];
0210         MAX_M[i][j] = MAX_M_PEDESTAL[i][j];
0211         MIN_C[i][j] = MIN_C_PEDESTAL[i][j];
0212         MAX_C[i][j] = MAX_C_PEDESTAL[i][j];
0213       }
0214     for (int i = 0; i <= 4; i++) {
0215       porog[i] = porog_PEDESTAL[i];
0216       Pedest[0][i] = Pedest_PEDESTAL[0][i];
0217       Pedest[1][i] = Pedest_PEDESTAL[1][i];
0218     }
0219   }
0220 
0221   //======================================================================
0222 
0223   cout << endl;
0224   cout << MIN_M[2][1] << endl;
0225 
0226   //======================================================================
0227   // Prepare histograms and plot them to .png files
0228 
0229   //TCanvas *cHB = new TCanvas("cHB","cHB",1000,500);
0230   TCanvas *cHB = new TCanvas("cHB", "cHB", 1000, 1000);
0231   //TCanvas *cHE = new TCanvas("cHE","cHE",1500,500);
0232   TCanvas *cHE = new TCanvas("cHE", "cHE", 1500, 1500);
0233   //TCanvas *cONE = new TCanvas("cONE","cONE",500,500);
0234   TCanvas *cONE = new TCanvas("cONE", "cONE", 1500, 500);
0235   TCanvas *cPED = new TCanvas("cPED", "cPED", 1000, 500);
0236   //TCanvas *cHF = new TCanvas("cHF","cHF",1000,1000);
0237   TCanvas *cHF = new TCanvas("cHF", "cHF", 1000, 1000);
0238 
0239   // Iteration Method for Calibration Group:
0240 
0241   TCanvas *c1x0 = new TCanvas("c1x0", "c1x0", 300, 10, 800, 700);
0242 
0243   TCanvas *c1x1 = new TCanvas("c1x1", "c1x1", 100, 10, 600, 700);
0244 
0245   TCanvas *c3x5 = new TCanvas("c3x5", "c3x5", 1000, 1500);
0246   //
0247 
0248   char *str = (char *)alloca(10000);
0249 
0250   // before upgrade 2017:
0251   // depth: HB depth1,2; HE depth1,2,3; HO depth4; HF depth1,2
0252   // 5 depthes:  0(empty),   1,2,3,4
0253 
0254   // upgrade 2017:
0255   // depth: HB depth1,2; HE depth1,2,3,4,5,6,7; HO depth4; HF depth1,2,3,4
0256   // 8 depthes:  0(empty),   1,2,3,4,5,6,7
0257 
0258   // upgrade 2021:
0259   // depth: HB depth1,2,3,4; HE depth1,2,3,4,5,6,7; HO depth4; HF depth1,2,3,4
0260   // 10 depthes:  0(empty),   1,2,3,4,5,6,7,8,9
0261 
0262   //  Int_t ALLDEPTH = 5;
0263   //  Int_t ALLDEPTH = 8;
0264   Int_t ALLDEPTH = 10;
0265 
0266   int k_min[5] = {0, 1, 1, 4, 1};  // minimum depth for each subdet
0267   //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0268   //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0269   int k_max[5] = {0, 4, 7, 4, 4};  // maximum depth for each subdet
0270 
0271   TH2F *Map_Ampl[33][5][ALLDEPTH];       // 2D histogramm for test,subdet,depth
0272   TH2F *Map_SUB[5][ALLDEPTH];            // 2d histogramm for subdet, depth
0273   TH1F *HistAmplDepth[22][5][ALLDEPTH];  // 1d histogramm for test,subdet, depth
0274   TH1F *HistAmpl[22][5];                 // 1d histogramm for test,subdet
0275 
0276   TH1F *HistPed[3][5][4];           // 1d  histogramm for test,subdet, CapID
0277   TH2F *Map_Ped[3][5];              // 2d  histogramm for test,subdet -> test 33
0278   TH1F *hist_GoodTSshape[5];        // 1d  histogramm for TS shape subdet -> test 41
0279   TH1F *hist_GoodTSshape0[5];       // 1d  histogramm for TS shape subdet -> test 41
0280   TH1F *hist_BadTSshape[5];         // 1d  histogramm for TS shape subdet -> test 41
0281   TH1F *hist_BadTSshape0[5];        // 1d  histogramm for TS shape subdet -> test 41
0282   TH1F *hist_ADC_All[5];            // 1d  histogramm for TS shape subdet -> test 42
0283   TH1F *hist_ADC_DS[5][ALLDEPTH];   // 1d  histogramm for TS shape subdet, depth -> test 42
0284   TH1F *hist_SumADC[5][ALLDEPTH];   // 1d  histogramm for TS shape subdet, depth -> test 43
0285   TH1F *hist_SumADC0[5][ALLDEPTH];  // 1d  histogramm for TS shape subdet, depth -> test 43
0286   TH1F *hist_SumADC1[5][ALLDEPTH];  // 1d  histogramm for TS shape subdet, depth -> test 43
0287 
0288   Map_SUB[1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HB");
0289   Map_SUB[1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HB");
0290   Map_SUB[2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HE");
0291   Map_SUB[2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HE");
0292   Map_SUB[2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HE");
0293   Map_SUB[3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HO");
0294   Map_SUB[4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HF");
0295   Map_SUB[4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HF");
0296 
0297   Map_SUB[1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HB");
0298   Map_SUB[1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HB");
0299   Map_SUB[2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HE");
0300   Map_SUB[2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5_HE");
0301   Map_SUB[2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6_HE");
0302   Map_SUB[2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7_HE");
0303   Map_SUB[4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HF");
0304   Map_SUB[4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HF");
0305 
0306   //+++++++++++++++++++++++++++++
0307   //Test 0 Entries
0308   //+++++++++++++++++++++++++++++
0309 
0310   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0311                                         //       if (sub==1) cHB->Divide(2,1);
0312     if (sub == 1)
0313       cHB->Divide(2, 2);
0314     //     if (sub==2) cHE->Divide(3,1);
0315     if (sub == 2)
0316       cHE->Divide(3, 3);
0317     if (sub == 3)
0318       cONE->Divide(1, 1);
0319     //     if (sub==4) cHF->Divide(2,1);
0320     if (sub == 4)
0321       cHF->Divide(2, 2);
0322     //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0323     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0324     //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0325     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0326       if (sub == 1)
0327         cHB->cd(k);
0328       if (sub == 2)
0329         cHE->cd(k);
0330       if (sub == 3)
0331         cONE->cd(k - 3);
0332       if (sub == 4)
0333         cHF->cd(k);
0334       gPad->SetGridy();
0335       gPad->SetGridx();
0336       gPad->SetLogz();
0337       if (sub == 1)
0338         sprintf(str, "HB, Depth%d \b", k);
0339       if (sub == 2)
0340         sprintf(str, "HE, Depth%d \b", k);
0341       if (sub == 3)
0342         sprintf(str, "HO, Depth%d \b", k);
0343       if (sub == 4)
0344         sprintf(str, "HF, Depth%d \b", k);
0345       Map_SUB[sub][k]->SetTitle(str);
0346       Map_SUB[sub][k]->SetXTitle("#eta \b");
0347       Map_SUB[sub][k]->SetYTitle("#phi \b");
0348       Map_SUB[sub][k]->SetZTitle("Number of events \b");
0349       if (sub == 3)
0350         Map_SUB[sub][k]->SetTitleOffset(0.8, "Z");
0351       Map_SUB[sub][k]->Draw("COLZ");
0352       Map_SUB[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0353       //            Map_SUB[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0354       if (sub == 1) {
0355         cHB->Modified();
0356         cHB->Update();
0357       }
0358       if (sub == 2) {
0359         cHE->Modified();
0360         cHE->Update();
0361       }
0362       if (sub == 3) {
0363         cONE->Modified();
0364         cONE->Update();
0365       }
0366       if (sub == 4) {
0367         cHF->Modified();
0368         cHF->Update();
0369       }
0370     }  //end depth
0371 
0372     if (sub == 1) {
0373       cHB->Print("MapRateEntryHB.png");
0374       cHB->Clear();
0375     }
0376     if (sub == 2) {
0377       cHE->Print("MapRateEntryHE.png");
0378       cHE->Clear();
0379     }
0380     if (sub == 3) {
0381       cONE->Print("MapRateEntryHO.png");
0382       cONE->Clear();
0383     }
0384     if (sub == 4) {
0385       cHF->Print("MapRateEntryHF.png");
0386       cHF->Clear();
0387     }
0388   }  // end sub
0389 
0390   //+++++++++++++++++++++++++++++
0391   //Test 1 (Cm) Rate of Cap ID errors
0392   //+++++++++++++++++++++++++++++
0393 
0394   Map_Ampl[1][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HB");
0395   Map_Ampl[1][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HB");
0396   Map_Ampl[1][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HE");
0397   Map_Ampl[1][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HE");
0398   Map_Ampl[1][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Error_HE");
0399   Map_Ampl[1][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HO");
0400   Map_Ampl[1][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HF");
0401   Map_Ampl[1][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HF");
0402 
0403   Map_Ampl[1][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Error_HB");
0404   Map_Ampl[1][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HB");
0405   Map_Ampl[1][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HE");
0406   Map_Ampl[1][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5Error_HE");
0407   Map_Ampl[1][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6Error_HE");
0408   Map_Ampl[1][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7Error_HE");
0409   Map_Ampl[1][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Error_HF");
0410   Map_Ampl[1][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HF");
0411 
0412   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0413                                         //     if (sub==1) cHB->Divide(2,1);
0414     if (sub == 1)
0415       cHB->Divide(2, 2);
0416     //     if (sub==2) cHE->Divide(3,1);
0417     if (sub == 2)
0418       cHE->Divide(3, 3);
0419     if (sub == 3)
0420       cONE->Divide(1, 1);
0421     //     if (sub==4) cHF->Divide(2,1);
0422     if (sub == 4)
0423       cHF->Divide(2, 2);
0424     //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0425     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0426     //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0427     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0428       if (sub == 1)
0429         cHB->cd(k);
0430       if (sub == 2)
0431         cHE->cd(k);
0432       if (sub == 3)
0433         cONE->cd(k - 3);
0434       if (sub == 4)
0435         cHF->cd(k);
0436       Map_Ampl[1][sub][k]->Divide(Map_Ampl[1][sub][k], Map_SUB[sub][k], 1, 1, "B");
0437       gPad->SetGridy();
0438       gPad->SetGridx();
0439       gPad->SetLogz();
0440       if (sub == 1)
0441         sprintf(str, "HB, Depth%d \b", k);
0442       if (sub == 2)
0443         sprintf(str, "HE, Depth%d \b", k);
0444       if (sub == 3)
0445         sprintf(str, "HO, Depth%d \b", k);
0446       if (sub == 4)
0447         sprintf(str, "HF, Depth%d \b", k);
0448       Map_Ampl[1][sub][k]->SetTitle(str);
0449       Map_Ampl[1][sub][k]->SetXTitle("#eta \b");
0450       Map_Ampl[1][sub][k]->SetYTitle("#phi \b");
0451       Map_Ampl[1][sub][k]->SetZTitle("Rate \b");
0452       if (sub == 3)
0453         Map_Ampl[1][sub][k]->SetTitleOffset(0.8, "Z");
0454       Map_Ampl[1][sub][k]->Draw("COLZ");
0455       Map_Ampl[1][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0456       Map_Ampl[1][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0457       if (sub == 1) {
0458         cHB->Modified();
0459         cHB->Update();
0460       }
0461       if (sub == 2) {
0462         cHE->Modified();
0463         cHE->Update();
0464       }
0465       if (sub == 3) {
0466         cONE->Modified();
0467         cONE->Update();
0468       }
0469       if (sub == 4) {
0470         cHF->Modified();
0471         cHF->Update();
0472       }
0473     }  //end depth
0474 
0475     if (sub == 1) {
0476       cHB->Print("MapRateCapIDHB.png");
0477       cHB->Clear();
0478     }
0479     if (sub == 2) {
0480       cHE->Print("MapRateCapIDHE.png");
0481       cHE->Clear();
0482     }
0483     if (sub == 3) {
0484       cONE->Print("MapRateCapIDHO.png");
0485       cONE->Clear();
0486     }
0487     if (sub == 4) {
0488       cHF->Print("MapRateCapIDHF.png");
0489       cHF->Clear();
0490     }
0491   }  // end sub
0492 
0493   //+++++++++++++++++++++++++++++
0494   //Test 2 (Am) ADC amplitude
0495   //+++++++++++++++++++++++++++++
0496 
0497   Map_Ampl[2][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1ADCAmpl225_HB");
0498   Map_Ampl[2][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2ADCAmpl225_HB");
0499   Map_Ampl[2][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1ADCAmpl225_HE");
0500   Map_Ampl[2][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2ADCAmpl225_HE");
0501   Map_Ampl[2][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3ADCAmpl225_HE");
0502   Map_Ampl[2][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4ADCAmpl225_HO");
0503   Map_Ampl[2][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1ADCAmpl225_HF");
0504   Map_Ampl[2][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2ADCAmpl225_HF");
0505 
0506   Map_Ampl[2][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3ADCAmpl225_HB");
0507   Map_Ampl[2][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4ADCAmpl225_HB");
0508   Map_Ampl[2][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4ADCAmpl225_HE");
0509   Map_Ampl[2][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5ADCAmpl225_HE");
0510   Map_Ampl[2][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6ADCAmpl225_HE");
0511   Map_Ampl[2][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7ADCAmpl225_HE");
0512   Map_Ampl[2][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3ADCAmpl225_HF");
0513   Map_Ampl[2][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4ADCAmpl225_HF");
0514 
0515   HistAmpl[2][1] = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HB");
0516   HistAmpl[2][2] = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HE");
0517   HistAmpl[2][3] = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HO");
0518   HistAmpl[2][4] = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HF");
0519 
0520   //+++++++++++++++++++++++++++++
0521   //Test 3 (Wm) Rate of RMS
0522   //+++++++++++++++++++++++++++++
0523 
0524   Map_Ampl[3][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Amplitude225_HB");
0525   Map_Ampl[3][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Amplitude225_HB");
0526   Map_Ampl[3][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Amplitude225_HE");
0527   Map_Ampl[3][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Amplitude225_HE");
0528   Map_Ampl[3][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Amplitude225_HE");
0529   Map_Ampl[3][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Amplitude225_HO");
0530   Map_Ampl[3][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Amplitude225_HF");
0531   Map_Ampl[3][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Amplitude225_HF");
0532 
0533   Map_Ampl[3][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Amplitude225_HB");
0534   Map_Ampl[3][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Amplitude225_HB");
0535   Map_Ampl[3][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Amplitude225_HE");
0536   Map_Ampl[3][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5Amplitude225_HE");
0537   Map_Ampl[3][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6Amplitude225_HE");
0538   Map_Ampl[3][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7Amplitude225_HE");
0539   Map_Ampl[3][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Amplitude225_HF");
0540   Map_Ampl[3][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Amplitude225_HF");
0541 
0542   HistAmpl[3][1] = (TH1F *)dir->FindObjectAny("h_Amplitude_HB");
0543   HistAmpl[3][2] = (TH1F *)dir->FindObjectAny("h_Amplitude_HE");
0544   HistAmpl[3][3] = (TH1F *)dir->FindObjectAny("h_Amplitude_HO");
0545   HistAmpl[3][4] = (TH1F *)dir->FindObjectAny("h_Amplitude_HF");
0546 
0547   //+++++++++++++++++++++++++++++
0548   //Test 4 (Rm) Rate of ratio 4 near max TS/ All TS
0549   //+++++++++++++++++++++++++++++
0550 
0551   Map_Ampl[4][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Ampl047_HB");
0552   Map_Ampl[4][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Ampl047_HB");
0553   Map_Ampl[4][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Ampl047_HE");
0554   Map_Ampl[4][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Ampl047_HE");
0555   Map_Ampl[4][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Ampl047_HE");
0556   Map_Ampl[4][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Ampl047_HO");
0557   Map_Ampl[4][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Ampl047_HF");
0558   Map_Ampl[4][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Ampl047_HF");
0559 
0560   Map_Ampl[4][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Ampl047_HB");
0561   Map_Ampl[4][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Ampl047_HB");
0562   Map_Ampl[4][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Ampl047_HE");
0563   Map_Ampl[4][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5Ampl047_HE");
0564   Map_Ampl[4][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6Ampl047_HE");
0565   Map_Ampl[4][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7Ampl047_HE");
0566   Map_Ampl[4][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Ampl047_HF");
0567   Map_Ampl[4][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Ampl047_HF");
0568 
0569   HistAmpl[4][1] = (TH1F *)dir->FindObjectAny("h_Ampl_HB");
0570   HistAmpl[4][2] = (TH1F *)dir->FindObjectAny("h_Ampl_HE");
0571   HistAmpl[4][3] = (TH1F *)dir->FindObjectAny("h_Ampl_HO");
0572   HistAmpl[4][4] = (TH1F *)dir->FindObjectAny("h_Ampl_HF");
0573 
0574   //+++++++++++++++++++++++++++++
0575   //Test 5 (TNm) Mean position in 1-8 TS range
0576   //+++++++++++++++++++++++++++++
0577 
0578   Map_Ampl[5][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmeanA225_HB");
0579   Map_Ampl[5][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmeanA225_HB");
0580   Map_Ampl[5][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmeanA225_HE");
0581   Map_Ampl[5][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmeanA225_HE");
0582   Map_Ampl[5][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmeanA225_HE");
0583   Map_Ampl[5][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmeanA225_HO");
0584   Map_Ampl[5][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmeanA225_HF");
0585   Map_Ampl[5][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmeanA225_HF");
0586 
0587   Map_Ampl[5][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmeanA225_HB");
0588   Map_Ampl[5][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmeanA225_HB");
0589   Map_Ampl[5][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmeanA225_HE");
0590   Map_Ampl[5][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5TSmeanA225_HE");
0591   Map_Ampl[5][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6TSmeanA225_HE");
0592   Map_Ampl[5][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7TSmeanA225_HE");
0593   Map_Ampl[5][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmeanA225_HF");
0594   Map_Ampl[5][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmeanA225_HF");
0595 
0596   HistAmpl[5][1] = (TH1F *)dir->FindObjectAny("h_TSmeanA_HB");
0597   HistAmpl[5][2] = (TH1F *)dir->FindObjectAny("h_TSmeanA_HE");
0598   HistAmpl[5][3] = (TH1F *)dir->FindObjectAny("h_TSmeanA_HO");
0599   HistAmpl[5][4] = (TH1F *)dir->FindObjectAny("h_TSmeanA_HF");
0600 
0601   //+++++++++++++++++++++++++++++
0602   //Test 6 (TXm) Maximum position in 1-8 TS range
0603   //+++++++++++++++++++++++++++++
0604 
0605   Map_Ampl[6][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmaxA225_HB");
0606   Map_Ampl[6][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmaxA225_HB");
0607   Map_Ampl[6][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmaxA225_HE");
0608   Map_Ampl[6][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmaxA225_HE");
0609   Map_Ampl[6][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmaxA225_HE");
0610   Map_Ampl[6][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmaxA225_HO");
0611   Map_Ampl[6][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1TSmaxA225_HF");
0612   Map_Ampl[6][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2TSmaxA225_HF");
0613 
0614   Map_Ampl[6][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmaxA225_HB");
0615   Map_Ampl[6][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmaxA225_HB");
0616   Map_Ampl[6][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmaxA225_HE");
0617   Map_Ampl[6][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5TSmaxA225_HE");
0618   Map_Ampl[6][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6TSmaxA225_HE");
0619   Map_Ampl[6][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7TSmaxA225_HE");
0620   Map_Ampl[6][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3TSmaxA225_HF");
0621   Map_Ampl[6][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4TSmaxA225_HF");
0622 
0623   HistAmpl[6][1] = (TH1F *)dir->FindObjectAny("h_TSmaxA_HB");
0624   HistAmpl[6][2] = (TH1F *)dir->FindObjectAny("h_TSmaxA_HE");
0625   HistAmpl[6][3] = (TH1F *)dir->FindObjectAny("h_TSmaxA_HO");
0626   HistAmpl[6][4] = (TH1F *)dir->FindObjectAny("h_TSmaxA_HF");
0627 
0628   for (int test = 2; test <= 6; test++) {  //Test: 2-Am, 3-Wm, 4-Rm, 5-TNm, 6-TXm,
0629     for (int sub = 1; sub <= 4; sub++) {   //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0630                                            //        if (sub==1) cHB->Divide(2,1);
0631       if (sub == 1)
0632         cHB->Divide(2, 2);
0633       //        if (sub==2) cHE->Divide(3,1);
0634       if (sub == 2)
0635         cHE->Divide(3, 3);
0636       if (sub == 3)
0637         cONE->Divide(1, 1);
0638       //        if (sub==4) cHF->Divide(2,1);
0639       if (sub == 4)
0640         cHF->Divide(2, 2);
0641       //          int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0642       //        int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0643       //          int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
0644       for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
0645         if (sub == 1)
0646           cHB->cd(k);
0647         if (sub == 2)
0648           cHE->cd(k);
0649         if (sub == 3)
0650           cONE->cd(k - 3);
0651         if (sub == 4)
0652           cHF->cd(k);
0653         Map_Ampl[test][sub][k]->Divide(Map_Ampl[test][sub][k], Map_SUB[sub][k], 1, 1, "B");
0654         gPad->SetGridy();
0655         gPad->SetGridx();
0656         gPad->SetLogz();
0657         if (sub == 1)
0658           sprintf(str, "HB, Depth%d \b", k);
0659         if (sub == 2)
0660           sprintf(str, "HE, Depth%d \b", k);
0661         if (sub == 3)
0662           sprintf(str, "HO, Depth%d \b", k);
0663         if (sub == 4)
0664           sprintf(str, "HF, Depth%d \b", k);
0665         Map_Ampl[test][sub][k]->SetTitle(str);
0666         Map_Ampl[test][sub][k]->SetXTitle("#eta \b");
0667         Map_Ampl[test][sub][k]->SetYTitle("#phi \b");
0668         Map_Ampl[test][sub][k]->SetZTitle("Rate \b");
0669         if (sub == 3)
0670           Map_Ampl[test][sub][k]->SetTitleOffset(0.8, "Z");
0671         Map_Ampl[test][sub][k]->Draw("COLZ");
0672         Map_Ampl[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
0673         Map_Ampl[test][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
0674         if (sub == 1) {
0675           cHB->Modified();
0676           cHB->Update();
0677         }
0678         if (sub == 2) {
0679           cHE->Modified();
0680           cHE->Update();
0681         }
0682         if (sub == 3) {
0683           cONE->Modified();
0684           cONE->Update();
0685         }
0686         if (sub == 4) {
0687           cHF->Modified();
0688           cHF->Update();
0689         }
0690       }  //end depth
0691       if (test == 2) {
0692         if (sub == 1) {
0693           cHB->Print("MapRateAmplHB.png");
0694           cHB->Clear();
0695         }
0696         if (sub == 2) {
0697           cHE->Print("MapRateAmplHE.png");
0698           cHE->Clear();
0699         }
0700         if (sub == 3) {
0701           cONE->Print("MapRateAmplHO.png");
0702           cONE->Clear();
0703         }
0704         if (sub == 4) {
0705           cHF->Print("MapRateAmplHF.png");
0706           cHF->Clear();
0707         }
0708       }
0709       if (test == 3) {
0710         if (sub == 1) {
0711           cHB->Print("MapRateRMSHB.png");
0712           cHB->Clear();
0713         }
0714         if (sub == 2) {
0715           cHE->Print("MapRateRMSHE.png");
0716           cHE->Clear();
0717         }
0718         if (sub == 3) {
0719           cONE->Print("MapRateRMSHO.png");
0720           cONE->Clear();
0721         }
0722         if (sub == 4) {
0723           cHF->Print("MapRateRMSHF.png");
0724           cHF->Clear();
0725         }
0726       }
0727       if (test == 4) {
0728         if (sub == 1) {
0729           cHB->Print("MapRate43TStoAllTSHB.png");
0730           cHB->Clear();
0731         }
0732         if (sub == 2) {
0733           cHE->Print("MapRate43TStoAllTSHE.png");
0734           cHE->Clear();
0735         }
0736         if (sub == 3) {
0737           cONE->Print("MapRate43TStoAllTSHO.png");
0738           cONE->Clear();
0739         }
0740         if (sub == 4) {
0741           cHF->Print("MapRate43TStoAllTSHF.png");
0742           cHF->Clear();
0743         }
0744       }
0745       if (test == 5) {
0746         if (sub == 1) {
0747           cHB->Print("MapRateMeanPosHB.png");
0748           cHB->Clear();
0749         }
0750         if (sub == 2) {
0751           cHE->Print("MapRateMeanPosHE.png");
0752           cHE->Clear();
0753         }
0754         if (sub == 3) {
0755           cONE->Print("MapRateMeanPosHO.png");
0756           cONE->Clear();
0757         }
0758         if (sub == 4) {
0759           cHF->Print("MapRateMeanPosHF.png");
0760           cHF->Clear();
0761         }
0762       }
0763       if (test == 6) {
0764         if (sub == 1) {
0765           cHB->Print("MapRateMaxPosHB.png");
0766           cHB->Clear();
0767         }
0768         if (sub == 2) {
0769           cHE->Print("MapRateMaxPosHE.png");
0770           cHE->Clear();
0771         }
0772         if (sub == 3) {
0773           cONE->Print("MapRateMaxPosHO.png");
0774           cONE->Clear();
0775         }
0776         if (sub == 4) {
0777           cHF->Print("MapRateMaxPosHF.png");
0778           cHF->Clear();
0779         }
0780       }
0781 
0782       //          cONE->Divide(1,1);
0783       cONE->Divide(3, 1);
0784       if (test == 2 && sub == 2) {
0785         cONE->cd(2);
0786         TH1F *kjkjkhj2 = (TH1F *)dir->FindObjectAny("h_AmplitudeHEtest1");
0787         kjkjkhj2->Draw("");
0788         kjkjkhj2->SetTitle("HE, All Depth: shunt1");
0789         cONE->cd(3);
0790         TH1F *kjkjkhj3 = (TH1F *)dir->FindObjectAny("h_AmplitudeHEtest6");
0791         kjkjkhj3->Draw("");
0792         kjkjkhj3->SetTitle("HE, All Depth: shunt6");
0793       }
0794       if (test == 2 && sub == 1) {
0795         cONE->cd(2);
0796         TH1F *kjkjkhb2 = (TH1F *)dir->FindObjectAny("h_AmplitudeHBtest1");
0797         kjkjkhb2->Draw("");
0798         kjkjkhb2->SetTitle("HB, All Depth: shunt1");
0799         cONE->cd(3);
0800         TH1F *kjkjkhb3 = (TH1F *)dir->FindObjectAny("h_AmplitudeHBtest6");
0801         kjkjkhb3->Draw("");
0802         kjkjkhb3->SetTitle("HB, All Depth: shunt6");
0803       }
0804       cONE->cd(1);
0805       gPad->SetGridy();
0806       gPad->SetGridx();
0807       gPad->SetLogy();
0808       if (sub == 1)
0809         HistAmpl[test][sub]->SetTitle("HB, All Depth: shunt6");
0810       if (sub == 2)
0811         HistAmpl[test][sub]->SetTitle("HE, All Depth: shunt6");
0812       if (sub == 3)
0813         HistAmpl[test][sub]->SetTitle("HO, All Depth");
0814       if (sub == 4)
0815         HistAmpl[test][sub]->SetTitle("HF, All Depth");
0816       if (test == 2)
0817         HistAmpl[test][sub]->SetXTitle("ADC Amlitude in each event & cell \b");
0818       if (test == 3)
0819         HistAmpl[test][sub]->SetXTitle("RMS in each event & cell \b");
0820       if (test == 4)
0821         HistAmpl[test][sub]->SetXTitle("Ratio in each event & cell \b");
0822       if (test == 5)
0823         HistAmpl[test][sub]->SetXTitle("Mean TS position in each event & cell \b");
0824       if (test == 6)
0825         HistAmpl[test][sub]->SetXTitle("Max TS position in each event & cell \b");
0826       HistAmpl[test][sub]->SetYTitle("Number of cell-events \b");
0827       HistAmpl[test][sub]->SetLineColor(4);
0828       HistAmpl[test][sub]->SetLineWidth(2);
0829       HistAmpl[test][sub]->SetTitleOffset(1.4, "Y");
0830       HistAmpl[test][sub]->Draw("");
0831       // //        HistAmpl[test][sub]->GetYaxis()->SetRangeUser(1., 100.);
0832       //          if (test==2) {gPad->SetLogx(); HistAmpl[test][sub]->GetXaxis()->SetRangeUser(1., 10000.);}
0833       if (test == 2) {
0834         gPad->SetLogx();
0835       }
0836       if (test == 3)
0837         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 5.);  // width
0838       if (test == 4)
0839         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 1.);  // R
0840       if (test == 5)
0841         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);  //Tn
0842       if (test == 6)
0843         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);  //Tx
0844       cONE->Modified();
0845       cONE->Update();
0846       double min_x[] = {MIN_M[test][sub], MIN_M[test][sub]};
0847       double min_y[] = {0., 100000000.};
0848       TGraph *MIN = new TGraph(2, min_x, min_y);
0849       MIN->SetLineStyle(2);
0850       MIN->SetLineColor(2);
0851       MIN->SetLineWidth(2 + 100 * 100);
0852       MIN->SetFillStyle(3005);
0853       MIN->SetFillColor(2);
0854       MIN->Draw("L");
0855       double max_x[] = {MAX_M[test][sub], MAX_M[test][sub]};
0856       double max_y[] = {0., 100000000.};
0857       TGraph *MAX = new TGraph(2, max_x, max_y);
0858       MAX->SetLineStyle(2);
0859       MAX->SetLineColor(2);
0860       MAX->SetLineWidth(-2 - 100 * 100);
0861       MAX->SetFillStyle(3004);
0862       MAX->SetFillColor(2);
0863       MAX->Draw("L");
0864       if (test == 2) {
0865         if (sub == 1) {
0866           cONE->Print("HistAmplHB.png");
0867           cONE->Clear();
0868         }
0869         if (sub == 2) {
0870           cONE->Print("HistAmplHE.png");
0871           cONE->Clear();
0872         }
0873         if (sub == 3) {
0874           cONE->Print("HistAmplHO.png");
0875           cONE->Clear();
0876         }
0877         if (sub == 4) {
0878           cONE->Print("HistAmplHF.png");
0879           cONE->Clear();
0880         }
0881       }
0882       if (test == 3) {
0883         if (sub == 1) {
0884           cONE->Print("HistRMSHB.png");
0885           cONE->Clear();
0886         }
0887         if (sub == 2) {
0888           cONE->Print("HistRMSHE.png");
0889           cONE->Clear();
0890         }
0891         if (sub == 3) {
0892           cONE->Print("HistRMSHO.png");
0893           cONE->Clear();
0894         }
0895         if (sub == 4) {
0896           cONE->Print("HistRMSHF.png");
0897           cONE->Clear();
0898         }
0899       }
0900       if (test == 4) {
0901         if (sub == 1) {
0902           cONE->Print("Hist43TStoAllTSHB.png");
0903           cONE->Clear();
0904         }
0905         if (sub == 2) {
0906           cONE->Print("Hist43TStoAllTSHE.png");
0907           cONE->Clear();
0908         }
0909         if (sub == 3) {
0910           cONE->Print("Hist43TStoAllTSHO.png");
0911           cONE->Clear();
0912         }
0913         if (sub == 4) {
0914           cONE->Print("Hist43TStoAllTSHF.png");
0915           cONE->Clear();
0916         }
0917       }
0918       if (test == 5) {
0919         if (sub == 1) {
0920           cONE->Print("HistMeanPosHB.png");
0921           cONE->Clear();
0922         }
0923         if (sub == 2) {
0924           cONE->Print("HistMeanPosHE.png");
0925           cONE->Clear();
0926         }
0927         if (sub == 3) {
0928           cONE->Print("HistMeanPosHO.png");
0929           cONE->Clear();
0930         }
0931         if (sub == 4) {
0932           cONE->Print("HistMeanPosHF.png");
0933           cONE->Clear();
0934         }
0935       }
0936       if (test == 6) {
0937         if (sub == 1) {
0938           cONE->Print("HistMaxPosHB.png");
0939           cONE->Clear();
0940         }
0941         if (sub == 2) {
0942           cONE->Print("HistMaxPosHE.png");
0943           cONE->Clear();
0944         }
0945         if (sub == 3) {
0946           cONE->Print("HistMaxPosHO.png");
0947           cONE->Clear();
0948         }
0949         if (sub == 4) {
0950           cONE->Print("HistMaxPosHF.png");
0951           cONE->Clear();
0952         }
0953       }
0954     }  // end sub
0955   }    //end test
0956 
0957   TH2F *Map_Calib[5][5];  // 2d histogramm for subdet, depth
0958 
0959   Map_Calib[1][1] = (TH2F *)dir->FindObjectAny("h_map_HB");
0960   Map_Calib[1][2] = (TH2F *)dir->FindObjectAny("h_map_HB");
0961   Map_Calib[2][1] = (TH2F *)dir->FindObjectAny("h_map_HE");
0962   Map_Calib[2][2] = (TH2F *)dir->FindObjectAny("h_map_HE");
0963   Map_Calib[2][3] = (TH2F *)dir->FindObjectAny("h_map_HE");
0964   Map_Calib[3][4] = (TH2F *)dir->FindObjectAny("h_map_HO");
0965   Map_Calib[4][1] = (TH2F *)dir->FindObjectAny("h_map_HF");
0966   Map_Calib[4][2] = (TH2F *)dir->FindObjectAny("h_map_HF");
0967 
0968   //+++++++++++++++++++++++++++++
0969   //Test 0 Entries
0970   //+++++++++++++++++++++++++++++
0971 
0972   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
0973                                         //       if (sub==1) cHB->Divide(2,1);
0974                                         //       if (sub==2) cHE->Divide(3,1);
0975     cONE->Divide(1, 1);
0976     //      if (sub==4) cHB->Divide(2,1);
0977     //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
0978     //       int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
0979     //       for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depth
0980     int k = 1;
0981     cONE->cd(k);
0982     //          if (sub==1) cHB->cd(k);
0983     //          if (sub==2) cHE->cd(k);
0984     if (sub == 3)
0985       k = 4;
0986     //      if (sub==4) cHB->cd(k);
0987     gPad->SetGridy();
0988     gPad->SetGridx();
0989     gPad->SetLogz();
0990     if (sub == 1)
0991       sprintf(str, "HB");
0992     if (sub == 2)
0993       sprintf(str, "HE");
0994     if (sub == 3)
0995       sprintf(str, "HO");
0996     if (sub == 4)
0997       sprintf(str, "HF");
0998     Map_Calib[sub][k]->SetTitle(str);
0999     Map_Calib[sub][k]->SetXTitle("#eta \b");
1000     Map_Calib[sub][k]->SetYTitle("#phi \b");
1001     Map_Calib[sub][k]->SetZTitle("Number of events\b");
1002     if (sub == 3)
1003       Map_Calib[sub][k]->SetTitleOffset(0.8, "Z");
1004     Map_Calib[sub][k]->Draw("COLZ");
1005     Map_Calib[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1006     //            Map_Calib[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
1007     //            if (sub==1) {cHB->Modified(); cHB->Update();}
1008     //            if (sub==2) {cHE->Modified(); cHE->Update();}
1009     cONE->Modified();
1010     cONE->Update();
1011     //            if (sub==4) {cHB->Modified(); cHB->Update();}
1012     //       }//end depth
1013 
1014     if (sub == 1) {
1015       cONE->Print("MapRateCalibEntryHB.png");
1016       cONE->Clear();
1017     }
1018     if (sub == 2) {
1019       cONE->Print("MapRateCalibEntryHE.png");
1020       cONE->Clear();
1021     }
1022     if (sub == 3) {
1023       cONE->Print("MapRateCalibEntryHO.png");
1024       cONE->Clear();
1025     }
1026     if (sub == 4) {
1027       cONE->Print("MapRateCalibEntryHF.png");
1028       cONE->Clear();
1029     }
1030   }  // end sub
1031 
1032   //+++++++++++++++++++++++++++++
1033   //Test 11 (Cc) Rate of Cap ID errors for calibration channels
1034   //+++++++++++++++++++++++++++++
1035 
1036   Map_Ampl[11][1][1] = (TH2F *)dir->FindObjectAny("h_mapCapCalib047_HB");
1037   Map_Ampl[11][1][2] = (TH2F *)dir->FindObjectAny("h_mapCapCalib047_HB");
1038   Map_Ampl[11][2][1] = (TH2F *)dir->FindObjectAny("h_mapCapCalib047_HE");
1039   Map_Ampl[11][2][2] = (TH2F *)dir->FindObjectAny("h_mapCapCalib047_HE");
1040   Map_Ampl[11][2][3] = (TH2F *)dir->FindObjectAny("h_mapCapCalib047_HE");
1041   Map_Ampl[11][3][4] = (TH2F *)dir->FindObjectAny("h_mapCapCalib047_HO");
1042   Map_Ampl[11][4][1] = (TH2F *)dir->FindObjectAny("h_mapCapCalib047_HF");
1043   Map_Ampl[11][4][2] = (TH2F *)dir->FindObjectAny("h_mapCapCalib047_HF");
1044 
1045   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1046                                         //       if (sub==1) cHB->Divide(2,1);
1047                                         //       if (sub==2) cHE->Divide(3,1);
1048     cONE->Divide(1, 1);
1049     //      if (sub==4) cHB->Divide(2,1);
1050     //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1051     //       int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1052     //       for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depth
1053     int k = 1;
1054     cONE->cd(k);
1055     //          if (sub==1) cHB->cd(k);
1056     //          if (sub==2) cHE->cd(k);
1057     if (sub == 3)
1058       k = 4;
1059     //      if (sub==4) cHB->cd(k);
1060     Map_Ampl[11][sub][k]->Divide(Map_Ampl[11][sub][k], Map_Calib[sub][k], 1, 1, "B");
1061     gPad->SetGridy();
1062     gPad->SetGridx();
1063     gPad->SetLogz();
1064     if (sub == 1)
1065       sprintf(str, "HB");
1066     if (sub == 2)
1067       sprintf(str, "HE");
1068     if (sub == 3)
1069       sprintf(str, "HO");
1070     if (sub == 4)
1071       sprintf(str, "HF");
1072     Map_Ampl[11][sub][k]->SetTitle(str);
1073     Map_Ampl[11][sub][k]->SetXTitle("#eta \b");
1074     Map_Ampl[11][sub][k]->SetYTitle("#phi \b");
1075     Map_Ampl[11][sub][k]->SetZTitle("Rate \b");
1076     Map_Ampl[11][sub][k]->SetTitleOffset(0.75, "Z");
1077     Map_Ampl[11][sub][k]->Draw("COLZ");
1078     Map_Ampl[11][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1079     Map_Ampl[11][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
1080     //            if (sub==1) {cHB->Modified(); cHB->Update();}
1081     //            if (sub==2) {cHE->Modified(); cHE->Update();}
1082     cONE->Modified();
1083     cONE->Update();
1084     //            if (sub==4) {cHB->Modified(); cHB->Update();}
1085     //       }//end depth
1086 
1087     if (sub == 1) {
1088       cONE->Print("MapRateCapCalibHB.png");
1089       cONE->Clear();
1090     }
1091     if (sub == 2) {
1092       cONE->Print("MapRateCapCalibHE.png");
1093       cONE->Clear();
1094     }
1095     if (sub == 3) {
1096       cONE->Print("MapRateCapCalibHO.png");
1097       cONE->Clear();
1098     }
1099     if (sub == 4) {
1100       cONE->Print("MapRateCapCalibHF.png");
1101       cONE->Clear();
1102     }
1103   }  // end sub
1104 
1105   //+++++++++++++++++++++++++++++
1106   //Test 12 (Ac) ADC amplitude for calibration chanels
1107   //+++++++++++++++++++++++++++++
1108 
1109   Map_Ampl[12][1][1] = (TH2F *)dir->FindObjectAny("h_mapADCCalib047_HB");
1110   Map_Ampl[12][1][2] = (TH2F *)dir->FindObjectAny("h_mapADCCalib047_HB");
1111   Map_Ampl[12][2][1] = (TH2F *)dir->FindObjectAny("h_mapADCCalib047_HE");
1112   Map_Ampl[12][2][2] = (TH2F *)dir->FindObjectAny("h_mapADCCalib047_HE");
1113   Map_Ampl[12][2][3] = (TH2F *)dir->FindObjectAny("h_mapADCCalib047_HE");
1114   Map_Ampl[12][3][4] = (TH2F *)dir->FindObjectAny("h_mapADCCalib047_HO");
1115   Map_Ampl[12][4][1] = (TH2F *)dir->FindObjectAny("h_mapADCCalib047_HF");
1116   Map_Ampl[12][4][2] = (TH2F *)dir->FindObjectAny("h_mapADCCalib047_HF");
1117 
1118   HistAmpl[12][1] = (TH1F *)dir->FindObjectAny("h_ADCCalib_HB");
1119   HistAmpl[12][2] = (TH1F *)dir->FindObjectAny("h_ADCCalib_HE");
1120   HistAmpl[12][3] = (TH1F *)dir->FindObjectAny("h_ADCCalib_HO");
1121   HistAmpl[12][4] = (TH1F *)dir->FindObjectAny("h_ADCCalib_HF");
1122 
1123   //+++++++++++++++++++++++++++++
1124   //Test 13 (Wc) Rate of RMS
1125   //+++++++++++++++++++++++++++++
1126 
1127   Map_Ampl[13][1][1] = (TH2F *)dir->FindObjectAny("h_mapWidthCalib047_HB");
1128   Map_Ampl[13][1][2] = (TH2F *)dir->FindObjectAny("h_mapWidthCalib047_HB");
1129   Map_Ampl[13][2][1] = (TH2F *)dir->FindObjectAny("h_mapWidthCalib047_HE");
1130   Map_Ampl[13][2][2] = (TH2F *)dir->FindObjectAny("h_mapWidthCalib047_HE");
1131   Map_Ampl[13][2][3] = (TH2F *)dir->FindObjectAny("h_mapWidthCalib047_HE");
1132   Map_Ampl[13][3][4] = (TH2F *)dir->FindObjectAny("h_mapWidthCalib047_HO");
1133   Map_Ampl[13][4][1] = (TH2F *)dir->FindObjectAny("h_mapWidthCalib047_HF");
1134   Map_Ampl[13][4][2] = (TH2F *)dir->FindObjectAny("h_mapWidthCalib047_HF");
1135 
1136   HistAmpl[13][1] = (TH1F *)dir->FindObjectAny("h_WidthCalib_HB");
1137   HistAmpl[13][2] = (TH1F *)dir->FindObjectAny("h_WidthCalib_HE");
1138   HistAmpl[13][3] = (TH1F *)dir->FindObjectAny("h_WidthCalib_HO");
1139   HistAmpl[13][4] = (TH1F *)dir->FindObjectAny("h_WidthCalib_HF");
1140 
1141   //+++++++++++++++++++++++++++++
1142   //Test 14 (Rc) Rate of ratio 4 near max TS/ All TS
1143   //+++++++++++++++++++++++++++++
1144 
1145   Map_Ampl[14][1][1] = (TH2F *)dir->FindObjectAny("h_mapRatioCalib047_HB");
1146   Map_Ampl[14][1][2] = (TH2F *)dir->FindObjectAny("h_mapRatioCalib047_HB");
1147   Map_Ampl[14][2][1] = (TH2F *)dir->FindObjectAny("h_mapRatioCalib047_HE");
1148   Map_Ampl[14][2][2] = (TH2F *)dir->FindObjectAny("h_mapRatioCalib047_HE");
1149   Map_Ampl[14][2][3] = (TH2F *)dir->FindObjectAny("h_mapRatioCalib047_HE");
1150   Map_Ampl[14][3][4] = (TH2F *)dir->FindObjectAny("h_mapRatioCalib047_HO");
1151   Map_Ampl[14][4][1] = (TH2F *)dir->FindObjectAny("h_mapRatioCalib047_HF");
1152   Map_Ampl[14][4][2] = (TH2F *)dir->FindObjectAny("h_mapRatioCalib047_HF");
1153 
1154   HistAmpl[14][1] = (TH1F *)dir->FindObjectAny("h_RatioCalib_HB");
1155   HistAmpl[14][2] = (TH1F *)dir->FindObjectAny("h_RatioCalib_HE");
1156   HistAmpl[14][3] = (TH1F *)dir->FindObjectAny("h_RatioCalib_HO");
1157   HistAmpl[14][4] = (TH1F *)dir->FindObjectAny("h_RatioCalib_HF");
1158 
1159   //+++++++++++++++++++++++++++++
1160   //Test 15 (TNc) Mean position in 1-8 TS range
1161   //+++++++++++++++++++++++++++++
1162 
1163   Map_Ampl[15][1][1] = (TH2F *)dir->FindObjectAny("h_mapTSmeanCalib047_HB");
1164   Map_Ampl[15][1][2] = (TH2F *)dir->FindObjectAny("h_mapTSmeanCalib047_HB");
1165   Map_Ampl[15][2][1] = (TH2F *)dir->FindObjectAny("h_mapTSmeanCalib047_HE");
1166   Map_Ampl[15][2][2] = (TH2F *)dir->FindObjectAny("h_mapTSmeanCalib047_HE");
1167   Map_Ampl[15][2][3] = (TH2F *)dir->FindObjectAny("h_mapTSmeanCalib047_HE");
1168   Map_Ampl[15][3][4] = (TH2F *)dir->FindObjectAny("h_mapTSmeanCalib047_HO");
1169   Map_Ampl[15][4][1] = (TH2F *)dir->FindObjectAny("h_mapTSmeanCalib047_HF");
1170   Map_Ampl[15][4][2] = (TH2F *)dir->FindObjectAny("h_mapTSmeanCalib047_HF");
1171 
1172   HistAmpl[15][1] = (TH1F *)dir->FindObjectAny("h_TSmeanCalib_HB");
1173   HistAmpl[15][2] = (TH1F *)dir->FindObjectAny("h_TSmeanCalib_HE");
1174   HistAmpl[15][3] = (TH1F *)dir->FindObjectAny("h_TSmeanCalib_HO");
1175   HistAmpl[15][4] = (TH1F *)dir->FindObjectAny("h_TSmeanCalib_HF");
1176 
1177   //+++++++++++++++++++++++++++++
1178   //Test 16 (TXc) Maximum position in 1-8 TS range
1179   //+++++++++++++++++++++++++++++
1180 
1181   Map_Ampl[16][1][1] = (TH2F *)dir->FindObjectAny("h_mapTSmaxCalib047_HB");
1182   Map_Ampl[16][1][2] = (TH2F *)dir->FindObjectAny("h_mapTSmaxCalib047_HB");
1183   Map_Ampl[16][2][1] = (TH2F *)dir->FindObjectAny("h_mapTSmaxCalib047_HE");
1184   Map_Ampl[16][2][2] = (TH2F *)dir->FindObjectAny("h_mapTSmaxCalib047_HE");
1185   Map_Ampl[16][2][3] = (TH2F *)dir->FindObjectAny("h_mapTSmaxCalib047_HE");
1186   Map_Ampl[16][3][4] = (TH2F *)dir->FindObjectAny("h_mapTSmaxCalib047_HO");
1187   Map_Ampl[16][4][1] = (TH2F *)dir->FindObjectAny("h_mapTSmaxCalib047_HF");
1188   Map_Ampl[16][4][2] = (TH2F *)dir->FindObjectAny("h_mapTSmaxCalib047_HF");
1189 
1190   HistAmpl[16][1] = (TH1F *)dir->FindObjectAny("h_TSmaxCalib_HB");
1191   HistAmpl[16][2] = (TH1F *)dir->FindObjectAny("h_TSmaxCalib_HE");
1192   HistAmpl[16][3] = (TH1F *)dir->FindObjectAny("h_TSmaxCalib_HO");
1193   HistAmpl[16][4] = (TH1F *)dir->FindObjectAny("h_TSmaxCalib_HF");
1194 
1195   for (int test = 12; test <= 16; test++) {  //Test: 2-Am, 3-Wm, 4-Rm, 5-TNm, 6-TXm,
1196     for (int sub = 1; sub <= 4; sub++) {     //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1197       if (sub == 1)
1198         cONE->Divide(1, 1);  //cHB->Divide(2,1);
1199       if (sub == 2)
1200         cONE->Divide(1, 1);  //cHE->Divide(3,1);
1201       if (sub == 3)
1202         cONE->Divide(1, 1);
1203       if (sub == 4)
1204         cONE->Divide(1, 1);  //cHB->Divide(2,1);
1205                              //          int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1206                              //          int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1207                              //          for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depth
1208       int k = 1;
1209       if (sub == 1) {
1210         k = 1;
1211         cONE->cd(k);
1212       }  //cHB->cd(k); }
1213       if (sub == 2) {
1214         k = 1;
1215         cONE->cd(k);
1216       }  //cHE->cd(k); }
1217       if (sub == 3) {
1218         k = 4;
1219         cONE->cd(k - 3);
1220       }
1221       if (sub == 4) {
1222         k = 1;
1223         cONE->cd(k);
1224       }  //cHB->cd(k); }
1225       Map_Ampl[test][sub][k]->Divide(Map_Ampl[test][sub][k], Map_Calib[sub][k], 1, 1, "B");
1226       gPad->SetGridy();
1227       gPad->SetGridx();
1228       gPad->SetLogz();
1229       if (sub == 1)
1230         sprintf(str, "HB");
1231       if (sub == 2)
1232         sprintf(str, "HE");
1233       if (sub == 3)
1234         sprintf(str, "HO");
1235       if (sub == 4)
1236         sprintf(str, "HF");
1237       Map_Ampl[test][sub][k]->SetTitle(str);
1238       Map_Ampl[test][sub][k]->SetXTitle("#eta \b");
1239       Map_Ampl[test][sub][k]->SetYTitle("#phi \b");
1240       Map_Ampl[test][sub][k]->SetZTitle("Rate \b");
1241       Map_Ampl[test][sub][k]->SetTitleOffset(0.8, "Z");
1242       Map_Ampl[test][sub][k]->Draw("COLZ");
1243       Map_Ampl[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1244       Map_Ampl[test][sub][k]->GetZaxis()->SetRangeUser(0.00001, 1.);
1245       //              if (sub==1) {cHB->Modified(); cHB->Update();}
1246       //              if (sub==2) {cHE->Modified(); cHE->Update();}
1247       cONE->Modified();
1248       cONE->Update();
1249       //              if (sub==4) {cHB->Modified(); cHB->Update();}
1250       //          }//end depth
1251       if (test == 12) {
1252         if (sub == 1) {
1253           cONE->Print("MapRateAmplCalibHB.png");
1254           cONE->Clear();
1255         }
1256         if (sub == 2) {
1257           cONE->Print("MapRateAmplCalibHE.png");
1258           cONE->Clear();
1259         }
1260         if (sub == 3) {
1261           cONE->Print("MapRateAmplCalibHO.png");
1262           cONE->Clear();
1263         }
1264         if (sub == 4) {
1265           cONE->Print("MapRateAmplCalibHF.png");
1266           cONE->Clear();
1267         }
1268       }
1269       if (test == 13) {
1270         if (sub == 1) {
1271           cONE->Print("MapRateRMSCalibHB.png");
1272           cONE->Clear();
1273         }
1274         if (sub == 2) {
1275           cONE->Print("MapRateRMSCalibHE.png");
1276           cONE->Clear();
1277         }
1278         if (sub == 3) {
1279           cONE->Print("MapRateRMSCalibHO.png");
1280           cONE->Clear();
1281         }
1282         if (sub == 4) {
1283           cONE->Print("MapRateRMSCalibHF.png");
1284           cONE->Clear();
1285         }
1286       }
1287       if (test == 14) {
1288         if (sub == 1) {
1289           cONE->Print("MapRate43TStoAllTSCalibHB.png");
1290           cONE->Clear();
1291         }
1292         if (sub == 2) {
1293           cONE->Print("MapRate43TStoAllTSCalibHE.png");
1294           cONE->Clear();
1295         }
1296         if (sub == 3) {
1297           cONE->Print("MapRate43TStoAllTSCalibHO.png");
1298           cONE->Clear();
1299         }
1300         if (sub == 4) {
1301           cONE->Print("MapRate43TStoAllTSCalibHF.png");
1302           cONE->Clear();
1303         }
1304       }
1305       if (test == 15) {
1306         if (sub == 1) {
1307           cONE->Print("MapRateMeanPosCalibHB.png");
1308           cONE->Clear();
1309         }
1310         if (sub == 2) {
1311           cONE->Print("MapRateMeanPosCalibHE.png");
1312           cONE->Clear();
1313         }
1314         if (sub == 3) {
1315           cONE->Print("MapRateMeanPosCalibHO.png");
1316           cONE->Clear();
1317         }
1318         if (sub == 4) {
1319           cONE->Print("MapRateMeanPosCalibHF.png");
1320           cONE->Clear();
1321         }
1322       }
1323       if (test == 16) {
1324         if (sub == 1) {
1325           cONE->Print("MapRateMaxPosCalibHB.png");
1326           cONE->Clear();
1327         }
1328         if (sub == 2) {
1329           cONE->Print("MapRateMaxPosCalibHE.png");
1330           cONE->Clear();
1331         }
1332         if (sub == 3) {
1333           cONE->Print("MapRateMaxPosCalibHO.png");
1334           cONE->Clear();
1335         }
1336         if (sub == 4) {
1337           cONE->Print("MapRateMaxPosCalibHF.png");
1338           cONE->Clear();
1339         }
1340       }
1341 
1342       cONE->Divide(1, 1);
1343       cONE->cd(1);
1344       gPad->SetGridy();
1345       gPad->SetGridx();
1346       gPad->SetLogy();
1347       if (sub == 1)
1348         HistAmpl[test][sub]->SetTitle("HB, All Depth");
1349       if (sub == 2)
1350         HistAmpl[test][sub]->SetTitle("HE, All Depth");
1351       if (sub == 3)
1352         HistAmpl[test][sub]->SetTitle("HO, All Depth");
1353       if (sub == 4)
1354         HistAmpl[test][sub]->SetTitle("HF, All Depth");
1355       if (test == 12)
1356         HistAmpl[test][sub]->SetXTitle("ADC Amlitude in each event & cell \b");
1357       if (test == 13)
1358         HistAmpl[test][sub]->SetXTitle("Amplitude RMS in each event & cell \b");
1359       if (test == 14)
1360         HistAmpl[test][sub]->SetXTitle("Ratio in each event & cell \b");
1361       if (test == 15)
1362         HistAmpl[test][sub]->SetXTitle("Mean TS position in each event & cell \b");
1363       if (test == 16)
1364         HistAmpl[test][sub]->SetXTitle("Max TS position in each event & cell \b");
1365       HistAmpl[test][sub]->SetYTitle("Number of cell-events \b");
1366       HistAmpl[test][sub]->SetLineColor(4);
1367       HistAmpl[test][sub]->SetLineWidth(2);
1368       HistAmpl[test][sub]->SetTitleOffset(1.4, "Y");
1369       HistAmpl[test][sub]->Draw("");
1370       //        HistAmpl[test][sub]->GetYaxis()->SetRangeUser(1., 100.);
1371       if (test == 12) {
1372         gPad->SetLogx();
1373         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(1., 10000.);
1374       }
1375       if (test == 13)
1376         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 5.);
1377       if (test == 14)
1378         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 1.);
1379       if (test == 15)
1380         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);
1381       if (test == 16)
1382         HistAmpl[test][sub]->GetXaxis()->SetRangeUser(0., 9.);
1383       cONE->Modified();
1384       cONE->Update();
1385       double min_x[] = {MIN_C[test - 10][sub], MIN_C[test - 10][sub]};
1386       double min_y[] = {0., 100000000.};
1387       TGraph *MIN = new TGraph(2, min_x, min_y);
1388       MIN->SetLineStyle(2);
1389       MIN->SetLineColor(2);
1390       MIN->SetLineWidth(2 + 100 * 100);
1391       MIN->SetFillStyle(3005);
1392       MIN->SetFillColor(2);
1393       MIN->Draw("L");
1394       double max_x[] = {MAX_C[test - 10][sub], MAX_C[test - 10][sub]};
1395       double max_y[] = {0., 100000000.};
1396       TGraph *MAX = new TGraph(2, max_x, max_y);
1397       MAX->SetLineStyle(2);
1398       MAX->SetLineColor(2);
1399       MAX->SetLineWidth(-2 - 100 * 100);
1400       MAX->SetFillStyle(3004);
1401       MAX->SetFillColor(2);
1402       MAX->Draw("L");
1403       if (test == 12) {
1404         if (sub == 1) {
1405           cONE->Print("HistAmplCalibHB.png");
1406           cONE->Clear();
1407         }
1408         if (sub == 2) {
1409           cONE->Print("HistAmplCalibHE.png");
1410           cONE->Clear();
1411         }
1412         if (sub == 3) {
1413           cONE->Print("HistAmplCalibHO.png");
1414           cONE->Clear();
1415         }
1416         if (sub == 4) {
1417           cONE->Print("HistAmplCalibHF.png");
1418           cONE->Clear();
1419         }
1420       }
1421       if (test == 13) {
1422         if (sub == 1) {
1423           cONE->Print("HistRMSCalibHB.png");
1424           cONE->Clear();
1425         }
1426         if (sub == 2) {
1427           cONE->Print("HistRMSCalibHE.png");
1428           cONE->Clear();
1429         }
1430         if (sub == 3) {
1431           cONE->Print("HistRMSCalibHO.png");
1432           cONE->Clear();
1433         }
1434         if (sub == 4) {
1435           cONE->Print("HistRMSCalibHF.png");
1436           cONE->Clear();
1437         }
1438       }
1439       if (test == 14) {
1440         if (sub == 1) {
1441           cONE->Print("Hist43TStoAllTSCalibHB.png");
1442           cONE->Clear();
1443         }
1444         if (sub == 2) {
1445           cONE->Print("Hist43TStoAllTSCalibHE.png");
1446           cONE->Clear();
1447         }
1448         if (sub == 3) {
1449           cONE->Print("Hist43TStoAllTSCalibHO.png");
1450           cONE->Clear();
1451         }
1452         if (sub == 4) {
1453           cONE->Print("Hist43TStoAllTSCalibHF.png");
1454           cONE->Clear();
1455         }
1456       }
1457       if (test == 15) {
1458         if (sub == 1) {
1459           cONE->Print("HistMeanPosCalibHB.png");
1460           cONE->Clear();
1461         }
1462         if (sub == 2) {
1463           cONE->Print("HistMeanPosCalibHE.png");
1464           cONE->Clear();
1465         }
1466         if (sub == 3) {
1467           cONE->Print("HistMeanPosCalibHO.png");
1468           cONE->Clear();
1469         }
1470         if (sub == 4) {
1471           cONE->Print("HistMeanPosCalibHF.png");
1472           cONE->Clear();
1473         }
1474       }
1475       if (test == 16) {
1476         if (sub == 1) {
1477           cONE->Print("HistMaxPosCalibHB.png");
1478           cONE->Clear();
1479         }
1480         if (sub == 2) {
1481           cONE->Print("HistMaxPosCalibHE.png");
1482           cONE->Clear();
1483         }
1484         if (sub == 3) {
1485           cONE->Print("HistMaxPosCalibHO.png");
1486           cONE->Clear();
1487         }
1488         if (sub == 4) {
1489           cONE->Print("HistMaxPosCalibHF.png");
1490           cONE->Clear();
1491         }
1492       }
1493     }  // end sub
1494   }    //end test
1495 
1496   //+++++++++++++++++++++++++++++
1497   //Test 21 (GS) Amplitude drift
1498   //+++++++++++++++++++++++++++++
1499 
1500   Map_Ampl[21][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1AmplE34_HB");
1501   Map_Ampl[21][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2AmplE34_HB");
1502   Map_Ampl[21][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3AmplE34_HB");
1503   Map_Ampl[21][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4AmplE34_HB");
1504   Map_Ampl[21][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1AmplE34_HE");
1505   Map_Ampl[21][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2AmplE34_HE");
1506   Map_Ampl[21][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3AmplE34_HE");
1507   Map_Ampl[21][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4AmplE34_HE");
1508   Map_Ampl[21][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5AmplE34_HE");
1509   Map_Ampl[21][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6AmplE34_HE");
1510   Map_Ampl[21][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7AmplE34_HE");
1511   Map_Ampl[21][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4AmplE34_HO");
1512   Map_Ampl[21][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1AmplE34_HF");
1513   Map_Ampl[21][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2AmplE34_HF");
1514   Map_Ampl[21][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3AmplE34_HF");
1515   Map_Ampl[21][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4AmplE34_HF");
1516 
1517   TH2F *Map_RefAmpl[5][ALLDEPTH];  // 2D histogramm for subdet, depth
1518   TH2F *Map_RefSUB[5][ALLDEPTH];   // 2d histogramm for subdet, depth
1519 
1520   Map_RefAmpl[1][1] = (TH2F *)refdir->FindObjectAny("h_mapDepth1AmplE34_HB");
1521   Map_RefAmpl[1][2] = (TH2F *)refdir->FindObjectAny("h_mapDepth2AmplE34_HB");
1522   Map_RefAmpl[1][3] = (TH2F *)refdir->FindObjectAny("h_mapDepth3AmplE34_HB");
1523   Map_RefAmpl[1][4] = (TH2F *)refdir->FindObjectAny("h_mapDepth4AmplE34_HB");
1524   Map_RefAmpl[2][1] = (TH2F *)refdir->FindObjectAny("h_mapDepth1AmplE34_HE");
1525   Map_RefAmpl[2][2] = (TH2F *)refdir->FindObjectAny("h_mapDepth2AmplE34_HE");
1526   Map_RefAmpl[2][3] = (TH2F *)refdir->FindObjectAny("h_mapDepth3AmplE34_HE");
1527   Map_RefAmpl[2][4] = (TH2F *)refdir->FindObjectAny("h_mapDepth4AmplE34_HE");
1528   Map_RefAmpl[2][5] = (TH2F *)refdir->FindObjectAny("h_mapDepth5AmplE34_HE");
1529   Map_RefAmpl[2][6] = (TH2F *)refdir->FindObjectAny("h_mapDepth6AmplE34_HE");
1530   Map_RefAmpl[2][7] = (TH2F *)refdir->FindObjectAny("h_mapDepth7AmplE34_HE");
1531   Map_RefAmpl[3][4] = (TH2F *)refdir->FindObjectAny("h_mapDepth4AmplE34_HO");
1532   Map_RefAmpl[4][1] = (TH2F *)refdir->FindObjectAny("h_mapDepth1AmplE34_HF");
1533   Map_RefAmpl[4][2] = (TH2F *)refdir->FindObjectAny("h_mapDepth2AmplE34_HF");
1534   Map_RefAmpl[4][3] = (TH2F *)refdir->FindObjectAny("h_mapDepth3AmplE34_HF");
1535   Map_RefAmpl[4][4] = (TH2F *)refdir->FindObjectAny("h_mapDepth4AmplE34_HF");
1536 
1537   Map_RefSUB[1][1] = (TH2F *)refdir->FindObjectAny("h_mapDepth1_HB");
1538   Map_RefSUB[1][2] = (TH2F *)refdir->FindObjectAny("h_mapDepth2_HB");
1539   Map_RefSUB[1][3] = (TH2F *)refdir->FindObjectAny("h_mapDepth3_HB");
1540   Map_RefSUB[1][4] = (TH2F *)refdir->FindObjectAny("h_mapDepth4_HB");
1541   Map_RefSUB[2][1] = (TH2F *)refdir->FindObjectAny("h_mapDepth1_HE");
1542   Map_RefSUB[2][2] = (TH2F *)refdir->FindObjectAny("h_mapDepth2_HE");
1543   Map_RefSUB[2][3] = (TH2F *)refdir->FindObjectAny("h_mapDepth3_HE");
1544   Map_RefSUB[2][4] = (TH2F *)refdir->FindObjectAny("h_mapDepth4_HE");
1545   Map_RefSUB[2][5] = (TH2F *)refdir->FindObjectAny("h_mapDepth5_HE");
1546   Map_RefSUB[2][6] = (TH2F *)refdir->FindObjectAny("h_mapDepth6_HE");
1547   Map_RefSUB[2][7] = (TH2F *)refdir->FindObjectAny("h_mapDepth7_HE");
1548   Map_RefSUB[3][4] = (TH2F *)refdir->FindObjectAny("h_mapDepth4_HO");
1549   Map_RefSUB[4][1] = (TH2F *)refdir->FindObjectAny("h_mapDepth1_HF");
1550   Map_RefSUB[4][2] = (TH2F *)refdir->FindObjectAny("h_mapDepth2_HF");
1551   Map_RefSUB[4][3] = (TH2F *)refdir->FindObjectAny("h_mapDepth3_HF");
1552   Map_RefSUB[4][4] = (TH2F *)refdir->FindObjectAny("h_mapDepth4_HF");
1553 
1554   HistAmplDepth[21][1][1] = new TH1F("diffAmpl_Depth1_HB", "", 100, -10., 10.);
1555   HistAmplDepth[21][1][2] = new TH1F("diffAmpl_Depth2_HB", "", 100, -10., 10.);
1556   HistAmplDepth[21][1][3] = new TH1F("diffAmpl_Depth3_HB", "", 100, -10., 10.);
1557   HistAmplDepth[21][1][4] = new TH1F("diffAmpl_Depth4_HB", "", 100, -10., 10.);
1558   HistAmplDepth[21][2][1] = new TH1F("diffAmpl_Depth1_HE", "", 100, -10., 10.);
1559   HistAmplDepth[21][2][2] = new TH1F("diffAmpl_Depth2_HE", "", 100, -10., 10.);
1560   HistAmplDepth[21][2][3] = new TH1F("diffAmpl_Depth3_HE", "", 100, -10., 10.);
1561   HistAmplDepth[21][2][4] = new TH1F("diffAmpl_Depth4_HE", "", 100, -10., 10.);
1562   HistAmplDepth[21][2][5] = new TH1F("diffAmpl_Depth5_HE", "", 100, -10., 10.);
1563   HistAmplDepth[21][2][6] = new TH1F("diffAmpl_Depth6_HE", "", 100, -10., 10.);
1564   HistAmplDepth[21][2][7] = new TH1F("diffAmpl_Depth7_HE", "", 100, -10., 10.);
1565   HistAmplDepth[21][3][4] = new TH1F("diffAmpl_Depth4_HO", "", 100, -10., 10.);
1566   HistAmplDepth[21][4][1] = new TH1F("diffAmpl_Depth1_HF", "", 100, -10., 10.);
1567   HistAmplDepth[21][4][2] = new TH1F("diffAmpl_Depth2_HF", "", 100, -10., 10.);
1568   HistAmplDepth[21][4][3] = new TH1F("diffAmpl_Depth3_HF", "", 100, -10., 10.);
1569   HistAmplDepth[21][4][4] = new TH1F("diffAmpl_Depth4_HF", "", 100, -10., 10.);
1570 
1571   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1572                                         //     if (sub==1) cHB->Divide(2,1);
1573     if (sub == 1)
1574       cHB->Divide(2, 2);
1575     //     if (sub==2) cHE->Divide(3,1);
1576     if (sub == 2)
1577       cHE->Divide(3, 3);
1578     if (sub == 3)
1579       cONE->Divide(1, 1);
1580     //     if (sub==4) cHF->Divide(2,1);
1581     if (sub == 4)
1582       cHF->Divide(2, 2);
1583     //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1584     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1585     //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
1586     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1587       if (sub == 1)
1588         cHB->cd(k);
1589       if (sub == 2)
1590         cHE->cd(k);
1591       if (sub == 3)
1592         cONE->cd(k - 3);
1593       if (sub == 4)
1594         cHF->cd(k);
1595       Map_Ampl[21][sub][k]->Divide(Map_Ampl[21][sub][k], Map_SUB[sub][k], 1, 1, "B");
1596       gPad->SetGridy();
1597       gPad->SetGridx();
1598       gPad->SetLogz();
1599       if (sub == 1)
1600         sprintf(str, "HB, Depth%d \b", k);
1601       if (sub == 2)
1602         sprintf(str, "HE, Depth%d \b", k);
1603       if (sub == 3)
1604         sprintf(str, "HO, Depth%d \b", k);
1605       if (sub == 4)
1606         sprintf(str, "HF, Depth%d \b", k);
1607       Map_Ampl[21][sub][k]->SetTitle(str);
1608       Map_Ampl[21][sub][k]->SetXTitle("#eta \b");
1609       Map_Ampl[21][sub][k]->SetYTitle("#phi \b");
1610       Map_Ampl[21][sub][k]->SetZTitle("Response \b");
1611       Map_Ampl[21][sub][k]->SetTitleOffset(1.1, "Z");
1612       Map_Ampl[21][sub][k]->Draw("COLZ");
1613       Map_Ampl[21][sub][k]->GetYaxis()->SetRangeUser(0, 71.);
1614       //            Map_Ampl[21][sub][k]->GetZaxis()->SetRangeUser(1., 10.);
1615       if (sub == 1) {
1616         cHB->Modified();
1617         cHB->Update();
1618       }
1619       if (sub == 2) {
1620         cHE->Modified();
1621         cHE->Update();
1622       }
1623       if (sub == 3) {
1624         cONE->Modified();
1625         cONE->Update();
1626       }
1627       if (sub == 4) {
1628         cHF->Modified();
1629         cHF->Update();
1630       }
1631     }  //end depth
1632     if (sub == 1) {
1633       cHB->Print("MapRateAmpl1HB.png");
1634       cHB->Clear();
1635     }
1636     if (sub == 2) {
1637       cHE->Print("MapRateAmpl1HE.png");
1638       cHE->Clear();
1639     }
1640     if (sub == 3) {
1641       cONE->Print("MapRateAmpl1HO.png");
1642       cONE->Clear();
1643     }
1644     if (sub == 4) {
1645       cHF->Print("MapRateAmpl1HF.png");
1646       cHF->Clear();
1647     }
1648 
1649     //     if (sub==1) cHB->Divide(2,1);
1650     if (sub == 1)
1651       cHB->Divide(2, 2);
1652     //     if (sub==2) cHE->Divide(3,1);
1653     if (sub == 2)
1654       cHE->Divide(3, 3);
1655     if (sub == 3)
1656       cONE->Divide(1, 1);
1657     //     if (sub==4) cHF->Divide(2,1);
1658     if (sub == 4)
1659       cHF->Divide(2, 2);
1660 
1661     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1662       if (sub == 1)
1663         cHB->cd(k);
1664       if (sub == 2)
1665         cHE->cd(k);
1666       if (sub == 3)
1667         cONE->cd(k - 3);
1668       if (sub == 4)
1669         cHF->cd(k);
1670       Map_RefAmpl[sub][k]->Divide(Map_RefAmpl[sub][k], Map_RefSUB[sub][k], 1, 1, "B");
1671       gPad->SetGridy();
1672       gPad->SetGridx();
1673       gPad->SetLogz();
1674       if (sub == 1)
1675         sprintf(str, "HB, Depth%d \b", k);
1676       if (sub == 2)
1677         sprintf(str, "HE, Depth%d \b", k);
1678       if (sub == 3)
1679         sprintf(str, "HO, Depth%d \b", k);
1680       if (sub == 4)
1681         sprintf(str, "HF, Depth%d \b", k);
1682       Map_RefAmpl[sub][k]->SetTitle(str);
1683       Map_RefAmpl[sub][k]->SetXTitle("#eta \b");
1684       Map_RefAmpl[sub][k]->SetYTitle("#phi \b");
1685       Map_RefAmpl[sub][k]->SetZTitle("Response\b");
1686       Map_RefAmpl[sub][k]->SetTitleOffset(1.1, "Z");
1687       Map_RefAmpl[sub][k]->Draw("COLZ");
1688       Map_RefAmpl[sub][k]->GetYaxis()->SetRangeUser(0, 71.);
1689       //            Map_RefAmpl[21][sub][k]->GetZaxis()->SetRangeUser(1., 10.);
1690       if (sub == 1) {
1691         cHB->Modified();
1692         cHB->Update();
1693       }
1694       if (sub == 2) {
1695         cHE->Modified();
1696         cHE->Update();
1697       }
1698       if (sub == 3) {
1699         cONE->Modified();
1700         cONE->Update();
1701       }
1702       if (sub == 4) {
1703         cHF->Modified();
1704         cHF->Update();
1705       }
1706     }  //end depth
1707     if (sub == 1) {
1708       cHB->Print("MapRateAmpl2HB.png");
1709       cHB->Clear();
1710     }
1711     if (sub == 2) {
1712       cHE->Print("MapRateAmpl2HE.png");
1713       cHE->Clear();
1714     }
1715     if (sub == 3) {
1716       cONE->Print("MapRateAmpl2HO.png");
1717       cONE->Clear();
1718     }
1719     if (sub == 4) {
1720       cHF->Print("MapRateAmpl2HF.png");
1721       cHF->Clear();
1722     }
1723 
1724     //     if (sub==1) cHB->Divide(2,1);
1725     if (sub == 1)
1726       cHB->Divide(2, 2);
1727     //     if (sub==2) cHE->Divide(3,1);
1728     if (sub == 2)
1729       cHE->Divide(3, 3);
1730     if (sub == 3)
1731       cONE->Divide(1, 1);
1732     //     if (sub==4) cHF->Divide(2,1);
1733     if (sub == 4)
1734       cHF->Divide(2, 2);
1735 
1736     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1737       if (sub == 1)
1738         cHB->cd(k);
1739       if (sub == 2)
1740         cHE->cd(k);
1741       if (sub == 3)
1742         cONE->cd(k - 3);
1743       if (sub == 4)
1744         cHF->cd(k);
1745       TH2F *TTT = new TH2F("Map", "Map", 82, -41, 40, 72, 0, 71);
1746       for (int x = 1; x <= Map_Ampl[21][sub][k]->GetXaxis()->GetNbins(); x++) {
1747         for (int y = 1; y <= Map_Ampl[21][sub][k]->GetYaxis()->GetNbins(); y++) {
1748           if (Map_Ampl[21][sub][k]->GetBinContent(x, y) != 0 && Map_RefAmpl[sub][k]->GetBinContent(x, y) != 0) {
1749             double ccc1 = Map_Ampl[21][sub][k]->GetBinContent(x, y) - Map_RefAmpl[sub][k]->GetBinContent(x, y);
1750             ccc1 = 100. * ccc1 / Map_Ampl[21][sub][k]->GetBinContent(x, y);  // in %
1751             HistAmplDepth[21][sub][k]->Fill(ccc1);
1752             Map_Ampl[21][sub][k]->SetBinContent(x, y, fabs(ccc1));
1753             if (fabs(ccc1) > porog[sub])
1754               TTT->SetBinContent(x, y, fabs(ccc1));
1755             else
1756               TTT->SetBinContent(x, y, 0);
1757           }
1758         }  //end y
1759       }    //esnd x
1760       gPad->SetGridy();
1761       gPad->SetGridx();
1762       //            gPad->SetLogz();
1763       if (sub == 1)
1764         sprintf(str, "HB, Depth%d \b", k);
1765       if (sub == 2)
1766         sprintf(str, "HE, Depth%d \b", k);
1767       if (sub == 3)
1768         sprintf(str, "HO, Depth%d \b", k);
1769       if (sub == 4)
1770         sprintf(str, "HF, Depth%d \b", k);
1771       TTT->SetTitle(str);
1772       TTT->SetXTitle("#eta \b");
1773       TTT->SetYTitle("#phi \b");
1774       TTT->SetZTitle("Relative difference, % \b");
1775       TTT->SetTitleOffset(0.9, "Z");
1776       TTT->Draw("COLZ");
1777       TTT->GetYaxis()->SetRangeUser(0, 71.);
1778       TTT->GetZaxis()->SetRangeUser(0, 10.);
1779       if (sub == 1) {
1780         cHB->Modified();
1781         cHB->Update();
1782       }
1783       if (sub == 2) {
1784         cHE->Modified();
1785         cHE->Update();
1786       }
1787       if (sub == 3) {
1788         cONE->Modified();
1789         cONE->Update();
1790       }
1791       if (sub == 4) {
1792         cHF->Modified();
1793         cHF->Update();
1794       }
1795     }  //end depth
1796 
1797     if (sub == 1) {
1798       cHB->Print("MapRateAmplDriftHB.png");
1799       cHB->Clear();
1800     }
1801     if (sub == 2) {
1802       cHE->Print("MapRateAmplDriftHE.png");
1803       cHE->Clear();
1804     }
1805     if (sub == 3) {
1806       cONE->Print("MapRateAmplDriftHO.png");
1807       cONE->Clear();
1808     }
1809     if (sub == 4) {
1810       cHF->Print("MapRateAmplDriftHF.png");
1811       cHF->Clear();
1812     }
1813     ////////////////////////////////////////////////////////////////////////////////////
1814 
1815     //     if (sub==1) cHB->Divide(2,1);
1816     if (sub == 1)
1817       cHB->Divide(2, 2);
1818     //     if (sub==2) cHE->Divide(3,1);
1819     if (sub == 2)
1820       cHE->Divide(3, 3);
1821     if (sub == 3)
1822       cONE->Divide(1, 1);
1823     //     if (sub==4) cHF->Divide(2,1);
1824     if (sub == 4)
1825       cHF->Divide(2, 2);
1826 
1827     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
1828       if (sub == 1)
1829         cHB->cd(k);
1830       if (sub == 2)
1831         cHE->cd(k);
1832       if (sub == 3)
1833         cONE->cd(k - 3);
1834       if (sub == 4)
1835         cHF->cd(k);
1836       gPad->SetGridy();
1837       gPad->SetGridx();
1838       gPad->SetLogy();
1839       if (sub == 1)
1840         sprintf(str, "HB, Depth%d \b", k);
1841       if (sub == 2)
1842         sprintf(str, "HE, Depth%d \b", k);
1843       if (sub == 3)
1844         sprintf(str, "HO, Depth%d \b", k);
1845       if (sub == 4)
1846         sprintf(str, "HF, Depth%d \b", k);
1847       HistAmplDepth[21][sub][k]->SetTitle(str);
1848       HistAmplDepth[21][sub][k]->SetYTitle("Number of cell-events \b");
1849       HistAmplDepth[21][sub][k]->SetXTitle("Per cent \b");
1850       HistAmplDepth[21][sub][k]->SetLineColor(4);
1851       HistAmplDepth[21][sub][k]->SetLineWidth(2);
1852       HistAmplDepth[21][sub][k]->SetTitleOffset(1.4, "Y");
1853       HistAmplDepth[21][sub][k]->Draw();
1854       //          HistAmplDepth[21][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
1855       HistAmplDepth[21][sub][k]->GetXaxis()->SetRangeUser(-10., 10.);
1856       if (sub == 1) {
1857         cHB->Modified();
1858         cHB->Update();
1859       }
1860       if (sub == 2) {
1861         cHE->Modified();
1862         cHE->Update();
1863       }
1864       if (sub == 3) {
1865         cONE->Modified();
1866         cONE->Update();
1867       }
1868       if (sub == 4) {
1869         cHF->Modified();
1870         cHF->Update();
1871       }
1872       double min_x[] = {-1 * porog[sub], -1 * porog[sub]};
1873       double min_y[] = {0., 100000000.};
1874       TGraph *MIN = new TGraph(2, min_x, min_y);
1875       MIN->SetLineStyle(2);
1876       MIN->SetLineColor(2);
1877       MIN->SetLineWidth(2 + 100 * 100);
1878       MIN->SetFillStyle(3005);
1879       MIN->SetFillColor(2);
1880       MIN->Draw("L");
1881       double max_x[] = {porog[sub], porog[sub]};
1882       double max_y[] = {0., 100000000.};
1883       TGraph *MAX = new TGraph(2, max_x, max_y);
1884       MAX->SetLineStyle(2);
1885       MAX->SetLineColor(2);
1886       MAX->SetLineWidth(-2 - 100 * 100);
1887       MAX->SetFillStyle(3004);
1888       MAX->SetFillColor(2);
1889       MAX->Draw("L");
1890     }  // end depth
1891     if (sub == 1) {
1892       cHB->Print("HistAmplDriftDepthHB.png");
1893       cHB->Clear();
1894     }
1895     if (sub == 2) {
1896       cHE->Print("HistAmplDriftDepthHE.png");
1897       cHE->Clear();
1898     }
1899     if (sub == 3) {
1900       cONE->Print("HistAmplDriftDepthHO.png");
1901       cONE->Clear();
1902     }
1903     if (sub == 4) {
1904       cHF->Print("HistAmplDriftDepthHF.png");
1905       cHF->Clear();
1906     }
1907   }  //end sub
1908 
1909   //+++++++++++++++++++++++++++++++++++
1910   //Test 31, 32 Pedestal, pedestalWidths
1911   //++++++++++++++++++++++++++++++++++++
1912 
1913   Map_Ampl[31][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestal_HB");
1914   Map_Ampl[31][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestal_HB");
1915   Map_Ampl[31][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestal_HB");
1916   Map_Ampl[31][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestal_HB");
1917   Map_Ampl[31][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestal_HE");
1918   Map_Ampl[31][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestal_HE");
1919   Map_Ampl[31][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestal_HE");
1920   Map_Ampl[31][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestal_HE");
1921   Map_Ampl[31][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5pedestal_HE");
1922   Map_Ampl[31][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6pedestal_HE");
1923   Map_Ampl[31][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7pedestal_HE");
1924   Map_Ampl[31][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestal_HO");
1925   Map_Ampl[31][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestal_HF");
1926   Map_Ampl[31][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestal_HF");
1927   Map_Ampl[31][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestal_HF");
1928   Map_Ampl[31][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestal_HF");
1929 
1930   Map_Ampl[32][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestalw_HB");
1931   Map_Ampl[32][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestalw_HB");
1932   Map_Ampl[32][1][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestalw_HB");
1933   Map_Ampl[32][1][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestalw_HB");
1934   Map_Ampl[32][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestalw_HE");
1935   Map_Ampl[32][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestalw_HE");
1936   Map_Ampl[32][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestalw_HE");
1937   Map_Ampl[32][2][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestalw_HE");
1938   Map_Ampl[32][2][5] = (TH2F *)dir->FindObjectAny("h_mapDepth5pedestalw_HE");
1939   Map_Ampl[32][2][6] = (TH2F *)dir->FindObjectAny("h_mapDepth6pedestalw_HE");
1940   Map_Ampl[32][2][7] = (TH2F *)dir->FindObjectAny("h_mapDepth7pedestalw_HE");
1941   Map_Ampl[32][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestalw_HO");
1942   Map_Ampl[32][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1pedestalw_HF");
1943   Map_Ampl[32][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2pedestalw_HF");
1944   Map_Ampl[32][4][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3pedestalw_HF");
1945   Map_Ampl[32][4][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4pedestalw_HF");
1946 
1947   HistPed[1][1][0] = (TH1F *)dir->FindObjectAny("h_pedestal0_HB");
1948   HistPed[1][1][1] = (TH1F *)dir->FindObjectAny("h_pedestal1_HB");
1949   HistPed[1][1][2] = (TH1F *)dir->FindObjectAny("h_pedestal2_HB");
1950   HistPed[1][1][3] = (TH1F *)dir->FindObjectAny("h_pedestal3_HB");
1951   HistPed[2][1][0] = (TH1F *)dir->FindObjectAny("h_pedestalw0_HB");
1952   HistPed[2][1][1] = (TH1F *)dir->FindObjectAny("h_pedestalw1_HB");
1953   HistPed[2][1][2] = (TH1F *)dir->FindObjectAny("h_pedestalw2_HB");
1954   HistPed[2][1][3] = (TH1F *)dir->FindObjectAny("h_pedestalw3_HB");
1955 
1956   HistPed[1][2][0] = (TH1F *)dir->FindObjectAny("h_pedestal0_HE");
1957   HistPed[1][2][1] = (TH1F *)dir->FindObjectAny("h_pedestal1_HE");
1958   HistPed[1][2][2] = (TH1F *)dir->FindObjectAny("h_pedestal2_HE");
1959   HistPed[1][2][3] = (TH1F *)dir->FindObjectAny("h_pedestal3_HE");
1960   HistPed[2][2][0] = (TH1F *)dir->FindObjectAny("h_pedestalw0_HE");
1961   HistPed[2][2][1] = (TH1F *)dir->FindObjectAny("h_pedestalw1_HE");
1962   HistPed[2][2][2] = (TH1F *)dir->FindObjectAny("h_pedestalw2_HE");
1963   HistPed[2][2][3] = (TH1F *)dir->FindObjectAny("h_pedestalw3_HE");
1964 
1965   HistPed[1][3][0] = (TH1F *)dir->FindObjectAny("h_pedestal0_HO");
1966   HistPed[1][3][1] = (TH1F *)dir->FindObjectAny("h_pedestal1_HO");
1967   HistPed[1][3][2] = (TH1F *)dir->FindObjectAny("h_pedestal2_HO");
1968   HistPed[1][3][3] = (TH1F *)dir->FindObjectAny("h_pedestal3_HO");
1969   HistPed[2][3][0] = (TH1F *)dir->FindObjectAny("h_pedestalw0_HO");
1970   HistPed[2][3][1] = (TH1F *)dir->FindObjectAny("h_pedestalw1_HO");
1971   HistPed[2][3][2] = (TH1F *)dir->FindObjectAny("h_pedestalw2_HO");
1972   HistPed[2][3][3] = (TH1F *)dir->FindObjectAny("h_pedestalw3_HO");
1973 
1974   HistPed[1][4][0] = (TH1F *)dir->FindObjectAny("h_pedestal0_HF");
1975   HistPed[1][4][1] = (TH1F *)dir->FindObjectAny("h_pedestal1_HF");
1976   HistPed[1][4][2] = (TH1F *)dir->FindObjectAny("h_pedestal2_HF");
1977   HistPed[1][4][3] = (TH1F *)dir->FindObjectAny("h_pedestal3_HF");
1978   HistPed[2][4][0] = (TH1F *)dir->FindObjectAny("h_pedestalw0_HF");
1979   HistPed[2][4][1] = (TH1F *)dir->FindObjectAny("h_pedestalw1_HF");
1980   HistPed[2][4][2] = (TH1F *)dir->FindObjectAny("h_pedestalw2_HF");
1981   HistPed[2][4][3] = (TH1F *)dir->FindObjectAny("h_pedestalw3_HF");
1982 
1983   for (int test = 31; test <= 32; test++) {  //Test: 31-Pedestals, 32-pedestal Widths,
1984     for (int sub = 1; sub <= 4; sub++) {     //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1985                                              //        if (sub==1) cHB->Divide(2,1);
1986       if (sub == 1)
1987         cHB->Divide(2, 2);
1988       //        if (sub==2) cHE->Divide(3,1);
1989       if (sub == 2)
1990         cHE->Divide(3, 3);
1991       if (sub == 3)
1992         cONE->Divide(1, 1);
1993       //        if (sub==4) cHF->Divide(2,1);
1994       if (sub == 4)
1995         cHF->Divide(2, 2);
1996       //          int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
1997       //        int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
1998       //          int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
1999       for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depths
2000         if (sub == 1)
2001           cHB->cd(k);
2002         if (sub == 2)
2003           cHE->cd(k);
2004         if (sub == 3)
2005           cONE->cd(k - 3);
2006         if (sub == 4)
2007           cHF->cd(k);
2008         Map_Ampl[test][sub][k]->Divide(Map_Ampl[test][sub][k], Map_SUB[sub][k], 1, 1, "B");
2009         gPad->SetGridy();
2010         gPad->SetGridx();
2011         gPad->SetLogz();
2012         if (sub == 1)
2013           sprintf(str, "HB, Depth%d \b", k);
2014         if (sub == 2)
2015           sprintf(str, "HE, Depth%d \b", k);
2016         if (sub == 3)
2017           sprintf(str, "HO, Depth%d \b", k);
2018         if (sub == 4)
2019           sprintf(str, "HF, Depth%d \b", k);
2020         Map_Ampl[test][sub][k]->SetTitle(str);
2021         Map_Ampl[test][sub][k]->SetXTitle("#eta \b");
2022         Map_Ampl[test][sub][k]->SetYTitle("#phi \b");
2023         Map_Ampl[test][sub][k]->SetZTitle("Rate \b");
2024         if (sub == 3)
2025           Map_Ampl[test][sub][k]->SetTitleOffset(0.8, "Z");
2026         Map_Ampl[test][sub][k]->Draw("COLZ");
2027         Map_Ampl[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2028         Map_Ampl[test][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
2029         if (sub == 1) {
2030           cHB->Modified();
2031           cHB->Update();
2032         }
2033         if (sub == 2) {
2034           cHE->Modified();
2035           cHE->Update();
2036         }
2037         if (sub == 3) {
2038           cONE->Modified();
2039           cONE->Update();
2040         }
2041         if (sub == 4) {
2042           cHF->Modified();
2043           cHF->Update();
2044         }
2045       }  //end depth
2046       if (test == 31) {
2047         if (sub == 1) {
2048           cHB->Print("MapRatePedHB.png");
2049           cHB->Clear();
2050         }
2051         if (sub == 2) {
2052           cHE->Print("MapRatePedHE.png");
2053           cHE->Clear();
2054         }
2055         if (sub == 3) {
2056           cONE->Print("MapRatePedHO.png");
2057           cONE->Clear();
2058         }
2059         if (sub == 4) {
2060           cHF->Print("MapRatePedHF.png");
2061           cHF->Clear();
2062         }
2063       }
2064       if (test == 32) {
2065         if (sub == 1) {
2066           cHB->Print("MapRatePedWidthsHB.png");
2067           cHB->Clear();
2068         }
2069         if (sub == 2) {
2070           cHE->Print("MapRatePedWidthsHE.png");
2071           cHE->Clear();
2072         }
2073         if (sub == 3) {
2074           cONE->Print("MapRatePedWidthsHO.png");
2075           cONE->Clear();
2076         }
2077         if (sub == 4) {
2078           cHF->Print("MapRatePedWidthsHF.png");
2079           cHF->Clear();
2080         }
2081       }
2082 
2083       ///////////////////////////////////////////////
2084 
2085       cPED->Divide(2, 2);
2086       for (int cap = 0; cap <= 3; cap++) {
2087         cPED->cd(cap + 1);
2088         gPad->SetGridy();
2089         gPad->SetGridx();
2090         gPad->SetLogy();
2091 
2092         if (sub == 1)
2093           sprintf(str, "HB, Cap%d, all depth\b", cap);
2094         if (sub == 2)
2095           sprintf(str, "HE, Cap%d, all depth\b", cap);
2096         if (sub == 3)
2097           sprintf(str, "HO, Cap%d, all depth\b", cap);
2098         if (sub == 4)
2099           sprintf(str, "HF, Cap%d, all depth\b", cap);
2100 
2101         HistPed[test - 30][sub][cap]->SetTitle(str);
2102 
2103         if (test == 31)
2104           HistPed[test - 30][sub][cap]->SetXTitle("Pedestals in each event & cell \b");
2105         if (test == 32)
2106           HistPed[test - 30][sub][cap]->SetXTitle("Pedestal Widths in each event & cell \b");
2107 
2108         HistPed[test - 30][sub][cap]->SetYTitle("Number of channel-events \b");
2109         HistPed[test - 30][sub][cap]->SetLineColor(4);
2110         HistPed[test - 30][sub][cap]->SetLineWidth(2);
2111         HistPed[test - 30][sub][cap]->SetTitleOffset(1.4, "Y");
2112         HistPed[test - 30][sub][cap]->Draw("");
2113         //            HistPed[test-30][sub][cap]->GetYaxis()->SetRangeUser(1., 100.);
2114         //            if (test==31) {gPad->SetLogx(); HistPed[test-30][sub][cap]->GetXaxis()->SetRangeUser(1., 10000.);}
2115         //            if (test==32) HistPed[test-30][sub][cap]->GetXaxis()->SetRangeUser(0., 5.);
2116 
2117         cPED->Modified();
2118         cPED->Update();
2119         double min_x[] = {Pedest[test - 31][sub], Pedest[test - 31][sub]};
2120         double min_y[] = {0., 100000000.};
2121         TGraph *MIN = new TGraph(2, min_x, min_y);
2122         MIN->SetLineStyle(2);
2123         MIN->SetLineColor(2);
2124         MIN->SetLineWidth(2 + 100 * 100);
2125         MIN->SetFillStyle(3005);
2126         MIN->SetFillColor(2);
2127         MIN->Draw("L");
2128       }
2129       if (test == 31) {
2130         if (sub == 1) {
2131           cPED->Print("HistPedestalsHB.png");
2132           cPED->Clear();
2133         }
2134         if (sub == 2) {
2135           cPED->Print("HistPedestalsHE.png");
2136           cPED->Clear();
2137         }
2138         if (sub == 3) {
2139           cPED->Print("HistPedestalsHO.png");
2140           cPED->Clear();
2141         }
2142         if (sub == 4) {
2143           cPED->Print("HistPedestalsHF.png");
2144           cPED->Clear();
2145         }
2146       }
2147       if (test == 32) {
2148         if (sub == 1) {
2149           cPED->Print("HistPedestalWidthsHB.png");
2150           cPED->Clear();
2151         }
2152         if (sub == 2) {
2153           cPED->Print("HistPedestalWidthsHE.png");
2154           cPED->Clear();
2155         }
2156         if (sub == 3) {
2157           cPED->Print("HistPedestalWidthsHO.png");
2158           cPED->Clear();
2159         }
2160         if (sub == 4) {
2161           cPED->Print("HistPedestalWidthsHF.png");
2162           cPED->Clear();
2163         }
2164       }
2165     }  // end sub
2166   }    //end test 31,32
2167 
2168   //+++++++++++++++++++++++++++++++++++
2169   //Test 33 Correlation of Pedestal, pedestalWidths Vs fullAmplitude
2170   //++++++++++++++++++++++++++++++++++++
2171 
2172   cPED->Clear();
2173   Map_Ped[1][1] = (TH2F *)dir->FindObjectAny("h2_pedvsampl_HB");
2174   Map_Ped[1][2] = (TH2F *)dir->FindObjectAny("h2_pedvsampl_HE");
2175   Map_Ped[1][3] = (TH2F *)dir->FindObjectAny("h2_pedvsampl_HO");
2176   Map_Ped[1][4] = (TH2F *)dir->FindObjectAny("h2_pedvsampl_HF");
2177   Map_Ped[2][1] = (TH2F *)dir->FindObjectAny("h2_pedwvsampl_HB");
2178   Map_Ped[2][2] = (TH2F *)dir->FindObjectAny("h2_pedwvsampl_HE");
2179   Map_Ped[2][3] = (TH2F *)dir->FindObjectAny("h2_pedwvsampl_HO");
2180   Map_Ped[2][4] = (TH2F *)dir->FindObjectAny("h2_pedwvsampl_HF");
2181   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2182     cPED->Divide(2, 1);
2183     for (int test = 1; test <= 2; test++) {
2184       cPED->cd(test);
2185       gPad->SetGridy();
2186       gPad->SetGridx();
2187       gPad->SetLogz();
2188       if (test == 1)
2189         Map_Ped[test][sub]->SetXTitle("Pedestal, fC \b");
2190       if (test == 2)
2191         Map_Ped[test][sub]->SetXTitle("pedestal Width, fC \b");
2192       Map_Ped[test][sub]->SetYTitle("Amplitude, fC \b");
2193       Map_Ped[test][sub]->SetZTitle("entries  \b");
2194       if (test == 1)
2195         sprintf(str, "Cap0 Pedestal vs Amplitude \b");
2196       if (test == 2)
2197         sprintf(str, "Cap0 pedestalWidth vs Amplitude \b");
2198       Map_Ped[test][sub]->SetTitle(str);
2199       Map_Ped[test][sub]->Draw("COLZ");
2200       // Map_Ped[test][sub]->GetYaxis()->SetRangeUser(0, 72.);
2201       //      Map_Ped[test][sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
2202       cPED->Modified();
2203       cPED->Update();
2204     }  // test 1,2
2205     if (sub == 1) {
2206       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHB.png");
2207       cPED->Clear();
2208     }
2209     if (sub == 2) {
2210       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHE.png");
2211       cPED->Clear();
2212     }
2213     if (sub == 3) {
2214       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHO.png");
2215       cPED->Clear();
2216     }
2217     if (sub == 4) {
2218       cPED->Print("CorrelationsMapPedestalVsfullAmplitudeHF.png");
2219       cPED->Clear();
2220     }
2221   }  // end sub
2222 
2223   //+++++++++++++++++++++++++++++++++++
2224   //Test 41 Time Slices shape for good and bad channels
2225   //++++++++++++++++++++++++++++++++++++
2226 
2227   cONE->Clear();
2228   hist_GoodTSshape[1] = (TH1F *)dir->FindObjectAny("h_shape_good_channels_HB");
2229   hist_GoodTSshape[2] = (TH1F *)dir->FindObjectAny("h_shape_good_channels_HE");
2230   hist_GoodTSshape[3] = (TH1F *)dir->FindObjectAny("h_shape_good_channels_HO");
2231   hist_GoodTSshape[4] = (TH1F *)dir->FindObjectAny("h_shape_good_channels_HF");
2232 
2233   hist_GoodTSshape0[1] = (TH1F *)dir->FindObjectAny("h_shape0_good_channels_HB");
2234   hist_GoodTSshape0[2] = (TH1F *)dir->FindObjectAny("h_shape0_good_channels_HE");
2235   hist_GoodTSshape0[3] = (TH1F *)dir->FindObjectAny("h_shape0_good_channels_HO");
2236   hist_GoodTSshape0[4] = (TH1F *)dir->FindObjectAny("h_shape0_good_channels_HF");
2237 
2238   hist_BadTSshape[1] = (TH1F *)dir->FindObjectAny("h_shape_bad_channels_HB");
2239   hist_BadTSshape[2] = (TH1F *)dir->FindObjectAny("h_shape_bad_channels_HE");
2240   hist_BadTSshape[3] = (TH1F *)dir->FindObjectAny("h_shape_bad_channels_HO");
2241   hist_BadTSshape[4] = (TH1F *)dir->FindObjectAny("h_shape_bad_channels_HF");
2242 
2243   hist_BadTSshape0[1] = (TH1F *)dir->FindObjectAny("h_shape0_bad_channels_HB");
2244   hist_BadTSshape0[2] = (TH1F *)dir->FindObjectAny("h_shape0_bad_channels_HE");
2245   hist_BadTSshape0[3] = (TH1F *)dir->FindObjectAny("h_shape0_bad_channels_HO");
2246   hist_BadTSshape0[4] = (TH1F *)dir->FindObjectAny("h_shape0_bad_channels_HF");
2247 
2248   cONE->cd(1);
2249 
2250   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2251 
2252     gPad->SetGridy();
2253     gPad->SetGridx();
2254     gPad->SetLogz();
2255     hist_GoodTSshape[sub]->Divide(hist_GoodTSshape[sub], hist_GoodTSshape0[sub], 1, 1, "B");
2256     hist_GoodTSshape[sub]->SetXTitle("Time slice \b");
2257     hist_GoodTSshape[sub]->SetYTitle("ADC counts \b");
2258     sprintf(str, "Mean ADC Shape \b");
2259     hist_GoodTSshape[sub]->SetTitle(str);
2260     hist_GoodTSshape[sub]->Draw("");
2261     // hist_GoodTSshape[sub]->GetYaxis()->SetRangeUser(0, 72.);
2262     // hist_GoodTSshape[sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
2263     cONE->Modified();
2264     cONE->Update();
2265     if (sub == 1) {
2266       cONE->Print("HistGoodTSshapesHB.png");
2267       cONE->Clear();
2268     }
2269     if (sub == 2) {
2270       cONE->Print("HistGoodTSshapesHE.png");
2271       cONE->Clear();
2272     }
2273     if (sub == 3) {
2274       cONE->Print("HistGoodTSshapesHO.png");
2275       cONE->Clear();
2276     }
2277     if (sub == 4) {
2278       cONE->Print("HistGoodTSshapesHF.png");
2279       cONE->Clear();
2280     }
2281   }  // end sub
2282 
2283   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2284 
2285     gPad->SetGridy();
2286     gPad->SetGridx();
2287     gPad->SetLogz();
2288     hist_BadTSshape[sub]->Divide(hist_BadTSshape[sub], hist_BadTSshape0[sub], 1, 1, "B");
2289     hist_BadTSshape[sub]->SetXTitle("Time slice \b");
2290     hist_BadTSshape[sub]->SetYTitle("ADC counts \b");
2291     sprintf(str, "Mean ADC Shape \b");
2292     hist_BadTSshape[sub]->SetTitle(str);
2293     hist_BadTSshape[sub]->Draw("");
2294     // hist_BadTSshape[sub]->GetYaxis()->SetRangeUser(0, 72.);
2295     // hist_BadTSshape[sub]->GetZaxis()->SetRangeUser(0.0001, 1.);
2296     cONE->Modified();
2297     cONE->Update();
2298     if (sub == 1) {
2299       cONE->Print("HistBadTSshapesHB.png");
2300       cONE->Clear();
2301     }
2302     if (sub == 2) {
2303       cONE->Print("HistBadTSshapesHE.png");
2304       cONE->Clear();
2305     }
2306     if (sub == 3) {
2307       cONE->Print("HistBadTSshapesHO.png");
2308       cONE->Clear();
2309     }
2310     if (sub == 4) {
2311       cONE->Print("HistBadTSshapesHF.png");
2312       cONE->Clear();
2313     }
2314   }  // end sub
2315 
2316   /*
2317  //+++++++++++++++++++++++++++++++++++  
2318 //Test 42 ADC in TS distributions   
2319 //++++++++++++++++++++++++++++++++++++
2320  
2321 std::cout<<" We are here to print ADC "<<std::endl; 
2322 
2323   hist_ADC_All[1] = (TH1F*)dir->FindObjectAny("h_ADC_HB");
2324   hist_ADC_All[2] = (TH1F*)dir->FindObjectAny("h_ADC_HE");
2325   hist_ADC_All[3] = (TH1F*)dir->FindObjectAny("h_ADC_HO");
2326   hist_ADC_All[4] = (TH1F*)dir->FindObjectAny("h_ADC_HF");
2327 
2328 
2329   hist_ADC_DS[1][1] = (TH1F*)dir->FindObjectAny("h_ADC_HBdepth1");
2330   hist_ADC_DS[1][2] = (TH1F*)dir->FindObjectAny("h_ADC_HBdepth2");
2331   hist_ADC_DS[2][1] = (TH1F*)dir->FindObjectAny("h_ADC_HEdepth1");
2332   hist_ADC_DS[2][2] = (TH1F*)dir->FindObjectAny("h_ADC_HEdepth2");
2333   hist_ADC_DS[2][3] = (TH1F*)dir->FindObjectAny("h_ADC_HEdepth3");
2334   hist_ADC_DS[3][4] = (TH1F*)dir->FindObjectAny("h_ADC_HOdepth4");
2335   hist_ADC_DS[4][1] = (TH1F*)dir->FindObjectAny("h_ADC_HFdepth1");
2336   hist_ADC_DS[4][2] = (TH1F*)dir->FindObjectAny("h_ADC_HFdepth2");
2337 
2338 
2339   cONE->Clear();   
2340   cONE->Divide(1,1);
2341   cONE->cd(1);
2342 
2343   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF         
2344       gPad->SetGridy();
2345       gPad->SetGridx();
2346       gPad->SetLogy();
2347       hist_ADC_All[sub]->SetXTitle("ADC counts \b");
2348       hist_ADC_All[sub]->SetYTitle("Number of channels-events \b");
2349       if (sub==1) sprintf(str,"ADC counts Distribution HB\b");
2350       if (sub==2) sprintf(str,"ADC counts Distribution HE\b");
2351       if (sub==3) sprintf(str,"ADC counts Distribution HO\b");
2352       if (sub==4) sprintf(str,"ADC counts Distribution HF\b");
2353       hist_ADC_All[sub]->SetTitle(str);
2354       hist_ADC_All[sub]->Draw("");
2355       // hist_ADC_All[sub]->GetYaxis()->SetRangeUser(0, 72.);
2356       hist_ADC_All[sub]->GetXaxis()->SetRangeUser(0.000, 1000.);
2357       cONE->Modified(); cONE->Update();
2358       if (sub==1) {cONE->Print("Hist_ADC_HB_All.png"); cONE->Clear();} 
2359       if (sub==2) {cONE->Print("Hist_ADC_HE_All.png"); cONE->Clear();}
2360       if (sub==3) {cONE->Print("Hist_ADC_HO_All.png"); cONE->Clear();}
2361       if (sub==4) {cONE->Print("Hist_ADC_HF_All.png"); cONE->Clear();} 
2362   }// end sub      
2363   
2364 
2365   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2366           if (sub==1) cHB->Divide(2,1);
2367           if (sub==2) cHE->Divide(3,1);
2368           if (sub==3) cONE->Divide(1,1);
2369           if (sub==4) cHB->Divide(2,1);
2370           int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2371           int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet    
2372           for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depths 
2373               if (sub==1) cHB->cd(k); 
2374               if (sub==2) cHE->cd(k);
2375           if (sub==3) cONE->cd(k-3);
2376           if (sub==4) cHB->cd(k); 
2377               gPad->SetGridy();
2378               gPad->SetGridx();
2379               gPad->SetLogy();
2380               hist_ADC_DS[sub][k]->SetXTitle("ADC counts \b");
2381               hist_ADC_DS[sub][k]->SetYTitle("Number of channels-events \b");
2382               if (sub==1) sprintf(str,"HB, Depth%d \b", k);
2383               if (sub==2) sprintf(str,"HE, Depth%d \b", k);
2384               if (sub==3) sprintf(str,"HO, Depth%d \b", k);
2385               if (sub==4) sprintf(str,"HF, Depth%d \b", k); 
2386               hist_ADC_DS[sub][k]->SetTitle(str);
2387               hist_ADC_DS[sub][k]->Draw("");
2388            // hist_ADC_DS[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2389               hist_ADC_DS[sub][k]->GetXaxis()->SetRangeUser(0.000, 1000.);
2390               if (sub==1) {cHB->Modified(); cHB->Update();} 
2391               if (sub==2) {cHE->Modified(); cHE->Update();}
2392               if (sub==3) {cONE->Modified();cONE->Update();}
2393               if (sub==4) {cHB->Modified(); cHB->Update();} 
2394           }//end depth    
2395       if (sub==1) {cHB->Print("Hist_ADC_HB_DS.png"); cHB->Clear();} 
2396           if (sub==2) {cHE->Print("Hist_ADC_HE_DS.png"); cHE->Clear();}
2397           if (sub==3) {cONE->Print("Hist_ADC_HO_DS.png"); cONE->Clear();}
2398           if (sub==4) {cHB->Print("Hist_ADC_HF_DS.png"); cHB->Clear();} 
2399   }// end sub
2400 
2401 
2402  //+++++++++++++++++++++++++++++++++++  
2403 //Test 43 Sum ADC in TS distributions   
2404 //++++++++++++++++++++++++++++++++++++
2405 
2406   hist_SumADC[1][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HB");
2407   hist_SumADC[1][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HB");
2408   hist_SumADC[2][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HE");
2409   hist_SumADC[2][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HE");
2410   hist_SumADC[2][3] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth3_HE");
2411   hist_SumADC[3][4] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth4_HO");
2412   hist_SumADC[4][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HF");
2413   hist_SumADC[4][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HF");
2414 
2415   hist_SumADC0[1][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HB0");
2416   hist_SumADC0[1][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HB0");
2417   hist_SumADC0[2][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HE0");
2418   hist_SumADC0[2][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HE0");
2419   hist_SumADC0[2][3] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth3_HE0");
2420   hist_SumADC0[3][4] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth4_HO0");
2421   hist_SumADC0[4][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HF0");
2422   hist_SumADC0[4][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HF0");
2423 
2424   hist_SumADC1[1][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HB1");
2425   hist_SumADC1[1][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HB1");
2426   hist_SumADC1[2][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HE1");
2427   hist_SumADC1[2][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HE1");
2428   hist_SumADC1[2][3] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth3_HE1");
2429   hist_SumADC1[3][4] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth4_HO1");
2430   hist_SumADC1[4][1] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth1_HF1");
2431   hist_SumADC1[4][2] = (TH1F*)dir->FindObjectAny("h_sumamplitude_depth2_HF1");
2432 
2433   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2434           if (sub==1) cHB->Divide(2,1);
2435           if (sub==2) cHE->Divide(3,1);
2436           if (sub==3) cONE->Divide(1,1);
2437           if (sub==4) cHB->Divide(2,1);
2438           int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2439           int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet    
2440           for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depths 
2441               if (sub==1) cHB->cd(k); 
2442               if (sub==2) cHE->cd(k);
2443           if (sub==3) cONE->cd(k-3);
2444           if (sub==4) cHB->cd(k); 
2445               gPad->SetGridy();
2446               gPad->SetGridx();
2447               gPad->SetLogy();
2448               hist_SumADC[sub][k]->SetXTitle("ADC sum \b");
2449               hist_SumADC[sub][k]->SetYTitle("Number of channels-events \b");
2450               if (sub==1) sprintf(str,"HB, Depth%d \b", k);
2451               if (sub==2) sprintf(str,"HE, Depth%d \b", k);
2452               if (sub==3) sprintf(str,"HO, Depth%d \b", k);
2453               if (sub==4) sprintf(str,"HF, Depth%d \b", k); 
2454               hist_SumADC[sub][k]->SetTitle(str);
2455               hist_SumADC[sub][k]->Draw("");
2456            // hist_SumADC[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2457            // hist_SumADC[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
2458               if (sub==1) {cHB->Modified(); cHB->Update();} 
2459               if (sub==2) {cHE->Modified(); cHE->Update();}
2460               if (sub==3) {cONE->Modified();cONE->Update();}
2461               if (sub==4) {cHB->Modified(); cHB->Update();} 
2462           }//end depth    
2463       if (sub==1) {cHB->Print("Hist_SumADC_HB.png"); cHB->Clear();} 
2464           if (sub==2) {cHE->Print("Hist_SumADC_HE.png"); cHE->Clear();}
2465           if (sub==3) {cONE->Print("Hist_SumADC_HO.png"); cONE->Clear();}
2466           if (sub==4) {cHB->Print("Hist_SumADC_HF.png"); cHB->Clear();} 
2467   }// end sub
2468 
2469 
2470   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2471           if (sub==1) cHB->Divide(2,1);
2472           if (sub==2) cHE->Divide(3,1);
2473           if (sub==3) cONE->Divide(1,1);
2474           if (sub==4) cHB->Divide(2,1);
2475           int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2476           int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet    
2477           for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depths 
2478               if (sub==1) cHB->cd(k); 
2479               if (sub==2) cHE->cd(k);
2480           if (sub==3) cONE->cd(k-3);
2481           if (sub==4) cHB->cd(k); 
2482               gPad->SetGridy();
2483               gPad->SetGridx();
2484               gPad->SetLogy();
2485               hist_SumADC0[sub][k]->SetXTitle("ADC sum \b");
2486               hist_SumADC0[sub][k]->SetYTitle("Number of channels-events \b");
2487               if (sub==1) sprintf(str,"HB, Depth%d \b", k);
2488               if (sub==2) sprintf(str,"HE, Depth%d \b", k);
2489               if (sub==3) sprintf(str,"HO, Depth%d \b", k);
2490               if (sub==4) sprintf(str,"HF, Depth%d \b", k); 
2491               hist_SumADC0[sub][k]->SetTitle(str);
2492               hist_SumADC0[sub][k]->Draw("");
2493            // hist_SumADC0[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2494            // hist_SumADC0[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
2495               if (sub==1) {cHB->Modified(); cHB->Update();} 
2496               if (sub==2) {cHE->Modified(); cHE->Update();}
2497               if (sub==3) {cONE->Modified();cONE->Update();}
2498               if (sub==4) {cHB->Modified(); cHB->Update();} 
2499           }//end depth    
2500       if (sub==1) {cHB->Print("Hist_SumADC_HB0.png"); cHB->Clear();} 
2501           if (sub==2) {cHE->Print("Hist_SumADC_HE0.png"); cHE->Clear();}
2502           if (sub==3) {cONE->Print("Hist_SumADC_HO0.png"); cONE->Clear();}
2503           if (sub==4) {cHB->Print("Hist_SumADC_HF0.png"); cHB->Clear();} 
2504   }// end sub
2505 
2506   for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
2507           if (sub==1) cHB->Divide(2,1);
2508           if (sub==2) cHE->Divide(3,1);
2509           if (sub==3) cONE->Divide(1,1);
2510           if (sub==4) cHB->Divide(2,1);
2511           int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
2512           int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet    
2513           for (int k=k_min[sub];k<=k_max[sub];k++) {  //Depths 
2514               if (sub==1) cHB->cd(k); 
2515               if (sub==2) cHE->cd(k);
2516           if (sub==3) cONE->cd(k-3);
2517           if (sub==4) cHB->cd(k); 
2518               gPad->SetGridy();
2519               gPad->SetGridx();
2520               gPad->SetLogy();
2521               hist_SumADC1[sub][k]->SetXTitle("ADC sum \b");
2522               hist_SumADC1[sub][k]->SetYTitle("Number of channels-events \b");
2523               if (sub==1) sprintf(str,"HB, Depth%d \b", k);
2524               if (sub==2) sprintf(str,"HE, Depth%d \b", k);
2525               if (sub==3) sprintf(str,"HO, Depth%d \b", k);
2526               if (sub==4) sprintf(str,"HF, Depth%d \b", k); 
2527               hist_SumADC1[sub][k]->SetTitle(str);
2528               hist_SumADC1[sub][k]->Draw("");
2529            // hist_SumADC1[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
2530            // hist_SumADC1[sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
2531               if (sub==1) {cHB->Modified(); cHB->Update();} 
2532               if (sub==2) {cHE->Modified(); cHE->Update();}
2533               if (sub==3) {cONE->Modified();cONE->Update();}
2534               if (sub==4) {cHB->Modified(); cHB->Update();} 
2535           }//end depth    
2536       if (sub==1) {cHB->Print("Hist_SumADC_HB1.png"); cHB->Clear();} 
2537           if (sub==2) {cHE->Print("Hist_SumADC_HE1.png"); cHE->Clear();}
2538           if (sub==3) {cONE->Print("Hist_SumADC_HO1.png"); cONE->Clear();}
2539           if (sub==4) {cHB->Print("Hist_SumADC_HF1.png"); cHB->Clear();} 
2540   }// end sub
2541 
2542 */
2543 
2544   ////////////////////         Iteration Method for Calibration Group:
2545   ////////////////////         Iteration Method for Calibration Group:
2546   ////////////////////         Iteration Method for Calibration Group:
2547   ////////////////////         Iteration Method for Calibration Group:
2548   ////////////////////         Iteration Method for Calibration Group:
2549 
2550   const int nsub = 4;
2551   const int ndepth = 7;
2552   const int neta = 82;
2553   const int nphi = 72;
2554   int njeta = neta;
2555   int njphi = nphi;
2556   int njdepth = ndepth;
2557   double alexhe[ndepth][njeta][njphi];
2558   double variance[ndepth][njeta][njphi];
2559 
2560   const int jposbeg = 57;
2561   const int jposend = 71;
2562 
2563   const int jnegbeg = 12;
2564   const int jnegend = 26;
2565 
2566   cout << "Iteration Method for Calibration Group    nsub=  " << nsub << "  ndepth =  " << ndepth << " neta =  " << neta
2567        << " nphi =  " << nphi << endl;
2568   cout << "Iteration Method for Calibration Group      njdepth =  " << njdepth << " njeta =  " << njeta
2569        << " njphi =  " << njphi << endl;
2570   cout << "Iteration Method for Calibration Group        jposbeg =  " << jposbeg << " jposend =  " << jposend
2571        << " jnegbeg =  " << jnegbeg << " jnegend =  " << jnegend << endl;
2572 
2573   /*
2574     depth=5                    all
2575     i=1-82 in initial histo
2576     j=i-1 in massives
2577     
2578     j= 13   23 (11)           12    25 (!!!)
2579     j-41 in histo
2580     -28  -18 (11)          -29    -16
2581     
2582     j= 59   69 (11)           57    70 (!!!)
2583     j-41 in histo
2584     18   28 (11)           16    29
2585   */
2586 
2587   //                                   RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR:
2588 
2589   TH2F *maprphinorm1HE1 = (TH2F *)dir->FindObjectAny("h_maprphinorm_HE1");
2590   TH2F *maprphinorm0HE1 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE1");
2591   TH2F *maprphinormHE1 = (TH2F *)maprphinorm1HE1->Clone("maprphinormHE1");
2592   maprphinormHE1->Divide(maprphinorm1HE1, maprphinorm0HE1, 1, 1, "B");
2593   TH2F *maprphinorm1HE2 = (TH2F *)dir->FindObjectAny("h_maprphinorm_HE2");
2594   TH2F *maprphinorm0HE2 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE2");
2595   TH2F *maprphinormHE2 = (TH2F *)maprphinorm1HE2->Clone("maprphinormHE2");
2596   maprphinormHE2->Divide(maprphinorm1HE2, maprphinorm0HE2, 1, 1, "B");
2597   TH2F *maprphinorm1HE3 = (TH2F *)dir->FindObjectAny("h_maprphinorm_HE3");
2598   TH2F *maprphinorm0HE3 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE3");
2599   TH2F *maprphinormHE3 = (TH2F *)maprphinorm1HE3->Clone("maprphinormHE3");
2600   maprphinormHE3->Divide(maprphinorm1HE3, maprphinorm0HE3, 1, 1, "B");
2601   TH2F *maprphinorm1HE4 = (TH2F *)dir->FindObjectAny("h_maprphinorm_HE4");
2602   TH2F *maprphinorm0HE4 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE4");
2603   TH2F *maprphinormHE4 = (TH2F *)maprphinorm1HE4->Clone("maprphinormHE4");
2604   maprphinormHE4->Divide(maprphinorm1HE4, maprphinorm0HE4, 1, 1, "B");
2605   TH2F *maprphinorm1HE5 = (TH2F *)dir->FindObjectAny("h_maprphinorm_HE5");
2606   TH2F *maprphinorm0HE5 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE5");
2607   TH2F *maprphinormHE5 = (TH2F *)maprphinorm1HE5->Clone("maprphinormHE5");
2608   maprphinormHE5->Divide(maprphinorm1HE5, maprphinorm0HE5, 1, 1, "B");
2609   TH2F *maprphinorm1HE6 = (TH2F *)dir->FindObjectAny("h_maprphinorm_HE6");
2610   TH2F *maprphinorm0HE6 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE6");
2611   TH2F *maprphinormHE6 = (TH2F *)maprphinorm1HE6->Clone("maprphinormHE6");
2612   maprphinormHE6->Divide(maprphinorm1HE6, maprphinorm0HE6, 1, 1, "B");
2613   TH2F *maprphinorm1HE7 = (TH2F *)dir->FindObjectAny("h_maprphinorm_HE7");
2614   TH2F *maprphinorm0HE7 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE7");
2615   TH2F *maprphinormHE7 = (TH2F *)maprphinorm1HE7->Clone("maprphinormHE7");
2616   maprphinormHE7->Divide(maprphinorm1HE7, maprphinorm0HE7, 1, 1, "B");
2617   //=========================== put R into massive alexhe
2618   for (int jeta = 0; jeta < njeta; jeta++) {
2619     for (int jphi = 0; jphi < njphi; jphi++) {
2620       alexhe[0][jeta][jphi] = maprphinormHE1->GetBinContent(jeta + 1, jphi + 1);
2621       alexhe[1][jeta][jphi] = maprphinormHE2->GetBinContent(jeta + 1, jphi + 1);
2622       alexhe[2][jeta][jphi] = maprphinormHE3->GetBinContent(jeta + 1, jphi + 1);
2623       alexhe[3][jeta][jphi] = maprphinormHE4->GetBinContent(jeta + 1, jphi + 1);
2624       alexhe[4][jeta][jphi] = maprphinormHE5->GetBinContent(jeta + 1, jphi + 1);
2625       alexhe[5][jeta][jphi] = maprphinormHE6->GetBinContent(jeta + 1, jphi + 1);
2626       alexhe[6][jeta][jphi] = maprphinormHE7->GetBinContent(jeta + 1, jphi + 1);
2627     }
2628   }
2629 
2630   //------------------------  2D-eta/phi-plot: R, averaged over depthes
2631   //======================================================================
2632   //======================================================================
2633   cout << "      R2D-eta/phi-plot: R, averaged over depthes *****" << endl;
2634   c1x0->Clear();
2635   /////////////////
2636   c1x0->Divide(1, 1);
2637   c1x0->cd(1);
2638   TH2F *Gefz42D = new TH2F("Gefz42D", "", neta, -41., 41., nphi, 0., 72.);
2639   TH2F *Gefz42D0 = new TH2F("Gefz42D0", "", neta, -41., 41., nphi, 0., 72.);
2640   TH2F *Gefz42DF = (TH2F *)Gefz42D0->Clone("Gefz42DF");
2641   for (int i = 0; i < ndepth; i++) {
2642     for (int jeta = 0; jeta < neta; jeta++) {
2643       for (int jphi = 0; jphi < nphi; jphi++) {
2644         double ccc1 = alexhe[i][jeta][jphi];
2645         int k2plot = jeta - 41;
2646         int kkk = k2plot;  //if(k2plot >0 ) kkk=k2plot+1; //-41 +41 !=0
2647         if (ccc1 != 0.) {
2648           Gefz42D->Fill(kkk, jphi, ccc1);
2649           Gefz42D0->Fill(kkk, jphi, 1.);
2650         }
2651       }
2652     }
2653   }
2654   Gefz42DF->Divide(Gefz42D, Gefz42D0, 1, 1, "B");  // average A
2655   gPad->SetGridy();
2656   gPad->SetGridx();  //      gPad->SetLogz();
2657   Gefz42DF->SetMarkerStyle(20);
2658   Gefz42DF->SetMarkerSize(0.4);
2659   Gefz42DF->GetZaxis()->SetLabelSize(0.08);
2660   Gefz42DF->SetXTitle("<R>_depth       #eta  \b");
2661   Gefz42DF->SetYTitle("      #phi \b");
2662   Gefz42DF->SetZTitle("<R>_depth \b");
2663   Gefz42DF->SetMarkerColor(2);
2664   Gefz42DF->SetLineColor(0);  //      Gefz42DF->SetMaximum(1.000);  //      Gefz42DF->SetMinimum(1.0);
2665   Gefz42DF->Draw("COLZ");
2666 
2667   /////////////////
2668   c1x0->Update();
2669   c1x0->Print("Rhist2IterationMethodHE.png");
2670   c1x0->Clear();
2671   // clean-up
2672   if (Gefz42D)
2673     delete Gefz42D;
2674   if (Gefz42D0)
2675     delete Gefz42D0;
2676   if (Gefz42DF)
2677     delete Gefz42DF;
2678 
2679   //====================================================================== 1D plot: R vs phi , averaged over depthes & eta
2680   //======================================================================
2681   cout << "      1D plot: R vs phi , averaged over depthes & eta *****" << endl;
2682   c1x1->Clear();
2683   /////////////////
2684   c1x1->Divide(1, 1);
2685   c1x1->cd(1);
2686   TH1F *Gefz41D = new TH1F("Gefz41D", "", nphi, 0., 72.);
2687   TH1F *Gefz41D0 = new TH1F("Gefz41D0", "", nphi, 0., 72.);
2688   TH1F *Gefz41DF = (TH1F *)Gefz41D0->Clone("Gefz41DF");
2689 
2690   for (int jeta = 0; jeta < neta; jeta++) {
2691     // positivedirection:
2692     if (jeta - 41 > 0) {
2693       for (int jphi = 0; jphi < nphi; jphi++) {
2694         for (int i = 0; i < ndepth; i++) {
2695           double ccc1 = alexhe[i][jeta][jphi];
2696           if (ccc1 != 0.) {
2697             Gefz41D->Fill(jphi, ccc1);
2698             Gefz41D0->Fill(jphi, 1.);
2699           }
2700         }
2701       }
2702     }
2703   }
2704   //     Gefz41D->Sumw2();Gefz41D0->Sumw2();
2705 
2706   Gefz41DF->Divide(Gefz41D, Gefz41D0, 1, 1, "B");  // R averaged over depthes & eta
2707   Gefz41D0->Sumw2();
2708   //    for (int jphi=1;jphi<73;jphi++) {Gefz41DF->SetBinError(jphi,0.01);}
2709   gPad->SetGridy();
2710   gPad->SetGridx();  //      gPad->SetLogz();
2711   Gefz41DF->SetMarkerStyle(20);
2712   Gefz41DF->SetMarkerSize(1.4);
2713   Gefz41DF->GetZaxis()->SetLabelSize(0.08);
2714   Gefz41DF->SetXTitle("#phi  \b");
2715   Gefz41DF->SetYTitle("  <R> \b");
2716   Gefz41DF->SetZTitle("<R>_PHI  - AllDepthes \b");
2717   Gefz41DF->SetMarkerColor(4);
2718   Gefz41DF->SetLineColor(4);
2719   Gefz41DF->SetMinimum(0.8);  //      Gefz41DF->SetMaximum(1.000);
2720   Gefz41DF->Draw("Error");
2721 
2722   /////////////////
2723   c1x1->Update();
2724   c1x1->Print("Rhist1IterationMethodHE.png");
2725   c1x1->Clear();
2726   // clean-up
2727   if (Gefz41D)
2728     delete Gefz41D;
2729   if (Gefz41D0)
2730     delete Gefz41D0;
2731   if (Gefz41DF)
2732     delete Gefz41DF;
2733 
2734   //========================================================================================== 4
2735   //======================================================================
2736   //======================================================================1D plot: R vs phi , different eta,  depth=1
2737   cout << "      1D plot: R vs phi , different eta,  depth=1 *****" << endl;
2738   c3x5->Clear();
2739   /////////////////
2740   c3x5->Divide(3, 5);
2741   c3x5->cd(1);
2742   int kcountHEpositivedirection1 = 1;
2743   TH1F *h2CeffHEpositivedirection1 = new TH1F("h2CeffHEpositivedirection1", "", nphi, 0., 72.);
2744 
2745   for (int jeta = 0; jeta < njeta; jeta++) {
2746     // positivedirection:
2747     if (jeta - 41 > 0) {
2748       //         for (int i=0;i<ndepth;i++) {
2749       // depth=1
2750       for (int i = 0; i < 1; i++) {
2751         TH1F *HEpositivedirection1 = (TH1F *)h2CeffHEpositivedirection1->Clone("twod1");
2752 
2753         float ccctest = 0;  // to avoid empty massive elements
2754         for (int jphi = 0; jphi < nphi; jphi++) {
2755           double ccc1 = alexhe[i][jeta][jphi];
2756           if (ccc1 != 0.) {
2757             HEpositivedirection1->Fill(jphi, ccc1);
2758             ccctest = 1.;  //HEpositivedirection1->SetBinError(i,0.01);
2759           }
2760         }  // for jphi
2761         if (ccctest > 0.) {
2762           cout << "444        kcountHEpositivedirection1   =     " << kcountHEpositivedirection1
2763                << "   jeta-41=     " << jeta - 41 << endl;
2764           c3x5->cd(kcountHEpositivedirection1);
2765           HEpositivedirection1->SetMarkerStyle(20);
2766           HEpositivedirection1->SetMarkerSize(0.4);
2767           HEpositivedirection1->GetYaxis()->SetLabelSize(0.04);
2768           HEpositivedirection1->SetXTitle("HEpositivedirection1 \b");
2769           HEpositivedirection1->SetMarkerColor(2);
2770           HEpositivedirection1->SetLineColor(0);
2771           gPad->SetGridy();
2772           gPad->SetGridx();
2773           //       gPad->SetLogy();
2774           if (kcountHEpositivedirection1 == 1)
2775             HEpositivedirection1->SetXTitle("R for HE+ jeta = 18; depth = 1 \b");
2776           if (kcountHEpositivedirection1 == 2)
2777             HEpositivedirection1->SetXTitle("R for HE+ jeta = 19; depth = 1 \b");
2778           if (kcountHEpositivedirection1 == 3)
2779             HEpositivedirection1->SetXTitle("R for HE+ jeta = 20; depth = 1 \b");
2780           if (kcountHEpositivedirection1 == 4)
2781             HEpositivedirection1->SetXTitle("R for HE+ jeta = 21; depth = 1 \b");
2782           if (kcountHEpositivedirection1 == 5)
2783             HEpositivedirection1->SetXTitle("R for HE+ jeta = 22; depth = 1 \b");
2784           if (kcountHEpositivedirection1 == 6)
2785             HEpositivedirection1->SetXTitle("R for HE+ jeta = 23; depth = 1 \b");
2786           if (kcountHEpositivedirection1 == 7)
2787             HEpositivedirection1->SetXTitle("R for HE+ jeta = 24; depth = 1 \b");
2788           if (kcountHEpositivedirection1 == 8)
2789             HEpositivedirection1->SetXTitle("R for HE+ jeta = 25; depth = 1 \b");
2790           if (kcountHEpositivedirection1 == 9)
2791             HEpositivedirection1->SetXTitle("R for HE+ jeta = 26; depth = 1 \b");
2792           if (kcountHEpositivedirection1 == 10)
2793             HEpositivedirection1->SetXTitle("R for HE+ jeta = 27; depth = 1 \b");
2794           if (kcountHEpositivedirection1 == 11)
2795             HEpositivedirection1->SetXTitle("R for HE+ jeta = 28; depth = 1 \b");
2796           if (kcountHEpositivedirection1 == 12)
2797             HEpositivedirection1->SetXTitle("R for HE+ jeta = 29; depth = 1 \b");
2798           HEpositivedirection1->Draw("Error");
2799           kcountHEpositivedirection1++;
2800           if (kcountHEpositivedirection1 > 15)
2801             break;  // 4x6 = 24
2802         }           //ccctest>0
2803 
2804       }  // for i
2805     }    //if(jeta-41 > 0)
2806   }      //for jeta
2807   /////////////////
2808   c3x5->Update();
2809   c3x5->Print("Rhist1IterationMethodDepth1HE.png");
2810   c3x5->Clear();
2811   // clean-up
2812   if (h2CeffHEpositivedirection1)
2813     delete h2CeffHEpositivedirection1;
2814 
2815   //========================================================================================== 5
2816   //======================================================================
2817   //======================================================================1D plot: R vs phi , different eta,  depth=2
2818   cout << "      1D plot: R vs phi , different eta,  depth=2 *****" << endl;
2819   c3x5->Clear();
2820   /////////////////
2821   c3x5->Divide(3, 5);
2822   c3x5->cd(1);
2823   int kcountHEpositivedirection2 = 1;
2824   TH1F *h2CeffHEpositivedirection2 = new TH1F("h2CeffHEpositivedirection2", "", nphi, 0., 72.);
2825 
2826   for (int jeta = 0; jeta < njeta; jeta++) {
2827     // positivedirection:
2828     if (jeta - 41 > 0) {
2829       //         for (int i=0;i<ndepth;i++) {
2830       // depth=2
2831       for (int i = 1; i < 2; i++) {
2832         TH1F *HEpositivedirection2 = (TH1F *)h2CeffHEpositivedirection2->Clone("twod1");
2833 
2834         float ccctest = 0;  // to avoid empty massive elements
2835         for (int jphi = 0; jphi < nphi; jphi++) {
2836           double ccc1 = alexhe[i][jeta][jphi];
2837           if (ccc1 != 0.) {
2838             HEpositivedirection2->Fill(jphi, ccc1);
2839             ccctest = 1.;  //HEpositivedirection2->SetBinError(i,0.01);
2840           }
2841         }  // for jphi
2842         if (ccctest > 0.) {
2843           cout << "555        kcountHEpositivedirection2   =     " << kcountHEpositivedirection2
2844                << "   jeta-41=     " << jeta - 41 << endl;
2845           c3x5->cd(kcountHEpositivedirection2);
2846           HEpositivedirection2->SetMarkerStyle(20);
2847           HEpositivedirection2->SetMarkerSize(0.4);
2848           HEpositivedirection2->GetYaxis()->SetLabelSize(0.04);
2849           HEpositivedirection2->SetXTitle("HEpositivedirection2 \b");
2850           HEpositivedirection2->SetMarkerColor(2);
2851           HEpositivedirection2->SetLineColor(0);
2852           gPad->SetGridy();
2853           gPad->SetGridx();
2854           //       gPad->SetLogy();
2855           if (kcountHEpositivedirection2 == 1)
2856             HEpositivedirection2->SetXTitle("R for HE+ jeta = 17; depth = 2 \b");
2857           if (kcountHEpositivedirection2 == 2)
2858             HEpositivedirection2->SetXTitle("R for HE+ jeta = 18; depth = 2 \b");
2859           if (kcountHEpositivedirection2 == 3)
2860             HEpositivedirection2->SetXTitle("R for HE+ jeta = 19; depth = 2 \b");
2861           if (kcountHEpositivedirection2 == 4)
2862             HEpositivedirection2->SetXTitle("R for HE+ jeta = 20; depth = 2 \b");
2863           if (kcountHEpositivedirection2 == 5)
2864             HEpositivedirection2->SetXTitle("R for HE+ jeta = 21; depth = 2 \b");
2865           if (kcountHEpositivedirection2 == 6)
2866             HEpositivedirection2->SetXTitle("R for HE+ jeta = 22; depth = 2 \b");
2867           if (kcountHEpositivedirection2 == 7)
2868             HEpositivedirection2->SetXTitle("R for HE+ jeta = 23; depth = 2 \b");
2869           if (kcountHEpositivedirection2 == 8)
2870             HEpositivedirection2->SetXTitle("R for HE+ jeta = 24; depth = 2 \b");
2871           if (kcountHEpositivedirection2 == 9)
2872             HEpositivedirection2->SetXTitle("R for HE+ jeta = 25; depth = 2 \b");
2873           if (kcountHEpositivedirection2 == 10)
2874             HEpositivedirection2->SetXTitle("R for HE+ jeta = 26; depth = 2 \b");
2875           if (kcountHEpositivedirection2 == 11)
2876             HEpositivedirection2->SetXTitle("R for HE+ jeta = 27; depth = 2 \b");
2877           if (kcountHEpositivedirection2 == 12)
2878             HEpositivedirection2->SetXTitle("R for HE+ jeta = 28; depth = 2 \b");
2879           if (kcountHEpositivedirection2 == 13)
2880             HEpositivedirection2->SetXTitle("R for HE+ jeta = 29; depth = 2 \b");
2881           HEpositivedirection2->Draw("Error");
2882           kcountHEpositivedirection2++;
2883           if (kcountHEpositivedirection2 > 15)
2884             break;  // 4x6 = 24
2885         }           //ccctest>0
2886 
2887       }  // for i
2888     }    //if(jeta-41 > 0)
2889   }      //for jeta
2890   /////////////////
2891   c3x5->Update();
2892   c3x5->Print("Rhist1IterationMethodDepth2HE.png");
2893   c3x5->Clear();
2894   // clean-up
2895   if (h2CeffHEpositivedirection2)
2896     delete h2CeffHEpositivedirection2;
2897   //========================================================================================== 6
2898   //======================================================================
2899   //======================================================================1D plot: R vs phi , different eta,  depth=3
2900   cout << "      1D plot: R vs phi , different eta,  depth=3 *****" << endl;
2901   c3x5->Clear();
2902   /////////////////
2903   c3x5->Divide(3, 5);
2904   c3x5->cd(1);
2905   int kcountHEpositivedirection3 = 1;
2906   TH1F *h2CeffHEpositivedirection3 = new TH1F("h2CeffHEpositivedirection3", "", nphi, 0., 72.);
2907 
2908   for (int jeta = 0; jeta < njeta; jeta++) {
2909     // positivedirection:
2910     if (jeta - 41 > 0) {
2911       //         for (int i=0;i<ndepth;i++) {
2912       // depth=3
2913       for (int i = 2; i < 3; i++) {
2914         TH1F *HEpositivedirection3 = (TH1F *)h2CeffHEpositivedirection3->Clone("twod1");
2915 
2916         float ccctest = 0;  // to avoid empty massive elements
2917         for (int jphi = 0; jphi < nphi; jphi++) {
2918           double ccc1 = alexhe[i][jeta][jphi];
2919           if (ccc1 != 0.) {
2920             HEpositivedirection3->Fill(jphi, ccc1);
2921             ccctest = 1.;  //HEpositivedirection3->SetBinError(i,0.01);
2922           }
2923         }  // for jphi
2924         if (ccctest > 0.) {
2925           cout << "666        kcountHEpositivedirection3   =     " << kcountHEpositivedirection3
2926                << "   jeta-41=     " << jeta - 41 << endl;
2927           c3x5->cd(kcountHEpositivedirection3);
2928           HEpositivedirection3->SetMarkerStyle(20);
2929           HEpositivedirection3->SetMarkerSize(0.4);
2930           HEpositivedirection3->GetYaxis()->SetLabelSize(0.04);
2931           HEpositivedirection3->SetXTitle("HEpositivedirection3 \b");
2932           HEpositivedirection3->SetMarkerColor(2);
2933           HEpositivedirection3->SetLineColor(0);
2934           gPad->SetGridy();
2935           gPad->SetGridx();
2936           //       gPad->SetLogy();
2937           if (kcountHEpositivedirection3 == 1)
2938             HEpositivedirection3->SetXTitle("R for HE+ jeta = 17; depth = 3 \b");
2939           if (kcountHEpositivedirection3 == 2)
2940             HEpositivedirection3->SetXTitle("R for HE+ jeta = 18; depth = 3 \b");
2941           if (kcountHEpositivedirection3 == 3)
2942             HEpositivedirection3->SetXTitle("R for HE+ jeta = 19; depth = 3 \b");
2943           if (kcountHEpositivedirection3 == 4)
2944             HEpositivedirection3->SetXTitle("R for HE+ jeta = 20; depth = 3 \b");
2945           if (kcountHEpositivedirection3 == 5)
2946             HEpositivedirection3->SetXTitle("R for HE+ jeta = 21; depth = 3 \b");
2947           if (kcountHEpositivedirection3 == 6)
2948             HEpositivedirection3->SetXTitle("R for HE+ jeta = 22; depth = 3 \b");
2949           if (kcountHEpositivedirection3 == 7)
2950             HEpositivedirection3->SetXTitle("R for HE+ jeta = 23; depth = 3 \b");
2951           if (kcountHEpositivedirection3 == 8)
2952             HEpositivedirection3->SetXTitle("R for HE+ jeta = 24; depth = 3 \b");
2953           if (kcountHEpositivedirection3 == 9)
2954             HEpositivedirection3->SetXTitle("R for HE+ jeta = 25; depth = 3 \b");
2955           if (kcountHEpositivedirection3 == 10)
2956             HEpositivedirection3->SetXTitle("R for HE+ jeta = 26; depth = 3 \b");
2957           if (kcountHEpositivedirection3 == 11)
2958             HEpositivedirection3->SetXTitle("R for HE+ jeta = 27; depth = 3 \b");
2959           if (kcountHEpositivedirection3 == 12)
2960             HEpositivedirection3->SetXTitle("R for HE+ jeta = 28; depth = 3 \b");
2961           if (kcountHEpositivedirection3 == 13)
2962             HEpositivedirection3->SetXTitle("R for HE+ jeta = 29; depth = 3 \b");
2963           HEpositivedirection3->Draw("Error");
2964           kcountHEpositivedirection3++;
2965           if (kcountHEpositivedirection3 > 15)
2966             break;  // 4x6 = 24
2967         }           //ccctest>0
2968 
2969       }  // for i
2970     }    //if(jeta-41 > 0)
2971   }      //for jeta
2972   /////////////////
2973   c3x5->Update();
2974   c3x5->Print("Rhist1IterationMethodDepth3HE.png");
2975   c3x5->Clear();
2976   // clean-up
2977   if (h2CeffHEpositivedirection3)
2978     delete h2CeffHEpositivedirection3;
2979   //========================================================================================== 7
2980   //======================================================================
2981   //======================================================================1D plot: R vs phi , different eta,  depth=4
2982   cout << "      1D plot: R vs phi , different eta,  depth=4 *****" << endl;
2983   c3x5->Clear();
2984   /////////////////
2985   c3x5->Divide(3, 5);
2986   c3x5->cd(1);
2987   int kcountHEpositivedirection4 = 1;
2988   TH1F *h2CeffHEpositivedirection4 = new TH1F("h2CeffHEpositivedirection4", "", nphi, 0., 72.);
2989 
2990   for (int jeta = 0; jeta < njeta; jeta++) {
2991     // positivedirection:
2992     if (jeta - 41 > 0) {
2993       //         for (int i=0;i<ndepth;i++) {
2994       // depth=4
2995       for (int i = 3; i < 4; i++) {
2996         TH1F *HEpositivedirection4 = (TH1F *)h2CeffHEpositivedirection4->Clone("twod1");
2997 
2998         float ccctest = 0;  // to avoid empty massive elements
2999         for (int jphi = 0; jphi < nphi; jphi++) {
3000           double ccc1 = alexhe[i][jeta][jphi];
3001           if (ccc1 != 0.) {
3002             HEpositivedirection4->Fill(jphi, ccc1);
3003             ccctest = 1.;  //HEpositivedirection4->SetBinError(i,0.01);
3004           }
3005         }  // for jphi
3006         if (ccctest > 0.) {
3007           cout << "777        kcountHEpositivedirection4   =     " << kcountHEpositivedirection4
3008                << "   jeta-41=     " << jeta - 41 << endl;
3009           c3x5->cd(kcountHEpositivedirection4);
3010           HEpositivedirection4->SetMarkerStyle(20);
3011           HEpositivedirection4->SetMarkerSize(0.4);
3012           HEpositivedirection4->GetYaxis()->SetLabelSize(0.04);
3013           HEpositivedirection4->SetXTitle("HEpositivedirection4 \b");
3014           HEpositivedirection4->SetMarkerColor(2);
3015           HEpositivedirection4->SetLineColor(0);
3016           gPad->SetGridy();
3017           gPad->SetGridx();
3018           //       gPad->SetLogy();
3019           if (kcountHEpositivedirection4 == 1)
3020             HEpositivedirection4->SetXTitle("R for HE+ jeta = 16; depth = 4 \b");
3021           if (kcountHEpositivedirection4 == 2)
3022             HEpositivedirection4->SetXTitle("R for HE+ jeta = 18; depth = 4 \b");
3023           if (kcountHEpositivedirection4 == 3)
3024             HEpositivedirection4->SetXTitle("R for HE+ jeta = 19; depth = 4 \b");
3025           if (kcountHEpositivedirection4 == 4)
3026             HEpositivedirection4->SetXTitle("R for HE+ jeta = 20; depth = 4 \b");
3027           if (kcountHEpositivedirection4 == 5)
3028             HEpositivedirection4->SetXTitle("R for HE+ jeta = 21; depth = 4 \b");
3029           if (kcountHEpositivedirection4 == 6)
3030             HEpositivedirection4->SetXTitle("R for HE+ jeta = 22; depth = 4 \b");
3031           if (kcountHEpositivedirection4 == 7)
3032             HEpositivedirection4->SetXTitle("R for HE+ jeta = 23; depth = 4 \b");
3033           if (kcountHEpositivedirection4 == 8)
3034             HEpositivedirection4->SetXTitle("R for HE+ jeta = 24; depth = 4 \b");
3035           if (kcountHEpositivedirection4 == 9)
3036             HEpositivedirection4->SetXTitle("R for HE+ jeta = 25; depth = 4 \b");
3037           if (kcountHEpositivedirection4 == 10)
3038             HEpositivedirection4->SetXTitle("R for HE+ jeta = 26; depth = 4 \b");
3039           if (kcountHEpositivedirection4 == 11)
3040             HEpositivedirection4->SetXTitle("R for HE+ jeta = 27; depth = 4 \b");
3041           if (kcountHEpositivedirection4 == 12)
3042             HEpositivedirection4->SetXTitle("R for HE+ jeta = 28; depth = 4 \b");
3043           HEpositivedirection4->Draw("Error");
3044           kcountHEpositivedirection4++;
3045           if (kcountHEpositivedirection4 > 15)
3046             break;  // 4x6 = 24
3047         }           //ccctest>0
3048 
3049       }  // for i
3050     }    //if(jeta-41 > 0)
3051   }      //for jeta
3052   /////////////////
3053   c3x5->Update();
3054   c3x5->Print("Rhist1IterationMethodDepth4HE.png");
3055   c3x5->Clear();
3056   // clean-up
3057   if (h2CeffHEpositivedirection4)
3058     delete h2CeffHEpositivedirection4;
3059   //========================================================================================== 8
3060   //======================================================================
3061   //======================================================================1D plot: R vs phi , different eta,  depth=5
3062   cout << "      1D plot: R vs phi , different eta,  depth=5 *****" << endl;
3063   c3x5->Clear();
3064   /////////////////
3065   c3x5->Divide(3, 5);
3066   c3x5->cd(1);
3067   int kcountHEpositivedirection5 = 1;
3068   TH1F *h2CeffHEpositivedirection5 = new TH1F("h2CeffHEpositivedirection5", "", nphi, 0., 72.);
3069 
3070   for (int jeta = 0; jeta < njeta; jeta++) {
3071     // positivedirection:
3072     if (jeta - 41 > 0) {
3073       //         for (int i=0;i<ndepth;i++) {
3074       // depth=5
3075       for (int i = 4; i < 5; i++) {
3076         TH1F *HEpositivedirection5 = (TH1F *)h2CeffHEpositivedirection5->Clone("twod1");
3077 
3078         float ccctest = 0;  // to avoid empty massive elements
3079         for (int jphi = 0; jphi < nphi; jphi++) {
3080           //           cout<<"888  initial      kcountHEpositivedirection5   =     "<<kcountHEpositivedirection5  <<"   jeta-41=     "<< jeta-41 <<"   jphi=     "<< jphi <<"   alexhe[i][jeta][jphi]=     "<< alexhe[i][jeta][jphi] <<"  depth=     "<< i <<endl;
3081 
3082           double ccc1 = alexhe[i][jeta][jphi];
3083           if (ccc1 != 0.) {
3084             HEpositivedirection5->Fill(jphi, ccc1);
3085             ccctest = 1.;  //HEpositivedirection5->SetBinError(i,0.01);
3086           }
3087         }  // for jphi
3088         if (ccctest > 0.) {
3089           cout << "888        kcountHEpositivedirection5   =     " << kcountHEpositivedirection5
3090                << "   jeta-41=     " << jeta - 41 << endl;
3091           c3x5->cd(kcountHEpositivedirection5);
3092           HEpositivedirection5->SetMarkerStyle(20);
3093           HEpositivedirection5->SetMarkerSize(0.4);
3094           HEpositivedirection5->GetYaxis()->SetLabelSize(0.04);
3095           HEpositivedirection5->SetXTitle("HEpositivedirection5 \b");
3096           HEpositivedirection5->SetMarkerColor(2);
3097           HEpositivedirection5->SetLineColor(0);
3098           gPad->SetGridy();
3099           gPad->SetGridx();
3100           //       gPad->SetLogy();
3101           if (kcountHEpositivedirection5 == 1)
3102             HEpositivedirection5->SetXTitle("R for HE+ jeta = 18; depth = 5 \b");
3103           if (kcountHEpositivedirection5 == 2)
3104             HEpositivedirection5->SetXTitle("R for HE+ jeta = 19; depth = 5 \b");
3105           if (kcountHEpositivedirection5 == 3)
3106             HEpositivedirection5->SetXTitle("R for HE+ jeta = 20; depth = 5 \b");
3107           if (kcountHEpositivedirection5 == 4)
3108             HEpositivedirection5->SetXTitle("R for HE+ jeta = 21; depth = 5 \b");
3109           if (kcountHEpositivedirection5 == 5)
3110             HEpositivedirection5->SetXTitle("R for HE+ jeta = 22; depth = 5 \b");
3111           if (kcountHEpositivedirection5 == 6)
3112             HEpositivedirection5->SetXTitle("R for HE+ jeta = 23; depth = 5 \b");
3113           if (kcountHEpositivedirection5 == 7)
3114             HEpositivedirection5->SetXTitle("R for HE+ jeta = 24; depth = 5 \b");
3115           if (kcountHEpositivedirection5 == 8)
3116             HEpositivedirection5->SetXTitle("R for HE+ jeta = 25; depth = 5 \b");
3117           if (kcountHEpositivedirection5 == 9)
3118             HEpositivedirection5->SetXTitle("R for HE+ jeta = 26; depth = 5 \b");
3119           if (kcountHEpositivedirection5 == 10)
3120             HEpositivedirection5->SetXTitle("R for HE+ jeta = 27; depth = 5 \b");
3121           if (kcountHEpositivedirection5 == 11)
3122             HEpositivedirection5->SetXTitle("R for HE+ jeta = 28; depth = 5 \b");
3123           HEpositivedirection5->Draw("Error");
3124           kcountHEpositivedirection5++;
3125           if (kcountHEpositivedirection5 > 15)
3126             break;  // 4x6 = 24
3127         }           //ccctest>0
3128 
3129       }  // for i
3130     }    //if(jeta-41 > 0)
3131   }      //for jeta
3132   /////////////////
3133   c3x5->Update();
3134   c3x5->Print("Rhist1IterationMethodDepth5HE.png");
3135   c3x5->Clear();
3136   // clean-up
3137   if (h2CeffHEpositivedirection5)
3138     delete h2CeffHEpositivedirection5;
3139   //========================================================================================== 9
3140   //======================================================================
3141   //======================================================================1D plot: R vs phi , different eta,  depth=6
3142   cout << "      1D plot: R vs phi , different eta,  depth=6 *****" << endl;
3143   c3x5->Clear();
3144   /////////////////
3145   c3x5->Divide(3, 5);
3146   c3x5->cd(1);
3147   int kcountHEpositivedirection6 = 1;
3148   TH1F *h2CeffHEpositivedirection6 = new TH1F("h2CeffHEpositivedirection6", "", nphi, 0., 72.);
3149 
3150   for (int jeta = 0; jeta < njeta; jeta++) {
3151     // positivedirection:
3152     if (jeta - 41 > 0) {
3153       //         for (int i=0;i<ndepth;i++) {
3154       // depth=6
3155       for (int i = 5; i < 6; i++) {
3156         TH1F *HEpositivedirection6 = (TH1F *)h2CeffHEpositivedirection6->Clone("twod1");
3157 
3158         float ccctest = 0;  // to avoid empty massive elements
3159         for (int jphi = 0; jphi < nphi; jphi++) {
3160           double ccc1 = alexhe[i][jeta][jphi];
3161           if (ccc1 != 0.) {
3162             HEpositivedirection6->Fill(jphi, ccc1);
3163             ccctest = 1.;  //HEpositivedirection6->SetBinError(i,0.01);
3164           }
3165         }  // for jphi
3166         if (ccctest > 0.) {
3167           cout << "999        kcountHEpositivedirection6   =     " << kcountHEpositivedirection6
3168                << "   jeta-41=     " << jeta - 41 << endl;
3169           c3x5->cd(kcountHEpositivedirection6);
3170           HEpositivedirection6->SetMarkerStyle(20);
3171           HEpositivedirection6->SetMarkerSize(0.4);
3172           HEpositivedirection6->GetYaxis()->SetLabelSize(0.04);
3173           HEpositivedirection6->SetXTitle("HEpositivedirection6 \b");
3174           HEpositivedirection6->SetMarkerColor(2);
3175           HEpositivedirection6->SetLineColor(0);
3176           gPad->SetGridy();
3177           gPad->SetGridx();
3178           //       gPad->SetLogy();
3179           if (kcountHEpositivedirection6 == 1)
3180             HEpositivedirection6->SetXTitle("R for HE+ jeta = 19; depth = 6 \b");
3181           if (kcountHEpositivedirection6 == 2)
3182             HEpositivedirection6->SetXTitle("R for HE+ jeta = 20; depth = 6 \b");
3183           if (kcountHEpositivedirection6 == 3)
3184             HEpositivedirection6->SetXTitle("R for HE+ jeta = 21; depth = 6 \b");
3185           if (kcountHEpositivedirection6 == 4)
3186             HEpositivedirection6->SetXTitle("R for HE+ jeta = 22; depth = 6 \b");
3187           if (kcountHEpositivedirection6 == 5)
3188             HEpositivedirection6->SetXTitle("R for HE+ jeta = 23; depth = 6 \b");
3189           if (kcountHEpositivedirection6 == 6)
3190             HEpositivedirection6->SetXTitle("R for HE+ jeta = 24; depth = 6 \b");
3191           if (kcountHEpositivedirection6 == 7)
3192             HEpositivedirection6->SetXTitle("R for HE+ jeta = 25; depth = 6 \b");
3193           if (kcountHEpositivedirection6 == 8)
3194             HEpositivedirection6->SetXTitle("R for HE+ jeta = 26; depth = 6 \b");
3195           if (kcountHEpositivedirection6 == 9)
3196             HEpositivedirection6->SetXTitle("R for HE+ jeta = 27; depth = 6 \b");
3197           if (kcountHEpositivedirection6 == 10)
3198             HEpositivedirection6->SetXTitle("R for HE+ jeta = 28; depth = 6 \b");
3199           HEpositivedirection6->Draw("Error");
3200           kcountHEpositivedirection6++;
3201           if (kcountHEpositivedirection6 > 15)
3202             break;  // 4x6 = 24
3203         }           //ccctest>0
3204 
3205       }  // for i
3206     }    //if(jeta-41 > 0)
3207   }      //for jeta
3208   /////////////////
3209   c3x5->Update();
3210   c3x5->Print("Rhist1IterationMethodDepth6HE.png");
3211   c3x5->Clear();
3212   // clean-up
3213   if (h2CeffHEpositivedirection6)
3214     delete h2CeffHEpositivedirection6;
3215   //========================================================================================== 10
3216   //======================================================================
3217   //======================================================================1D plot: R vs phi , different eta,  depth=7
3218   cout << "      1D plot: R vs phi , different eta,  depth=7 *****" << endl;
3219   c3x5->Clear();
3220   /////////////////
3221   c3x5->Divide(3, 5);
3222   c3x5->cd(1);
3223   int kcountHEpositivedirection7 = 1;
3224   TH1F *h2CeffHEpositivedirection7 = new TH1F("h2CeffHEpositivedirection7", "", nphi, 0., 72.);
3225 
3226   for (int jeta = 0; jeta < njeta; jeta++) {
3227     // positivedirection:
3228     if (jeta - 41 > 0) {
3229       //         for (int i=0;i<ndepth;i++) {
3230       // depth=7
3231       for (int i = 6; i < 7; i++) {
3232         TH1F *HEpositivedirection7 = (TH1F *)h2CeffHEpositivedirection7->Clone("twod1");
3233 
3234         float ccctest = 0;  // to avoid empty massive elements
3235         for (int jphi = 0; jphi < nphi; jphi++) {
3236           double ccc1 = alexhe[i][jeta][jphi];
3237           if (ccc1 != 0.) {
3238             HEpositivedirection7->Fill(jphi, ccc1);
3239             ccctest = 1.;  //HEpositivedirection7->SetBinError(i,0.01);
3240           }
3241         }  // for jphi
3242         if (ccctest > 0.) {
3243           cout << "1010       kcountHEpositivedirection7   =     " << kcountHEpositivedirection7
3244                << "   jeta-41=     " << jeta - 41 << endl;
3245           c3x5->cd(kcountHEpositivedirection7);
3246           HEpositivedirection7->SetMarkerStyle(20);
3247           HEpositivedirection7->SetMarkerSize(0.4);
3248           HEpositivedirection7->GetYaxis()->SetLabelSize(0.04);
3249           HEpositivedirection7->SetXTitle("HEpositivedirection7 \b");
3250           HEpositivedirection7->SetMarkerColor(2);
3251           HEpositivedirection7->SetLineColor(0);
3252           gPad->SetGridy();
3253           gPad->SetGridx();
3254           //       gPad->SetLogy();
3255           if (kcountHEpositivedirection7 == 1)
3256             HEpositivedirection7->SetXTitle("R for HE+ jeta = 26; depth = 7 \b");
3257           if (kcountHEpositivedirection7 == 2)
3258             HEpositivedirection7->SetXTitle("R for HE+ jeta = 27; depth = 7 \b");
3259           if (kcountHEpositivedirection7 == 3)
3260             HEpositivedirection7->SetXTitle("R for HE+ jeta = 28; depth = 7 \b");
3261           HEpositivedirection7->Draw("Error");
3262           kcountHEpositivedirection7++;
3263           if (kcountHEpositivedirection7 > 15)
3264             break;  // 4x6 = 24
3265         }           //ccctest>0
3266 
3267       }  // for i
3268     }    //if(jeta-41 > 0)
3269   }      //for jeta
3270   /////////////////
3271   c3x5->Update();
3272   c3x5->Print("Rhist1IterationMethodDepth7HE.png");
3273   c3x5->Clear();
3274   // clean-up
3275   if (h2CeffHEpositivedirection7)
3276     delete h2CeffHEpositivedirection7;
3277 
3278   //                                   DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD:
3279 
3280   cout << "    Start Vaiance: preparation  *****" << endl;
3281   TH2F *mapdphinorm1HE1 = (TH2F *)dir->FindObjectAny("h_maprphinorm2_HE1");
3282   TH2F *mapdphinorm0HE1 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE1");
3283   TH2F *mapdphinormHE1 = (TH2F *)mapdphinorm1HE1->Clone("mapdphinormHE1");
3284   mapdphinormHE1->Divide(mapdphinorm1HE1, mapdphinorm0HE1, 1, 1, "B");
3285   TH2F *mapdphinorm1HE2 = (TH2F *)dir->FindObjectAny("h_maprphinorm2_HE2");
3286   TH2F *mapdphinorm0HE2 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE2");
3287   TH2F *mapdphinormHE2 = (TH2F *)mapdphinorm1HE2->Clone("mapdphinormHE2");
3288   mapdphinormHE2->Divide(mapdphinorm1HE2, mapdphinorm0HE2, 1, 1, "B");
3289   TH2F *mapdphinorm1HE3 = (TH2F *)dir->FindObjectAny("h_maprphinorm2_HE3");
3290   TH2F *mapdphinorm0HE3 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE3");
3291   TH2F *mapdphinormHE3 = (TH2F *)mapdphinorm1HE3->Clone("mapdphinormHE3");
3292   mapdphinormHE3->Divide(mapdphinorm1HE3, mapdphinorm0HE3, 1, 1, "B");
3293   TH2F *mapdphinorm1HE4 = (TH2F *)dir->FindObjectAny("h_maprphinorm2_HE4");
3294   TH2F *mapdphinorm0HE4 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE4");
3295   TH2F *mapdphinormHE4 = (TH2F *)mapdphinorm1HE4->Clone("mapdphinormHE4");
3296   mapdphinormHE4->Divide(mapdphinorm1HE4, mapdphinorm0HE4, 1, 1, "B");
3297   TH2F *mapdphinorm1HE5 = (TH2F *)dir->FindObjectAny("h_maprphinorm2_HE5");
3298   TH2F *mapdphinorm0HE5 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE5");
3299   TH2F *mapdphinormHE5 = (TH2F *)mapdphinorm1HE5->Clone("mapdphinormHE5");
3300   mapdphinormHE5->Divide(mapdphinorm1HE5, mapdphinorm0HE5, 1, 1, "B");
3301   TH2F *mapdphinorm1HE6 = (TH2F *)dir->FindObjectAny("h_maprphinorm2_HE6");
3302   TH2F *mapdphinorm0HE6 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE6");
3303   TH2F *mapdphinormHE6 = (TH2F *)mapdphinorm1HE6->Clone("mapdphinormHE6");
3304   mapdphinormHE6->Divide(mapdphinorm1HE6, mapdphinorm0HE6, 1, 1, "B");
3305   TH2F *mapdphinorm1HE7 = (TH2F *)dir->FindObjectAny("h_maprphinorm2_HE7");
3306   TH2F *mapdphinorm0HE7 = (TH2F *)dir->FindObjectAny("h_maprphinorm0_HE7");
3307   TH2F *mapdphinormHE7 = (TH2F *)mapdphinorm1HE7->Clone("mapdphinormHE7");
3308   mapdphinormHE7->Divide(mapdphinorm1HE7, mapdphinorm0HE7, 1, 1, "B");
3309   cout << "      Vaiance: preparation DONE *****" << endl;
3310   //====================================================================== put Vaiance=Dispersia = Sig**2=<R**2> - (<R>)**2
3311   //                                                                                           = sum(R*R)/N - (sum(R)/N)**2
3312   //                                                                                           =  mapdphinormHE1,2,3..7   -  alexhe*alexhe
3313   for (int jeta = 0; jeta < njeta; jeta++) {
3314     for (int jphi = 0; jphi < njphi; jphi++) {
3315       variance[0][jeta][jphi] =
3316           fabs(mapdphinormHE1->GetBinContent(jeta + 1, jphi + 1) - alexhe[0][jeta][jphi] * alexhe[0][jeta][jphi]);
3317       if (variance[0][jeta][jphi] < 0.00003)
3318         variance[0][jeta][jphi] = 0.000067;
3319       variance[1][jeta][jphi] =
3320           fabs(mapdphinormHE2->GetBinContent(jeta + 1, jphi + 1) - alexhe[1][jeta][jphi] * alexhe[1][jeta][jphi]);
3321       if (variance[1][jeta][jphi] < 0.00003)
3322         variance[1][jeta][jphi] = 0.000067;
3323       variance[2][jeta][jphi] =
3324           fabs(mapdphinormHE3->GetBinContent(jeta + 1, jphi + 1) - alexhe[2][jeta][jphi] * alexhe[2][jeta][jphi]);
3325       if (variance[2][jeta][jphi] < 0.00003)
3326         variance[2][jeta][jphi] = 0.000067;
3327       variance[3][jeta][jphi] =
3328           fabs(mapdphinormHE4->GetBinContent(jeta + 1, jphi + 1) - alexhe[3][jeta][jphi] * alexhe[3][jeta][jphi]);
3329       if (variance[3][jeta][jphi] < 0.00003)
3330         variance[3][jeta][jphi] = 0.000067;
3331       variance[4][jeta][jphi] =
3332           fabs(mapdphinormHE5->GetBinContent(jeta + 1, jphi + 1) - alexhe[4][jeta][jphi] * alexhe[4][jeta][jphi]);
3333       if (variance[4][jeta][jphi] < 0.00003)
3334         variance[4][jeta][jphi] = 0.000067;
3335       variance[5][jeta][jphi] =
3336           fabs(mapdphinormHE6->GetBinContent(jeta + 1, jphi + 1) - alexhe[5][jeta][jphi] * alexhe[5][jeta][jphi]);
3337       if (variance[5][jeta][jphi] < 0.00003)
3338         variance[5][jeta][jphi] = 0.000067;
3339       variance[6][jeta][jphi] =
3340           fabs(mapdphinormHE7->GetBinContent(jeta + 1, jphi + 1) - alexhe[6][jeta][jphi] * alexhe[6][jeta][jphi]);
3341       if (variance[6][jeta][jphi] < 0.00003)
3342         variance[6][jeta][jphi] = 0.000067;
3343     }
3344   }
3345   cout << "      Vaiance: DONE*****" << endl;
3346 
3347   //------------------------  2D-eta/phi-plot: D, averaged over depthes
3348   //======================================================================
3349   //======================================================================
3350   cout << "      R2D-eta/phi-plot: D, averaged over depthes *****" << endl;
3351   c1x1->Clear();
3352   /////////////////
3353   c1x0->Divide(1, 1);
3354   c1x0->cd(1);
3355   TH2F *Defz42D = new TH2F("Defz42D", "", neta, -41., 41., nphi, 0., 72.);
3356   TH2F *Defz42D0 = new TH2F("Defz42D0", "", neta, -41., 41., nphi, 0., 72.);
3357   TH2F *Defz42DF = (TH2F *)Defz42D0->Clone("Defz42DF");
3358   for (int i = 0; i < ndepth; i++) {
3359     for (int jeta = 0; jeta < neta; jeta++) {
3360       for (int jphi = 0; jphi < nphi; jphi++) {
3361         double ccc1 = variance[i][jeta][jphi];
3362         int k2plot = jeta - 41;
3363         int kkk = k2plot;  //if(k2plot >0   kkk=k2plot+1; //-41 +41 !=0
3364         if (alexhe[i][jeta][jphi] > 0.) {
3365           Defz42D->Fill(kkk, jphi, ccc1);
3366           Defz42D0->Fill(kkk, jphi, 1.);
3367         }
3368       }
3369     }
3370   }
3371   Defz42DF->Divide(Defz42D, Defz42D0, 1, 1, "B");  // average A
3372   //    Defz1->Sumw2();
3373   gPad->SetGridy();
3374   gPad->SetGridx();  //      gPad->SetLogz();
3375   Defz42DF->SetMarkerStyle(20);
3376   Defz42DF->SetMarkerSize(0.4);
3377   Defz42DF->GetZaxis()->SetLabelSize(0.08);
3378   Defz42DF->SetXTitle("<D>_depth       #eta  \b");
3379   Defz42DF->SetYTitle("      #phi \b");
3380   Defz42DF->SetZTitle("<D>_depth \b");
3381   Defz42DF->SetMarkerColor(2);
3382   Defz42DF->SetLineColor(0);  //      Defz42DF->SetMaximum(1.000);  //      Defz42DF->SetMinimum(1.0);
3383   Defz42DF->Draw("COLZ");
3384   /////////////////
3385   c1x0->Update();
3386   c1x0->Print("Dhist2IterationMethodHE.png");
3387   c1x0->Clear();
3388   // clean-up
3389   if (Defz42D)
3390     delete Defz42D;
3391   if (Defz42D0)
3392     delete Defz42D0;
3393   if (Defz42DF)
3394     delete Defz42DF;
3395 
3396   //====================================================================== 1D plot: D vs phi , averaged over depthes & eta
3397   //======================================================================
3398   cout << "      1D plot: D vs phi , averaged over depthes & eta *****" << endl;
3399   c1x1->Clear();
3400   /////////////////
3401   c1x1->Divide(1, 1);
3402   c1x1->cd(1);
3403   TH1F *Defz41D = new TH1F("Defz41D", "", nphi, 0., 72.);
3404   TH1F *Defz41D0 = new TH1F("Defz41D0", "", nphi, 0., 72.);
3405   TH1F *Defz41DF = (TH1F *)Defz41D0->Clone("Defz41DF");
3406 
3407   for (int jeta = 0; jeta < neta; jeta++) {
3408     // positivedirectionD:
3409     for (int jphi = 0; jphi < nphi; jphi++) {
3410       if (jeta - 41 > 0) {
3411         for (int i = 0; i < ndepth; i++) {
3412           double ccc1 = variance[i][jeta][jphi];
3413           if (alexhe[i][jeta][jphi] > 0.) {
3414             Defz41D->Fill(jphi, ccc1);
3415             Defz41D0->Fill(jphi, 1.);
3416           }
3417         }
3418       }
3419     }
3420   }
3421   //     Defz41D->Sumw2();Defz41D0->Sumw2();
3422 
3423   Defz41DF->Divide(Defz41D, Defz41D0, 1, 1, "B");  // R averaged over depthes & eta
3424   Defz41D0->Sumw2();
3425   //    for (int jphi=1;jphi<73;jphi++) {Defz41DF->SetBinError(jphi,0.01);}
3426   gPad->SetGridy();
3427   gPad->SetGridx();  //      gPad->SetLogz();
3428   Defz41DF->SetMarkerStyle(20);
3429   Defz41DF->SetMarkerSize(1.4);
3430   Defz41DF->GetZaxis()->SetLabelSize(0.08);
3431   Defz41DF->SetXTitle("#phi  \b");
3432   Defz41DF->SetYTitle("  <D> \b");
3433   Defz41DF->SetZTitle("<D>_PHI  - AllDepthes \b");
3434   Defz41DF->SetMarkerColor(4);
3435   Defz41DF->SetLineColor(4);
3436   Defz41DF->SetMinimum(0.8);
3437   Defz41DF->SetMinimum(-0.015);
3438   Defz41DF->Draw("Error");
3439   /////////////////
3440   c1x1->Update();
3441   c1x1->Print("Dhist1IterationMethodHE.png");
3442   c1x1->Clear();
3443   // clean-up
3444   if (Defz41D)
3445     delete Defz41D;
3446   if (Defz41D0)
3447     delete Defz41D0;
3448   if (Defz41DF)
3449     delete Defz41DF;
3450 
3451   //========================================================================================== 14
3452   //======================================================================
3453   //======================================================================1D plot: D vs phi , different eta,  depth=1
3454   cout << "      1D plot: D vs phi , different eta,  depth=1 *****" << endl;
3455   c3x5->Clear();
3456   /////////////////
3457   c3x5->Divide(3, 5);
3458   c3x5->cd(1);
3459 
3460   int kcountHEpositivedirectionD1 = 1;
3461   TH1F *h2CeffHEpositivedirectionD1 = new TH1F("h2CeffHEpositivedirectionD1", "", nphi, 0., 72.);
3462 
3463   for (int jeta = 0; jeta < njeta; jeta++) {
3464     // positivedirectionD:
3465     if (jeta - 41 > 0) {
3466       //         for (int i=0;i<ndepth;i++) {
3467       // depth=1
3468       for (int i = 0; i < 1; i++) {
3469         TH1F *HEpositivedirectionD1 = (TH1F *)h2CeffHEpositivedirectionD1->Clone("twod1");
3470 
3471         float ccctest = 0;  // to avoid empty massive elements
3472         for (int jphi = 0; jphi < nphi; jphi++) {
3473           double ccc1 = variance[i][jeta][jphi];
3474           if (alexhe[i][jeta][jphi] > 0.) {
3475             HEpositivedirectionD1->Fill(jphi, ccc1);
3476             ccctest = 1.;  //HEpositivedirectionD1->SetBinError(i,0.01);
3477           }
3478         }  // for jphi
3479         if (ccctest > 0.) {
3480           cout << "1414       kcountHEpositivedirectionD1   =     " << kcountHEpositivedirectionD1
3481                << "   jeta-41=     " << jeta - 41 << endl;
3482           c3x5->cd(kcountHEpositivedirectionD1);
3483           HEpositivedirectionD1->SetMarkerStyle(20);
3484           HEpositivedirectionD1->SetMarkerSize(0.4);
3485           HEpositivedirectionD1->GetYaxis()->SetLabelSize(0.04);
3486           HEpositivedirectionD1->SetXTitle("HEpositivedirectionD1 \b");
3487           HEpositivedirectionD1->SetMarkerColor(2);
3488           HEpositivedirectionD1->SetLineColor(0);
3489           gPad->SetGridy();
3490           gPad->SetGridx();
3491           //       gPad->SetLogy();
3492           if (kcountHEpositivedirectionD1 == 1)
3493             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 18; depth = 1 \b");
3494           if (kcountHEpositivedirectionD1 == 2)
3495             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 19; depth = 1 \b");
3496           if (kcountHEpositivedirectionD1 == 3)
3497             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 20; depth = 1 \b");
3498           if (kcountHEpositivedirectionD1 == 4)
3499             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 21; depth = 1 \b");
3500           if (kcountHEpositivedirectionD1 == 5)
3501             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 22; depth = 1 \b");
3502           if (kcountHEpositivedirectionD1 == 6)
3503             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 23; depth = 1 \b");
3504           if (kcountHEpositivedirectionD1 == 7)
3505             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 24; depth = 1 \b");
3506           if (kcountHEpositivedirectionD1 == 8)
3507             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 25; depth = 1 \b");
3508           if (kcountHEpositivedirectionD1 == 9)
3509             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 26; depth = 1 \b");
3510           if (kcountHEpositivedirectionD1 == 10)
3511             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 27; depth = 1 \b");
3512           if (kcountHEpositivedirectionD1 == 11)
3513             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 28; depth = 1 \b");
3514           if (kcountHEpositivedirectionD1 == 12)
3515             HEpositivedirectionD1->SetXTitle("D for HE+ jeta = 29; depth = 1 \b");
3516           HEpositivedirectionD1->Draw("Error");
3517           kcountHEpositivedirectionD1++;
3518           if (kcountHEpositivedirectionD1 > 15)
3519             break;  // 4x6 = 24
3520         }           //ccctest>0
3521 
3522       }  // for i
3523     }    //if(jeta-41 > 0)
3524   }      //for jeta
3525   /////////////////
3526   c3x5->Update();
3527   c3x5->Print("Dhist1IterationMethodDepth1HE.png");
3528   c3x5->Clear();
3529   // clean-up
3530   if (h2CeffHEpositivedirectionD1)
3531     delete h2CeffHEpositivedirectionD1;
3532 
3533   //========================================================================================== 15
3534   //======================================================================
3535   //======================================================================1D plot: D vs phi , different eta,  depth=2
3536   cout << "      1D plot: D vs phi , different eta,  depth=2 *****" << endl;
3537   c3x5->Clear();
3538   c3x5->Divide(3, 5);
3539   c3x5->cd(1);
3540   int kcountHEpositivedirectionD2 = 1;
3541   TH1F *h2CeffHEpositivedirectionD2 = new TH1F("h2CeffHEpositivedirectionD2", "", nphi, 0., 72.);
3542 
3543   for (int jeta = 0; jeta < njeta; jeta++) {
3544     // positivedirectionD:
3545     if (jeta - 41 > 0) {
3546       //         for (int i=0;i<ndepth;i++) {
3547       // depth=2
3548       for (int i = 1; i < 2; i++) {
3549         TH1F *HEpositivedirectionD2 = (TH1F *)h2CeffHEpositivedirectionD2->Clone("twod1");
3550 
3551         float ccctest = 0;  // to avoid empty massive elements
3552         for (int jphi = 0; jphi < nphi; jphi++) {
3553           double ccc1 = variance[i][jeta][jphi];
3554           if (alexhe[i][jeta][jphi] > 0.) {
3555             HEpositivedirectionD2->Fill(jphi, ccc1);
3556             ccctest = 1.;  //HEpositivedirectionD2->SetBinError(i,0.01);
3557           }
3558         }  // for jphi
3559         if (ccctest > 0.) {
3560           cout << "1515       kcountHEpositivedirectionD2   =     " << kcountHEpositivedirectionD2
3561                << "   jeta-41=     " << jeta - 41 << endl;
3562           c3x5->cd(kcountHEpositivedirectionD2);
3563           HEpositivedirectionD2->SetMarkerStyle(20);
3564           HEpositivedirectionD2->SetMarkerSize(0.4);
3565           HEpositivedirectionD2->GetYaxis()->SetLabelSize(0.04);
3566           HEpositivedirectionD2->SetXTitle("HEpositivedirectionD2 \b");
3567           HEpositivedirectionD2->SetMarkerColor(2);
3568           HEpositivedirectionD2->SetLineColor(0);
3569           gPad->SetGridy();
3570           gPad->SetGridx();
3571           //       gPad->SetLogy();
3572           if (kcountHEpositivedirectionD2 == 1)
3573             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 17; depth = 2 \b");
3574           if (kcountHEpositivedirectionD2 == 2)
3575             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 18; depth = 2 \b");
3576           if (kcountHEpositivedirectionD2 == 3)
3577             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 19; depth = 2 \b");
3578           if (kcountHEpositivedirectionD2 == 4)
3579             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 20; depth = 2 \b");
3580           if (kcountHEpositivedirectionD2 == 5)
3581             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 21; depth = 2 \b");
3582           if (kcountHEpositivedirectionD2 == 6)
3583             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 22; depth = 2 \b");
3584           if (kcountHEpositivedirectionD2 == 7)
3585             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 23; depth = 2 \b");
3586           if (kcountHEpositivedirectionD2 == 8)
3587             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 24; depth = 2 \b");
3588           if (kcountHEpositivedirectionD2 == 9)
3589             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 25; depth = 2 \b");
3590           if (kcountHEpositivedirectionD2 == 10)
3591             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 26; depth = 2 \b");
3592           if (kcountHEpositivedirectionD2 == 11)
3593             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 27; depth = 2 \b");
3594           if (kcountHEpositivedirectionD2 == 12)
3595             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 28; depth = 2 \b");
3596           if (kcountHEpositivedirectionD2 == 13)
3597             HEpositivedirectionD2->SetXTitle("D for HE+ jeta = 29; depth = 2 \b");
3598           HEpositivedirectionD2->Draw("Error");
3599           kcountHEpositivedirectionD2++;
3600           if (kcountHEpositivedirectionD2 > 15)
3601             break;  // 4x6 = 24
3602         }           //ccctest>0
3603 
3604       }  // for i
3605     }    //if(jeta-41 > 0)
3606   }      //for jeta
3607   /////////////////
3608   c3x5->Update();
3609   c3x5->Print("Dhist1IterationMethodDepth2HE.png");
3610   c3x5->Clear();
3611   // clean-up
3612   if (h2CeffHEpositivedirectionD2)
3613     delete h2CeffHEpositivedirectionD2;
3614 
3615   //========================================================================================== 16
3616   //======================================================================
3617   //======================================================================1D plot: D vs phi , different eta,  depth=3
3618   cout << "      1D plot: D vs phi , different eta,  depth=3 *****" << endl;
3619   c3x5->Clear();
3620   c3x5->Divide(3, 5);
3621   c3x5->cd(1);
3622   int kcountHEpositivedirectionD3 = 1;
3623   TH1F *h2CeffHEpositivedirectionD3 = new TH1F("h2CeffHEpositivedirectionD3", "", nphi, 0., 72.);
3624 
3625   for (int jeta = 0; jeta < njeta; jeta++) {
3626     // positivedirectionD:
3627     if (jeta - 41 > 0) {
3628       //         for (int i=0;i<ndepth;i++) {
3629       // depth=3
3630       for (int i = 2; i < 3; i++) {
3631         TH1F *HEpositivedirectionD3 = (TH1F *)h2CeffHEpositivedirectionD3->Clone("twod1");
3632 
3633         float ccctest = 0;  // to avoid empty massive elements
3634         for (int jphi = 0; jphi < nphi; jphi++) {
3635           double ccc1 = variance[i][jeta][jphi];
3636           if (alexhe[i][jeta][jphi] > 0.) {
3637             HEpositivedirectionD3->Fill(jphi, ccc1);
3638             ccctest = 1.;  //HEpositivedirectionD3->SetBinError(i,0.01);
3639           }
3640         }  // for jphi
3641         if (ccctest > 0.) {
3642           cout << "1616       kcountHEpositivedirectionD3   =     " << kcountHEpositivedirectionD3
3643                << "   jeta-41=     " << jeta - 41 << endl;
3644           c3x5->cd(kcountHEpositivedirectionD3);
3645           HEpositivedirectionD3->SetMarkerStyle(20);
3646           HEpositivedirectionD3->SetMarkerSize(0.4);
3647           HEpositivedirectionD3->GetYaxis()->SetLabelSize(0.04);
3648           HEpositivedirectionD3->SetXTitle("HEpositivedirectionD3 \b");
3649           HEpositivedirectionD3->SetMarkerColor(2);
3650           HEpositivedirectionD3->SetLineColor(0);
3651           gPad->SetGridy();
3652           gPad->SetGridx();
3653           //       gPad->SetLogy();
3654           if (kcountHEpositivedirectionD3 == 1)
3655             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 17; depth = 3 \b");
3656           if (kcountHEpositivedirectionD3 == 2)
3657             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 18; depth = 3 \b");
3658           if (kcountHEpositivedirectionD3 == 3)
3659             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 19; depth = 3 \b");
3660           if (kcountHEpositivedirectionD3 == 4)
3661             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 20; depth = 3 \b");
3662           if (kcountHEpositivedirectionD3 == 5)
3663             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 21; depth = 3 \b");
3664           if (kcountHEpositivedirectionD3 == 6)
3665             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 22; depth = 3 \b");
3666           if (kcountHEpositivedirectionD3 == 7)
3667             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 23; depth = 3 \b");
3668           if (kcountHEpositivedirectionD3 == 8)
3669             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 24; depth = 3 \b");
3670           if (kcountHEpositivedirectionD3 == 9)
3671             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 25; depth = 3 \b");
3672           if (kcountHEpositivedirectionD3 == 10)
3673             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 26; depth = 3 \b");
3674           if (kcountHEpositivedirectionD3 == 11)
3675             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 27; depth = 3 \b");
3676           if (kcountHEpositivedirectionD3 == 12)
3677             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 28; depth = 3 \b");
3678           if (kcountHEpositivedirectionD3 == 13)
3679             HEpositivedirectionD3->SetXTitle("D for HE+ jeta = 29; depth = 3 \b");
3680           HEpositivedirectionD3->Draw("Error");
3681           kcountHEpositivedirectionD3++;
3682           if (kcountHEpositivedirectionD3 > 15)
3683             break;  // 4x6 = 24
3684         }           //ccctest>0
3685 
3686       }  // for i
3687     }    //if(jeta-41 > 0)
3688   }      //for jeta
3689   /////////////////
3690   c3x5->Update();
3691   c3x5->Print("Dhist1IterationMethodDepth3HE.png");
3692   c3x5->Clear();
3693   // clean-up
3694   if (h2CeffHEpositivedirectionD3)
3695     delete h2CeffHEpositivedirectionD3;
3696 
3697   //========================================================================================== 17
3698   //======================================================================
3699   //======================================================================1D plot: D vs phi , different eta,  depth=4
3700   cout << "      1D plot: D vs phi , different eta,  depth=4 *****" << endl;
3701   c3x5->Clear();
3702   c3x5->Divide(3, 5);
3703   c3x5->cd(1);
3704   int kcountHEpositivedirectionD4 = 1;
3705   TH1F *h2CeffHEpositivedirectionD4 = new TH1F("h2CeffHEpositivedirectionD4", "", nphi, 0., 72.);
3706 
3707   for (int jeta = 0; jeta < njeta; jeta++) {
3708     // positivedirectionD:
3709     if (jeta - 41 > 0) {
3710       //         for (int i=0;i<ndepth;i++) {
3711       // depth=4
3712       for (int i = 3; i < 4; i++) {
3713         TH1F *HEpositivedirectionD4 = (TH1F *)h2CeffHEpositivedirectionD4->Clone("twod1");
3714 
3715         float ccctest = 0;  // to avoid empty massive elements
3716         for (int jphi = 0; jphi < nphi; jphi++) {
3717           double ccc1 = variance[i][jeta][jphi];
3718           if (alexhe[i][jeta][jphi] > 0.) {
3719             HEpositivedirectionD4->Fill(jphi, ccc1);
3720             ccctest = 1.;  //HEpositivedirectionD4->SetBinError(i,0.01);
3721           }
3722         }  // for jphi
3723         if (ccctest > 0.) {
3724           cout << "1717       kcountHEpositivedirectionD4   =     " << kcountHEpositivedirectionD4
3725                << "   jeta-41=     " << jeta - 41 << endl;
3726           c3x5->cd(kcountHEpositivedirectionD4);
3727           HEpositivedirectionD4->SetMarkerStyle(20);
3728           HEpositivedirectionD4->SetMarkerSize(0.4);
3729           HEpositivedirectionD4->GetYaxis()->SetLabelSize(0.04);
3730           HEpositivedirectionD4->SetXTitle("HEpositivedirectionD4 \b");
3731           HEpositivedirectionD4->SetMarkerColor(2);
3732           HEpositivedirectionD4->SetLineColor(0);
3733           gPad->SetGridy();
3734           gPad->SetGridx();
3735           //       gPad->SetLogy();
3736           if (kcountHEpositivedirectionD4 == 1)
3737             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 16; depth = 4 \b");
3738           if (kcountHEpositivedirectionD4 == 2)
3739             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 18; depth = 4 \b");
3740           if (kcountHEpositivedirectionD4 == 3)
3741             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 19; depth = 4 \b");
3742           if (kcountHEpositivedirectionD4 == 4)
3743             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 20; depth = 4 \b");
3744           if (kcountHEpositivedirectionD4 == 5)
3745             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 21; depth = 4 \b");
3746           if (kcountHEpositivedirectionD4 == 6)
3747             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 22; depth = 4 \b");
3748           if (kcountHEpositivedirectionD4 == 7)
3749             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 23; depth = 4 \b");
3750           if (kcountHEpositivedirectionD4 == 8)
3751             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 24; depth = 4 \b");
3752           if (kcountHEpositivedirectionD4 == 9)
3753             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 25; depth = 4 \b");
3754           if (kcountHEpositivedirectionD4 == 10)
3755             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 26; depth = 4 \b");
3756           if (kcountHEpositivedirectionD4 == 11)
3757             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 27; depth = 4 \b");
3758           if (kcountHEpositivedirectionD4 == 12)
3759             HEpositivedirectionD4->SetXTitle("D for HE+ jeta = 28; depth = 4 \b");
3760           HEpositivedirectionD4->Draw("Error");
3761           kcountHEpositivedirectionD4++;
3762           if (kcountHEpositivedirectionD4 > 15)
3763             break;  // 4x6 = 24
3764         }           //ccctest>0
3765 
3766       }  // for i
3767     }    //if(jeta-41 > 0)
3768   }      //for jeta
3769   /////////////////
3770   c3x5->Update();
3771   c3x5->Print("Dhist1IterationMethodDepth4HE.png");
3772   c3x5->Clear();
3773   // clean-up
3774   if (h2CeffHEpositivedirectionD4)
3775     delete h2CeffHEpositivedirectionD4;
3776 
3777   //========================================================================================== 18
3778   //======================================================================
3779   //======================================================================1D plot: D vs phi , different eta,  depth=5
3780   cout << "      1D plot: D vs phi , different eta,  depth=5 *****" << endl;
3781   c3x5->Clear();
3782   c3x5->Divide(3, 5);
3783   c3x5->cd(1);
3784   int kcountHEpositivedirectionD5 = 1;
3785   TH1F *h2CeffHEpositivedirectionD5 = new TH1F("h2CeffHEpositivedirectionD5", "", nphi, 0., 72.);
3786 
3787   for (int jeta = 0; jeta < njeta; jeta++) {
3788     // positivedirectionD:
3789     if (jeta - 41 > 0) {
3790       //         for (int i=0;i<ndepth;i++) {
3791       // depth=5
3792       for (int i = 4; i < 5; i++) {
3793         TH1F *HEpositivedirectionD5 = (TH1F *)h2CeffHEpositivedirectionD5->Clone("twod1");
3794 
3795         float ccctest = 0;  // to avoid empty massive elements
3796         for (int jphi = 0; jphi < nphi; jphi++) {
3797           double ccc1 = variance[i][jeta][jphi];
3798           if (alexhe[i][jeta][jphi] > 0.) {
3799             HEpositivedirectionD5->Fill(jphi, ccc1);
3800             ccctest = 1.;  //HEpositivedirectionD5->SetBinError(i,0.01);
3801           }
3802         }  // for jphi
3803         if (ccctest > 0.) {
3804           cout << "1818       kcountHEpositivedirectionD5   =     " << kcountHEpositivedirectionD5
3805                << "   jeta-41=     " << jeta - 41 << endl;
3806           c3x5->cd(kcountHEpositivedirectionD5);
3807           HEpositivedirectionD5->SetMarkerStyle(20);
3808           HEpositivedirectionD5->SetMarkerSize(0.4);
3809           HEpositivedirectionD5->GetYaxis()->SetLabelSize(0.04);
3810           HEpositivedirectionD5->SetXTitle("HEpositivedirectionD5 \b");
3811           HEpositivedirectionD5->SetMarkerColor(2);
3812           HEpositivedirectionD5->SetLineColor(0);
3813           gPad->SetGridy();
3814           gPad->SetGridx();
3815           //       gPad->SetLogy();
3816           if (kcountHEpositivedirectionD5 == 1)
3817             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 18; depth = 5 \b");
3818           if (kcountHEpositivedirectionD5 == 2)
3819             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 19; depth = 5 \b");
3820           if (kcountHEpositivedirectionD5 == 3)
3821             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 20; depth = 5 \b");
3822           if (kcountHEpositivedirectionD5 == 4)
3823             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 21; depth = 5 \b");
3824           if (kcountHEpositivedirectionD5 == 5)
3825             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 22; depth = 5 \b");
3826           if (kcountHEpositivedirectionD5 == 6)
3827             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 23; depth = 5 \b");
3828           if (kcountHEpositivedirectionD5 == 7)
3829             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 24; depth = 5 \b");
3830           if (kcountHEpositivedirectionD5 == 8)
3831             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 25; depth = 5 \b");
3832           if (kcountHEpositivedirectionD5 == 9)
3833             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 26; depth = 5 \b");
3834           if (kcountHEpositivedirectionD5 == 10)
3835             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 27; depth = 5 \b");
3836           if (kcountHEpositivedirectionD5 == 11)
3837             HEpositivedirectionD5->SetXTitle("D for HE+ jeta = 28; depth = 5 \b");
3838           HEpositivedirectionD5->Draw("Error");
3839           kcountHEpositivedirectionD5++;
3840           if (kcountHEpositivedirectionD5 > 15)
3841             break;  // 4x6 = 24
3842         }           //ccctest>0
3843 
3844       }  // for i
3845     }    //if(jeta-41 > 0)
3846   }      //for jeta
3847   /////////////////
3848   c3x5->Update();
3849   c3x5->Print("Dhist1IterationMethodDepth5HE.png");
3850   c3x5->Clear();
3851   // clean-up
3852   if (h2CeffHEpositivedirectionD5)
3853     delete h2CeffHEpositivedirectionD5;
3854 
3855   //========================================================================================== 19
3856   //======================================================================
3857   //======================================================================1D plot: D vs phi , different eta,  depth=6
3858   cout << "      1D plot: D vs phi , different eta,  depth=6 *****" << endl;
3859   c3x5->Clear();
3860   c3x5->Divide(3, 5);
3861   c3x5->cd(1);
3862   int kcountHEpositivedirectionD6 = 1;
3863   TH1F *h2CeffHEpositivedirectionD6 = new TH1F("h2CeffHEpositivedirectionD6", "", nphi, 0., 72.);
3864 
3865   for (int jeta = 0; jeta < njeta; jeta++) {
3866     // positivedirectionD:
3867     if (jeta - 41 > 0) {
3868       //         for (int i=0;i<ndepth;i++) {
3869       // depth=6
3870       for (int i = 5; i < 6; i++) {
3871         TH1F *HEpositivedirectionD6 = (TH1F *)h2CeffHEpositivedirectionD6->Clone("twod1");
3872 
3873         float ccctest = 0;  // to avoid empty massive elements
3874         for (int jphi = 0; jphi < nphi; jphi++) {
3875           double ccc1 = variance[i][jeta][jphi];
3876           if (alexhe[i][jeta][jphi] > 0.) {
3877             HEpositivedirectionD6->Fill(jphi, ccc1);
3878             ccctest = 1.;  //HEpositivedirectionD6->SetBinError(i,0.01);
3879           }
3880         }  // for jphi
3881         if (ccctest > 0.) {
3882           cout << "1919       kcountHEpositivedirectionD6   =     " << kcountHEpositivedirectionD6
3883                << "   jeta-41=     " << jeta - 41 << endl;
3884           c3x5->cd(kcountHEpositivedirectionD6);
3885           HEpositivedirectionD6->SetMarkerStyle(20);
3886           HEpositivedirectionD6->SetMarkerSize(0.4);
3887           HEpositivedirectionD6->GetYaxis()->SetLabelSize(0.04);
3888           HEpositivedirectionD6->SetXTitle("HEpositivedirectionD6 \b");
3889           HEpositivedirectionD6->SetMarkerColor(2);
3890           HEpositivedirectionD6->SetLineColor(0);
3891           gPad->SetGridy();
3892           gPad->SetGridx();
3893           //       gPad->SetLogy();
3894           if (kcountHEpositivedirectionD6 == 1)
3895             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 19; depth = 6 \b");
3896           if (kcountHEpositivedirectionD6 == 2)
3897             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 20; depth = 6 \b");
3898           if (kcountHEpositivedirectionD6 == 3)
3899             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 21; depth = 6 \b");
3900           if (kcountHEpositivedirectionD6 == 4)
3901             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 22; depth = 6 \b");
3902           if (kcountHEpositivedirectionD6 == 5)
3903             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 23; depth = 6 \b");
3904           if (kcountHEpositivedirectionD6 == 6)
3905             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 24; depth = 6 \b");
3906           if (kcountHEpositivedirectionD6 == 7)
3907             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 25; depth = 6 \b");
3908           if (kcountHEpositivedirectionD6 == 8)
3909             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 26; depth = 6 \b");
3910           if (kcountHEpositivedirectionD6 == 9)
3911             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 27; depth = 6 \b");
3912           if (kcountHEpositivedirectionD6 == 10)
3913             HEpositivedirectionD6->SetXTitle("D for HE+ jeta = 28; depth = 6 \b");
3914           HEpositivedirectionD6->Draw("Error");
3915           kcountHEpositivedirectionD6++;
3916           if (kcountHEpositivedirectionD6 > 15)
3917             break;  // 4x6 = 24
3918         }           //ccctest>0
3919 
3920       }  // for i
3921     }    //if(jeta-41 > 0)
3922   }      //for jeta
3923   /////////////////
3924   c3x5->Update();
3925   c3x5->Print("Dhist1IterationMethodDepth6HE.png");
3926   c3x5->Clear();
3927   // clean-up
3928   if (h2CeffHEpositivedirectionD6)
3929     delete h2CeffHEpositivedirectionD6;
3930 
3931   //========================================================================================== 20
3932   //======================================================================
3933   //======================================================================1D plot: D vs phi , different eta,  depth=7
3934   cout << "      1D plot: D vs phi , different eta,  depth=7 *****" << endl;
3935   c3x5->Clear();
3936   c3x5->Divide(3, 5);
3937   c3x5->cd(1);
3938   int kcountHEpositivedirectionD7 = 1;
3939   TH1F *h2CeffHEpositivedirectionD7 = new TH1F("h2CeffHEpositivedirectionD7", "", nphi, 0., 72.);
3940 
3941   for (int jeta = 0; jeta < njeta; jeta++) {
3942     // positivedirectionD:
3943     if (jeta - 41 > 0) {
3944       //         for (int i=0;i<ndepth;i++) {
3945       // depth=7
3946       for (int i = 6; i < 7; i++) {
3947         TH1F *HEpositivedirectionD7 = (TH1F *)h2CeffHEpositivedirectionD7->Clone("twod1");
3948 
3949         float ccctest = 0;  // to avoid empty massive elements
3950         for (int jphi = 0; jphi < nphi; jphi++) {
3951           double ccc1 = variance[i][jeta][jphi];
3952           if (alexhe[i][jeta][jphi] > 0.) {
3953             HEpositivedirectionD7->Fill(jphi, ccc1);
3954             ccctest = 1.;  //HEpositivedirectionD7->SetBinError(i,0.01);
3955           }
3956         }  // for jphi
3957         if (ccctest != 0.) {
3958           cout << "2020       kcountHEpositivedirectionD7   =     " << kcountHEpositivedirectionD7
3959                << "   jeta-41=     " << jeta - 41 << endl;
3960           c3x5->cd(kcountHEpositivedirectionD7);
3961           HEpositivedirectionD7->SetMarkerStyle(20);
3962           HEpositivedirectionD7->SetMarkerSize(0.4);
3963           HEpositivedirectionD7->GetYaxis()->SetLabelSize(0.04);
3964           HEpositivedirectionD7->SetXTitle("HEpositivedirectionD7 \b");
3965           HEpositivedirectionD7->SetMarkerColor(2);
3966           HEpositivedirectionD7->SetLineColor(0);
3967           gPad->SetGridy();
3968           gPad->SetGridx();
3969           //       gPad->SetLogy();
3970           if (kcountHEpositivedirectionD7 == 1)
3971             HEpositivedirectionD7->SetXTitle("D for HE+ jeta = 26; depth = 7 \b");
3972           if (kcountHEpositivedirectionD7 == 2)
3973             HEpositivedirectionD7->SetXTitle("D for HE+ jeta = 27; depth = 7 \b");
3974           if (kcountHEpositivedirectionD7 == 3)
3975             HEpositivedirectionD7->SetXTitle("D for HE+ jeta = 28; depth = 7 \b");
3976           HEpositivedirectionD7->Draw("Error");
3977           kcountHEpositivedirectionD7++;
3978           if (kcountHEpositivedirectionD7 > 15)
3979             break;  // 4x6 = 24
3980         }           //ccctest>0
3981 
3982       }  // for i
3983     }    //if(jeta-41 > 0)
3984   }      //for jeta
3985   /////////////////
3986   c3x5->Update();
3987   c3x5->Print("Dhist1IterationMethodDepth7HE.png");
3988   c3x5->Clear();
3989   // clean-up
3990   if (h2CeffHEpositivedirectionD7)
3991     delete h2CeffHEpositivedirectionD7;
3992 
3993   //=====================================================================
3994   //======================================================================
3995   //======================================================================
3996   //======================================================================
3997   //======================================================================
3998   //======================================================================
3999 
4000   std::cout << " We are here to print 2017 MAPs " << std::endl;
4001   //======================================================================
4002 
4003   //======================================================================
4004   /// Prepare maps of good/bad channels:
4005 
4006   TH2F *Map_ALL = new TH2F("Map_All", "Map_all", 82, -41, 40, 72, 0, 71);
4007   int nx = Map_ALL->GetXaxis()->GetNbins();
4008   int ny = Map_ALL->GetYaxis()->GetNbins();
4009   int NBad = 0;
4010   int NWarn = 0;
4011   int NCalib = 0;
4012   int NPed = 0;
4013   //    int Eta[3][10000]={0};
4014   int Eta[4][10000] = {0};
4015   int Phi[4][10000] = {0};
4016   int Sub[4][10000] = {0};
4017   int Depth[4][10000] = {0};
4018   string Comment[4][10000] = {""};
4019   string Text[33] = {"", "Cm", "Am", "Wm", "Rm", "TNm", "TXm", "", "", "", "", "Cc", "Ac", "Wc", "Rc", "TNc", "TXc",
4020                      "", "",   "",   "",   "GS", "",    "",    "", "", "", "", "",   "",   "",   "Pm", "pWm"};
4021   int flag_W = 0;
4022   int flag_B = 0;
4023   int flag_P = 0;
4024 
4025   for (int i = 1; i <= nx; i++) {           //Eta
4026     for (int j = 1; j <= ny; j++) {         // Phi
4027       for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
4028                                             //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
4029         //       int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
4030         //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
4031         for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
4032           if (Map_SUB[sub][k]->GetBinContent(i, j) != 0) {
4033             Map_SUB[sub][k]->SetBinContent(i, j, 0.5);
4034             Map_ALL->SetBinContent(i, j, 0.5);
4035           }
4036         }
4037       }
4038     }
4039   }
4040 
4041   for (int i = 1; i <= nx; i++) {           //Eta
4042     for (int j = 1; j <= ny; j++) {         // Phi
4043       for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
4044                                             //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
4045         //       int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
4046         //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
4047         for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
4048           flag_W = 0;
4049           flag_B = 0;
4050           flag_P = 0;
4051           for (int test = 1; test <= 6; test++) {  //Test: 1-Wm, 2-Rm, etc
4052                                                    //Bad
4053             if (Map_Ampl[test][sub][k]->GetBinContent(i, j) >
4054                 0.1) {  //Rate 0.1 for displaying  on whole detector map and subdetector map
4055               Map_ALL->SetBinContent(i, j, 1.);
4056               Map_SUB[sub][k]->SetBinContent(i, j, 1.);
4057               if (flag_B == 0) {
4058                 NBad += 1;
4059                 Eta[2][NBad] = i - 41;
4060                 Phi[2][NBad] = j - 1;
4061                 Sub[2][NBad] = sub;
4062                 Depth[2][NBad] = k;
4063                 Comment[2][NBad] = Text[test];
4064               } else
4065                 Comment[2][NBad] += ", " + Text[test];
4066               flag_B = 1;
4067               //              cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
4068             }
4069             //Warning
4070             /* 
4071                    if ((Map_Ampl[test][sub][k]->GetBinContent(i,j) != 0.)&&(Map_Ampl[test][sub][k]->GetBinContent(i,j) < 0.001) )  {
4072                   if (Map_SUB[sub][k]->GetBinContent(i,j)!=1.) Map_SUB[sub][k]->SetBinContent(i,j,0.75);
4073               if (Map_ALL->GetBinContent(i,j)!=1.) Map_ALL->SetBinContent(i,j,0.75);
4074               if (flag_W == 0) {
4075                  NWarn +=1; 
4076                  Eta[1][NWarn]=i-41;
4077                  Phi[1][NWarn]=j-1;
4078              Sub[1][NWarn]=sub;
4079                  Depth[1][NWarn]=k;
4080                  Comment[1][NWarn]=Text[test]; 
4081               } 
4082               else Comment[1][NWarn]+=", "+Text[test];
4083               flag_W = 1;                    
4084 //            cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
4085                    }           
4086 */
4087 
4088           }  //end test
4089 
4090           //Calib
4091           /*
4092          for (int test=11;test<=16;test++) { //Test: 1-2.E, 2-2.F, etc
4093                    if (Map_Ampl[test][sub][k]->GetBinContent(i,j) != 0.)  {
4094 //                if (Map_SUB[sub][k]->GetBinContent(i,j)!=1.0) Map_SUB[sub][k]->SetBinContent(i,j,0.3);
4095 //            if (Map_ALL->GetBinContent(i,j)!=1.) Map_ALL->SetBinContent(i,j,0.3);
4096               if (flag_W == 0) {
4097                  NWarn +=1; 
4098                  Eta[1][NWarn]=i-41;
4099                  Phi[1][NWarn]=j-1;
4100              Sub[1][NWarn]=sub;
4101                  Depth[1][NWarn]=k;
4102                  Comment[1][NWarn]=Text[test]; 
4103               } 
4104               else Comment[1][NWarn]+=", "+Text[test];
4105               flag_W = 1;                    
4106 //            cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
4107                   } 
4108         } //end test
4109 */
4110           //Gain stabil
4111           for (int test = 21; test <= 21; test++) {
4112             if (abs(Map_Ampl[test][sub][k]->GetBinContent(i, j)) > porog[sub]) {
4113               if (Map_SUB[sub][k]->GetBinContent(i, j) != 1.0)
4114                 Map_SUB[sub][k]->SetBinContent(i, j, 0.75);
4115               if (Map_ALL->GetBinContent(i, j) != 1.) {
4116                 Map_ALL->SetBinContent(i, j, 0.75);
4117                 if (flag_W == 0) {
4118                   NWarn += 1;
4119                   Eta[1][NWarn] = i - 41;
4120                   Phi[1][NWarn] = j - 1;
4121                   Sub[1][NWarn] = sub;
4122                   Depth[1][NWarn] = k;
4123                   Comment[1][NWarn] = Text[test];
4124                 } else
4125                   Comment[1][NWarn] += ", " + Text[test];
4126                 flag_W = 1;
4127 
4128                 cout << "Map_Ampl[" << test << "][" << sub << "][" << k << "]->GetBinContent(" << i << "," << j
4129                      << ")= " << Map_Ampl[test][sub][k]->GetBinContent(i, j) << endl;
4130               }
4131             }
4132           }  //end test
4133 
4134           //Pedestals
4135           for (int test = 31; test <= 32; test++) {
4136             if (Map_Ampl[test][sub][k]->GetBinContent(i, j) > 0.1) {
4137               //                  if (Map_SUB[sub][k]->GetBinContent(i,j)!=1.0) Map_SUB[sub][k]->SetBinContent(i,j,0.75);
4138               //              if (Map_ALL->GetBinContent(i,j)!=1.)  Map_ALL->SetBinContent(i,j,0.75);
4139               if (flag_P == 0) {
4140                 NPed += 1;
4141                 Eta[3][NPed] = i - 41;
4142                 Phi[3][NPed] = j - 1;
4143                 Sub[3][NPed] = sub;
4144                 Depth[3][NPed] = k;
4145                 Comment[3][NPed] = Text[test];
4146               } else
4147                 Comment[3][NPed] += ", " + Text[test];
4148               flag_P = 1;
4149 
4150               //              cout<<"Map_Ampl["<<test<<"]["<<sub<<"]["<<k<<"]->GetBinContent("<<i<<","<<j<<")= "<<Map_Ampl[test][sub][k]->GetBinContent(i,j)<<endl;
4151             }
4152           }  //end test
4153 
4154         }                               //end Depth
4155       }                                 //end Sub
4156     }                                   //end Phi
4157   }                                     //end Eta
4158                                         // subdet maps
4159   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
4160 
4161     std::cout << " 2017 MAPS_SUB " << sub << std::endl;
4162     //     if (sub==1) cHB->Divide(2,1);
4163     if (sub == 1)
4164       cHB->Divide(2, 2);
4165     //     if (sub==2) cHE->Divide(3,1);
4166     if (sub == 2)
4167       cHE->Divide(3, 3);
4168     if (sub == 3)
4169       cONE->Divide(1, 1);
4170     //     if (sub==4) cHB->Divide(2,1);
4171     if (sub == 4)
4172       cHF->Divide(2, 2);
4173     //       int k_min[5]={0,1,1,4,1}; // minimum depth for each subdet
4174     //     int k_max[5]={0,2,3,4,2}; // maximum depth for each subdet
4175     //       int k_max[5]={0,2,7,4,4}; // maximum depth for each subdet
4176     for (int k = k_min[sub]; k <= k_max[sub]; k++) {  //Depth
4177       if (sub == 1)
4178         cHB->cd(k);
4179       if (sub == 2)
4180         cHE->cd(k);
4181       if (sub == 3)
4182         cONE->cd(k - 3);
4183       if (sub == 4)
4184         cHF->cd(k);
4185       gPad->SetGridy();
4186       gPad->SetGridx();
4187       //          gPad->SetLogz();
4188       //          gStyle->SetTitleOffset(0.5, "Y");
4189       if (sub == 1)
4190         sprintf(str, "HB, Depth%d \b", k);
4191       if (sub == 2)
4192         sprintf(str, "HE, Depth%d \b", k);
4193       if (sub == 3)
4194         sprintf(str, "HO, Depth%d \b", k);
4195       if (sub == 4)
4196         sprintf(str, "HF, Depth%d \b", k);
4197       Map_SUB[sub][k]->SetTitle(str);
4198       Map_SUB[sub][k]->SetXTitle("#eta \b");
4199       Map_SUB[sub][k]->SetYTitle("#phi \b");
4200       Map_SUB[sub][k]->Draw("COL");
4201       Map_SUB[sub][k]->GetYaxis()->SetRangeUser(0, 72.);
4202       Map_SUB[sub][k]->GetZaxis()->SetRangeUser(0., 1.);
4203       if (sub == 1) {
4204         cHB->Modified();
4205         cHB->Update();
4206       }
4207       if (sub == 2) {
4208         cHE->Modified();
4209         cHE->Update();
4210       }
4211       if (sub == 3) {
4212         cONE->Modified();
4213         cONE->Update();
4214       }
4215       if (sub == 4) {
4216         cHF->Modified();
4217         cHF->Update();
4218       }
4219     }  //end depth
4220     if (sub == 1) {
4221       cHB->Print("MAPHB.png");
4222       cHB->Clear();
4223     }
4224     if (sub == 2) {
4225       cHE->Print("MAPHE.png");
4226       cHE->Clear();
4227     }
4228     if (sub == 3) {
4229       cONE->Print("MAPHO.png");
4230       cONE->Clear();
4231     }
4232     if (sub == 4) {
4233       cHF->Print("MAPHF.png");
4234       cHF->Clear();
4235     }
4236   }
4237 
4238   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4239   //  TCanvas *cmain1 = new TCanvas("cmain1","MAP",200,10,1400,1800);
4240   TCanvas *cmain1 = new TCanvas("cmain1", "MAP", 250, 10, 1450, 1410);
4241   cmain1->Divide(2, 2);
4242 
4243   cmain1->cd(1);
4244   TH1F *JDBEYESJ0 = (TH1F *)dir->FindObjectAny("h_totalAmplitudeHBperEvent");
4245   JDBEYESJ0->SetStats(0);
4246   JDBEYESJ0->SetMarkerStyle(20);
4247   JDBEYESJ0->SetMarkerSize(0.8);
4248   JDBEYESJ0->GetYaxis()->SetLabelSize(0.04);
4249   JDBEYESJ0->SetXTitle("iEvent \b");
4250   JDBEYESJ0->SetYTitle("totalAmplitude perEvent \b");
4251   JDBEYESJ0->SetTitle("HB \b");
4252   JDBEYESJ0->SetMarkerColor(2);
4253   JDBEYESJ0->SetLineColor(1);
4254   JDBEYESJ0->SetMinimum(0.8);
4255   JDBEYESJ0->Draw("HIST same P0");
4256 
4257   cmain1->cd(2);
4258   TH1F *JDBEYESJ1 = (TH1F *)dir->FindObjectAny("h_totalAmplitudeHEperEvent");
4259   JDBEYESJ1->SetStats(0);
4260   JDBEYESJ1->SetMarkerStyle(20);
4261   JDBEYESJ1->SetMarkerSize(0.8);
4262   JDBEYESJ1->GetYaxis()->SetLabelSize(0.04);
4263   JDBEYESJ1->SetXTitle("iEvent \b");
4264   JDBEYESJ1->SetYTitle("totalAmplitude perEvent \b");
4265   JDBEYESJ1->SetTitle("HE \b");
4266   JDBEYESJ1->SetMarkerColor(2);
4267   JDBEYESJ1->SetLineColor(1);
4268   JDBEYESJ1->SetMinimum(0.8);
4269   JDBEYESJ1->Draw("HIST same P0");
4270 
4271   cmain1->cd(3);
4272   TH1F *JDBEYESJ2 = (TH1F *)dir->FindObjectAny("h_totalAmplitudeHFperEvent");
4273   JDBEYESJ2->SetStats(0);
4274   JDBEYESJ2->SetMarkerStyle(20);
4275   JDBEYESJ2->SetMarkerSize(0.8);
4276   JDBEYESJ2->GetYaxis()->SetLabelSize(0.04);
4277   JDBEYESJ2->SetXTitle("iEvent \b");
4278   JDBEYESJ2->SetYTitle("totalAmplitude perEvent \b");
4279   JDBEYESJ2->SetTitle("HF \b");
4280   JDBEYESJ2->SetMarkerColor(2);
4281   JDBEYESJ2->SetLineColor(1);
4282   JDBEYESJ2->SetMinimum(0.8);
4283   JDBEYESJ2->Draw("HIST same P0");
4284 
4285   cmain1->cd(4);
4286   TH1F *JDBEYESJ3 = (TH1F *)dir->FindObjectAny("h_totalAmplitudeHOperEvent");
4287   JDBEYESJ3->SetStats(0);
4288   JDBEYESJ3->SetMarkerStyle(20);
4289   JDBEYESJ3->SetMarkerSize(0.8);
4290   JDBEYESJ3->GetYaxis()->SetLabelSize(0.04);
4291   JDBEYESJ3->SetXTitle("iEvent \b");
4292   JDBEYESJ3->SetYTitle("totalAmplitude perEvent \b");
4293   JDBEYESJ3->SetTitle("HO \b");
4294   JDBEYESJ3->SetMarkerColor(2);
4295   JDBEYESJ3->SetLineColor(1);
4296   JDBEYESJ3->SetMinimum(0.8);
4297   JDBEYESJ3->Draw("HIST same P0");
4298 
4299   cmain1->Modified();
4300   cmain1->Update();
4301   cmain1->Print("EVENTDEPENDENCE.png");
4302 
4303   std::cout << " EVENTDEPENDENCE " << std::endl;
4304 
4305   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4306   // ALL SubDet
4307   gStyle->SetOptTitle(0);
4308   TCanvas *cmain = new TCanvas("cmain", "MAP", 1000, 1000);
4309   //cmain->cd(1);
4310   gPad->SetGridy();
4311   gPad->SetGridx();
4312   //   gPad->SetLogz();
4313   Map_ALL->SetTitleOffset(1.3, "Y");
4314   Map_ALL->SetXTitle("#eta \b");
4315   Map_ALL->SetYTitle("#phi \b");
4316   Map_ALL->Draw("COL");
4317   Map_ALL->GetYaxis()->SetRangeUser(0, 72.);
4318   Map_ALL->GetZaxis()->SetRangeUser(0, 1.);
4319   cmain->Modified();
4320   cmain->Update();
4321   cmain->Print("MAP.png");
4322 
4323   std::cout << "********      MAP_ALL  done" << std::endl;
4324   std::cout << "********" << std::endl;
4325 
4326   std::cout << "********" << std::endl;
4327   std::cout << "************    Start creating each test kind for each subdet html pages:" << std::endl;
4328 
4329   //======================================================================
4330 
4331   //======================================================================
4332   // Creating each test kind for each subdet html pages:
4333   std::string raw_class, raw_class1, raw_class2, raw_class3;
4334   int ind = 0;
4335 
4336   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
4337     ofstream htmlFileT, htmlFileC, htmlFileD, htmlFileP, htmlFileS, htmlFileM;
4338     if (sub == 1) {
4339       htmlFileT.open("HB_Tile.html");
4340       htmlFileC.open("HB_Calib.html");
4341       htmlFileD.open("HB_Drift.html");
4342       htmlFileP.open("HB_Pedestals.html");
4343       htmlFileS.open("HB_Shapes.html");
4344     }
4345     if (sub == 2) {
4346       htmlFileT.open("HE_Tile.html");
4347       htmlFileC.open("HE_Calib.html");
4348       htmlFileD.open("HE_Drift.html");
4349       htmlFileP.open("HE_Pedestals.html");
4350       htmlFileS.open("HE_Shapes.html");
4351       htmlFileM.open("HE_IterationMethod.html");
4352     }
4353     if (sub == 3) {
4354       htmlFileT.open("HO_Tile.html");
4355       htmlFileC.open("HO_Calib.html");
4356       htmlFileD.open("HO_Drift.html");
4357       htmlFileP.open("HO_Pedestals.html");
4358       htmlFileS.open("HO_Shapes.html");
4359     }
4360     if (sub == 4) {
4361       htmlFileT.open("HF_Tile.html");
4362       htmlFileC.open("HF_Calib.html");
4363       htmlFileD.open("HF_Drift.html");
4364       htmlFileP.open("HF_Pedestals.html");
4365       htmlFileS.open("HF_Shapes.html");
4366     }
4367 
4368     // Megatile channels
4369     htmlFileT << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
4370     htmlFileT << "<head>" << std::endl;
4371     htmlFileT << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
4372     htmlFileT << "<title> Remote Monitoring Tool </title>" << std::endl;
4373     htmlFileT << "<style type=\"text/css\">" << std::endl;
4374     htmlFileT << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
4375               << std::endl;
4376     htmlFileT << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
4377     htmlFileT << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
4378                  "text-align: center;}"
4379               << std::endl;
4380     htmlFileT << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
4381     htmlFileT << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
4382     htmlFileT << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
4383     htmlFileT << "</style>" << std::endl;
4384     htmlFileT << "<body>" << std::endl;
4385 
4386     if (sub == 1)
4387       htmlFileT << "<h1> Criteria for megatile channels for HB, RUN = " << runnumber << " </h1>" << std::endl;
4388     if (sub == 2)
4389       htmlFileT << "<h1> Criteria for megatile channels for HE, RUN = " << runnumber << " </h1>" << std::endl;
4390     if (sub == 3)
4391       htmlFileT << "<h1> Criteria for megatile channels for HO, RUN = " << runnumber << " </h1>" << std::endl;
4392     if (sub == 4)
4393       htmlFileT << "<h1> Criteria for megatile channels for HF, RUN = " << runnumber << " </h1>" << std::endl;
4394     htmlFileT << "<br>" << std::endl;
4395 
4396     // Test Entries
4397 
4398     htmlFileT << "<h2> 0. Entries for each channel.</h3>" << std::endl;
4399     htmlFileT << "<h3> 0.A. Entries in each channel for each depth.</h3>" << std::endl;
4400     htmlFileT << "<h4> Channel legend: color is rate of entries </h4>" << std::endl;
4401     if (sub == 1)
4402       htmlFileT << " <img src=\"MapRateEntryHB.png\" />" << std::endl;
4403     if (sub == 2)
4404       htmlFileT << " <img src=\"MapRateEntryHE.png\" />" << std::endl;
4405     if (sub == 3)
4406       htmlFileT << " <img src=\"MapRateEntryHO.png\" />" << std::endl;
4407     if (sub == 4)
4408       htmlFileT << " <img src=\"MapRateEntryHF.png\" />" << std::endl;
4409     htmlFileT << "<br>" << std::endl;
4410 
4411     // Test Cm
4412     htmlFileT << "<h2> 1. Cm criterion: CapID errors for each channel.</h3>" << std::endl;
4413     htmlFileT << "<h3> 1.A. Rate of CapId failures in each channel for each depth.</h3>" << std::endl;
4414     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4415     if (sub == 1)
4416       htmlFileT << " <img src=\"MapRateCapIDHB.png\" />" << std::endl;
4417     if (sub == 2)
4418       htmlFileT << " <img src=\"MapRateCapIDHE.png\" />" << std::endl;
4419     if (sub == 3)
4420       htmlFileT << " <img src=\"MapRateCapIDHO.png\" />" << std::endl;
4421     if (sub == 4)
4422       htmlFileT << " <img src=\"MapRateCapIDHF.png\" />" << std::endl;
4423     htmlFileT << "<br>" << std::endl;
4424 
4425     // Am
4426     htmlFileT << "<h2> 2. Am criterion: ADC amplitude collected over all TSs(Full Amplitude) for each channel. </h3>"
4427               << std::endl;
4428     htmlFileT << "<h3> 2.A. Full ADC amplitude distribution over all events, channels and depths.</h3>" << std::endl;
4429     htmlFileT << "<h4> Legend: Bins less " << MIN_M[2][sub] << " correpond to bad ADC amplitude </h4>" << std::endl;
4430     if (sub == 1)
4431       htmlFileT << " <img src=\"HistAmplHB.png\" />" << std::endl;
4432     if (sub == 2)
4433       htmlFileT << " <img src=\"HistAmplHE.png\" />" << std::endl;
4434     if (sub == 3)
4435       htmlFileT << " <img src=\"HistAmplHO.png\" />" << std::endl;
4436     if (sub == 4)
4437       htmlFileT << " <img src=\"HistAmplHF.png\" />" << std::endl;
4438     htmlFileT << "<br>" << std::endl;
4439     htmlFileT << "<h3> 2.B. Rate of bad ADC amplitude (<" << MIN_M[2][sub] << ") in each channel for each depth. </h3>"
4440               << std::endl;
4441     htmlFileT << "<h4> Channel legend: white - good, other colours - bad. </h4>" << std::endl;
4442     if (sub == 1)
4443       htmlFileT << " <img src=\"MapRateAmplHB.png\" />" << std::endl;
4444     if (sub == 2)
4445       htmlFileT << " <img src=\"MapRateAmplHE.png\" />" << std::endl;
4446     if (sub == 3)
4447       htmlFileT << " <img src=\"MapRateAmplHO.png\" />" << std::endl;
4448     if (sub == 4)
4449       htmlFileT << " <img src=\"MapRateAmplHF.png\" />" << std::endl;
4450     htmlFileT << "<br>" << std::endl;
4451 
4452     // Test Wm
4453     htmlFileT << "<h2> 3. Wm criterion: RMS (width) of ADC amplutude for each channel.</h3>" << std::endl;
4454     htmlFileT << "<h3> 3.A. RMS distribution over all events, channel and depth.</h3>" << std::endl;
4455     htmlFileT << "<h4> Legend: Bins less " << MIN_M[3][sub] << " and more " << MAX_M[3][sub]
4456               << " correpond to bad RMS </h4>" << std::endl;
4457     if (sub == 1)
4458       htmlFileT << " <img src=\"HistRMSHB.png\" />" << std::endl;
4459     if (sub == 2)
4460       htmlFileT << " <img src=\"HistRMSHE.png\" />" << std::endl;
4461     if (sub == 3)
4462       htmlFileT << " <img src=\"HistRMSHO.png\" />" << std::endl;
4463     if (sub == 4)
4464       htmlFileT << " <img src=\"HistRMSHF.png\" />" << std::endl;
4465     htmlFileT << "<br>" << std::endl;
4466     htmlFileT << "<h3> 3.B. Rate of bad RMS (<" << MIN_M[3][sub] << ",>" << MAX_M[3][sub]
4467               << ") in each channel for each depth.</h3>" << std::endl;
4468     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4469     if (sub == 1)
4470       htmlFileT << " <img src=\"MapRateRMSHB.png\" />" << std::endl;
4471     if (sub == 2)
4472       htmlFileT << " <img src=\"MapRateRMSHE.png\" />" << std::endl;
4473     if (sub == 3)
4474       htmlFileT << " <img src=\"MapRateRMSHO.png\" />" << std::endl;
4475     if (sub == 4)
4476       htmlFileT << " <img src=\"MapRateRMSHF.png\" />" << std::endl;
4477     htmlFileT << "<br>" << std::endl;
4478 
4479     // Rm
4480     htmlFileT << "<h2> 4. Rm criterion: Ratio ADC value sum over four near maximum (-2, -1, max, +1) TS to ADC value "
4481                  "sum over all TS for each channel. </h3>"
4482               << std::endl;
4483     htmlFileT << "<h3> 4.A. Ratio distribution over all events, channels and depths.</h3>" << std::endl;
4484     htmlFileT << "<h4> Legend: Bins less " << MIN_M[4][sub] << " and more " << MAX_M[4][sub]
4485               << " correpond to bad ratio </h4>" << std::endl;
4486     if (sub == 1)
4487       htmlFileT << " <img src=\"Hist43TStoAllTSHB.png\" />" << std::endl;
4488     if (sub == 2)
4489       htmlFileT << " <img src=\"Hist43TStoAllTSHE.png\" />" << std::endl;
4490     if (sub == 3)
4491       htmlFileT << " <img src=\"Hist43TStoAllTSHO.png\" />" << std::endl;
4492     if (sub == 4)
4493       htmlFileT << " <img src=\"Hist43TStoAllTSHF.png\" />" << std::endl;
4494     htmlFileT << "<br>" << std::endl;
4495     htmlFileT << "<h3> 4.B. Rate of bad ratio (<" << MIN_M[4][sub] << ", >" << MAX_M[4][sub]
4496               << ") in each channel for each depth.</h3>" << std::endl;
4497     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4498     if (sub == 1)
4499       htmlFileT << " <img src=\"MapRate43TStoAllTSHB.png\" />" << std::endl;
4500     if (sub == 2)
4501       htmlFileT << " <img src=\"MapRate43TStoAllTSHE.png\" />" << std::endl;
4502     if (sub == 3)
4503       htmlFileT << " <img src=\"MapRate43TStoAllTSHO.png\" />" << std::endl;
4504     if (sub == 4)
4505       htmlFileT << " <img src=\"MapRate43TStoAllTSHF.png\" />" << std::endl;
4506     htmlFileT << "<br>" << std::endl;
4507 
4508     // TNm
4509     htmlFileT << "<h2> 5. TNm criterion: Mean TS position for each channel.</h3>" << std::endl;
4510     htmlFileT << "<h3> 5.A. TN position distribution over all events, channels and depths.</h3>" << std::endl;
4511     htmlFileT << "<h4> Legend: Bins less " << MIN_M[5][sub] << " and more " << MAX_M[5][sub]
4512               << " correpond to bad mean position </h4>" << std::endl;
4513     if (sub == 1)
4514       htmlFileT << " <img src=\"HistMeanPosHB.png\" />" << std::endl;
4515     if (sub == 2)
4516       htmlFileT << " <img src=\"HistMeanPosHE.png\" />" << std::endl;
4517     if (sub == 3)
4518       htmlFileT << " <img src=\"HistMeanPosHO.png\" />" << std::endl;
4519     if (sub == 4)
4520       htmlFileT << " <img src=\"HistMeanPosHF.png\" />" << std::endl;
4521     htmlFileT << "<br>" << std::endl;
4522     htmlFileT << "<h3> 5.B. Rate of bad TN position  (<" << MIN_M[5][sub] << ", >" << MAX_M[5][sub]
4523               << ") in each channel for each depth. </h3>" << std::endl;
4524     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4525     if (sub == 1)
4526       htmlFileT << " <img src=\"MapRateMeanPosHB.png\" />" << std::endl;
4527     if (sub == 2)
4528       htmlFileT << " <img src=\"MapRateMeanPosHE.png\" />" << std::endl;
4529     if (sub == 3)
4530       htmlFileT << " <img src=\"MapRateMeanPosHO.png\" />" << std::endl;
4531     if (sub == 4)
4532       htmlFileT << " <img src=\"MapRateMeanPosHF.png\" />" << std::endl;
4533     htmlFileT << "<br>" << std::endl;
4534 
4535     // TXm
4536     htmlFileT << "<h2> 6.TXm criterion: Maximum TS position for each channel.</h3>" << std::endl;
4537     htmlFileT << "<h3> 6.A. TX position distribution over all events, channel and depth.</h3>" << std::endl;
4538     htmlFileT << "<h4> Legend: Bins less " << MIN_M[6][sub] << " and more " << MAX_M[6][sub]
4539               << " correpond to bad position </h4>" << std::endl;
4540     if (sub == 1)
4541       htmlFileT << " <img src=\"HistMaxPosHB.png\" />" << std::endl;
4542     if (sub == 2)
4543       htmlFileT << " <img src=\"HistMaxPosHE.png\" />" << std::endl;
4544     if (sub == 3)
4545       htmlFileT << " <img src=\"HistMaxPosHO.png\" />" << std::endl;
4546     if (sub == 4)
4547       htmlFileT << " <img src=\"HistMaxPosHF.png\" />" << std::endl;
4548     htmlFileT << "<br>" << std::endl;
4549     htmlFileT << "<h3> 6.B. Rate of bad TX position  (<" << MIN_M[6][sub] << ", >" << MAX_M[6][sub]
4550               << ") in each channel for each depth. </h3>" << std::endl;
4551     htmlFileT << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4552     if (sub == 1)
4553       htmlFileT << " <img src=\"MapRateMaxPosHB.png\" />" << std::endl;
4554     if (sub == 2)
4555       htmlFileT << " <img src=\"MapRateMaxPosHE.png\" />" << std::endl;
4556     if (sub == 3)
4557       htmlFileT << " <img src=\"MapRateMaxPosHO.png\" />" << std::endl;
4558     if (sub == 4)
4559       htmlFileT << " <img src=\"MapRateMaxPosHF.png\" />" << std::endl;
4560     htmlFileT << "<br>" << std::endl;
4561 
4562     htmlFileT << "</body> " << std::endl;
4563     htmlFileT << "</html> " << std::endl;
4564     htmlFileT.close();
4565 
4566     //Calibration channels
4567     htmlFileC << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
4568     htmlFileC << "<head>" << std::endl;
4569     htmlFileC << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
4570     htmlFileC << "<title> Raw Data Analyser </title>" << std::endl;
4571     htmlFileC << "<style type=\"text/css\">" << std::endl;
4572     htmlFileC << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
4573               << std::endl;
4574     htmlFileC << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
4575     htmlFileC << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
4576                  "text-align: center;}"
4577               << std::endl;
4578     htmlFileC << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
4579     htmlFileC << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
4580     htmlFileC << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
4581     htmlFileC << "</style>" << std::endl;
4582     htmlFileC << "<body>" << std::endl;
4583 
4584     if (sub == 1)
4585       htmlFileC << "<h1> Criteria for calibration channels for HB, RUN = " << runnumber << " </h1>" << std::endl;
4586     if (sub == 2)
4587       htmlFileC << "<h1> Criteria for calibration channels for HE, RUN = " << runnumber << " </h1>" << std::endl;
4588     if (sub == 3)
4589       htmlFileC << "<h1> Criteria for calibration channels for HO, RUN = " << runnumber << " </h1>" << std::endl;
4590     if (sub == 4)
4591       htmlFileC << "<h1> Criteria for calibration channels for HF, RUN = " << runnumber << " </h1>" << std::endl;
4592     htmlFileC << "<br>" << std::endl;
4593 
4594     // Test Entries
4595 
4596     htmlFileC << "<h2> 0. Entries for each channel.</h3>" << std::endl;
4597     htmlFileC << "<h3> 0.A. Entries in each channel for each depth.</h3>" << std::endl;
4598     htmlFileC << "<h4> Channel legend: color is rate of entries </h4>" << std::endl;
4599     if (sub == 1)
4600       htmlFileC << " <img src=\"MapRateCalibEntryHB.png\" />" << std::endl;
4601     if (sub == 2)
4602       htmlFileC << " <img src=\"MapRateCalibEntryHE.png\" />" << std::endl;
4603     if (sub == 3)
4604       htmlFileC << " <img src=\"MapRateCalibEntryHO.png\" />" << std::endl;
4605     if (sub == 4)
4606       htmlFileC << " <img src=\"MapRateCalibEntryHF.png\" />" << std::endl;
4607     htmlFileC << "<br>" << std::endl;
4608 
4609     // Test Cc
4610     htmlFileC << "<h2> 1. Cc criterion: CapID errors for each channel.</h3>" << std::endl;
4611     htmlFileC << "<h3> 1.A. Rate of CapId failures in each channel for each depth.</h3>" << std::endl;
4612     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4613     if (sub == 1)
4614       htmlFileC << " <img src=\"MapRateCapCalibHB.png\" />" << std::endl;
4615     if (sub == 2)
4616       htmlFileC << " <img src=\"MapRateCapCalibHE.png\" />" << std::endl;
4617     if (sub == 3)
4618       htmlFileC << " <img src=\"MapRateCapCalibHO.png\" />" << std::endl;
4619     if (sub == 4)
4620       htmlFileC << " <img src=\"MapRateCapCalibHF.png\" />" << std::endl;
4621     htmlFileC << "<br>" << std::endl;
4622 
4623     // Ac
4624     htmlFileC << "<h2> 2. Ac criterion: ADC amplitude collected over all TSs(Full Amplitude) for each channel. </h3>"
4625               << std::endl;
4626     htmlFileC << "<h3> 2.A. Full ADC amplitude distribution over all events, channels and depths.</h3>" << std::endl;
4627     htmlFileC << "<h4> Legend: Bins less " << MIN_C[2][sub] << " correpond to bad ADC amplitude </h4>" << std::endl;
4628     if (sub == 1)
4629       htmlFileC << " <img src=\"HistAmplCalibHB.png\" />" << std::endl;
4630     if (sub == 2)
4631       htmlFileC << " <img src=\"HistAmplCalibHE.png\" />" << std::endl;
4632     if (sub == 3)
4633       htmlFileC << " <img src=\"HistAmplCalibHO.png\" />" << std::endl;
4634     if (sub == 4)
4635       htmlFileC << " <img src=\"HistAmplCalibHF.png\" />" << std::endl;
4636     htmlFileC << "<br>" << std::endl;
4637     htmlFileC << "<h3> 2.B. Rate of bad ADC amplitude (<" << MIN_C[2][sub] << ") in each channel for each depth. </h3>"
4638               << std::endl;
4639     htmlFileC << "<h4> Channel legend: white - good, other colours - bad. </h4>" << std::endl;
4640     if (sub == 1)
4641       htmlFileC << " <img src=\"MapRateAmplCalibHB.png\" />" << std::endl;
4642     if (sub == 2)
4643       htmlFileC << " <img src=\"MapRateAmplCalibHE.png\" />" << std::endl;
4644     if (sub == 3)
4645       htmlFileC << " <img src=\"MapRateAmplCalibHO.png\" />" << std::endl;
4646     if (sub == 4)
4647       htmlFileC << " <img src=\"MapRateAmplCalibHF.png\" />" << std::endl;
4648     htmlFileC << "<br>" << std::endl;
4649 
4650     // Test Wc
4651     htmlFileC << "<h2> 3. Wc criterion: RMS (width) of ADC amplutude for each channel.</h3>" << std::endl;
4652     htmlFileC << "<h3> 3.A. W distribution over all events, channel and depth.</h3>" << std::endl;
4653     htmlFileC << "<h4> Legend: Bins less " << MIN_C[3][sub] << " and more " << MAX_C[3][sub]
4654               << " correpond to bad RMS </h4>" << std::endl;
4655     if (sub == 1)
4656       htmlFileC << " <img src=\"HistRMSCalibHB.png\" />" << std::endl;
4657     if (sub == 2)
4658       htmlFileC << " <img src=\"HistRMSCalibHE.png\" />" << std::endl;
4659     if (sub == 3)
4660       htmlFileC << " <img src=\"HistRMSCalibHO.png\" />" << std::endl;
4661     if (sub == 4)
4662       htmlFileC << " <img src=\"HistRMSCalibHF.png\" />" << std::endl;
4663     htmlFileC << "<br>" << std::endl;
4664     htmlFileC << "<h3> 3.B. Rate of bad W (<" << MIN_C[3][sub] << ",>" << MAX_C[3][sub]
4665               << ") in each channel for each depth.</h3>" << std::endl;
4666     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4667     if (sub == 1)
4668       htmlFileC << " <img src=\"MapRateRMSCalibHB.png\" />" << std::endl;
4669     if (sub == 2)
4670       htmlFileC << " <img src=\"MapRateRMSCalibHE.png\" />" << std::endl;
4671     if (sub == 3)
4672       htmlFileC << " <img src=\"MapRateRMSCalibHO.png\" />" << std::endl;
4673     if (sub == 4)
4674       htmlFileC << " <img src=\"MapRateRMSCalibHF.png\" />" << std::endl;
4675     htmlFileC << "<br>" << std::endl;
4676 
4677     // Rc
4678     htmlFileC << "<h2> 4. Rc criterion: Ratio ADC value sum over five near maximum (-2, -1, max, +1, +2) TS to ADC "
4679                  "value sum over all TS for each channel. </h3>"
4680               << std::endl;
4681     htmlFileC << "<h3> 4.A. Ratio distribution over all events, channels and depths.</h3>" << std::endl;
4682     htmlFileC << "<h4> Legend: Bins less " << MIN_C[4][sub] << " and more " << MAX_C[4][sub]
4683               << " correpond to bad ratio </h4>" << std::endl;
4684     if (sub == 1)
4685       htmlFileC << " <img src=\"Hist43TStoAllTSCalibHB.png\" />" << std::endl;
4686     if (sub == 2)
4687       htmlFileC << " <img src=\"Hist43TStoAllTSCalibHE.png\" />" << std::endl;
4688     if (sub == 3)
4689       htmlFileC << " <img src=\"Hist43TStoAllTSCalibHO.png\" />" << std::endl;
4690     if (sub == 4)
4691       htmlFileC << " <img src=\"Hist43TStoAllTSCalibHF.png\" />" << std::endl;
4692     htmlFileC << "<br>" << std::endl;
4693     htmlFileC << "<h3> 4.B. Rate of bad Ratio (<" << MIN_C[4][sub] << ", >" << MAX_C[4][sub]
4694               << ") in each channel for each depth.</h3>" << std::endl;
4695     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4696     if (sub == 1)
4697       htmlFileC << " <img src=\"MapRate43TStoAllTSCalibHB.png\" />" << std::endl;
4698     if (sub == 2)
4699       htmlFileC << " <img src=\"MapRate43TStoAllTSCalibHE.png\" />" << std::endl;
4700     if (sub == 3)
4701       htmlFileC << " <img src=\"MapRate43TStoAllTSCalibHO.png\" />" << std::endl;
4702     if (sub == 4)
4703       htmlFileC << " <img src=\"MapRate43TStoAllTSCalibHF.png\" />" << std::endl;
4704     htmlFileC << "<br>" << std::endl;
4705 
4706     // TNc
4707     htmlFileC << "<h2> 5. TNc criterion: Mean TS position for each channel.</h3>" << std::endl;
4708     htmlFileC << "<h3> 5.A. TN position distribution over all events, channels and depths.</h3>" << std::endl;
4709     htmlFileC << "<h4> Legend: Bins less " << MIN_C[5][sub] << " and more " << MAX_C[5][sub]
4710               << " correpond to bad position </h4>" << std::endl;
4711     if (sub == 1)
4712       htmlFileC << " <img src=\"HistMeanPosCalibHB.png\" />" << std::endl;
4713     if (sub == 2)
4714       htmlFileC << " <img src=\"HistMeanPosCalibHE.png\" />" << std::endl;
4715     if (sub == 3)
4716       htmlFileC << " <img src=\"HistMeanPosCalibHO.png\" />" << std::endl;
4717     if (sub == 4)
4718       htmlFileC << " <img src=\"HistMeanPosCalibHF.png\" />" << std::endl;
4719     htmlFileC << "<br>" << std::endl;
4720     htmlFileC << "<h3> 5.B. Rate of bad TN position  (<" << MIN_C[5][sub] << ", >" << MAX_C[5][sub]
4721               << ") in each channel for each depth. </h3>" << std::endl;
4722     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4723     if (sub == 1)
4724       htmlFileC << " <img src=\"MapRateMeanPosCalibHB.png\" />" << std::endl;
4725     if (sub == 2)
4726       htmlFileC << " <img src=\"MapRateMeanPosCalibHE.png\" />" << std::endl;
4727     if (sub == 3)
4728       htmlFileC << " <img src=\"MapRateMeanPosCalibHO.png\" />" << std::endl;
4729     if (sub == 4)
4730       htmlFileC << " <img src=\"MapRateMeanPosCalibHF.png\" />" << std::endl;
4731     htmlFileC << "<br>" << std::endl;
4732 
4733     // TXm
4734     htmlFileC << "<h2> 6.TXc criterion: Maximum TS position for each channel.</h3>" << std::endl;
4735     htmlFileC << "<h3> 6.A. TX position distribution over all events, channel and depth.</h3>" << std::endl;
4736     htmlFileC << "<h4> Legend: Bins less " << MIN_C[6][sub] << " and more " << MAX_C[6][sub]
4737               << " correpond to bad position </h4>" << std::endl;
4738     if (sub == 1)
4739       htmlFileC << " <img src=\"HistMaxPosCalibHB.png\" />" << std::endl;
4740     if (sub == 2)
4741       htmlFileC << " <img src=\"HistMaxPosCalibHE.png\" />" << std::endl;
4742     if (sub == 3)
4743       htmlFileC << " <img src=\"HistMaxPosCalibHO.png\" />" << std::endl;
4744     if (sub == 4)
4745       htmlFileC << " <img src=\"HistMaxPosCalibHF.png\" />" << std::endl;
4746     htmlFileC << "<br>" << std::endl;
4747     htmlFileC << "<h3> 6.B. Rate of bad TX position  (<" << MIN_C[6][sub] << ", >" << MAX_C[6][sub]
4748               << ") in each channel for each depth. </h3>" << std::endl;
4749     htmlFileC << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4750     if (sub == 1)
4751       htmlFileC << " <img src=\"MapRateMaxPosCalibHB.png\" />" << std::endl;
4752     if (sub == 2)
4753       htmlFileC << " <img src=\"MapRateMaxPosCalibHE.png\" />" << std::endl;
4754     if (sub == 3)
4755       htmlFileC << " <img src=\"MapRateMaxPosCalibHO.png\" />" << std::endl;
4756     if (sub == 4)
4757       htmlFileC << " <img src=\"MapRateMaxPosCalibHF.png\" />" << std::endl;
4758     htmlFileC << "<br>" << std::endl;
4759 
4760     htmlFileC << "</body> " << std::endl;
4761     htmlFileC << "</html> " << std::endl;
4762     htmlFileC.close();
4763 
4764     //Response drift
4765     htmlFileD << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
4766     htmlFileD << "<head>" << std::endl;
4767     htmlFileD << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
4768     htmlFileD << "<title> Remore Monitoring Tool </title>" << std::endl;
4769     htmlFileD << "<style type=\"text/css\">" << std::endl;
4770     htmlFileD << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
4771               << std::endl;
4772     htmlFileD << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
4773     htmlFileD << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
4774                  "text-align: center;}"
4775               << std::endl;
4776     htmlFileD << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
4777     htmlFileD << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
4778     htmlFileD << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
4779     htmlFileD << "</style>" << std::endl;
4780     htmlFileD << "<body>" << std::endl;
4781 
4782     if (sub == 1)
4783       htmlFileD << "<h1> Response drift for HB: Current RUN = " << runnumber << ", Reference RUN = " << refrunnumber
4784                 << " </h1>" << std::endl;
4785     if (sub == 2)
4786       htmlFileD << "<h1> Response drift for HE: Current RUN = " << runnumber << ", Reference RUN = " << refrunnumber
4787                 << " </h1>" << std::endl;
4788     if (sub == 3)
4789       htmlFileD << "<h1> Response drift for HO: Current RUN = " << runnumber << ", Reference RUN = " << refrunnumber
4790                 << " </h1>" << std::endl;
4791     if (sub == 4)
4792       htmlFileD << "<h1> Response drift for HF: Current RUN = " << runnumber << ", Reference RUN = " << refrunnumber
4793                 << " </h1>" << std::endl;
4794     htmlFileD << "<br>" << std::endl;
4795 
4796     // test GS
4797     htmlFileD << "<h2> 1. Gain Stability (GS) </h3>" << std::endl;
4798     htmlFileD << "<h3> 1.A. Averaged channel response, collected over all TS, for Current run in each channel for each "
4799                  "depth.</h3>"
4800               << std::endl;
4801     htmlFileD << "<h4> Channel legend: colour means cooresponding value of mean response. </h4>" << std::endl;
4802     if (sub == 1)
4803       htmlFileD << " <img src=\"MapRateAmpl1HB.png\" />" << std::endl;
4804     if (sub == 2)
4805       htmlFileD << " <img src=\"MapRateAmpl1HE.png\" />" << std::endl;
4806     if (sub == 3)
4807       htmlFileD << " <img src=\"MapRateAmpl1HO.png\" />" << std::endl;
4808     if (sub == 4)
4809       htmlFileD << " <img src=\"MapRateAmpl1HF.png\" />" << std::endl;
4810     htmlFileD << "<br>" << std::endl;
4811     htmlFileD << "<h3> 1.B. Averaged channel response, collected over all TS, for Reference run in each channel for "
4812                  "each depth.</h3>"
4813               << std::endl;
4814     htmlFileD << "<h4> Channel legend: colour means cooresponding value of mean response. </h4>" << std::endl;
4815     if (sub == 1)
4816       htmlFileD << " <img src=\"MapRateAmpl2HB.png\" />" << std::endl;
4817     if (sub == 2)
4818       htmlFileD << " <img src=\"MapRateAmpl2HE.png\" />" << std::endl;
4819     if (sub == 3)
4820       htmlFileD << " <img src=\"MapRateAmpl2HO.png\" />" << std::endl;
4821     if (sub == 4)
4822       htmlFileD << " <img src=\"MapRateAmpl2HF.png\" />" << std::endl;
4823     htmlFileD << "<br>" << std::endl;
4824     htmlFileD << "<h3> 1.C. Relative difference between Current and Reference run distribution over all events, "
4825                  "channels for each depth.</h3>"
4826               << std::endl;
4827     htmlFileD << "<h4>  Legend: Bins less -" << porog[sub] << "% and more +" << porog[sub]
4828               << "% correpond to bad relative difference position </h4>" << std::endl;
4829     if (sub == 1)
4830       htmlFileD << " <img src=\"HistAmplDriftDepthHB.png\" />" << std::endl;
4831     if (sub == 2)
4832       htmlFileD << " <img src=\"HistAmplDriftDepthHE.png\" />" << std::endl;
4833     if (sub == 3)
4834       htmlFileD << " <img src=\"HistAmplDriftDepthHO.png\" />" << std::endl;
4835     if (sub == 4)
4836       htmlFileD << " <img src=\"HistAmplDriftDepthHF.png\" />" << std::endl;
4837     htmlFileD << "<br>" << std::endl;
4838     htmlFileD << "<h3> 1.D. Rate of bad relative difference  (<-" << porog[sub] << ", >+" << porog[sub]
4839               << ") in each channel for each depth.</h3>" << std::endl;
4840     htmlFileD << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4841     if (sub == 1)
4842       htmlFileD << " <img src=\"MapRateAmplDriftHB.png\" />" << std::endl;
4843     if (sub == 2)
4844       htmlFileD << " <img src=\"MapRateAmplDriftHE.png\" />" << std::endl;
4845     if (sub == 3)
4846       htmlFileD << " <img src=\"MapRateAmplDriftHO.png\" />" << std::endl;
4847     if (sub == 4)
4848       htmlFileD << " <img src=\"MapRateAmplDriftHF.png\" />" << std::endl;
4849     htmlFileD << "<br>" << std::endl;
4850 
4851     htmlFileD << "</body> " << std::endl;
4852     htmlFileD << "</html> " << std::endl;
4853     htmlFileD.close();
4854 
4855     // Pedestals
4856     htmlFileP << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
4857     htmlFileP << "<head>" << std::endl;
4858     htmlFileP << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
4859     htmlFileP << "<title> Remote Monitoring Tool </title>" << std::endl;
4860     htmlFileP << "<style type=\"text/css\">" << std::endl;
4861     htmlFileP << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
4862               << std::endl;
4863     htmlFileP << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
4864     htmlFileP << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
4865                  "text-align: center;}"
4866               << std::endl;
4867     htmlFileP << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
4868     htmlFileP << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
4869     htmlFileP << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
4870     htmlFileP << "</style>" << std::endl;
4871     htmlFileP << "<body>" << std::endl;
4872 
4873     if (sub == 1)
4874       htmlFileP << "<h1> Pedestals for HB, RUN = " << runnumber << " </h1>" << std::endl;
4875     if (sub == 2)
4876       htmlFileP << "<h1> Pedestals for HE, RUN = " << runnumber << " </h1>" << std::endl;
4877     if (sub == 3)
4878       htmlFileP << "<h1> Pedestals for HO, RUN = " << runnumber << " </h1>" << std::endl;
4879     if (sub == 4)
4880       htmlFileP << "<h1> Pedestals for HF, RUN = " << runnumber << " </h1>" << std::endl;
4881     htmlFileP << "<br>" << std::endl;
4882 
4883     // Pedestal:
4884     htmlFileP << "<h2> 1.Pm criterion: Pedestals for each CapID .</h3>" << std::endl;
4885     htmlFileP << "<h3> 1.A. Pedestal distribution over all events, channels for each CapID and all depths.</h3>"
4886               << std::endl;
4887     htmlFileP << "<h4> Legend: Bins less " << Pedest[0][sub] << " correpond to bad Pedestals </h4>" << std::endl;
4888     if (sub == 1)
4889       htmlFileP << " <img src=\"HistPedestalsHB.png\" />" << std::endl;
4890     if (sub == 2)
4891       htmlFileP << " <img src=\"HistPedestalsHE.png\" />" << std::endl;
4892     if (sub == 3)
4893       htmlFileP << " <img src=\"HistPedestalsHO.png\" />" << std::endl;
4894     if (sub == 4)
4895       htmlFileP << " <img src=\"HistPedestalsHF.png\" />" << std::endl;
4896     htmlFileP << "<br>" << std::endl;
4897     htmlFileP << "<h3> 1.B. Rate of channels at very low Pedestals at least in one CapID for each depth.</h3>"
4898               << std::endl;
4899     htmlFileP << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4900     if (sub == 1)
4901       htmlFileP << " <img src=\"MapRatePedHB.png\" />" << std::endl;
4902     if (sub == 2)
4903       htmlFileP << " <img src=\"MapRatePedHE.png\" />" << std::endl;
4904     if (sub == 3)
4905       htmlFileP << " <img src=\"MapRatePedHO.png\" />" << std::endl;
4906     if (sub == 4)
4907       htmlFileP << " <img src=\"MapRatePedHF.png\" />" << std::endl;
4908 
4909     // PedestalWidth:
4910     htmlFileP << "<h2> 2.pWm criterion: Pedestal Widths for each CapID .</h3>" << std::endl;
4911     htmlFileP << "<h3> 2.A. Pedestal Widths distribution over all events, channels for each CapID and all depths.</h3>"
4912               << std::endl;
4913     htmlFileP << "<h4> Legend: Bins less " << Pedest[1][sub] << " correpond to bad Pedestal Widths </h4>" << std::endl;
4914     if (sub == 1)
4915       htmlFileP << " <img src=\"HistPedestalWidthsHB.png\" />" << std::endl;
4916     if (sub == 2)
4917       htmlFileP << " <img src=\"HistPedestalWidthsHE.png\" />" << std::endl;
4918     if (sub == 3)
4919       htmlFileP << " <img src=\"HistPedestalWidthsHO.png\" />" << std::endl;
4920     if (sub == 4)
4921       htmlFileP << " <img src=\"HistPedestalWidthsHF.png\" />" << std::endl;
4922     htmlFileP << "<br>" << std::endl;
4923     htmlFileP << "<h3> 2.B. Rate of channels at very low Pedestal Widths at least in one CapID for each depth.</h3>"
4924               << std::endl;
4925     htmlFileP << "<h4> Channel legend: white - good, other colour - bad. </h4>" << std::endl;
4926     if (sub == 1)
4927       htmlFileP << " <img src=\"MapRatePedWidthsHB.png\" />" << std::endl;
4928     if (sub == 2)
4929       htmlFileP << " <img src=\"MapRatePedWidthsHE.png\" />" << std::endl;
4930     if (sub == 3)
4931       htmlFileP << " <img src=\"MapRatePedWidthsHO.png\" />" << std::endl;
4932     if (sub == 4)
4933       htmlFileP << " <img src=\"MapRatePedWidthsHF.png\" />" << std::endl;
4934 
4935     // Correlations of Pedestal(Width) and fullAmplitude:
4936     htmlFileP << "<h2> 3.Pedestal and pedestalWidths vs Amplitude .</h3>" << std::endl;
4937     htmlFileP << "<h3> 3.A. Correlation of Pedestal(pedestalWidths) and Amplitude over all channels and events .</h3>"
4938               << std::endl;
4939     htmlFileP << "<h4> Legend: colour - entries </h4>" << std::endl;
4940     if (sub == 1)
4941       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHB.png\" />" << std::endl;
4942     if (sub == 2)
4943       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHE.png\" />" << std::endl;
4944     if (sub == 3)
4945       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHO.png\" />" << std::endl;
4946     if (sub == 4)
4947       htmlFileP << "<img src=\"CorrelationsMapPedestalVsfullAmplitudeHF.png\" />" << std::endl;
4948     htmlFileP << "<br>" << std::endl;
4949     htmlFileP.close();
4950 
4951     // TSs Shapes:
4952 
4953     htmlFileS << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
4954     htmlFileS << "<head>" << std::endl;
4955     htmlFileS << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
4956     htmlFileS << "<title> Remote Monitoring Tool </title>" << std::endl;
4957     htmlFileS << "<style type=\"text/css\">" << std::endl;
4958     htmlFileS << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
4959               << std::endl;
4960     htmlFileS << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
4961     htmlFileS << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
4962                  "text-align: center;}"
4963               << std::endl;
4964     htmlFileS << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
4965     htmlFileS << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
4966     htmlFileS << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
4967     htmlFileS << "</style>" << std::endl;
4968     htmlFileS << "<body>" << std::endl;
4969 
4970     if (sub == 1)
4971       htmlFileS << "<h1> ADC Shape for HB, RUN = " << runnumber << " </h1>" << std::endl;
4972     if (sub == 2)
4973       htmlFileS << "<h1> ADC Shape for HE, RUN = " << runnumber << " </h1>" << std::endl;
4974     if (sub == 3)
4975       htmlFileS << "<h1> ADC Shape for HO, RUN = " << runnumber << " </h1>" << std::endl;
4976     if (sub == 4)
4977       htmlFileS << "<h1> ADC Shape for HF, RUN = " << runnumber << " </h1>" << std::endl;
4978     htmlFileS << "<br>" << std::endl;
4979 
4980     htmlFileS << "<h2> 1.Mean ADC Shape.</h3>" << std::endl;
4981     htmlFileS << "<h3> 1.A. ADC shape averaged over all good channels, depth and events.</h3>" << std::endl;
4982     //     htmlFileS << "<h4> Legend: Bins less "<<Pedest[0][sub]<<" correpond to bad Pedestals </h4>"<< std::endl;
4983     if (sub == 1)
4984       htmlFileS << " <img src=\"HistGoodTSshapesHB.png\" />" << std::endl;
4985     if (sub == 2)
4986       htmlFileS << " <img src=\"HistGoodTSshapesHE.png\" />" << std::endl;
4987     if (sub == 3)
4988       htmlFileS << " <img src=\"HistGoodTSshapesHO.png\" />" << std::endl;
4989     if (sub == 4)
4990       htmlFileS << " <img src=\"HistGoodTSshapesHF.png\" />" << std::endl;
4991     htmlFileS << "<br>" << std::endl;
4992     htmlFileS << "<h3> 1.B. ADC shape averaged over all bad channels, depth and events. Bad channels are selected by 5 "
4993                  "criteria: CapId, A, W, P, Pw </h3>"
4994               << std::endl;
4995     //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
4996     if (sub == 1)
4997       htmlFileS << " <img src=\"HistBadTSshapesHB.png\" />" << std::endl;
4998     if (sub == 2)
4999       htmlFileS << " <img src=\"HistBadTSshapesHE.png\" />" << std::endl;
5000     if (sub == 3)
5001       htmlFileS << " <img src=\"HistBadTSshapesHO.png\" />" << std::endl;
5002     if (sub == 4)
5003       htmlFileS << " <img src=\"HistBadTSshapesHF.png\" />" << std::endl;
5004     /*
5005    htmlFileS << "<h2> 2. ADC in Time Slice </h3>"<< std::endl;
5006      htmlFileS << "<h3> 2.A. ADC counts  histogrammed over all channels, depth and events.</h3>"<< std::endl; 
5007 //     htmlFileS << "<h4> Legend: Bins less "<<Pedest[0][sub]<<" correpond to bad Pedestals </h4>"<< std::endl; 
5008      if (sub==1) htmlFileS << " <img src=\"Hist_ADC_HB_All.png\" />" << std::endl;
5009      if (sub==2) htmlFileS << " <img src=\"Hist_ADC_HE_All.png\" />" << std::endl;    
5010      if (sub==3) htmlFileS << " <img src=\"Hist_ADC_HO_All.png\" />" << std::endl;
5011      if (sub==4) htmlFileS << " <img src=\"Hist_ADC_HF_All.png\" />" << std::endl;
5012      htmlFileS << "<br>"<< std::endl;
5013      htmlFileS << "<h3> 2.B. ADC counts  histogrammed over all channels and events for each depth separately. </h3>"<< std::endl; 
5014 //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5015      if (sub==1) htmlFileS << " <img src=\"Hist_ADC_HB_DS.png\" />" << std::endl;
5016      if (sub==2) htmlFileS << " <img src=\"Hist_ADC_HE_DS.png\" />" << std::endl;
5017      if (sub==3) htmlFileS << " <img src=\"Hist_ADC_HO_DS.png\" />" << std::endl;
5018      if (sub==4) htmlFileS << " <img src=\"Hist_ADC_HF_DS.png\" />" << std::endl;
5019 
5020      htmlFileS << "<h2> 3. ADC Sum in Time Slice </h3>"<< std::endl;
5021      htmlFileS << "<h3> 3.A. ADC Sum over all channels histogrammed over all events for each depth separately. </h3>"<< std::endl; 
5022 //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5023      if (sub==1) htmlFileS << " <img src=\"Hist_SumADC_HB.png\" />" << std::endl;
5024      if (sub==2) htmlFileS << " <img src=\"Hist_SumADC_HE.png\" />" << std::endl;
5025      if (sub==3) htmlFileS << " <img src=\"Hist_SumADC_HO.png\" />" << std::endl;
5026      if (sub==4) htmlFileS << " <img src=\"Hist_SumADC_HF.png\" />" << std::endl;
5027 
5028      htmlFileS << "<h3> 3.B. ADC Sum over all channels histogrammed over all events for each depth separately. </h3>"<< std::endl; 
5029 //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5030      if (sub==1) htmlFileS << " <img src=\"Hist_SumADC_HB0.png\" />" << std::endl;
5031      if (sub==2) htmlFileS << " <img src=\"Hist_SumADC_HE0.png\" />" << std::endl;
5032      if (sub==3) htmlFileS << " <img src=\"Hist_SumADC_HO0.png\" />" << std::endl;
5033      if (sub==4) htmlFileS << " <img src=\"Hist_SumADC_HF0.png\" />" << std::endl;
5034 
5035      htmlFileS << "<h3> 3.C. ADC Sum over all channels histogrammed over all events for each depth separately. </h3>"<< std::endl; 
5036 //     htmlFileS << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5037      if (sub==1) htmlFileS << " <img src=\"Hist_SumADC_HB1.png\" />" << std::endl;
5038      if (sub==2) htmlFileS << " <img src=\"Hist_SumADC_HE1.png\" />" << std::endl;
5039      if (sub==3) htmlFileS << " <img src=\"Hist_SumADC_HO1.png\" />" << std::endl;
5040      if (sub==4) htmlFileS << " <img src=\"Hist_SumADC_HF1.png\" />" << std::endl;
5041 */
5042     htmlFileS.close();
5043 
5044     ///////////////////////////////////////////
5045 
5046     // Iteration Method for Calibration Group:
5047 
5048     htmlFileM << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
5049     htmlFileM << "<head>" << std::endl;
5050     htmlFileM << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
5051     htmlFileM << "<title> Remote Monitoring Tool </title>" << std::endl;
5052     htmlFileM << "<style type=\"text/css\">" << std::endl;
5053     htmlFileM << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
5054               << std::endl;
5055     htmlFileM << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
5056     htmlFileM << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
5057                  "text-align: center;}"
5058               << std::endl;
5059     htmlFileM << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
5060     htmlFileM << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
5061     htmlFileM << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
5062     htmlFileM << "</style>" << std::endl;
5063     htmlFileM << "<body>" << std::endl;
5064 
5065     if (sub == 1)
5066       htmlFileM << "<h1> Iteration Method for Calibration Group, HB, RUN = " << runnumber << " </h1>" << std::endl;
5067     if (sub == 2)
5068       htmlFileM << "<h1> Iteration Method for Calibration Group, HE, RUN = " << runnumber << " </h1>" << std::endl;
5069     if (sub == 3)
5070       htmlFileM << "<h1> Iteration Method for Calibration Group, HO, RUN = " << runnumber << " </h1>" << std::endl;
5071     if (sub == 4)
5072       htmlFileM << "<h1> Iteration Method for Calibration Group, HF, RUN = " << runnumber << " </h1>" << std::endl;
5073     htmlFileM << "<br>" << std::endl;
5074 
5075     htmlFileM << "<h2> 1:  Positive direction, R = R_depth_ieta_iphi = E_depth_ieta_iphi/E_depth_ieta </h3>"
5076               << std::endl;
5077 
5078     htmlFileM << "<h3> 1.A. eta/phi-plot: R, averaged over depthes </h3>" << std::endl;
5079     //     htmlFileM << "<h4> Legend: Bins less "<<Pedest[0][sub]<<" correpond to bad Pedestals </h4>"<< std::endl;
5080     if (sub == 1)
5081       htmlFileM << " <img src=\"Rhist2IterationMethodHB.png\" />" << std::endl;
5082     if (sub == 2)
5083       htmlFileM << " <img src=\"Rhist2IterationMethodHE.png\" />" << std::endl;
5084     if (sub == 3)
5085       htmlFileM << " <img src=\"Rhist2IterationMethodHO.png\" />" << std::endl;
5086     if (sub == 4)
5087       htmlFileM << " <img src=\"Rhist2IterationMethodHF.png\" />" << std::endl;
5088     htmlFileM << "<br>" << std::endl;
5089 
5090     htmlFileM << "<h3> 1B: R vs phi , averaged over depthes & eta </h3>" << std::endl;
5091     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5092     if (sub == 1)
5093       htmlFileM << " <img src=\"Rhist1IterationMethodHB.png\" />" << std::endl;
5094     if (sub == 2)
5095       htmlFileM << " <img src=\"Rhist1IterationMethodHE.png\" />" << std::endl;
5096     if (sub == 3)
5097       htmlFileM << " <img src=\"Rhist1IterationMethodHO.png\" />" << std::endl;
5098     if (sub == 4)
5099       htmlFileM << " <img src=\"Rhist1IterationMethodHF.png\" />" << std::endl;
5100     htmlFileM << "<br>" << std::endl;
5101 
5102     /////////////////////////////////////////////// different Depthes:
5103 
5104     htmlFileM << "<h3> 1C: R vs phi , different eta, Depth1 </h3>" << std::endl;
5105     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5106     if (sub == 1)
5107       htmlFileM << " <img src=\"Rhist1IterationMethodDepth1HB.png\" />" << std::endl;
5108     if (sub == 2)
5109       htmlFileM << " <img src=\"Rhist1IterationMethodDepth1HE.png\" />" << std::endl;
5110     if (sub == 4)
5111       htmlFileM << " <img src=\"Rhist1IterationMethodDepth1HF.png\" />" << std::endl;
5112     htmlFileM << "<br>" << std::endl;
5113 
5114     htmlFileM << "<h3> 1D: R vs phi , different eta, Depth2 </h3>" << std::endl;
5115     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5116     if (sub == 1)
5117       htmlFileM << " <img src=\"Rhist1IterationMethodDepth2HB.png\" />" << std::endl;
5118     if (sub == 2)
5119       htmlFileM << " <img src=\"Rhist1IterationMethodDepth2HE.png\" />" << std::endl;
5120     if (sub == 4)
5121       htmlFileM << " <img src=\"Rhist1IterationMethodDepth2HF.png\" />" << std::endl;
5122     htmlFileM << "<br>" << std::endl;
5123 
5124     htmlFileM << "<h3> 1E: R vs phi , different eta, Depth3 </h3>" << std::endl;
5125     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5126     if (sub == 1)
5127       htmlFileM << " <img src=\"Rhist1IterationMethodDepth3HB.png\" />" << std::endl;
5128     if (sub == 2)
5129       htmlFileM << " <img src=\"Rhist1IterationMethodDepth3HE.png\" />" << std::endl;
5130     if (sub == 4)
5131       htmlFileM << " <img src=\"Rhist1IterationMethodDepth3HF.png\" />" << std::endl;
5132     htmlFileM << "<br>" << std::endl;
5133 
5134     htmlFileM << "<h3> 1F: R vs phi , different eta, Depth4 </h3>" << std::endl;
5135     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5136     if (sub == 1)
5137       htmlFileM << " <img src=\"Rhist1IterationMethodDepth4HB.png\" />" << std::endl;
5138     if (sub == 2)
5139       htmlFileM << " <img src=\"Rhist1IterationMethodDepth4HE.png\" />" << std::endl;
5140     if (sub == 3)
5141       htmlFileM << " <img src=\"Rhist1IterationMethodDepth4HO.png\" />" << std::endl;
5142     if (sub == 4)
5143       htmlFileM << " <img src=\"Rhist1IterationMethodDepth4HF.png\" />" << std::endl;
5144     htmlFileM << "<br>" << std::endl;
5145 
5146     htmlFileM << "<h3> 1G: R vs phi , different eta, Depth5 </h3>" << std::endl;
5147     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5148     if (sub == 2)
5149       htmlFileM << " <img src=\"Rhist1IterationMethodDepth5HE.png\" />" << std::endl;
5150     htmlFileM << "<br>" << std::endl;
5151 
5152     htmlFileM << "<h3> 1H: R vs phi , different eta, Depth6 </h3>" << std::endl;
5153     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5154     if (sub == 2)
5155       htmlFileM << " <img src=\"Rhist1IterationMethodDepth6HE.png\" />" << std::endl;
5156     htmlFileM << "<br>" << std::endl;
5157 
5158     htmlFileM << "<h3> 1I: R vs phi , different eta, Depth7 </h3>" << std::endl;
5159     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5160     if (sub == 2)
5161       htmlFileM << " <img src=\"Rhist1IterationMethodDepth7HE.png\" />" << std::endl;
5162     htmlFileM << "<br>" << std::endl;
5163 
5164     htmlFileM << "<h2> 2: Positive direction,   D(variance)   </h3>" << std::endl;
5165 
5166     htmlFileM << "<h3> 2A: eta/phi-plot: D(variance), averaged over depthes </h3>" << std::endl;
5167     //     htmlFileM << "<h4> Legend: Bins less "<<Pedest[0][sub]<<" correpond to bad Pedestals </h4>"<< std::endl;
5168     if (sub == 1)
5169       htmlFileM << " <img src=\"Dhist2IterationMethodHB.png\" />" << std::endl;
5170     if (sub == 2)
5171       htmlFileM << " <img src=\"Dhist2IterationMethodHE.png\" />" << std::endl;
5172     if (sub == 3)
5173       htmlFileM << " <img src=\"Dhist2IterationMethodHO.png\" />" << std::endl;
5174     if (sub == 4)
5175       htmlFileM << " <img src=\"Dhist2IterationMethodHF.png\" />" << std::endl;
5176     htmlFileM << "<br>" << std::endl;
5177 
5178     htmlFileM << "<h3> 2B: D(variance) vs phi , averaged over depthes & eta </h3>" << std::endl;
5179     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5180     if (sub == 1)
5181       htmlFileM << " <img src=\"Dhist1IterationMethodHB.png\" />" << std::endl;
5182     if (sub == 2)
5183       htmlFileM << " <img src=\"Dhist1IterationMethodHE.png\" />" << std::endl;
5184     if (sub == 3)
5185       htmlFileM << " <img src=\"Dhist1IterationMethodHO.png\" />" << std::endl;
5186     if (sub == 4)
5187       htmlFileM << " <img src=\"Dhist1IterationMethodHF.png\" />" << std::endl;
5188     htmlFileM << "<br>" << std::endl;
5189 
5190     /////////////////////////////////////////////// different Depthes:
5191 
5192     htmlFileM << "<h3> 2C: D(variance) vs phi , different eta, Depth1 </h3>" << std::endl;
5193     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5194     if (sub == 1)
5195       htmlFileM << " <img src=\"Dhist1IterationMethodDepth1HB.png\" />" << std::endl;
5196     if (sub == 2)
5197       htmlFileM << " <img src=\"Dhist1IterationMethodDepth1HE.png\" />" << std::endl;
5198     if (sub == 4)
5199       htmlFileM << " <img src=\"Dhist1IterationMethodDepth1HF.png\" />" << std::endl;
5200     htmlFileM << "<br>" << std::endl;
5201 
5202     htmlFileM << "<h3> 2.D. D(variance) vs phi , different eta, Depth2 </h3>" << std::endl;
5203     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5204     if (sub == 1)
5205       htmlFileM << " <img src=\"Dhist1IterationMethodDepth2HB.png\" />" << std::endl;
5206     if (sub == 2)
5207       htmlFileM << " <img src=\"Dhist1IterationMethodDepth2HE.png\" />" << std::endl;
5208     if (sub == 4)
5209       htmlFileM << " <img src=\"Dhist1IterationMethodDepth2HF.png\" />" << std::endl;
5210     htmlFileM << "<br>" << std::endl;
5211 
5212     htmlFileM << "<h3> 2E: D(variance) vs phi , different eta, Depth3 </h3>" << std::endl;
5213     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5214     if (sub == 1)
5215       htmlFileM << " <img src=\"Dhist1IterationMethodDepth3HB.png\" />" << std::endl;
5216     if (sub == 2)
5217       htmlFileM << " <img src=\"Dhist1IterationMethodDepth3HE.png\" />" << std::endl;
5218     if (sub == 4)
5219       htmlFileM << " <img src=\"Dhist1IterationMethodDepth3HF.png\" />" << std::endl;
5220     htmlFileM << "<br>" << std::endl;
5221 
5222     htmlFileM << "<h3> 2F: D(variance) vs phi , different eta, Depth4 </h3>" << std::endl;
5223     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5224     if (sub == 1)
5225       htmlFileM << " <img src=\"Dhist1IterationMethodDepth4HB.png\" />" << std::endl;
5226     if (sub == 2)
5227       htmlFileM << " <img src=\"Dhist1IterationMethodDepth4HE.png\" />" << std::endl;
5228     if (sub == 3)
5229       htmlFileM << " <img src=\"Dhist1IterationMethodDepth4HO.png\" />" << std::endl;
5230     if (sub == 4)
5231       htmlFileM << " <img src=\"Dhist1IterationMethodDepth4HF.png\" />" << std::endl;
5232     htmlFileM << "<br>" << std::endl;
5233 
5234     htmlFileM << "<h3> 2G: D(variance) vs phi , different eta, Depth5 </h3>" << std::endl;
5235     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5236     if (sub == 2)
5237       htmlFileM << " <img src=\"Dhist1IterationMethodDepth5HE.png\" />" << std::endl;
5238     htmlFileM << "<br>" << std::endl;
5239 
5240     htmlFileM << "<h3> 2H: D(variance) vs phi , different eta, Depth6 </h3>" << std::endl;
5241     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5242     if (sub == 2)
5243       htmlFileM << " <img src=\"Dhist1IterationMethodDepth6HE.png\" />" << std::endl;
5244     htmlFileM << "<br>" << std::endl;
5245 
5246     htmlFileM << "<h3> 2I: D(variance) vs phi , different eta, Depth7 </h3>" << std::endl;
5247     //     htmlFileM << "<h4> Channel legend: white - good, other colour - bad. </h4>"<< std::endl;
5248     if (sub == 2)
5249       htmlFileM << " <img src=\"Dhist1IterationMethodDepth7HE.png\" />" << std::endl;
5250     htmlFileM << "<br>" << std::endl;
5251 
5252     htmlFileM.close();
5253 
5254     ///////////////////////////////////////////
5255     //
5256     //
5257   }  // end sub  //for (int sub=1;sub<=4;sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
5258 
5259   //======================================================================
5260 
5261   std::cout << "********" << std::endl;
5262   std::cout << "************    Start creating subdet  html pages: - rather long time needed, waiting please"
5263             << std::endl;
5264   //======================================================================
5265   // Creating subdet  html pages:
5266 
5267   for (int sub = 1; sub <= 4; sub++) {  //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
5268     ofstream htmlFile;
5269     if (sub == 1)
5270       htmlFile.open("HB.html");
5271     if (sub == 2)
5272       htmlFile.open("HE.html");
5273     if (sub == 3)
5274       htmlFile.open("HO.html");
5275     if (sub == 4)
5276       htmlFile.open("HF.html");
5277 
5278     htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
5279     htmlFile << "<head>" << std::endl;
5280     htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
5281     htmlFile << "<title> Remote Monitoring Tool </title>" << std::endl;
5282     htmlFile << "<style type=\"text/css\">" << std::endl;
5283     htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
5284              << std::endl;
5285     htmlFile << "   td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
5286     htmlFile << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
5287                 "text-align: center;}"
5288              << std::endl;
5289     htmlFile << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
5290     htmlFile << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
5291     htmlFile << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
5292     htmlFile << "   td.s5 { font-family: arial, arial ce, helvetica; background-color: #FF00FF; }" << std::endl;
5293     htmlFile << "   td.s6 { font-family: arial, arial ce, helvetica; background-color: #9ACD32; }" << std::endl;
5294     htmlFile << "   td.s7 { font-family: arial, arial ce, helvetica; background-color: #32CD32; }" << std::endl;
5295     htmlFile << "   td.s8 { font-family: arial, arial ce, helvetica; background-color: #00FFFF; }" << std::endl;
5296     htmlFile << "   td.s9 { font-family: arial, arial ce, helvetica; background-color: #FFE4E1; }" << std::endl;
5297     htmlFile << "   td.s10 { font-family: arial, arial ce, helvetica; background-color: #A0522D; }" << std::endl;
5298     htmlFile << "   td.s11 { font-family: arial, arial ce, helvetica; background-color: #1E90FF; }" << std::endl;
5299     htmlFile << "   td.s12 { font-family: arial, arial ce, helvetica; background-color: #00BFFF; }" << std::endl;
5300     htmlFile << "   td.s13 { font-family: arial, arial ce, helvetica; background-color: #FFFF00; }" << std::endl;
5301     htmlFile << "   td.s14 { font-family: arial, arial ce, helvetica; background-color: #B8860B; }" << std::endl;
5302     htmlFile << "</style>" << std::endl;
5303     htmlFile << "<body>" << std::endl;
5304     if (sub == 1)
5305       htmlFile << "<h1> HCAL BARREL, RUN = " << runnumber << " </h1>" << std::endl;
5306     if (sub == 2)
5307       htmlFile << "<h1> HCAL ENDCAP, RUN = " << runnumber << " </h1>" << std::endl;
5308     if (sub == 3)
5309       htmlFile << "<h1> HCAL OUTER, RUN = " << runnumber << " </h1>" << std::endl;
5310     if (sub == 4)
5311       htmlFile << "<h1> HCAL FORWARD, RUN = " << runnumber << " </h1>" << std::endl;
5312     htmlFile << "<br>" << std::endl;
5313     if (sub == 1)
5314       htmlFile << "<h2> 1. Analysis results for HB</h2>" << std::endl;
5315     if (sub == 2)
5316       htmlFile << "<h2> 1. Analysis results for HE</h2>" << std::endl;
5317     if (sub == 3)
5318       htmlFile << "<h2> 1. Analysis results for HO</h2>" << std::endl;
5319     if (sub == 4)
5320       htmlFile << "<h2> 1. Analysis results for HF</h2>" << std::endl;
5321     htmlFile << "<table width=\"600\">" << std::endl;
5322     htmlFile << "<tr>" << std::endl;
5323 
5324     if (sub == 1) {
5325       /*
5326        htmlFile << "  <td><a href=\"HB_Tile.html\">Megatile Channels</a></td>"<< std::endl;
5327        htmlFile << "  <td><a href=\"HB_Calib.html\">Calibration Channels</a></td>"<< std::endl;
5328        htmlFile << "  <td><a href=\"HB_Drift.html\">Gain Stability</a></td>"<< std::endl;
5329        htmlFile << "  <td><a href=\"HB_Pedestals.html\">Pedestals</a></td>"<< std::endl;
5330        htmlFile << "  <td><a href=\"HB_Shapes.html\">ADC Shapes</a></td>"<< std::endl;
5331 */
5332 
5333       htmlFile << "  <td><a "
5334                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5335                   "HcalRemoteMonitoring/RMT/LED_"
5336                << runnumber << "/HB_Tile.html\">Megatile Channels</a></td>" << std::endl;
5337       htmlFile << "  <td><a "
5338                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5339                   "HcalRemoteMonitoring/RMT/LED_"
5340                << runnumber << "/HB_Calib.html\">Calibration Channels</a></td>" << std::endl;
5341       htmlFile << "  <td><a "
5342                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5343                   "HcalRemoteMonitoring/RMT/LED_"
5344                << runnumber << "/HB_Drift.html\">Gain Stability</a></td>" << std::endl;
5345       htmlFile << "  <td><a "
5346                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5347                   "HcalRemoteMonitoring/RMT/LED_"
5348                << runnumber << "/HB_Pedestals.html\">Pedestals</a></td>" << std::endl;
5349       htmlFile << "  <td><a "
5350                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5351                   "HcalRemoteMonitoring/RMT/LED_"
5352                << runnumber << "/HB_Shapes.html\">ADC Shapes</a></td>" << std::endl;
5353     }
5354     if (sub == 2) {
5355       /*
5356        htmlFile << "  <td><a href=\"HE_Tile.html\">Megatile Channels</a></td>"<< std::endl;
5357        htmlFile << "  <td><a href=\"HE_Calib.html\">Calibration Channels</a></td>"<< std::endl;
5358        htmlFile << "  <td><a href=\"HE_Drift.html\">Gain Stability</a></td>"<< std::endl;
5359        htmlFile << "  <td><a href=\"HE_Pedestals.html\">Pedestals</a></td>"<< std::endl;
5360        htmlFile << "  <td><a href=\"HE_Shapes.html\">ADC Shapes</a></td>"<< std::endl;
5361        htmlFile << "  <td><a href=\"HE_IterationMethod.html\">Iteration Method</a></td>"<< std::endl;
5362 */
5363 
5364       htmlFile << "  <td><a "
5365                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5366                   "HcalRemoteMonitoring/RMT/LED_"
5367                << runnumber << "/HE_Tile.html\">Megatile Channels</a></td>" << std::endl;
5368       htmlFile << "  <td><a "
5369                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5370                   "HcalRemoteMonitoring/RMT/LED_"
5371                << runnumber << "/HE_Calib.html\">Calibration Channels</a></td>" << std::endl;
5372       htmlFile << "  <td><a "
5373                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5374                   "HcalRemoteMonitoring/RMT/LED_"
5375                << runnumber << "/HE_Drift.html\">Gain Stability</a></td>" << std::endl;
5376       htmlFile << "  <td><a "
5377                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5378                   "HcalRemoteMonitoring/RMT/LED_"
5379                << runnumber << "/HE_Pedestals.html\">Pedestals</a></td>" << std::endl;
5380       htmlFile << "  <td><a "
5381                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5382                   "HcalRemoteMonitoring/RMT/LED_"
5383                << runnumber << "/HE_Shapes.html\">ADC Shapes</a></td>" << std::endl;
5384       htmlFile << "  <td><a "
5385                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5386                   "HcalRemoteMonitoring/RMT/LED_"
5387                << runnumber << "/HE_IterationMethod.html\">Iteration Method</a></td>" << std::endl;
5388     }
5389 
5390     if (sub == 3) {
5391       /*
5392        htmlFile << "  <td><a href=\"HO_Tile.html\">Megatile Channels</a></td>"<< std::endl;
5393        htmlFile << "  <td><a href=\"HO_Calib.html\">Calibration Channels</a></td>"<< std::endl;
5394        htmlFile << "  <td><a href=\"HO_Drift.html\">Gain Stability</a></td>"<< std::endl;
5395        htmlFile << "  <td><a href=\"HO_Pedestals.html\">Pedestals</a></td>"<< std::endl;
5396        htmlFile << "  <td><a href=\"HO_Shapes.html\">ADC Shapes</a></td>"<< std::endl;
5397        */
5398       htmlFile << "  <td><a "
5399                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5400                   "HcalRemoteMonitoring/RMT/LED_"
5401                << runnumber << "/HO_Tile.html\">Megatile Channels</a></td>" << std::endl;
5402       htmlFile << "  <td><a "
5403                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5404                   "HcalRemoteMonitoring/RMT/LED_"
5405                << runnumber << "/HO_Calib.html\">Calibration Channels</a></td>" << std::endl;
5406       htmlFile << "  <td><a "
5407                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5408                   "HcalRemoteMonitoring/RMT/LED_"
5409                << runnumber << "/HO_Drift.html\">Gain Stability</a></td>" << std::endl;
5410       htmlFile << "  <td><a "
5411                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5412                   "HcalRemoteMonitoring/RMT/LED_"
5413                << runnumber << "/HO_Pedestals.html\">Pedestals</a></td>" << std::endl;
5414       htmlFile << "  <td><a "
5415                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5416                   "HcalRemoteMonitoring/RMT/LED_"
5417                << runnumber << "/HO_Shapes.html\">ADC Shapes</a></td>" << std::endl;
5418     }
5419     if (sub == 4) {
5420       /*
5421        htmlFile << "  <td><a href=\"HF_Tile.html\">Megatile Channels</a></td>"<< std::endl;
5422        htmlFile << "  <td><a href=\"HF_Calib.html\">Calibration Channels</a></td>"<< std::endl;
5423        htmlFile << "  <td><a href=\"HF_Drift.html\">Gain Stability</a></td>"<< std::endl;
5424        htmlFile << "  <td><a href=\"HF_Pedestals.html\">Pedestals</a></td>"<< std::endl;
5425        htmlFile << "  <td><a href=\"HF_Shapes.html\">ADC Shapes</a></td>"<< std::endl;
5426        */
5427       htmlFile << "  <td><a "
5428                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5429                   "HcalRemoteMonitoring/RMT/LED_"
5430                << runnumber << "/HF_Tile.html\">Megatile Channels</a></td>" << std::endl;
5431       htmlFile << "  <td><a "
5432                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5433                   "HcalRemoteMonitoring/RMT/LED_"
5434                << runnumber << "/HF_Calib.html\">Calibration Channels</a></td>" << std::endl;
5435       htmlFile << "  <td><a "
5436                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5437                   "HcalRemoteMonitoring/RMT/LED_"
5438                << runnumber << "/HF_Drift.html\">Gain Stability</a></td>" << std::endl;
5439       htmlFile << "  <td><a "
5440                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5441                   "HcalRemoteMonitoring/RMT/LED_"
5442                << runnumber << "/HF_Pedestals.html\">Pedestals</a></td>" << std::endl;
5443       htmlFile << "  <td><a "
5444                   "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5445                   "HcalRemoteMonitoring/RMT/LED_"
5446                << runnumber << "/HF_Shapes.html\">ADC Shapes</a></td>" << std::endl;
5447     }
5448 
5449     htmlFile << "</tr>" << std::endl;
5450     htmlFile << "</table>" << std::endl;
5451     htmlFile << "<br>" << std::endl;
5452     if (sub == 1)
5453       htmlFile << "<h2> 2.Status HB over all criteria </h2>" << std::endl;
5454     if (sub == 2)
5455       htmlFile << "<h2> 2.Status HE over all criteria </h2>" << std::endl;
5456     if (sub == 3)
5457       htmlFile << "<h2> 2.Status HO over all criteria </h2>" << std::endl;
5458     if (sub == 4)
5459       htmlFile << "<h2> 2.Status HF over all criteria </h2>" << std::endl;
5460     htmlFile << "<h3> 2.A.Channel map for each Depth </h3>" << std::endl;
5461     htmlFile << "<h4> Channel legend: green - good, red - bad (rate of failures at least 0.1), yellow - at least 2% "
5462                 "gain drift, white - not applicable or out of range </h4>"
5463              << std::endl;
5464     if (sub == 1)
5465       htmlFile << " <img src=\"MAPHB.png\" />" << std::endl;
5466     if (sub == 2)
5467       htmlFile << " <img src=\"MAPHE.png\" />" << std::endl;
5468     if (sub == 3)
5469       htmlFile << " <img src=\"MAPHO.png\" />" << std::endl;
5470     if (sub == 4)
5471       htmlFile << " <img src=\"MAPHF.png\" />" << std::endl;
5472     htmlFile << "<br>" << std::endl;
5473 
5474     htmlFile << "<h3> 2.B.List of Bad channels (rate > 0.1) and its rates for each RMT criteria (for GS - %) </h3>"
5475              << std::endl;
5476 
5477     //   htmlFile << "  <td><a href=\"HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
5478     htmlFile << "  <td><a "
5479                 "href=\"https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/"
5480                 "HcalRemoteMonitoring/RMT/LED_"
5481              << runnumber << "/HELP.html\"> Description of criteria for bad channel selection</a></td>" << std::endl;
5482 
5483     htmlFile << "<table>" << std::endl;
5484     htmlFile << "<tr>";
5485     htmlFile << "<td class=\"s4\" align=\"center\">#</td>" << std::endl;
5486     htmlFile << "<td class=\"s1\" align=\"center\">ETA</td>" << std::endl;
5487     htmlFile << "<td class=\"s1\" align=\"center\">PHI</td>" << std::endl;
5488     htmlFile << "<td class=\"s1\" align=\"center\">DEPTH</td>" << std::endl;
5489     htmlFile << "<td class=\"s1\" align=\"center\">RBX</td>" << std::endl;
5490     htmlFile << "<td class=\"s1\" align=\"center\">RM</td>" << std::endl;
5491     htmlFile << "<td class=\"s1\" align=\"center\">PIXEL</td>" << std::endl;
5492     htmlFile << "<td class=\"s1\" align=\"center\">RM_FIBER</td>" << std::endl;
5493     htmlFile << "<td class=\"s1\" align=\"center\">FIBER_CH</td>" << std::endl;
5494     htmlFile << "<td class=\"s1\" align=\"center\">QIE</td>" << std::endl;
5495     htmlFile << "<td class=\"s1\" align=\"center\">ADC</td>" << std::endl;
5496     htmlFile << "<td class=\"s1\" align=\"center\">CRATE</td>" << std::endl;
5497     htmlFile << "<td class=\"s1\" align=\"center\">DCC</td>" << std::endl;
5498     htmlFile << "<td class=\"s1\" align=\"center\">SPIGOT</td>" << std::endl;
5499     htmlFile << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>" << std::endl;
5500     htmlFile << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>" << std::endl;
5501     htmlFile << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>" << std::endl;
5502     htmlFile << "<td class=\"s5\" align=\"center\">Cm</td>" << std::endl;
5503     htmlFile << "<td class=\"s5\" align=\"center\">Am</td>" << std::endl;
5504     htmlFile << "<td class=\"s5\" align=\"center\">Wm</td>" << std::endl;
5505     htmlFile << "<td class=\"s5\" align=\"center\">Rm</td>" << std::endl;
5506     htmlFile << "<td class=\"s5\" align=\"center\">TNm</td>" << std::endl;
5507     htmlFile << "<td class=\"s5\" align=\"center\">TXm</td>" << std::endl;
5508     htmlFile << "<td class=\"s9\" align=\"center\">GS (%)</td>" << std::endl;
5509     htmlFile << "<td class=\"s4\" align=\"center\">Pm</td>" << std::endl;
5510     htmlFile << "<td class=\"s4\" align=\"center\">pWm</td>" << std::endl;
5511     htmlFile << "<td class=\"s8\" align=\"center\">Cc</td>" << std::endl;
5512     htmlFile << "<td class=\"s8\" align=\"center\">Ac</td>" << std::endl;
5513     htmlFile << "<td class=\"s8\" align=\"center\">Wc</td>" << std::endl;
5514     htmlFile << "<td class=\"s8\" align=\"center\">Rc</td>" << std::endl;
5515     htmlFile << "<td class=\"s8\" align=\"center\">TNc</td>" << std::endl;
5516     htmlFile << "<td class=\"s8\" align=\"center\">TXc</td>" << std::endl;
5517 
5518     htmlFile << "</tr>" << std::endl;
5519 
5520     for (int i = 1; i <= NBad; i++) {
5521       if ((ind % 2) == 1) {
5522         raw_class = "<td class=\"s2\" align=\"center\">";
5523         raw_class1 = "<td class=\"s6\" align=\"center\">";
5524         raw_class2 = "<td class=\"s11\" align=\"center\">";
5525         raw_class3 = "<td class=\"s13\" align=\"center\">";
5526 
5527       } else {
5528         raw_class = "<td class=\"s3\" align=\"center\">";
5529         raw_class1 = "<td class=\"s7\" align=\"center\">";
5530         raw_class2 = "<td class=\"s12\" align=\"center\">";
5531         raw_class3 = "<td class=\"s14\" align=\"center\">";
5532       }
5533       const CellDB db;
5534       CellDB ce;
5535       if ((ce.size() >= 1) && (Sub[2][i] == sub)) {
5536         if (Sub[2][i] == 1) {
5537           ce = db.find("subdet", "HB").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
5538           if (ce.size() == 0) {
5539             //      cout<<"Error: No such HB, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;
5540             continue;
5541           } else if (ce.size() > 1) {
5542             cout << "Warning: More than one line correspond to such HB, Eta=" << Eta[2][i] << ", Phi=" << Phi[2][i]
5543                  << ", Depth=" << Depth[2][i] << " in database" << endl;
5544           }
5545         }
5546         if (Sub[2][i] == 2) {
5547           ce = db.find("subdet", "HE").find("Eta", Eta[2][i]).find("Phi", Phi[2][i]).find("Depth", Depth[2][i]);
5548           if (ce.size() == 0) {
5549             //      cout<<"Error: No such HE, Eta="<< Eta[2][i] <<", Phi="<< Phi[2][i] <<", Depth="<< Depth[2][i] <<" in database"<<endl;
5550             continue;
5551           } else