Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:31

0001 #include <iostream>
0002 #include <fstream>
0003 #include "TROOT.h"
0004 #include <TMath.h>
0005 #include "TStyle.h"
0006 #include "TSystem.h"
0007 #include "TLegend.h"
0008 #include "TText.h"
0009 #include "TAxis.h"
0010 #include "TFile.h"
0011 #include "TLine.h"
0012 #include "TGraph.h"
0013 #include <TPaveText.h>
0014 #include <TPostScript.h>
0015 #include <TClass.h>
0016 #include "TH1.h"
0017 #include "TH2.h"
0018 #include "TCanvas.h"
0019 
0020 //
0021 using namespace std;
0022 //
0023 //
0024 
0025 //inline void HERE(const char *msg) { std::cout << msg << std::endl; }
0026 
0027 int main(int argc, char* argv[]) {
0028   //======================================================================
0029   printf("reco: gROOT Reset \n");
0030   gROOT->Reset();
0031   gROOT->SetStyle("Plain");
0032   gStyle->SetOptStat(0);  //  no statistics _or_
0033   //                  gStyle->SetOptStat(11111111);
0034   //gStyle->SetOptStat(1101);// name mean and rms
0035   //    gStyle->SetOptStat(0101);// name and entries
0036   //       gStyle->SetOptStat(1100);// mean and rms only !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0037   //    gStyle->SetOptStat(1110000);// und over, integral !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0038   //    gStyle->SetOptStat(101110);                                          // entries, mean, rms, overflow !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0039   //    gStyle->SetOptStat(100000);//  over !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0040   //
0041   //gStyle->SetOptFit(00010);// constant, mean and sigma only !!
0042   //    gStyle->SetOptFit(00001);// hi2/nu, constant, mean and sigma only !!
0043   //    gStyle->SetOptFit(0010);// constant, mean and sigma only !!
0044   //    gStyle->SetOptFit(00011);// constant, mean and sigma only !!
0045   // gStyle->SetOptFit(1101);
0046   //       gStyle->SetOptFit(1011);
0047   //
0048   //gStyle->SetStatX(0.98);
0049   //gStyle->SetStatY(0.99);
0050   //gStyle->SetStatW(0.30);
0051   //gStyle->SetStatH(0.25);
0052   gStyle->SetStatX(0.91);
0053   gStyle->SetStatY(0.75);
0054   gStyle->SetStatW(0.20);
0055   gStyle->SetStatH(0.10);
0056   // gStyle->SetStatH(0.35);
0057   //
0058 
0059   //        Float_t LeftOffset = 0.12;
0060   //Float_t TopOffset = 0.12;
0061   Float_t LeftOffset = 0.12;
0062   Float_t TopOffset = 0.22;
0063 
0064   gStyle->SetLineWidth(1);
0065   gStyle->SetErrorX(0);
0066 
0067   //---=[ Titles,Labels ]=-----------
0068   gStyle->SetOptTitle(0);  // title on/off
0069   //      gStyle->SetTitleColor(0);           // title color
0070   gStyle->SetTitleColor(1);  // title color
0071   //      gStyle->SetTitleX(0.35);            // title x-position
0072   gStyle->SetTitleX(0.15);  // title x-position
0073   gStyle->SetTitleH(0.15);  // title height
0074   //      gStyle->SetTitleW(0.53);            // title width
0075   gStyle->SetTitleW(0.60);         // title width
0076   gStyle->SetTitleFont(42);        // title font
0077   gStyle->SetTitleFontSize(0.07);  // title font size
0078 
0079   gStyle->SetPalette(1);
0080   //---=[ Histogram style ]=----------
0081   //        gStyle->SetHistFillColor(38);
0082   //            gStyle->SetFrameFillColor(41);// jelto-kori4nev-svetl
0083   //    gStyle->SetFrameFillColor(5);// jeltyi
0084   //    gStyle->SetFrameFillColor(17);// seryi
0085   //    gStyle->SetFrameFillColor(18);// svetlo seryi
0086   //    gStyle->SetFrameFillColor(20);// svetlo kori4nev
0087   //        gStyle->SetFrameFillColor(33);// sine-seryi
0088   //    gStyle->SetFrameFillColor(40);// fiolet-seryi
0089   //    gStyle->SetFrameFillColor(23);// sv.kor
0090 
0091   //---=[ Pad style ]=----------------
0092   gStyle->SetPadTopMargin(TopOffset);
0093   gStyle->SetPadBottomMargin(LeftOffset);
0094   gStyle->SetPadRightMargin(TopOffset);
0095   gStyle->SetPadLeftMargin(LeftOffset);
0096   //---=[ SetCanvasDef           ]=----------------
0097   //======================================================================
0098   //
0099   // Connect the input file and get the 2-d histogram in memory
0100   //======================================================================
0101   //  TBrowser *b = new TBrowser
0102 
0103   //    TFile *hfile1= new TFile("/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/CMTweb/histos/Global_234556.root", "READ");
0104   ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0105 
0106   //////////////////////////////////////////////////////////////////////////////// normal gap 321177:
0107   //    TFile *hfile1= new TFile("Global_321177_41.root", "READ");
0108   //    TFile *hfile1= new TFile("Global_321177_ls1to600.root", "READ");
0109   //    TFile *hfile1= new TFile("Global_321177_ls1to600.root_no41", "READ");
0110   //    TFile *hfile1= new TFile("Global_RBX_321177_ls1to600.root", "READ");
0111 
0112   //////////////////////////////////////////////////////////////////////////////// normal gap 325001:
0113   //    TFile *hfile1= new TFile("Global_325001_ls1to600.root", "READ");
0114   //    TFile *hfile1= new TFile("Global_RBX_325001_40.root", "READ");
0115   //    TFile *hfile1= new TFile("Global_RBX_325001_ls1to600.root", "READ");
0116 
0117   //    TFile *hfile1= new TFile("Global_RBX_325001.root", "READ");
0118 
0119   //    TFile *hfile1= new TFile("Global_321624_1.root", "READ");
0120   //    TFile *hfile1= new TFile("Global_321625.root", "READ");
0121   //    TFile *hfile1= new TFile("Global_321313.root", "READ");
0122 
0123   //////////////////////////////////////////////////////////////////////////////// abort gap:
0124   //    TFile *hfile1= new TFile("Global_321177_41_abortgap.root", "READ");
0125   //    TFile *hfile1= new TFile("Global_321177_ls1to600_abortgap.root", "READ");
0126   //    TFile *hfile1= new TFile("Global_321177_ls1to600_abortgap_no41.root", "READ");
0127   //    TFile *hfile1= new TFile("Global_325001_ls1to600_abortgap.root", "READ");
0128 
0129   TFile* hfile1 = new TFile("Global_RBX_325001.root", "READ");
0130   //    TFile *hfile1= new TFile("Global_RBX_321177.root", "READ");
0131 
0132   //    TFile *hfile1= new TFile("Global_321758.root", "READ");
0133   //    TFile *hfile1= new TFile("Global_321773.root", "READ");
0134   //    TFile *hfile1= new TFile("Global_321774.root", "READ");
0135   //    TFile *hfile1= new TFile("Global_321775.root", "READ");
0136 
0137   ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0138   //    getchar();
0139   //
0140   TPostScript psfile("zlsgainstabilityCMT.ps", 111);
0141   //
0142   TCanvas* c1 = new TCanvas("c1", "Hcal4test", 200, 10, 700, 900);
0143   //========================================================================================== 1
0144   //======================================================================
0145   //======================================================================
0146   //================
0147   //======================================================================
0148   c1->Clear();
0149   c1->Divide(1, 2);
0150 
0151   c1->cd(1);
0152   TH1F* Rate1 = (TH1F*)hfile1->Get("h_nevents_per_eachRealLS");
0153 
0154   //      gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
0155   //      Rate1->SetXTitle("nevents_per_eachRealLS \b");
0156   //      Rate1->Draw("");
0157 
0158   int maxbins = 0;
0159   int nx = Rate1->GetXaxis()->GetNbins();
0160   for (int i = 1; i <= nx; i++) {
0161     double ccc1 = Rate1->GetBinContent(i);
0162     if (ccc1 > 0.) {
0163       maxbins = i;
0164       if (i > maxbins)
0165         maxbins = i;
0166     }
0167     //  if(ccc1>0.) cout<<" ibin=     "<< i <<" nevents=     "<< ccc1 <<endl;
0168   }
0169   cout << "111 maxbins=     " << maxbins << endl;
0170   /////////////////////////////////////////////////////////////////////////////////////////////////////////
0171   TH1F* ADCAmplperLS = new TH1F("ADCAmplperLS", "", maxbins, 1., maxbins + 1.);
0172   //          TH1F* ADCAmplperLS  = new TH1F("ADCAmplperLS ","", 600, 1.,601.);
0173   nx = Rate1->GetXaxis()->GetNbins();
0174   for (int i = 1; i <= maxbins; i++) {
0175     double ccc1 = Rate1->GetBinContent(i);
0176     //    if(ccc1>0.)     cout<<" depth1_HB iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
0177     //  cout<<" ibin=     "<< i <<" nevents=     "<< ccc1 <<endl;
0178     //    if(ccc1>0.) ADCAmplperLS ->Fill(float(i), ccc1);
0179     ADCAmplperLS->Fill(float(i), ccc1);
0180   }
0181   //      gPad->SetLogy();
0182   ADCAmplperLS->SetMarkerStyle(20);
0183   ADCAmplperLS->SetMarkerSize(0.4);
0184   ADCAmplperLS->GetYaxis()->SetLabelSize(0.04);
0185   ADCAmplperLS->SetXTitle("nevents_per_eachRealLS \b");
0186   ADCAmplperLS->SetMarkerColor(2);
0187   ADCAmplperLS->SetLineColor(0);
0188   //          ADCAmplperLS ->SetMaximum(30.0);
0189   //          ADCAmplperLS ->SetMinimum(20.0);
0190   ADCAmplperLS->Draw("Error");
0191 
0192   c1->cd(2);
0193 
0194   TH1F* Rate2 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_lscounterM1");  // 0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0195   //      TH1F *Rate2= (TH1F*)hfile1->Get("h_nevents_per_eachRealLS");// norm: no 0
0196   //    TH1F *Rate2= (TH1F*)hfile1->Get("h_sumADCAmplperLS1");//Fill( float(lscounterM1) ,bbbc);// norm: no 0
0197   //     TH1F *Rate2= (TH1F*)hfile1->Get("h_sum0ADCAmplperLS2");//Fill( float(lscounterM1) ,bbb1);// norm: no 0
0198 
0199   TH1F* Rate2redone = new TH1F("Rate2redone", "", maxbins, 1., maxbins + 1.);
0200   //    for (int i=1;i<=Rate2->GetXaxis()->GetNbins();i++) {
0201   for (int i = 1; i <= maxbins; i++) {
0202     double ccc1 = Rate2->GetBinContent(i);
0203     //if(ccc1 <= 0. )               cout<<"1 Page  i=  "<< i <<"      A= "<< ccc1 <<endl;
0204     //  cout<<"1 Page  i=  "<< i <<"      A= "<< ccc1 <<endl;
0205     Rate2redone->Fill(float(i), ccc1);
0206     //  if(ccc1>0.) Rate2redone ->Fill(float(i), ccc1);
0207   }
0208   Rate2redone->SetMarkerStyle(20);
0209   Rate2redone->SetMarkerSize(0.4);
0210   Rate2redone->GetYaxis()->SetLabelSize(0.04);
0211   Rate2redone->SetXTitle("sumADCAmplEtaPhiLsS \b");
0212   Rate2redone->SetMarkerColor(2);
0213   Rate2redone->SetLineColor(0);
0214   // Rate2redone ->SetMaximum(30.0);Rate2redone ->SetMinimum(20.0);
0215   Rate2redone->Draw("Error");
0216 
0217   c1->Update();
0218 
0219   //========================================================================================== 2
0220   //======================================================================
0221   //======================================================================
0222   //================
0223   //======================================================================
0224   c1->Clear();
0225   c1->Divide(2, 2);
0226 
0227   c1->cd(1);
0228   TH1F* Rate3 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_bbbc");
0229   gPad->SetLogy();
0230   gPad->SetGridy();
0231   gPad->SetGridx();
0232   Rate3->SetXTitle("bbbc sumADCAmplEtaPhiLs \b");
0233   Rate3->Draw("");
0234 
0235   c1->cd(2);
0236   TH1F* Rate4 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_bbb1");
0237   gPad->SetLogy();
0238   gPad->SetGridy();
0239   gPad->SetGridx();
0240   Rate4->SetXTitle("bbb1 sumADCAmplEtaPhiLs \b");
0241   Rate4->Draw("");
0242 
0243   c1->cd(3);
0244   TH1F* Rate5 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs");
0245   gPad->SetLogy();
0246   gPad->SetGridy();
0247   gPad->SetGridx();
0248   Rate5->SetXTitle("bbb3 sumADCAmplEtaPhiLs \b");
0249   Rate5->Draw("");
0250 
0251   c1->cd(4);
0252   TH1F* Rate6 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_ietaphi");
0253   gPad->SetLogy();
0254   gPad->SetGridy();
0255   gPad->SetGridx();
0256   Rate6->SetXTitle("ietaphi sumADCAmplEtaPhiLs \b");
0257   Rate6->Draw("");
0258 
0259   c1->Update();
0260   //========================================================================================== 3
0261   //======================================================================
0262   //======================================================================
0263   //================
0264   //======================================================================
0265   c1->Clear();
0266   c1->Divide(1, 1);
0267   //  h_2DsumADCAmplEtaPhiLs00->Fill(float(lscounterM1), float(ietaphi), bbb1);//HB
0268   //     h_2D0sumADCAmplLS1->Fill(double(ieta), double(k3), bbb1);
0269   c1->cd(1);
0270   TH2F* Cefz2 = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs0");
0271   //TH2F *Cefz2= (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs00");
0272   //    TH2F *Cefz2= (TH2F*)hfile1->Get("h_2D0sumADCAmplLS1");
0273   gPad->SetGridy();
0274   gPad->SetGridx();
0275   //      gPad->SetLogz();
0276   Cefz2->SetMarkerStyle(20);
0277   Cefz2->SetMarkerSize(0.4);
0278   //    Cefz2->GetYaxis()->SetLabelSize(0.04);
0279   Cefz2->GetZaxis()->SetLabelSize(0.08);
0280   Cefz2->SetXTitle("nv0-overAllLSs test with  HB1  #eta \b");
0281   Cefz2->SetYTitle("#phi  \b");
0282   //    Cefz2->SetZTitle("<A>  - HB Depth1 \b");
0283   Cefz2->SetMarkerColor(2);
0284   Cefz2->SetLineColor(2);
0285   //      Cefz2->SetMaximum(1.000);
0286   //      Cefz2->SetMinimum(1.0);
0287   Cefz2->Draw("COLZ");
0288 
0289   c1->Update();
0290   //======================================================================
0291   //======================================================================
0292   //========================================================================================== 4
0293   //======================================================================
0294   //======================================================================
0295   //================
0296   //======================================================================
0297   c1->Clear();
0298   c1->Divide(1, 1);
0299 
0300   c1->cd(1);
0301   int maxbinx = 0;
0302   int maxbiny = 0;
0303   nx = Cefz2->GetXaxis()->GetNbins();
0304   nx = maxbins;
0305   int ny = Cefz2->GetYaxis()->GetNbins();
0306   cout << "444 HB1        nx=     " << nx << " ny=     " << ny << endl;
0307   //    TH1F* ADCAmplLSHB1 = new TH1F("ADCAmplLSHB1","", 1000, 0., 1000000.);
0308   //    TH1F* ADCAmplLSHB1 = new TH1F("ADCAmplLSHB1","", 1000, 0., 1000.);
0309   TH2F* ADCAmplLSHB1 = new TH2F("ADCAmplLSHB1", "", 610, 0., 610., 160, 120., 280.);
0310   for (int i = 1; i <= nx; i++) {
0311     for (int j = 1; j <= ny; j++) {
0312       double ccc1 = Cefz2->GetBinContent(i, j);
0313       //      if(ccc1>0.) {
0314       if (j > 130 && j < 270) {
0315         maxbinx = i;
0316         if (i > maxbinx)
0317           maxbinx = i;
0318         maxbiny = j;
0319         if (j > maxbiny)
0320           maxbiny = j;
0321         //      if(ccc1 <= 0. )             cout<<"HB1:  ibin=  "<< i <<"      jbin= "<< j <<"      A= "<< ccc1 <<endl;
0322         //      ADCAmplLSHB1 ->Fill(ccc1);
0323         ADCAmplLSHB1->Fill(float(i), float(j), ccc1);
0324       }  // if
0325     }
0326   }
0327   ADCAmplLSHB1->SetMarkerStyle(20);
0328   ADCAmplLSHB1->SetMarkerSize(0.4);
0329   ADCAmplLSHB1->GetYaxis()->SetLabelSize(0.04);
0330   ADCAmplLSHB1->SetXTitle("nev0-overAllLSs test with ADCAmplLSHB1 \b");
0331   ADCAmplLSHB1->SetMarkerColor(2);
0332   ADCAmplLSHB1->SetLineColor(0);
0333   //          ADCAmplLSHB1 ->SetMaximum(30.0);
0334   //          ADCAmplLSHB1 ->SetMinimum(20.0);
0335   //    gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
0336   ADCAmplLSHB1->Draw("COLZ");
0337   //          ADCAmplLSHB1 ->Draw("Error");
0338   //   ADCAmplLSHB1 ->Draw("");
0339   cout << "444 HB1 for h_2D0sumADCAmplLS1 maxbinx =  " << maxbinx << "     maxbiny=  " << maxbiny << endl;
0340   // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ;  k2=0-neta-1; k3=0-nphi-1; neta=72; nphi=82;
0341 
0342   c1->Update();
0343 
0344   //========================================================================================== 5
0345   //======================================================================
0346   //======================================================================
0347   //======================================================================
0348   c1->Clear();
0349   c1->Divide(1, 2);
0350 
0351   TH1F* ATIT1 = (TH1F*)hfile1->Get("h_bcnvsamplitude_HB");
0352   TH1F* ATIT2 = (TH1F*)hfile1->Get("h_bcnvsamplitude0_HB");
0353   int minbx = 999999;
0354   int maxbx = -1;
0355   nx = ATIT2->GetXaxis()->GetNbins();
0356   for (int i = 0; i <= nx; i++) {
0357     //  i-=1;
0358     double ccc1 = ATIT2->GetBinContent(i);
0359     if (ccc1 > 0.) {
0360       if (i > maxbx)
0361         maxbx = i;
0362       if (i < minbx)
0363         minbx = i;
0364       if (i >= 3440 && i <= 3570)
0365         cout << "Page5: i = =     " << i - 1 << " Ni=     " << ccc1 << endl;
0366     }
0367   }
0368   cout << "Page5: minbx=     " << minbx - 1 << " maxbx=     " << maxbx - 1 << endl;
0369 
0370   c1->cd(1);
0371   TH1F* ITIT1 = new TH1F("ITIT1", "", maxbx - minbx + 1, float(minbx), maxbx + 1.);
0372   for (int i = 1; i <= nx; i++) {
0373     double ccc1 = ATIT1->GetBinContent(i);
0374     //  if(ccc1>0.)   cout<<" bcnvsamplitude_HB ;  i = "<<i<<" ccc1= "<<ccc1<<endl;
0375     if (ccc1 > 0.)
0376       ITIT1->Fill(float(i), ccc1);
0377   }
0378   gPad->SetLogy();
0379   gPad->SetGridy();
0380   gPad->SetGridx();
0381   ITIT1->SetXTitle("bcnvsamplitude_HB \b");
0382   ITIT1->SetMarkerStyle(20);
0383   ITIT1->SetMarkerSize(0.4);
0384   ITIT1->GetYaxis()->SetLabelSize(0.04);
0385   ITIT1->SetMarkerColor(2);
0386   ITIT1->SetLineColor(0);  // ITIT1->SetMaximum(30.0);// ITIT1->SetMinimum(20.0);
0387   ITIT1->Draw("Error");
0388 
0389   c1->cd(2);
0390   TH1F* ITIT2 = new TH1F("ITIT2", "", maxbx - minbx + 1, float(minbx), maxbx + 1.);
0391   for (int i = 1; i <= nx; i++) {
0392     double ccc1 = ATIT2->GetBinContent(i);
0393     //  if(ccc1>0.)   cout<<" bcnvsamplitude_HB ;  i = "<<i<<" ccc1= "<<ccc1<<endl;
0394     if (ccc1 > 0.)
0395       ITIT2->Fill(float(i), ccc1);
0396   }
0397   gPad->SetLogy();
0398   gPad->SetGridy();
0399   gPad->SetGridx();
0400   ITIT2->SetXTitle("bcnvsamplitude0 HBs \b");
0401   ITIT2->SetMarkerStyle(20);
0402   ITIT2->SetMarkerSize(0.4);
0403   ITIT2->GetYaxis()->SetLabelSize(0.04);
0404   ITIT2->SetMarkerColor(2);
0405   ITIT2->SetLineColor(0);  // ITIT2->SetMaximum(30.0);// ITIT2->SetMinimum(20.0);
0406   ITIT2->Draw("Error");
0407 
0408   c1->Update();
0409   ////////////////////////////////////////////////////////////////////////////////////
0410 
0411   //======================================================================
0412   //========================================================================================== 6
0413   //======================================================================
0414   //======================================================================
0415   //======================================================================
0416   c1->Clear();
0417   c1->Divide(1, 4);
0418 
0419   c1->cd(1);
0420   TH1F* twrd3 = (TH1F*)hfile1->Get("h_bcnvsamplitude_HB");
0421   TH1F* twrd2 = (TH1F*)hfile1->Get("h_bcnvsamplitude0_HB");
0422   twrd3->Sumw2();
0423   twrd2->Sumw2();
0424   gPad->SetGridy();
0425   TH1F* Rase1 = (TH1F*)twrd3->Clone("Rase1");
0426   Rase1->Divide(twrd3, twrd2, 1, 1, "B");
0427   Rase1->Sumw2();
0428   TH1F* Rase1NNN = new TH1F("Rase1NNN", "", maxbx - minbx + 1, float(minbx), maxbx + 1.);
0429   nx = Rase1->GetXaxis()->GetNbins();
0430   for (int i = 1; i <= nx; i++) {
0431     double ccc1 = Rase1->GetBinContent(i);
0432     //  if(ccc1>0.)   cout<<" HB i = "<<i<<" <A> per bx= "<<ccc1<<endl;
0433     if (ccc1 > 0.)
0434       Rase1NNN->Fill(float(i), ccc1);
0435   }
0436   //      gPad->SetLogy();
0437   Rase1NNN->SetMarkerStyle(20);
0438   Rase1NNN->SetMarkerSize(0.4);
0439   Rase1NNN->GetYaxis()->SetLabelSize(0.04);
0440   Rase1NNN->SetXTitle("<ADCAmpl> per bx HB \b");
0441   Rase1NNN->SetMarkerColor(2);
0442   Rase1NNN->SetLineColor(0);  //Rase1NNN->SetMaximum(30.0);//Rase1NNN->SetMinimum(20.0);
0443   Rase1NNN->Draw("Error");
0444 
0445   c1->cd(2);
0446   TH1F* twed3 = (TH1F*)hfile1->Get("h_bcnvsamplitude_HE");
0447   TH1F* twed2 = (TH1F*)hfile1->Get("h_bcnvsamplitude0_HE");
0448   twed3->Sumw2();
0449   twed2->Sumw2();
0450   gPad->SetGridy();
0451   TH1F* Rase2 = (TH1F*)twed3->Clone("Rase2");
0452   Rase2->Divide(twed3, twed2, 1, 1, "B");
0453   Rase2->Sumw2();
0454   TH1F* Rase2NNN = new TH1F("Rase2NNN", "", maxbx - minbx + 1, float(minbx), maxbx + 1.);
0455   nx = Rase2->GetXaxis()->GetNbins();
0456   for (int i = 1; i <= nx; i++) {
0457     double ccc1 = Rase2->GetBinContent(i);
0458     //  if(ccc1>0.)   cout<<" HE i = "<<i<<" <A> per bx= "<<ccc1<<endl;
0459     if (ccc1 > 0.)
0460       Rase2NNN->Fill(float(i), ccc1);
0461   }
0462   //      gPad->SetLogy();
0463   Rase2NNN->SetMarkerStyle(20);
0464   Rase2NNN->SetMarkerSize(0.4);
0465   Rase2NNN->GetYaxis()->SetLabelSize(0.04);
0466   Rase2NNN->SetXTitle("<ADCAmpl> per bx HE \b");
0467   Rase2NNN->SetMarkerColor(2);
0468   Rase2NNN->SetLineColor(0);  //Rase2NNN->SetMaximum(30.0);//Rase2NNN->SetMinimum(20.0);
0469   Rase2NNN->Draw("Error");
0470 
0471   c1->cd(3);
0472   TH1F* twwd3 = (TH1F*)hfile1->Get("h_bcnvsamplitude_HF");
0473   TH1F* twwd2 = (TH1F*)hfile1->Get("h_bcnvsamplitude0_HF");
0474   twwd3->Sumw2();
0475   twwd2->Sumw2();
0476   gPad->SetGridy();
0477   TH1F* Rase3 = (TH1F*)twwd3->Clone("Rase3");
0478   Rase3->Divide(twwd3, twwd2, 1, 1, "B");
0479   Rase3->Sumw2();
0480   TH1F* Rase3NNN = new TH1F("Rase3NNN", "", maxbx - minbx + 1, float(minbx), maxbx + 1.);
0481   nx = Rase3->GetXaxis()->GetNbins();
0482   for (int i = 1; i <= nx; i++) {
0483     double ccc1 = Rase3->GetBinContent(i);
0484     //  if(ccc1>0.)   cout<<" HF i = "<<i<<" <A> per bx= "<<ccc1<<endl;
0485     if (ccc1 > 0.)
0486       Rase3NNN->Fill(float(i), ccc1);
0487   }
0488   //      gPad->SetLogy();
0489   Rase3NNN->SetMarkerStyle(20);
0490   Rase3NNN->SetMarkerSize(0.4);
0491   Rase3NNN->GetYaxis()->SetLabelSize(0.04);
0492   Rase3NNN->SetXTitle("<ADCAmpl> per bx HF \b");
0493   Rase3NNN->SetMarkerColor(2);
0494   Rase3NNN->SetLineColor(0);  //Rase3NNN->SetMaximum(30.0);//Rase3NNN->SetMinimum(20.0);
0495   Rase3NNN->Draw("Error");
0496 
0497   c1->cd(4);
0498   TH1F* twqd3 = (TH1F*)hfile1->Get("h_bcnvsamplitude_HO");
0499   TH1F* twqd2 = (TH1F*)hfile1->Get("h_bcnvsamplitude0_HO");
0500   twqd3->Sumw2();
0501   twqd2->Sumw2();
0502   gPad->SetGridy();
0503   TH1F* Rase4 = (TH1F*)twqd3->Clone("Rase4");
0504   Rase4->Divide(twqd3, twqd2, 1, 1, "B");
0505   Rase4->Sumw2();
0506   TH1F* Rase4NNN = new TH1F("Rase4NNN", "", maxbx - minbx + 1, float(minbx), maxbx + 1.);
0507   nx = Rase4->GetXaxis()->GetNbins();
0508   for (int i = 1; i <= nx; i++) {
0509     double ccc1 = Rase4->GetBinContent(i);
0510     //  if(ccc1>0.)   cout<<" HO i = "<<i<<" <A> per bx= "<<ccc1<<endl;
0511     if (ccc1 > 0.)
0512       Rase4NNN->Fill(float(i), ccc1);
0513   }
0514   //      gPad->SetLogy();
0515   Rase4NNN->SetMarkerStyle(20);
0516   Rase4NNN->SetMarkerSize(0.4);
0517   Rase4NNN->GetYaxis()->SetLabelSize(0.04);
0518   Rase4NNN->SetXTitle("<ADCAmpl> per bx HO \b");
0519   Rase4NNN->SetMarkerColor(2);
0520   Rase4NNN->SetLineColor(0);  //Rase4NNN->SetMaximum(30.0);//Rase4NNN->SetMinimum(20.0);
0521   Rase4NNN->Draw("Error");
0522 
0523   c1->Update();
0524   //========================================================================================== 7
0525   //======================================================================
0526   //======================================================================
0527   //================
0528   //======================================================================
0529   c1->Clear();
0530   c1->Divide(1, 3);
0531 
0532   c1->cd(1);
0533   TH1F* Rate7 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_orbitNum");
0534   gPad->SetLogy();
0535   gPad->SetGridy();
0536   gPad->SetGridx();
0537   Rate7->SetXTitle("h_sumADCAmplEtaPhiLs_orbitNum \b");
0538   Rate7->Draw("");
0539 
0540   c1->cd(2);
0541   TH1F* Rate8 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_lscounterM1");
0542   gPad->SetLogy();
0543   gPad->SetGridy();
0544   gPad->SetGridx();
0545   Rate8->SetXTitle("h_sumADCAmplEtaPhiLs_lscounterM1 \b");
0546   Rate8->Draw("");
0547 
0548   c1->cd(3);
0549   TH1F* Rate9 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_lscounterM1orbitNum");
0550   gPad->SetLogy();
0551   gPad->SetGridy();
0552   gPad->SetGridx();
0553   Rate9->SetXTitle("h_sumADCAmplEtaPhiLs_lscounterM1orbitNum \b");
0554   Rate9->Draw("");
0555 
0556   c1->Update();
0557   //======================================================================
0558   //========================================================================================== 8
0559   //======================================================================
0560   //======================================================================
0561   //======================================================================
0562   c1->Clear();
0563   c1->Divide(1, 3);
0564 
0565   TH1F* ASSS1 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_lscounterM1orbitNum");
0566   TH1F* ASSS2 = (TH1F*)hfile1->Get("h_sumADCAmplEtaPhiLs_lscounterM1");
0567   int minls = 999999;
0568   int maxls = -1;
0569   nx = ASSS2->GetXaxis()->GetNbins();
0570   for (int i = 1; i <= nx; i++) {
0571     double ccc1 = ASSS2->GetBinContent(i);
0572     if (ccc1 > 0.) {
0573       if (i > maxls)
0574         maxls = i;
0575       if (i < minls)
0576         minls = i;
0577     }
0578     //    if(ccc1>0.)     cout<<" ASSS2 ;  i = "<<i<<" ccc1= "<<ccc1<<endl;
0579     //  if(ccc1>0.) {maxls = i; if(i>maxls) maxls = i;}
0580   }
0581   cout << "Page8: minls=     " << minls << " maxls=     " << maxls << endl;
0582   //////////////////////////////////////////////////////////////////////////////////////
0583   c1->cd(1);
0584   TH1F* ISSS1 = new TH1F("ISSS1", "", maxls - minls + 1, float(minls), maxls + 1.);
0585   for (int i = 0; i <= nx; i++) {
0586     double ccc1 = ASSS1->GetBinContent(i);
0587     //  if(ccc1>0.)   cout<<" bcnvsamplitude_HB ;  i = "<<i<<" ccc1= "<<ccc1<<endl;
0588     if (ccc1 > 0.)
0589       ISSS1->Fill(float(i), ccc1);
0590   }
0591   gPad->SetLogy();
0592   gPad->SetGridy();
0593   gPad->SetGridx();
0594   ISSS1->SetXTitle("lscounterM1 w = orbitNum*Nentries \b");
0595   ISSS1->SetMarkerStyle(20);
0596   ISSS1->SetMarkerSize(0.4);
0597   ISSS1->GetYaxis()->SetLabelSize(0.04);
0598   ISSS1->SetMarkerColor(2);
0599   ISSS1->SetLineColor(0);  // ISSS1->SetMaximum(30.0);// ISSS1->SetMinimum(20.0);
0600   ISSS1->Draw("Error");
0601   //////////////////////////////////////////////////////////////////////////////////////
0602   c1->cd(2);
0603   TH1F* ISSS2 = new TH1F("ISSS2", "", maxls - minls + 1, float(minls), maxls + 1.);
0604   for (int i = 0; i <= nx; i++) {
0605     double ccc1 = ASSS2->GetBinContent(i);
0606     //  if(ccc1>0.)   cout<<" bcnvsamplitude_HB ;  i = "<<i<<" ccc1= "<<ccc1<<endl;
0607     if (ccc1 > 0.)
0608       ISSS2->Fill(float(i), ccc1);
0609   }
0610   gPad->SetLogy();
0611   gPad->SetGridy();
0612   gPad->SetGridx();
0613   ISSS2->SetXTitle("lscounterM1 w = Nentries \b");
0614   ISSS2->SetMarkerStyle(20);
0615   ISSS2->SetMarkerSize(0.4);
0616   ISSS2->GetYaxis()->SetLabelSize(0.04);
0617   ISSS2->SetMarkerColor(2);
0618   ISSS2->SetLineColor(0);  // ISSS2->SetMaximum(30.0);// ISSS2->SetMinimum(20.0);
0619   ISSS2->Draw("Error");
0620   //////////////////////////////////////////////////////////////////////////////////////
0621   c1->cd(3);
0622   TH1F* Roze1 = (TH1F*)ASSS2->Clone("Roze1");
0623   Roze1->Divide(ASSS1, ASSS2, 1, 1, "B");
0624   Roze1->Sumw2();
0625   TH1F* Roze1NNN = new TH1F("Roze1NNN", "", maxls - minls + 1, float(minls), maxls + 1.);
0626   nx = Roze1->GetXaxis()->GetNbins();
0627   for (int i = 1; i <= nx; i++) {
0628     double ccc1 = Roze1->GetBinContent(i);
0629     //  if(ccc1>0.)   cout<<" HB i = "<<i<<" <A> per ls= "<<ccc1<<endl;
0630     if (ccc1 > 0.)
0631       Roze1NNN->Fill(float(i), ccc1);
0632   }
0633   //      gPad->SetLogy();
0634   Roze1NNN->SetMarkerStyle(20);
0635   Roze1NNN->SetMarkerSize(0.4);
0636   Roze1NNN->GetYaxis()->SetLabelSize(0.04);
0637   Roze1NNN->SetXTitle("lscounterM1 w = <orbitNum> \b");
0638   Roze1NNN->SetMarkerColor(2);
0639   Roze1NNN->SetLineColor(0);  //Roze1NNN->SetMaximum(30.0);//Roze1NNN->SetMinimum(20.0);
0640   Roze1NNN->Draw("Error");
0641 
0642   c1->Update();
0643   ////////////////////////////////////////////////////////////////////////////////////
0644 
0645   //========================================================================================== 9
0646   //======================================================================
0647   //======================================================================
0648   //================
0649   //======================================================================
0650   c1->Clear();
0651   c1->Divide(1, 3);
0652 
0653   c1->cd(1);
0654   TH1F* TEST7 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude_HB");
0655   gPad->SetLogy();
0656   gPad->SetGridy();
0657   gPad->SetGridx();
0658   TEST7->SetXTitle("h_orbitNumvsamplitude_HB \b");
0659   TEST7->Draw("");
0660 
0661   c1->cd(2);
0662   TH1F* TEST8 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude0_HB");
0663   gPad->SetLogy();
0664   gPad->SetGridy();
0665   gPad->SetGridx();
0666   TEST8->SetXTitle("h_orbitNumvsamplitude0_HB \b");
0667   TEST8->Draw("");
0668 
0669   c1->cd(3);
0670   TH1F* TEST9 = (TH1F*)TEST8->Clone("TEST9");
0671   TEST9->Divide(TEST7, TEST8, 1, 1, "B");
0672   //    TH1F* TEST9 = new TH1F("TEST9","", zaP, zaR, zaR2);
0673   //      TH1F* TEST9 = new TH1F("TEST9","", maxorbitNum-minorbitNum+1, float(minorbitNum), maxorbitNum+1.);
0674   /*
0675       nx =TEST9->GetXaxis()->GetNbins();
0676       for (int i=1;i<=nx;i++) {
0677     double ccc1 =  TEST9->GetBinContent(i);
0678         if(ccc1>0.)   cout<<" HB i = "<<i<<" <A> per orbitNum= "<<ccc1<<endl;
0679         //    if(ccc1>0.) TEST9->Fill(float(i), ccc1);
0680       }
0681 */
0682   //      gPad->SetLogy();
0683   TEST9->SetMarkerStyle(20);
0684   TEST9->SetMarkerSize(0.4);
0685   TEST9->GetYaxis()->SetLabelSize(0.04);
0686   TEST9->SetXTitle("<ADCAmpl> per orbitNum HB \b");
0687   TEST9->SetMarkerColor(2);
0688   TEST9->SetLineColor(0);  //TEST9->SetMaximum(30.0);//TEST9->SetMinimum(20.0);
0689   TEST9->Draw("Error");
0690 
0691   c1->Update();
0692   //======================================================================
0693   //========================================================================================== 10
0694   //======================================================================
0695   //======================================================================
0696   //======================================================================
0697   c1->Clear();
0698   c1->Divide(1, 4);
0699 
0700   c1->cd(1);
0701   TH1F* kqrd3 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude_HB");
0702   TH1F* kqrd2 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude0_HB");
0703   kqrd3->Sumw2();
0704   kqrd2->Sumw2();
0705   gPad->SetGridy();
0706   TH1F* Posw1 = (TH1F*)kqrd3->Clone("Posw1");
0707   Posw1->Divide(kqrd3, kqrd2, 1, 1, "B");
0708   Posw1->Sumw2();
0709   //    TH1F* Posw1 = new TH1F("Posw1","", zaP, zaR, zaR2);
0710   //      TH1F* Posw1 = new TH1F("Posw1","", maxorbitNum-minorbitNum+1, float(minorbitNum), maxorbitNum+1.);
0711   nx = Posw1->GetXaxis()->GetNbins();
0712   for (int i = 1; i <= nx; i++) {
0713     double ccc1 = Posw1->GetBinContent(i);
0714     //  if(ccc1>0.)   cout<<" HB i = "<<i<<" <A> per orbitNum= "<<ccc1<<endl;
0715     if (ccc1 > 0.)
0716       Posw1->Fill(float(i), ccc1);
0717   }
0718   //      gPad->SetLogy();
0719   Posw1->SetMarkerStyle(20);
0720   Posw1->SetMarkerSize(0.4);
0721   Posw1->GetYaxis()->SetLabelSize(0.04);
0722   Posw1->SetXTitle("<ADCAmpl> per orbitNum HB \b");
0723   Posw1->SetMarkerColor(2);
0724   Posw1->SetLineColor(0);  //Posw1->SetMaximum(30.0);//Posw1->SetMinimum(20.0);
0725   Posw1->Draw("Error");
0726 
0727   c1->cd(2);
0728   TH1F* kqed3 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude_HE");
0729   TH1F* kqed2 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude0_HE");
0730   kqed3->Sumw2();
0731   kqed2->Sumw2();
0732   gPad->SetGridy();
0733   TH1F* Posw2 = (TH1F*)kqed3->Clone("Posw2");
0734   Posw2->Divide(kqed3, kqed2, 1, 1, "B");
0735   Posw2->Sumw2();
0736   //    TH1F* Posw2 = new TH1F("Posw2","", zaP, zaR, zaR2);
0737   //      TH1F* Posw2 = new TH1F("Posw2","", maxorbitNum-minorbitNum+1, float(minorbitNum), maxorbitNum+1.);
0738   nx = Posw2->GetXaxis()->GetNbins();
0739   for (int i = 1; i <= nx; i++) {
0740     double ccc1 = Posw2->GetBinContent(i);
0741     //  if(ccc1>0.)   cout<<" HE i = "<<i<<" <A> per orbitNum= "<<ccc1<<endl;
0742     if (ccc1 > 0.)
0743       Posw2->Fill(float(i), ccc1);
0744   }
0745   //      gPad->SetLogy();
0746   Posw2->SetMarkerStyle(20);
0747   Posw2->SetMarkerSize(0.4);
0748   Posw2->GetYaxis()->SetLabelSize(0.04);
0749   Posw2->SetXTitle("<ADCAmpl> per orbitNum HE \b");
0750   Posw2->SetMarkerColor(2);
0751   Posw2->SetLineColor(0);  //Posw2->SetMaximum(30.0);//Posw2->SetMinimum(20.0);
0752   Posw2->Draw("Error");
0753 
0754   c1->cd(3);
0755   TH1F* kqwd3 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude_HF");
0756   TH1F* kqwd2 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude0_HF");
0757   kqwd3->Sumw2();
0758   kqwd2->Sumw2();
0759   gPad->SetGridy();
0760   TH1F* Posw3 = (TH1F*)kqwd3->Clone("Posw3");
0761   Posw3->Divide(kqwd3, kqwd2, 1, 1, "B");
0762   Posw3->Sumw2();
0763   //    TH1F* Posw3 = new TH1F("Posw3","", zaP, zaR, zaR2);
0764   //      TH1F* Posw3 = new TH1F("Posw3","", maxorbitNum-minorbitNum+1, float(minorbitNum), maxorbitNum+1.);
0765   nx = Posw3->GetXaxis()->GetNbins();
0766   for (int i = 1; i <= nx; i++) {
0767     double ccc1 = Posw3->GetBinContent(i);
0768     //  if(ccc1>0.)   cout<<" HF i = "<<i<<" <A> per orbitNum= "<<ccc1<<endl;
0769     if (ccc1 > 0.)
0770       Posw3->Fill(float(i), ccc1);
0771   }
0772   //      gPad->SetLogy();
0773   Posw3->SetMarkerStyle(20);
0774   Posw3->SetMarkerSize(0.4);
0775   Posw3->GetYaxis()->SetLabelSize(0.04);
0776   Posw3->SetXTitle("<ADCAmpl> per orbitNum HF \b");
0777   Posw3->SetMarkerColor(2);
0778   Posw3->SetLineColor(0);  //Posw3->SetMaximum(30.0);//Posw3->SetMinimum(20.0);
0779   Posw3->Draw("Error");
0780 
0781   c1->cd(4);
0782   TH1F* kqqd3 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude_HO");
0783   TH1F* kqqd2 = (TH1F*)hfile1->Get("h_orbitNumvsamplitude0_HO");
0784   kqqd3->Sumw2();
0785   kqqd2->Sumw2();
0786   gPad->SetGridy();
0787   TH1F* Posw4 = (TH1F*)kqqd3->Clone("Posw4");
0788   Posw4->Divide(kqqd3, kqqd2, 1, 1, "B");
0789   Posw4->Sumw2();
0790   //    TH1F* Posw4 = new TH1F("Posw4","", zaP, zaR, zaR2);
0791   //    TH1F* Posw4 = new TH1F("Posw4","", maxorbitNum-minorbitNum+1, float(minorbitNum), maxorbitNum+1.);
0792   nx = Posw4->GetXaxis()->GetNbins();
0793   for (int i = 1; i <= nx; i++) {
0794     double ccc1 = Posw4->GetBinContent(i);
0795     //  if(ccc1>0.)   cout<<" HO i = "<<i<<" <A> per orbitNum= "<<ccc1<<endl;
0796     if (ccc1 > 0.)
0797       Posw4->Fill(float(i), ccc1);
0798   }
0799   //      gPad->SetLogy();
0800   Posw4->SetMarkerStyle(20);
0801   Posw4->SetMarkerSize(0.4);
0802   Posw4->GetYaxis()->SetLabelSize(0.04);
0803   Posw4->SetXTitle("<ADCAmpl> per orbitNum HO \b");
0804   Posw4->SetMarkerColor(2);
0805   Posw4->SetLineColor(0);  //Posw4->SetMaximum(30.0);//Posw4->SetMinimum(20.0);
0806   Posw4->Draw("Error");
0807 
0808   c1->Update();
0809 
0810   //========================================================================================== 11    HB - "h_2DsumADCAmplEtaPhiLs0
0811   //======================================================================
0812   //======================================================================
0813   //================
0814   //======================================================================
0815   c1->Clear();
0816   c1->Divide(2, 2);
0817 
0818   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0819   TH2F* Cefz1KKK = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs0");
0820   TH2F* Cefz1LLL = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs00");
0821   TH2F* Cefz1 = (TH2F*)Cefz1LLL->Clone("Cefz1");
0822   Cefz1->Divide(Cefz1KKK, Cefz1LLL, 1, 1, "B");  // average A
0823   Cefz1->Sumw2();
0824   //  maxbins, 1., maxbins+1.);
0825   int sumijhb = 0;
0826   c1->cd(1);
0827   maxbinx = 0;
0828   maxbiny = 0;
0829   nx = Cefz1->GetXaxis()->GetNbins();
0830   ny = Cefz1->GetYaxis()->GetNbins();
0831   nx = maxbins;
0832   cout << "Page11: HB h_2DsumADCAmplEtaPhiLs0         nx=     " << nx << " ny=     " << ny << endl;
0833   TH1F* ADCAmplLS0 = new TH1F("ADCAmplLS0", "", 100, 0., 50.);
0834   // i - # LSs:
0835   for (int i = 1; i <= nx; i++) {
0836     // j - etaphi index:
0837     for (int j = 1; j <= ny; j++) {
0838       double ccc1 = Cefz1->GetBinContent(i, j);
0839       if (ccc1 > 0.) {
0840         sumijhb++;
0841         maxbinx = i;
0842         if (i > maxbinx)
0843           maxbinx = i;
0844         maxbiny = j;
0845         if (j > maxbiny)
0846           maxbiny = j;
0847         //    cout<<"Page11: HB h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
0848         ADCAmplLS0->Fill(ccc1);
0849       }
0850     }
0851   }
0852   cout << "Page11: HB maxbinx=  " << maxbinx << "     maxbiny=  " << maxbiny << "     sumijhb=  " << sumijhb << endl;
0853   ADCAmplLS0->SetMarkerStyle(20);
0854   ADCAmplLS0->SetMarkerSize(0.4);
0855   ADCAmplLS0->GetYaxis()->SetLabelSize(0.04);
0856   ADCAmplLS0->SetXTitle("<A>ijk = <A> averaged per events in k-th LS \b");
0857   ADCAmplLS0->SetYTitle("     HB \b");
0858   ADCAmplLS0->SetMarkerColor(2);
0859   ADCAmplLS0->SetLineColor(0);  //ADCAmplLS0->SetMinimum(10.);
0860   gPad->SetLogy();
0861   gPad->SetGridy();
0862   gPad->SetGridx();
0863   //      ADCAmplLS0 ->Draw("L");
0864   ADCAmplLS0->Draw("Error");
0865   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  maxbins, 1., maxbins+1.);
0866   c1->cd(2);
0867   TH1F* ADCAmplLS = new TH1F("ADCAmplLS", "", maxbins, 1., maxbins + 1.);
0868   // i - # LSs:
0869   for (int i = 1; i <= nx; i++) {
0870     // j - etaphi index:
0871     for (int j = 1; j <= ny; j++) {
0872       double ccc1 = Cefz1->GetBinContent(i, j);
0873       if (ccc1 > 0.) {
0874         //    cout<<"Page11: HB h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
0875         //    ADCAmplLS ->Fill(ccc1/maxbinx);
0876         ADCAmplLS->Fill(float(i), ccc1* maxbinx / sumijhb);
0877       }
0878     }
0879   }
0880   ADCAmplLS->SetMarkerStyle(20);
0881   ADCAmplLS->SetMarkerSize(0.4);
0882   ADCAmplLS->GetYaxis()->SetLabelSize(0.04);
0883   ADCAmplLS->SetMarkerColor(2);
0884   ADCAmplLS->SetLineColor(0);
0885   ADCAmplLS->SetXTitle("        iLS  \b");
0886   ADCAmplLS->SetYTitle("     <A>k \b");
0887   //ADCAmplLS->SetMinimum(0.8);ADCAmplLS->SetMaximum(500.);
0888   //      gPad->SetLogy();
0889   gPad->SetGridy();
0890   gPad->SetGridx();
0891   ADCAmplLS->Draw("Error");
0892 
0893   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0894   c1->cd(3);
0895   TH1F* ADCAmplLS1 = new TH1F("ADCAmplLS1", "", 200, 0., 100.);
0896   for (int i = 1; i <= nx; i++) {
0897     // j - etaphi index:
0898     for (int j = 1; j <= ny; j++) {
0899       double ccc1 = Cefz1->GetBinContent(i, j);
0900       if (ccc1 > 0.) {
0901         maxbinx = i;
0902         if (i > maxbinx)
0903           maxbinx = i;
0904         maxbiny = j;
0905         if (j > maxbiny)
0906           maxbiny = j;
0907         //    cout<<"Page11: HB h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
0908         ADCAmplLS1->Fill(ccc1);
0909       }
0910     }
0911   }
0912   cout << "Page11: HB maxbinx=  " << maxbinx << "     maxbiny=  " << maxbiny << endl;
0913   ADCAmplLS1->SetMarkerStyle(20);
0914   ADCAmplLS1->SetMarkerSize(0.4);
0915   ADCAmplLS1->GetYaxis()->SetLabelSize(0.04);
0916   ADCAmplLS1->SetXTitle("<A>ijk = <A> averaged per events in k-th LS \b");
0917   ADCAmplLS1->SetMarkerColor(2);
0918   ADCAmplLS1->SetLineColor(0);
0919   ADCAmplLS1->SetMinimum(0.8);
0920   gPad->SetLogy();
0921   gPad->SetGridy();
0922   gPad->SetGridx();
0923   //      ADCAmplLS1 ->Draw("L");
0924   ADCAmplLS1->Draw("Error");
0925 
0926   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0927   c1->cd(4);
0928   // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ;  k2=0-neta-1; k3=0-nphi-1;
0929   //          neta=72;    nphi=82;
0930   //         zneta=18;   znphi=22;
0931   TH2F* Cefz4 = new TH2F("Cefz4", "", 22, -11., 11., 18, 0., 18.);
0932   // i - # LSs:
0933   for (int i = 1; i <= nx; i++) {
0934     // j - etaphi index:
0935     for (int j = 1; j <= ny; j++) {
0936       double ccc1 = Cefz1->GetBinContent(i, j);
0937       //if(ccc1>0.) cout<<"Page11: HB h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1/maxbinx <<endl;
0938       //    if(ccc1>0. && ccc1/maxbinx < 2000) {
0939       if (ccc1 > 0.) {
0940         int jeta = (j - 1) / 18;             // jeta = 0-21
0941         int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
0942         //    jeta += 1;// jeta = 1-22
0943         //        if(i==1) cout<<"Page11: HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta-11 <<" jphi= "<< jphi-1 <<"  A= "<< ccc1/maxbinx <<endl;
0944         //    Cefz4 ->Fill(jeta-11,jphi-1,ccc1/maxbinx);
0945 
0946         Cefz4->Fill(jeta - 11, jphi - 1, ccc1 * maxbiny / sumijhb);
0947       }
0948     }
0949   }
0950   gPad->SetGridy();
0951   gPad->SetGridx();  //      gPad->SetLogz();
0952   Cefz4->SetMarkerStyle(20);
0953   Cefz4->SetMarkerSize(0.4);
0954   Cefz4->GetZaxis()->SetLabelSize(0.04);
0955   Cefz4->SetXTitle("<A>ij         #eta  \b");
0956   Cefz4->SetYTitle("      #phi \b");
0957   Cefz4->SetZTitle("<A>ij  - All \b");
0958   Cefz4->SetMarkerColor(2);
0959   Cefz4->SetLineColor(2);  //      Cefz4->SetMaximum(1.000);  //      Cefz4->SetMinimum(1.0);
0960   Cefz4->Draw("COLZ");
0961 
0962   c1->Update();
0963 
0964   //======================================================================
0965 
0966   //========================================================================================== 12   HB
0967   //======================================================================
0968   //======================================================================
0969   //======================================================================
0970   c1->Clear();
0971   //    c1->Divide(1,3);
0972   double ccc0HB = 0.;
0973   gStyle->SetOptStat(1110000);
0974   c1->Divide(2, 3);
0975 
0976   c1->cd(1);
0977   nx = Cefz1->GetXaxis()->GetNbins();
0978   ny = Cefz1->GetYaxis()->GetNbins();
0979   nx = maxbins;
0980   cout << "HB GainStability        nx=     " << nx << " ny=     " << ny << endl;
0981   TH1F* GainStability0 = new TH1F("GainStability0", "", maxbins, 1., maxbins + 1.);
0982   TH1F* GainStability1 = new TH1F("GainStability1", "", maxbins, 1., maxbins + 1.);
0983   TH1F* GainStability2 = new TH1F("GainStability2", "", maxbins, 1., maxbins + 1.);
0984   // i - # LSs:
0985   for (int i = 1; i <= nx; i++) {
0986     // j - etaphi index:
0987     for (int j = 1; j <= ny; j++) {
0988       double ccc1 = Cefz1->GetBinContent(i, j);
0989       if (ccc1 > 0.) {
0990         int jeta = (j - 1) / 18;             // jeta = 0-21
0991         int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
0992         //    jeta += 1;// jeta = 1-22
0993         //      cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
0994         if (jeta == 8 && jphi == 11)
0995           GainStability0->Fill(i, ccc1);
0996         if (jeta == 10 && jphi == 11)
0997           GainStability1->Fill(i, ccc1);
0998         if (jeta == 12 && jphi == 11)
0999           GainStability2->Fill(i, ccc1);
1000       }
1001     }
1002   }
1003   GainStability0->SetMarkerStyle(20);
1004   GainStability0->SetMarkerSize(0.4);
1005   GainStability0->GetYaxis()->SetLabelSize(0.04);
1006   GainStability0->SetXTitle("GainStability0 \b");
1007   GainStability0->SetMarkerColor(2);
1008   GainStability0->SetLineColor(
1009       0);  // GainStability0 ->SetMaximum(30.0);// GainStability0 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1010   GainStability0->Draw("Error");
1011 
1012   //================
1013   c1->cd(2);
1014   GainStability1->SetMarkerStyle(20);
1015   GainStability1->SetMarkerSize(0.4);
1016   GainStability1->GetYaxis()->SetLabelSize(0.04);
1017   GainStability1->SetXTitle("GainStability1 \b");
1018   GainStability1->SetMarkerColor(2);
1019   GainStability1->SetLineColor(
1020       0);  // GainStability1 ->SetMaximum(30.0);// GainStability1 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1021   GainStability1->Draw("Error");
1022 
1023   //================
1024   c1->cd(3);
1025   GainStability2->SetMarkerStyle(20);
1026   GainStability2->SetMarkerSize(0.4);
1027   GainStability2->GetYaxis()->SetLabelSize(0.04);
1028   GainStability2->SetXTitle("GainStability2 \b");
1029   GainStability2->SetMarkerColor(2);
1030   GainStability2->SetLineColor(
1031       0);  // GainStability2 ->SetMaximum(30.0);// GainStability2 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1032   GainStability2->Draw("Error");
1033 
1034   //======================================================================
1035   //================
1036   c1->cd(4);
1037   TH1F* Ghb5 = new TH1F("Ghb5", "", nx, 1., nx + 1.);
1038   //    TH1F* Ghb51 = new TH1F("Ghb51","", nx, 1., nx+1.);
1039   //    TH1F* Ghb50= new TH1F("Ghb50","", nx, 1., nx+1.);
1040   //    TH1F* Ghb5 = (TH1F*)Ghb50->Clone("Ghb5");
1041   // j - etaphi index:
1042   for (int j = 1; j <= ny; j++) {
1043     ccc0HB = Cefz1->GetBinContent(1, j);
1044     //  if(ccc0HB <=0.) for (int i=1;i<=nx;i++) {double ccc2 =  Cefz1->GetBinContent(i,j);if(ccc2>0.){ccc0HB=ccc2;cout<<"!!! ccc0HB= "<<ccc0HB<<endl;break;} }
1045     if (ccc0HB <= 0.)
1046       for (int i = 1; i <= nx; i++) {
1047         double ccc2 = Cefz1->GetBinContent(i, j);
1048         if (ccc2 > 0.) {
1049           ccc0HB = ccc2;
1050           break;
1051         }
1052       }
1053     if (ccc0HB > 0.) {
1054       // i - # LSs:
1055       for (int i = 1; i <= nx; i++) {
1056         double ccc1 = Cefz1->GetBinContent(i, j);
1057         if (ccc1 > 0.) {
1058           double Rij = ccc1 / ccc0HB;
1059           Ghb5->Fill(float(i), Rij);
1060           //          Ghb51 ->Fill( float(i), Rij);
1061           //          Ghb50->Fill( float(i), 1.);
1062         }
1063       }
1064     }
1065   }
1066   //    Ghb5->Divide(Ghb51,Ghb50, 1, 1, "B");// average A
1067   for (int i = 1; i <= nx; i++) {
1068     Ghb5->SetBinError(i, 0.0001);
1069   }
1070   Ghb5->SetMarkerStyle(20);
1071   Ghb5->SetMarkerSize(0.4);
1072   Ghb5->GetYaxis()->SetLabelSize(0.04);
1073   Ghb5->SetMarkerColor(2);
1074   Ghb5->SetLineColor(0);
1075   Ghb5->SetXTitle("        iLS  \b");
1076   Ghb5->SetYTitle("     <R> \b");
1077   Ghb5->SetTitle("<Ri> vs iLS \b");
1078   Ghb5->SetMinimum(0.);  //Ghb5->SetMaximum(2.5);
1079   //            gPad->SetLogy();
1080   gPad->SetGridy();
1081   gPad->SetGridx();
1082   Ghb5->SetStats(0);
1083   Ghb5->GetYaxis()->SetLabelSize(0.025);
1084   Ghb5->Draw("Error");
1085   //================
1086   c1->cd(5);
1087   TH2F* Ghb60 = new TH2F("Ghb60", "", 22, -11., 11., 18, 0., 18.);
1088   TH2F* Ghb61 = new TH2F("Ghb61", "", 22, -11., 11., 18, 0., 18.);
1089   TH2F* Ghb6 = new TH2F("Ghb6", "", 22, -11., 11., 18, 0., 18.);
1090   // j - etaphi index; i - # LSs;
1091   //
1092   // define mean and RMS:
1093   double sumjHB = 0.;
1094   int njHB = 0;
1095   double meanjHB = 0.;
1096   for (int j = 1; j <= ny; j++) {
1097     ccc0HB = Cefz1->GetBinContent(1, j);
1098     if (ccc0HB <= 0.)
1099       for (int i = 1; i <= nx; i++) {
1100         double ccc2 = Cefz1->GetBinContent(i, j);
1101         if (ccc2 > 0.) {
1102           ccc0HB = ccc2;
1103           break;
1104         }
1105       }
1106     if (ccc0HB > 0.) {
1107       for (int i = 1; i <= nx; i++) {
1108         double ccc1 = Cefz1->GetBinContent(i, j) / ccc0HB;
1109         if (ccc1 > 0.) {
1110           sumjHB += ccc1;
1111           njHB++;
1112         }
1113       }
1114       meanjHB = sumjHB / njHB;
1115     }
1116   }  // j
1117 
1118   double ssumjHB = 0.;
1119   njHB = 0;
1120   double sigmajHB = 0.;
1121   for (int j = 1; j <= ny; j++) {
1122     ccc0HB = Cefz1->GetBinContent(1, j);
1123     if (ccc0HB <= 0.)
1124       for (int i = 1; i <= nx; i++) {
1125         double ccc2 = Cefz1->GetBinContent(i, j);
1126         if (ccc2 > 0.) {
1127           ccc0HB = ccc2;
1128           break;
1129         }
1130       }
1131     if (ccc0HB > 0.) {
1132       for (int i = 1; i <= nx; i++) {
1133         double ccc1 = Cefz1->GetBinContent(i, j) / ccc0HB;
1134         if (ccc1 > 0.) {
1135           ssumjHB += (ccc1 - meanjHB) * (ccc1 - meanjHB);
1136           njHB++;
1137         }
1138       }
1139       sigmajHB = sqrt(ssumjHB / njHB);
1140     }
1141   }  // j
1142 
1143   double dif3rmsHBMIN = meanjHB - 3 * sigmajHB;
1144   if (dif3rmsHBMIN < 0.)
1145     dif3rmsHBMIN = 0.;
1146   double dif3rmsHBMAX = meanjHB + 3 * sigmajHB;
1147   cout << "22HB-2    meanjHB=  " << meanjHB << "  sigmajHB=  " << sigmajHB << "  dif3rmsHBMIN=  " << dif3rmsHBMIN
1148        << "  dif3rmsHBMAX=  " << dif3rmsHBMAX << endl;
1149 
1150   double MAXdif3rmsHBMIN = dif3rmsHBMIN;
1151   double MINdif3rmsHBMAX = dif3rmsHBMAX;
1152   if (MAXdif3rmsHBMIN < 0.95)
1153     MAXdif3rmsHBMIN = 0.95;
1154   if (MINdif3rmsHBMAX > 1.05)
1155     MINdif3rmsHBMAX = 1.05;
1156   cout << "22HB-2     MAXdif3rmsHBMIN=  " << MAXdif3rmsHBMIN << "     MINdif3rmsHBMAX=  " << MINdif3rmsHBMAX << endl;
1157   //
1158   for (int j = 1; j <= ny; j++) {
1159     ccc0HB = Cefz1->GetBinContent(1, j);
1160     if (ccc0HB <= 0.)
1161       for (int i = 1; i <= nx; i++) {
1162         double ccc2 = Cefz1->GetBinContent(i, j);
1163         if (ccc2 > 0.) {
1164           ccc0HB = ccc2;
1165           break;
1166         }
1167       }
1168     if (ccc0HB > 0.) {
1169       int jeta = (j - 1) / 18;         // jeta = 0-21
1170       int jphi = (j - 1) - 18 * jeta;  // jphi=0-17
1171       // i - # LSs:
1172       for (int i = 1; i <= nx; i++) {
1173         double ccc1 = Cefz1->GetBinContent(i, j);
1174         if (ccc1 > 0.) {
1175           double Rij = ccc1 / ccc0HB;
1176           if (Rij < MAXdif3rmsHBMIN || Rij > MINdif3rmsHBMAX) {
1177             Ghb61->Fill(jeta - 11, jphi, Rij);
1178             Ghb60->Fill(jeta - 11, jphi, 1.);
1179           }
1180         }                                 //if(ccc1>0.
1181       }                                   // i
1182     }                                     //if(ccc0HB>0
1183   }                                       // j
1184   Ghb6->Divide(Ghb61, Ghb60, 1, 1, "B");  // average R
1185   //      Ghb6->SetLabelOffset (Float_t offset=0.005, Option_t *axis="X")//Set offset between axis and axis' labels
1186   //      Ghb6->GetZaxis()->SetLabelOffset(-0.05);
1187   Ghb6->GetZaxis()->SetLabelSize(0.025);
1188 
1189   Ghb6->SetXTitle("             #eta  \b");
1190   Ghb6->SetYTitle("      #phi \b");
1191   Ghb6->SetTitle(
1192       "<Rj> for |1-<R>| > 0.05 \b");  //      Ghb6->SetMaximum(1.000);  //      Ghb6->SetMinimum(1.0); //Ghb6->SetZTitle("Rij averaged over LSs \b"); //Ghb6->GetZaxis()->SetLabelSize(0.04); //Ghb6->SetMarkerStyle(20);// Ghb6->SetMarkerSize(0.4);//Ghb6->SetMarkerColor(2); //Ghb6->SetLineColor(2);
1193   //gStyle->SetOptStat(kFALSE);
1194   Ghb6->SetStats(0);
1195   Ghb6->Draw("COLZ");
1196   //================
1197   c1->cd(6);
1198   TH1F* Ghb7 = new TH1F("Ghb7", "", 120, 0.4, 1.6);
1199   // j - etaphi index:
1200   for (int j = 1; j <= ny; j++) {
1201     ccc0HB = Cefz1->GetBinContent(1, j);
1202     if (ccc0HB <= 0.)
1203       for (int i = 1; i <= nx; i++) {
1204         double ccc2 = Cefz1->GetBinContent(i, j);
1205         if (ccc2 > 0.) {
1206           ccc0HB = ccc2;
1207           break;
1208         }
1209       }
1210     if (ccc0HB > 0.) {
1211       // i - # LSs:
1212       for (int i = 1; i <= nx; i++) {
1213         double ccc1 = Cefz1->GetBinContent(i, j);
1214         if (ccc1 > 0.) {
1215           double Rij = ccc1 / ccc0HB;
1216           Ghb7->Fill(Rij);
1217         }
1218       }
1219     }
1220   }
1221   Ghb7->SetMarkerStyle(20);
1222   Ghb7->SetMarkerSize(0.4);
1223   Ghb7->GetYaxis()->SetLabelSize(0.04);
1224   Ghb7->SetMarkerColor(2);
1225   Ghb7->SetLineColor(0);
1226   Ghb7->SetYTitle("        N  \b");
1227   Ghb7->SetXTitle("     Rij \b");
1228   Ghb7->SetTitle(" Rij \b");
1229   //Ghb7->SetMinimum(0.8);Ghb7->SetMaximum(500.);
1230   gPad->SetGridy();
1231   gPad->SetGridx();  //            gPad->SetLogy();
1232   //      Ghb7->SetStats(1110000);
1233   Ghb7->GetYaxis()->SetLabelSize(0.025);
1234   Ghb7->Draw("Error");
1235   Float_t ymaxHB = Ghb7->GetMaximum();
1236   cout << "22HB-3   ymaxHB=  " << ymaxHB << "       MAXdif3rmsHBMIN=  " << MAXdif3rmsHBMIN
1237        << "         MINdif3rmsHBMAX=  " << MINdif3rmsHBMAX << endl;
1238   TLine* lineHB = new TLine(MAXdif3rmsHBMIN, 0., MAXdif3rmsHBMIN, ymaxHB);
1239   lineHB->SetLineColor(kBlue);
1240   lineHB->Draw();
1241   TLine* line1HB = new TLine(MINdif3rmsHBMAX, 0., MINdif3rmsHBMAX, ymaxHB);
1242   line1HB->SetLineColor(kBlue);
1243   line1HB->Draw();
1244 
1245   //================
1246   //
1247   // gain stabilitY:
1248   // Rij = Aij / A1j , where i-over LSs, j-channels
1249   //
1250 
1251   /*
1252       double ccc0 = 0.;
1253 //================      
1254       c1->cd(4);
1255       TH1F* Cefz51 = new TH1F("Cefz51","", maxbins, 1., maxbins+1.);
1256       TH1F* Cefz50= new TH1F("Cefz50","", maxbins, 1., maxbins+1.);
1257       TH1F* Cefz5 = (TH1F*)Cefz50->Clone("Cefz5");
1258       // j - etaphi index:
1259       for (int j=1;j<=ny;j++) {
1260     ccc0 =  Cefz1->GetBinContent(1,j);
1261     //  if(ccc0 <=0.) for (int i=1;i<=nx;i++) {double ccc2 =  Cefz1->GetBinContent(i,j);if(ccc2>0.){ccc0=ccc2;cout<<"!!! ccc0= "<<ccc0<<endl;break;} }
1262     if(ccc0 <=0.) for (int i=1;i<=nx;i++) {double ccc2 =  Cefz1->GetBinContent(i,j);if(ccc2>0.){ccc0=ccc2;break;} }
1263     if(ccc0>0.) { 
1264       // i - # LSs:
1265       for (int i=1;i<=nx;i++) {
1266         double ccc1 =  Cefz1->GetBinContent(i,j);
1267         if(ccc1>0.) {
1268           double Rij = ccc1/ccc0;         
1269           Cefz51 ->Fill( float(i), Rij);
1270           Cefz50->Fill( float(i), 1.);
1271         }}}}
1272       Cefz5->Divide(Cefz51,Cefz50, 1, 1, "B");// average A
1273       for (int jeta=1;jeta<=maxbins;jeta++) {Cefz5->SetBinError(jeta,0.0001);}
1274       Cefz5 ->SetMarkerStyle(20);Cefz5 ->SetMarkerSize(0.4);Cefz5 ->GetYaxis()->SetLabelSize(0.04);Cefz5 ->SetMarkerColor(2);Cefz5 ->SetLineColor(0);
1275       Cefz5->SetXTitle("        iLS  \b");  Cefz5->SetYTitle("     Rij \b");
1276       Cefz5->SetMinimum(0.);//Cefz5->SetMaximum(2.5);
1277       //            gPad->SetLogy();
1278       gPad->SetGridy();gPad->SetGridx();     
1279       Cefz5 ->Draw("Error");
1280 //================
1281       c1->cd(5);
1282       TH2F* Cefz6     = new TH2F("Cefz6","",  22, -11., 11., 18, 0., 18. );
1283       // j - etaphi index:
1284       double mincutR = 999999.;double maxcutR = -999999.;
1285       for (int j=1;j<=ny;j++) {
1286     ccc0 =  Cefz1->GetBinContent(1,j);
1287     if(ccc0 <=0.) for (int i=1;i<=nx;i++) {double ccc2 =  Cefz1->GetBinContent(i,j);if(ccc2>0.){ccc0=ccc2;break;} }
1288     if(ccc0>0.) { 
1289       int jeta = (j-1)/18;// jeta = 0-21
1290       int jphi = (j-1)-18*jeta;// jphi=0-17 
1291       // define mean and RMS:
1292       double sumj=0.; double ssumj=0.; int nj=0;double meanj=0.;double sigmaj=0.;
1293       for (int i=1;i<=nx;i++) {double ccc1 =  Cefz1->GetBinContent(i,j)/ccc0;if(ccc1>0.){sumj += ccc1;nj++;} } meanj=sumj/nj;
1294       for (int i=1;i<=nx;i++) {double ccc1 =  Cefz1->GetBinContent(i,j)/ccc0;if(ccc1>0.) {ssumj += (ccc1-meanj)*(ccc1-meanj);}} sigmaj = sqrt(ssumj/nj);
1295       //          cout<<"12    j=     "<< j <<" meanj=     "<< meanj <<" sigmaj=     "<< sigmaj <<endl;
1296       double dif3rmsMIN = meanj-3*sigmaj;if(dif3rmsMIN<0.) dif3rmsMIN = 0.;  double dif3rmsMAX = meanj+3*sigmaj;
1297       //      cout<<"12    j=     "<< j <<" dif3rmsMIN=     "<< dif3rmsMIN <<" dif3rmsMAX=     "<< dif3rmsMAX <<endl;
1298       if(dif3rmsMIN<mincutR) mincutR=dif3rmsMIN;if(dif3rmsMAX>maxcutR) maxcutR=dif3rmsMAX;
1299       // i - # LSs:
1300       for (int i=1;i<=nx;i++) {
1301         double ccc1 =  Cefz1->GetBinContent(i,j);
1302         if(ccc1>0.) {
1303           double Rij = ccc1/ccc0;         
1304           if(Rij<dif3rmsMIN || Rij>dif3rmsMAX) { Cefz6 ->Fill(jeta-11,jphi,Rij); }
1305               //    if(Rij<dif3rmsMIN || Rij>dif3rmsMAX) Cefz6 ->Fill(jeta-11,jphi,1.);
1306         }//if(ccc1>0.
1307       }// i
1308     }//if(ccc0>0 
1309       }// j
1310       Cefz6->SetMarkerStyle(20); Cefz6->SetMarkerSize(0.4); Cefz6->GetZaxis()->SetLabelSize(0.04); Cefz6->SetXTitle("Rij out 3sigma       #eta  \b"); Cefz6->SetYTitle("      #phi \b"); Cefz6->SetZTitle("sum of bad Rij  \b"); Cefz6->SetMarkerColor(2); Cefz6->SetLineColor(2);      //      Cefz6->SetMaximum(1.000);  //      Cefz6->SetMinimum(1.0);
1311       Cefz6->Draw("COLZ");
1312 //================
1313       c1->cd(6);
1314       TH1F* Cefz7 = new TH1F("Cefz7","", 100, 0.8, 1.2);
1315       // j - etaphi index:
1316       for (int j=1;j<=ny;j++) {
1317     ccc0 =  Cefz1->GetBinContent(1,j);
1318     if(ccc0 <=0.) for (int i=1;i<=nx;i++) {double ccc2 =  Cefz1->GetBinContent(i,j);if(ccc2>0.){ccc0=ccc2;break;} }
1319     if(ccc0>0.) { 
1320       // i - # LSs:
1321       for (int i=1;i<=nx;i++) {
1322         double ccc1 =  Cefz1->GetBinContent(i,j);
1323         if(ccc1>0.) {
1324           double Rij = ccc1/ccc0;         
1325           Cefz7 ->Fill( Rij );
1326         }}}}
1327       Cefz7 ->SetMarkerStyle(20);Cefz7 ->SetMarkerSize(0.4);Cefz7 ->GetYaxis()->SetLabelSize(0.04);Cefz7 ->SetMarkerColor(2);Cefz7 ->SetLineColor(0);
1328       Cefz7->SetXTitle("        iLS  \b");  Cefz7->SetYTitle("     Rij \b");
1329       //Cefz7->SetMinimum(0.8);Cefz7->SetMaximum(500.);
1330       //            gPad->SetLogy();
1331       gPad->SetGridy();gPad->SetGridx();     
1332       Cefz7 ->Draw("Error");
1333       Float_t ymax = Cefz7->GetMaximum();
1334       TLine *line = new TLine(mincutR,0.,mincutR,ymax);line->SetLineColor(4);line->Draw();
1335       TLine *line1= new TLine(maxcutR,0.,maxcutR,ymax);line1->SetLineColor(4);line1->Draw();      
1336       //================
1337 
1338 */
1339   ////////////////////////////////////////////////////////////////////////////////////
1340 
1341   c1->Update();
1342   gStyle->SetOptStat(0);
1343 
1344   //========================================================================================== 13  HB: j = 7,8,9,10            11,12,13,14      7
1345   //======================================================================
1346   //======================================================================
1347   //======================================================================
1348   c1->Clear();
1349   c1->Divide(3, 6);
1350 
1351   nx = Cefz1->GetXaxis()->GetNbins();
1352   ny = Cefz1->GetYaxis()->GetNbins();
1353   nx = maxbins;
1354 
1355   //    if( nlsohb > 0.)      nhistohb /= nlsohb;
1356   //    cout<<"HB Gforhbjeta0k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohb=     "<< nhistohb <<endl;
1357   int kcount = 1;
1358   cout << "HB Gforhbjeta0k *********************************************************************       jeta == 7    "
1359        << endl;
1360   // j - etaphi index:
1361   TH1F* h2CeffGforhbjeta0k0 = new TH1F("h2CeffGforhbjeta0k0", "", maxbins, 1., maxbins + 1.);
1362   for (int j = 1; j <= ny; j++) {
1363     int jeta = (j - 1) / 18;  // jeta = 0-21
1364     if (jeta == 7) {
1365       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1366                                            //     jeta += 1;// jeta = 1-22
1367       //      TH1F* Gforhbjeta0k0 = new TH1F("Gforhbjeta0k0","", maxbins, 1., maxbins+1.);
1368       TH1F* Gforhbjeta0k0 = (TH1F*)h2CeffGforhbjeta0k0->Clone("twod1");
1369       // i - # LSs:
1370       for (int i = 1; i <= nx; i++) {
1371         double ccc1 = Cefz1->GetBinContent(i, j);
1372         if (ccc1 > 0.) {
1373           //          if(i==1)cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1374           Gforhbjeta0k0->Fill(i, ccc1);
1375         }
1376       }
1377       c1->cd(kcount);
1378       //      cout<<"HB Gforhbjeta0k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
1379       Gforhbjeta0k0->SetMarkerStyle(20);
1380       Gforhbjeta0k0->SetMarkerSize(0.4);
1381       Gforhbjeta0k0->GetYaxis()->SetLabelSize(0.04);
1382       Gforhbjeta0k0->SetXTitle("Gforhbjeta0k0 \b");
1383       Gforhbjeta0k0->SetMarkerColor(2);
1384       Gforhbjeta0k0->SetLineColor(0);
1385       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1386       Gforhbjeta0k0->Draw("Error");
1387       kcount++;
1388       //    c1->Update();
1389       //        delete Gforhbjeta0k0;
1390       if (kcount > 18)
1391         break;
1392     }
1393   }
1394 
1395   /////////////////
1396   c1->Update();
1397   ////////////////////////////////////////////////////////////////////////////////////
1398   //========================================================================================== 14 HB: j = 7,8,9,10            11,12,13,14     8
1399   //======================================================================
1400   //======================================================================
1401   //======================================================================
1402   c1->Clear();
1403   c1->Divide(3, 6);
1404 
1405   nx = Cefz1->GetXaxis()->GetNbins();
1406   ny = Cefz1->GetYaxis()->GetNbins();
1407   nx = maxbins;
1408 
1409   //    if( nlsohb > 0.)      nhistohb /= nlsohb;
1410   //    cout<<"HB Gforhbjeta1k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohb=     "<< nhistohb <<endl;
1411   kcount = 1;
1412   cout << "HB Gforhbjeta1k *********************************************************************       jeta == 8    "
1413        << endl;
1414   // j - etaphi index:
1415   TH1F* h2CeffGforhbjeta1k0 = new TH1F("h2CeffGforhbjeta1k0", "", maxbins, 1., maxbins + 1.);
1416   for (int j = 1; j <= ny; j++) {
1417     int jeta = (j - 1) / 18;  // jeta = 0-21
1418     if (jeta == 8) {
1419       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1420                                            //     jeta += 1;// jeta = 1-22
1421       //      TH1F* Gforhbjeta1k0 = new TH1F("Gforhbjeta1k0","", maxbins, 1., maxbins+1.);
1422       TH1F* Gforhbjeta1k0 = (TH1F*)h2CeffGforhbjeta1k0->Clone("twod1");
1423       // i - # LSs:
1424       for (int i = 1; i <= nx; i++) {
1425         double ccc1 = Cefz1->GetBinContent(i, j);
1426         if (ccc1 > 0.) {
1427           //          if(i==1)cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1428           Gforhbjeta1k0->Fill(i, ccc1);
1429         }
1430       }
1431       c1->cd(kcount);
1432       //      cout<<"HB Gforhbjeta1k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
1433       Gforhbjeta1k0->SetMarkerStyle(20);
1434       Gforhbjeta1k0->SetMarkerSize(0.4);
1435       Gforhbjeta1k0->GetYaxis()->SetLabelSize(0.04);
1436       Gforhbjeta1k0->SetXTitle("Gforhbjeta1k0 \b");
1437       Gforhbjeta1k0->SetMarkerColor(2);
1438       Gforhbjeta1k0->SetLineColor(0);
1439       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1440       Gforhbjeta1k0->Draw("Error");
1441       kcount++;
1442       //    c1->Update();
1443       //        delete Gforhbjeta1k0;
1444       if (kcount > 18)
1445         break;
1446     }
1447   }
1448 
1449   /////////////////
1450   c1->Update();
1451   ////////////////////////////////////////////////////////////////////////////////////
1452   //========================================================================================== 15 HB: j = 7,8,9,10            11,12,13,14      9
1453   //======================================================================
1454   //======================================================================
1455   //======================================================================
1456   c1->Clear();
1457   c1->Divide(3, 6);
1458 
1459   nx = Cefz1->GetXaxis()->GetNbins();
1460   ny = Cefz1->GetYaxis()->GetNbins();
1461   nx = maxbins;
1462 
1463   //    if( nlsohb > 0.)      nhistohb /= nlsohb;
1464   //    cout<<"HB Gforhbjeta2k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohb=     "<< nhistohb <<endl;
1465   kcount = 1;
1466   cout << "HB Gforhbjeta2k *********************************************************************       jeta == 9    "
1467        << endl;
1468   // j - etaphi index:
1469   TH1F* h2CeffGforhbjeta2k0 = new TH1F("h2CeffGforhbjeta2k0", "", maxbins, 1., maxbins + 1.);
1470   for (int j = 1; j <= ny; j++) {
1471     int jeta = (j - 1) / 18;  // jeta = 0-21
1472     if (jeta == 9) {
1473       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1474                                            //     jeta += 1;// jeta = 1-22
1475       //      TH1F* Gforhbjeta2k0 = new TH1F("Gforhbjeta2k0","", maxbins, 1., maxbins+1.);
1476       TH1F* Gforhbjeta2k0 = (TH1F*)h2CeffGforhbjeta2k0->Clone("twod1");
1477       // i - # LSs:
1478       for (int i = 1; i <= nx; i++) {
1479         double ccc1 = Cefz1->GetBinContent(i, j);
1480         if (ccc1 > 0.) {
1481           //          if(i==1)cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1482           Gforhbjeta2k0->Fill(i, ccc1);
1483         }
1484       }
1485       c1->cd(kcount);
1486       //      cout<<"HB Gforhbjeta2k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
1487       Gforhbjeta2k0->SetMarkerStyle(20);
1488       Gforhbjeta2k0->SetMarkerSize(0.4);
1489       Gforhbjeta2k0->GetYaxis()->SetLabelSize(0.04);
1490       Gforhbjeta2k0->SetXTitle("Gforhbjeta2k0 \b");
1491       Gforhbjeta2k0->SetMarkerColor(2);
1492       Gforhbjeta2k0->SetLineColor(0);
1493       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1494       Gforhbjeta2k0->Draw("Error");
1495       kcount++;
1496       //    c1->Update();
1497       //        delete Gforhbjeta2k0;
1498       if (kcount > 18)
1499         break;
1500     }
1501   }
1502 
1503   /////////////////
1504   c1->Update();
1505   ////////////////////////////////////////////////////////////////////////////////////
1506   //========================================================================================== 16 HB: j = 7,8,9,10            11,12,13,14       10
1507   //======================================================================
1508   //======================================================================
1509   //======================================================================
1510   c1->Clear();
1511   c1->Divide(3, 6);
1512 
1513   nx = Cefz1->GetXaxis()->GetNbins();
1514   ny = Cefz1->GetYaxis()->GetNbins();
1515   nx = maxbins;
1516 
1517   //    if( nlsohb > 0.)      nhistohb /= nlsohb;
1518   //    cout<<"HB Gforhbjeta3k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohb=     "<< nhistohb <<endl;
1519   kcount = 1;
1520   cout << "HB Gforhbjeta3k *********************************************************************       jeta == 10   "
1521        << endl;
1522   // j - etaphi index:
1523   TH1F* h2CeffGforhbjeta3k0 = new TH1F("h2CeffGforhbjeta3k0", "", maxbins, 1., maxbins + 1.);
1524   for (int j = 1; j <= ny; j++) {
1525     int jeta = (j - 1) / 18;  // jeta = 0-21
1526     if (jeta == 10) {
1527       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1528                                            //     jeta += 1;// jeta = 1-22
1529       //      TH1F* Gforhbjeta3k0 = new TH1F("Gforhbjeta3k0","", maxbins, 1., maxbins+1.);
1530       TH1F* Gforhbjeta3k0 = (TH1F*)h2CeffGforhbjeta3k0->Clone("twod1");
1531       // i - # LSs:
1532       for (int i = 1; i <= nx; i++) {
1533         double ccc1 = Cefz1->GetBinContent(i, j);
1534         if (ccc1 > 0.) {
1535           //          if(i==1)cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1536           Gforhbjeta3k0->Fill(i, ccc1);
1537         }
1538       }
1539       c1->cd(kcount);
1540       //      cout<<"HB Gforhbjeta3k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
1541       Gforhbjeta3k0->SetMarkerStyle(20);
1542       Gforhbjeta3k0->SetMarkerSize(0.4);
1543       Gforhbjeta3k0->GetYaxis()->SetLabelSize(0.04);
1544       Gforhbjeta3k0->SetXTitle("Gforhbjeta3k0 \b");
1545       Gforhbjeta3k0->SetMarkerColor(2);
1546       Gforhbjeta3k0->SetLineColor(0);
1547       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1548       Gforhbjeta3k0->Draw("Error");
1549       kcount++;
1550       //    c1->Update();
1551       //        delete Gforhbjeta3k0;
1552       if (kcount > 18)
1553         break;
1554     }
1555   }
1556 
1557   /////////////////
1558   c1->Update();
1559   ////////////////////////////////////////////////////////////////////////////////////
1560   //========================================================================================== 17 HB: j = 7,8,9,10            11,12,13,14        11
1561   //======================================================================
1562   //======================================================================
1563   //======================================================================
1564   c1->Clear();
1565   c1->Divide(3, 6);
1566 
1567   nx = Cefz1->GetXaxis()->GetNbins();
1568   ny = Cefz1->GetYaxis()->GetNbins();
1569   nx = maxbins;
1570 
1571   //    if( nlsohb > 0.)      nhistohb /= nlsohb;
1572   //    cout<<"HB Gforhbjeta18k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohb=     "<< nhistohb <<endl;
1573   kcount = 1;
1574   cout << "HB Gforhbjeta18k *********************************************************************       jeta == 11    "
1575        << endl;
1576   // j - etaphi index:
1577   TH1F* h2CeffGforhbjeta18k0 = new TH1F("h2CeffGforhbjeta18k0", "", maxbins, 1., maxbins + 1.);
1578   for (int j = 1; j <= ny; j++) {
1579     int jeta = (j - 1) / 18;  // jeta = 0-21
1580     if (jeta == 11) {
1581       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1582                                            //     jeta += 1;// jeta = 1-22
1583       //      TH1F* Gforhbjeta18k0 = new TH1F("Gforhbjeta18k0","", maxbins, 1., maxbins+1.);
1584       TH1F* Gforhbjeta18k0 = (TH1F*)h2CeffGforhbjeta18k0->Clone("twod1");
1585       // i - # LSs:
1586       for (int i = 1; i <= nx; i++) {
1587         double ccc1 = Cefz1->GetBinContent(i, j);
1588         if (ccc1 > 0.) {
1589           //          if(i==1)cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1590           Gforhbjeta18k0->Fill(i, ccc1);
1591         }
1592       }
1593       c1->cd(kcount);
1594       //      cout<<"HB Gforhbjeta18k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
1595       Gforhbjeta18k0->SetMarkerStyle(20);
1596       Gforhbjeta18k0->SetMarkerSize(0.4);
1597       Gforhbjeta18k0->GetYaxis()->SetLabelSize(0.04);
1598       Gforhbjeta18k0->SetXTitle("Gforhbjeta18k0 \b");
1599       Gforhbjeta18k0->SetMarkerColor(2);
1600       Gforhbjeta18k0->SetLineColor(0);
1601       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1602       Gforhbjeta18k0->Draw("Error");
1603       kcount++;
1604       //    c1->Update();
1605       //        delete Gforhbjeta18k0;
1606       if (kcount > 18)
1607         break;
1608     }
1609   }
1610 
1611   /////////////////
1612   c1->Update();
1613   ////////////////////////////////////////////////////////////////////////////////////
1614   //========================================================================================== 18 HB: j = 7,8,9,10            11,12,13,14       12
1615   //======================================================================
1616   //======================================================================
1617   //======================================================================
1618   c1->Clear();
1619   c1->Divide(3, 6);
1620 
1621   nx = Cefz1->GetXaxis()->GetNbins();
1622   ny = Cefz1->GetYaxis()->GetNbins();
1623   nx = maxbins;
1624 
1625   //    if( nlsohb > 0.)      nhistohb /= nlsohb;
1626   //    cout<<"HB Gforhbjeta19k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohb=     "<< nhistohb <<endl;
1627   kcount = 1;
1628   cout << "HB Gforhbjeta19k *********************************************************************       jeta == 12    "
1629        << endl;
1630   // j - etaphi index:
1631   TH1F* h2CeffGforhbjeta19k0 = new TH1F("h2CeffGforhbjeta19k0", "", maxbins, 1., maxbins + 1.);
1632   for (int j = 1; j <= ny; j++) {
1633     int jeta = (j - 1) / 18;  // jeta = 0-21
1634     if (jeta == 12) {
1635       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1636                                            //     jeta += 1;// jeta = 1-22
1637       //      TH1F* Gforhbjeta19k0 = new TH1F("Gforhbjeta19k0","", maxbins, 1., maxbins+1.);
1638       TH1F* Gforhbjeta19k0 = (TH1F*)h2CeffGforhbjeta19k0->Clone("twod1");
1639       // i - # LSs:
1640       for (int i = 1; i <= nx; i++) {
1641         double ccc1 = Cefz1->GetBinContent(i, j);
1642         if (ccc1 > 0.) {
1643           //          if(i==1)cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1644           Gforhbjeta19k0->Fill(i, ccc1);
1645         }
1646       }
1647       c1->cd(kcount);
1648       //      cout<<"HB Gforhbjeta19k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
1649       Gforhbjeta19k0->SetMarkerStyle(20);
1650       Gforhbjeta19k0->SetMarkerSize(0.4);
1651       Gforhbjeta19k0->GetYaxis()->SetLabelSize(0.04);
1652       Gforhbjeta19k0->SetXTitle("Gforhbjeta19k0 \b");
1653       Gforhbjeta19k0->SetMarkerColor(2);
1654       Gforhbjeta19k0->SetLineColor(0);
1655       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1656       Gforhbjeta19k0->Draw("Error");
1657       kcount++;
1658       //    c1->Update();
1659       //        delete Gforhbjeta19k0;
1660       if (kcount > 18)
1661         break;
1662     }
1663   }
1664 
1665   /////////////////
1666   c1->Update();
1667   ////////////////////////////////////////////////////////////////////////////////////
1668   //========================================================================================== 19 HB: j = 7,8,9,10            11,12,13,14       13
1669   //======================================================================
1670   //======================================================================
1671   //======================================================================
1672   c1->Clear();
1673   c1->Divide(3, 6);
1674 
1675   nx = Cefz1->GetXaxis()->GetNbins();
1676   ny = Cefz1->GetYaxis()->GetNbins();
1677   nx = maxbins;
1678 
1679   //    if( nlsohb > 0.)      nhistohb /= nlsohb;
1680   //    cout<<"HB Gforhbjeta20k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohb=     "<< nhistohb <<endl;
1681   kcount = 1;
1682   cout << "HB Gforhbjeta20k *********************************************************************       jeta == 13    "
1683        << endl;
1684   // j - etaphi index:
1685   TH1F* h2CeffGforhbjeta20k0 = new TH1F("h2CeffGforhbjeta20k0", "", maxbins, 1., maxbins + 1.);
1686   for (int j = 1; j <= ny; j++) {
1687     int jeta = (j - 1) / 18;  // jeta = 0-21
1688     if (jeta == 13) {
1689       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1690                                            //     jeta += 1;// jeta = 1-22
1691       //      TH1F* Gforhbjeta20k0 = new TH1F("Gforhbjeta20k0","", maxbins, 1., maxbins+1.);
1692       TH1F* Gforhbjeta20k0 = (TH1F*)h2CeffGforhbjeta20k0->Clone("twod1");
1693       // i - # LSs:
1694       for (int i = 1; i <= nx; i++) {
1695         double ccc1 = Cefz1->GetBinContent(i, j);
1696         if (ccc1 > 0.) {
1697           //          if(i==1)cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1698           Gforhbjeta20k0->Fill(i, ccc1);
1699         }
1700       }
1701       c1->cd(kcount);
1702       //      cout<<"HB Gforhbjeta20k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
1703       Gforhbjeta20k0->SetMarkerStyle(20);
1704       Gforhbjeta20k0->SetMarkerSize(0.4);
1705       Gforhbjeta20k0->GetYaxis()->SetLabelSize(0.04);
1706       Gforhbjeta20k0->SetXTitle("Gforhbjeta20k0 \b");
1707       Gforhbjeta20k0->SetMarkerColor(2);
1708       Gforhbjeta20k0->SetLineColor(0);
1709       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1710       Gforhbjeta20k0->Draw("Error");
1711       kcount++;
1712       //    c1->Update();
1713       //        delete Gforhbjeta20k0;
1714       if (kcount > 18)
1715         break;
1716     }
1717   }
1718 
1719   /////////////////
1720   c1->Update();
1721   ////////////////////////////////////////////////////////////////////////////////////
1722   //========================================================================================== 20 HB: j = 7,8,9,10            11,12,13,14        14
1723   //======================================================================
1724   //======================================================================
1725   //======================================================================
1726   c1->Clear();
1727   c1->Divide(3, 6);
1728 
1729   nx = Cefz1->GetXaxis()->GetNbins();
1730   ny = Cefz1->GetYaxis()->GetNbins();
1731   nx = maxbins;
1732 
1733   //    if( nlsohb > 0.)      nhistohb /= nlsohb;
1734   //    cout<<"HB Gforhbjeta21k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohb=     "<< nhistohb <<endl;
1735   kcount = 1;
1736   cout << "HB Gforhbjeta21k *********************************************************************       jeta == 14    "
1737        << endl;
1738   // j - etaphi index:
1739   TH1F* h2CeffGforhbjeta21k0 = new TH1F("h2CeffGforhbjeta21k0", "", maxbins, 1., maxbins + 1.);
1740   for (int j = 1; j <= ny; j++) {
1741     int jeta = (j - 1) / 18;  // jeta = 0-21
1742     if (jeta == 14) {
1743       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1744                                            //     jeta += 1;// jeta = 1-22
1745       //      TH1F* Gforhbjeta21k0 = new TH1F("Gforhbjeta21k0","", maxbins, 1., maxbins+1.);
1746       TH1F* Gforhbjeta21k0 = (TH1F*)h2CeffGforhbjeta21k0->Clone("twod1");
1747       // i - # LSs:
1748       for (int i = 1; i <= nx; i++) {
1749         double ccc1 = Cefz1->GetBinContent(i, j);
1750         if (ccc1 > 0.) {
1751           //          if(i==1)cout<<"HB  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1752           Gforhbjeta21k0->Fill(i, ccc1);
1753         }
1754       }
1755       c1->cd(kcount);
1756       //      cout<<"HB Gforhbjeta21k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
1757       Gforhbjeta21k0->SetMarkerStyle(20);
1758       Gforhbjeta21k0->SetMarkerSize(0.4);
1759       Gforhbjeta21k0->GetYaxis()->SetLabelSize(0.04);
1760       Gforhbjeta21k0->SetXTitle("Gforhbjeta21k0 \b");
1761       Gforhbjeta21k0->SetMarkerColor(2);
1762       Gforhbjeta21k0->SetLineColor(0);
1763       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1764       Gforhbjeta21k0->Draw("Error");
1765       kcount++;
1766       //    c1->Update();
1767       //        delete Gforhbjeta21k0;
1768       if (kcount > 18)
1769         break;
1770     }
1771   }
1772 
1773   /////////////////
1774   c1->Update();
1775   ////////////////////////////////////////////////////////////////////////////////////
1776   //========================================================================================== 21    HE - "h_2DsumADCAmplEtaPhiLs1
1777   //======================================================================
1778   //======================================================================
1779   //================
1780   //======================================================================
1781   c1->Clear();
1782   c1->Divide(2, 2);
1783 
1784   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1785   TH2F* Sefz1KKK = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs1");
1786   TH2F* Sefz1LLL = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs10");
1787   TH2F* Sefz1 = (TH2F*)Sefz1LLL->Clone("Sefz1");
1788   Sefz1->Divide(Sefz1KKK, Sefz1LLL, 1, 1, "B");  // average A
1789   Sefz1->Sumw2();
1790 
1791   c1->cd(1);
1792   maxbinx = 0;
1793   maxbiny = 0;
1794   int sumijhe = 0;
1795   nx = Sefz1->GetXaxis()->GetNbins();
1796   ny = Sefz1->GetYaxis()->GetNbins();
1797   nx = maxbins;
1798   cout << "HE h_2DsumADCAmplEtaPhiLs0         nx=     " << nx << " ny=     " << ny << endl;
1799   // i - # LSs:
1800   TH1F* Sefw0 = new TH1F("Sefw0", "", 200, 0., 15000.);
1801   for (int i = 1; i <= nx; i++) {
1802     // j - etaphi index:
1803     for (int j = 1; j <= ny; j++) {
1804       double ccc1 = Sefz1->GetBinContent(i, j);
1805       if (ccc1 > 0.) {
1806         sumijhe++;
1807         maxbinx = i;
1808         if (i > maxbinx)
1809           maxbinx = i;
1810         maxbiny = j;
1811         if (j > maxbiny)
1812           maxbiny = j;
1813         //    cout<<"HE h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
1814         Sefw0->Fill(ccc1);
1815       }
1816     }
1817   }
1818   cout << "HE maxbinx=  " << maxbinx << "     maxbiny=  " << maxbiny << "     sumijhe=  " << sumijhe << endl;
1819   Sefw0->SetMarkerStyle(20);
1820   Sefw0->SetMarkerSize(0.4);
1821   Sefw0->GetYaxis()->SetLabelSize(0.04);
1822   Sefw0->SetXTitle("<A>ijk = <A> averaged per events in k-th LS \b");
1823   Sefw0->SetYTitle("     HE \b");
1824   Sefw0->SetMarkerColor(2);
1825   Sefw0->SetLineColor(0);
1826   Sefw0->SetMinimum(10.);
1827   gPad->SetLogy();
1828   gPad->SetGridy();
1829   gPad->SetGridx();
1830   //      Sefw0 ->Draw("L");
1831   Sefw0->Draw("Error");
1832   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1833   c1->cd(2);
1834   TH1F* Sefw = new TH1F("Sefw", "", maxbins, 1., maxbins + 1.);
1835   // i - # LSs:
1836   for (int i = 1; i <= nx; i++) {
1837     // j - etaphi index:
1838     for (int j = 1; j <= ny; j++) {
1839       double ccc1 = Sefz1->GetBinContent(i, j);
1840       if (ccc1 > 0.) {
1841         //    cout<<"HE h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
1842         //    Sefw ->Fill(ccc1/maxbinx);
1843         Sefw->Fill(float(i), ccc1* maxbinx / sumijhe);
1844       }
1845     }
1846   }
1847   Sefw->SetMarkerStyle(20);
1848   Sefw->SetMarkerSize(0.4);
1849   Sefw->GetYaxis()->SetLabelSize(0.04);
1850   Sefw->SetMarkerColor(2);
1851   Sefw->SetLineColor(0);
1852   Sefw->SetXTitle("        iLS  \b");
1853   Sefw->SetYTitle("     <A>k \b");
1854   //Sefw->SetMinimum(0.8);Sefw->SetMaximum(500.);
1855   gPad->SetLogy();
1856   gPad->SetGridy();
1857   gPad->SetGridx();
1858   Sefw->Draw("Error");
1859 
1860   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1861   c1->cd(3);
1862   TH1F* Sefw1 = new TH1F("Sefw1", "", 100, 0., 9000.);
1863   for (int i = 1; i <= nx; i++) {
1864     // j - etaphi index:
1865     for (int j = 1; j <= ny; j++) {
1866       double ccc1 = Sefz1->GetBinContent(i, j);
1867       if (ccc1 > 0.) {
1868         maxbinx = i;
1869         if (i > maxbinx)
1870           maxbinx = i;
1871         maxbiny = j;
1872         if (j > maxbiny)
1873           maxbiny = j;
1874         //    cout<<"HE h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
1875         Sefw1->Fill(ccc1);
1876       }
1877     }
1878   }
1879   cout << "HE maxbinx=  " << maxbinx << "     maxbiny=  " << maxbiny << endl;
1880   Sefw1->SetMarkerStyle(20);
1881   Sefw1->SetMarkerSize(0.4);
1882   Sefw1->GetYaxis()->SetLabelSize(0.04);
1883   Sefw1->SetXTitle("<A>ijk = <A> averaged per events in k-th LS \b");
1884   Sefw1->SetMarkerColor(2);
1885   Sefw1->SetLineColor(0);
1886   //Sefw1->SetMinimum(0.8);
1887   gPad->SetLogy();
1888   gPad->SetGridy();
1889   gPad->SetGridx();
1890   //      Sefw1 ->Draw("L");
1891   Sefw1->Draw("Error");
1892 
1893   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1894   c1->cd(4);
1895   // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ;  k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
1896   TH2F* Sefz4 = new TH2F("Sefz4", "", 22, -11., 11., 18, 0., 18.);
1897   // i - # LSs:
1898   for (int i = 1; i <= nx; i++) {
1899     // j - etaphi index:
1900     for (int j = 1; j <= ny; j++) {
1901       double ccc1 = Sefz1->GetBinContent(i, j);
1902       //if(ccc1>0.) cout<<"HE h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1/maxbinx <<endl;
1903       //    if(ccc1>0. && ccc1/maxbinx < 2000) {
1904       if (ccc1 > 0.) {
1905         int jeta = (j - 1) / 18;             // jeta = 0-21
1906         int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1907         //    jeta += 1;// jeta = 1-22
1908         //        if(i==1) cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta-11 <<" jphi= "<< jphi-1 <<"  A= "<< ccc1/maxbinx <<endl;
1909         //    Sefz4 ->Fill(jeta-11,jphi-1,ccc1/maxbinx);
1910         Sefz4->Fill(jeta - 11, jphi - 1, ccc1 * maxbiny / sumijhe);
1911       }
1912     }
1913   }
1914   gPad->SetGridy();
1915   gPad->SetGridx();  //      gPad->SetLogz();
1916   Sefz4->SetMarkerStyle(20);
1917   Sefz4->SetMarkerSize(0.4);
1918   Sefz4->GetZaxis()->SetLabelSize(0.08);
1919   Sefz4->SetXTitle("<A>ij         #eta  \b");
1920   Sefz4->SetYTitle("      #phi \b");
1921   Sefz4->SetZTitle("<A>ij  - All \b");
1922   Sefz4->SetMarkerColor(2);
1923   Sefz4->SetLineColor(2);  //      Sefz4->SetMaximum(1.000);  //      Sefz4->SetMinimum(1.0);
1924   Sefz4->Draw("COLZ");
1925 
1926   c1->Update();
1927 
1928   //======================================================================
1929 
1930   //========================================================================================== 22 HE
1931   //======================================================================
1932   //======================================================================
1933   //======================================================================
1934   c1->Clear();
1935   c1->Divide(2, 3);
1936 
1937   c1->cd(1);
1938   nx = Sefz1->GetXaxis()->GetNbins();
1939   ny = Sefz1->GetYaxis()->GetNbins();
1940   nx = maxbins;
1941   cout << "HE Sefk        nx=     " << nx << " ny=     " << ny << endl;
1942   TH1F* Sefk0 = new TH1F("Sefk0", "", maxbins, 1., maxbins + 1.);
1943   TH1F* Sefk1 = new TH1F("Sefk1", "", maxbins, 1., maxbins + 1.);
1944   TH1F* Sefk2 = new TH1F("Sefk2", "", maxbins, 1., maxbins + 1.);
1945   // i - # LSs:
1946   for (int i = 1; i <= nx; i++) {
1947     // j - etaphi index:
1948     for (int j = 1; j <= ny; j++) {
1949       double ccc1 = Sefz1->GetBinContent(i, j);
1950       if (ccc1 > 0.) {
1951         int jeta = (j - 1) / 18;             // jeta = 0-21
1952         int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
1953         //    jeta += 1;// jeta = 1-22
1954         //      cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
1955         if (jeta == 4 && jphi == 11)
1956           Sefk0->Fill(i, ccc1);
1957         if (jeta == 5 && jphi == 11)
1958           Sefk1->Fill(i, ccc1);
1959         if (jeta == 16 && jphi == 11)
1960           Sefk2->Fill(i, ccc1);
1961       }
1962     }
1963   }
1964   Sefk0->SetMarkerStyle(20);
1965   Sefk0->SetMarkerSize(0.4);
1966   Sefk0->GetYaxis()->SetLabelSize(0.04);
1967   Sefk0->SetXTitle("Sefk0 \b");
1968   Sefk0->SetMarkerColor(2);
1969   Sefk0->SetLineColor(
1970       0);  // Sefk0 ->SetMaximum(30.0);// Sefk0 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1971   Sefk0->Draw("Error");
1972 
1973   //================
1974   c1->cd(2);
1975   Sefk1->SetMarkerStyle(20);
1976   Sefk1->SetMarkerSize(0.4);
1977   Sefk1->GetYaxis()->SetLabelSize(0.04);
1978   Sefk1->SetXTitle("Sefk1 \b");
1979   Sefk1->SetMarkerColor(2);
1980   Sefk1->SetLineColor(
1981       0);  // Sefk1 ->SetMaximum(30.0);// Sefk1 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1982   Sefk1->Draw("Error");
1983 
1984   //================
1985   c1->cd(3);
1986   Sefk2->SetMarkerStyle(20);
1987   Sefk2->SetMarkerSize(0.4);
1988   Sefk2->GetYaxis()->SetLabelSize(0.04);
1989   Sefk2->SetXTitle("Sefk2 \b");
1990   Sefk2->SetMarkerColor(2);
1991   Sefk2->SetLineColor(
1992       0);  // Sefk2 ->SetMaximum(30.0);// Sefk2 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
1993   Sefk2->Draw("Error");
1994 
1995   //======================================================================
1996   //================
1997   //
1998   // gain stabilitY:
1999   // Rij = Aij / A1j , where i-over LSs, j-channels
2000   //
2001   double ccc0E = 0.;
2002   //================
2003   /*
2004       c1->cd(4);
2005       TH1F* Sefz51 = new TH1F("Sefz51","", maxbins, 1., maxbins+1.);
2006       TH1F* Sefz50= new TH1F("Sefz50","", maxbins, 1., maxbins+1.);
2007       TH1F* Sefz5 = (TH1F*)Sefz50->Clone("Sefz5");
2008       // j - etaphi index:
2009       for (int j=1;j<=ny;j++) {
2010     ccc0E =  Sefz1->GetBinContent(1,j);
2011     //  if(ccc0E <=0.) for (int i=1;i<=nx;i++) {double ccc2 =  Sefz1->GetBinContent(i,j);if(ccc2>0.){ccc0E=ccc2;cout<<"!!! ccc0E= "<<ccc0E<<endl;break;} }
2012     if(ccc0E <=0.) for (int i=1;i<=nx;i++) {double ccc2 =  Sefz1->GetBinContent(i,j);if(ccc2>0.){ccc0E=ccc2;break;} }
2013     if(ccc0E>0.) { 
2014       int jeta = (j-1)/18;// jeta = 0-21
2015       int jphi = (j-1)-18*jeta;// jphi=0-17 
2016       // i - # LSs:
2017       for (int i=1;i<=nx;i++) {
2018         double ccc1 =  Sefz1->GetBinContent(i,j);
2019         if(ccc1>0.) {
2020           double Rij = ccc1/ccc0E;        
2021           Sefz51 ->Fill( float(i), Rij);
2022           Sefz50->Fill( float(i), 1.);
2023         }//if(ccc1>0.
2024       }// i
2025       //      }// j
2026       Sefz5->Divide(Sefz51,Sefz50, 1, 1, "B");// average A
2027       for (int i=1;i<=maxbins;i++) {Sefz5->SetBinError(i,0.0001);}
2028       //
2029       cout<< "j=  " <<j  << "    jeta=  " <<jeta  << "   jphi=  " <<jphi  << "  j/50+1=  " << j/50+1  << "  maxbins= " << maxbins  << "  BinContent(maxbins)=  " << Sefz5->GetBinContent(maxbins) <<endl;
2030             Sefz5 ->SetMarkerColor(j/50+1);
2031       //Sefz5 ->SetMarkerColor(jeta);
2032       //Sefz5 ->SetMarkerColor(jphi);
2033       //      Sefz5 ->SetMarkerColor(2);
2034       Sefz5 ->SetMarkerStyle(20);Sefz5 ->SetMarkerSize(0.4);Sefz5 ->GetYaxis()->SetLabelSize(0.04);Sefz5 ->SetLineColor(0);Sefz5->SetXTitle("        iLS  \b");  Sefz5->SetYTitle("     Rij \b");
2035       gPad->SetGridy();gPad->SetGridx();  //            gPad->SetLogy();
2036       //      Sefz5 ->Draw("Error");
2037       //Sefz5->SetMinimum(0.995);Sefz5->SetMaximum(1.005);
2038       Sefz5 ->Draw("ErrorSame");
2039     }//if(ccc0E>0 
2040       }// j
2041 */
2042   //================
2043 
2044   c1->cd(4);
2045   //    TH1F* Sefz5 = new TH1F("Sefz5","", maxbins, 1., maxbins+1.);
2046   TH1F* Sefz51 = new TH1F("Sefz51", "", maxbins, 1., maxbins + 1.);
2047   TH1F* Sefz50 = new TH1F("Sefz50", "", maxbins, 1., maxbins + 1.);
2048   TH1F* Sefz5 = (TH1F*)Sefz50->Clone("Sefz5");
2049   // j - etaphi index:
2050   for (int j = 1; j <= ny; j++) {
2051     ccc0E = Sefz1->GetBinContent(1, j);
2052     //  if(ccc0E <=0.) for (int i=1;i<=nx;i++) {double ccc2 =  Sefz1->GetBinContent(i,j);if(ccc2>0.){ccc0E=ccc2;cout<<"!!! ccc0E= "<<ccc0E<<endl;break;} }
2053     if (ccc0E <= 0.)
2054       for (int i = 1; i <= nx; i++) {
2055         double ccc2 = Sefz1->GetBinContent(i, j);
2056         if (ccc2 > 0.) {
2057           ccc0E = ccc2;
2058           break;
2059         }
2060       }
2061 
2062     cout << "!!! ccc0E= " << ccc0E << endl;
2063 
2064     if (ccc0E > 0.) {
2065       // i - # LSs:
2066       for (int i = 1; i <= nx; i++) {
2067         double ccc1 = Sefz1->GetBinContent(i, j);
2068         if (ccc1 > 0.) {
2069           double Rij = ccc1 / ccc0E;
2070           //    Sefz5 ->Fill( float(i), Rij);
2071           Sefz51->Fill(float(i), Rij);
2072           Sefz50->Fill(float(i), 1.);
2073         }
2074       }
2075     }
2076   }
2077   Sefz5->Divide(Sefz51, Sefz50, 1, 1, "B");  // average A
2078   for (int jeta = 1; jeta <= maxbins; jeta++) {
2079     Sefz5->SetBinError(jeta, 0.0001);
2080   }
2081   Sefz5->SetMarkerStyle(20);
2082   Sefz5->SetMarkerSize(0.4);
2083   Sefz5->GetYaxis()->SetLabelSize(0.04);
2084   Sefz5->SetMarkerColor(2);
2085   Sefz5->SetLineColor(0);
2086   Sefz5->SetXTitle("        iLS  \b");
2087   Sefz5->SetYTitle("     <R> \b");
2088   Sefz5->SetMinimum(0.);  //Sefz5->SetMaximum(2.5);
2089   //            gPad->SetLogy();
2090   gPad->SetGridy();
2091   gPad->SetGridx();
2092   Sefz5->Draw("Error");
2093 
2094   //================
2095   c1->cd(5);
2096   TH2F* Sefz60 = new TH2F("Sefz60", "", 22, -11., 11., 18, 0., 18.);
2097   TH2F* Sefz61 = new TH2F("Sefz61", "", 22, -11., 11., 18, 0., 18.);
2098   TH2F* Sefz6 = new TH2F("Sefz6", "", 22, -11., 11., 18, 0., 18.);
2099   // j - etaphi index; i - # LSs;
2100   //
2101   // define mean and RMS:
2102   double sumj = 0.;
2103   int nj = 0;
2104   double meanj = 0.;
2105   for (int j = 1; j <= ny; j++) {
2106     ccc0E = Sefz1->GetBinContent(1, j);
2107     if (ccc0E <= 0.)
2108       for (int i = 1; i <= nx; i++) {
2109         double ccc2 = Sefz1->GetBinContent(i, j);
2110         if (ccc2 > 0.) {
2111           ccc0E = ccc2;
2112           break;
2113         }
2114       }
2115     if (ccc0E > 0.) {
2116       for (int i = 1; i <= nx; i++) {
2117         double ccc1 = Sefz1->GetBinContent(i, j) / ccc0E;
2118         if (ccc1 > 0.) {
2119           sumj += ccc1;
2120           nj++;
2121         }
2122       }
2123       meanj = sumj / nj;
2124     }
2125   }  // j
2126 
2127   double ssumj = 0.;
2128   nj = 0;
2129   double sigmaj = 0.;
2130   for (int j = 1; j <= ny; j++) {
2131     ccc0E = Sefz1->GetBinContent(1, j);
2132     if (ccc0E <= 0.)
2133       for (int i = 1; i <= nx; i++) {
2134         double ccc2 = Sefz1->GetBinContent(i, j);
2135         if (ccc2 > 0.) {
2136           ccc0E = ccc2;
2137           break;
2138         }
2139       }
2140     if (ccc0E > 0.) {
2141       for (int i = 1; i <= nx; i++) {
2142         double ccc1 = Sefz1->GetBinContent(i, j) / ccc0E;
2143         if (ccc1 > 0.) {
2144           ssumj += (ccc1 - meanj) * (ccc1 - meanj);
2145           nj++;
2146         }
2147       }
2148       sigmaj = sqrt(ssumj / nj);
2149     }
2150   }  // j
2151 
2152   double dif3rmsMIN = meanj - 3 * sigmaj;
2153   if (dif3rmsMIN < 0.)
2154     dif3rmsMIN = 0.;
2155   double dif3rmsMAX = meanj + 3 * sigmaj;
2156   cout << "22-5    meanj=  " << meanj << "  sigmaj=  " << sigmaj << "  dif3rmsMIN=  " << dif3rmsMIN
2157        << "  dif3rmsMAX=  " << dif3rmsMAX << endl;
2158 
2159   double MAXdif3rmsMIN = dif3rmsMIN;
2160   double MINdif3rmsMAX = dif3rmsMAX;
2161   if (MAXdif3rmsMIN < 0.95)
2162     MAXdif3rmsMIN = 0.95;
2163   if (MINdif3rmsMAX > 1.05)
2164     MINdif3rmsMAX = 1.05;
2165   cout << "22-5     MAXdif3rmsMIN=  " << MAXdif3rmsMIN << "     MINdif3rmsMAX=  " << MINdif3rmsMAX << endl;
2166   //
2167   for (int j = 1; j <= ny; j++) {
2168     ccc0E = Sefz1->GetBinContent(1, j);
2169     if (ccc0E <= 0.)
2170       for (int i = 1; i <= nx; i++) {
2171         double ccc2 = Sefz1->GetBinContent(i, j);
2172         if (ccc2 > 0.) {
2173           ccc0E = ccc2;
2174           break;
2175         }
2176       }
2177     if (ccc0E > 0.) {
2178       int jeta = (j - 1) / 18;         // jeta = 0-21
2179       int jphi = (j - 1) - 18 * jeta;  // jphi=0-17
2180       // i - # LSs:
2181       for (int i = 1; i <= nx; i++) {
2182         double ccc1 = Sefz1->GetBinContent(i, j);
2183         if (ccc1 > 0.) {
2184           double Rij = ccc1 / ccc0E;
2185           if (Rij < MAXdif3rmsMIN || Rij > MINdif3rmsMAX) {
2186             Sefz61->Fill(jeta - 11, jphi, Rij);
2187             Sefz60->Fill(jeta - 11, jphi, 1.);
2188           }
2189         }                                    //if(ccc1>0.
2190       }                                      // i
2191     }                                        //if(ccc0E>0
2192   }                                          // j
2193   Sefz6->Divide(Sefz61, Sefz60, 1, 1, "B");  // average R
2194 
2195   Sefz6->SetMarkerStyle(20);
2196   Sefz6->SetMarkerSize(0.4);
2197   Sefz6->GetZaxis()->SetLabelSize(0.04);
2198   Sefz6->SetXTitle("<Rj> outside_Cuts         #eta  \b");
2199   Sefz6->SetYTitle("      #phi \b");
2200   Sefz6->SetZTitle("Rij averaged over LSs \b");
2201   Sefz6->SetMarkerColor(2);
2202   Sefz6->SetLineColor(2);  //      Sefz6->SetMaximum(1.000);  //      Sefz6->SetMinimum(1.0);
2203   Sefz6->Draw("COLZ");
2204   //================
2205   c1->cd(6);
2206   TH1F* Sefz7 = new TH1F("Sefz7", "", 120, 0.4, 1.6);
2207   // j - etaphi index:
2208   for (int j = 1; j <= ny; j++) {
2209     ccc0E = Sefz1->GetBinContent(1, j);
2210     if (ccc0E <= 0.)
2211       for (int i = 1; i <= nx; i++) {
2212         double ccc2 = Sefz1->GetBinContent(i, j);
2213         if (ccc2 > 0.) {
2214           ccc0E = ccc2;
2215           break;
2216         }
2217       }
2218     if (ccc0E > 0.) {
2219       // i - # LSs:
2220       for (int i = 1; i <= nx; i++) {
2221         double ccc1 = Sefz1->GetBinContent(i, j);
2222         if (ccc1 > 0.) {
2223           double Rij = ccc1 / ccc0E;
2224           Sefz7->Fill(Rij);
2225         }
2226       }
2227     }
2228   }
2229   Sefz7->SetMarkerStyle(20);
2230   Sefz7->SetMarkerSize(0.4);
2231   Sefz7->GetYaxis()->SetLabelSize(0.04);
2232   Sefz7->SetMarkerColor(2);
2233   Sefz7->SetLineColor(0);
2234   Sefz7->SetYTitle("        N  \b");
2235   Sefz7->SetXTitle("     Rij \b");
2236   //Sefz7->SetMinimum(0.8);Sefz7->SetMaximum(500.);
2237   //            gPad->SetLogy();
2238   gPad->SetGridy();
2239   gPad->SetGridx();
2240   Sefz7->Draw("Error");
2241   double ymaxE = Sefz7->GetMaximum();
2242   //      cout<< "ymaxE=  " <<ymaxE  <<endl;
2243   cout << "22-6   ymaxE=  " << ymaxE << "       MAXdif3rmsMIN=  " << MAXdif3rmsMIN
2244        << "         MINdif3rmsMAX=  " << MINdif3rmsMAX << endl;
2245   TLine* lineE = new TLine(MAXdif3rmsMIN, 0., MAXdif3rmsMIN, ymaxE);
2246   lineE->SetLineColor(kGreen);
2247   lineE->Draw();
2248   TLine* line1E = new TLine(MINdif3rmsMAX, 0., MINdif3rmsMAX, ymaxE);
2249   line1E->SetLineColor(kGreen);
2250   line1E->Draw();
2251   //================
2252   ////////////////////////////////////////////////////////////////////////////////////
2253 
2254   c1->Update();
2255 
2256   //========================================================================================== 23  HE: j = 3,4,5, 6, 7      14,15,16,17,18                 3
2257   //======================================================================
2258   //======================================================================
2259   //======================================================================
2260   c1->Clear();
2261   c1->Divide(3, 6);
2262 
2263   nx = Sefz1->GetXaxis()->GetNbins();
2264   ny = Sefz1->GetYaxis()->GetNbins();
2265   nx = maxbins;
2266 
2267   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2268   //    cout<<"HE Gforhejeta0k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2269   kcount = 1;
2270   cout << "HE Gforhejeta0k *********************************************************************       jeta == 3    "
2271        << endl;
2272   // j - etaphi index:
2273   TH1F* h2CeffGforhejeta0k0 = new TH1F("h2CeffGforhejeta0k0", "", maxbins, 1., maxbins + 1.);
2274   for (int j = 1; j <= ny; j++) {
2275     int jeta = (j - 1) / 18;  // jeta = 0-21
2276     if (jeta == 3) {
2277       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2278                                            //     jeta += 1;// jeta = 1-22
2279       //      TH1F* Gforhejeta0k0 = new TH1F("Gforhejeta0k0","", maxbins, 1., maxbins+1.);
2280       TH1F* Gforhejeta0k0 = (TH1F*)h2CeffGforhejeta0k0->Clone("twod1");
2281       // i - # LSs:
2282       for (int i = 1; i <= nx; i++) {
2283         double ccc1 = Sefz1->GetBinContent(i, j);
2284         if (ccc1 > 0.) {
2285           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2286           Gforhejeta0k0->Fill(i, ccc1);
2287         }
2288       }
2289       c1->cd(kcount);
2290       //      cout<<"HE Gforhejeta0k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2291       Gforhejeta0k0->SetMarkerStyle(20);
2292       Gforhejeta0k0->SetMarkerSize(0.4);
2293       Gforhejeta0k0->GetYaxis()->SetLabelSize(0.04);
2294       Gforhejeta0k0->SetXTitle("Gforhejeta0k0 \b");
2295       Gforhejeta0k0->SetMarkerColor(2);
2296       Gforhejeta0k0->SetLineColor(0);
2297       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2298       Gforhejeta0k0->Draw("Error");
2299       kcount++;
2300       //    c1->Update();
2301       //        delete Gforhejeta0k0;
2302       if (kcount > 18)
2303         break;
2304     }
2305   }
2306 
2307   /////////////////
2308   c1->Update();
2309   ////////////////////////////////////////////////////////////////////////////////////
2310   //========================================================================================== 24 HE: j = 3,4,5, 6, 7      14,15,16,17,18                     4
2311   //======================================================================
2312   //======================================================================
2313   //======================================================================
2314   c1->Clear();
2315   c1->Divide(3, 6);
2316 
2317   nx = Sefz1->GetXaxis()->GetNbins();
2318   ny = Sefz1->GetYaxis()->GetNbins();
2319   nx = maxbins;
2320 
2321   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2322   //    cout<<"HE Gforhejeta1k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2323   kcount = 1;
2324   cout << "HE Gforhejeta1k *********************************************************************       jeta == 4    "
2325        << endl;
2326   // j - etaphi index:
2327   TH1F* h2CeffGforhejeta1k0 = new TH1F("h2CeffGforhejeta1k0", "", maxbins, 1., maxbins + 1.);
2328   for (int j = 1; j <= ny; j++) {
2329     int jeta = (j - 1) / 18;  // jeta = 0-21
2330     if (jeta == 4) {
2331       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2332                                            //     jeta += 1;// jeta = 1-22
2333       //      TH1F* Gforhejeta1k0 = new TH1F("Gforhejeta1k0","", maxbins, 1., maxbins+1.);
2334       TH1F* Gforhejeta1k0 = (TH1F*)h2CeffGforhejeta1k0->Clone("twod1");
2335       // i - # LSs:
2336       for (int i = 1; i <= nx; i++) {
2337         double ccc1 = Sefz1->GetBinContent(i, j);
2338         if (ccc1 > 0.) {
2339           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2340           Gforhejeta1k0->Fill(i, ccc1);
2341         }
2342       }
2343       c1->cd(kcount);
2344       //      cout<<"HE Gforhejeta1k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2345       Gforhejeta1k0->SetMarkerStyle(20);
2346       Gforhejeta1k0->SetMarkerSize(0.4);
2347       Gforhejeta1k0->GetYaxis()->SetLabelSize(0.04);
2348       Gforhejeta1k0->SetXTitle("Gforhejeta1k0 \b");
2349       Gforhejeta1k0->SetMarkerColor(2);
2350       Gforhejeta1k0->SetLineColor(0);
2351       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2352       Gforhejeta1k0->Draw("Error");
2353       kcount++;
2354       //    c1->Update();
2355       //        delete Gforhejeta1k0;
2356       if (kcount > 18)
2357         break;
2358     }
2359   }
2360 
2361   /////////////////
2362   c1->Update();
2363   ////////////////////////////////////////////////////////////////////////////////////
2364   //========================================================================================== 25 HE: j = 3,4,5, 6, 7      14,15,16,17,18          5
2365   //======================================================================
2366   //======================================================================
2367   //======================================================================
2368   c1->Clear();
2369   c1->Divide(3, 6);
2370 
2371   nx = Sefz1->GetXaxis()->GetNbins();
2372   ny = Sefz1->GetYaxis()->GetNbins();
2373   nx = maxbins;
2374 
2375   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2376   //    cout<<"HE Gforhejeta2k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2377   kcount = 1;
2378   cout << "HE Gforhejeta2k *********************************************************************       jeta == 5    "
2379        << endl;
2380   // j - etaphi index:
2381   TH1F* h2CeffGforhejeta2k0 = new TH1F("h2CeffGforhejeta2k0", "", maxbins, 1., maxbins + 1.);
2382   for (int j = 1; j <= ny; j++) {
2383     int jeta = (j - 1) / 18;  // jeta = 0-21
2384     if (jeta == 5) {
2385       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2386                                            //     jeta += 1;// jeta = 1-22
2387       //      TH1F* Gforhejeta2k0 = new TH1F("Gforhejeta2k0","", maxbins, 1., maxbins+1.);
2388       TH1F* Gforhejeta2k0 = (TH1F*)h2CeffGforhejeta2k0->Clone("twod1");
2389       // i - # LSs:
2390       for (int i = 1; i <= nx; i++) {
2391         double ccc1 = Sefz1->GetBinContent(i, j);
2392         if (ccc1 > 0.) {
2393           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2394           Gforhejeta2k0->Fill(i, ccc1);
2395         }
2396       }
2397       c1->cd(kcount);
2398       //      cout<<"HE Gforhejeta2k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2399       Gforhejeta2k0->SetMarkerStyle(20);
2400       Gforhejeta2k0->SetMarkerSize(0.4);
2401       Gforhejeta2k0->GetYaxis()->SetLabelSize(0.04);
2402       Gforhejeta2k0->SetXTitle("Gforhejeta2k0 \b");
2403       Gforhejeta2k0->SetMarkerColor(2);
2404       Gforhejeta2k0->SetLineColor(0);
2405       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2406       Gforhejeta2k0->Draw("Error");
2407       kcount++;
2408       //    c1->Update();
2409       //        delete Gforhejeta2k0;
2410       if (kcount > 18)
2411         break;
2412     }
2413   }
2414 
2415   /////////////////
2416   c1->Update();
2417   ////////////////////////////////////////////////////////////////////////////////////
2418   //========================================================================================== 26 HE: j = 3,4,5, 6, 7      14,15,16,17,18            6
2419   //======================================================================
2420   //======================================================================
2421   //======================================================================
2422   c1->Clear();
2423   c1->Divide(3, 6);
2424 
2425   nx = Sefz1->GetXaxis()->GetNbins();
2426   ny = Sefz1->GetYaxis()->GetNbins();
2427   nx = maxbins;
2428 
2429   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2430   //    cout<<"HE Gforhejeta3k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2431   kcount = 1;
2432   cout << "HE Gforhejeta3k *********************************************************************       jeta ==   6  "
2433        << endl;
2434   // j - etaphi index:
2435   TH1F* h2CeffGforhejeta3k0 = new TH1F("h2CeffGforhejeta3k0", "", maxbins, 1., maxbins + 1.);
2436   for (int j = 1; j <= ny; j++) {
2437     int jeta = (j - 1) / 18;  // jeta = 0-21
2438     if (jeta == 6) {
2439       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2440                                            //     jeta += 1;// jeta = 1-22
2441       //      TH1F* Gforhejeta3k0 = new TH1F("Gforhejeta3k0","", maxbins, 1., maxbins+1.);
2442       TH1F* Gforhejeta3k0 = (TH1F*)h2CeffGforhejeta3k0->Clone("twod1");
2443       // i - # LSs:
2444       for (int i = 1; i <= nx; i++) {
2445         double ccc1 = Sefz1->GetBinContent(i, j);
2446         if (ccc1 > 0.) {
2447           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2448           Gforhejeta3k0->Fill(i, ccc1);
2449         }
2450       }
2451       c1->cd(kcount);
2452       //      cout<<"HE Gforhejeta3k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2453       Gforhejeta3k0->SetMarkerStyle(20);
2454       Gforhejeta3k0->SetMarkerSize(0.4);
2455       Gforhejeta3k0->GetYaxis()->SetLabelSize(0.04);
2456       Gforhejeta3k0->SetXTitle("Gforhejeta3k0 \b");
2457       Gforhejeta3k0->SetMarkerColor(2);
2458       Gforhejeta3k0->SetLineColor(0);
2459       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2460       Gforhejeta3k0->Draw("Error");
2461       kcount++;
2462       //    c1->Update();
2463       //        delete Gforhejeta3k0;
2464       if (kcount > 18)
2465         break;
2466     }
2467   }
2468 
2469   /////////////////
2470   c1->Update();
2471   ////////////////////////////////////////////////////////////////////////////////////
2472   //========================================================================================== 27 HE: j = 3,4,5, 6, 7      14,15,16,17,18    7
2473   //======================================================================
2474   //======================================================================
2475   //======================================================================
2476   c1->Clear();
2477   c1->Divide(3, 6);
2478 
2479   nx = Sefz1->GetXaxis()->GetNbins();
2480   ny = Sefz1->GetYaxis()->GetNbins();
2481   nx = maxbins;
2482 
2483   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2484   //    cout<<"HE Gforhejeta18k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2485   kcount = 1;
2486   cout << "HE Gforhejeta18k *********************************************************************       jeta ==  7    "
2487        << endl;
2488   // j - etaphi index:
2489   TH1F* h2CeffGforhejeta18k0 = new TH1F("h2CeffGforhejeta18k0", "", maxbins, 1., maxbins + 1.);
2490   for (int j = 1; j <= ny; j++) {
2491     int jeta = (j - 1) / 18;  // jeta = 0-21
2492     if (jeta == 7) {
2493       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2494                                            //     jeta += 1;// jeta = 1-22
2495       //      TH1F* Gforhejeta18k0 = new TH1F("Gforhejeta18k0","", maxbins, 1., maxbins+1.);
2496       TH1F* Gforhejeta18k0 = (TH1F*)h2CeffGforhejeta18k0->Clone("twod1");
2497       // i - # LSs:
2498       for (int i = 1; i <= nx; i++) {
2499         double ccc1 = Sefz1->GetBinContent(i, j);
2500         if (ccc1 > 0.) {
2501           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2502           Gforhejeta18k0->Fill(i, ccc1);
2503         }
2504       }
2505       c1->cd(kcount);
2506       //      cout<<"HE Gforhejeta18k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2507       Gforhejeta18k0->SetMarkerStyle(20);
2508       Gforhejeta18k0->SetMarkerSize(0.4);
2509       Gforhejeta18k0->GetYaxis()->SetLabelSize(0.04);
2510       Gforhejeta18k0->SetXTitle("Gforhejeta18k0 \b");
2511       Gforhejeta18k0->SetMarkerColor(2);
2512       Gforhejeta18k0->SetLineColor(0);
2513       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2514       Gforhejeta18k0->Draw("Error");
2515       kcount++;
2516       //    c1->Update();
2517       //        delete Gforhejeta18k0;
2518       if (kcount > 18)
2519         break;
2520     }
2521   }
2522 
2523   /////////////////
2524   c1->Update();
2525   ////////////////////////////////////////////////////////////////////////////////////
2526   //========================================================================================== 28 HE: j = 3,4,5, 6, 7      14,15,16,17,18           14
2527   //======================================================================
2528   //======================================================================
2529   //======================================================================
2530   c1->Clear();
2531   c1->Divide(3, 6);
2532 
2533   nx = Sefz1->GetXaxis()->GetNbins();
2534   ny = Sefz1->GetYaxis()->GetNbins();
2535   nx = maxbins;
2536 
2537   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2538   //    cout<<"HE Gforhejeta19k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2539   kcount = 1;
2540   cout << "HE Gforhejeta19k *********************************************************************       jeta == 14    "
2541        << endl;
2542   // j - etaphi index:
2543   TH1F* h2CeffGforhejeta19k0 = new TH1F("h2CeffGforhejeta19k0", "", maxbins, 1., maxbins + 1.);
2544   for (int j = 1; j <= ny; j++) {
2545     int jeta = (j - 1) / 18;  // jeta = 0-21
2546     if (jeta == 14) {
2547       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2548                                            //     jeta += 1;// jeta = 1-22
2549       //      TH1F* Gforhejeta19k0 = new TH1F("Gforhejeta19k0","", maxbins, 1., maxbins+1.);
2550       TH1F* Gforhejeta19k0 = (TH1F*)h2CeffGforhejeta19k0->Clone("twod1");
2551       // i - # LSs:
2552       for (int i = 1; i <= nx; i++) {
2553         double ccc1 = Sefz1->GetBinContent(i, j);
2554         if (ccc1 > 0.) {
2555           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2556           Gforhejeta19k0->Fill(i, ccc1);
2557         }
2558       }
2559       c1->cd(kcount);
2560       //      cout<<"HE Gforhejeta19k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2561       Gforhejeta19k0->SetMarkerStyle(20);
2562       Gforhejeta19k0->SetMarkerSize(0.4);
2563       Gforhejeta19k0->GetYaxis()->SetLabelSize(0.04);
2564       Gforhejeta19k0->SetXTitle("Gforhejeta19k0 \b");
2565       Gforhejeta19k0->SetMarkerColor(2);
2566       Gforhejeta19k0->SetLineColor(0);
2567       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2568       Gforhejeta19k0->Draw("Error");
2569       kcount++;
2570       //    c1->Update();
2571       //        delete Gforhejeta19k0;
2572       if (kcount > 18)
2573         break;
2574     }
2575   }
2576 
2577   /////////////////
2578   c1->Update();
2579   ////////////////////////////////////////////////////////////////////////////////////
2580   //========================================================================================== 29 HE: j = 3,4,5, 6, 7      14,15,16,17,18     15
2581   //======================================================================
2582   //======================================================================
2583   //======================================================================
2584   c1->Clear();
2585   c1->Divide(3, 6);
2586 
2587   nx = Sefz1->GetXaxis()->GetNbins();
2588   ny = Sefz1->GetYaxis()->GetNbins();
2589   nx = maxbins;
2590 
2591   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2592   //    cout<<"HE Gforhejeta20k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2593   kcount = 1;
2594   cout << "HE Gforhejeta20k *********************************************************************       jeta == 15    "
2595        << endl;
2596   // j - etaphi index:
2597   TH1F* h2CeffGforhejeta20k0 = new TH1F("h2CeffGforhejeta20k0", "", maxbins, 1., maxbins + 1.);
2598   for (int j = 1; j <= ny; j++) {
2599     int jeta = (j - 1) / 18;  // jeta = 0-21
2600     if (jeta == 15) {
2601       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2602                                            //     jeta += 1;// jeta = 1-22
2603       //      TH1F* Gforhejeta20k0 = new TH1F("Gforhejeta20k0","", maxbins, 1., maxbins+1.);
2604       TH1F* Gforhejeta20k0 = (TH1F*)h2CeffGforhejeta20k0->Clone("twod1");
2605       // i - # LSs:
2606       for (int i = 1; i <= nx; i++) {
2607         double ccc1 = Sefz1->GetBinContent(i, j);
2608         if (ccc1 > 0.) {
2609           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2610           Gforhejeta20k0->Fill(i, ccc1);
2611         }
2612       }
2613       c1->cd(kcount);
2614       //      cout<<"HE Gforhejeta20k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2615       Gforhejeta20k0->SetMarkerStyle(20);
2616       Gforhejeta20k0->SetMarkerSize(0.4);
2617       Gforhejeta20k0->GetYaxis()->SetLabelSize(0.04);
2618       Gforhejeta20k0->SetXTitle("Gforhejeta20k0 \b");
2619       Gforhejeta20k0->SetMarkerColor(2);
2620       Gforhejeta20k0->SetLineColor(0);
2621       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2622       Gforhejeta20k0->Draw("Error");
2623       kcount++;
2624       //    c1->Update();
2625       //        delete Gforhejeta20k0;
2626       if (kcount > 18)
2627         break;
2628     }
2629   }
2630 
2631   /////////////////
2632   c1->Update();
2633   ////////////////////////////////////////////////////////////////////////////////////
2634   //========================================================================================== 30 HE: j = 3,4,5, 6, 7      14,15,16,17,18    16
2635   //======================================================================
2636   //======================================================================
2637   //======================================================================
2638   c1->Clear();
2639   c1->Divide(3, 6);
2640 
2641   nx = Sefz1->GetXaxis()->GetNbins();
2642   ny = Sefz1->GetYaxis()->GetNbins();
2643   nx = maxbins;
2644 
2645   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2646   //    cout<<"HE Gforhejeta21k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2647   kcount = 1;
2648   cout << "HE Gforhejeta21k *********************************************************************       jeta ==  16   "
2649        << endl;
2650   // j - etaphi index:
2651   TH1F* h2CeffGforhejeta21k0 = new TH1F("h2CeffGforhejeta21k0", "", maxbins, 1., maxbins + 1.);
2652   for (int j = 1; j <= ny; j++) {
2653     int jeta = (j - 1) / 18;  // jeta = 0-21
2654     if (jeta == 16) {
2655       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2656                                            //     jeta += 1;// jeta = 1-22
2657       //      TH1F* Gforhejeta21k0 = new TH1F("Gforhejeta21k0","", maxbins, 1., maxbins+1.);
2658       TH1F* Gforhejeta21k0 = (TH1F*)h2CeffGforhejeta21k0->Clone("twod1");
2659       // i - # LSs:
2660       for (int i = 1; i <= nx; i++) {
2661         double ccc1 = Sefz1->GetBinContent(i, j);
2662         if (ccc1 > 0.) {
2663           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2664           Gforhejeta21k0->Fill(i, ccc1);
2665         }
2666       }
2667       c1->cd(kcount);
2668       //      cout<<"HE Gforhejeta21k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2669       Gforhejeta21k0->SetMarkerStyle(20);
2670       Gforhejeta21k0->SetMarkerSize(0.4);
2671       Gforhejeta21k0->GetYaxis()->SetLabelSize(0.04);
2672       Gforhejeta21k0->SetXTitle("Gforhejeta21k0 \b");
2673       Gforhejeta21k0->SetMarkerColor(2);
2674       Gforhejeta21k0->SetLineColor(0);
2675       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2676       Gforhejeta21k0->Draw("Error");
2677       kcount++;
2678       //    c1->Update();
2679       //        delete Gforhejeta21k0;
2680       if (kcount > 18)
2681         break;
2682     }
2683   }
2684 
2685   /////////////////
2686   c1->Update();
2687   ////////////////////////////////////////////////////////////////////////////////////
2688   //========================================================================================== 31 HE: j = 3,4,5, 6, 7      14,15,16,17,18         17
2689   //======================================================================
2690   //======================================================================
2691   //======================================================================
2692   c1->Clear();
2693   c1->Divide(3, 6);
2694 
2695   nx = Sefz1->GetXaxis()->GetNbins();
2696   ny = Sefz1->GetYaxis()->GetNbins();
2697   nx = maxbins;
2698 
2699   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2700   //    cout<<"HE Gforhejeta22k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2701   kcount = 1;
2702   cout << "HE Gforhejeta22k *********************************************************************       jeta == 17    "
2703        << endl;
2704   // j - etaphi index:
2705   TH1F* h2CeffGforhejeta22k0 = new TH1F("h2CeffGforhejeta22k0", "", maxbins, 1., maxbins + 1.);
2706   for (int j = 1; j <= ny; j++) {
2707     int jeta = (j - 1) / 18;  // jeta = 0-21
2708     if (jeta == 17) {
2709       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2710                                            //     jeta += 1;// jeta = 1-22
2711       //      TH1F* Gforhejeta22k0 = new TH1F("Gforhejeta22k0","", maxbins, 1., maxbins+1.);
2712       TH1F* Gforhejeta22k0 = (TH1F*)h2CeffGforhejeta22k0->Clone("twod1");
2713       // i - # LSs:
2714       for (int i = 1; i <= nx; i++) {
2715         double ccc1 = Sefz1->GetBinContent(i, j);
2716         if (ccc1 > 0.) {
2717           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2718           Gforhejeta22k0->Fill(i, ccc1);
2719         }
2720       }
2721       c1->cd(kcount);
2722       //      cout<<"HE Gforhejeta22k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2723       Gforhejeta22k0->SetMarkerStyle(20);
2724       Gforhejeta22k0->SetMarkerSize(0.4);
2725       Gforhejeta22k0->GetYaxis()->SetLabelSize(0.04);
2726       Gforhejeta22k0->SetXTitle("Gforhejeta22k0 \b");
2727       Gforhejeta22k0->SetMarkerColor(2);
2728       Gforhejeta22k0->SetLineColor(0);
2729       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2730       Gforhejeta22k0->Draw("Error");
2731       kcount++;
2732       //    c1->Update();
2733       //        delete Gforhejeta22k0;
2734       if (kcount > 18)
2735         break;
2736     }
2737   }
2738 
2739   /////////////////
2740   c1->Update();
2741   ////////////////////////////////////////////////////////////////////////////////////
2742   //========================================================================================== 32 HE: j = 3,4,5, 6, 7      14,15,16,17,18          18
2743   //======================================================================
2744   //======================================================================
2745   //======================================================================
2746   c1->Clear();
2747   c1->Divide(3, 6);
2748 
2749   nx = Sefz1->GetXaxis()->GetNbins();
2750   ny = Sefz1->GetYaxis()->GetNbins();
2751   nx = maxbins;
2752 
2753   //    if( nlsohe > 0.)      nhistohe /= nlsohe;
2754   //    cout<<"HE Gforhejeta23k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohe=     "<< nhistohe <<endl;
2755   kcount = 1;
2756   cout << "HE Gforhejeta23k *********************************************************************       jeta == 18    "
2757        << endl;
2758   // j - etaphi index:
2759   TH1F* h2CeffGforhejeta23k0 = new TH1F("h2CeffGforhejeta23k0", "", maxbins, 1., maxbins + 1.);
2760   for (int j = 1; j <= ny; j++) {
2761     int jeta = (j - 1) / 18;  // jeta = 0-21
2762     if (jeta == 18) {
2763       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2764                                            //     jeta += 1;// jeta = 1-22
2765       //      TH1F* Gforhejeta23k0 = new TH1F("Gforhejeta23k0","", maxbins, 1., maxbins+1.);
2766       TH1F* Gforhejeta23k0 = (TH1F*)h2CeffGforhejeta23k0->Clone("twod1");
2767       // i - # LSs:
2768       for (int i = 1; i <= nx; i++) {
2769         double ccc1 = Sefz1->GetBinContent(i, j);
2770         if (ccc1 > 0.) {
2771           //          if(i==1)cout<<"HE  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2772           Gforhejeta23k0->Fill(i, ccc1);
2773         }
2774       }
2775       c1->cd(kcount);
2776       //      cout<<"HE Gforhejeta23k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
2777       Gforhejeta23k0->SetMarkerStyle(20);
2778       Gforhejeta23k0->SetMarkerSize(0.4);
2779       Gforhejeta23k0->GetYaxis()->SetLabelSize(0.04);
2780       Gforhejeta23k0->SetXTitle("Gforhejeta23k0 \b");
2781       Gforhejeta23k0->SetMarkerColor(2);
2782       Gforhejeta23k0->SetLineColor(0);
2783       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2784       Gforhejeta23k0->Draw("Error");
2785       kcount++;
2786       //    c1->Update();
2787       //        delete Gforhejeta23k0;
2788       if (kcount > 18)
2789         break;
2790     }
2791   }
2792 
2793   /////////////////
2794   c1->Update();
2795   ////////////////////////////////////////////////////////////////////////////////////
2796   //========================================================================================== 33    HO - "h_2DsumADCAmplEtaPhiLs2
2797   //======================================================================
2798   //======================================================================
2799   //================
2800   //======================================================================
2801   c1->Clear();
2802   c1->Divide(2, 2);
2803 
2804   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2805   TH2F* Yefz1KKK = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs2");
2806   TH2F* Yefz1LLL = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs20");
2807   TH2F* Yefz1 = (TH2F*)Yefz1LLL->Clone("Yefz1");
2808   Yefz1->Divide(Yefz1KKK, Yefz1LLL, 1, 1, "B");  // average A
2809   Yefz1->Sumw2();
2810 
2811   c1->cd(1);
2812   maxbinx = 0;
2813   maxbiny = 0;
2814   int sumijho = 0;
2815   nx = Yefz1->GetXaxis()->GetNbins();
2816   ny = Yefz1->GetYaxis()->GetNbins();
2817   nx = maxbins;
2818   cout << "HO h_2DsumADCAmplEtaPhiLs0         nx=     " << nx << " ny=     " << ny << endl;
2819   // i - # LSs:
2820   TH1F* Yefw0 = new TH1F("Yefw0", "", 200, 0., 1000.);
2821   for (int i = 1; i <= nx; i++) {
2822     // j - etaphi index:
2823     for (int j = 1; j <= ny; j++) {
2824       double ccc1 = Yefz1->GetBinContent(i, j);
2825       if (ccc1 > 0.) {
2826         sumijho++;
2827         maxbinx = i;
2828         if (i > maxbinx)
2829           maxbinx = i;
2830         maxbiny = j;
2831         if (j > maxbiny)
2832           maxbiny = j;
2833         //    cout<<"HO h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
2834         Yefw0->Fill(ccc1);
2835       }
2836     }
2837   }
2838   cout << "HO maxbinx=  " << maxbinx << "     maxbiny=  " << maxbiny << "     sumijho=  " << sumijho << endl;
2839   Yefw0->SetMarkerStyle(20);
2840   Yefw0->SetMarkerSize(0.4);
2841   Yefw0->GetYaxis()->SetLabelSize(0.04);
2842   Yefw0->SetXTitle("<A>ijk = <A> averaged per events in k-th LS \b");
2843   Yefw0->SetYTitle("     HO \b");
2844   Yefw0->SetMarkerColor(2);
2845   Yefw0->SetLineColor(0);
2846   //  Yefw0->SetMinimum(10.);
2847   gPad->SetLogy();
2848   gPad->SetGridy();
2849   gPad->SetGridx();
2850   //      Yefw0 ->Draw("L");
2851   Yefw0->Draw("Error");
2852   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2853   c1->cd(2);
2854   TH1F* Yefw = new TH1F("Yefw", "", maxbins, 1., maxbins + 1.);
2855   // i - # LSs:
2856   for (int i = 1; i <= nx; i++) {
2857     // j - etaphi index:
2858     double sumsum = 0.;
2859     for (int j = 1; j <= ny; j++) {
2860       double ccc1 = Yefz1->GetBinContent(i, j);
2861       if (ccc1 > 0.) {
2862         //      if(ccc1> 2500.) cout<<"HO :  i=  "<< i <<"      j= "<< j <<"  ccc1 = "<< ccc1 <<"  ccc1*maxbinx/sumijho = "<< ccc1*maxbinx/sumijho <<endl;
2863         //        Yefw ->Fill(ccc1/maxbinx);
2864         sumsum += ccc1 * maxbinx / sumijho;
2865         //      Yefw ->Fill( float(i), ccc1*maxbinx/sumijho);
2866       }
2867     }
2868     //  cout<<"HO :  i=  "<< i <<"  sumsum = "<< sumsum <<endl;
2869     Yefw->Fill(float(i), sumsum);
2870   }
2871   Yefw->SetMarkerStyle(20);
2872   Yefw->SetMarkerSize(0.4);
2873   Yefw->GetYaxis()->SetLabelSize(0.04);
2874   Yefw->SetMarkerColor(2);
2875   Yefw->SetLineColor(0);
2876   Yefw->SetXTitle("        iLS  \b");
2877   Yefw->SetYTitle("     <A>k \b");
2878   //Yefw->SetMinimum(0.8);Yefw->SetMaximum(500.);
2879   gPad->SetLogy();
2880   gPad->SetGridy();
2881   gPad->SetGridx();
2882   Yefw->Draw("Error");
2883 
2884   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2885   c1->cd(3);
2886   TH1F* Yefw1 = new TH1F("Yefw1", "", 100, 0., 200.);
2887   for (int i = 1; i <= nx; i++) {
2888     // j - etaphi index:
2889     for (int j = 1; j <= ny; j++) {
2890       double ccc1 = Yefz1->GetBinContent(i, j);
2891       if (ccc1 > 0.) {
2892         maxbinx = i;
2893         if (i > maxbinx)
2894           maxbinx = i;
2895         maxbiny = j;
2896         if (j > maxbiny)
2897           maxbiny = j;
2898         //    cout<<"HO h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
2899         Yefw1->Fill(ccc1);
2900       }
2901     }
2902   }
2903   cout << "HO maxbinx=  " << maxbinx << "     maxbiny=  " << maxbiny << endl;
2904   Yefw1->SetMarkerStyle(20);
2905   Yefw1->SetMarkerSize(0.4);
2906   Yefw1->GetYaxis()->SetLabelSize(0.04);
2907   Yefw1->SetXTitle("<A>ijk = <A> averaged per events in k-th LS \b");
2908   Yefw1->SetMarkerColor(2);
2909   Yefw1->SetLineColor(0);
2910   //  Yefw1->SetMinimum(0.8);
2911   gPad->SetLogy();
2912   gPad->SetGridy();
2913   gPad->SetGridx();
2914   //      Yefw1 ->Draw("L");
2915   Yefw1->Draw("Error");
2916 
2917   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2918   c1->cd(4);
2919   // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ;  k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
2920   TH2F* Yefz4 = new TH2F("Yefz4", "", 22, -11., 11., 18, 0., 18.);
2921   // i - # LSs:
2922   for (int i = 1; i <= nx; i++) {
2923     // j - etaphi index:
2924     for (int j = 1; j <= ny; j++) {
2925       double ccc1 = Yefz1->GetBinContent(i, j);
2926       //if(ccc1>0.) cout<<"HO h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1/maxbinx <<endl;
2927       //    if(ccc1>0. && ccc1/maxbinx < 2000) {
2928       if (ccc1 > 0.) {
2929         int jeta = (j - 1) / 18;             // jeta = 0-21
2930         int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2931         //    jeta += 1;// jeta = 1-22
2932         //      if(i==1) cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta-11 <<" jphi= "<< jphi-1 <<"  A= "<< ccc1/maxbinx <<endl;
2933         //    Yefz4 ->Fill(jeta-11,jphi-1,ccc1/maxbinx);
2934         Yefz4->Fill(jeta - 11, jphi - 1, ccc1 * maxbiny / sumijho);
2935       }
2936     }
2937   }
2938   gPad->SetGridy();
2939   gPad->SetGridx();  //      gPad->SetLogz();
2940   Yefz4->SetMarkerStyle(20);
2941   Yefz4->SetMarkerSize(0.4);
2942   Yefz4->GetZaxis()->SetLabelSize(0.08);
2943   Yefz4->SetXTitle("<A>ij         #eta  \b");
2944   Yefz4->SetYTitle("      #phi \b");
2945   Yefz4->SetZTitle("<A>ij  - All \b");
2946   Yefz4->SetMarkerColor(2);
2947   Yefz4->SetLineColor(2);  //    Yefz4->SetMaximum(180.0);        Yefz4->SetMinimum(80.0);
2948   Yefz4->Draw("COLZ");
2949 
2950   c1->Update();
2951 
2952   //======================================================================
2953 
2954   //========================================================================================== 34 HO
2955   //======================================================================
2956   //======================================================================
2957   //======================================================================
2958   c1->Clear();
2959   c1->Divide(1, 3);
2960 
2961   c1->cd(1);
2962   nx = Yefz1->GetXaxis()->GetNbins();
2963   ny = Yefz1->GetYaxis()->GetNbins();
2964   nx = maxbins;
2965   cout << "HO Yefk        nx=     " << nx << " ny=     " << ny << endl;
2966   TH1F* Yefk0 = new TH1F("Yefk0", "", maxbins, 1., maxbins + 1.);
2967   TH1F* Yefk1 = new TH1F("Yefk1", "", maxbins, 1., maxbins + 1.);
2968   TH1F* Yefk2 = new TH1F("Yefk2", "", maxbins, 1., maxbins + 1.);
2969   // i - # LSs:
2970   for (int i = 1; i <= nx; i++) {
2971     // j - etaphi index:
2972     for (int j = 1; j <= ny; j++) {
2973       double ccc1 = Yefz1->GetBinContent(i, j);
2974       if (ccc1 > 0.) {
2975         int jeta = (j - 1) / 18;             // jeta = 0-21
2976         int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
2977         //    jeta += 1;// jeta = 1-22
2978         //      cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
2979         if (jeta == 7 && jphi == 11)
2980           Yefk0->Fill(i, ccc1);
2981         if (jeta == 10 && jphi == 11)
2982           Yefk1->Fill(i, ccc1);
2983         if (jeta == 12 && jphi == 11)
2984           Yefk2->Fill(i, ccc1);
2985       }
2986     }
2987   }
2988   Yefk0->SetMarkerStyle(20);
2989   Yefk0->SetMarkerSize(0.4);
2990   Yefk0->GetYaxis()->SetLabelSize(0.04);
2991   Yefk0->SetXTitle("Yefk0 \b");
2992   Yefk0->SetMarkerColor(2);
2993   Yefk0->SetLineColor(
2994       0);  // Yefk0 ->SetMaximum(30.0);// Yefk0 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
2995   Yefk0->Draw("Error");
2996 
2997   //================
2998   c1->cd(2);
2999   Yefk1->SetMarkerStyle(20);
3000   Yefk1->SetMarkerSize(0.4);
3001   Yefk1->GetYaxis()->SetLabelSize(0.04);
3002   Yefk1->SetXTitle("Yefk1 \b");
3003   Yefk1->SetMarkerColor(2);
3004   Yefk1->SetLineColor(
3005       0);  // Yefk1 ->SetMaximum(30.0);// Yefk1 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3006   Yefk1->Draw("Error");
3007 
3008   //================
3009   c1->cd(3);
3010   Yefk2->SetMarkerStyle(20);
3011   Yefk2->SetMarkerSize(0.4);
3012   Yefk2->GetYaxis()->SetLabelSize(0.04);
3013   Yefk2->SetXTitle("Yefk2 \b");
3014   Yefk2->SetMarkerColor(2);
3015   Yefk2->SetLineColor(
3016       0);  // Yefk2 ->SetMaximum(30.0);// Yefk2 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3017   Yefk2->Draw("Error");
3018 
3019   ////////////////////////////////////////////////////////////////////////////////////
3020 
3021   c1->Update();
3022 
3023   //========================================================================================== 35 HO: j = 7,8,9,10            11,12,13,14      7
3024   //======================================================================
3025   //======================================================================
3026   //======================================================================
3027   c1->Clear();
3028   c1->Divide(3, 6);
3029 
3030   nx = Yefz1->GetXaxis()->GetNbins();
3031   ny = Yefz1->GetYaxis()->GetNbins();
3032   nx = maxbins;
3033 
3034   //    if( nlsoho > 0.)      nhistoho /= nlsoho;
3035   //    cout<<"HO Gforhojeta0k        nx=     "<< nx <<" ny=     "<< ny <<" nhistoho=     "<< nhistoho <<endl;
3036   kcount = 1;
3037   cout << "HO Gforhojeta0k *********************************************************************       jeta == 7    "
3038        << endl;
3039   // j - etaphi index:
3040   TH1F* h2CeffGforhojeta0k0 = new TH1F("h2CeffGforhojeta0k0", "", maxbins, 1., maxbins + 1.);
3041   for (int j = 1; j <= ny; j++) {
3042     int jeta = (j - 1) / 18;  // jeta = 0-21
3043     if (jeta == 7) {
3044       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3045                                            //     jeta += 1;// jeta = 1-22
3046       //      TH1F* Gforhojeta0k0 = new TH1F("Gforhojeta0k0","", maxbins, 1., maxbins+1.);
3047       TH1F* Gforhojeta0k0 = (TH1F*)h2CeffGforhojeta0k0->Clone("twod1");
3048       // i - # LSs:
3049       for (int i = 1; i <= nx; i++) {
3050         double ccc1 = Yefz1->GetBinContent(i, j);
3051         if (ccc1 > 0.) {
3052           //          if(i==1)cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3053           Gforhojeta0k0->Fill(i, ccc1);
3054         }
3055       }
3056       c1->cd(kcount);
3057       //      cout<<"HO Gforhojeta0k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3058       Gforhojeta0k0->SetMarkerStyle(20);
3059       Gforhojeta0k0->SetMarkerSize(0.4);
3060       Gforhojeta0k0->GetYaxis()->SetLabelSize(0.04);
3061       Gforhojeta0k0->SetXTitle("Gforhojeta0k0 \b");
3062       Gforhojeta0k0->SetMarkerColor(2);
3063       Gforhojeta0k0->SetLineColor(0);
3064       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3065       Gforhojeta0k0->Draw("Error");
3066       kcount++;
3067       //    c1->Update();
3068       //        delete Gforhojeta0k0;
3069       if (kcount > 18)
3070         break;
3071     }
3072   }
3073 
3074   /////////////////
3075   c1->Update();
3076   ////////////////////////////////////////////////////////////////////////////////////
3077   //========================================================================================== 36 HO: j = 7,8,9,10            11,12,13,14      8
3078   //======================================================================
3079   //======================================================================
3080   //======================================================================
3081   c1->Clear();
3082   c1->Divide(3, 6);
3083 
3084   nx = Yefz1->GetXaxis()->GetNbins();
3085   ny = Yefz1->GetYaxis()->GetNbins();
3086   nx = maxbins;
3087 
3088   //    if( nlsoho > 0.)      nhistoho /= nlsoho;
3089   //    cout<<"HO Gforhojeta1k        nx=     "<< nx <<" ny=     "<< ny <<" nhistoho=     "<< nhistoho <<endl;
3090   kcount = 1;
3091   cout << "HO Gforhojeta1k *********************************************************************       jeta == 8    "
3092        << endl;
3093   // j - etaphi index:
3094   TH1F* h2CeffGforhojeta1k0 = new TH1F("h2CeffGforhojeta1k0", "", maxbins, 1., maxbins + 1.);
3095   for (int j = 1; j <= ny; j++) {
3096     int jeta = (j - 1) / 18;  // jeta = 0-21
3097     if (jeta == 8) {
3098       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3099                                            //     jeta += 1;// jeta = 1-22
3100       //      TH1F* Gforhojeta1k0 = new TH1F("Gforhojeta1k0","", maxbins, 1., maxbins+1.);
3101       TH1F* Gforhojeta1k0 = (TH1F*)h2CeffGforhojeta1k0->Clone("twod1");
3102       // i - # LSs:
3103       for (int i = 1; i <= nx; i++) {
3104         double ccc1 = Yefz1->GetBinContent(i, j);
3105         if (ccc1 > 0.) {
3106           //          if(i==1)cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3107           Gforhojeta1k0->Fill(i, ccc1);
3108         }
3109       }
3110       c1->cd(kcount);
3111       //      cout<<"HO Gforhojeta1k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3112       Gforhojeta1k0->SetMarkerStyle(20);
3113       Gforhojeta1k0->SetMarkerSize(0.4);
3114       Gforhojeta1k0->GetYaxis()->SetLabelSize(0.04);
3115       Gforhojeta1k0->SetXTitle("Gforhojeta1k0 \b");
3116       Gforhojeta1k0->SetMarkerColor(2);
3117       Gforhojeta1k0->SetLineColor(0);
3118       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3119       Gforhojeta1k0->Draw("Error");
3120       kcount++;
3121       //    c1->Update();
3122       //        delete Gforhojeta1k0;
3123       if (kcount > 18)
3124         break;
3125     }
3126   }
3127 
3128   /////////////////
3129   c1->Update();
3130   ////////////////////////////////////////////////////////////////////////////////////
3131   //========================================================================================== 37  HO: j = 7,8,9,10            11,12,13,14      9
3132   //======================================================================
3133   //======================================================================
3134   //======================================================================
3135   c1->Clear();
3136   c1->Divide(3, 6);
3137 
3138   nx = Yefz1->GetXaxis()->GetNbins();
3139   ny = Yefz1->GetYaxis()->GetNbins();
3140   nx = maxbins;
3141 
3142   //    if( nlsoho > 0.)      nhistoho /= nlsoho;
3143   //    cout<<"HO Gforhojeta2k        nx=     "<< nx <<" ny=     "<< ny <<" nhistoho=     "<< nhistoho <<endl;
3144   kcount = 1;
3145   cout << "HO Gforhojeta2k *********************************************************************       jeta == 9    "
3146        << endl;
3147   // j - etaphi index:
3148   TH1F* h2CeffGforhojeta2k0 = new TH1F("h2CeffGforhojeta2k0", "", maxbins, 1., maxbins + 1.);
3149   for (int j = 1; j <= ny; j++) {
3150     int jeta = (j - 1) / 18;  // jeta = 0-21
3151     if (jeta == 9) {
3152       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3153                                            //     jeta += 1;// jeta = 1-22
3154       //      TH1F* Gforhojeta2k0 = new TH1F("Gforhojeta2k0","", maxbins, 1., maxbins+1.);
3155       TH1F* Gforhojeta2k0 = (TH1F*)h2CeffGforhojeta2k0->Clone("twod1");
3156       // i - # LSs:
3157       for (int i = 1; i <= nx; i++) {
3158         double ccc1 = Yefz1->GetBinContent(i, j);
3159         if (ccc1 > 0.) {
3160           //          if(i==1)cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3161           Gforhojeta2k0->Fill(i, ccc1);
3162         }
3163       }
3164       c1->cd(kcount);
3165       //      cout<<"HO Gforhojeta2k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3166       Gforhojeta2k0->SetMarkerStyle(20);
3167       Gforhojeta2k0->SetMarkerSize(0.4);
3168       Gforhojeta2k0->GetYaxis()->SetLabelSize(0.04);
3169       Gforhojeta2k0->SetXTitle("Gforhojeta2k0 \b");
3170       Gforhojeta2k0->SetMarkerColor(2);
3171       Gforhojeta2k0->SetLineColor(0);
3172       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3173       Gforhojeta2k0->Draw("Error");
3174       kcount++;
3175       //    c1->Update();
3176       //        delete Gforhojeta2k0;
3177       if (kcount > 18)
3178         break;
3179     }
3180   }
3181 
3182   /////////////////
3183   c1->Update();
3184   ////////////////////////////////////////////////////////////////////////////////////
3185   //========================================================================================== 38  HO: j = 7,8,9,10            11,12,13,14    10
3186   //======================================================================
3187   //======================================================================
3188   //======================================================================
3189   c1->Clear();
3190   c1->Divide(3, 6);
3191 
3192   nx = Yefz1->GetXaxis()->GetNbins();
3193   ny = Yefz1->GetYaxis()->GetNbins();
3194   nx = maxbins;
3195 
3196   //    if( nlsoho > 0.)      nhistoho /= nlsoho;
3197   //    cout<<"HO Gforhojeta3k        nx=     "<< nx <<" ny=     "<< ny <<" nhistoho=     "<< nhistoho <<endl;
3198   kcount = 1;
3199   cout << "HO Gforhojeta3k *********************************************************************       jeta == 10   "
3200        << endl;
3201   // j - etaphi index:
3202   TH1F* h2CeffGforhojeta3k0 = new TH1F("h2CeffGforhojeta3k0", "", maxbins, 1., maxbins + 1.);
3203   for (int j = 1; j <= ny; j++) {
3204     int jeta = (j - 1) / 18;  // jeta = 0-21
3205     if (jeta == 10) {
3206       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3207                                            //     jeta += 1;// jeta = 1-22
3208       //      TH1F* Gforhojeta3k0 = new TH1F("Gforhojeta3k0","", maxbins, 1., maxbins+1.);
3209       TH1F* Gforhojeta3k0 = (TH1F*)h2CeffGforhojeta3k0->Clone("twod1");
3210       // i - # LSs:
3211       for (int i = 1; i <= nx; i++) {
3212         double ccc1 = Yefz1->GetBinContent(i, j);
3213         if (ccc1 > 0.) {
3214           //          if(i==1)cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3215           Gforhojeta3k0->Fill(i, ccc1);
3216         }
3217       }
3218       c1->cd(kcount);
3219       //      cout<<"HO Gforhojeta3k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3220       Gforhojeta3k0->SetMarkerStyle(20);
3221       Gforhojeta3k0->SetMarkerSize(0.4);
3222       Gforhojeta3k0->GetYaxis()->SetLabelSize(0.04);
3223       Gforhojeta3k0->SetXTitle("Gforhojeta3k0 \b");
3224       Gforhojeta3k0->SetMarkerColor(2);
3225       Gforhojeta3k0->SetLineColor(0);
3226       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3227       Gforhojeta3k0->Draw("Error");
3228       kcount++;
3229       //    c1->Update();
3230       //        delete Gforhojeta3k0;
3231       if (kcount > 18)
3232         break;
3233     }
3234   }
3235 
3236   /////////////////
3237   c1->Update();
3238   ////////////////////////////////////////////////////////////////////////////////////
3239   //========================================================================================== 39  HO: j = 7,8,9,10            11,12,13,14    11
3240   //======================================================================
3241   //======================================================================
3242   //======================================================================
3243   c1->Clear();
3244   c1->Divide(3, 6);
3245 
3246   nx = Yefz1->GetXaxis()->GetNbins();
3247   ny = Yefz1->GetYaxis()->GetNbins();
3248   nx = maxbins;
3249 
3250   //    if( nlsoho > 0.)      nhistoho /= nlsoho;
3251   //    cout<<"HO Gforhojeta18k        nx=     "<< nx <<" ny=     "<< ny <<" nhistoho=     "<< nhistoho <<endl;
3252   kcount = 1;
3253   cout << "HO Gforhojeta18k *********************************************************************       jeta == 11    "
3254        << endl;
3255   // j - etaphi index:
3256   TH1F* h2CeffGforhojeta18k0 = new TH1F("h2CeffGforhojeta18k0", "", maxbins, 1., maxbins + 1.);
3257   for (int j = 1; j <= ny; j++) {
3258     int jeta = (j - 1) / 18;  // jeta = 0-21
3259     if (jeta == 11) {
3260       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3261                                            //     jeta += 1;// jeta = 1-22
3262       //      TH1F* Gforhojeta18k0 = new TH1F("Gforhojeta18k0","", maxbins, 1., maxbins+1.);
3263       TH1F* Gforhojeta18k0 = (TH1F*)h2CeffGforhojeta18k0->Clone("twod1");
3264       // i - # LSs:
3265       for (int i = 1; i <= nx; i++) {
3266         double ccc1 = Yefz1->GetBinContent(i, j);
3267         if (ccc1 > 0.) {
3268           //          if(i==1)cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3269           Gforhojeta18k0->Fill(i, ccc1);
3270         }
3271       }
3272       c1->cd(kcount);
3273       //      cout<<"HO Gforhojeta18k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3274       Gforhojeta18k0->SetMarkerStyle(20);
3275       Gforhojeta18k0->SetMarkerSize(0.4);
3276       Gforhojeta18k0->GetYaxis()->SetLabelSize(0.04);
3277       Gforhojeta18k0->SetXTitle("Gforhojeta18k0 \b");
3278       Gforhojeta18k0->SetMarkerColor(2);
3279       Gforhojeta18k0->SetLineColor(0);
3280       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3281       Gforhojeta18k0->Draw("Error");
3282       kcount++;
3283       //    c1->Update();
3284       //        delete Gforhojeta18k0;
3285       if (kcount > 18)
3286         break;
3287     }
3288   }
3289 
3290   /////////////////
3291   c1->Update();
3292   ////////////////////////////////////////////////////////////////////////////////////
3293   //========================================================================================== 40  HO: j = 7,8,9,10            11,12,13,14   12
3294   //======================================================================
3295   //======================================================================
3296   //======================================================================
3297   c1->Clear();
3298   c1->Divide(3, 6);
3299 
3300   nx = Yefz1->GetXaxis()->GetNbins();
3301   ny = Yefz1->GetYaxis()->GetNbins();
3302   nx = maxbins;
3303 
3304   //    if( nlsoho > 0.)      nhistoho /= nlsoho;
3305   //    cout<<"HO Gforhojeta19k        nx=     "<< nx <<" ny=     "<< ny <<" nhistoho=     "<< nhistoho <<endl;
3306   kcount = 1;
3307   cout << "HO Gforhojeta19k *********************************************************************       jeta == 12    "
3308        << endl;
3309   // j - etaphi index:
3310   TH1F* h2CeffGforhojeta19k0 = new TH1F("h2CeffGforhojeta19k0", "", maxbins, 1., maxbins + 1.);
3311   for (int j = 1; j <= ny; j++) {
3312     int jeta = (j - 1) / 18;  // jeta = 0-21
3313     if (jeta == 12) {
3314       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3315                                            //     jeta += 1;// jeta = 1-22
3316       //      TH1F* Gforhojeta19k0 = new TH1F("Gforhojeta19k0","", maxbins, 1., maxbins+1.);
3317       TH1F* Gforhojeta19k0 = (TH1F*)h2CeffGforhojeta19k0->Clone("twod1");
3318       // i - # LSs:
3319       for (int i = 1; i <= nx; i++) {
3320         double ccc1 = Yefz1->GetBinContent(i, j);
3321         if (ccc1 > 0.) {
3322           //          if(i==1)cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3323           Gforhojeta19k0->Fill(i, ccc1);
3324         }
3325       }
3326       c1->cd(kcount);
3327       //      cout<<"HO Gforhojeta19k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3328       Gforhojeta19k0->SetMarkerStyle(20);
3329       Gforhojeta19k0->SetMarkerSize(0.4);
3330       Gforhojeta19k0->GetYaxis()->SetLabelSize(0.04);
3331       Gforhojeta19k0->SetXTitle("Gforhojeta19k0 \b");
3332       Gforhojeta19k0->SetMarkerColor(2);
3333       Gforhojeta19k0->SetLineColor(0);
3334       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3335       Gforhojeta19k0->Draw("Error");
3336       kcount++;
3337       //    c1->Update();
3338       //        delete Gforhojeta19k0;
3339       if (kcount > 18)
3340         break;
3341     }
3342   }
3343 
3344   /////////////////
3345   c1->Update();
3346   ////////////////////////////////////////////////////////////////////////////////////
3347   //========================================================================================== 41  HO: j = 7,8,9,10            11,12,13,14    13
3348   //======================================================================
3349   //======================================================================
3350   //======================================================================
3351   c1->Clear();
3352   c1->Divide(3, 6);
3353 
3354   nx = Yefz1->GetXaxis()->GetNbins();
3355   ny = Yefz1->GetYaxis()->GetNbins();
3356   nx = maxbins;
3357 
3358   //    if( nlsoho > 0.)      nhistoho /= nlsoho;
3359   //    cout<<"HO Gforhojeta20k        nx=     "<< nx <<" ny=     "<< ny <<" nhistoho=     "<< nhistoho <<endl;
3360   kcount = 1;
3361   cout << "HO Gforhojeta20k *********************************************************************       jeta == 13    "
3362        << endl;
3363   // j - etaphi index:
3364   TH1F* h2CeffGforhojeta20k0 = new TH1F("h2CeffGforhojeta20k0", "", maxbins, 1., maxbins + 1.);
3365   for (int j = 1; j <= ny; j++) {
3366     int jeta = (j - 1) / 18;  // jeta = 0-21
3367     if (jeta == 13) {
3368       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3369                                            //     jeta += 1;// jeta = 1-22
3370       //      TH1F* Gforhojeta20k0 = new TH1F("Gforhojeta20k0","", maxbins, 1., maxbins+1.);
3371       TH1F* Gforhojeta20k0 = (TH1F*)h2CeffGforhojeta20k0->Clone("twod1");
3372       // i - # LSs:
3373       for (int i = 1; i <= nx; i++) {
3374         double ccc1 = Yefz1->GetBinContent(i, j);
3375         if (ccc1 > 0.) {
3376           //          if(i==1)cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3377           Gforhojeta20k0->Fill(i, ccc1);
3378         }
3379       }
3380       c1->cd(kcount);
3381       //      cout<<"HO Gforhojeta20k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3382       Gforhojeta20k0->SetMarkerStyle(20);
3383       Gforhojeta20k0->SetMarkerSize(0.4);
3384       Gforhojeta20k0->GetYaxis()->SetLabelSize(0.04);
3385       Gforhojeta20k0->SetXTitle("Gforhojeta20k0 \b");
3386       Gforhojeta20k0->SetMarkerColor(2);
3387       Gforhojeta20k0->SetLineColor(0);
3388       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3389       Gforhojeta20k0->Draw("Error");
3390       kcount++;
3391       //    c1->Update();
3392       //        delete Gforhojeta20k0;
3393       if (kcount > 18)
3394         break;
3395     }
3396   }
3397 
3398   /////////////////
3399   c1->Update();
3400   ////////////////////////////////////////////////////////////////////////////////////
3401   //========================================================================================== 42  HO: j = 7,8,9,10            11,12,13,14    14
3402   //======================================================================
3403   //======================================================================
3404   //======================================================================
3405   c1->Clear();
3406   c1->Divide(3, 6);
3407 
3408   nx = Yefz1->GetXaxis()->GetNbins();
3409   ny = Yefz1->GetYaxis()->GetNbins();
3410   nx = maxbins;
3411 
3412   //    if( nlsoho > 0.)      nhistoho /= nlsoho;
3413   //    cout<<"HO Gforhojeta21k        nx=     "<< nx <<" ny=     "<< ny <<" nhistoho=     "<< nhistoho <<endl;
3414   kcount = 1;
3415   cout << "HO Gforhojeta21k *********************************************************************       jeta == 14    "
3416        << endl;
3417   // j - etaphi index:
3418   TH1F* h2CeffGforhojeta21k0 = new TH1F("h2CeffGforhojeta21k0", "", maxbins, 1., maxbins + 1.);
3419   for (int j = 1; j <= ny; j++) {
3420     int jeta = (j - 1) / 18;  // jeta = 0-21
3421     if (jeta == 14) {
3422       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3423                                            //     jeta += 1;// jeta = 1-22
3424       //      TH1F* Gforhojeta21k0 = new TH1F("Gforhojeta21k0","", maxbins, 1., maxbins+1.);
3425       TH1F* Gforhojeta21k0 = (TH1F*)h2CeffGforhojeta21k0->Clone("twod1");
3426       // i - # LSs:
3427       for (int i = 1; i <= nx; i++) {
3428         double ccc1 = Yefz1->GetBinContent(i, j);
3429         if (ccc1 > 0.) {
3430           //          if(i==1)cout<<"HO  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3431           Gforhojeta21k0->Fill(i, ccc1);
3432         }
3433       }
3434       c1->cd(kcount);
3435       //      cout<<"HO Gforhojeta21k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3436       Gforhojeta21k0->SetMarkerStyle(20);
3437       Gforhojeta21k0->SetMarkerSize(0.4);
3438       Gforhojeta21k0->GetYaxis()->SetLabelSize(0.04);
3439       Gforhojeta21k0->SetXTitle("Gforhojeta21k0 \b");
3440       Gforhojeta21k0->SetMarkerColor(2);
3441       Gforhojeta21k0->SetLineColor(0);
3442       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3443       Gforhojeta21k0->Draw("Error");
3444       kcount++;
3445       //    c1->Update();
3446       //        delete Gforhojeta21k0;
3447       if (kcount > 18)
3448         break;
3449     }
3450   }
3451 
3452   /////////////////
3453   c1->Update();
3454   ////////////////////////////////////////////////////////////////////////////////////
3455   //========================================================================================== 43    HF - "h_2DsumADCAmplEtaPhiLs3
3456   //======================================================================
3457   //======================================================================
3458   //================
3459   //======================================================================
3460   c1->Clear();
3461   c1->Divide(2, 2);
3462 
3463   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3464   TH2F* Gefz1KKK = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs3");
3465   TH2F* Gefz1LLL = (TH2F*)hfile1->Get("h_2DsumADCAmplEtaPhiLs30");
3466   TH2F* Gefz1 = (TH2F*)Gefz1LLL->Clone("Gefz1");
3467   Gefz1->Divide(Gefz1KKK, Gefz1LLL, 1, 1, "B");  // average A
3468   Gefz1->Sumw2();
3469 
3470   c1->cd(1);
3471   maxbinx = 0;
3472   maxbiny = 0;
3473   int sumijhf = 0;
3474   nx = Gefz1->GetXaxis()->GetNbins();
3475   ny = Gefz1->GetYaxis()->GetNbins();
3476   nx = maxbins;
3477   cout << "HF h_2DsumADCAmplEtaPhiLs0         nx=     " << nx << " ny=     " << ny << endl;
3478   // i - # LSs:
3479   TH1F* Gefw0 = new TH1F("Gefw0", "", 250, 0., 1500.);
3480   for (int i = 1; i <= nx; i++) {
3481     // j - etaphi index:
3482     for (int j = 1; j <= ny; j++) {
3483       double ccc1 = Gefz1->GetBinContent(i, j);
3484       if (ccc1 > 0.) {
3485         sumijhf++;
3486         maxbinx = i;
3487         if (i > maxbinx)
3488           maxbinx = i;
3489         maxbiny = j;
3490         if (j > maxbiny)
3491           maxbiny = j;
3492         //    cout<<"HF h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
3493         Gefw0->Fill(ccc1);
3494       }
3495     }
3496   }
3497   cout << "HF maxbinx=  " << maxbinx << "     maxbiny=  " << maxbiny << "     sumijhf=  " << sumijhf << endl;
3498   Gefw0->SetMarkerStyle(20);
3499   Gefw0->SetMarkerSize(0.4);
3500   Gefw0->GetYaxis()->SetLabelSize(0.04);
3501   Gefw0->SetXTitle("<A>ijk = <A> averaged per events in k-th LS \b");
3502   Gefw0->SetYTitle("     HF \b");
3503   Gefw0->SetMarkerColor(2);
3504   Gefw0->SetLineColor(0);
3505   //  Gefw0->SetMinimum(10.);
3506   gPad->SetLogy();
3507   gPad->SetGridy();
3508   gPad->SetGridx();
3509   //      Gefw0 ->Draw("L");
3510   Gefw0->Draw("Error");
3511   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3512   c1->cd(2);
3513   TH1F* Gefw = new TH1F("Gefw", "", maxbins, 1., maxbins + 1.);
3514   // i - # LSs:
3515   for (int i = 1; i <= nx; i++) {
3516     // j - etaphi index:
3517     for (int j = 1; j <= ny; j++) {
3518       double ccc1 = Gefz1->GetBinContent(i, j);
3519       if (ccc1 > 0.) {
3520         //    cout<<"HF h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
3521         //    Gefw ->Fill(ccc1/maxbinx);
3522         Gefw->Fill(float(i), ccc1* maxbinx / sumijhf);
3523       }
3524     }
3525   }
3526   Gefw->SetMarkerStyle(20);
3527   Gefw->SetMarkerSize(0.4);
3528   Gefw->GetYaxis()->SetLabelSize(0.04);
3529   Gefw->SetMarkerColor(2);
3530   Gefw->SetLineColor(0);
3531   Gefw->SetXTitle("        iLS  \b");
3532   Gefw->SetYTitle("     <A>k \b");
3533   //Gefw->SetMinimum(0.8);Gefw->SetMaximum(500.);
3534   gPad->SetLogy();
3535   gPad->SetGridy();
3536   gPad->SetGridx();
3537   Gefw->Draw("Error");
3538 
3539   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3540   c1->cd(3);
3541   TH1F* Gefw1 = new TH1F("Gefw1", "", 150, 0., 500.);
3542   for (int i = 1; i <= nx; i++) {
3543     // j - etaphi index:
3544     for (int j = 1; j <= ny; j++) {
3545       double ccc1 = Gefz1->GetBinContent(i, j);
3546       if (ccc1 > 0.) {
3547         maxbinx = i;
3548         if (i > maxbinx)
3549           maxbinx = i;
3550         maxbiny = j;
3551         if (j > maxbiny)
3552           maxbiny = j;
3553         //    cout<<"HF h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1 <<endl;
3554         Gefw1->Fill(ccc1);
3555       }
3556     }
3557   }
3558   cout << "HF maxbinx=  " << maxbinx << "     maxbiny=  " << maxbiny << endl;
3559   Gefw1->SetMarkerStyle(20);
3560   Gefw1->SetMarkerSize(0.4);
3561   Gefw1->GetYaxis()->SetLabelSize(0.04);
3562   Gefw1->SetXTitle("<A>ijk = <A> averaged per events in k-th LS \b");
3563   Gefw1->SetMarkerColor(2);
3564   Gefw1->SetLineColor(0);
3565   // Gefw1->SetMinimum(0.8);
3566   gPad->SetLogy();
3567   gPad->SetGridy();
3568   gPad->SetGridx();
3569   //      Gefw1 ->Draw("L");
3570   Gefw1->Draw("Error");
3571 
3572   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3573   c1->cd(4);
3574   // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ;  k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
3575   TH2F* Gefz4 = new TH2F("Gefz4", "", 22, -11., 11., 18, 0., 18.);
3576   // i - # LSs:
3577   for (int i = 1; i <= nx; i++) {
3578     // j - etaphi index:
3579     for (int j = 1; j <= ny; j++) {
3580       double ccc1 = Gefz1->GetBinContent(i, j);
3581       //if(ccc1>0.) cout<<"HF h_2DsumADCAmplEtaPhiLs:  ibin=  "<< i <<"      jbin= "<< j <<"  A= "<< ccc1/maxbinx <<endl;
3582       //    if(ccc1>0. && ccc1/maxbinx < 2000) {
3583       if (ccc1 > 0.) {
3584         int jeta = (j - 1) / 18;             // jeta = 0-21
3585         int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3586         //    jeta += 1;// jeta = 1-22
3587         //        if(i==1) cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta-11 <<" jphi= "<< jphi-1 <<"  A= "<< ccc1/maxbinx <<endl;
3588         Gefz4->Fill(jeta - 11, jphi - 1, ccc1 * maxbiny / sumijhf);
3589         //    Gefz4 ->Fill(jeta-11,jphi-1,ccc1/maxbinx);
3590       }
3591     }
3592   }
3593   gPad->SetGridy();
3594   gPad->SetGridx();  //      gPad->SetLogz();
3595   Gefz4->SetMarkerStyle(20);
3596   Gefz4->SetMarkerSize(0.4);
3597   Gefz4->GetZaxis()->SetLabelSize(0.08);
3598   Gefz4->SetXTitle("<A>_RBX         #eta  \b");
3599   Gefz4->SetYTitle("      #phi \b");
3600   Gefz4->SetZTitle("<A>_RBX  - All \b");
3601   Gefz4->SetMarkerColor(2);
3602   Gefz4->SetLineColor(2);  //      Gefz4->SetMaximum(1.000);  //      Gefz4->SetMinimum(1.0);
3603   Gefz4->Draw("COLZ");
3604 
3605   c1->Update();
3606 
3607   //======================================================================
3608 
3609   //========================================================================================== 44 HF
3610   //======================================================================
3611   //======================================================================
3612   //======================================================================
3613   c1->Clear();
3614   c1->Divide(1, 3);
3615 
3616   c1->cd(1);
3617   nx = Gefz1->GetXaxis()->GetNbins();
3618   ny = Gefz1->GetYaxis()->GetNbins();
3619   nx = maxbins;
3620   cout << "HF Gefk        nx=     " << nx << " ny=     " << ny << endl;
3621   TH1F* Gefk0 = new TH1F("Gefk0", "", maxbins, 1., maxbins + 1.);
3622   TH1F* Gefk1 = new TH1F("Gefk1", "", maxbins, 1., maxbins + 1.);
3623   TH1F* Gefk2 = new TH1F("Gefk2", "", maxbins, 1., maxbins + 1.);
3624   // i - # LSs:
3625   for (int i = 1; i <= nx; i++) {
3626     // j - etaphi index:
3627     for (int j = 1; j <= ny; j++) {
3628       double ccc1 = Gefz1->GetBinContent(i, j);
3629       if (ccc1 > 0.) {
3630         int jeta = (j - 1) / 18;             // jeta = 0-21
3631         int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3632         //    jeta += 1;// jeta = 1-22
3633         //      cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3634         if (jeta == 1 && jphi == 11)
3635           Gefk0->Fill(i, ccc1);
3636         if (jeta == 2 && jphi == 11)
3637           Gefk1->Fill(i, ccc1);
3638         if (jeta == 3 && jphi == 11)
3639           Gefk2->Fill(i, ccc1);
3640       }
3641     }
3642   }
3643   Gefk0->SetMarkerStyle(20);
3644   Gefk0->SetMarkerSize(0.4);
3645   Gefk0->GetYaxis()->SetLabelSize(0.04);
3646   Gefk0->SetXTitle("Gefk0 \b");
3647   Gefk0->SetMarkerColor(2);
3648   Gefk0->SetLineColor(
3649       0);  // Gefk0 ->SetMaximum(30.0);// Gefk0 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3650   Gefk0->Draw("Error");
3651 
3652   //================
3653   c1->cd(2);
3654   Gefk1->SetMarkerStyle(20);
3655   Gefk1->SetMarkerSize(0.4);
3656   Gefk1->GetYaxis()->SetLabelSize(0.04);
3657   Gefk1->SetXTitle("Gefk1 \b");
3658   Gefk1->SetMarkerColor(2);
3659   Gefk1->SetLineColor(
3660       0);  // Gefk1 ->SetMaximum(30.0);// Gefk1 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3661   Gefk1->Draw("Error");
3662 
3663   //================
3664   c1->cd(3);
3665   Gefk2->SetMarkerStyle(20);
3666   Gefk2->SetMarkerSize(0.4);
3667   Gefk2->GetYaxis()->SetLabelSize(0.04);
3668   Gefk2->SetXTitle("Gefk2 \b");
3669   Gefk2->SetMarkerColor(2);
3670   Gefk2->SetLineColor(
3671       0);  // Gefk2 ->SetMaximum(30.0);// Gefk2 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3672   Gefk2->Draw("Error");
3673 
3674   ////////////////////////////////////////////////////////////////////////////////////
3675   c1->Update();
3676   ////////////////////////////////////////////////////////////////////////////////////
3677   //========================================================================================== 45 HF
3678   //======================================================================
3679   //======================================================================
3680   //======================================================================
3681   c1->Clear();
3682   c1->Divide(1, 3);
3683 
3684   //        cout<<"  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3685   c1->cd(1);
3686   nx = Gefz1->GetXaxis()->GetNbins();
3687   ny = Gefz1->GetYaxis()->GetNbins();
3688   nx = maxbins;
3689   cout << "HF Gefh        nx=     " << nx << " ny=     " << ny << endl;
3690   TH1F* Gefh0 = new TH1F("Gefh0", "", maxbins, 1., maxbins + 1.);
3691   TH1F* Gefh1 = new TH1F("Gefh1", "", maxbins, 1., maxbins + 1.);
3692   TH1F* Gefh2 = new TH1F("Gefh2", "", maxbins, 1., maxbins + 1.);
3693   // j - etaphi index:
3694   int nhistohf = 0.;
3695   int nlsohf = -1.;
3696   for (int j = 1; j <= ny; j++) {
3697     int jeta = (j - 1) / 18;             // jeta = 0-21
3698     int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3699     //    jeta += 1;// jeta = 1-22
3700     double sumj = 0.;
3701     double ssumj = 0.;
3702     int nj = 0;
3703     double meanj = 0.;
3704     double sigmaj = 0.;
3705     // i - # LSs:
3706     for (int i = 1; i <= nx; i++) {
3707       double ccc1 = Gefz1->GetBinContent(i, j);
3708       if (ccc1 > 0.) {
3709         sumj += ccc1;
3710         nj++;
3711         nhistohf++;
3712       }
3713     }
3714     meanj = sumj / nj;
3715     if (nj > nlsohf)
3716       nlsohf = nj;
3717     // i - # LSs:
3718     for (int i = 1; i <= nx; i++) {
3719       double ccc1 = Gefz1->GetBinContent(i, j);
3720       if (ccc1 > 0.) {
3721         ssumj += (ccc1 - meanj) * (ccc1 - meanj);
3722       }
3723     }
3724     sigmaj = sqrt(ssumj / nj);
3725     // i - # LSs:
3726     for (int i = 1; i <= nx; i++) {
3727       double ccc1 = Gefz1->GetBinContent(i, j);
3728       if (ccc1 > 0.) {
3729         double dif3rmsMIN = meanj - 3 * sigmaj;
3730         if (dif3rmsMIN < 0.)
3731           dif3rmsMIN = 0.;
3732         double dif3rmsMAX = meanj + 3 * sigmaj;
3733         if (jeta == 1 && jphi == 11 && (ccc1 < dif3rmsMIN || ccc1 > dif3rmsMAX))
3734           Gefh0->Fill(i, ccc1);
3735         if (jeta == 2 && jphi == 11 && (ccc1 < dif3rmsMIN || ccc1 > dif3rmsMAX))
3736           Gefh1->Fill(i, ccc1);
3737         if (jeta == 3 && jphi == 11 && (ccc1 < dif3rmsMIN || ccc1 > dif3rmsMAX))
3738           Gefh2->Fill(i, ccc1);
3739       }
3740     }
3741   }
3742   cout << "HF 45        nhistohf =     " << nhistohf << "           nlsohf =     " << nlsohf << endl;
3743 
3744   Gefh0->SetMarkerStyle(20);
3745   Gefh0->SetMarkerSize(0.4);
3746   Gefh0->GetYaxis()->SetLabelSize(0.04);
3747   Gefh0->SetXTitle("Gefh0 \b");
3748   Gefh0->SetMarkerColor(2);
3749   Gefh0->SetLineColor(
3750       0);  // Gefh0 ->SetMaximum(30.0);// Gefh0 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3751   Gefh0->Draw("Error");
3752   //================
3753   c1->cd(2);
3754   Gefh1->SetMarkerStyle(20);
3755   Gefh1->SetMarkerSize(0.4);
3756   Gefh1->GetYaxis()->SetLabelSize(0.04);
3757   Gefh1->SetXTitle("Gefh1 \b");
3758   Gefh1->SetMarkerColor(2);
3759   Gefh1->SetLineColor(
3760       0);  // Gefh1 ->SetMaximum(30.0);// Gefh1 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3761   Gefh1->Draw("Error");
3762   //================
3763   c1->cd(3);
3764   Gefh2->SetMarkerStyle(20);
3765   Gefh2->SetMarkerSize(0.4);
3766   Gefh2->GetYaxis()->SetLabelSize(0.04);
3767   Gefh2->SetXTitle("Gefh2 \b");
3768   Gefh2->SetMarkerColor(2);
3769   Gefh2->SetLineColor(
3770       0);  // Gefh2 ->SetMaximum(30.0);// Gefh2 ->SetMinimum(20.0); // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3771   Gefh2->Draw("Error");
3772 
3773   ////////////////////////////////////////////////////////////////////////////////////
3774   c1->Update();
3775 
3776   //========================================================================================== 46 HF: j = 0,1,2, 3            18,19,20,21          0
3777   //======================================================================
3778   //======================================================================
3779   //======================================================================
3780   c1->Clear();
3781   c1->Divide(3, 6);
3782 
3783   nx = Gefz1->GetXaxis()->GetNbins();
3784   ny = Gefz1->GetYaxis()->GetNbins();
3785   nx = maxbins;
3786 
3787   if (nlsohf > 0.)
3788     nhistohf /= nlsohf;
3789   cout << "HF Gforhfjeta0k        nx=     " << nx << " ny=     " << ny << " nhistohf=     " << nhistohf << endl;
3790   kcount = 1;
3791   cout << "HF Gforhfjeta0k *********************************************************************       jeta == 0    "
3792        << endl;
3793   // j - etaphi index:
3794   TH1F* h2CeffGforhfjeta0k0 = new TH1F("h2CeffGforhfjeta0k0", "", maxbins, 1., maxbins + 1.);
3795   for (int j = 1; j <= ny; j++) {
3796     int jeta = (j - 1) / 18;  // jeta = 0-21
3797     if (jeta == 0) {
3798       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3799                                            //     jeta += 1;// jeta = 1-22
3800       //      TH1F* Gforhfjeta0k0 = new TH1F("Gforhfjeta0k0","", maxbins, 1., maxbins+1.);
3801       TH1F* Gforhfjeta0k0 = (TH1F*)h2CeffGforhfjeta0k0->Clone("twod1");
3802       // i - # LSs:
3803       for (int i = 1; i <= nx; i++) {
3804         double ccc1 = Gefz1->GetBinContent(i, j);
3805         if (ccc1 > 0.) {
3806           //          if(i==1)cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3807           Gforhfjeta0k0->Fill(i, ccc1);
3808         }
3809       }
3810       c1->cd(kcount);
3811       //      cout<<"HF Gforhfjeta0k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3812       Gforhfjeta0k0->SetMarkerStyle(20);
3813       Gforhfjeta0k0->SetMarkerSize(0.4);
3814       Gforhfjeta0k0->GetYaxis()->SetLabelSize(0.04);
3815       Gforhfjeta0k0->SetXTitle("Gforhfjeta0k0 \b");
3816       Gforhfjeta0k0->SetMarkerColor(2);
3817       Gforhfjeta0k0->SetLineColor(0);
3818       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3819       Gforhfjeta0k0->Draw("Error");
3820       kcount++;
3821       //    c1->Update();
3822       //        delete Gforhfjeta0k0;
3823       if (kcount > 18)
3824         break;
3825     }
3826   }
3827 
3828   /////////////////
3829   c1->Update();
3830   ////////////////////////////////////////////////////////////////////////////////////
3831   //========================================================================================== 47 HF: j = 0,1,2, 3            18,19,20,21      1
3832   //======================================================================
3833   //======================================================================
3834   //======================================================================
3835   c1->Clear();
3836   c1->Divide(3, 6);
3837 
3838   nx = Gefz1->GetXaxis()->GetNbins();
3839   ny = Gefz1->GetYaxis()->GetNbins();
3840   nx = maxbins;
3841 
3842   //      if( nlsohf > 0.)      nhistohf /= nlsohf;
3843   //      cout<<"HF Gforhfjeta1k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohf=     "<< nhistohf <<endl;
3844   kcount = 1;
3845   cout << "HF Gforhfjeta1k *********************************************************************       jeta == 1    "
3846        << endl;
3847   // j - etaphi index:
3848   TH1F* h2CeffGforhfjeta1k0 = new TH1F("h2CeffGforhfjeta1k0", "", maxbins, 1., maxbins + 1.);
3849   for (int j = 1; j <= ny; j++) {
3850     int jeta = (j - 1) / 18;  // jeta = 0-21
3851     if (jeta == 1) {
3852       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3853                                            //     jeta += 1;// jeta = 1-22
3854       //      TH1F* Gforhfjeta1k0 = new TH1F("Gforhfjeta1k0","", maxbins, 1., maxbins+1.);
3855       TH1F* Gforhfjeta1k0 = (TH1F*)h2CeffGforhfjeta1k0->Clone("twod1");
3856       // i - # LSs:
3857       for (int i = 1; i <= nx; i++) {
3858         double ccc1 = Gefz1->GetBinContent(i, j);
3859         if (ccc1 > 0.) {
3860           //          if(i==1)cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3861           Gforhfjeta1k0->Fill(i, ccc1);
3862         }
3863       }
3864       c1->cd(kcount);
3865       //      cout<<"HF Gforhfjeta1k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3866       Gforhfjeta1k0->SetMarkerStyle(20);
3867       Gforhfjeta1k0->SetMarkerSize(0.4);
3868       Gforhfjeta1k0->GetYaxis()->SetLabelSize(0.04);
3869       Gforhfjeta1k0->SetXTitle("Gforhfjeta1k0 \b");
3870       Gforhfjeta1k0->SetMarkerColor(2);
3871       Gforhfjeta1k0->SetLineColor(0);
3872       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3873       Gforhfjeta1k0->Draw("Error");
3874       kcount++;
3875       //    c1->Update();
3876       //        delete Gforhfjeta1k0;
3877       if (kcount > 18)
3878         break;
3879     }
3880   }
3881 
3882   /////////////////
3883   c1->Update();
3884   ////////////////////////////////////////////////////////////////////////////////////
3885   //========================================================================================== 48   HF: j = 0,1,2, 3            18,19,20,21    2
3886   //======================================================================
3887   //======================================================================
3888   //======================================================================
3889   c1->Clear();
3890   c1->Divide(3, 6);
3891 
3892   nx = Gefz1->GetXaxis()->GetNbins();
3893   ny = Gefz1->GetYaxis()->GetNbins();
3894   nx = maxbins;
3895 
3896   //      if( nlsohf > 0.)      nhistohf /= nlsohf;
3897   //      cout<<"HF Gforhfjeta2k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohf=     "<< nhistohf <<endl;
3898   kcount = 1;
3899   cout << "HF Gforhfjeta2k *********************************************************************       jeta == 2    "
3900        << endl;
3901   // j - etaphi index:
3902   TH1F* h2CeffGforhfjeta2k0 = new TH1F("h2CeffGforhfjeta2k0", "", maxbins, 1., maxbins + 1.);
3903   for (int j = 1; j <= ny; j++) {
3904     int jeta = (j - 1) / 18;  // jeta = 0-21
3905     if (jeta == 2) {
3906       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3907                                            //     jeta += 1;// jeta = 1-22
3908       //      TH1F* Gforhfjeta2k0 = new TH1F("Gforhfjeta2k0","", maxbins, 1., maxbins+1.);
3909       TH1F* Gforhfjeta2k0 = (TH1F*)h2CeffGforhfjeta2k0->Clone("twod1");
3910       // i - # LSs:
3911       for (int i = 1; i <= nx; i++) {
3912         double ccc1 = Gefz1->GetBinContent(i, j);
3913         if (ccc1 > 0.) {
3914           //          if(i==1)cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3915           Gforhfjeta2k0->Fill(i, ccc1);
3916         }
3917       }
3918       c1->cd(kcount);
3919       //      cout<<"HF Gforhfjeta2k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3920       Gforhfjeta2k0->SetMarkerStyle(20);
3921       Gforhfjeta2k0->SetMarkerSize(0.4);
3922       Gforhfjeta2k0->GetYaxis()->SetLabelSize(0.04);
3923       Gforhfjeta2k0->SetXTitle("Gforhfjeta2k0 \b");
3924       Gforhfjeta2k0->SetMarkerColor(2);
3925       Gforhfjeta2k0->SetLineColor(0);
3926       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3927       Gforhfjeta2k0->Draw("Error");
3928       kcount++;
3929       //    c1->Update();
3930       //        delete Gforhfjeta2k0;
3931       if (kcount > 18)
3932         break;
3933     }
3934   }
3935 
3936   /////////////////
3937   c1->Update();
3938   ////////////////////////////////////////////////////////////////////////////////////
3939   //========================================================================================== 49 HF: j = 0,1,2, 3            18,19,20,21   3
3940   //======================================================================
3941   //======================================================================
3942   //======================================================================
3943   c1->Clear();
3944   c1->Divide(3, 6);
3945 
3946   nx = Gefz1->GetXaxis()->GetNbins();
3947   ny = Gefz1->GetYaxis()->GetNbins();
3948   nx = maxbins;
3949 
3950   //      if( nlsohf > 0.)      nhistohf /= nlsohf;
3951   //      cout<<"HF Gforhfjeta3k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohf=     "<< nhistohf <<endl;
3952   kcount = 1;
3953   cout << "HF Gforhfjeta3k *********************************************************************       jeta == 3    "
3954        << endl;
3955   // j - etaphi index:
3956   TH1F* h2CeffGforhfjeta3k0 = new TH1F("h2CeffGforhfjeta3k0", "", maxbins, 1., maxbins + 1.);
3957   for (int j = 1; j <= ny; j++) {
3958     int jeta = (j - 1) / 18;  // jeta = 0-21
3959     if (jeta == 3) {
3960       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
3961                                            //     jeta += 1;// jeta = 1-22
3962       //      TH1F* Gforhfjeta3k0 = new TH1F("Gforhfjeta3k0","", maxbins, 1., maxbins+1.);
3963       TH1F* Gforhfjeta3k0 = (TH1F*)h2CeffGforhfjeta3k0->Clone("twod1");
3964       // i - # LSs:
3965       for (int i = 1; i <= nx; i++) {
3966         double ccc1 = Gefz1->GetBinContent(i, j);
3967         if (ccc1 > 0.) {
3968           //          if(i==1)cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
3969           Gforhfjeta3k0->Fill(i, ccc1);
3970         }
3971       }
3972       c1->cd(kcount);
3973       //      cout<<"HF Gforhfjeta3k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
3974       Gforhfjeta3k0->SetMarkerStyle(20);
3975       Gforhfjeta3k0->SetMarkerSize(0.4);
3976       Gforhfjeta3k0->GetYaxis()->SetLabelSize(0.04);
3977       Gforhfjeta3k0->SetXTitle("Gforhfjeta3k0 \b");
3978       Gforhfjeta3k0->SetMarkerColor(2);
3979       Gforhfjeta3k0->SetLineColor(0);
3980       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
3981       Gforhfjeta3k0->Draw("Error");
3982       kcount++;
3983       //    c1->Update();
3984       //        delete Gforhfjeta3k0;
3985       if (kcount > 18)
3986         break;
3987     }
3988   }
3989 
3990   /////////////////
3991   c1->Update();
3992   ////////////////////////////////////////////////////////////////////////////////////
3993   //========================================================================================== 50   HF: j = 0,1,2, 3            18,19,20,21      18
3994   //======================================================================
3995   //======================================================================
3996   //======================================================================
3997   c1->Clear();
3998   c1->Divide(3, 6);
3999 
4000   nx = Gefz1->GetXaxis()->GetNbins();
4001   ny = Gefz1->GetYaxis()->GetNbins();
4002   nx = maxbins;
4003 
4004   //      if( nlsohf > 0.)      nhistohf /= nlsohf;
4005   //      cout<<"HF Gforhfjeta18k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohf=     "<< nhistohf <<endl;
4006   kcount = 1;
4007   cout << "HF Gforhfjeta18k *********************************************************************       jeta == 18    "
4008        << endl;
4009   // j - etaphi index:
4010   TH1F* h2CeffGforhfjeta18k0 = new TH1F("h2CeffGforhfjeta18k0", "", maxbins, 1., maxbins + 1.);
4011   for (int j = 1; j <= ny; j++) {
4012     int jeta = (j - 1) / 18;  // jeta = 0-21
4013     if (jeta == 18) {
4014       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
4015                                            //     jeta += 1;// jeta = 1-22
4016       //      TH1F* Gforhfjeta18k0 = new TH1F("Gforhfjeta18k0","", maxbins, 1., maxbins+1.);
4017       TH1F* Gforhfjeta18k0 = (TH1F*)h2CeffGforhfjeta18k0->Clone("twod1");
4018       // i - # LSs:
4019       for (int i = 1; i <= nx; i++) {
4020         double ccc1 = Gefz1->GetBinContent(i, j);
4021         if (ccc1 > 0.) {
4022           //          if(i==1)cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
4023           Gforhfjeta18k0->Fill(i, ccc1);
4024         }
4025       }
4026       c1->cd(kcount);
4027       //      cout<<"HF Gforhfjeta18k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
4028       Gforhfjeta18k0->SetMarkerStyle(20);
4029       Gforhfjeta18k0->SetMarkerSize(0.4);
4030       Gforhfjeta18k0->GetYaxis()->SetLabelSize(0.04);
4031       Gforhfjeta18k0->SetXTitle("Gforhfjeta18k0 \b");
4032       Gforhfjeta18k0->SetMarkerColor(2);
4033       Gforhfjeta18k0->SetLineColor(0);
4034       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
4035       Gforhfjeta18k0->Draw("Error");
4036       kcount++;
4037       //    c1->Update();
4038       //        delete Gforhfjeta18k0;
4039       if (kcount > 18)
4040         break;
4041     }
4042   }
4043 
4044   /////////////////
4045   c1->Update();
4046   ////////////////////////////////////////////////////////////////////////////////////
4047   //========================================================================================== 51   HF: j = 0,1,2, 3            18,19,20,21     19
4048   //======================================================================
4049   //======================================================================
4050   //======================================================================
4051   c1->Clear();
4052   c1->Divide(3, 6);
4053 
4054   nx = Gefz1->GetXaxis()->GetNbins();
4055   ny = Gefz1->GetYaxis()->GetNbins();
4056   nx = maxbins;
4057 
4058   //      if( nlsohf > 0.)      nhistohf /= nlsohf;
4059   //      cout<<"HF Gforhfjeta19k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohf=     "<< nhistohf <<endl;
4060   kcount = 1;
4061   cout << "HF Gforhfjeta19k *********************************************************************       jeta == 19    "
4062        << endl;
4063   // j - etaphi index:
4064   TH1F* h2CeffGforhfjeta19k0 = new TH1F("h2CeffGforhfjeta19k0", "", maxbins, 1., maxbins + 1.);
4065   for (int j = 1; j <= ny; j++) {
4066     int jeta = (j - 1) / 18;  // jeta = 0-21
4067     if (jeta == 19) {
4068       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
4069                                            //     jeta += 1;// jeta = 1-22
4070       //      TH1F* Gforhfjeta19k0 = new TH1F("Gforhfjeta19k0","", maxbins, 1., maxbins+1.);
4071       TH1F* Gforhfjeta19k0 = (TH1F*)h2CeffGforhfjeta19k0->Clone("twod1");
4072       // i - # LSs:
4073       for (int i = 1; i <= nx; i++) {
4074         double ccc1 = Gefz1->GetBinContent(i, j);
4075         if (ccc1 > 0.) {
4076           //          if(i==1)cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
4077           Gforhfjeta19k0->Fill(i, ccc1);
4078         }
4079       }
4080       c1->cd(kcount);
4081       //      cout<<"HF Gforhfjeta19k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
4082       Gforhfjeta19k0->SetMarkerStyle(20);
4083       Gforhfjeta19k0->SetMarkerSize(0.4);
4084       Gforhfjeta19k0->GetYaxis()->SetLabelSize(0.04);
4085       Gforhfjeta19k0->SetXTitle("Gforhfjeta19k0 \b");
4086       Gforhfjeta19k0->SetMarkerColor(2);
4087       Gforhfjeta19k0->SetLineColor(0);
4088       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
4089       Gforhfjeta19k0->Draw("Error");
4090       kcount++;
4091       //    c1->Update();
4092       //        delete Gforhfjeta19k0;
4093       if (kcount > 18)
4094         break;
4095     }
4096   }
4097 
4098   /////////////////
4099   c1->Update();
4100   ////////////////////////////////////////////////////////////////////////////////////
4101   //========================================================================================== 52  HF: j = 0,1,2, 3            18,19,20,21   20
4102   //======================================================================
4103   //======================================================================
4104   //======================================================================
4105   c1->Clear();
4106   c1->Divide(3, 6);
4107 
4108   nx = Gefz1->GetXaxis()->GetNbins();
4109   ny = Gefz1->GetYaxis()->GetNbins();
4110   nx = maxbins;
4111 
4112   //      if( nlsohf > 0.)      nhistohf /= nlsohf;
4113   //      cout<<"HF Gforhfjeta20k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohf=     "<< nhistohf <<endl;
4114   kcount = 1;
4115   cout << "HF Gforhfjeta20k *********************************************************************       jeta == 20    "
4116        << endl;
4117   TH1F* h2CeffGforhfjeta20k0 = new TH1F("h2CeffGforhfjeta20k0", "", maxbins, 1., maxbins + 1.);
4118   // j - etaphi index:
4119   for (int j = 1; j <= ny; j++) {
4120     int jeta = (j - 1) / 18;  // jeta = 0-21
4121     if (jeta == 20) {
4122       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
4123                                            //     jeta += 1;// jeta = 1-22
4124       //      TH1F* Gforhfjeta20k0 = new TH1F("Gforhfjeta20k0","", maxbins, 1., maxbins+1.);
4125       TH1F* Gforhfjeta20k0 = (TH1F*)h2CeffGforhfjeta20k0->Clone("twod1");
4126       // i - # LSs:
4127       for (int i = 1; i <= nx; i++) {
4128         double ccc1 = Gefz1->GetBinContent(i, j);
4129         if (ccc1 > 0.) {
4130           //          if(i==1)cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
4131           Gforhfjeta20k0->Fill(i, ccc1);
4132         }
4133       }
4134       c1->cd(kcount);
4135       //      cout<<"HF Gforhfjeta20k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
4136       Gforhfjeta20k0->SetMarkerStyle(20);
4137       Gforhfjeta20k0->SetMarkerSize(0.4);
4138       Gforhfjeta20k0->GetYaxis()->SetLabelSize(0.04);
4139       Gforhfjeta20k0->SetXTitle("Gforhfjeta20k0 \b");
4140       Gforhfjeta20k0->SetMarkerColor(2);
4141       Gforhfjeta20k0->SetLineColor(0);
4142       gPad->SetGridx();
4143       // gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();
4144       Gforhfjeta20k0->Draw("Error");
4145       kcount++;
4146       //    c1->Update();
4147       //        delete Gforhfjeta20k0;
4148       if (kcount > 18)
4149         break;
4150     }
4151   }
4152 
4153   /////////////////
4154   c1->Update();
4155   ////////////////////////////////////////////////////////////////////////////////////
4156   //========================================================================================== 53   HF: j = 0,1,2, 3            18,19,20,21    21
4157   //======================================================================
4158   //======================================================================
4159   //======================================================================
4160   c1->Clear();
4161   c1->Divide(3, 6);
4162   nx = Gefz1->GetXaxis()->GetNbins();
4163   ny = Gefz1->GetYaxis()->GetNbins();
4164   nx = maxbins;
4165 
4166   //      if( nlsohf > 0.)      nhistohf /= nlsohf;
4167   //      cout<<"HF Gforhfjeta21k        nx=     "<< nx <<" ny=     "<< ny <<" nhistohf=     "<< nhistohf <<endl;
4168   kcount = 1;
4169   cout << "HF Gforhfjeta21k *********************************************************************       jeta == 21    "
4170        << endl;
4171   // j - etaphi index:
4172   //    TH1F *Gforhfjeta21k0= NULL;
4173   TH1F* h2CeffGforhfjeta21k0 = new TH1F("h2CeffGforhfjeta21k0", "", maxbins, 1., maxbins + 1.);
4174   for (int j = 1; j <= ny; j++) {
4175     int jeta = (j - 1) / 18;  // jeta = 0-21
4176     if (jeta == 21) {
4177       int jphi = (j - 1) - 18 * jeta + 1;  // jphi=1-18
4178                                            //     jeta += 1;// jeta = 1-22
4179       //      TH1F* Gforhfjeta21k0 = new TH1F("Gforhfjeta21k0","", maxbins, 1., maxbins+1.);
4180       TH1F* Gforhfjeta21k0 = (TH1F*)h2CeffGforhfjeta21k0->Clone("twod1");
4181 
4182       //    h2Ceff = (TH2F*)twod1->Clone(Form("Ceff_HF%d",depth));
4183       //    h2Ceff->SetTitle(Form("HF Depth %d. (No cut) \b",depth));
4184       //    h2Ceff->Divide(twod1,twod0, 1, 1, "B");
4185 
4186       // i - # LSs:
4187       for (int i = 1; i <= nx; i++) {
4188         double ccc1 = Gefz1->GetBinContent(i, j);
4189         if (ccc1 > 0.) {
4190           //          if(i==1)cout<<"HF  i= "<< i <<" j= "<< j <<"  jeta= "<< jeta <<" jphi= "<< jphi <<"      A= "<< ccc1 <<endl;
4191           Gforhfjeta21k0->Fill(i, ccc1);
4192         }
4193       }
4194       c1->cd(kcount);
4195       //      cout<<"HF Gforhfjeta21k        kcount=     "<< kcount <<"   jphi   =     "<<jphi  <<endl;
4196       Gforhfjeta21k0->SetMarkerStyle(20);
4197       Gforhfjeta21k0->SetMarkerSize(0.4);
4198       Gforhfjeta21k0->GetYaxis()->SetLabelSize(0.04);
4199       Gforhfjeta21k0->SetXTitle("Gforhfjeta21k0 \b");
4200       Gforhfjeta21k0->SetMarkerColor(2);
4201       Gforhfjeta21k0->SetLineColor(0);
4202       gPad->SetGridy();
4203       gPad->SetGridx();
4204       //       gPad->SetLogy();
4205       Gforhfjeta21k0->Draw("Error");
4206       kcount++;
4207       //    c1->Update();
4208       //        delete Gforhfjeta21k0;
4209       //      if (Gforhfjeta21k0) delete Gforhfjeta21k0;
4210 
4211       if (kcount > 18)
4212         break;
4213     }
4214   }
4215 
4216   /////////////////
4217   c1->Update();
4218   //////////////////////////////////////////////////////////////////////////////////// 533    HF:: jeta = 0,1,2, 3            18,19,20,21       // jphi = 0,1,2,3,4,5.... 17
4219   //======================================================================
4220   //======================================================================
4221   //======================================================================
4222   /*
4223       c1->Clear();
4224       c1->Divide(1,1);
4225       c1->cd(1);
4226       maxbinx = 0;
4227       maxbiny = 0;
4228       nx = Gefz1->GetXaxis()->GetNbins();
4229       ny = Gefz1->GetYaxis()->GetNbins();
4230       nx = maxbins;// ls
4231       cout<<"533 HF1     LS   nx=     "<< nx <<" ny=     "<< ny <<endl;
4232       TH2F* ADCAmplLSHF1 = new TH2F("ADCAmplLSHF1","", 610, 0., 610.,400,0., 400.);
4233       TH2F* ADCAmplLSHF10 = new TH2F("ADCAmplLSHF10","", 610, 0., 610.,400,0., 400.);
4234        TH2F* ADCAmplLSHF2 = (TH2F*)ADCAmplLSHF10->Clone("ADCAmplLSHF2");
4235       for (int i=1;i<=nx;i++) {
4236     for (int j=1;j<=ny;j++) {
4237       double ccc1 =  Gefz1->GetBinContent(i,j);
4238       if(ccc1>0.) {
4239         maxbinx = i; if(i>maxbinx) maxbinx = i;
4240         maxbiny = j; if(j>maxbiny) maxbiny = j;
4241         //              if(ccc1 <= 0.)              cout<<"HF1:  ibin=  "<< i <<"      jbin= "<< j <<"      A= "<< ccc1 <<endl;
4242         //      ADCAmplLSHF1 ->Fill(ccc1);
4243         ADCAmplLSHF1 ->Fill(float(i), float(j),ccc1);
4244         ADCAmplLSHF10 ->Fill(float(i), float(j),1.);
4245       }
4246     }}
4247        ADCAmplLSHF2->Divide(ADCAmplLSHF1,ADCAmplLSHF10, 1, 1, "B");// average A
4248       ADCAmplLSHF2 ->SetMarkerStyle(20);
4249       ADCAmplLSHF2 ->SetMarkerSize(0.4);
4250       ADCAmplLSHF2 ->GetYaxis()->SetLabelSize(0.04);
4251       ADCAmplLSHF2 ->SetXTitle("nev0-overAllLSs test with ADCAmplLSHF1 \b");
4252       ADCAmplLSHF2 ->SetMarkerColor(2);
4253       ADCAmplLSHF2 ->SetLineColor(0);
4254       //    gPad->SetLogy();gPad->SetGridy();gPad->SetGridx();     
4255           ADCAmplLSHF2 ->Draw("COLZ");
4256       cout<<"533 HF1 for h_2D0sumADCAmplLS1 maxbinx =  "<< maxbinx<<"     maxbiny=  "<< maxbiny <<endl;
4257        c1->Update();
4258 */
4259   /*
4260        for (int j=1;j<=ny;j++) {
4261      for (int i=1;i<=nx;i++) {
4262        double ccc1 =  Gefz1->GetBinContent(i,j);
4263        if(ccc1 <= 0.) cout<<"HF==================================*:  ibin=  "<< i <<"      jbin= "<< j <<"      A= "<< ccc1 <<endl;
4264      }//i
4265        }//j
4266 */
4267   //======================================================================HF:: jeta = 0,1,2, 3            18,19,20,21       // jphi = 0,1,2,3,4,5.... 17
4268   int njeta = 22;
4269   int njphi = 18;
4270   //       ny = Gefz1->GetYaxis()->GetNbins();// # etaphi indexe
4271   //       nx = Gefz1->GetXaxis()->GetNbins();// # LS
4272   //               cout<<"HF 111 54        ny=     "<< ny <<"   nx   =     "<<nx  <<endl;
4273   //       nx = maxbins;
4274   //               cout<<"HF 222 54        ny=     "<< ny <<"   nx   =     "<<nx  <<endl;
4275   double alexhf[njeta][njphi][nx];
4276   for (int i = 0; i < nx; i++) {
4277     for (int jeta = 0; jeta < njeta; jeta++) {
4278       for (int jphi = 0; jphi < njphi; jphi++) {
4279         alexhf[jeta][jphi][i] = 0.;
4280       }
4281     }
4282   }
4283   for (int j = 1; j <= ny; j++) {
4284     int jeta = (j - 1) / njphi;  // jeta = 0-21
4285     if (jeta < 4 || jeta > 17) {
4286       int jphi = (j - 1) - njphi * jeta;  // jphi=0-17
4287       //               cout<<"HF 54        jeta=     "<< jeta <<"   jphi   =     "<<jphi  <<endl;
4288 
4289       for (int i = 1; i <= nx; i++) {
4290         double ccc1 = Gefz1->GetBinContent(i, j);
4291         //              if(ccc1 <= 0.)              cout<<"HF*****************:  ibin=  "<< i <<"      jbin= "<< j <<"      A= "<< ccc1 <<endl;
4292         alexhf[jeta][jphi][i - 1] = ccc1;
4293         //               if( i == 1 ) cout<<"HF 54  for LS=1      ccc1=     "<< ccc1 <<endl;
4294         //               if( alexhf[jeta][jphi][i-1] <= 0. ) cout<<"HF 54        jeta=     "<< jeta <<"   jphi   =     "<<jphi  <<"  j   =     "<<j  <<"  i-1   =     "<<i-1  <<"  ccc1   =     "<<ccc1  <<endl;
4295       }  //i
4296     }    //if
4297   }      //j
4298   //------------------------
4299 
4300   //========================================================================================== 54   HF:: jeta = 0,1,2, 3            18,19,20,21       // jphi = 0,1,2,3,4,5.... 17
4301   //======================================================================
4302   //======================================================================
4303   //======================================================================
4304   c1->Clear();
4305   /////////////////
4306   c1->Divide(4, 6);
4307   int kcountHFnegativedirection1 = 1;
4308   // j - etaphi index:
4309   TH1F* h2CeffHFnegativedirection1 = new TH1F("h2CeffHFnegativedirection1", "", maxbins, 1., maxbins + 1.);
4310   for (int jeta = 0; jeta < njeta; jeta++) {
4311     // negativedirection:
4312     if (jeta < 4) {
4313       // jphi = 0,1,2,3,4,5
4314       for (int jphi = 0; jphi < 6; jphi++) {
4315         //     for (int jphi=0;jphi<njphi;jphi++) {
4316         //       cout<<"HF 54 PLOTTING       jeta=     "<< jeta <<"   jphi   =     "<<jphi  <<endl;
4317         TH1F* HFnegativedirection1 = (TH1F*)h2CeffHFnegativedirection1->Clone("twod1");
4318         for (int i = 0; i < nx; i++) {
4319           double ccc1 = alexhf[jeta][jphi][i];
4320           if (ccc1 > 0.) {
4321             HFnegativedirection1->Fill(i, ccc1);
4322           }
4323           //           if( i == 0 ) cout<<"HF 54 PLOTTING  for LS=1      ccc1=     "<< ccc1 <<endl;
4324         }  // for i
4325         c1->cd(kcountHFnegativedirection1);
4326         HFnegativedirection1->SetMarkerStyle(20);
4327         HFnegativedirection1->SetMarkerSize(0.4);
4328         HFnegativedirection1->GetYaxis()->SetLabelSize(0.04);
4329         HFnegativedirection1->SetXTitle("HFnegativedirection1 \b");
4330         HFnegativedirection1->SetMarkerColor(2);
4331         HFnegativedirection1->SetLineColor(0);
4332         gPad->SetGridy();
4333         gPad->SetGridx();
4334         //     gPad->SetLogy();
4335         HFnegativedirection1->Draw("Error");
4336         kcountHFnegativedirection1++;
4337         if (kcountHFnegativedirection1 > 24)
4338           break;  // 4x6 = 24
4339       }           // for jphi
4340     }             //if
4341   }               //for jeta
4342   /////////////////
4343   c1->Update();
4344   ////////////////////////////////////////////////////////////////////////////////////
4345   //========================================================================================== 55   HF:: jeta = 0,1,2, 3            18,19,20,21       jphi = 6,7,8,9,10,11
4346   //======================================================================
4347   //======================================================================
4348   //======================================================================
4349   c1->Clear();
4350   /////////////////
4351   c1->Divide(4, 6);
4352   int kcountHFnegativedirection2 = 1;
4353   // j - etaphi index:
4354   TH1F* h2CeffHFnegativedirection2 = new TH1F("h2CeffHFnegativedirection2", "", maxbins, 1., maxbins + 1.);
4355   for (int jeta = 0; jeta < njeta; jeta++) {
4356     // negativedirection:
4357     if (jeta < 4) {
4358       // jphi = 6,7,8,9,10,11
4359       for (int jphi = 6; jphi < 12; jphi++) {
4360         //               cout<<"HF 55 PLOTTING       jeta=     "<< jeta <<"   jphi   =     "<<jphi  <<"   kcountHFnegativedirection2   =     "<<kcountHFnegativedirection2  <<endl;
4361         TH1F* HFnegativedirection2 = (TH1F*)h2CeffHFnegativedirection2->Clone("twod1");
4362         for (int i = 0; i < nx; i++) {
4363           double ccc1 = alexhf[jeta][jphi][i];
4364           if (ccc1 > 0.) {
4365             HFnegativedirection2->Fill(i, ccc1);
4366           }
4367           //                   if( i == 0 ) cout<<"HF 55 PLOTTING  for LS=1      ccc1=     "<< ccc1 <<endl;
4368         }  // for i
4369         c1->cd(kcountHFnegativedirection2);
4370         HFnegativedirection2->SetMarkerStyle(20);
4371         HFnegativedirection2->SetMarkerSize(0.4);
4372         HFnegativedirection2->GetYaxis()->SetLabelSize(0.04);
4373         HFnegativedirection2->SetXTitle("HFnegativedirection2 \b");
4374         HFnegativedirection2->SetMarkerColor(2);
4375         HFnegativedirection2->SetLineColor(0);
4376         gPad->SetGridy();
4377         gPad->SetGridx();
4378         //     gPad->SetLogy();
4379         HFnegativedirection2->Draw("Error");
4380         kcountHFnegativedirection2++;
4381         if (kcountHFnegativedirection2 > 24)
4382           break;  // 4x6 = 24
4383       }           // for jphi
4384     }             //if
4385   }               //for jeta
4386   /////////////////
4387   c1->Update();
4388   ////////////////////////////////////////////////////////////////////////////////////
4389   //========================================================================================== 56   HF:: jeta = 0,1,2, 3            18,19,20,21       jphi =12,13,14,15,16,17
4390   //======================================================================
4391   //======================================================================
4392   //======================================================================
4393   c1->Clear();
4394   /////////////////
4395   c1->Divide(4, 6);
4396   int kcountHFnegativedirection3 = 1;
4397   // j - etaphi index:
4398   TH1F* h2CeffHFnegativedirection3 = new TH1F("h2CeffHFnegativedirection3", "", maxbins, 1., maxbins + 1.);
4399   for (int jeta = 0; jeta < njeta; jeta++) {
4400     // negativedirection:
4401     if (jeta < 4) {
4402       // jphi = 12,13,14,15,16,17
4403       for (int jphi = 12; jphi < 18; jphi++) {
4404         //               cout<<"HF 55 PLOTTING       jeta=     "<< jeta <<"   jphi   =     "<<jphi  <<"   kcountHFnegativedirection3   =     "<<kcountHFnegativedirection3  <<endl;
4405         TH1F* HFnegativedirection3 = (TH1F*)h2CeffHFnegativedirection3->Clone("twod1");
4406         for (int i = 0; i < nx; i++) {
4407           double ccc1 = alexhf[jeta][jphi][i];
4408           if (ccc1 > 0.) {
4409             HFnegativedirection3->Fill(i, ccc1);
4410           }
4411           //                   if( i == 0 ) cout<<"HF 55 PLOTTING  for LS=1      ccc1=     "<< ccc1 <<endl;
4412         }  // for i
4413         c1->cd(kcountHFnegativedirection3);
4414         HFnegativedirection3->SetMarkerStyle(20);
4415         HFnegativedirection3->SetMarkerSize(0.4);
4416         HFnegativedirection3->GetYaxis()->SetLabelSize(0.04);
4417         HFnegativedirection3->SetXTitle("HFnegativedirection3 \b");
4418         HFnegativedirection3->SetMarkerColor(2);
4419         HFnegativedirection3->SetLineColor(0);
4420         gPad->SetGridy();
4421         gPad->SetGridx();
4422         //     gPad->SetLogy();
4423         HFnegativedirection3->Draw("Error");
4424         kcountHFnegativedirection3++;
4425         if (kcountHFnegativedirection3 > 24)
4426           break;  // 4x6 = 24
4427       }           // for jphi
4428     }             //if
4429   }               //for jeta
4430   /////////////////
4431   c1->Update();
4432   ////////////////////////////////////////////////////////////////////////////////////
4433   //========================================================================================== 57   HF:: jeta = 0,1,2, 3            18,19,20,21       // jphi = 0,1,2,3,4,5
4434   //======================================================================
4435   //======================================================================
4436   //======================================================================
4437   c1->Clear();
4438   /////////////////
4439   c1->Divide(4, 6);
4440   int kcountHFpositivedirection1 = 1;
4441   // j - etaphi index:
4442   TH1F* h2CeffHFpositivedirection1 = new TH1F("h2CeffHFpositivedirection1", "", maxbins, 1., maxbins + 1.);
4443   for (int jeta = 0; jeta < njeta; jeta++) {
4444     // positivedirection:
4445     if (jeta > 17) {
4446       // jphi = 0,1,2,3,4,5
4447       for (int jphi = 0; jphi < 6; jphi++) {
4448         //     for (int jphi=0;jphi<njphi;jphi++) {
4449         //       cout<<"HF 54 PLOTTING       jeta=     "<< jeta <<"   jphi   =     "<<jphi  <<endl;
4450         TH1F* HFpositivedirection1 = (TH1F*)h2CeffHFpositivedirection1->Clone("twod1");
4451         for (int i = 0; i < nx; i++) {
4452           double ccc1 = alexhf[jeta][jphi][i];
4453           if (ccc1 > 0.) {
4454             HFpositivedirection1->Fill(i, ccc1);
4455           }
4456           //           if( i == 0 ) cout<<"HF 54 PLOTTING  for LS=1      ccc1=     "<< ccc1 <<endl;
4457         }  // for i
4458         c1->cd(kcountHFpositivedirection1);
4459         HFpositivedirection1->SetMarkerStyle(20);
4460         HFpositivedirection1->SetMarkerSize(0.4);
4461         HFpositivedirection1->GetYaxis()->SetLabelSize(0.04);
4462         HFpositivedirection1->SetXTitle("HFpositivedirection1 \b");
4463         HFpositivedirection1->SetMarkerColor(2);
4464         HFpositivedirection1->SetLineColor(0);
4465         gPad->SetGridy();
4466         gPad->SetGridx();
4467         //     gPad->SetLogy();
4468         HFpositivedirection1->Draw("Error");
4469         kcountHFpositivedirection1++;
4470         if (kcountHFpositivedirection1 > 24)
4471           break;  // 4x6 = 24
4472       }           // for jphi
4473     }             //if
4474   }               //for jeta
4475   /////////////////
4476   c1->Update();
4477   ////////////////////////////////////////////////////////////////////////////////////
4478   //========================================================================================== 58   HF:: jeta = 0,1,2, 3            18,19,20,21       jphi = 6,7,8,9,10,11
4479   //======================================================================
4480   //======================================================================
4481   //======================================================================
4482   c1->Clear();
4483   /////////////////
4484   c1->Divide(4, 6);
4485   int kcountHFpositivedirection2 = 1;
4486   // j - etaphi index:
4487   TH1F* h2CeffHFpositivedirection2 = new TH1F("h2CeffHFpositivedirection2", "", maxbins, 1., maxbins + 1.);
4488   for (int jeta = 0; jeta < njeta; jeta++) {
4489     // positivedirection:
4490     if (jeta > 17) {
4491       // jphi = 6,7,8,9,10,11
4492       for (int jphi = 6; jphi < 12; jphi++) {
4493         //               cout<<"HF 55 PLOTTING       jeta=     "<< jeta <<"   jphi   =     "<<jphi  <<"   kcountHFpositivedirection2   =     "<<kcountHFpositivedirection2  <<endl;
4494         TH1F* HFpositivedirection2 = (TH1F*)h2CeffHFpositivedirection2->Clone("twod1");
4495         for (int i = 0; i < nx; i++) {
4496           double ccc1 = alexhf[jeta][jphi][i];
4497           if (ccc1 > 0.) {
4498             HFpositivedirection2->Fill(i, ccc1);
4499           }
4500           //                   if( i == 0 ) cout<<"HF 55 PLOTTING  for LS=1      ccc1=     "<< ccc1 <<endl;
4501         }  // for i
4502         c1->cd(kcountHFpositivedirection2);
4503         HFpositivedirection2->SetMarkerStyle(20);
4504         HFpositivedirection2->SetMarkerSize(0.4);
4505         HFpositivedirection2->GetYaxis()->SetLabelSize(0.04);
4506         HFpositivedirection2->SetXTitle("HFpositivedirection2 \b");
4507         HFpositivedirection2->SetMarkerColor(2);
4508         HFpositivedirection2->SetLineColor(0);
4509         gPad->SetGridy();
4510         gPad->SetGridx();
4511         //     gPad->SetLogy();
4512         HFpositivedirection2->Draw("Error");
4513         kcountHFpositivedirection2++;
4514         if (kcountHFpositivedirection2 > 24)
4515           break;  // 4x6 = 24
4516       }           // for jphi
4517     }             //if
4518   }               //for jeta
4519   /////////////////
4520   c1->Update();
4521   ////////////////////////////////////////////////////////////////////////////////////
4522   //========================================================================================== 59   HF:: jeta = 0,1,2, 3            18,19,20,21       jphi =12,13,14,15,16,17
4523   //======================================================================
4524   //======================================================================
4525   //======================================================================
4526   c1->Clear();
4527   /////////////////
4528   c1->Divide(4, 6);
4529   int kcountHFpositivedirection3 = 1;
4530   // j - etaphi index:
4531   TH1F* h2CeffHFpositivedirection3 =
4532       new TH1F("h2CeffHFpositivedirection3", "", maxbins, 1., maxbins + 1.);  //  h2CeffHFpositivedirection3->Sumw2();
4533   for (int jphi = 12; jphi < 18; jphi++) {
4534     for (int jeta = 18; jeta < 22; jeta++) {
4535       //                 cout<<"HF 55 PLOTTING       jeta=     "<< jeta <<"   jphi   =     "<<jphi  <<"   kcountHFpositivedirection3   =     "<<kcountHFpositivedirection3  <<endl;
4536       TH1F* HFpositivedirection3 = (TH1F*)h2CeffHFpositivedirection3->Clone("twod1");
4537       for (int i = 0; i < nx; i++) {
4538         double ccc1 = alexhf[jeta][jphi][i];
4539         //      if(ccc1 <= 0.)              cout<<"59  HF:  ibin=  "<< i <<"      jphi= "<< jphi <<"      jeta= "<< jeta <<"      A= "<< ccc1 <<endl;
4540 
4541         if (ccc1 > 0.) {
4542           HFpositivedirection3->Fill(i, ccc1);
4543           HFpositivedirection3->SetBinError(i, 0.01);
4544         }
4545         //         if(ccc1>0.) {HFpositivedirection3->AddBinContent(int(HFpositivedirection3->FindBin(i)), ccc1);HFpositivedirection3->SetBinError(i,0.);}
4546 
4547         //                 if( i == 0 ) cout<<"HF 55 PLOTTING  for LS=1      ccc1=     "<< ccc1 <<endl;
4548       }  // for i
4549       c1->cd(kcountHFpositivedirection3);
4550       HFpositivedirection3->SetMarkerStyle(20);
4551       HFpositivedirection3->SetMarkerSize(0.4);
4552       HFpositivedirection3->GetYaxis()->SetLabelSize(0.04);
4553       HFpositivedirection3->SetXTitle("HFpositivedirection3 \b");
4554       HFpositivedirection3->SetMarkerColor(2);
4555       HFpositivedirection3->SetLineColor(0);
4556       gPad->SetGridy();
4557       gPad->SetGridx();
4558       //       gPad->SetLogy();
4559       if (kcountHFpositivedirection3 == 1)
4560         HFpositivedirection3->SetXTitle("HF jeta = 18; jphi = 12 \b");
4561       if (kcountHFpositivedirection3 == 5)
4562         HFpositivedirection3->SetXTitle("HF jeta = 18; jphi = 13 \b");
4563       if (kcountHFpositivedirection3 == 9)
4564         HFpositivedirection3->SetXTitle("HF jeta = 18; jphi = 14 \b");
4565       if (kcountHFpositivedirection3 == 13)
4566         HFpositivedirection3->SetXTitle("HF jeta = 18; jphi = 15 \b");
4567       if (kcountHFpositivedirection3 == 17)
4568         HFpositivedirection3->SetXTitle("HF jeta = 18; jphi = 16 \b");
4569       if (kcountHFpositivedirection3 == 21)
4570         HFpositivedirection3->SetXTitle("HF jeta = 18; jphi = 17 \b");
4571 
4572       if (kcountHFpositivedirection3 == 2)
4573         HFpositivedirection3->SetXTitle("HF jeta = 19; jphi = 12 \b");
4574       if (kcountHFpositivedirection3 == 6)
4575         HFpositivedirection3->SetXTitle("HF jeta = 19; jphi = 13 \b");
4576       if (kcountHFpositivedirection3 == 10)
4577         HFpositivedirection3->SetXTitle("HF jeta = 19; jphi = 14 \b");
4578       if (kcountHFpositivedirection3 == 14)
4579         HFpositivedirection3->SetXTitle("HF jeta = 19; jphi = 15 \b");
4580       if (kcountHFpositivedirection3 == 18)
4581         HFpositivedirection3->SetXTitle("HF jeta = 19; jphi = 16 \b");
4582       if (kcountHFpositivedirection3 == 22)
4583         HFpositivedirection3->SetXTitle("HF jeta = 19; jphi = 17 \b");
4584 
4585       if (kcountHFpositivedirection3 == 3)
4586         HFpositivedirection3->SetXTitle("HF jeta = 20; jphi = 12 \b");
4587       if (kcountHFpositivedirection3 == 7)
4588         HFpositivedirection3->SetXTitle("HF jeta = 20; jphi = 13 \b");
4589       if (kcountHFpositivedirection3 == 11)
4590         HFpositivedirection3->SetXTitle("HF jeta = 20; jphi = 14 \b");
4591       if (kcountHFpositivedirection3 == 15)
4592         HFpositivedirection3->SetXTitle("HF jeta = 20; jphi = 15 \b");
4593       if (kcountHFpositivedirection3 == 19)
4594         HFpositivedirection3->SetXTitle("HF jeta = 20; jphi = 16 \b");
4595       if (kcountHFpositivedirection3 == 23)
4596         HFpositivedirection3->SetXTitle("HF jeta = 20; jphi = 17 \b");
4597 
4598       if (kcountHFpositivedirection3 == 4)
4599         HFpositivedirection3->SetXTitle("HF jeta = 21; jphi = 12 \b");
4600       if (kcountHFpositivedirection3 == 8)
4601         HFpositivedirection3->SetXTitle("HF jeta = 21; jphi = 13 \b");
4602       if (kcountHFpositivedirection3 == 12)
4603         HFpositivedirection3->SetXTitle("HF jeta = 21; jphi = 14 \b");
4604       if (kcountHFpositivedirection3 == 16)
4605         HFpositivedirection3->SetXTitle("HF jeta = 21; jphi = 15 \b");
4606       if (kcountHFpositivedirection3 == 20)
4607         HFpositivedirection3->SetXTitle("HF jeta = 21; jphi = 16 \b");
4608       if (kcountHFpositivedirection3 == 24)
4609         HFpositivedirection3->SetXTitle("HF jeta = 21; jphi = 17 \b");
4610 
4611       HFpositivedirection3->Draw("Error");
4612 
4613       //int bin = HFpositivedirection3->FindBin(i);         //OPTION C This works fine.
4614       //HFpositivedirection3->AddBinContent(bin, ccc1);
4615       //HFpositivedirection3->AddBinContent(int(HFpositivedirection3->FindBin(i)), ccc1);
4616 
4617       //             HFpositivedirection3->Draw("HIST");
4618 
4619       kcountHFpositivedirection3++;
4620       if (kcountHFpositivedirection3 > 24)
4621         break;  // 4x6 = 24
4622     }           // for jphi
4623   }             //for jeta
4624                 /////////////////
4625   if (h2CeffHFpositivedirection3)
4626     delete h2CeffHFpositivedirection3;
4627   c1->Update();
4628   //////////////////////////////////////////////////////////////////////////////////// Gefz1
4629 
4630   ////////////////////////////////////////////////////////////////////////////////////
4631   //========================================================================================== 60   HF:: 2D  jeta = 0 - 21       jphi =0 - 17
4632   //======================================================================
4633   //======================================================================
4634   //======================================================================
4635   //======================================================================
4636   c1->Clear();
4637   /////////////////
4638   c1->Divide(1, 1);
4639   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4640   c1->cd(1);
4641   // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ;  k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
4642   TH2F* Gefz42D = new TH2F("Gefz42D", "", 23, -11.5, 11.5, 18, 0., 18.);
4643   TH2F* Gefz42D0 = new TH2F("Gefz42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
4644   //     TH2F* Gefz42D      = new TH2F("Gefz42D","",   22, -11., 11., 18, 0., 18. );
4645   //     TH2F* Gefz42D0     = new TH2F("Gefz42D0","",  22, -11., 11., 18, 0., 18. );
4646   //      TH2F* Gefz42D      = new TH2F("Gefz42D","",   24, -12., 12., 18, 0., 18. );
4647   //     TH2F* Gefz42D0     = new TH2F("Gefz42D0","",  24, -12., 12., 18, 0., 18. );
4648   TH2F* Gefz42DF = (TH2F*)Gefz42D0->Clone("Gefz42DF");
4649   for (int jphi = 0; jphi < 18; jphi++) {
4650     for (int jeta = 0; jeta < 22; jeta++) {
4651       for (int i = 0; i < nx; i++) {
4652         double ccc1 = alexhf[jeta][jphi][i];
4653         int neweta = jeta - 11 - 0.5;
4654         if (jeta >= 11)
4655           neweta = jeta - 11 + 1.5;
4656         if (ccc1 > 0.) {
4657           Gefz42D->Fill(neweta, jphi, ccc1);
4658           Gefz42D0->Fill(neweta, jphi, 1.);
4659         }
4660       }
4661     }
4662   }
4663   Gefz42DF->Divide(Gefz42D, Gefz42D0, 1, 1, "B");  // average A
4664   //    Gefz1->Sumw2();
4665   gPad->SetGridy();
4666   gPad->SetGridx();  //      gPad->SetLogz();
4667   Gefz42DF->SetMarkerStyle(20);
4668   Gefz42DF->SetMarkerSize(0.4);
4669   Gefz42DF->GetZaxis()->SetLabelSize(0.08);
4670   Gefz42DF->SetXTitle("<A>_RBX         #eta  \b");
4671   Gefz42DF->SetYTitle("      #phi \b");
4672   Gefz42DF->SetZTitle("<A>_RBX  - All \b");
4673   Gefz42DF->SetMarkerColor(2);
4674   Gefz42DF->SetLineColor(0);  //      Gefz42DF->SetMaximum(1.000);  //      Gefz42DF->SetMinimum(1.0);
4675   Gefz42DF->Draw("COLZ");
4676 
4677   c1->Update();
4678 
4679   //======================================================================
4680   //========================================================================================== 61   HF:: 2D  jeta = 0 - 21       jphi =0 - 17
4681   //======================================================================
4682   //======================================================================
4683   //======================================================================
4684   //======================================================================
4685   c1->Clear();
4686   /////////////////
4687   c1->Divide(1, 1);
4688   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4689   c1->cd(1);
4690   // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ;  k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
4691 
4692   TH1F* Gefz41D = new TH1F("Gefz41D", "", 18, 0., 18.);
4693   TH1F* Gefz41D0 = new TH1F("Gefz41D0", "", 18, 0., 18.);
4694   TH1F* Gefz41DF = (TH1F*)Gefz41D0->Clone("Gefz41DF");
4695   for (int jphi = 0; jphi < 18; jphi++) {
4696     for (int jeta = 0; jeta < 22; jeta++) {
4697       for (int i = 0; i < nx; i++) {
4698         double ccc1 = alexhf[jeta][jphi][i];
4699         if (ccc1 > 0.) {
4700           Gefz41D->Fill(jphi, ccc1);
4701           Gefz41D0->Fill(jphi, 1.);
4702         }
4703       }
4704     }
4705   }
4706   //     Gefz41D->Sumw2();Gefz41D0->Sumw2();
4707   Gefz41DF->Divide(Gefz41D, Gefz41D0, 1, 1, "B");  // average A
4708                                                    //     Gefz41DF->Sumw2();
4709   for (int jphi = 1; jphi < 19; jphi++) {
4710     Gefz41DF->SetBinError(jphi, 0.01);
4711   }
4712   gPad->SetGridy();
4713   gPad->SetGridx();  //      gPad->SetLogz();
4714   Gefz41DF->SetMarkerStyle(20);
4715   Gefz41DF->SetMarkerSize(1.4);
4716   Gefz41DF->GetZaxis()->SetLabelSize(0.08);
4717   Gefz41DF->SetXTitle("#phi  \b");
4718   Gefz41DF->SetYTitle("  <A> \b");
4719   Gefz41DF->SetZTitle("<A>_PHI  - All \b");
4720   Gefz41DF->SetMarkerColor(4);
4721   Gefz41DF->SetLineColor(4);
4722   Gefz41DF->SetMinimum(0.8);  //      Gefz41DF->SetMaximum(1.000);
4723   Gefz41DF->Draw("Error");
4724 
4725   c1->Update();
4726 
4727   //======================================================================
4728   //======================================================================
4729   //========================================================================================== 62   HF:: 2D  jeta = 0 - 21       jphi =0 - 17
4730   //======================================================================
4731   //======================================================================
4732   //======================================================================
4733   //======================================================================
4734   c1->Clear();
4735   /////////////////
4736   c1->Divide(1, 1);
4737   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4738   c1->cd(1);
4739   // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ;  k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
4740   // jeta = 0 - 21       jphi = 0 - 17
4741   TH1F* Gjeta41D = new TH1F("Gjeta41D", "", 23, -11.5, 11.5);
4742   TH1F* Gjeta41D0 = new TH1F("Gjeta41D0", "", 23, -11.5, 11.5);
4743   TH1F* Gjeta41DF = (TH1F*)Gjeta41D0->Clone("Gjeta41DF");
4744 
4745   for (int jeta = 0; jeta < 22; jeta++) {
4746     for (int jphi = 0; jphi < 18; jphi++) {
4747       for (int i = 0; i < nx; i++) {
4748         double ccc1 = alexhf[jeta][jphi][i];
4749         int neweta = jeta - 11 - 0.5;
4750         if (jeta >= 11)
4751           neweta = jeta - 11 + 1.5;
4752         if (ccc1 > 0.) {
4753           Gjeta41D->Fill(neweta, ccc1);
4754           Gjeta41D0->Fill(neweta, 1.);
4755           //           if( i == 0 ) cout<<"62  HF:  ibin=  "<< i <<"      jphi= "<< jphi <<"      jeta= "<< jeta <<"      A= "<< ccc1 <<endl;
4756         }
4757       }
4758     }
4759   }
4760   //     Gjeta41D->Sumw2();Gjeta41D0->Sumw2();
4761   Gjeta41DF->Divide(Gjeta41D, Gjeta41D0, 1, 1, "B");  // average A
4762                                                       //     Gjeta41DF->Sumw2();
4763   for (int jeta = 1; jeta < 24; jeta++) {
4764     Gjeta41DF->SetBinError(jeta, 0.01);
4765   }
4766   gPad->SetGridy();
4767   gPad->SetGridx();  //      gPad->SetLogz();
4768   Gjeta41DF->SetMarkerStyle(20);
4769   Gjeta41DF->SetMarkerSize(1.4);
4770   Gjeta41DF->GetZaxis()->SetLabelSize(0.08);
4771   Gjeta41DF->SetXTitle("#eta  \b");
4772   Gjeta41DF->SetYTitle("  <A> \b");
4773   Gjeta41DF->SetZTitle("<A>_ETA  - All \b");
4774   Gjeta41DF->SetMarkerColor(4);
4775   Gjeta41DF->SetLineColor(4);
4776   Gjeta41DF->SetMinimum(0.8);  //      Gjeta41DF->SetMaximum(1.000);
4777   Gjeta41DF->Draw("Error");
4778 
4779   c1->Update();
4780 
4781   //======================================================================
4782   //======================================================================
4783   //======================================================================
4784   ////////////////////////////////////////////////////////////////////////////////////
4785   ////////////////////////////////////////////////////////////////////////////////////
4786   ////////////////////////////////////////////////////////////////////////////////////
4787   ////////////////////////////////////////////////////////////////////////////////////
4788   ////////////////////////////////////////////////////////////////////////////////////
4789   ////////////////////////////////////////////////////////////////////////////////////
4790   //======================================================================
4791   //======================================================================
4792   //==================================================================================================== end
4793   //======================================================================
4794   //======================================================================
4795   // close and delete all possible things:
4796 
4797   //   psfile->Close();
4798   psfile.Close();
4799 
4800   hfile1->Close();
4801   //    hfile1->Delete();
4802   hfile1->Close();
4803   //    hfile1->Delete();
4804 
4805   //  Exit Root
4806   gSystem->Exit(0);
4807   //======================================================================
4808 }