Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:41:11

0001 // -*- C++ -*-
0002 //
0003 // Package:    CMTRawAnalyzer
0004 //
0005 #include <fstream>
0006 #include <iostream>
0007 #include <cmath>
0008 #include <iosfwd>
0009 #include <bitset>
0010 #include <memory>
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "FWCore/ServiceRegistry/interface/Service.h"
0013 #include "FWCore/PluginManager/interface/ModuleDef.h"
0014 #include "FWCore/Framework/interface/Frameworkfwd.h"
0015 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/Framework/interface/MakerMacros.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0019 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0020 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0021 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0022 #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
0023 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0024 #include "DataFormats/HcalDigi/interface/HcalQIESample.h"
0025 #include "DataFormats/HcalDetId/interface/HcalCalibDetId.h"
0026 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0027 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0028 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
0029 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
0030 #include "DataFormats/HcalDigi/interface/HODataFrame.h"
0031 #include "DataFormats/HcalDigi/interface/QIE10DataFrame.h"
0032 #include "DataFormats/HcalDigi/interface/QIE11DataFrame.h"
0033 #include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h"
0034 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0035 #include "CalibCalorimetry/HcalAlgos/interface/HcalLogicalMapGenerator.h"
0036 #include "CondFormats/HcalObjects/interface/HcalLogicalMap.h"
0037 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
0038 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
0039 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
0040 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
0041 #include "CondFormats/HcalObjects/interface/HcalQIECoder.h"
0042 #include "CondFormats/HcalObjects/interface/HcalQIEShape.h"
0043 #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h"
0044 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
0045 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
0046 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0047 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
0048 #include "DataFormats/FEDRawData/interface/FEDTrailer.h"
0049 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0050 #include "Geometry/Records/interface/HcalGeometryRecord.h"
0051 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0052 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0053 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0054 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0055 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0056 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0057 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0058 #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
0059 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0060 #include "TFile.h"
0061 #include "TTree.h"
0062 #include "TH1.h"
0063 #include "TH2.h"
0064 #include "TF1.h"
0065 
0066 #define NUMADCS 256
0067 double const adc2fC_QIE10[NUMADCS] = {
0068     //subrange0
0069     1.58,
0070     4.73,
0071     7.88,
0072     11.0,
0073     14.2,
0074     17.3,
0075     20.5,
0076     23.6,
0077     26.8,
0078     29.9,
0079     33.1,
0080     36.2,
0081     39.4,
0082     42.5,
0083     45.7,
0084     48.8,
0085     //subrange1
0086     53.6,
0087     60.1,
0088     66.6,
0089     73.0,
0090     79.5,
0091     86.0,
0092     92.5,
0093     98.9,
0094     105,
0095     112,
0096     118,
0097     125,
0098     131,
0099     138,
0100     144,
0101     151,
0102     //subrange2
0103     157,
0104     164,
0105     170,
0106     177,
0107     186,
0108     199,
0109     212,
0110     225,
0111     238,
0112     251,
0113     264,
0114     277,
0115     289,
0116     302,
0117     315,
0118     328,
0119     //subrange3
0120     341,
0121     354,
0122     367,
0123     380,
0124     393,
0125     406,
0126     418,
0127     431,
0128     444,
0129     464,
0130     490,
0131     516,
0132     542,
0133     568,
0134     594,
0135     620,
0136 
0137     // - - - - - - - range 1 - - - - - - - -
0138     //subrange0
0139     569,
0140     594,
0141     619,
0142     645,
0143     670,
0144     695,
0145     720,
0146     745,
0147     771,
0148     796,
0149     821,
0150     846,
0151     871,
0152     897,
0153     922,
0154     947,
0155     //subrange1
0156     960,
0157     1010,
0158     1060,
0159     1120,
0160     1170,
0161     1220,
0162     1270,
0163     1320,
0164     1370,
0165     1430,
0166     1480,
0167     1530,
0168     1580,
0169     1630,
0170     1690,
0171     1740,
0172     //subrange2
0173     1790,
0174     1840,
0175     1890,
0176     1940,
0177     2020,
0178     2120,
0179     2230,
0180     2330,
0181     2430,
0182     2540,
0183     2640,
0184     2740,
0185     2850,
0186     2950,
0187     3050,
0188     3150,
0189     //subrange3
0190     3260,
0191     3360,
0192     3460,
0193     3570,
0194     3670,
0195     3770,
0196     3880,
0197     3980,
0198     4080,
0199     4240,
0200     4450,
0201     4650,
0202     4860,
0203     5070,
0204     5280,
0205     5490,
0206 
0207     // - - - - - - - range 2 - - - - - - - -
0208     //subrange0
0209     5080,
0210     5280,
0211     5480,
0212     5680,
0213     5880,
0214     6080,
0215     6280,
0216     6480,
0217     6680,
0218     6890,
0219     7090,
0220     7290,
0221     7490,
0222     7690,
0223     7890,
0224     8090,
0225     //subrange1
0226     8400,
0227     8810,
0228     9220,
0229     9630,
0230     10000,
0231     10400,
0232     10900,
0233     11300,
0234     11700,
0235     12100,
0236     12500,
0237     12900,
0238     13300,
0239     13700,
0240     14100,
0241     14500,
0242     //subrange2
0243     15000,
0244     15400,
0245     15800,
0246     16200,
0247     16800,
0248     17600,
0249     18400,
0250     19300,
0251     20100,
0252     20900,
0253     21700,
0254     22500,
0255     23400,
0256     24200,
0257     25000,
0258     25800,
0259     //subrange3
0260     26600,
0261     27500,
0262     28300,
0263     29100,
0264     29900,
0265     30700,
0266     31600,
0267     32400,
0268     33200,
0269     34400,
0270     36100,
0271     37700,
0272     39400,
0273     41000,
0274     42700,
0275     44300,
0276 
0277     // - - - - - - - range 3 - - - - - - - - -
0278     //subrange0
0279     41100,
0280     42700,
0281     44300,
0282     45900,
0283     47600,
0284     49200,
0285     50800,
0286     52500,
0287     54100,
0288     55700,
0289     57400,
0290     59000,
0291     60600,
0292     62200,
0293     63900,
0294     65500,
0295     //subrange1
0296     68000,
0297     71300,
0298     74700,
0299     78000,
0300     81400,
0301     84700,
0302     88000,
0303     91400,
0304     94700,
0305     98100,
0306     101000,
0307     105000,
0308     108000,
0309     111000,
0310     115000,
0311     118000,
0312     //subrange2
0313     121000,
0314     125000,
0315     128000,
0316     131000,
0317     137000,
0318     145000,
0319     152000,
0320     160000,
0321     168000,
0322     176000,
0323     183000,
0324     191000,
0325     199000,
0326     206000,
0327     214000,
0328     222000,
0329     //subrange3
0330     230000,
0331     237000,
0332     245000,
0333     253000,
0334     261000,
0335     268000,
0336     276000,
0337     284000,
0338     291000,
0339     302000,
0340     316000,
0341     329000,
0342     343000,
0343     356000,
0344     370000,
0345     384000
0346 
0347 };
0348 
0349 //shunt1
0350 double const adc2fC_QIE11_shunt1[NUMADCS] = {
0351     1.89,     5.07,     8.25,     11.43,    14.61,    17.78,    20.96,    24.14,    27.32,    30.50,    33.68,
0352     36.86,    40.04,    43.22,    46.40,    49.58,    54.35,    60.71,    67.07,    73.43,    79.79,    86.15,
0353     92.51,    98.87,    105.2,    111.6,    117.9,    124.3,    130.7,    137.0,    143.4,    149.7,    156.1,
0354     162.5,    168.8,    175.2,    184.7,    197.4,    210.2,    222.9,    235.6,    248.3,    261.0,    273.7,
0355     286.5,    299.2,    311.9,    324.6,    337.3,    350.1,    362.8,    375.5,    388.2,    400.9,    413.6,
0356     426.4,    439.1,    458.2,    483.6,    509.0,    534.5,    559.9,    585.3,    610.8,    558.9,    584.2,
0357     609.5,    634.7,    660.0,    685.3,    710.6,    735.9,    761.2,    786.5,    811.8,    837.1,    862.4,
0358     887.7,    913.0,    938.3,    976.2,    1026.8,   1077.4,   1128.0,   1178.6,   1229.1,   1279.7,   1330.3,
0359     1380.9,   1431.5,   1482.1,   1532.7,   1583.3,   1633.8,   1684.4,   1735.0,   1785.6,   1836.2,   1886.8,
0360     1937.4,   2013.2,   2114.4,   2215.6,   2316.8,   2417.9,   2519.1,   2620.3,   2721.5,   2822.6,   2923.8,
0361     3025.0,   3126.2,   3227.3,   3328.5,   3429.7,   3530.9,   3632.0,   3733.2,   3834.4,   3935.5,   4036.7,
0362     4188.5,   4390.8,   4593.2,   4795.5,   4997.9,   5200.2,   5402.6,   5057.5,   5262.3,   5467.1,   5671.8,
0363     5876.6,   6081.4,   6286.2,   6491.0,   6695.8,   6900.6,   7105.3,   7310.1,   7514.9,   7719.7,   7924.5,
0364     8129.3,   8436.4,   8846.0,   9255.6,   9665.1,   10074.7,  10484.3,  10893.9,  11303.4,  11713.0,  12122.6,
0365     12532.1,  12941.7,  13351.3,  13760.8,  14170.4,  14580.0,  14989.5,  15399.1,  15808.7,  16218.2,  16832.6,
0366     17651.7,  18470.9,  19290.0,  20109.2,  20928.3,  21747.4,  22566.6,  23385.7,  24204.8,  25024.0,  25843.1,
0367     26662.3,  27481.4,  28300.5,  29119.7,  29938.8,  30757.9,  31577.1,  32396.2,  33215.4,  34444.1,  36082.3,
0368     37720.6,  39358.9,  40997.2,  42635.4,  44273.7,  40908.7,  42542.6,  44176.5,  45810.4,  47444.3,  49078.3,
0369     50712.2,  52346.1,  53980.0,  55613.9,  57247.8,  58881.8,  60515.7,  62149.6,  63783.5,  65417.4,  67868.3,
0370     71136.1,  74404.0,  77671.8,  80939.7,  84207.5,  87475.3,  90743.2,  94011.0,  97278.8,  100546.7, 103814.5,
0371     107082.3, 110350.2, 113618.0, 116885.8, 120153.7, 123421.5, 126689.3, 129957.2, 134858.9, 141394.6, 147930.3,
0372     154465.9, 161001.6, 167537.3, 174072.9, 180608.6, 187144.3, 193679.9, 200215.6, 206751.3, 213287.0, 219822.6,
0373     226358.3, 232894.0, 239429.6, 245965.3, 252501.0, 259036.6, 265572.3, 275375.8, 288447.2, 301518.5, 314589.8,
0374     327661.2, 340732.5, 353803.8};
0375 //shunt6
0376 double const adc2fC_QIE11_shunt6[NUMADCS] = {
0377     9.56,      28.24,     46.91,     65.59,     84.27,     102.9,     121.6,     140.3,     159.0,     177.7,
0378     196.3,     215.0,     233.7,     252.4,     271.0,     289.7,     317.7,     355.1,     392.4,     429.8,
0379     467.1,     504.5,     541.9,     579.2,     616.6,     653.9,     691.3,     728.6,     766.0,     803.3,
0380     840.7,     878.0,     915.4,     952.8,     990.1,     1027.5,    1083.5,    1158.2,    1232.9,    1307.6,
0381     1382.3,    1457.0,    1531.7,    1606.4,    1681.2,    1755.9,    1830.6,    1905.3,    1980.0,    2054.7,
0382     2129.4,    2204.1,    2278.8,    2353.5,    2428.2,    2502.9,    2577.7,    2689.7,    2839.1,    2988.6,
0383     3138.0,    3287.4,    3436.8,    3586.2,    3263.0,    3411.3,    3559.6,    3707.9,    3856.2,    4004.5,
0384     4152.9,    4301.2,    4449.5,    4597.8,    4746.1,    4894.4,    5042.7,    5191.0,    5339.4,    5487.7,
0385     5710.1,    6006.8,    6303.4,    6600.0,    6896.6,    7193.3,    7489.9,    7786.5,    8083.1,    8379.8,
0386     8676.4,    8973.0,    9269.6,    9566.3,    9862.9,    10159.5,   10456.2,   10752.8,   11049.4,   11346.0,
0387     11791.0,   12384.2,   12977.5,   13570.7,   14164.0,   14757.2,   15350.5,   15943.7,   16537.0,   17130.2,
0388     17723.5,   18316.7,   18910.0,   19503.2,   20096.5,   20689.7,   21283.0,   21876.2,   22469.5,   23062.8,
0389     23656.0,   24545.9,   25732.4,   26918.9,   28105.4,   29291.9,   30478.4,   31664.9,   29399.4,   30590.1,
0390     31780.9,   32971.7,   34162.4,   35353.2,   36544.0,   37734.7,   38925.5,   40116.3,   41307.0,   42497.8,
0391     43688.5,   44879.3,   46070.1,   47260.8,   49047.0,   51428.5,   53810.1,   56191.6,   58573.1,   60954.6,
0392     63336.2,   65717.7,   68099.2,   70480.8,   72862.3,   75243.8,   77625.4,   80006.9,   82388.4,   84769.9,
0393     87151.5,   89533.0,   91914.5,   94296.1,   97868.4,   102631.4,  107394.5,  112157.5,  116920.6,  121683.7,
0394     126446.7,  131209.8,  135972.8,  140735.9,  145499.0,  150262.0,  155025.1,  159788.2,  164551.2,  169314.3,
0395     174077.3,  178840.4,  183603.5,  188366.5,  193129.6,  200274.2,  209800.3,  219326.4,  228852.5,  238378.7,
0396     247904.8,  257430.9,  237822.7,  247326.7,  256830.7,  266334.8,  275838.8,  285342.9,  294846.9,  304351.0,
0397     313855.0,  323359.1,  332863.1,  342367.1,  351871.2,  361375.2,  370879.3,  380383.3,  394639.4,  413647.5,
0398     432655.6,  451663.6,  470671.7,  489679.8,  508687.9,  527696.0,  546704.1,  565712.2,  584720.3,  603728.3,
0399     622736.4,  641744.5,  660752.6,  679760.7,  698768.8,  717776.9,  736785.0,  755793.0,  784305.2,  822321.3,
0400     860337.5,  898353.7,  936369.9,  974386.0,  1012402.2, 1050418.4, 1088434.6, 1126450.7, 1164466.9, 1202483.1,
0401     1240499.3, 1278515.4, 1316531.6, 1354547.8, 1392564.0, 1430580.1, 1468596.3, 1506612.5, 1544628.7, 1601652.9,
0402     1677685.3, 1753717.6, 1829750.0, 1905782.3, 1981814.7, 2057847.0};
0403 // for HPD:
0404 static const float adc2fC[128] = {
0405     -0.5,   0.5,    1.5,    2.5,    3.5,    4.5,    5.5,    6.5,    7.5,    8.5,    9.5,    10.5,   11.5,
0406     12.5,   13.5,   15.,    17.,    19.,    21.,    23.,    25.,    27.,    29.5,   32.5,   35.5,   38.5,
0407     42.,    46.,    50.,    54.5,   59.5,   64.5,   59.5,   64.5,   69.5,   74.5,   79.5,   84.5,   89.5,
0408     94.5,   99.5,   104.5,  109.5,  114.5,  119.5,  124.5,  129.5,  137.,   147.,   157.,   167.,   177.,
0409     187.,   197.,   209.5,  224.5,  239.5,  254.5,  272.,   292.,   312.,   334.5,  359.5,  384.5,  359.5,
0410     384.5,  409.5,  434.5,  459.5,  484.5,  509.5,  534.5,  559.5,  584.5,  609.5,  634.5,  659.5,  684.5,
0411     709.5,  747.,   797.,   847.,   897.,   947.,   997.,   1047.,  1109.5, 1184.5, 1259.5, 1334.5, 1422.,
0412     1522.,  1622.,  1734.5, 1859.5, 1984.5, 1859.5, 1984.5, 2109.5, 2234.5, 2359.5, 2484.5, 2609.5, 2734.5,
0413     2859.5, 2984.5, 3109.5, 3234.5, 3359.5, 3484.5, 3609.5, 3797.,  4047.,  4297.,  4547.,  4797.,  5047.,
0414     5297.,  5609.5, 5984.5, 6359.5, 6734.5, 7172.,  7672.,  8172.,  8734.5, 9359.5, 9984.5};
0415 const int nsub = 4;
0416 const int ndepth = 7;
0417 const int neta = 82;
0418 const int nphi = 72;
0419 const float bphi = 72.;
0420 const int zneta = 22;
0421 const int znphi = 18;
0422 const int npfit = 220;
0423 const float anpfit = 220.;  // for SiPM:
0424 
0425 //
0426 class CMTRawAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
0427 public:
0428   explicit CMTRawAnalyzer(const edm::ParameterSet&);
0429   ~CMTRawAnalyzer() override;
0430   void beginJob() override;
0431   void analyze(const edm::Event&, const edm::EventSetup&) override;
0432   void endJob() override;
0433   void beginRun(const edm::Run& r, const edm::EventSetup& iSetup) override;
0434   void endRun(const edm::Run& r, const edm::EventSetup& iSetup) override;
0435   virtual void fillMAP();
0436 
0437 private:
0438   double phi12(double phi1, double en1, double phi2, double en2);
0439   double dR(double eta1, double phi1, double eta2, double phi2);
0440   double dPhiWsign(double phi1, double phi2);
0441 
0442   edm::EDGetTokenT<HcalCalibDigiCollection> tok_calib_;
0443   edm::EDGetTokenT<HBHEDigiCollection> tok_hbhe_;
0444   edm::EDGetTokenT<HODigiCollection> tok_ho_;
0445   edm::EDGetTokenT<HFDigiCollection> tok_hf_;
0446   edm::EDGetTokenT<QIE11DigiCollection> tok_qie11_;
0447   edm::EDGetTokenT<QIE10DigiCollection> tok_qie10_;
0448   edm::EDGetTokenT<HBHERecHitCollection> tok_hbheSignal_;
0449   edm::EDGetTokenT<HBHERecHitCollection> tok_hbheNoise_;
0450   edm::EDGetTokenT<HFRecHitCollection> tok_hfSignal_;
0451   edm::EDGetTokenT<HFRecHitCollection> tok_hfNoise_;
0452 
0453   edm::Service<TFileService> fs_;
0454   edm::InputTag inputTag_;
0455   const edm::ESGetToken<HcalDbService, HcalDbRecord> tokDB_;
0456   const edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> tokTopo_;
0457   const HcalQIEShape* shape;
0458   const HcalDbService* conditions;
0459   const HcalTopology* topo;
0460   /////////////////////////////////////////////
0461   int verbosity;
0462   int MAPcreation;
0463   /////////////////////////////////////////////
0464   bool recordNtuples_;
0465   int maxNeventsInNtuple_;
0466   bool recordHistoes_;
0467   bool studyRunDependenceHist_;
0468   bool studyCapIDErrorsHist_;
0469   bool studyRMSshapeHist_;
0470   bool studyRatioShapeHist_;
0471   bool studyTSmaxShapeHist_;
0472   bool studyTSmeanShapeHist_;
0473   bool studyDiffAmplHist_;
0474   bool studyCalibCellsHist_;
0475   bool studyADCAmplHist_;
0476   bool studyPedestalsHist_;
0477   bool studyPedestalCorrelations_;
0478   bool usePedestalSubtraction_;
0479   bool useADCmassive_;
0480   bool useADCfC_;
0481   bool useADCcounts_;
0482   bool usecontinuousnumbering_;
0483   /////////////////////////////////////////////
0484   double ratioHBMin_;
0485   double ratioHBMax_;
0486   double ratioHEMin_;
0487   double ratioHEMax_;
0488   double ratioHFMin_;
0489   double ratioHFMax_;
0490   double ratioHOMin_;
0491   double ratioHOMax_;
0492   /////////////////////////////////////////////
0493   int flagfitshunt1pedorledlowintensity_;
0494   int flagLaserRaddam_;
0495   int flagToUseDigiCollectionsORNot_;
0496   int flagIterativeMethodCalibrationGroupDigi_;
0497   int flagIterativeMethodCalibrationGroupReco_;
0498   int flagtoaskrunsorls_;
0499   int flagtodefinebadchannel_;
0500   int howmanybinsonplots_;
0501   int splashesUpperLimit_;
0502   int flagabortgaprejected_;
0503   int bcnrejectedlow_;
0504   int bcnrejectedhigh_;
0505   int flagestimatornormalization_;
0506   int flagcpuoptimization_;
0507   int flagupgradeqie1011_;
0508   int flagsipmcorrection_;
0509   int flaguseshunt_;
0510   int lsdep_cut1_peak_HBdepth1_;
0511   int lsdep_cut1_peak_HBdepth2_;
0512   int lsdep_cut1_peak_HEdepth1_;
0513   int lsdep_cut1_peak_HEdepth2_;
0514   int lsdep_cut1_peak_HEdepth3_;
0515   int lsdep_cut1_peak_HFdepth1_;
0516   int lsdep_cut1_peak_HFdepth2_;
0517   int lsdep_cut1_peak_HOdepth4_;
0518   //
0519   int lsdep_cut3_max_HBdepth1_;
0520   int lsdep_cut3_max_HBdepth2_;
0521   int lsdep_cut3_max_HEdepth1_;
0522   int lsdep_cut3_max_HEdepth2_;
0523   int lsdep_cut3_max_HEdepth3_;
0524   int lsdep_cut3_max_HFdepth1_;
0525   int lsdep_cut3_max_HFdepth2_;
0526   int lsdep_cut3_max_HOdepth4_;
0527   double lsdep_estimator1_HBdepth1_;
0528   double lsdep_estimator1_HBdepth2_;
0529   double lsdep_estimator1_HEdepth1_;
0530   double lsdep_estimator1_HEdepth2_;
0531   double lsdep_estimator1_HEdepth3_;
0532   double lsdep_estimator1_HFdepth1_;
0533   double lsdep_estimator1_HFdepth2_;
0534   double lsdep_estimator1_HOdepth4_;
0535   double lsdep_estimator1_HEdepth4_;
0536   double lsdep_estimator1_HEdepth5_;
0537   double lsdep_estimator1_HEdepth6_;
0538   double lsdep_estimator1_HEdepth7_;
0539   double lsdep_estimator1_HFdepth3_;
0540   double lsdep_estimator1_HFdepth4_;
0541   double lsdep_estimator1_HBdepth3_;
0542   double lsdep_estimator1_HBdepth4_;
0543 
0544   double lsdep_estimator2_HBdepth1_;
0545   double lsdep_estimator2_HBdepth2_;
0546   double lsdep_estimator2_HEdepth1_;
0547   double lsdep_estimator2_HEdepth2_;
0548   double lsdep_estimator2_HEdepth3_;
0549   double lsdep_estimator2_HFdepth1_;
0550   double lsdep_estimator2_HFdepth2_;
0551   double lsdep_estimator2_HOdepth4_;
0552 
0553   double lsdep_estimator3_HBdepth1_;
0554   double lsdep_estimator3_HBdepth2_;
0555   double lsdep_estimator3_HEdepth1_;
0556   double lsdep_estimator3_HEdepth2_;
0557   double lsdep_estimator3_HEdepth3_;
0558   double lsdep_estimator3_HFdepth1_;
0559   double lsdep_estimator3_HFdepth2_;
0560   double lsdep_estimator3_HOdepth4_;
0561 
0562   double lsdep_estimator4_HBdepth1_;
0563   double lsdep_estimator4_HBdepth2_;
0564   double lsdep_estimator4_HEdepth1_;
0565   double lsdep_estimator4_HEdepth2_;
0566   double lsdep_estimator4_HEdepth3_;
0567   double lsdep_estimator4_HFdepth1_;
0568   double lsdep_estimator4_HFdepth2_;
0569   double lsdep_estimator4_HOdepth4_;
0570 
0571   double lsdep_estimator5_HBdepth1_;
0572   double lsdep_estimator5_HBdepth2_;
0573   double lsdep_estimator5_HEdepth1_;
0574   double lsdep_estimator5_HEdepth2_;
0575   double lsdep_estimator5_HEdepth3_;
0576   double lsdep_estimator5_HFdepth1_;
0577   double lsdep_estimator5_HFdepth2_;
0578   double lsdep_estimator5_HOdepth4_;
0579   double forallestimators_amplitude_bigger_;
0580   /////////////////////////////////////////////
0581   double rmsHBMin_;
0582   double rmsHBMax_;
0583   double rmsHEMin_;
0584   double rmsHEMax_;
0585   double rmsHFMin_;
0586   double rmsHFMax_;
0587   double rmsHOMin_;
0588   double rmsHOMax_;
0589   /////////////////////////////////////////////
0590   double TSpeakHBMin_;
0591   double TSpeakHBMax_;
0592   double TSpeakHEMin_;
0593   double TSpeakHEMax_;
0594   double TSpeakHFMin_;
0595   double TSpeakHFMax_;
0596   double TSpeakHOMin_;
0597   double TSpeakHOMax_;
0598   double TSmeanHBMin_;
0599   double TSmeanHBMax_;
0600   double TSmeanHEMin_;
0601   double TSmeanHEMax_;
0602   double TSmeanHFMin_;
0603   double TSmeanHFMax_;
0604   double TSmeanHOMin_;
0605   double TSmeanHOMax_;
0606   int lsmin_;
0607   int lsmax_;
0608   /////////////////////////////////////////////
0609   double ADCAmplHBMin_;
0610   double ADCAmplHEMin_;
0611   double ADCAmplHOMin_;
0612   double ADCAmplHFMin_;
0613   double ADCAmplHBMax_;
0614   double ADCAmplHEMax_;
0615   double ADCAmplHOMax_;
0616   double ADCAmplHFMax_;
0617   double calibrADCHBMin_;
0618   double calibrADCHEMin_;
0619   double calibrADCHOMin_;
0620   double calibrADCHFMin_;
0621   double calibrADCHBMax_;
0622   double calibrADCHEMax_;
0623   double calibrADCHOMax_;
0624   double calibrADCHFMax_;
0625   double calibrRatioHBMin_;
0626   double calibrRatioHEMin_;
0627   double calibrRatioHOMin_;
0628   double calibrRatioHFMin_;
0629   double calibrRatioHBMax_;
0630   double calibrRatioHEMax_;
0631   double calibrRatioHOMax_;
0632   double calibrRatioHFMax_;
0633   double calibrTSmaxHBMin_;
0634   double calibrTSmaxHEMin_;
0635   double calibrTSmaxHOMin_;
0636   double calibrTSmaxHFMin_;
0637   double calibrTSmaxHBMax_;
0638   double calibrTSmaxHEMax_;
0639   double calibrTSmaxHOMax_;
0640   double calibrTSmaxHFMax_;
0641   double calibrTSmeanHBMin_;
0642   double calibrTSmeanHEMin_;
0643   double calibrTSmeanHOMin_;
0644   double calibrTSmeanHFMin_;
0645   double calibrTSmeanHBMax_;
0646   double calibrTSmeanHEMax_;
0647   double calibrTSmeanHOMax_;
0648   double calibrTSmeanHFMax_;
0649   double calibrWidthHBMin_;
0650   double calibrWidthHEMin_;
0651   double calibrWidthHOMin_;
0652   double calibrWidthHFMin_;
0653   double calibrWidthHBMax_;
0654   double calibrWidthHEMax_;
0655   double calibrWidthHOMax_;
0656   double calibrWidthHFMax_;
0657   /////////////////////////////////////////////
0658   int nevent;
0659   int nevent50;
0660   int nnnnnn;
0661   int nnnnnnhbhe;
0662   int nnnnnnhbheqie11;
0663   int counterhf;
0664   int counterhfqie10;
0665   int counterho;
0666   int nnnnnn1;
0667   int nnnnnn2;
0668   int nnnnnn3;
0669   int nnnnnn4;
0670   int nnnnnn5;
0671   int nnnnnn6;
0672   double pedestalwHBMax_;
0673   double pedestalwHEMax_;
0674   double pedestalwHFMax_;
0675   double pedestalwHOMax_;
0676   double pedestalHBMax_;
0677   double pedestalHEMax_;
0678   double pedestalHFMax_;
0679   double pedestalHOMax_;
0680   /////////////////////////////////////////////
0681   TH1F* h_bcnvsamplitude_HB;
0682   TH1F* h_bcnvsamplitude0_HB;
0683   TH1F* h_bcnvsamplitude_HE;
0684   TH1F* h_bcnvsamplitude0_HE;
0685   TH1F* h_bcnvsamplitude_HF;
0686   TH1F* h_bcnvsamplitude0_HF;
0687   TH1F* h_bcnvsamplitude_HO;
0688   TH1F* h_bcnvsamplitude0_HO;
0689   TH1F* h_orbitNumvsamplitude_HB;
0690   TH1F* h_orbitNumvsamplitude0_HB;
0691   TH1F* h_orbitNumvsamplitude_HE;
0692   TH1F* h_orbitNumvsamplitude0_HE;
0693   TH1F* h_orbitNumvsamplitude_HF;
0694   TH1F* h_orbitNumvsamplitude0_HF;
0695   TH1F* h_orbitNumvsamplitude_HO;
0696   TH1F* h_orbitNumvsamplitude0_HO;
0697   TH2F* h_2DsumADCAmplEtaPhiLs0;
0698   TH2F* h_2DsumADCAmplEtaPhiLs1;
0699   TH2F* h_2DsumADCAmplEtaPhiLs2;
0700   TH2F* h_2DsumADCAmplEtaPhiLs3;
0701   TH2F* h_2DsumADCAmplEtaPhiLs00;
0702   TH2F* h_2DsumADCAmplEtaPhiLs10;
0703   TH2F* h_2DsumADCAmplEtaPhiLs20;
0704   TH2F* h_2DsumADCAmplEtaPhiLs30;
0705   TH1F* h_sumADCAmplEtaPhiLs;
0706   TH1F* h_sumADCAmplEtaPhiLs_bbbc;
0707   TH1F* h_sumADCAmplEtaPhiLs_bbb1;
0708   TH1F* h_sumADCAmplEtaPhiLs_lscounterM1;
0709   TH1F* h_sumADCAmplEtaPhiLs_ietaphi;
0710   TH1F* h_sumADCAmplEtaPhiLs_lscounterM1orbitNum;
0711   TH1F* h_sumADCAmplEtaPhiLs_orbitNum;
0712   TH2F* h_mapAiForLS_bad_HB;
0713   TH2F* h_map0AiForLS_bad_HB;
0714   TH2F* h_mapAiForLS_good_HB;
0715   TH2F* h_map0AiForLS_good_HB;
0716   TH2F* h_mapAiForLS_bad_HE;
0717   TH2F* h_map0AiForLS_bad_HE;
0718   TH2F* h_mapAiForLS_good_HE;
0719   TH2F* h_map0AiForLS_good_HE;
0720   TH2F* h_mapAiForLS_bad_HO;
0721   TH2F* h_map0AiForLS_bad_HO;
0722   TH2F* h_mapAiForLS_good_HO;
0723   TH2F* h_map0AiForLS_good_HO;
0724   TH2F* h_mapAiForLS_bad_HF;
0725   TH2F* h_map0AiForLS_bad_HF;
0726   TH2F* h_mapAiForLS_good_HF;
0727   TH2F* h_map0AiForLS_good_HF;
0728   TH1F* h_numberofhitsHBtest;
0729   TH1F* h_numberofhitsHEtest;
0730   TH1F* h_numberofhitsHFtest;
0731   TH1F* h_numberofhitsHOtest;
0732   TH1F* h_AmplitudeHBtest;
0733   TH1F* h_AmplitudeHBtest1;
0734   TH1F* h_AmplitudeHBtest6;
0735   TH1F* h_AmplitudeHEtest;
0736   TH1F* h_AmplitudeHEtest1;
0737   TH1F* h_AmplitudeHEtest6;
0738   TH1F* h_AmplitudeHFtest;
0739   TH1F* h_AmplitudeHOtest;
0740   TH1F* h_totalAmplitudeHB;
0741   TH1F* h_totalAmplitudeHE;
0742   TH1F* h_totalAmplitudeHF;
0743   TH1F* h_totalAmplitudeHO;
0744   TH1F* h_totalAmplitudeHBperEvent;
0745   TH1F* h_totalAmplitudeHEperEvent;
0746   TH1F* h_totalAmplitudeHFperEvent;
0747   TH1F* h_totalAmplitudeHOperEvent;
0748   TH1F* h_amplitudeaveragedbydepthes_HE;
0749   TH1F* h_ndepthesperamplitudebins_HE;
0750   TH1F* h_errorGeneral;
0751   TH1F* h_error1;
0752   TH1F* h_error2;
0753   TH1F* h_error3;
0754   TH1F* h_amplError;
0755   TH1F* h_amplFine;
0756   TH1F* h_errorGeneral_HB;
0757   TH1F* h_error1_HB;
0758   TH1F* h_error2_HB;
0759   TH1F* h_error3_HB;
0760   TH1F* h_error4_HB;
0761   TH1F* h_error5_HB;
0762   TH1F* h_error6_HB;
0763   TH1F* h_error7_HB;
0764   TH1F* h_amplError_HB;
0765   TH1F* h_amplFine_HB;
0766   TH2F* h_mapDepth1Error_HB;
0767   TH2F* h_mapDepth2Error_HB;
0768   TH2F* h_mapDepth3Error_HB;
0769   TH2F* h_mapDepth4Error_HB;
0770   TH1F* h_fiber0_HB;
0771   TH1F* h_fiber1_HB;
0772   TH1F* h_fiber2_HB;
0773   TH1F* h_repetedcapid_HB;
0774   TH1F* h_errorGeneral_HE;
0775   TH1F* h_error1_HE;
0776   TH1F* h_error2_HE;
0777   TH1F* h_error3_HE;
0778   TH1F* h_error4_HE;
0779   TH1F* h_error5_HE;
0780   TH1F* h_error6_HE;
0781   TH1F* h_error7_HE;
0782   TH1F* h_amplError_HE;
0783   TH1F* h_amplFine_HE;
0784   TH2F* h_mapDepth1Error_HE;
0785   TH2F* h_mapDepth2Error_HE;
0786   TH2F* h_mapDepth3Error_HE;
0787   TH2F* h_mapDepth4Error_HE;
0788   TH2F* h_mapDepth5Error_HE;
0789   TH2F* h_mapDepth6Error_HE;
0790   TH2F* h_mapDepth7Error_HE;
0791   TH1F* h_fiber0_HE;
0792   TH1F* h_fiber1_HE;
0793   TH1F* h_fiber2_HE;
0794   TH1F* h_repetedcapid_HE;
0795   TH1F* h_errorGeneral_HF;
0796   TH1F* h_error1_HF;
0797   TH1F* h_error2_HF;
0798   TH1F* h_error3_HF;
0799   TH1F* h_error4_HF;
0800   TH1F* h_error5_HF;
0801   TH1F* h_error6_HF;
0802   TH1F* h_error7_HF;
0803   TH1F* h_amplError_HF;
0804   TH1F* h_amplFine_HF;
0805   TH2F* h_mapDepth1Error_HF;
0806   TH2F* h_mapDepth2Error_HF;
0807   TH2F* h_mapDepth3Error_HF;
0808   TH2F* h_mapDepth4Error_HF;
0809   TH1F* h_fiber0_HF;
0810   TH1F* h_fiber1_HF;
0811   TH1F* h_fiber2_HF;
0812   TH1F* h_repetedcapid_HF;
0813   TH1F* h_errorGeneral_HO;
0814   TH1F* h_error1_HO;
0815   TH1F* h_error2_HO;
0816   TH1F* h_error3_HO;
0817   TH1F* h_error4_HO;
0818   TH1F* h_error5_HO;
0819   TH1F* h_error6_HO;
0820   TH1F* h_error7_HO;
0821   TH1F* h_amplError_HO;
0822   TH1F* h_amplFine_HO;
0823   TH2F* h_mapDepth4Error_HO;
0824   TH1F* h_fiber0_HO;
0825   TH1F* h_fiber1_HO;
0826   TH1F* h_fiber2_HO;
0827   TH1F* h_repetedcapid_HO;
0828   /////////////////////////////////////////////
0829   TH2F* h_mapDepth1ADCAmpl225Copy_HB;
0830   TH2F* h_mapDepth2ADCAmpl225Copy_HB;
0831   TH2F* h_mapDepth3ADCAmpl225Copy_HB;
0832   TH2F* h_mapDepth4ADCAmpl225Copy_HB;
0833   TH2F* h_mapDepth1ADCAmpl225Copy_HE;
0834   TH2F* h_mapDepth2ADCAmpl225Copy_HE;
0835   TH2F* h_mapDepth3ADCAmpl225Copy_HE;
0836   TH2F* h_mapDepth4ADCAmpl225Copy_HE;
0837   TH2F* h_mapDepth5ADCAmpl225Copy_HE;
0838   TH2F* h_mapDepth6ADCAmpl225Copy_HE;
0839   TH2F* h_mapDepth7ADCAmpl225Copy_HE;
0840   TH2F* h_mapDepth1ADCAmpl225Copy_HF;
0841   TH2F* h_mapDepth2ADCAmpl225Copy_HF;
0842   TH2F* h_mapDepth3ADCAmpl225Copy_HF;
0843   TH2F* h_mapDepth4ADCAmpl225Copy_HF;
0844   TH2F* h_mapDepth4ADCAmpl225Copy_HO;
0845   TH1F* h_ADCAmpl345Zoom_HE;
0846   TH1F* h_ADCAmpl345Zoom1_HE;
0847   TH1F* h_ADCAmpl345_HE;
0848   TH1F* h_ADCAmpl345Zoom_HB;
0849   TH1F* h_ADCAmpl345Zoom1_HB;
0850   TH1F* h_ADCAmpl345_HB;
0851   TH1F* h_ADCAmpl_HBCapIdNoError;
0852   TH1F* h_ADCAmpl345_HBCapIdNoError;
0853   TH1F* h_ADCAmpl_HBCapIdError;
0854   TH1F* h_ADCAmpl345_HBCapIdError;
0855   TH1F* h_ADCAmplZoom_HB;
0856   TH1F* h_ADCAmplZoom1_HB;
0857   TH1F* h_ADCAmpl_HB;
0858   TH1F* h_AmplitudeHBrest;
0859   TH1F* h_AmplitudeHBrest1;
0860   TH1F* h_AmplitudeHBrest6;
0861   TH2F* h_mapDepth1ADCAmpl_HB;
0862   TH2F* h_mapDepth2ADCAmpl_HB;
0863   TH2F* h_mapDepth1ADCAmpl225_HB;
0864   TH2F* h_mapDepth2ADCAmpl225_HB;
0865   TH2F* h_mapDepth3ADCAmpl_HB;
0866   TH2F* h_mapDepth4ADCAmpl_HB;
0867   TH2F* h_mapDepth3ADCAmpl225_HB;
0868   TH2F* h_mapDepth4ADCAmpl225_HB;
0869   TH1F* h_TSmeanA_HB;
0870   TH2F* h_mapDepth1TSmeanA_HB;
0871   TH2F* h_mapDepth2TSmeanA_HB;
0872   TH2F* h_mapDepth1TSmeanA225_HB;
0873   TH2F* h_mapDepth2TSmeanA225_HB;
0874   TH2F* h_mapDepth3TSmeanA_HB;
0875   TH2F* h_mapDepth4TSmeanA_HB;
0876   TH2F* h_mapDepth3TSmeanA225_HB;
0877   TH2F* h_mapDepth4TSmeanA225_HB;
0878   TH1F* h_TSmaxA_HB;
0879   TH2F* h_mapDepth1TSmaxA_HB;
0880   TH2F* h_mapDepth2TSmaxA_HB;
0881   TH2F* h_mapDepth1TSmaxA225_HB;
0882   TH2F* h_mapDepth2TSmaxA225_HB;
0883   TH2F* h_mapDepth3TSmaxA_HB;
0884   TH2F* h_mapDepth4TSmaxA_HB;
0885   TH2F* h_mapDepth3TSmaxA225_HB;
0886   TH2F* h_mapDepth4TSmaxA225_HB;
0887   TH1F* h_Amplitude_HB;
0888   TH2F* h_mapDepth1Amplitude_HB;
0889   TH2F* h_mapDepth2Amplitude_HB;
0890   TH2F* h_mapDepth1Amplitude225_HB;
0891   TH2F* h_mapDepth2Amplitude225_HB;
0892   TH2F* h_mapDepth3Amplitude_HB;
0893   TH2F* h_mapDepth4Amplitude_HB;
0894   TH2F* h_mapDepth3Amplitude225_HB;
0895   TH2F* h_mapDepth4Amplitude225_HB;
0896   TH1F* h_Ampl_HB;
0897   TH2F* h_mapDepth1Ampl047_HB;
0898   TH2F* h_mapDepth2Ampl047_HB;
0899   TH2F* h_mapDepth1Ampl_HB;
0900   TH2F* h_mapDepth2Ampl_HB;
0901   TH2F* h_mapDepth1AmplE34_HB;
0902   TH2F* h_mapDepth2AmplE34_HB;
0903   TH2F* h_mapDepth1_HB;
0904   TH2F* h_mapDepth2_HB;
0905   TH2F* h_mapDepth3Ampl047_HB;
0906   TH2F* h_mapDepth4Ampl047_HB;
0907   TH2F* h_mapDepth3Ampl_HB;
0908   TH2F* h_mapDepth4Ampl_HB;
0909   TH2F* h_mapDepth3AmplE34_HB;
0910   TH2F* h_mapDepth4AmplE34_HB;
0911   TH2F* h_mapDepth3_HB;
0912   TH2F* h_mapDepth4_HB;
0913   TH2F* h_mapDepth1ADCAmpl12_HB;
0914   TH2F* h_mapDepth2ADCAmpl12_HB;
0915   TH2F* h_mapDepth3ADCAmpl12_HB;
0916   TH2F* h_mapDepth4ADCAmpl12_HB;
0917   TH2F* h_mapDepth1ADCAmpl12_HE;
0918   TH2F* h_mapDepth2ADCAmpl12_HE;
0919   TH2F* h_mapDepth3ADCAmpl12_HE;
0920   TH2F* h_mapDepth4ADCAmpl12_HE;
0921   TH2F* h_mapDepth5ADCAmpl12_HE;
0922   TH2F* h_mapDepth6ADCAmpl12_HE;
0923   TH2F* h_mapDepth7ADCAmpl12_HE;
0924   TH2F* h_mapDepth1ADCAmpl12SiPM_HE;
0925   TH2F* h_mapDepth2ADCAmpl12SiPM_HE;
0926   TH2F* h_mapDepth3ADCAmpl12SiPM_HE;
0927   TH2F* h_mapDepth1ADCAmpl12_HF;
0928   TH2F* h_mapDepth2ADCAmpl12_HF;
0929   TH2F* h_mapDepth3ADCAmpl12_HF;
0930   TH2F* h_mapDepth4ADCAmpl12_HF;
0931   TH2F* h_mapDepth4ADCAmpl12_HO;
0932   TH2F* h_mapDepth1linADCAmpl12_HE;
0933   TH2F* h_mapDepth2linADCAmpl12_HE;
0934   TH2F* h_mapDepth3linADCAmpl12_HE;
0935 
0936   TH2F* h_mapDepth1TS2_HB;
0937   TH2F* h_mapDepth2TS2_HB;
0938   TH2F* h_mapDepth3TS2_HB;
0939   TH2F* h_mapDepth4TS2_HB;
0940   TH2F* h_mapDepth1TS2_HE;
0941   TH2F* h_mapDepth2TS2_HE;
0942   TH2F* h_mapDepth3TS2_HE;
0943   TH2F* h_mapDepth4TS2_HE;
0944   TH2F* h_mapDepth5TS2_HE;
0945   TH2F* h_mapDepth6TS2_HE;
0946   TH2F* h_mapDepth7TS2_HE;
0947   TH2F* h_mapDepth1TS1_HF;
0948   TH2F* h_mapDepth2TS1_HF;
0949   TH2F* h_mapDepth3TS1_HF;
0950   TH2F* h_mapDepth4TS1_HF;
0951   TH2F* h_mapDepth4TS012_HO;
0952 
0953   /////////////////////////////////////////////
0954   TH1F* h_ADCAmpl_HF;
0955   TH1F* h_ADCAmplrest1_HF;
0956   TH1F* h_ADCAmplrest6_HF;
0957   TH1F* h_ADCAmplZoom1_HF;
0958   TH2F* h_mapDepth1ADCAmpl_HF;
0959   TH2F* h_mapDepth2ADCAmpl_HF;
0960   TH2F* h_mapDepth1ADCAmpl225_HF;
0961   TH2F* h_mapDepth2ADCAmpl225_HF;
0962   TH2F* h_mapDepth3ADCAmpl_HF;
0963   TH2F* h_mapDepth4ADCAmpl_HF;
0964   TH2F* h_mapDepth3ADCAmpl225_HF;
0965   TH2F* h_mapDepth4ADCAmpl225_HF;
0966   TH1F* h_TSmeanA_HF;
0967   TH2F* h_mapDepth1TSmeanA_HF;
0968   TH2F* h_mapDepth2TSmeanA_HF;
0969   TH2F* h_mapDepth1TSmeanA225_HF;
0970   TH2F* h_mapDepth2TSmeanA225_HF;
0971   TH2F* h_mapDepth3TSmeanA_HF;
0972   TH2F* h_mapDepth4TSmeanA_HF;
0973   TH2F* h_mapDepth3TSmeanA225_HF;
0974   TH2F* h_mapDepth4TSmeanA225_HF;
0975   TH1F* h_TSmaxA_HF;
0976   TH2F* h_mapDepth1TSmaxA_HF;
0977   TH2F* h_mapDepth2TSmaxA_HF;
0978   TH2F* h_mapDepth1TSmaxA225_HF;
0979   TH2F* h_mapDepth2TSmaxA225_HF;
0980   TH2F* h_mapDepth3TSmaxA_HF;
0981   TH2F* h_mapDepth4TSmaxA_HF;
0982   TH2F* h_mapDepth3TSmaxA225_HF;
0983   TH2F* h_mapDepth4TSmaxA225_HF;
0984   TH1F* h_Amplitude_HF;
0985   TH2F* h_mapDepth1Amplitude_HF;
0986   TH2F* h_mapDepth2Amplitude_HF;
0987   TH2F* h_mapDepth1Amplitude225_HF;
0988   TH2F* h_mapDepth2Amplitude225_HF;
0989   TH2F* h_mapDepth3Amplitude_HF;
0990   TH2F* h_mapDepth4Amplitude_HF;
0991   TH2F* h_mapDepth3Amplitude225_HF;
0992   TH2F* h_mapDepth4Amplitude225_HF;
0993   TH1F* h_Ampl_HF;
0994   TH2F* h_mapDepth1Ampl047_HF;
0995   TH2F* h_mapDepth2Ampl047_HF;
0996   TH2F* h_mapDepth1Ampl_HF;
0997   TH2F* h_mapDepth2Ampl_HF;
0998   TH2F* h_mapDepth1AmplE34_HF;
0999   TH2F* h_mapDepth2AmplE34_HF;
1000   TH2F* h_mapDepth1_HF;
1001   TH2F* h_mapDepth2_HF;
1002   TH2F* h_mapDepth3Ampl047_HF;
1003   TH2F* h_mapDepth4Ampl047_HF;
1004   TH2F* h_mapDepth3Ampl_HF;
1005   TH2F* h_mapDepth4Ampl_HF;
1006   TH2F* h_mapDepth3AmplE34_HF;
1007   TH2F* h_mapDepth4AmplE34_HF;
1008   TH2F* h_mapDepth3_HF;
1009   TH2F* h_mapDepth4_HF;
1010   /////////////////////////////////////////////
1011   TH1F* h_ADCAmpl_HO;
1012   TH1F* h_ADCAmplrest1_HO;
1013   TH1F* h_ADCAmplrest6_HO;
1014   TH1F* h_ADCAmplZoom1_HO;
1015   TH1F* h_ADCAmpl_HO_copy;
1016   TH2F* h_mapDepth4ADCAmpl_HO;
1017   TH2F* h_mapDepth4ADCAmpl225_HO;
1018   TH1F* h_TSmeanA_HO;
1019   TH2F* h_mapDepth4TSmeanA_HO;
1020   TH2F* h_mapDepth4TSmeanA225_HO;
1021   TH1F* h_TSmaxA_HO;
1022   TH2F* h_mapDepth4TSmaxA_HO;
1023   TH2F* h_mapDepth4TSmaxA225_HO;
1024   TH1F* h_Amplitude_HO;
1025   TH2F* h_mapDepth4Amplitude_HO;
1026   TH2F* h_mapDepth4Amplitude225_HO;
1027   TH1F* h_Ampl_HO;
1028   TH2F* h_mapDepth4Ampl047_HO;
1029   TH2F* h_mapDepth4Ampl_HO;
1030   TH2F* h_mapDepth4AmplE34_HO;
1031   TH2F* h_mapDepth4_HO;
1032   /////////////////////////////////////////////
1033   TH1F* h_nbadchannels_depth1_HB;
1034   TH1F* h_runnbadchannels_depth1_HB;
1035   TH1F* h_runnbadchannelsC_depth1_HB;
1036   TH1F* h_runbadrate_depth1_HB;
1037   TH1F* h_runbadrateC_depth1_HB;
1038   TH1F* h_runbadrate0_depth1_HB;
1039   TH1F* h_nbadchannels_depth2_HB;
1040   TH1F* h_runnbadchannels_depth2_HB;
1041   TH1F* h_runnbadchannelsC_depth2_HB;
1042   TH1F* h_runbadrate_depth2_HB;
1043   TH1F* h_runbadrateC_depth2_HB;
1044   TH1F* h_runbadrate0_depth2_HB;
1045   TH1F* h_nbadchannels_depth1_HE;
1046   TH1F* h_runnbadchannels_depth1_HE;
1047   TH1F* h_runnbadchannelsC_depth1_HE;
1048   TH1F* h_runbadrate_depth1_HE;
1049   TH1F* h_runbadrateC_depth1_HE;
1050   TH1F* h_runbadrate0_depth1_HE;
1051   TH1F* h_nbadchannels_depth2_HE;
1052   TH1F* h_runnbadchannels_depth2_HE;
1053   TH1F* h_runnbadchannelsC_depth2_HE;
1054   TH1F* h_runbadrate_depth2_HE;
1055   TH1F* h_runbadrateC_depth2_HE;
1056   TH1F* h_runbadrate0_depth2_HE;
1057   TH1F* h_nbadchannels_depth3_HE;
1058   TH1F* h_runnbadchannels_depth3_HE;
1059   TH1F* h_runnbadchannelsC_depth3_HE;
1060   TH1F* h_runbadrate_depth3_HE;
1061   TH1F* h_runbadrateC_depth3_HE;
1062   TH1F* h_runbadrate0_depth3_HE;
1063   TH1F* h_nbadchannels_depth4_HO;
1064   TH1F* h_runnbadchannels_depth4_HO;
1065   TH1F* h_runnbadchannelsC_depth4_HO;
1066   TH1F* h_runbadrate_depth4_HO;
1067   TH1F* h_runbadrateC_depth4_HO;
1068   TH1F* h_runbadrate0_depth4_HO;
1069   TH1F* h_nbadchannels_depth1_HF;
1070   TH1F* h_runnbadchannels_depth1_HF;
1071   TH1F* h_runnbadchannelsC_depth1_HF;
1072   TH1F* h_runbadrate_depth1_HF;
1073   TH1F* h_runbadrateC_depth1_HF;
1074   TH1F* h_runbadrate0_depth1_HF;
1075   TH1F* h_nbadchannels_depth2_HF;
1076   TH1F* h_runnbadchannels_depth2_HF;
1077   TH1F* h_runnbadchannelsC_depth2_HF;
1078   TH1F* h_runbadrate_depth2_HF;
1079   TH1F* h_runbadrateC_depth2_HF;
1080   TH1F* h_runbadrate0_depth2_HF;
1081   TH1F* h_bcnnbadchannels_depth1_HB;
1082   TH1F* h_bcnnbadchannels_depth2_HB;
1083   TH1F* h_bcnnbadchannels_depth1_HE;
1084   TH1F* h_bcnnbadchannels_depth2_HE;
1085   TH1F* h_bcnnbadchannels_depth3_HE;
1086   TH1F* h_bcnnbadchannels_depth4_HO;
1087   TH1F* h_bcnnbadchannels_depth1_HF;
1088   TH1F* h_bcnnbadchannels_depth2_HF;
1089   TH1F* h_bcnbadrate0_depth1_HB;
1090   TH1F* h_bcnbadrate0_depth2_HB;
1091   TH1F* h_bcnbadrate0_depth1_HE;
1092   TH1F* h_bcnbadrate0_depth2_HE;
1093   TH1F* h_bcnbadrate0_depth3_HE;
1094   TH1F* h_bcnbadrate0_depth4_HO;
1095   TH1F* h_bcnbadrate0_depth1_HF;
1096   TH1F* h_bcnbadrate0_depth2_HF;
1097   TH1F* h_Amplitude_forCapIdErrors_HB1;
1098   TH1F* h_Amplitude_forCapIdErrors_HB2;
1099   TH1F* h_Amplitude_forCapIdErrors_HE1;
1100   TH1F* h_Amplitude_forCapIdErrors_HE2;
1101   TH1F* h_Amplitude_forCapIdErrors_HE3;
1102   TH1F* h_Amplitude_forCapIdErrors_HF1;
1103   TH1F* h_Amplitude_forCapIdErrors_HF2;
1104   TH1F* h_Amplitude_forCapIdErrors_HO4;
1105   TH1F* h_Amplitude_notCapIdErrors_HB1;
1106   TH1F* h_Amplitude_notCapIdErrors_HB2;
1107   TH1F* h_Amplitude_notCapIdErrors_HE1;
1108   TH1F* h_Amplitude_notCapIdErrors_HE2;
1109   TH1F* h_Amplitude_notCapIdErrors_HE3;
1110   TH1F* h_Amplitude_notCapIdErrors_HF1;
1111   TH1F* h_Amplitude_notCapIdErrors_HF2;
1112   TH1F* h_Amplitude_notCapIdErrors_HO4;
1113   /////////////////////////////////////////////
1114   TH1F* h_corrforxaMAIN_HE;
1115   TH1F* h_corrforxaMAIN0_HE;
1116   TH1F* h_corrforxaADDI_HE;
1117   TH1F* h_corrforxaADDI0_HE;
1118   TH1F* h_ADCAmpl_HE;
1119   TH1F* h_ADCAmplrest_HE;
1120   TH1F* h_ADCAmplrest1_HE;
1121   TH1F* h_ADCAmplrest6_HE;
1122   TH1F* h_ADCAmplZoom1_HE;
1123   TH2F* h_mapDepth1ADCAmpl_HE;
1124   TH2F* h_mapDepth2ADCAmpl_HE;
1125   TH2F* h_mapDepth3ADCAmpl_HE;
1126   TH2F* h_mapDepth4ADCAmpl_HE;
1127   TH2F* h_mapDepth5ADCAmpl_HE;
1128   TH2F* h_mapDepth6ADCAmpl_HE;
1129   TH2F* h_mapDepth7ADCAmpl_HE;
1130   TH2F* h_mapADCAmplfirstpeak_HE;
1131   TH2F* h_mapADCAmplfirstpeak0_HE;
1132   TH2F* h_mapADCAmplsecondpeak_HE;
1133   TH2F* h_mapADCAmplsecondpeak0_HE;
1134   TH2F* h_mapADCAmpl11firstpeak_HE;
1135   TH2F* h_mapADCAmpl11firstpeak0_HE;
1136   TH2F* h_mapADCAmpl11secondpeak_HE;
1137   TH2F* h_mapADCAmpl11secondpeak0_HE;
1138   TH2F* h_mapADCAmpl12firstpeak_HE;
1139   TH2F* h_mapADCAmpl12firstpeak0_HE;
1140   TH2F* h_mapADCAmpl12secondpeak_HE;
1141   TH2F* h_mapADCAmpl12secondpeak0_HE;
1142   TH1F* h_gsmdifferencefit1_HE;
1143   TH1F* h_gsmdifferencefit2_HE;
1144   TH1F* h_gsmdifferencefit3_HE;
1145   TH1F* h_gsmdifferencefit4_HE;
1146   TH1F* h_gsmdifferencefit5_HE;
1147   TH1F* h_gsmdifferencefit6_HE;
1148   TH2F* h_mapDepth1ADCAmplSiPM_HE;
1149   TH2F* h_mapDepth2ADCAmplSiPM_HE;
1150   TH2F* h_mapDepth3ADCAmplSiPM_HE;
1151   TH2F* h_mapDepth1ADCAmpl225_HE;
1152   TH2F* h_mapDepth2ADCAmpl225_HE;
1153   TH2F* h_mapDepth3ADCAmpl225_HE;
1154   TH2F* h_mapDepth4ADCAmpl225_HE;
1155   TH2F* h_mapDepth5ADCAmpl225_HE;
1156   TH2F* h_mapDepth6ADCAmpl225_HE;
1157   TH2F* h_mapDepth7ADCAmpl225_HE;
1158   TH1F* h_TSmeanA_HE;
1159   TH2F* h_mapDepth1TSmeanA_HE;
1160   TH2F* h_mapDepth2TSmeanA_HE;
1161   TH2F* h_mapDepth3TSmeanA_HE;
1162   TH2F* h_mapDepth4TSmeanA_HE;
1163   TH2F* h_mapDepth5TSmeanA_HE;
1164   TH2F* h_mapDepth6TSmeanA_HE;
1165   TH2F* h_mapDepth7TSmeanA_HE;
1166   TH2F* h_mapDepth1TSmeanA225_HE;
1167   TH2F* h_mapDepth2TSmeanA225_HE;
1168   TH2F* h_mapDepth3TSmeanA225_HE;
1169   TH2F* h_mapDepth4TSmeanA225_HE;
1170   TH2F* h_mapDepth5TSmeanA225_HE;
1171   TH2F* h_mapDepth6TSmeanA225_HE;
1172   TH2F* h_mapDepth7TSmeanA225_HE;
1173   TH1F* h_TSmaxA_HE;
1174   TH2F* h_mapDepth1TSmaxA_HE;
1175   TH2F* h_mapDepth2TSmaxA_HE;
1176   TH2F* h_mapDepth3TSmaxA_HE;
1177   TH2F* h_mapDepth4TSmaxA_HE;
1178   TH2F* h_mapDepth5TSmaxA_HE;
1179   TH2F* h_mapDepth6TSmaxA_HE;
1180   TH2F* h_mapDepth7TSmaxA_HE;
1181   TH2F* h_mapDepth1TSmaxA225_HE;
1182   TH2F* h_mapDepth2TSmaxA225_HE;
1183   TH2F* h_mapDepth3TSmaxA225_HE;
1184   TH2F* h_mapDepth4TSmaxA225_HE;
1185   TH2F* h_mapDepth5TSmaxA225_HE;
1186   TH2F* h_mapDepth6TSmaxA225_HE;
1187   TH2F* h_mapDepth7TSmaxA225_HE;
1188   TH1F* h_Amplitude_HE;
1189   TH2F* h_mapDepth1Amplitude_HE;
1190   TH2F* h_mapDepth2Amplitude_HE;
1191   TH2F* h_mapDepth3Amplitude_HE;
1192   TH2F* h_mapDepth4Amplitude_HE;
1193   TH2F* h_mapDepth5Amplitude_HE;
1194   TH2F* h_mapDepth6Amplitude_HE;
1195   TH2F* h_mapDepth7Amplitude_HE;
1196   TH2F* h_mapDepth1Amplitude225_HE;
1197   TH2F* h_mapDepth2Amplitude225_HE;
1198   TH2F* h_mapDepth3Amplitude225_HE;
1199   TH2F* h_mapDepth4Amplitude225_HE;
1200   TH2F* h_mapDepth5Amplitude225_HE;
1201   TH2F* h_mapDepth6Amplitude225_HE;
1202   TH2F* h_mapDepth7Amplitude225_HE;
1203   TH1F* h_Ampl_HE;
1204   TH2F* h_mapDepth1Ampl047_HE;
1205   TH2F* h_mapDepth2Ampl047_HE;
1206   TH2F* h_mapDepth3Ampl047_HE;
1207   TH2F* h_mapDepth4Ampl047_HE;
1208   TH2F* h_mapDepth5Ampl047_HE;
1209   TH2F* h_mapDepth6Ampl047_HE;
1210   TH2F* h_mapDepth7Ampl047_HE;
1211   TH2F* h_mapDepth1Ampl_HE;
1212   TH2F* h_mapDepth2Ampl_HE;
1213   TH2F* h_mapDepth3Ampl_HE;
1214   TH2F* h_mapDepth4Ampl_HE;
1215   TH2F* h_mapDepth5Ampl_HE;
1216   TH2F* h_mapDepth6Ampl_HE;
1217   TH2F* h_mapDepth7Ampl_HE;
1218   TH2F* h_mapDepth1AmplE34_HE;
1219   TH2F* h_mapDepth2AmplE34_HE;
1220   TH2F* h_mapDepth3AmplE34_HE;
1221   TH2F* h_mapDepth4AmplE34_HE;
1222   TH2F* h_mapDepth5AmplE34_HE;
1223   TH2F* h_mapDepth6AmplE34_HE;
1224   TH2F* h_mapDepth7AmplE34_HE;
1225   TH2F* h_mapDepth1_HE;
1226   TH2F* h_mapDepth2_HE;
1227   TH2F* h_mapDepth3_HE;
1228   TH2F* h_mapDepth4_HE;
1229   TH2F* h_mapDepth5_HE;
1230   TH2F* h_mapDepth6_HE;
1231   TH2F* h_mapDepth7_HE;
1232   TH2F* h_FullSignal3D_HB;
1233   TH2F* h_FullSignal3D0_HB;
1234   TH2F* h_FullSignal3D_HE;
1235   TH2F* h_FullSignal3D0_HE;
1236   TH2F* h_FullSignal3D_HO;
1237   TH2F* h_FullSignal3D0_HO;
1238   TH2F* h_FullSignal3D_HF;
1239   TH2F* h_FullSignal3D0_HF;
1240   TH2F* h_mapCapCalib047_HB;
1241   TH2F* h_mapCapCalib047_HE;
1242   TH2F* h_mapCapCalib047_HO;
1243   TH2F* h_mapCapCalib047_HF;
1244   TH1F* h_ADCCalib_HB;
1245   TH1F* h_ADCCalib1_HB;
1246   TH2F* h_mapADCCalib047_HB;
1247   TH2F* h_mapADCCalib_HB;
1248   TH1F* h_RatioCalib_HB;
1249   TH2F* h_mapRatioCalib047_HB;
1250   TH2F* h_mapRatioCalib_HB;
1251   TH1F* h_TSmaxCalib_HB;
1252   TH2F* h_mapTSmaxCalib047_HB;
1253   TH2F* h_mapTSmaxCalib_HB;
1254   TH1F* h_TSmeanCalib_HB;
1255   TH2F* h_mapTSmeanCalib047_HB;
1256   TH2F* h_mapTSmeanCalib_HB;
1257   TH1F* h_WidthCalib_HB;
1258   TH2F* h_mapWidthCalib047_HB;
1259   TH2F* h_mapWidthCalib_HB;
1260   TH2F* h_map_HB;
1261   TH1F* h_ADCCalib_HE;
1262   TH1F* h_ADCCalib1_HE;
1263   TH2F* h_mapADCCalib047_HE;
1264   TH2F* h_mapADCCalib_HE;
1265   TH1F* h_RatioCalib_HE;
1266   TH2F* h_mapRatioCalib047_HE;
1267   TH2F* h_mapRatioCalib_HE;
1268   TH1F* h_TSmaxCalib_HE;
1269   TH2F* h_mapTSmaxCalib047_HE;
1270   TH2F* h_mapTSmaxCalib_HE;
1271   TH1F* h_TSmeanCalib_HE;
1272   TH2F* h_mapTSmeanCalib047_HE;
1273   TH2F* h_mapTSmeanCalib_HE;
1274   TH1F* h_WidthCalib_HE;
1275   TH2F* h_mapWidthCalib047_HE;
1276   TH2F* h_mapWidthCalib_HE;
1277   TH2F* h_map_HE;
1278   TH1F* h_ADCCalib_HO;
1279   TH1F* h_ADCCalib1_HO;
1280   TH2F* h_mapADCCalib047_HO;
1281   TH2F* h_mapADCCalib_HO;
1282   TH1F* h_RatioCalib_HO;
1283   TH2F* h_mapRatioCalib047_HO;
1284   TH2F* h_mapRatioCalib_HO;
1285   TH1F* h_TSmaxCalib_HO;
1286   TH2F* h_mapTSmaxCalib047_HO;
1287   TH2F* h_mapTSmaxCalib_HO;
1288   TH1F* h_TSmeanCalib_HO;
1289   TH2F* h_mapTSmeanCalib047_HO;
1290   TH2F* h_mapTSmeanCalib_HO;
1291   TH1F* h_WidthCalib_HO;
1292   TH2F* h_mapWidthCalib047_HO;
1293   TH2F* h_mapWidthCalib_HO;
1294   TH2F* h_map_HO;
1295   TH1F* h_ADCCalib_HF;
1296   TH1F* h_ADCCalib1_HF;
1297   TH2F* h_mapADCCalib047_HF;
1298   TH2F* h_mapADCCalib_HF;
1299   TH1F* h_RatioCalib_HF;
1300   TH2F* h_mapRatioCalib047_HF;
1301   TH2F* h_mapRatioCalib_HF;
1302   TH1F* h_TSmaxCalib_HF;
1303   TH2F* h_mapTSmaxCalib047_HF;
1304   TH2F* h_mapTSmaxCalib_HF;
1305   TH1F* h_TSmeanCalib_HF;
1306   TH2F* h_mapTSmeanCalib047_HF;
1307   TH2F* h_mapTSmeanCalib_HF;
1308   TH1F* h_WidthCalib_HF;
1309   TH2F* h_mapWidthCalib047_HF;
1310   TH2F* h_mapWidthCalib_HF;
1311   TH2F* h_map_HF;
1312   TH1F* h_nls_per_run;
1313   TH1F* h_nls_per_run10;
1314   TH1F* h_nevents_per_LS;
1315   TH1F* h_nevents_per_LSzoom;
1316   TH1F* h_nevents_per_eachLS;
1317   TH1F* h_nevents_per_eachRealLS;
1318   TH1F* h_lsnumber_per_eachLS;
1319   TH1F* h_sumPedestalLS1;
1320   TH2F* h_2DsumPedestalLS1;
1321   TH1F* h_sumPedestalperLS1;
1322   TH2F* h_2D0sumPedestalLS1;
1323   TH1F* h_sum0PedestalperLS1;
1324   TH1F* h_sumPedestalLS2;
1325   TH2F* h_2DsumPedestalLS2;
1326   TH1F* h_sumPedestalperLS2;
1327   TH2F* h_2D0sumPedestalLS2;
1328   TH1F* h_sum0PedestalperLS2;
1329   TH1F* h_sumPedestalLS3;
1330   TH2F* h_2DsumPedestalLS3;
1331   TH1F* h_sumPedestalperLS3;
1332   TH2F* h_2D0sumPedestalLS3;
1333   TH1F* h_sum0PedestalperLS3;
1334   TH1F* h_sumPedestalLS4;
1335   TH2F* h_2DsumPedestalLS4;
1336   TH1F* h_sumPedestalperLS4;
1337   TH2F* h_2D0sumPedestalLS4;
1338   TH1F* h_sum0PedestalperLS4;
1339   TH1F* h_sumPedestalLS5;
1340   TH2F* h_2DsumPedestalLS5;
1341   TH1F* h_sumPedestalperLS5;
1342   TH2F* h_2D0sumPedestalLS5;
1343   TH1F* h_sum0PedestalperLS5;
1344   TH1F* h_sumPedestalLS6;
1345   TH2F* h_2DsumPedestalLS6;
1346   TH1F* h_sumPedestalperLS6;
1347   TH2F* h_2D0sumPedestalLS6;
1348   TH1F* h_sum0PedestalperLS6;
1349   TH1F* h_sumPedestalLS7;
1350   TH2F* h_2DsumPedestalLS7;
1351   TH1F* h_sumPedestalperLS7;
1352   TH2F* h_2D0sumPedestalLS7;
1353   TH1F* h_sum0PedestalperLS7;
1354   TH1F* h_sumPedestalLS8;
1355   TH2F* h_2DsumPedestalLS8;
1356   TH1F* h_sumPedestalperLS8;
1357   TH2F* h_2D0sumPedestalLS8;
1358   TH1F* h_sum0PedestalperLS8;
1359   TH2F* h_2DsumADCAmplLSdepth4HEu;
1360   TH2F* h_2D0sumADCAmplLSdepth4HEu;
1361   TH2F* h_2DsumADCAmplLSdepth5HEu;
1362   TH2F* h_2D0sumADCAmplLSdepth5HEu;
1363   TH2F* h_2DsumADCAmplLSdepth6HEu;
1364   TH2F* h_2D0sumADCAmplLSdepth6HEu;
1365   TH2F* h_2DsumADCAmplLSdepth7HEu;
1366   TH2F* h_2D0sumADCAmplLSdepth7HEu;
1367   TH2F* h_2DsumADCAmplLSdepth3HFu;
1368   TH2F* h_2D0sumADCAmplLSdepth3HFu;
1369   TH2F* h_2DsumADCAmplLSdepth4HFu;
1370   TH2F* h_2D0sumADCAmplLSdepth4HFu;
1371   TH2F* h_2DsumADCAmplLSdepth3HBu;
1372   TH2F* h_2D0sumADCAmplLSdepth3HBu;
1373   TH2F* h_2DsumADCAmplLSdepth4HBu;
1374   TH2F* h_2D0sumADCAmplLSdepth4HBu;
1375   TH1F* h_sumADCAmplLS1copy1;
1376   TH1F* h_sumADCAmplLS1copy2;
1377   TH1F* h_sumADCAmplLS1copy3;
1378   TH1F* h_sumADCAmplLS1copy4;
1379   TH1F* h_sumADCAmplLS1copy5;
1380   TH1F* h_sumADCAmplLS1;
1381   TH2F* h_2DsumADCAmplLS1;
1382   TH2F* h_2DsumADCAmplLS1_LSselected;
1383   TH1F* h_sumADCAmplperLS1;
1384   TH1F* h_sumCutADCAmplperLS1;
1385   TH2F* h_2D0sumADCAmplLS1;
1386   TH1F* h_sum0ADCAmplperLS1;
1387   TH1F* h_sumADCAmplLS2;
1388   TH2F* h_2DsumADCAmplLS2;
1389   TH2F* h_2DsumADCAmplLS2_LSselected;
1390   TH1F* h_sumADCAmplperLS2;
1391   TH1F* h_sumCutADCAmplperLS2;
1392   TH2F* h_2D0sumADCAmplLS2;
1393   TH1F* h_sum0ADCAmplperLS2;
1394   TH1F* h_sumADCAmplLS3;
1395   TH2F* h_2DsumADCAmplLS3;
1396   TH2F* h_2DsumADCAmplLS3_LSselected;
1397   TH1F* h_sumADCAmplperLS3;
1398   TH1F* h_sumCutADCAmplperLS3;
1399   TH2F* h_2D0sumADCAmplLS3;
1400   TH1F* h_sum0ADCAmplperLS3;
1401   TH1F* h_sumADCAmplLS4;
1402   TH2F* h_2DsumADCAmplLS4;
1403   TH2F* h_2DsumADCAmplLS4_LSselected;
1404   TH1F* h_sumADCAmplperLS4;
1405   TH1F* h_sumCutADCAmplperLS4;
1406   TH2F* h_2D0sumADCAmplLS4;
1407   TH1F* h_sum0ADCAmplperLS4;
1408   TH1F* h_sumADCAmplLS5;
1409   TH2F* h_2DsumADCAmplLS5;
1410   TH2F* h_2DsumADCAmplLS5_LSselected;
1411   TH1F* h_sumADCAmplperLS5;
1412   TH1F* h_sumCutADCAmplperLS5;
1413   TH2F* h_2D0sumADCAmplLS5;
1414   TH1F* h_sum0ADCAmplperLS5;
1415   TH1F* h_sumADCAmplLS6;
1416   TH2F* h_2DsumADCAmplLS6;
1417   TH2F* h_2DsumADCAmplLS6_LSselected;
1418   TH2F* h_2D0sumADCAmplLS6;
1419   TH1F* h_sumADCAmplperLS6;
1420   TH1F* h_sumCutADCAmplperLS6;
1421   TH1F* h_sum0ADCAmplperLS6;
1422   TH1F* h_sumADCAmplperLSdepth4HEu;
1423   TH1F* h_sumADCAmplperLSdepth5HEu;
1424   TH1F* h_sumADCAmplperLSdepth6HEu;
1425   TH1F* h_sumADCAmplperLSdepth7HEu;
1426   TH1F* h_sumCutADCAmplperLSdepth4HEu;
1427   TH1F* h_sumCutADCAmplperLSdepth5HEu;
1428   TH1F* h_sumCutADCAmplperLSdepth6HEu;
1429   TH1F* h_sumCutADCAmplperLSdepth7HEu;
1430   TH1F* h_sum0ADCAmplperLSdepth4HEu;
1431   TH1F* h_sum0ADCAmplperLSdepth5HEu;
1432   TH1F* h_sum0ADCAmplperLSdepth6HEu;
1433   TH1F* h_sum0ADCAmplperLSdepth7HEu;
1434   TH1F* h_sumADCAmplperLSdepth3HBu;
1435   TH1F* h_sumADCAmplperLSdepth4HBu;
1436   TH1F* h_sumCutADCAmplperLSdepth3HBu;
1437   TH1F* h_sumCutADCAmplperLSdepth4HBu;
1438   TH1F* h_sum0ADCAmplperLSdepth3HBu;
1439   TH1F* h_sum0ADCAmplperLSdepth4HBu;
1440   TH1F* h_sumADCAmplperLS6u;
1441   TH1F* h_sumCutADCAmplperLS6u;
1442   TH1F* h_sum0ADCAmplperLS6u;
1443   TH1F* h_sumADCAmplperLS1_P1;
1444   TH1F* h_sum0ADCAmplperLS1_P1;
1445   TH1F* h_sumADCAmplperLS1_P2;
1446   TH1F* h_sum0ADCAmplperLS1_P2;
1447   TH1F* h_sumADCAmplperLS1_M1;
1448   TH1F* h_sum0ADCAmplperLS1_M1;
1449   TH1F* h_sumADCAmplperLS1_M2;
1450   TH1F* h_sum0ADCAmplperLS1_M2;
1451   TH1F* h_sumADCAmplperLS3_P1;
1452   TH1F* h_sum0ADCAmplperLS3_P1;
1453   TH1F* h_sumADCAmplperLS3_P2;
1454   TH1F* h_sum0ADCAmplperLS3_P2;
1455   TH1F* h_sumADCAmplperLS3_M1;
1456   TH1F* h_sum0ADCAmplperLS3_M1;
1457   TH1F* h_sumADCAmplperLS3_M2;
1458   TH1F* h_sum0ADCAmplperLS3_M2;
1459   TH1F* h_sumADCAmplperLS6_P1;
1460   TH1F* h_sum0ADCAmplperLS6_P1;
1461   TH1F* h_sumADCAmplperLS6_P2;
1462   TH1F* h_sum0ADCAmplperLS6_P2;
1463   TH1F* h_sumADCAmplperLS6_M1;
1464   TH1F* h_sum0ADCAmplperLS6_M1;
1465   TH1F* h_sumADCAmplperLS6_M2;
1466   TH1F* h_sum0ADCAmplperLS6_M2;
1467   TH1F* h_sumADCAmplperLS8_P1;
1468   TH1F* h_sum0ADCAmplperLS8_P1;
1469   TH1F* h_sumADCAmplperLS8_P2;
1470   TH1F* h_sum0ADCAmplperLS8_P2;
1471   TH1F* h_sumADCAmplperLS8_M1;
1472   TH1F* h_sum0ADCAmplperLS8_M1;
1473   TH1F* h_sumADCAmplperLS8_M2;
1474   TH1F* h_sum0ADCAmplperLS8_M2;
1475   TH1F* h_sumADCAmplLS7;
1476   TH2F* h_2DsumADCAmplLS7;
1477   TH2F* h_2DsumADCAmplLS7_LSselected;
1478   TH2F* h_2D0sumADCAmplLS7;
1479   TH1F* h_sumADCAmplperLS7;
1480   TH1F* h_sumCutADCAmplperLS7;
1481   TH1F* h_sum0ADCAmplperLS7;
1482   TH1F* h_sumADCAmplperLS7u;
1483   TH1F* h_sumCutADCAmplperLS7u;
1484   TH1F* h_sum0ADCAmplperLS7u;
1485   TH1F* h_sumADCAmplLS8;
1486   TH2F* h_2DsumADCAmplLS8;
1487   TH2F* h_2DsumADCAmplLS8_LSselected;
1488   TH1F* h_sumADCAmplperLS8;
1489   TH1F* h_sumCutADCAmplperLS8;
1490   TH2F* h_2D0sumADCAmplLS8;
1491   TH1F* h_sum0ADCAmplperLS8;
1492   TH1F* h_sumTSmeanALS1;
1493   TH2F* h_2DsumTSmeanALS1;
1494   TH1F* h_sumTSmeanAperLS1;
1495   TH1F* h_sumTSmeanAperLS1_LSselected;
1496   TH1F* h_sumCutTSmeanAperLS1;
1497   TH2F* h_2D0sumTSmeanALS1;
1498   TH1F* h_sum0TSmeanAperLS1;
1499   TH1F* h_sumTSmeanALS2;
1500   TH2F* h_2DsumTSmeanALS2;
1501   TH1F* h_sumTSmeanAperLS2;
1502   TH1F* h_sumCutTSmeanAperLS2;
1503   TH2F* h_2D0sumTSmeanALS2;
1504   TH1F* h_sum0TSmeanAperLS2;
1505   TH1F* h_sumTSmeanALS3;
1506   TH2F* h_2DsumTSmeanALS3;
1507   TH1F* h_sumTSmeanAperLS3;
1508   TH1F* h_sumCutTSmeanAperLS3;
1509   TH2F* h_2D0sumTSmeanALS3;
1510   TH1F* h_sum0TSmeanAperLS3;
1511   TH1F* h_sumTSmeanALS4;
1512   TH2F* h_2DsumTSmeanALS4;
1513   TH1F* h_sumTSmeanAperLS4;
1514   TH1F* h_sumCutTSmeanAperLS4;
1515   TH2F* h_2D0sumTSmeanALS4;
1516   TH1F* h_sum0TSmeanAperLS4;
1517   TH1F* h_sumTSmeanALS5;
1518   TH2F* h_2DsumTSmeanALS5;
1519   TH1F* h_sumTSmeanAperLS5;
1520   TH1F* h_sumCutTSmeanAperLS5;
1521   TH2F* h_2D0sumTSmeanALS5;
1522   TH1F* h_sum0TSmeanAperLS5;
1523   TH1F* h_sumTSmeanALS6;
1524   TH2F* h_2DsumTSmeanALS6;
1525   TH1F* h_sumTSmeanAperLS6;
1526   TH1F* h_sumCutTSmeanAperLS6;
1527   TH2F* h_2D0sumTSmeanALS6;
1528   TH1F* h_sum0TSmeanAperLS6;
1529   TH1F* h_sumTSmeanALS7;
1530   TH2F* h_2DsumTSmeanALS7;
1531   TH1F* h_sumTSmeanAperLS7;
1532   TH1F* h_sumCutTSmeanAperLS7;
1533   TH2F* h_2D0sumTSmeanALS7;
1534   TH1F* h_sum0TSmeanAperLS7;
1535   TH1F* h_sumTSmeanALS8;
1536   TH2F* h_2DsumTSmeanALS8;
1537   TH1F* h_sumTSmeanAperLS8;
1538   TH1F* h_sumCutTSmeanAperLS8;
1539   TH2F* h_2D0sumTSmeanALS8;
1540   TH1F* h_sum0TSmeanAperLS8;
1541   TH1F* h_sumTSmaxALS1;
1542   TH2F* h_2DsumTSmaxALS1;
1543   TH1F* h_sumTSmaxAperLS1;
1544   TH1F* h_sumTSmaxAperLS1_LSselected;
1545   TH1F* h_sumCutTSmaxAperLS1;
1546   TH2F* h_2D0sumTSmaxALS1;
1547   TH1F* h_sum0TSmaxAperLS1;
1548   TH1F* h_sumTSmaxALS2;
1549   TH2F* h_2DsumTSmaxALS2;
1550   TH1F* h_sumTSmaxAperLS2;
1551   TH1F* h_sumCutTSmaxAperLS2;
1552   TH2F* h_2D0sumTSmaxALS2;
1553   TH1F* h_sum0TSmaxAperLS2;
1554   TH1F* h_sumTSmaxALS3;
1555   TH2F* h_2DsumTSmaxALS3;
1556   TH1F* h_sumTSmaxAperLS3;
1557   TH1F* h_sumCutTSmaxAperLS3;
1558   TH2F* h_2D0sumTSmaxALS3;
1559   TH1F* h_sum0TSmaxAperLS3;
1560   TH1F* h_sumTSmaxALS4;
1561   TH2F* h_2DsumTSmaxALS4;
1562   TH1F* h_sumTSmaxAperLS4;
1563   TH1F* h_sumCutTSmaxAperLS4;
1564   TH2F* h_2D0sumTSmaxALS4;
1565   TH1F* h_sum0TSmaxAperLS4;
1566   TH1F* h_sumTSmaxALS5;
1567   TH2F* h_2DsumTSmaxALS5;
1568   TH1F* h_sumTSmaxAperLS5;
1569   TH1F* h_sumCutTSmaxAperLS5;
1570   TH2F* h_2D0sumTSmaxALS5;
1571   TH1F* h_sum0TSmaxAperLS5;
1572   TH1F* h_sumTSmaxALS6;
1573   TH2F* h_2DsumTSmaxALS6;
1574   TH1F* h_sumTSmaxAperLS6;
1575   TH1F* h_sumCutTSmaxAperLS6;
1576   TH2F* h_2D0sumTSmaxALS6;
1577   TH1F* h_sum0TSmaxAperLS6;
1578   TH1F* h_sumTSmaxALS7;
1579   TH2F* h_2DsumTSmaxALS7;
1580   TH1F* h_sumTSmaxAperLS7;
1581   TH1F* h_sumCutTSmaxAperLS7;
1582   TH2F* h_2D0sumTSmaxALS7;
1583   TH1F* h_sum0TSmaxAperLS7;
1584   TH1F* h_sumTSmaxALS8;
1585   TH2F* h_2DsumTSmaxALS8;
1586   TH1F* h_sumTSmaxAperLS8;
1587   TH1F* h_sumCutTSmaxAperLS8;
1588   TH2F* h_2D0sumTSmaxALS8;
1589   TH1F* h_sum0TSmaxAperLS8;
1590   TH1F* h_sumAmplitudeLS1;
1591   TH2F* h_2DsumAmplitudeLS1;
1592   TH1F* h_sumAmplitudeperLS1;
1593   TH1F* h_sumAmplitudeperLS1_LSselected;
1594   TH1F* h_sumCutAmplitudeperLS1;
1595   TH2F* h_2D0sumAmplitudeLS1;
1596   TH1F* h_sum0AmplitudeperLS1;
1597   TH1F* h_sumAmplitudeLS2;
1598   TH2F* h_2DsumAmplitudeLS2;
1599   TH1F* h_sumAmplitudeperLS2;
1600   TH1F* h_sumCutAmplitudeperLS2;
1601   TH2F* h_2D0sumAmplitudeLS2;
1602   TH1F* h_sum0AmplitudeperLS2;
1603   TH1F* h_sumAmplitudeLS3;
1604   TH2F* h_2DsumAmplitudeLS3;
1605   TH1F* h_sumAmplitudeperLS3;
1606   TH1F* h_sumCutAmplitudeperLS3;
1607   TH2F* h_2D0sumAmplitudeLS3;
1608   TH1F* h_sum0AmplitudeperLS3;
1609   TH1F* h_sumAmplitudeLS4;
1610   TH2F* h_2DsumAmplitudeLS4;
1611   TH1F* h_sumAmplitudeperLS4;
1612   TH1F* h_sumCutAmplitudeperLS4;
1613   TH2F* h_2D0sumAmplitudeLS4;
1614   TH1F* h_sum0AmplitudeperLS4;
1615   TH1F* h_sumAmplitudeLS5;
1616   TH2F* h_2DsumAmplitudeLS5;
1617   TH1F* h_sumAmplitudeperLS5;
1618   TH1F* h_sumCutAmplitudeperLS5;
1619   TH2F* h_2D0sumAmplitudeLS5;
1620   TH1F* h_sum0AmplitudeperLS5;
1621   TH1F* h_sumAmplitudeLS6;
1622   TH2F* h_2DsumAmplitudeLS6;
1623   TH1F* h_sumAmplitudeperLS6;
1624   TH1F* h_sumCutAmplitudeperLS6;
1625   TH2F* h_2D0sumAmplitudeLS6;
1626   TH1F* h_sum0AmplitudeperLS6;
1627   TH1F* h_sumAmplitudeLS7;
1628   TH2F* h_2DsumAmplitudeLS7;
1629   TH1F* h_sumAmplitudeperLS7;
1630   TH1F* h_sumCutAmplitudeperLS7;
1631   TH2F* h_2D0sumAmplitudeLS7;
1632   TH1F* h_sum0AmplitudeperLS7;
1633   TH1F* h_sumAmplitudeLS8;
1634   TH2F* h_2DsumAmplitudeLS8;
1635   TH1F* h_sumAmplitudeperLS8;
1636   TH1F* h_sumCutAmplitudeperLS8;
1637   TH2F* h_2D0sumAmplitudeLS8;
1638   TH1F* h_sum0AmplitudeperLS8;
1639   TH1F* h_sumAmplLS1;
1640   TH2F* h_2DsumAmplLS1;
1641   TH1F* h_sumAmplperLS1;
1642   TH1F* h_sumAmplperLS1_LSselected;
1643   TH1F* h_sumCutAmplperLS1;
1644   TH2F* h_2D0sumAmplLS1;
1645   TH1F* h_sum0AmplperLS1;
1646   TH1F* h_sumAmplLS2;
1647   TH2F* h_2DsumAmplLS2;
1648   TH1F* h_sumAmplperLS2;
1649   TH1F* h_sumCutAmplperLS2;
1650   TH2F* h_2D0sumAmplLS2;
1651   TH1F* h_sum0AmplperLS2;
1652   TH1F* h_sumAmplLS3;
1653   TH2F* h_2DsumAmplLS3;
1654   TH1F* h_sumAmplperLS3;
1655   TH1F* h_sumCutAmplperLS3;
1656   TH2F* h_2D0sumAmplLS3;
1657   TH1F* h_sum0AmplperLS3;
1658   TH1F* h_sumAmplLS4;
1659   TH2F* h_2DsumAmplLS4;
1660   TH1F* h_sumAmplperLS4;
1661   TH1F* h_sumCutAmplperLS4;
1662   TH2F* h_2D0sumAmplLS4;
1663   TH1F* h_sum0AmplperLS4;
1664   TH1F* h_sumAmplLS5;
1665   TH2F* h_2DsumAmplLS5;
1666   TH1F* h_sumAmplperLS5;
1667   TH1F* h_sumCutAmplperLS5;
1668   TH2F* h_2D0sumAmplLS5;
1669   TH1F* h_sum0AmplperLS5;
1670   TH1F* h_sumAmplLS6;
1671   TH2F* h_2DsumAmplLS6;
1672   TH1F* h_sumAmplperLS6;
1673   TH1F* h_sumCutAmplperLS6;
1674   TH2F* h_2D0sumAmplLS6;
1675   TH1F* h_sum0AmplperLS6;
1676   TH1F* h_RatioOccupancy_HBP;
1677   TH1F* h_RatioOccupancy_HBM;
1678   TH1F* h_RatioOccupancy_HEP;
1679   TH1F* h_RatioOccupancy_HEM;
1680   TH1F* h_RatioOccupancy_HOP;
1681   TH1F* h_RatioOccupancy_HOM;
1682   TH1F* h_RatioOccupancy_HFP;
1683   TH1F* h_RatioOccupancy_HFM;
1684   TH1F* h_sumAmplLS7;
1685   TH2F* h_2DsumAmplLS7;
1686   TH1F* h_sumAmplperLS7;
1687   TH1F* h_sumCutAmplperLS7;
1688   TH2F* h_2D0sumAmplLS7;
1689   TH1F* h_sum0AmplperLS7;
1690   TH1F* h_sumAmplLS8;
1691   TH2F* h_2DsumAmplLS8;
1692   TH1F* h_sumAmplperLS8;
1693   TH1F* h_sumCutAmplperLS8;
1694   TH2F* h_2D0sumAmplLS8;
1695   TH1F* h_sum0AmplperLS8;
1696   TH1F* h_pedestal0_HB;
1697   TH1F* h_pedestal1_HB;
1698   TH1F* h_pedestal2_HB;
1699   TH1F* h_pedestal3_HB;
1700   TH1F* h_pedestalaver4_HB;
1701   TH1F* h_pedestalaver9_HB;
1702   TH1F* h_pedestalw0_HB;
1703   TH1F* h_pedestalw1_HB;
1704   TH1F* h_pedestalw2_HB;
1705   TH1F* h_pedestalw3_HB;
1706   TH1F* h_pedestalwaver4_HB;
1707   TH1F* h_pedestalwaver9_HB;
1708   TH1F* h_pedestal0_HE;
1709   TH1F* h_pedestal1_HE;
1710   TH1F* h_pedestal2_HE;
1711   TH1F* h_pedestal3_HE;
1712   TH1F* h_pedestalaver4_HE;
1713   TH1F* h_pedestalaver9_HE;
1714   TH1F* h_pedestalw0_HE;
1715   TH1F* h_pedestalw1_HE;
1716   TH1F* h_pedestalw2_HE;
1717   TH1F* h_pedestalw3_HE;
1718   TH1F* h_pedestalwaver4_HE;
1719   TH1F* h_pedestalwaver9_HE;
1720   TH1F* h_pedestal0_HF;
1721   TH1F* h_pedestal1_HF;
1722   TH1F* h_pedestal2_HF;
1723   TH1F* h_pedestal3_HF;
1724   TH1F* h_pedestalaver4_HF;
1725   TH1F* h_pedestalaver9_HF;
1726   TH1F* h_pedestalw0_HF;
1727   TH1F* h_pedestalw1_HF;
1728   TH1F* h_pedestalw2_HF;
1729   TH1F* h_pedestalw3_HF;
1730   TH1F* h_pedestalwaver4_HF;
1731   TH1F* h_pedestalwaver9_HF;
1732   TH1F* h_pedestal0_HO;
1733   TH1F* h_pedestal1_HO;
1734   TH1F* h_pedestal2_HO;
1735   TH1F* h_pedestal3_HO;
1736   TH1F* h_pedestalaver4_HO;
1737   TH1F* h_pedestalaver9_HO;
1738   TH1F* h_pedestalw0_HO;
1739   TH1F* h_pedestalw1_HO;
1740   TH1F* h_pedestalw2_HO;
1741   TH1F* h_pedestalw3_HO;
1742   TH1F* h_pedestalwaver4_HO;
1743   TH1F* h_pedestalwaver9_HO;
1744   TH2F* h_mapDepth1pedestalw_HB;
1745   TH2F* h_mapDepth2pedestalw_HB;
1746   TH2F* h_mapDepth3pedestalw_HB;
1747   TH2F* h_mapDepth4pedestalw_HB;
1748   TH2F* h_mapDepth1pedestalw_HE;
1749   TH2F* h_mapDepth2pedestalw_HE;
1750   TH2F* h_mapDepth3pedestalw_HE;
1751   TH2F* h_mapDepth4pedestalw_HE;
1752   TH2F* h_mapDepth5pedestalw_HE;
1753   TH2F* h_mapDepth6pedestalw_HE;
1754   TH2F* h_mapDepth7pedestalw_HE;
1755   TH2F* h_mapDepth1pedestalw_HF;
1756   TH2F* h_mapDepth2pedestalw_HF;
1757   TH2F* h_mapDepth3pedestalw_HF;
1758   TH2F* h_mapDepth4pedestalw_HF;
1759   TH2F* h_mapDepth4pedestalw_HO;
1760   TH2F* h_mapDepth1pedestal_HB;
1761   TH2F* h_mapDepth2pedestal_HB;
1762   TH2F* h_mapDepth3pedestal_HB;
1763   TH2F* h_mapDepth4pedestal_HB;
1764   TH2F* h_mapDepth1pedestal_HE;
1765   TH2F* h_mapDepth2pedestal_HE;
1766   TH2F* h_mapDepth3pedestal_HE;
1767   TH2F* h_mapDepth4pedestal_HE;
1768   TH2F* h_mapDepth5pedestal_HE;
1769   TH2F* h_mapDepth6pedestal_HE;
1770   TH2F* h_mapDepth7pedestal_HE;
1771   TH2F* h_mapDepth1pedestal_HF;
1772   TH2F* h_mapDepth2pedestal_HF;
1773   TH2F* h_mapDepth3pedestal_HF;
1774   TH2F* h_mapDepth4pedestal_HF;
1775   TH2F* h_mapDepth4pedestal_HO;
1776   TH1F* h_pedestal00_HB;
1777   TH1F* h_gain_HB;
1778   TH1F* h_respcorr_HB;
1779   TH1F* h_timecorr_HB;
1780   TH1F* h_lutcorr_HB;
1781   TH1F* h_difpedestal0_HB;
1782   TH1F* h_difpedestal1_HB;
1783   TH1F* h_difpedestal2_HB;
1784   TH1F* h_difpedestal3_HB;
1785   TH1F* h_pedestal00_HE;
1786   TH1F* h_gain_HE;
1787   TH1F* h_respcorr_HE;
1788   TH1F* h_timecorr_HE;
1789   TH1F* h_lutcorr_HE;
1790   TH1F* h_pedestal00_HF;
1791   TH1F* h_gain_HF;
1792   TH1F* h_respcorr_HF;
1793   TH1F* h_timecorr_HF;
1794   TH1F* h_lutcorr_HF;
1795   TH1F* h_pedestal00_HO;
1796   TH1F* h_gain_HO;
1797   TH1F* h_respcorr_HO;
1798   TH1F* h_timecorr_HO;
1799   TH1F* h_lutcorr_HO;
1800   TH2F* h2_pedvsampl_HB;
1801   TH2F* h2_pedwvsampl_HB;
1802   TH1F* h_pedvsampl_HB;
1803   TH1F* h_pedwvsampl_HB;
1804   TH1F* h_pedvsampl0_HB;
1805   TH1F* h_pedwvsampl0_HB;
1806   TH2F* h2_amplvsped_HB;
1807   TH2F* h2_amplvspedw_HB;
1808   TH1F* h_amplvsped_HB;
1809   TH1F* h_amplvspedw_HB;
1810   TH1F* h_amplvsped0_HB;
1811   TH2F* h2_pedvsampl_HE;
1812   TH2F* h2_pedwvsampl_HE;
1813   TH1F* h_pedvsampl_HE;
1814   TH1F* h_pedwvsampl_HE;
1815   TH1F* h_pedvsampl0_HE;
1816   TH1F* h_pedwvsampl0_HE;
1817   TH2F* h2_pedvsampl_HF;
1818   TH2F* h2_pedwvsampl_HF;
1819   TH1F* h_pedvsampl_HF;
1820   TH1F* h_pedwvsampl_HF;
1821   TH1F* h_pedvsampl0_HF;
1822   TH1F* h_pedwvsampl0_HF;
1823   TH2F* h2_pedvsampl_HO;
1824   TH2F* h2_pedwvsampl_HO;
1825   TH1F* h_pedvsampl_HO;
1826   TH1F* h_pedwvsampl_HO;
1827   TH1F* h_pedvsampl0_HO;
1828   TH1F* h_pedwvsampl0_HO;
1829   TH1F* h_shape_Ahigh_HB0;
1830   TH1F* h_shape0_Ahigh_HB0;
1831   TH1F* h_shape_Alow_HB0;
1832   TH1F* h_shape0_Alow_HB0;
1833   TH1F* h_shape_Ahigh_HB1;
1834   TH1F* h_shape0_Ahigh_HB1;
1835   TH1F* h_shape_Alow_HB1;
1836   TH1F* h_shape0_Alow_HB1;
1837   TH1F* h_shape_Ahigh_HB2;
1838   TH1F* h_shape0_Ahigh_HB2;
1839   TH1F* h_shape_Alow_HB2;
1840   TH1F* h_shape0_Alow_HB2;
1841   TH1F* h_shape_Ahigh_HB3;
1842   TH1F* h_shape0_Ahigh_HB3;
1843   TH1F* h_shape_Alow_HB3;
1844   TH1F* h_shape0_Alow_HB3;
1845   TH1F* h_shape_bad_channels_HB;
1846   TH1F* h_shape0_bad_channels_HB;
1847   TH1F* h_shape_good_channels_HB;
1848   TH1F* h_shape0_good_channels_HB;
1849   TH1F* h_shape_bad_channels_HE;
1850   TH1F* h_shape0_bad_channels_HE;
1851   TH1F* h_shape_good_channels_HE;
1852   TH1F* h_shape0_good_channels_HE;
1853   TH1F* h_shape_bad_channels_HF;
1854   TH1F* h_shape0_bad_channels_HF;
1855   TH1F* h_shape_good_channels_HF;
1856   TH1F* h_shape0_good_channels_HF;
1857   TH1F* h_shape_bad_channels_HO;
1858   TH1F* h_shape0_bad_channels_HO;
1859   TH1F* h_shape_good_channels_HO;
1860   TH1F* h_shape0_good_channels_HO;
1861   TH1F* h_sumamplitude_depth1_HB;
1862   TH1F* h_sumamplitude_depth2_HB;
1863   TH1F* h_sumamplitude_depth1_HE;
1864   TH1F* h_sumamplitude_depth2_HE;
1865   TH1F* h_sumamplitude_depth3_HE;
1866   TH1F* h_sumamplitude_depth1_HF;
1867   TH1F* h_sumamplitude_depth2_HF;
1868   TH1F* h_sumamplitude_depth4_HO;
1869   TH1F* h_sumamplitude_depth1_HB0;
1870   TH1F* h_sumamplitude_depth2_HB0;
1871   TH1F* h_sumamplitude_depth1_HE0;
1872   TH1F* h_sumamplitude_depth2_HE0;
1873   TH1F* h_sumamplitude_depth3_HE0;
1874   TH1F* h_sumamplitude_depth1_HF0;
1875   TH1F* h_sumamplitude_depth2_HF0;
1876   TH1F* h_sumamplitude_depth4_HO0;
1877   TH1F* h_sumamplitude_depth1_HB1;
1878   TH1F* h_sumamplitude_depth2_HB1;
1879   TH1F* h_sumamplitude_depth1_HE1;
1880   TH1F* h_sumamplitude_depth2_HE1;
1881   TH1F* h_sumamplitude_depth3_HE1;
1882   TH1F* h_sumamplitude_depth1_HF1;
1883   TH1F* h_sumamplitude_depth2_HF1;
1884   TH1F* h_sumamplitude_depth4_HO1;
1885   TH2F* h_mapDepth1Ped0_HB;
1886   TH2F* h_mapDepth1Ped1_HB;
1887   TH2F* h_mapDepth1Ped2_HB;
1888   TH2F* h_mapDepth1Ped3_HB;
1889   TH2F* h_mapDepth1Pedw0_HB;
1890   TH2F* h_mapDepth1Pedw1_HB;
1891   TH2F* h_mapDepth1Pedw2_HB;
1892   TH2F* h_mapDepth1Pedw3_HB;
1893   TH2F* h_mapDepth2Ped0_HB;
1894   TH2F* h_mapDepth2Ped1_HB;
1895   TH2F* h_mapDepth2Ped2_HB;
1896   TH2F* h_mapDepth2Ped3_HB;
1897   TH2F* h_mapDepth2Pedw0_HB;
1898   TH2F* h_mapDepth2Pedw1_HB;
1899   TH2F* h_mapDepth2Pedw2_HB;
1900   TH2F* h_mapDepth2Pedw3_HB;
1901   TH2F* h_mapDepth1Ped0_HE;
1902   TH2F* h_mapDepth1Ped1_HE;
1903   TH2F* h_mapDepth1Ped2_HE;
1904   TH2F* h_mapDepth1Ped3_HE;
1905   TH2F* h_mapDepth1Pedw0_HE;
1906   TH2F* h_mapDepth1Pedw1_HE;
1907   TH2F* h_mapDepth1Pedw2_HE;
1908   TH2F* h_mapDepth1Pedw3_HE;
1909   TH2F* h_mapDepth2Ped0_HE;
1910   TH2F* h_mapDepth2Ped1_HE;
1911   TH2F* h_mapDepth2Ped2_HE;
1912   TH2F* h_mapDepth2Ped3_HE;
1913   TH2F* h_mapDepth2Pedw0_HE;
1914   TH2F* h_mapDepth2Pedw1_HE;
1915   TH2F* h_mapDepth2Pedw2_HE;
1916   TH2F* h_mapDepth2Pedw3_HE;
1917   TH2F* h_mapDepth3Ped0_HE;
1918   TH2F* h_mapDepth3Ped1_HE;
1919   TH2F* h_mapDepth3Ped2_HE;
1920   TH2F* h_mapDepth3Ped3_HE;
1921   TH2F* h_mapDepth3Pedw0_HE;
1922   TH2F* h_mapDepth3Pedw1_HE;
1923   TH2F* h_mapDepth3Pedw2_HE;
1924   TH2F* h_mapDepth3Pedw3_HE;
1925   TH2F* h_mapDepth1Ped0_HF;
1926   TH2F* h_mapDepth1Ped1_HF;
1927   TH2F* h_mapDepth1Ped2_HF;
1928   TH2F* h_mapDepth1Ped3_HF;
1929   TH2F* h_mapDepth1Pedw0_HF;
1930   TH2F* h_mapDepth1Pedw1_HF;
1931   TH2F* h_mapDepth1Pedw2_HF;
1932   TH2F* h_mapDepth1Pedw3_HF;
1933   TH2F* h_mapDepth2Ped0_HF;
1934   TH2F* h_mapDepth2Ped1_HF;
1935   TH2F* h_mapDepth2Ped2_HF;
1936   TH2F* h_mapDepth2Ped3_HF;
1937   TH2F* h_mapDepth2Pedw0_HF;
1938   TH2F* h_mapDepth2Pedw1_HF;
1939   TH2F* h_mapDepth2Pedw2_HF;
1940   TH2F* h_mapDepth2Pedw3_HF;
1941   TH2F* h_mapDepth4Ped0_HO;
1942   TH2F* h_mapDepth4Ped1_HO;
1943   TH2F* h_mapDepth4Ped2_HO;
1944   TH2F* h_mapDepth4Ped3_HO;
1945   TH2F* h_mapDepth4Pedw0_HO;
1946   TH2F* h_mapDepth4Pedw1_HO;
1947   TH2F* h_mapDepth4Pedw2_HO;
1948   TH2F* h_mapDepth4Pedw3_HO;
1949   TH2F* h_mapGetRMSOverNormalizedSignal_HB;
1950   TH2F* h_mapGetRMSOverNormalizedSignal0_HB;
1951   TH2F* h_mapGetRMSOverNormalizedSignal_HE;
1952   TH2F* h_mapGetRMSOverNormalizedSignal0_HE;
1953   TH2F* h_mapGetRMSOverNormalizedSignal_HF;
1954   TH2F* h_mapGetRMSOverNormalizedSignal0_HF;
1955   TH2F* h_mapGetRMSOverNormalizedSignal_HO;
1956   TH2F* h_mapGetRMSOverNormalizedSignal0_HO;
1957   TH2F* h_2D0sumErrorBLS1;
1958   TH2F* h_2DsumErrorBLS1;
1959   TH1F* h_sumErrorBLS1;
1960   TH1F* h_sumErrorBperLS1;
1961   TH1F* h_sum0ErrorBperLS1;
1962   TH2F* h_2D0sumErrorBLS2;
1963   TH2F* h_2DsumErrorBLS2;
1964   TH1F* h_sumErrorBLS2;
1965   TH1F* h_sumErrorBperLS2;
1966   TH1F* h_sum0ErrorBperLS2;
1967   TH2F* h_2D0sumErrorBLS3;
1968   TH2F* h_2DsumErrorBLS3;
1969   TH1F* h_sumErrorBLS3;
1970   TH1F* h_sumErrorBperLS3;
1971   TH1F* h_sum0ErrorBperLS3;
1972   TH2F* h_2D0sumErrorBLS4;
1973   TH2F* h_2DsumErrorBLS4;
1974   TH1F* h_sumErrorBLS4;
1975   TH1F* h_sumErrorBperLS4;
1976   TH1F* h_sum0ErrorBperLS4;
1977   TH2F* h_2D0sumErrorBLS5;
1978   TH2F* h_2DsumErrorBLS5;
1979   TH1F* h_sumErrorBLS5;
1980   TH1F* h_sumErrorBperLS5;
1981   TH1F* h_sum0ErrorBperLS5;
1982   TH2F* h_2D0sumErrorBLS6;
1983   TH2F* h_2DsumErrorBLS6;
1984   TH1F* h_sumErrorBLS6;
1985   TH1F* h_sumErrorBperLS6;
1986   TH1F* h_sum0ErrorBperLS6;
1987   TH2F* h_2D0sumErrorBLS7;
1988   TH2F* h_2DsumErrorBLS7;
1989   TH1F* h_sumErrorBLS7;
1990   TH1F* h_sumErrorBperLS7;
1991   TH1F* h_sum0ErrorBperLS7;
1992   TH2F* h_2D0sumErrorBLS8;
1993   TH2F* h_2DsumErrorBLS8;
1994   TH1F* h_sumErrorBLS8;
1995   TH1F* h_sumErrorBperLS8;
1996   TH1F* h_sum0ErrorBperLS8;
1997   TH1F* h_averSIGNALoccupancy_HB;
1998   TH1F* h_averSIGNALoccupancy_HE;
1999   TH1F* h_averSIGNALoccupancy_HF;
2000   TH1F* h_averSIGNALoccupancy_HO;
2001   TH1F* h_averSIGNALsumamplitude_HB;
2002   TH1F* h_averSIGNALsumamplitude_HE;
2003   TH1F* h_averSIGNALsumamplitude_HF;
2004   TH1F* h_averSIGNALsumamplitude_HO;
2005   TH1F* h_averNOSIGNALoccupancy_HB;
2006   TH1F* h_averNOSIGNALoccupancy_HE;
2007   TH1F* h_averNOSIGNALoccupancy_HF;
2008   TH1F* h_averNOSIGNALoccupancy_HO;
2009   TH1F* h_averNOSIGNALsumamplitude_HB;
2010   TH1F* h_averNOSIGNALsumamplitude_HE;
2011   TH1F* h_averNOSIGNALsumamplitude_HF;
2012   TH1F* h_averNOSIGNALsumamplitude_HO;
2013   TH1F* h_maxxSUMAmpl_HB;
2014   TH1F* h_maxxSUMAmpl_HE;
2015   TH1F* h_maxxSUMAmpl_HF;
2016   TH1F* h_maxxSUMAmpl_HO;
2017   TH1F* h_maxxOCCUP_HB;
2018   TH1F* h_maxxOCCUP_HE;
2019   TH1F* h_maxxOCCUP_HF;
2020   TH1F* h_maxxOCCUP_HO;
2021   TH1F* h_sumamplitudechannel_HB;
2022   TH1F* h_sumamplitudechannel_HE;
2023   TH1F* h_sumamplitudechannel_HF;
2024   TH1F* h_sumamplitudechannel_HO;
2025   TH1F* h_eventamplitude_HB;
2026   TH1F* h_eventamplitude_HE;
2027   TH1F* h_eventamplitude_HF;
2028   TH1F* h_eventamplitude_HO;
2029   TH1F* h_eventoccupancy_HB;
2030   TH1F* h_eventoccupancy_HE;
2031   TH1F* h_eventoccupancy_HF;
2032   TH1F* h_eventoccupancy_HO;
2033   TH2F* h_2DAtaildepth1_HB;
2034   TH2F* h_2D0Ataildepth1_HB;
2035   TH2F* h_2DAtaildepth2_HB;
2036   TH2F* h_2D0Ataildepth2_HB;
2037   TH2F* h_mapenophinorm_HE1;
2038   TH2F* h_mapenophinorm_HE2;
2039   TH2F* h_mapenophinorm_HE3;
2040   TH2F* h_mapenophinorm_HE4;
2041   TH2F* h_mapenophinorm_HE5;
2042   TH2F* h_mapenophinorm_HE6;
2043   TH2F* h_mapenophinorm_HE7;
2044   TH2F* h_mapenophinorm2_HE1;
2045   TH2F* h_mapenophinorm2_HE2;
2046   TH2F* h_mapenophinorm2_HE3;
2047   TH2F* h_mapenophinorm2_HE4;
2048   TH2F* h_mapenophinorm2_HE5;
2049   TH2F* h_mapenophinorm2_HE6;
2050   TH2F* h_mapenophinorm2_HE7;
2051   TH2F* h_maprphinorm_HE1;
2052   TH2F* h_maprphinorm_HE2;
2053   TH2F* h_maprphinorm_HE3;
2054   TH2F* h_maprphinorm_HE4;
2055   TH2F* h_maprphinorm_HE5;
2056   TH2F* h_maprphinorm_HE6;
2057   TH2F* h_maprphinorm_HE7;
2058   TH2F* h_maprphinorm2_HE1;
2059   TH2F* h_maprphinorm2_HE2;
2060   TH2F* h_maprphinorm2_HE3;
2061   TH2F* h_maprphinorm2_HE4;
2062   TH2F* h_maprphinorm2_HE5;
2063   TH2F* h_maprphinorm2_HE6;
2064   TH2F* h_maprphinorm2_HE7;
2065   TH2F* h_maprphinorm0_HE1;
2066   TH2F* h_maprphinorm0_HE2;
2067   TH2F* h_maprphinorm0_HE3;
2068   TH2F* h_maprphinorm0_HE4;
2069   TH2F* h_maprphinorm0_HE5;
2070   TH2F* h_maprphinorm0_HE6;
2071   TH2F* h_maprphinorm0_HE7;
2072   // phy-symmetry, phi-symmetry:
2073   // Reco:
2074   TH1F* h_energyhitSignal_HB;
2075   TH1F* h_energyhitSignal_HE;
2076   TH1F* h_energyhitSignal_HF;
2077   TH1F* h_energyhitNoise_HB;
2078   TH1F* h_energyhitNoise_HE;
2079   TH1F* h_energyhitNoise_HF;
2080   //HB:
2081   TH2F* h_recSignalEnergy0_HB1;
2082   TH2F* h_recSignalEnergy1_HB1;
2083   TH2F* h_recSignalEnergy2_HB1;
2084   TH2F* h_recSignalEnergy0_HB2;
2085   TH2F* h_recSignalEnergy1_HB2;
2086   TH2F* h_recSignalEnergy2_HB2;
2087   TH2F* h_recSignalEnergy0_HB3;
2088   TH2F* h_recSignalEnergy1_HB3;
2089   TH2F* h_recSignalEnergy2_HB3;
2090   TH2F* h_recSignalEnergy0_HB4;
2091   TH2F* h_recSignalEnergy1_HB4;
2092   TH2F* h_recSignalEnergy2_HB4;
2093   TH2F* h_recNoiseEnergy0_HB1;
2094   TH2F* h_recNoiseEnergy1_HB1;
2095   TH2F* h_recNoiseEnergy2_HB1;
2096   TH2F* h_recNoiseEnergy0_HB2;
2097   TH2F* h_recNoiseEnergy1_HB2;
2098   TH2F* h_recNoiseEnergy2_HB2;
2099   TH2F* h_recNoiseEnergy0_HB3;
2100   TH2F* h_recNoiseEnergy1_HB3;
2101   TH2F* h_recNoiseEnergy2_HB3;
2102   TH2F* h_recNoiseEnergy0_HB4;
2103   TH2F* h_recNoiseEnergy1_HB4;
2104   TH2F* h_recNoiseEnergy2_HB4;
2105   //HE:
2106   TH2F* h_recSignalEnergy0_HE1;
2107   TH2F* h_recSignalEnergy1_HE1;
2108   TH2F* h_recSignalEnergy2_HE1;
2109   TH2F* h_recSignalEnergy0_HE2;
2110   TH2F* h_recSignalEnergy1_HE2;
2111   TH2F* h_recSignalEnergy2_HE2;
2112   TH2F* h_recSignalEnergy0_HE3;
2113   TH2F* h_recSignalEnergy1_HE3;
2114   TH2F* h_recSignalEnergy2_HE3;
2115   TH2F* h_recSignalEnergy0_HE4;
2116   TH2F* h_recSignalEnergy1_HE4;
2117   TH2F* h_recSignalEnergy2_HE4;
2118   TH2F* h_recSignalEnergy0_HE5;
2119   TH2F* h_recSignalEnergy1_HE5;
2120   TH2F* h_recSignalEnergy2_HE5;
2121   TH2F* h_recSignalEnergy0_HE6;
2122   TH2F* h_recSignalEnergy1_HE6;
2123   TH2F* h_recSignalEnergy2_HE6;
2124   TH2F* h_recSignalEnergy0_HE7;
2125   TH2F* h_recSignalEnergy1_HE7;
2126   TH2F* h_recSignalEnergy2_HE7;
2127   TH2F* h_recNoiseEnergy0_HE1;
2128   TH2F* h_recNoiseEnergy1_HE1;
2129   TH2F* h_recNoiseEnergy2_HE1;
2130   TH2F* h_recNoiseEnergy0_HE2;
2131   TH2F* h_recNoiseEnergy1_HE2;
2132   TH2F* h_recNoiseEnergy2_HE2;
2133   TH2F* h_recNoiseEnergy0_HE3;
2134   TH2F* h_recNoiseEnergy1_HE3;
2135   TH2F* h_recNoiseEnergy2_HE3;
2136   TH2F* h_recNoiseEnergy0_HE4;
2137   TH2F* h_recNoiseEnergy1_HE4;
2138   TH2F* h_recNoiseEnergy2_HE4;
2139   TH2F* h_recNoiseEnergy0_HE5;
2140   TH2F* h_recNoiseEnergy1_HE5;
2141   TH2F* h_recNoiseEnergy2_HE5;
2142   TH2F* h_recNoiseEnergy0_HE6;
2143   TH2F* h_recNoiseEnergy1_HE6;
2144   TH2F* h_recNoiseEnergy2_HE6;
2145   TH2F* h_recNoiseEnergy0_HE7;
2146   TH2F* h_recNoiseEnergy1_HE7;
2147   TH2F* h_recNoiseEnergy2_HE7;
2148   //HF:
2149   TH2F* h_recSignalEnergy0_HF1;
2150   TH2F* h_recSignalEnergy1_HF1;
2151   TH2F* h_recSignalEnergy2_HF1;
2152   TH2F* h_recSignalEnergy0_HF2;
2153   TH2F* h_recSignalEnergy1_HF2;
2154   TH2F* h_recSignalEnergy2_HF2;
2155   TH2F* h_recSignalEnergy0_HF3;
2156   TH2F* h_recSignalEnergy1_HF3;
2157   TH2F* h_recSignalEnergy2_HF3;
2158   TH2F* h_recSignalEnergy0_HF4;
2159   TH2F* h_recSignalEnergy1_HF4;
2160   TH2F* h_recSignalEnergy2_HF4;
2161 
2162   TH2F* h_recNoiseEnergy0_HF1;
2163   TH2F* h_recNoiseEnergy1_HF1;
2164   TH2F* h_recNoiseEnergy2_HF1;
2165   TH2F* h_recNoiseEnergy0_HF2;
2166   TH2F* h_recNoiseEnergy1_HF2;
2167   TH2F* h_recNoiseEnergy2_HF2;
2168   TH2F* h_recNoiseEnergy0_HF3;
2169   TH2F* h_recNoiseEnergy1_HF3;
2170   TH2F* h_recNoiseEnergy2_HF3;
2171   TH2F* h_recNoiseEnergy0_HF4;
2172   TH2F* h_recNoiseEnergy1_HF4;
2173   TH2F* h_recNoiseEnergy2_HF4;
2174 
2175   TH2F* h_amplitudechannel0_HB1;
2176   TH2F* h_amplitudechannel1_HB1;
2177   TH2F* h_amplitudechannel2_HB1;
2178   TH2F* h_amplitudechannel0_HB2;
2179   TH2F* h_amplitudechannel1_HB2;
2180   TH2F* h_amplitudechannel2_HB2;
2181   TH2F* h_amplitudechannel0_HB3;
2182   TH2F* h_amplitudechannel1_HB3;
2183   TH2F* h_amplitudechannel2_HB3;
2184   TH2F* h_amplitudechannel0_HB4;
2185   TH2F* h_amplitudechannel1_HB4;
2186   TH2F* h_amplitudechannel2_HB4;
2187   TH2F* h_amplitudechannel0_HE1;
2188   TH2F* h_amplitudechannel1_HE1;
2189   TH2F* h_amplitudechannel2_HE1;
2190   TH2F* h_amplitudechannel0_HE2;
2191   TH2F* h_amplitudechannel1_HE2;
2192   TH2F* h_amplitudechannel2_HE2;
2193   TH2F* h_amplitudechannel0_HE3;
2194   TH2F* h_amplitudechannel1_HE3;
2195   TH2F* h_amplitudechannel2_HE3;
2196   TH2F* h_amplitudechannel0_HE4;
2197   TH2F* h_amplitudechannel1_HE4;
2198   TH2F* h_amplitudechannel2_HE4;
2199   TH2F* h_amplitudechannel0_HE5;
2200   TH2F* h_amplitudechannel1_HE5;
2201   TH2F* h_amplitudechannel2_HE5;
2202   TH2F* h_amplitudechannel0_HE6;
2203   TH2F* h_amplitudechannel1_HE6;
2204   TH2F* h_amplitudechannel2_HE6;
2205   TH2F* h_amplitudechannel0_HE7;
2206   TH2F* h_amplitudechannel1_HE7;
2207   TH2F* h_amplitudechannel2_HE7;
2208   TH2F* h_amplitudechannel0_HF1;
2209   TH2F* h_amplitudechannel1_HF1;
2210   TH2F* h_amplitudechannel2_HF1;
2211   TH2F* h_amplitudechannel0_HF2;
2212   TH2F* h_amplitudechannel1_HF2;
2213   TH2F* h_amplitudechannel2_HF2;
2214   TH2F* h_amplitudechannel0_HF3;
2215   TH2F* h_amplitudechannel1_HF3;
2216   TH2F* h_amplitudechannel2_HF3;
2217   TH2F* h_amplitudechannel0_HF4;
2218   TH2F* h_amplitudechannel1_HF4;
2219   TH2F* h_amplitudechannel2_HF4;
2220 
2221   TH2F* h_mapDepth1RADDAM_HE;
2222   TH2F* h_mapDepth2RADDAM_HE;
2223   TH2F* h_mapDepth3RADDAM_HE;
2224   TH1F* h_sigLayer1RADDAM_HE;
2225   TH1F* h_sigLayer2RADDAM_HE;
2226   TH1F* h_sigLayer1RADDAM0_HE;
2227   TH1F* h_sigLayer2RADDAM0_HE;
2228   TH1F* h_mapDepth3RADDAM16_HE;
2229   TH2F* h_mapDepth1RADDAM0_HE;
2230   TH2F* h_mapDepth2RADDAM0_HE;
2231   TH2F* h_mapDepth3RADDAM0_HE;
2232   TH1F* h_AamplitudewithPedSubtr_RADDAM_HE;
2233   TH1F* h_AamplitudewithPedSubtr_RADDAM_HEzoom0;
2234   TH1F* h_AamplitudewithPedSubtr_RADDAM_HEzoom1;
2235   TH1F* h_A_Depth1RADDAM_HE;
2236   TH1F* h_A_Depth2RADDAM_HE;
2237   TH1F* h_A_Depth3RADDAM_HE;
2238   TH1F* h_sumphiEta16Depth3RADDAM_HED2;
2239   TH1F* h_Eta16Depth3RADDAM_HED2;
2240   TH1F* h_NphiForEta16Depth3RADDAM_HED2;
2241   TH1F* h_sumphiEta16Depth3RADDAM_HED2P;
2242   TH1F* h_Eta16Depth3RADDAM_HED2P;
2243   TH1F* h_NphiForEta16Depth3RADDAM_HED2P;
2244   TH1F* h_sumphiEta16Depth3RADDAM_HED2ALL;
2245   TH1F* h_Eta16Depth3RADDAM_HED2ALL;
2246   TH1F* h_NphiForEta16Depth3RADDAM_HED2ALL;
2247   TH1F* h_sigLayer1RADDAM5_HE;
2248   TH1F* h_sigLayer2RADDAM5_HE;
2249   TH1F* h_sigLayer1RADDAM6_HE;
2250   TH1F* h_sigLayer2RADDAM6_HE;
2251   TH1F* h_sigLayer1RADDAM5_HED2;
2252   TH1F* h_sigLayer1RADDAM6_HED2;
2253   TH1F* h_sigLayer2RADDAM5_HED2;
2254   TH1F* h_sigLayer2RADDAM6_HED2;
2255   TH2F* h2_TSnVsAyear2023_HB;
2256   TH2F* h2_TSnVsAyear2023_HE;
2257   TH2F* h2_TSnVsAyear2023_HF;
2258   TH2F* h2_TSnVsAyear2023_HO;
2259   TH1F* h1_TSnVsAyear2023_HB;
2260   TH1F* h1_TSnVsAyear2023_HE;
2261   TH1F* h1_TSnVsAyear2023_HF;
2262   TH1F* h1_TSnVsAyear2023_HO;
2263   TH1F* h1_TSnVsAyear20230_HB;
2264   TH1F* h1_TSnVsAyear20230_HE;
2265   TH1F* h1_TSnVsAyear20230_HF;
2266   TH1F* h1_TSnVsAyear20230_HO;
2267 
2268   int calibcapiderror[ndepth][neta][nphi];
2269   float calibt[ndepth][neta][nphi];
2270   double caliba[ndepth][neta][nphi];
2271   double calibw[ndepth][neta][nphi];
2272   double calib0[ndepth][neta][nphi];
2273   double signal[ndepth][neta][nphi];
2274   double calib3[ndepth][neta][nphi];
2275   double signal3[ndepth][neta][nphi];
2276   double calib2[ndepth][neta][nphi];
2277   int badchannels[nsub][ndepth][neta][nphi];
2278   double sumEstimator0[nsub][ndepth][neta][nphi];
2279   double sumEstimator1[nsub][ndepth][neta][nphi];
2280   double sumEstimator2[nsub][ndepth][neta][nphi];
2281   double sumEstimator3[nsub][ndepth][neta][nphi];
2282   double sumEstimator4[nsub][ndepth][neta][nphi];
2283   double sumEstimator5[nsub][ndepth][neta][nphi];
2284   double sumEstimator6[nsub][ndepth][neta][nphi];
2285   double sum0Estimator[nsub][ndepth][neta][nphi];
2286 
2287   // phi-symmetry monitoring for calibration group:
2288   double amplitudechannel0[nsub][ndepth][neta][nphi];
2289   double amplitudechannel[nsub][ndepth][neta][nphi];
2290   double amplitudechannel2[nsub][ndepth][neta][nphi];
2291   double tocamplchannel[nsub][ndepth][neta][nphi];
2292   double maprphinorm[nsub][ndepth][neta][nphi];
2293 
2294   double recNoiseEnergy0[nsub][ndepth][neta][nphi];
2295   double recNoiseEnergy1[nsub][ndepth][neta][nphi];
2296   double recNoiseEnergy2[nsub][ndepth][neta][nphi];
2297 
2298   double recSignalEnergy0[nsub][ndepth][neta][nphi];
2299   double recSignalEnergy1[nsub][ndepth][neta][nphi];
2300   double recSignalEnergy2[nsub][ndepth][neta][nphi];
2301 
2302   float TS_data[100];
2303   float TS_cal[100];
2304   double mapRADDAM_HE[ndepth][neta][nphi];
2305   int mapRADDAM0_HE[ndepth][neta][nphi];
2306   double mapRADDAM_HED2[ndepth][neta];
2307   int mapRADDAM_HED20[ndepth][neta];
2308   float binanpfit = anpfit / npfit;
2309   long int gsmdepth1sipm[npfit][neta][nphi][ndepth];
2310   /////////////////////////////////////////////
2311   long int Nevent;
2312   int Run;
2313   int run0;
2314   int runcounter;
2315   int eventcounter;
2316   long int orbitNum;
2317   int bcn;
2318   int lumi;
2319   int ls0;
2320   int lscounter;
2321   int lscounterM1;
2322   int lscounter10;
2323   int nevcounter;
2324   int lscounterrun;
2325   int lscounterrun10;
2326   int nevcounter0;
2327   int nevcounter00;
2328   double averSIGNALoccupancy_HB;
2329   double averSIGNALoccupancy_HE;
2330   double averSIGNALoccupancy_HF;
2331   double averSIGNALoccupancy_HO;
2332   double averSIGNALsumamplitude_HB;
2333   double averSIGNALsumamplitude_HE;
2334   double averSIGNALsumamplitude_HF;
2335   double averSIGNALsumamplitude_HO;
2336   double averNOSIGNALoccupancy_HB;
2337   double averNOSIGNALoccupancy_HE;
2338   double averNOSIGNALoccupancy_HF;
2339   double averNOSIGNALoccupancy_HO;
2340   double averNOSIGNALsumamplitude_HB;
2341   double averNOSIGNALsumamplitude_HE;
2342   double averNOSIGNALsumamplitude_HF;
2343   double averNOSIGNALsumamplitude_HO;
2344   double maxxSUM1;
2345   double maxxSUM2;
2346   double maxxSUM3;
2347   double maxxSUM4;
2348   double maxxOCCUP1;
2349   double maxxOCCUP2;
2350   double maxxOCCUP3;
2351   double maxxOCCUP4;
2352   TTree* myTree;
2353   TFile* hOutputFile;
2354   std::ofstream MAPfile;
2355   /////////////////////////////////////////
2356   // Get RBX number from 1-35 for Calibration box
2357   int getRBX(int& i, int& j, int& k);
2358   void fillDigiErrors(HBHEDigiCollection::const_iterator& digiItr);
2359   void fillDigiErrorsHF(HFDigiCollection::const_iterator& digiItr);
2360   void fillDigiErrorsHO(HODigiCollection::const_iterator& digiItr);
2361   // upgrade:
2362   void fillDigiErrorsHFQIE10(QIE10DataFrame qie10df);
2363   void fillDigiErrorsQIE11(QIE11DataFrame qie11df);
2364   void fillDigiAmplitude(HBHEDigiCollection::const_iterator& digiItr);
2365   void fillDigiAmplitudeHF(HFDigiCollection::const_iterator& digiItr);
2366   void fillDigiAmplitudeHO(HODigiCollection::const_iterator& digiItr);
2367   // upgrade:
2368   void fillDigiAmplitudeHFQIE10(QIE10DataFrame qie10df);
2369   void fillDigiAmplitudeQIE11(QIE11DataFrame qie11df);
2370   int local_event;
2371   int eta, phi, depth, nTS, cap_num;
2372   int numOfTS;
2373   int numOfLaserEv;
2374   int testmetka;
2375   float alsmin;
2376   float blsmax;
2377   int nlsminmax;
2378 };
2379 
2380 //
2381 /////////////////////////////// -------------------------------------------------------------------
2382 //
2383 void CMTRawAnalyzer::endJob() {
2384   if (verbosity > 0)
2385     std::cout << "==============    endJob  ===================================" << std::endl;
2386 
2387   std::cout << " --------------------------------------- " << std::endl;
2388   std::cout << " for Run = " << run0 << " with runcounter = " << runcounter << " #ev = " << eventcounter << std::endl;
2389   std::cout << " #LS =  " << lscounterrun << " #LS10 =  " << lscounterrun10 << " Last LS =  " << ls0 << std::endl;
2390   std::cout << " --------------------------------------------- " << std::endl;
2391   h_nls_per_run->Fill(float(lscounterrun));
2392   h_nls_per_run10->Fill(float(lscounterrun10));
2393 
2394   ///////////////////////////////////////////////////////////////////////////////////////////////
2395   std::cout << "===== full number of events =  " << nevent << std::endl;
2396   std::cout << "===== possible max number of events in ntuple(each 50th recorded) =  " << nevent50 << std::endl;
2397   std::cout << "===== but limited by maxNeventsInNtuple  =  " << maxNeventsInNtuple_ << std::endl;
2398   std::cout << "===== full number of events*HBHEdigis and qie11 =  " << nnnnnnhbhe << "   and  " << nnnnnnhbheqie11
2399             << std::endl;
2400   std::cout << "===== full number of events*HBHEdigis =  " << nnnnnn << std::endl;
2401   std::cout << "===== full number of events*HFdigis and qie10 =  " << counterhf << "   and  " << counterhfqie10
2402             << std::endl;
2403   std::cout << "===== full number of events*HOdigis =  " << counterho << std::endl;
2404 
2405   std::cout << "===== Start writing user histograms =====" << std::endl;
2406   //////////////////////////////////////////////////////////////////////   scaling of some histoes:
2407   ///////////////////////////////////////////->Write();
2408 }
2409 //
2410 
2411 //
2412 //
2413 CMTRawAnalyzer::CMTRawAnalyzer(const edm::ParameterSet& iConfig)
2414     : tokDB_(esConsumes<HcalDbService, HcalDbRecord>()), tokTopo_(esConsumes<HcalTopology, HcalRecNumberingRecord>()) {
2415   usesResource(TFileService::kSharedResource);
2416   verbosity = iConfig.getUntrackedParameter<int>("Verbosity");
2417   MAPcreation = iConfig.getUntrackedParameter<int>("MapCreation");
2418   recordNtuples_ = iConfig.getUntrackedParameter<bool>("recordNtuples");
2419   maxNeventsInNtuple_ = iConfig.getParameter<int>("maxNeventsInNtuple");
2420   tok_calib_ = consumes<HcalCalibDigiCollection>(iConfig.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag"));  //
2421   tok_hbhe_ = consumes<HBHEDigiCollection>(iConfig.getParameter<edm::InputTag>("hbheDigiCollectionTag"));
2422   tok_ho_ = consumes<HODigiCollection>(iConfig.getParameter<edm::InputTag>("hoDigiCollectionTag"));
2423   tok_hf_ = consumes<HFDigiCollection>(iConfig.getParameter<edm::InputTag>("hfDigiCollectionTag"));  //
2424   tok_qie11_ = consumes<QIE11DigiCollection>(iConfig.getParameter<edm::InputTag>("hbheQIE11DigiCollectionTag"));
2425   tok_qie10_ = consumes<QIE10DigiCollection>(iConfig.getParameter<edm::InputTag>("hbheQIE10DigiCollectionTag"));
2426   // phi-symmetry monitoring for calibration group:
2427   tok_hbheSignal_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputSignalTag"));
2428   tok_hbheNoise_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputNoiseTag"));
2429   tok_hfSignal_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputSignalTag"));
2430   tok_hfNoise_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputNoiseTag"));
2431   recordHistoes_ = iConfig.getUntrackedParameter<bool>("recordHistoes");
2432   studyRunDependenceHist_ = iConfig.getUntrackedParameter<bool>("studyRunDependenceHist");
2433   studyCapIDErrorsHist_ = iConfig.getUntrackedParameter<bool>("studyCapIDErrorsHist");
2434   studyRMSshapeHist_ = iConfig.getUntrackedParameter<bool>("studyRMSshapeHist");
2435   studyRatioShapeHist_ = iConfig.getUntrackedParameter<bool>("studyRatioShapeHist");
2436   studyTSmaxShapeHist_ = iConfig.getUntrackedParameter<bool>("studyTSmaxShapeHist");
2437   studyTSmeanShapeHist_ = iConfig.getUntrackedParameter<bool>("studyTSmeanShapeHist");
2438   studyDiffAmplHist_ = iConfig.getUntrackedParameter<bool>("studyDiffAmplHist");
2439   studyCalibCellsHist_ = iConfig.getUntrackedParameter<bool>("studyCalibCellsHist");
2440   studyADCAmplHist_ = iConfig.getUntrackedParameter<bool>("studyADCAmplHist");
2441   studyPedestalsHist_ = iConfig.getUntrackedParameter<bool>("studyPedestalsHist");
2442   studyPedestalCorrelations_ = iConfig.getUntrackedParameter<bool>("studyPedestalCorrelations");
2443   useADCmassive_ = iConfig.getUntrackedParameter<bool>("useADCmassive");
2444   useADCfC_ = iConfig.getUntrackedParameter<bool>("useADCfC");
2445   useADCcounts_ = iConfig.getUntrackedParameter<bool>("useADCcounts");
2446   usePedestalSubtraction_ = iConfig.getUntrackedParameter<bool>("usePedestalSubtraction");
2447   usecontinuousnumbering_ = iConfig.getUntrackedParameter<bool>("usecontinuousnumbering");
2448   flagLaserRaddam_ = iConfig.getParameter<int>("flagLaserRaddam");
2449   flagToUseDigiCollectionsORNot_ = iConfig.getParameter<int>("flagToUseDigiCollectionsORNot");
2450   flagIterativeMethodCalibrationGroupDigi_ = iConfig.getParameter<int>("flagIterativeMethodCalibrationGroupDigi");
2451   flagIterativeMethodCalibrationGroupReco_ = iConfig.getParameter<int>("flagIterativeMethodCalibrationGroupReco");
2452   flagfitshunt1pedorledlowintensity_ = iConfig.getParameter<int>("flagfitshunt1pedorledlowintensity");
2453   flagabortgaprejected_ = iConfig.getParameter<int>("flagabortgaprejected");
2454   bcnrejectedlow_ = iConfig.getParameter<int>("bcnrejectedlow");
2455   bcnrejectedhigh_ = iConfig.getParameter<int>("bcnrejectedhigh");
2456   ratioHBMin_ = iConfig.getParameter<double>("ratioHBMin");
2457   ratioHBMax_ = iConfig.getParameter<double>("ratioHBMax");
2458   ratioHEMin_ = iConfig.getParameter<double>("ratioHEMin");
2459   ratioHEMax_ = iConfig.getParameter<double>("ratioHEMax");
2460   ratioHFMin_ = iConfig.getParameter<double>("ratioHFMin");
2461   ratioHFMax_ = iConfig.getParameter<double>("ratioHFMax");
2462   ratioHOMin_ = iConfig.getParameter<double>("ratioHOMin");
2463   ratioHOMax_ = iConfig.getParameter<double>("ratioHOMax");
2464   flagtodefinebadchannel_ = iConfig.getParameter<int>("flagtodefinebadchannel");
2465   howmanybinsonplots_ = iConfig.getParameter<int>("howmanybinsonplots");
2466   splashesUpperLimit_ = iConfig.getParameter<int>("splashesUpperLimit");
2467   flagtoaskrunsorls_ = iConfig.getParameter<int>("flagtoaskrunsorls");
2468   flagestimatornormalization_ = iConfig.getParameter<int>("flagestimatornormalization");
2469   flagcpuoptimization_ = iConfig.getParameter<int>("flagcpuoptimization");
2470   flagupgradeqie1011_ = iConfig.getParameter<int>("flagupgradeqie1011");
2471   flagsipmcorrection_ = iConfig.getParameter<int>("flagsipmcorrection");
2472   flaguseshunt_ = iConfig.getParameter<int>("flaguseshunt");
2473   lsdep_cut1_peak_HBdepth1_ = iConfig.getParameter<int>("lsdep_cut1_peak_HBdepth1");
2474   lsdep_cut1_peak_HBdepth2_ = iConfig.getParameter<int>("lsdep_cut1_peak_HBdepth2");
2475   lsdep_cut1_peak_HEdepth1_ = iConfig.getParameter<int>("lsdep_cut1_peak_HEdepth1");
2476   lsdep_cut1_peak_HEdepth2_ = iConfig.getParameter<int>("lsdep_cut1_peak_HEdepth2");
2477   lsdep_cut1_peak_HEdepth3_ = iConfig.getParameter<int>("lsdep_cut1_peak_HEdepth3");
2478   lsdep_cut1_peak_HFdepth1_ = iConfig.getParameter<int>("lsdep_cut1_peak_HFdepth1");
2479   lsdep_cut1_peak_HFdepth2_ = iConfig.getParameter<int>("lsdep_cut1_peak_HFdepth2");
2480   lsdep_cut1_peak_HOdepth4_ = iConfig.getParameter<int>("lsdep_cut1_peak_HOdepth4");
2481   lsdep_cut3_max_HBdepth1_ = iConfig.getParameter<int>("lsdep_cut3_max_HBdepth1");
2482   lsdep_cut3_max_HBdepth2_ = iConfig.getParameter<int>("lsdep_cut3_max_HBdepth2");
2483   lsdep_cut3_max_HEdepth1_ = iConfig.getParameter<int>("lsdep_cut3_max_HEdepth1");
2484   lsdep_cut3_max_HEdepth2_ = iConfig.getParameter<int>("lsdep_cut3_max_HEdepth2");
2485   lsdep_cut3_max_HEdepth3_ = iConfig.getParameter<int>("lsdep_cut3_max_HEdepth3");
2486   lsdep_cut3_max_HFdepth1_ = iConfig.getParameter<int>("lsdep_cut3_max_HFdepth1");
2487   lsdep_cut3_max_HFdepth2_ = iConfig.getParameter<int>("lsdep_cut3_max_HFdepth2");
2488   lsdep_cut3_max_HOdepth4_ = iConfig.getParameter<int>("lsdep_cut3_max_HOdepth4");
2489   lsdep_estimator1_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator1_HBdepth1");
2490   lsdep_estimator1_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator1_HBdepth2");
2491   lsdep_estimator1_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth1");
2492   lsdep_estimator1_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth2");
2493   lsdep_estimator1_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth3");
2494   lsdep_estimator1_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator1_HFdepth1");
2495   lsdep_estimator1_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator1_HFdepth2");
2496   lsdep_estimator1_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator1_HOdepth4");
2497   lsdep_estimator1_HEdepth4_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth4");
2498   lsdep_estimator1_HEdepth5_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth5");
2499   lsdep_estimator1_HEdepth6_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth6");
2500   lsdep_estimator1_HEdepth7_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth7");
2501   lsdep_estimator1_HFdepth3_ = iConfig.getParameter<double>("lsdep_estimator1_HFdepth3");
2502   lsdep_estimator1_HFdepth4_ = iConfig.getParameter<double>("lsdep_estimator1_HFdepth4");
2503   lsdep_estimator1_HBdepth3_ = iConfig.getParameter<double>("lsdep_estimator1_HBdepth3");
2504   lsdep_estimator1_HBdepth4_ = iConfig.getParameter<double>("lsdep_estimator1_HBdepth4");
2505   lsdep_estimator2_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator2_HBdepth1");
2506   lsdep_estimator2_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator2_HBdepth2");
2507   lsdep_estimator2_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator2_HEdepth1");
2508   lsdep_estimator2_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator2_HEdepth2");
2509   lsdep_estimator2_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator2_HEdepth3");
2510   lsdep_estimator2_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator2_HFdepth1");
2511   lsdep_estimator2_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator2_HFdepth2");
2512   lsdep_estimator2_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator2_HOdepth4");
2513   lsdep_estimator3_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator3_HBdepth1");
2514   lsdep_estimator3_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator3_HBdepth2");
2515   lsdep_estimator3_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator3_HEdepth1");
2516   lsdep_estimator3_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator3_HEdepth2");
2517   lsdep_estimator3_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator3_HEdepth3");
2518   lsdep_estimator3_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator3_HFdepth1");
2519   lsdep_estimator3_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator3_HFdepth2");
2520   lsdep_estimator3_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator3_HOdepth4");
2521   lsdep_estimator4_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator4_HBdepth1");
2522   lsdep_estimator4_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator4_HBdepth2");
2523   lsdep_estimator4_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator4_HEdepth1");
2524   lsdep_estimator4_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator4_HEdepth2");
2525   lsdep_estimator4_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator4_HEdepth3");
2526   lsdep_estimator4_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator4_HFdepth1");
2527   lsdep_estimator4_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator4_HFdepth2");
2528   lsdep_estimator4_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator4_HOdepth4");
2529   lsdep_estimator5_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator5_HBdepth1");
2530   lsdep_estimator5_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator5_HBdepth2");
2531   lsdep_estimator5_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator5_HEdepth1");
2532   lsdep_estimator5_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator5_HEdepth2");
2533   lsdep_estimator5_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator5_HEdepth3");
2534   lsdep_estimator5_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator5_HFdepth1");
2535   lsdep_estimator5_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator5_HFdepth2");
2536   lsdep_estimator5_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator5_HOdepth4");
2537   forallestimators_amplitude_bigger_ = iConfig.getParameter<double>("forallestimators_amplitude_bigger");
2538   rmsHBMin_ = iConfig.getParameter<double>("rmsHBMin");
2539   rmsHBMax_ = iConfig.getParameter<double>("rmsHBMax");
2540   rmsHEMin_ = iConfig.getParameter<double>("rmsHEMin");
2541   rmsHEMax_ = iConfig.getParameter<double>("rmsHEMax");
2542   rmsHFMin_ = iConfig.getParameter<double>("rmsHFMin");
2543   rmsHFMax_ = iConfig.getParameter<double>("rmsHFMax");
2544   rmsHOMin_ = iConfig.getParameter<double>("rmsHOMin");
2545   rmsHOMax_ = iConfig.getParameter<double>("rmsHOMax");
2546   ADCAmplHBMin_ = iConfig.getParameter<double>("ADCAmplHBMin");
2547   ADCAmplHEMin_ = iConfig.getParameter<double>("ADCAmplHEMin");
2548   ADCAmplHOMin_ = iConfig.getParameter<double>("ADCAmplHOMin");
2549   ADCAmplHFMin_ = iConfig.getParameter<double>("ADCAmplHFMin");
2550   ADCAmplHBMax_ = iConfig.getParameter<double>("ADCAmplHBMax");
2551   ADCAmplHEMax_ = iConfig.getParameter<double>("ADCAmplHEMax");
2552   ADCAmplHOMax_ = iConfig.getParameter<double>("ADCAmplHOMax");
2553   ADCAmplHFMax_ = iConfig.getParameter<double>("ADCAmplHFMax");
2554   pedestalwHBMax_ = iConfig.getParameter<double>("pedestalwHBMax");
2555   pedestalwHEMax_ = iConfig.getParameter<double>("pedestalwHEMax");
2556   pedestalwHFMax_ = iConfig.getParameter<double>("pedestalwHFMax");
2557   pedestalwHOMax_ = iConfig.getParameter<double>("pedestalwHOMax");
2558   pedestalHBMax_ = iConfig.getParameter<double>("pedestalHBMax");
2559   pedestalHEMax_ = iConfig.getParameter<double>("pedestalHEMax");
2560   pedestalHFMax_ = iConfig.getParameter<double>("pedestalHFMax");
2561   pedestalHOMax_ = iConfig.getParameter<double>("pedestalHOMax");
2562   calibrADCHBMin_ = iConfig.getParameter<double>("calibrADCHBMin");
2563   calibrADCHEMin_ = iConfig.getParameter<double>("calibrADCHEMin");
2564   calibrADCHOMin_ = iConfig.getParameter<double>("calibrADCHOMin");
2565   calibrADCHFMin_ = iConfig.getParameter<double>("calibrADCHFMin");
2566   calibrADCHBMax_ = iConfig.getParameter<double>("calibrADCHBMax");
2567   calibrADCHEMax_ = iConfig.getParameter<double>("calibrADCHEMax");
2568   calibrADCHOMax_ = iConfig.getParameter<double>("calibrADCHOMax");
2569   calibrADCHFMax_ = iConfig.getParameter<double>("calibrADCHFMax");
2570   calibrRatioHBMin_ = iConfig.getParameter<double>("calibrRatioHBMin");
2571   calibrRatioHEMin_ = iConfig.getParameter<double>("calibrRatioHEMin");
2572   calibrRatioHOMin_ = iConfig.getParameter<double>("calibrRatioHOMin");
2573   calibrRatioHFMin_ = iConfig.getParameter<double>("calibrRatioHFMin");
2574   calibrRatioHBMax_ = iConfig.getParameter<double>("calibrRatioHBMax");
2575   calibrRatioHEMax_ = iConfig.getParameter<double>("calibrRatioHEMax");
2576   calibrRatioHOMax_ = iConfig.getParameter<double>("calibrRatioHOMax");
2577   calibrRatioHFMax_ = iConfig.getParameter<double>("calibrRatioHFMax");
2578   calibrTSmaxHBMin_ = iConfig.getParameter<double>("calibrTSmaxHBMin");
2579   calibrTSmaxHEMin_ = iConfig.getParameter<double>("calibrTSmaxHEMin");
2580   calibrTSmaxHOMin_ = iConfig.getParameter<double>("calibrTSmaxHOMin");
2581   calibrTSmaxHFMin_ = iConfig.getParameter<double>("calibrTSmaxHFMin");
2582   calibrTSmaxHBMax_ = iConfig.getParameter<double>("calibrTSmaxHBMax");
2583   calibrTSmaxHEMax_ = iConfig.getParameter<double>("calibrTSmaxHEMax");
2584   calibrTSmaxHOMax_ = iConfig.getParameter<double>("calibrTSmaxHOMax");
2585   calibrTSmaxHFMax_ = iConfig.getParameter<double>("calibrTSmaxHFMax");
2586   calibrTSmeanHBMin_ = iConfig.getParameter<double>("calibrTSmeanHBMin");
2587   calibrTSmeanHEMin_ = iConfig.getParameter<double>("calibrTSmeanHEMin");
2588   calibrTSmeanHOMin_ = iConfig.getParameter<double>("calibrTSmeanHOMin");
2589   calibrTSmeanHFMin_ = iConfig.getParameter<double>("calibrTSmeanHFMin");
2590   calibrTSmeanHBMax_ = iConfig.getParameter<double>("calibrTSmeanHBMax");
2591   calibrTSmeanHEMax_ = iConfig.getParameter<double>("calibrTSmeanHEMax");
2592   calibrTSmeanHOMax_ = iConfig.getParameter<double>("calibrTSmeanHOMax");
2593   calibrTSmeanHFMax_ = iConfig.getParameter<double>("calibrTSmeanHFMax");
2594   calibrWidthHBMin_ = iConfig.getParameter<double>("calibrWidthHBMin");
2595   calibrWidthHEMin_ = iConfig.getParameter<double>("calibrWidthHEMin");
2596   calibrWidthHOMin_ = iConfig.getParameter<double>("calibrWidthHOMin");
2597   calibrWidthHFMin_ = iConfig.getParameter<double>("calibrWidthHFMin");
2598   calibrWidthHBMax_ = iConfig.getParameter<double>("calibrWidthHBMax");
2599   calibrWidthHEMax_ = iConfig.getParameter<double>("calibrWidthHEMax");
2600   calibrWidthHOMax_ = iConfig.getParameter<double>("calibrWidthHOMax");
2601   calibrWidthHFMax_ = iConfig.getParameter<double>("calibrWidthHFMax");
2602   TSpeakHBMin_ = iConfig.getParameter<double>("TSpeakHBMin");
2603   TSpeakHBMax_ = iConfig.getParameter<double>("TSpeakHBMax");
2604   TSpeakHEMin_ = iConfig.getParameter<double>("TSpeakHEMin");
2605   TSpeakHEMax_ = iConfig.getParameter<double>("TSpeakHEMax");
2606   TSpeakHFMin_ = iConfig.getParameter<double>("TSpeakHFMin");
2607   TSpeakHFMax_ = iConfig.getParameter<double>("TSpeakHFMax");
2608   TSpeakHOMin_ = iConfig.getParameter<double>("TSpeakHOMin");
2609   TSpeakHOMax_ = iConfig.getParameter<double>("TSpeakHOMax");
2610   TSmeanHBMin_ = iConfig.getParameter<double>("TSmeanHBMin");
2611   TSmeanHBMax_ = iConfig.getParameter<double>("TSmeanHBMax");
2612   TSmeanHEMin_ = iConfig.getParameter<double>("TSmeanHEMin");
2613   TSmeanHEMax_ = iConfig.getParameter<double>("TSmeanHEMax");
2614   TSmeanHFMin_ = iConfig.getParameter<double>("TSmeanHFMin");
2615   TSmeanHFMax_ = iConfig.getParameter<double>("TSmeanHFMax");
2616   TSmeanHOMin_ = iConfig.getParameter<double>("TSmeanHOMin");
2617   TSmeanHOMax_ = iConfig.getParameter<double>("TSmeanHOMax");
2618   lsmin_ = iConfig.getParameter<int>("lsmin");
2619   lsmax_ = iConfig.getParameter<int>("lsmax");
2620   alsmin = lsmin_;
2621   blsmax = lsmax_;
2622   nlsminmax = lsmax_ - lsmin_ + 1;
2623   numOfLaserEv = 0;
2624   local_event = 0;
2625   numOfTS = 10;
2626   run0 = -1;
2627   runcounter = 0;
2628   eventcounter = 0;
2629   lumi = 0;
2630   ls0 = -1;
2631   lscounter = 0;
2632   lscounterM1 = 0;
2633   lscounter10 = 0;
2634   nevcounter = 0;
2635   lscounterrun = 0;
2636   lscounterrun10 = 0;
2637   nevcounter0 = 0;
2638   nevcounter00 = 0;
2639   for (int k0 = 0; k0 < nsub; k0++) {
2640     for (int k1 = 0; k1 < ndepth; k1++) {
2641       for (int k2 = 0; k2 < neta; k2++) {
2642         if (k0 == 1) {
2643           mapRADDAM_HED2[k1][k2] = 0.;
2644           mapRADDAM_HED20[k1][k2] = 0.;
2645         }
2646         for (int k3 = 0; k3 < nphi; k3++) {
2647           sumEstimator0[k0][k1][k2][k3] = 0.;
2648           sumEstimator1[k0][k1][k2][k3] = 0.;
2649           sumEstimator2[k0][k1][k2][k3] = 0.;
2650           sumEstimator3[k0][k1][k2][k3] = 0.;
2651           sumEstimator4[k0][k1][k2][k3] = 0.;
2652           sumEstimator5[k0][k1][k2][k3] = 0.;
2653           sumEstimator6[k0][k1][k2][k3] = 0.;
2654           sum0Estimator[k0][k1][k2][k3] = 0.;
2655           if (k0 == 1) {
2656             mapRADDAM_HE[k1][k2][k3] = 0.;
2657             mapRADDAM0_HE[k1][k2][k3] = 0;
2658           }
2659         }
2660       }
2661     }
2662   }
2663   averSIGNALoccupancy_HB = 0.;
2664   averSIGNALoccupancy_HE = 0.;
2665   averSIGNALoccupancy_HF = 0.;
2666   averSIGNALoccupancy_HO = 0.;
2667   averSIGNALsumamplitude_HB = 0.;
2668   averSIGNALsumamplitude_HE = 0.;
2669   averSIGNALsumamplitude_HF = 0.;
2670   averSIGNALsumamplitude_HO = 0.;
2671   averNOSIGNALoccupancy_HB = 0.;
2672   averNOSIGNALoccupancy_HE = 0.;
2673   averNOSIGNALoccupancy_HF = 0.;
2674   averNOSIGNALoccupancy_HO = 0.;
2675   averNOSIGNALsumamplitude_HB = 0.;
2676   averNOSIGNALsumamplitude_HE = 0.;
2677   averNOSIGNALsumamplitude_HF = 0.;
2678   averNOSIGNALsumamplitude_HO = 0.;
2679   maxxSUM1 = 0.;
2680   maxxSUM2 = 0.;
2681   maxxSUM3 = 0.;
2682   maxxSUM4 = 0.;
2683   maxxOCCUP1 = 0.;
2684   maxxOCCUP2 = 0.;
2685   maxxOCCUP3 = 0.;
2686   maxxOCCUP4 = 0.;
2687   testmetka = 0;
2688 }
2689 CMTRawAnalyzer::~CMTRawAnalyzer() {}
2690 void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
2691   conditions = &iSetup.getData(tokDB_);
2692   topo = &iSetup.getData(tokTopo_);
2693   if (MAPcreation > 0) {
2694     if (flagupgradeqie1011_ == 1)
2695       fillMAP();
2696     MAPcreation = 0;
2697   }
2698   nevent++;
2699   nevent50 = nevent / 50;
2700   Run = iEvent.id().run();
2701   Nevent = iEvent.id().event();     // event number = global_event
2702   lumi = iEvent.luminosityBlock();  // lumi section
2703   bcn = iEvent.bunchCrossing();
2704   orbitNum = iEvent.orbitNumber();
2705   int outabortgap = 1;
2706   if (bcn >= bcnrejectedlow_ && bcn <= bcnrejectedhigh_)
2707     outabortgap = 0;  //  if(bcn>=3446 && bcn<=3564)
2708 
2709   if ((flagabortgaprejected_ == 1 && outabortgap == 1) || (flagabortgaprejected_ == 0 && outabortgap == 0) ||
2710       flagabortgaprejected_ == 2) {
2711     if (run0 != Run) {
2712       ++runcounter;
2713       if (runcounter != 1) {
2714         nevcounter00 = eventcounter;
2715         std::cout << " --------------------------------------- " << std::endl;
2716         std::cout << " for Run = " << run0 << " with runcounter = " << runcounter - 1 << " #ev = " << eventcounter
2717                   << std::endl;
2718         std::cout << " #LS =  " << lscounterrun << " #LS10 =  " << lscounterrun10 << " Last LS =  " << ls0 << std::endl;
2719         std::cout << " --------------------------------------------- " << std::endl;
2720         h_nls_per_run->Fill(float(lscounterrun));
2721         h_nls_per_run10->Fill(float(lscounterrun10));
2722         lscounterrun = 0;
2723         lscounterrun10 = 0;
2724       }  // runcounter > 1
2725       std::cout << " ---------***********************------------- " << std::endl;
2726       std::cout << " New Run =  " << Run << " runcounter =  " << runcounter << std::endl;
2727       std::cout << " ------- " << std::endl;
2728       run0 = Run;
2729       eventcounter = 0;
2730       ls0 = -1;
2731     }  // new run
2732     else {
2733       nevcounter00 = 0;
2734     }  //else new run
2735     ++eventcounter;
2736     if (ls0 != lumi) {
2737       if (ls0 != -1) {
2738         h_nevents_per_eachLS->Fill(float(lscounter), float(nevcounter));  //
2739         nevcounter0 = nevcounter;
2740       }  // ls0>-1
2741       lscounter++;
2742       lscounterrun++;
2743       if (usecontinuousnumbering_) {
2744         lscounterM1 = lscounter - 1;
2745       } else {
2746         lscounterM1 = ls0;
2747       }
2748       if (ls0 != -1)
2749         h_nevents_per_eachRealLS->Fill(float(lscounterM1), float(nevcounter));  //
2750       h_lsnumber_per_eachLS->Fill(float(lscounter), float(lumi));
2751       if (nevcounter > 10.) {
2752         ++lscounter10;
2753         ++lscounterrun10;
2754       }
2755       h_nevents_per_LS->Fill(float(nevcounter));
2756       h_nevents_per_LSzoom->Fill(float(nevcounter));
2757       nevcounter = 0;
2758       ls0 = lumi;
2759     }  // new lumi
2760     else {
2761       nevcounter0 = 0;
2762     }              //else new lumi
2763     ++nevcounter;  // #ev in LS
2764                    //////
2765     if (flagtoaskrunsorls_ == 0) {
2766       lscounterM1 = runcounter;
2767       nevcounter0 = nevcounter00;
2768     }
2769     if (nevcounter0 != 0 || nevcounter > 99999) {
2770       if (nevcounter > 99999)
2771         nevcounter0 = 1;
2772       ///////  int sub= cell.subdet();  1-HB, 2-HE, 3-HO, 4-HF
2773       ////////////            k0(sub): =0 HB; =1 HE; =2 HO; =3 HF;
2774       ////////////         k1(depth-1): = 0 - 3 or depth: = 1 - 4;
2775       unsigned long int pcountall1 = 0;
2776       unsigned long int pcountall3 = 0;
2777       unsigned long int pcountall6 = 0;
2778       unsigned long int pcountall8 = 0;
2779       int pcountmin1 = 0;
2780       int pcountmin3 = 0;
2781       int pcountmin6 = 0;
2782       int pcountmin8 = 0;
2783       unsigned long int mcountall1 = 0;
2784       unsigned long int mcountall3 = 0;
2785       unsigned long int mcountall6 = 0;
2786       unsigned long int mcountall8 = 0;
2787       int mcountmin1 = 0;
2788       int mcountmin3 = 0;
2789       int mcountmin6 = 0;
2790       int mcountmin8 = 0;
2791       int pnnmin1 = 999999999;
2792       int pnnmin3 = 999999999;
2793       int pnnmin6 = 999999999;
2794       int pnnmin8 = 999999999;
2795       int mnnbins1 = 0;
2796       int mnnbins3 = 0;
2797       int mnnbins6 = 0;
2798       int mnnbins8 = 0;
2799       int mnnmin1 = 999999999;
2800       int mnnmin3 = 999999999;
2801       int mnnmin6 = 999999999;
2802       int mnnmin8 = 999999999;
2803       for (int k0 = 0; k0 < nsub; k0++) {
2804         for (int k1 = 0; k1 < ndepth; k1++) {
2805           for (int k3 = 0; k3 < nphi; k3++) {
2806             for (int k2 = 0; k2 < neta; k2++) {
2807               int ieta = k2 - 41;
2808               // ------------------------------------------------------------sumEstimator0
2809               if (sumEstimator0[k0][k1][k2][k3] != 0.) {
2810                 // fill histoes:
2811                 double bbbc = 0.;
2812                 if (flagestimatornormalization_ == 0)
2813                   bbbc = sumEstimator0[k0][k1][k2][k3] / nevcounter0;
2814                 if (flagestimatornormalization_ == 1)
2815                   bbbc = sumEstimator0[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
2816                 double bbb1 = 1.;
2817                 if (flagestimatornormalization_ == 2) {
2818                   bbbc = sumEstimator0[k0][k1][k2][k3];
2819                   bbb1 = sum0Estimator[k0][k1][k2][k3];
2820                 }
2821 
2822                 // HB:
2823                 if (k0 == 0) {
2824                   // HBdepth1
2825                   if (k1 + 1 == 1) {
2826                     h_sumPedestalLS1->Fill(bbbc / bbb1);
2827                     h_2DsumPedestalLS1->Fill(double(ieta), double(k3), bbbc);
2828                     h_2D0sumPedestalLS1->Fill(double(ieta), double(k3), bbb1);
2829                     h_sumPedestalperLS1->Fill(float(lscounterM1), bbbc);
2830                     h_sum0PedestalperLS1->Fill(float(lscounterM1), bbb1);
2831                   }
2832                   if (k1 + 1 == 2) {
2833                     h_sumPedestalLS2->Fill(bbbc / bbb1);
2834                     h_2DsumPedestalLS2->Fill(double(ieta), double(k3), bbbc);
2835                     h_2D0sumPedestalLS2->Fill(double(ieta), double(k3), bbb1);
2836                     h_sumPedestalperLS2->Fill(float(lscounterM1), bbbc);
2837                     h_sum0PedestalperLS2->Fill(float(lscounterM1), bbb1);
2838                   }
2839                 }
2840                 // HE:
2841                 if (k0 == 1) {
2842                   // HEdepth1
2843                   if (k1 + 1 == 1) {
2844                     h_sumPedestalLS3->Fill(bbbc / bbb1);
2845                     h_2DsumPedestalLS3->Fill(double(ieta), double(k3), bbbc);
2846                     h_2D0sumPedestalLS3->Fill(double(ieta), double(k3), bbb1);
2847                     h_sumPedestalperLS3->Fill(float(lscounterM1), bbbc);
2848                     h_sum0PedestalperLS3->Fill(float(lscounterM1), bbb1);
2849                   }
2850                   if (k1 + 1 == 2) {
2851                     h_sumPedestalLS4->Fill(bbbc / bbb1);
2852                     h_2DsumPedestalLS4->Fill(double(ieta), double(k3), bbbc);
2853                     h_2D0sumPedestalLS4->Fill(double(ieta), double(k3), bbb1);
2854                     h_sumPedestalperLS4->Fill(float(lscounterM1), bbbc);
2855                     h_sum0PedestalperLS4->Fill(float(lscounterM1), bbb1);
2856                   }
2857                   if (k1 + 1 == 3) {
2858                     h_sumPedestalLS5->Fill(bbbc / bbb1);
2859                     h_2DsumPedestalLS5->Fill(double(ieta), double(k3), bbbc);
2860                     h_2D0sumPedestalLS5->Fill(double(ieta), double(k3), bbb1);
2861                     h_sumPedestalperLS5->Fill(float(lscounterM1), bbbc);
2862                     h_sum0PedestalperLS5->Fill(float(lscounterM1), bbb1);
2863                   }
2864                 }
2865                 // HF:
2866                 if (k0 == 3) {
2867                   // HFdepth1
2868                   if (k1 + 1 == 1) {
2869                     h_sumPedestalLS6->Fill(bbbc / bbb1);
2870                     h_2DsumPedestalLS6->Fill(double(ieta), double(k3), bbbc);
2871                     h_2D0sumPedestalLS6->Fill(double(ieta), double(k3), bbb1);
2872                     h_sumPedestalperLS6->Fill(float(lscounterM1), bbbc);
2873                     h_sum0PedestalperLS6->Fill(float(lscounterM1), bbb1);
2874                   }
2875                   if (k1 + 1 == 2) {
2876                     h_sumPedestalLS7->Fill(bbbc / bbb1);
2877                     h_2DsumPedestalLS7->Fill(double(ieta), double(k3), bbbc);
2878                     h_2D0sumPedestalLS7->Fill(double(ieta), double(k3), bbb1);
2879                     h_sumPedestalperLS7->Fill(float(lscounterM1), bbbc);
2880                     h_sum0PedestalperLS7->Fill(float(lscounterM1), bbb1);
2881                   }
2882                 }
2883                 // HO:
2884                 if (k0 == 2) {
2885                   // HOdepth4
2886                   if (k1 + 1 == 4) {
2887                     h_sumPedestalLS8->Fill(bbbc / bbb1);
2888                     h_2DsumPedestalLS8->Fill(double(ieta), double(k3), bbbc);
2889                     h_2D0sumPedestalLS8->Fill(double(ieta), double(k3), bbb1);
2890                     h_sumPedestalperLS8->Fill(float(lscounterM1), bbbc);
2891                     h_sum0PedestalperLS8->Fill(float(lscounterM1), bbb1);
2892                   }
2893                 }
2894               }  //if(sumEstimator0[k0][k1][k2][k3] != 0.
2895 
2896               // -------------------------------------------------------------------------------------   sumEstimator1
2897               if (sumEstimator1[k0][k1][k2][k3] != 0.) {
2898                 // fill histoes:
2899                 double bbbc = 0.;
2900                 if (flagestimatornormalization_ == 0)
2901                   bbbc = sumEstimator1[k0][k1][k2][k3] / nevcounter0;
2902                 if (flagestimatornormalization_ == 1)
2903                   bbbc = sumEstimator1[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
2904                 double bbb1 = 1.;
2905                 if (flagestimatornormalization_ == 2) {
2906                   bbbc = sumEstimator1[k0][k1][k2][k3];
2907                   bbb1 = sum0Estimator[k0][k1][k2][k3];
2908                 }
2909                 //flag for ask type of Normalization for CMT estimators:
2910                 //=0-normalizationOn#evOfLS;   =1-averagedMeanChannelVariable;   =2-averageVariable-normalizationOn#entriesInLS;
2911                 //flagestimatornormalization = cms.int32(2), !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2912                 // zhokin 18.10.2018 STUDY:               CALL  HFF2 (ID,NID,X,Y,W)
2913                 if (lscounterM1 >= lsmin_ && lscounterM1 < lsmax_) {
2914                   //                                       INDEXIES:
2915                   int kkkk2 = (k2 - 1) / 4;
2916                   if (k2 == 0)
2917                     kkkk2 = 1.;
2918                   else
2919                     kkkk2 += 2;              //kkkk2= 1-22
2920                   int kkkk3 = (k3) / 4 + 1;  //kkkk3= 1-18
2921                   //                                       PACKING
2922                   //kkkk2= 1-22 ;kkkk3= 1-18
2923                   int ietaphi = 0;
2924                   ietaphi = ((kkkk2)-1) * znphi + (kkkk3);
2925                   //  Outout is       ietaphi = 1 - 396 ( # =396; in histo,booking is: 1 - 397 )
2926 
2927                   double bbb3 = 0.;
2928                   if (bbb1 != 0.)
2929                     bbb3 = bbbc / bbb1;
2930                   // very very wrong if below:
2931                   //        if(bbb3 != 0.) {
2932 
2933                   if (k0 == 0) {
2934                     h_2DsumADCAmplEtaPhiLs0->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HB
2935                     h_2DsumADCAmplEtaPhiLs00->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HB
2936                   }
2937                   if (k0 == 1) {
2938                     h_2DsumADCAmplEtaPhiLs1->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HE
2939                     h_2DsumADCAmplEtaPhiLs10->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HE
2940                   }
2941                   if (k0 == 2) {
2942                     h_2DsumADCAmplEtaPhiLs2->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HO
2943                     h_2DsumADCAmplEtaPhiLs20->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HO
2944                   }
2945                   if (k0 == 3) {
2946                     h_2DsumADCAmplEtaPhiLs3->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HF
2947                     h_2DsumADCAmplEtaPhiLs30->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HF
2948                   }
2949 
2950                   h_sumADCAmplEtaPhiLs->Fill(bbb3);
2951                   h_sumADCAmplEtaPhiLs_bbbc->Fill(bbbc);
2952                   h_sumADCAmplEtaPhiLs_bbb1->Fill(bbb1);
2953                   h_sumADCAmplEtaPhiLs_lscounterM1orbitNum->Fill(float(lscounterM1), float(orbitNum));
2954                   h_sumADCAmplEtaPhiLs_orbitNum->Fill(float(orbitNum), 1.);
2955                   h_sumADCAmplEtaPhiLs_lscounterM1->Fill(float(lscounterM1), 1.);
2956                   h_sumADCAmplEtaPhiLs_ietaphi->Fill(float(ietaphi));
2957 
2958                   //        }// bb3
2959                 }  // lscounterM1 >= lsmin_ && lscounterM1 < lsmax_
2960 
2961                 // HB:
2962                 if (k0 == 0) {
2963                   // HBdepth1
2964                   if (k1 + 1 == 1) {
2965                     h_sumADCAmplLS1copy1->Fill(bbbc / bbb1);
2966                     h_sumADCAmplLS1copy2->Fill(bbbc / bbb1);
2967                     h_sumADCAmplLS1copy3->Fill(bbbc / bbb1);
2968                     h_sumADCAmplLS1copy4->Fill(bbbc / bbb1);
2969                     h_sumADCAmplLS1copy5->Fill(bbbc / bbb1);
2970                     h_sumADCAmplLS1->Fill(bbbc / bbb1);
2971                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth1_)
2972                       h_2DsumADCAmplLS1->Fill(double(ieta), double(k3), bbbc);
2973                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HBdepth1_)
2974                       h_2DsumADCAmplLS1_LSselected->Fill(double(ieta), double(k3), bbbc);
2975 
2976                     h_2D0sumADCAmplLS1->Fill(double(ieta), double(k3), bbb1);
2977 
2978                     h_sumADCAmplperLS1->Fill(float(lscounterM1), bbbc);
2979                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth1_)
2980                       h_sumCutADCAmplperLS1->Fill(float(lscounterM1), bbbc);
2981                     h_sum0ADCAmplperLS1->Fill(float(lscounterM1), bbb1);
2982 
2983                     if (ieta > 0) {
2984                       if (k3 < 36) {
2985                         h_sumADCAmplperLS1_P1->Fill(float(lscounterM1), bbbc);
2986                         h_sum0ADCAmplperLS1_P1->Fill(float(lscounterM1), bbb1);
2987                       } else {
2988                         h_sumADCAmplperLS1_P2->Fill(float(lscounterM1), bbbc);
2989                         h_sum0ADCAmplperLS1_P2->Fill(float(lscounterM1), bbb1);
2990                       }
2991                       ////////////////////////////// P
2992                       if (bbbc / bbb1 > 25.) {
2993                         pcountall1 += bbb1;
2994                         pcountmin1 += bbb1;
2995                       }
2996                       //////////////////////////////
2997 
2998                     } else {
2999                       if (k3 < 36) {
3000                         h_sumADCAmplperLS1_M1->Fill(float(lscounterM1), bbbc);
3001                         h_sum0ADCAmplperLS1_M1->Fill(float(lscounterM1), bbb1);
3002                       } else {
3003                         h_sumADCAmplperLS1_M2->Fill(float(lscounterM1), bbbc);
3004                         h_sum0ADCAmplperLS1_M2->Fill(float(lscounterM1), bbb1);
3005                       }
3006                       ////////////////////////////// M
3007                       if (bbbc / bbb1 > 25.) {
3008                         mcountall1 += bbb1;
3009                         mcountmin1 += bbb1;
3010                       }
3011                       //////////////////////////////
3012                     }
3013                   }
3014                   // HBdepth2
3015                   if (k1 + 1 == 2) {
3016                     h_sumADCAmplLS2->Fill(bbbc / bbb1);
3017                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth2_)
3018                       h_2DsumADCAmplLS2->Fill(double(ieta), double(k3), bbbc);
3019                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HBdepth2_)
3020                       h_2DsumADCAmplLS2_LSselected->Fill(double(ieta), double(k3), bbbc);
3021                     h_2D0sumADCAmplLS2->Fill(double(ieta), double(k3), bbb1);
3022                     h_sumADCAmplperLS2->Fill(float(lscounterM1), bbbc);
3023                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth2_)
3024                       h_sumCutADCAmplperLS2->Fill(float(lscounterM1), bbbc);
3025                     h_sum0ADCAmplperLS2->Fill(float(lscounterM1), bbb1);
3026                     if (ieta > 0) {
3027                       if (k3 < 36) {
3028                         h_sumADCAmplperLS1_P1->Fill(float(lscounterM1), bbbc);
3029                         h_sum0ADCAmplperLS1_P1->Fill(float(lscounterM1), bbb1);
3030                       } else {
3031                         h_sumADCAmplperLS1_P2->Fill(float(lscounterM1), bbbc);
3032                         h_sum0ADCAmplperLS1_P2->Fill(float(lscounterM1), bbb1);
3033                       }
3034                     } else {
3035                       if (k3 < 36) {
3036                         h_sumADCAmplperLS1_M1->Fill(float(lscounterM1), bbbc);
3037                         h_sum0ADCAmplperLS1_M1->Fill(float(lscounterM1), bbb1);
3038                       } else {
3039                         h_sumADCAmplperLS1_M2->Fill(float(lscounterM1), bbbc);
3040                         h_sum0ADCAmplperLS1_M2->Fill(float(lscounterM1), bbb1);
3041                       }
3042                     }
3043                   }
3044                   // HBdepth3 upgrade
3045                   if (k1 + 1 == 3) {
3046                     h_sumADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbbc);
3047                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth3_)
3048                       h_sumCutADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbbc);
3049                     h_sum0ADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbb1);
3050 
3051                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth3_)
3052                       h_2DsumADCAmplLSdepth3HBu->Fill(double(ieta), double(k3), bbbc);
3053                     h_2D0sumADCAmplLSdepth3HBu->Fill(double(ieta), double(k3), bbb1);
3054                   }  //if(k1+1  ==3)
3055 
3056                   // HBdepth4 upgrade
3057                   if (k1 + 1 == 4) {
3058                     h_sumADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbbc);
3059                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth4_)
3060                       h_sumCutADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbbc);
3061                     h_sum0ADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbb1);
3062 
3063                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth4_)
3064                       h_2DsumADCAmplLSdepth4HBu->Fill(double(ieta), double(k3), bbbc);
3065                     h_2D0sumADCAmplLSdepth4HBu->Fill(double(ieta), double(k3), bbb1);
3066                   }  //if(k1+1  ==4)
3067                 }
3068 
3069                 // HE:
3070                 if (k0 == 1) {
3071                   // HEdepth1
3072                   if (k1 + 1 == 1) {
3073                     h_sumADCAmplLS3->Fill(bbbc / bbb1);
3074                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth1_)
3075                       h_2DsumADCAmplLS3->Fill(double(ieta), double(k3), bbbc);
3076                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth1_)
3077                       h_2DsumADCAmplLS3_LSselected->Fill(double(ieta), double(k3), bbbc);
3078                     h_2D0sumADCAmplLS3->Fill(double(ieta), double(k3), bbb1);
3079                     h_sumADCAmplperLS3->Fill(float(lscounterM1), bbbc);
3080                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth1_)
3081                       h_sumCutADCAmplperLS3->Fill(float(lscounterM1), bbbc);
3082                     h_sum0ADCAmplperLS3->Fill(float(lscounterM1), bbb1);
3083                     if (ieta > 0) {
3084                       if (k3 < 36) {
3085                         h_sumADCAmplperLS3_P1->Fill(float(lscounterM1), bbbc);
3086                         h_sum0ADCAmplperLS3_P1->Fill(float(lscounterM1), bbb1);
3087                       } else {
3088                         h_sumADCAmplperLS3_P2->Fill(float(lscounterM1), bbbc);
3089                         h_sum0ADCAmplperLS3_P2->Fill(float(lscounterM1), bbb1);
3090                       }
3091                       ////////////////////////////// P
3092                       if (bbbc / bbb1 > 15. && k3 % 2 == 0) {
3093                         pcountall3 += bbb1;
3094                         pcountmin3 += bbb1;
3095                       }
3096                       //////////////////////////////
3097                     } else {
3098                       if (k3 < 36) {
3099                         h_sumADCAmplperLS3_M1->Fill(float(lscounterM1), bbbc);
3100                         h_sum0ADCAmplperLS3_M1->Fill(float(lscounterM1), bbb1);
3101                       } else {
3102                         h_sumADCAmplperLS3_M2->Fill(float(lscounterM1), bbbc);
3103                         h_sum0ADCAmplperLS3_M2->Fill(float(lscounterM1), bbb1);
3104                       }
3105                       ////////////////////////////// M
3106                       if (bbbc / bbb1 > 15. && k3 % 2 == 0) {
3107                         mcountall3 += bbb1;
3108                         mcountmin3 += bbb1;
3109                       }
3110                       //////////////////////////////
3111                     }
3112                   }
3113                   // HEdepth2
3114                   if (k1 + 1 == 2) {
3115                     h_sumADCAmplLS4->Fill(bbbc / bbb1);
3116                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth2_)
3117                       h_2DsumADCAmplLS4->Fill(double(ieta), double(k3), bbbc);
3118                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth2_)
3119                       h_2DsumADCAmplLS4_LSselected->Fill(double(ieta), double(k3), bbbc);
3120                     h_2D0sumADCAmplLS4->Fill(double(ieta), double(k3), bbb1);
3121                     h_sumADCAmplperLS4->Fill(float(lscounterM1), bbbc);
3122                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth2_)
3123                       h_sumCutADCAmplperLS4->Fill(float(lscounterM1), bbbc);
3124                     h_sum0ADCAmplperLS4->Fill(float(lscounterM1), bbb1);
3125                     if (ieta > 0) {
3126                       if (k3 < 36) {
3127                         h_sumADCAmplperLS3_P1->Fill(float(lscounterM1), bbbc);
3128                         h_sum0ADCAmplperLS3_P1->Fill(float(lscounterM1), bbb1);
3129                       } else {
3130                         h_sumADCAmplperLS3_P2->Fill(float(lscounterM1), bbbc);
3131                         h_sum0ADCAmplperLS3_P2->Fill(float(lscounterM1), bbb1);
3132                       }
3133                     } else {
3134                       if (k3 < 36) {
3135                         h_sumADCAmplperLS3_M1->Fill(float(lscounterM1), bbbc);
3136                         h_sum0ADCAmplperLS3_M1->Fill(float(lscounterM1), bbb1);
3137                       } else {
3138                         h_sumADCAmplperLS3_M2->Fill(float(lscounterM1), bbbc);
3139                         h_sum0ADCAmplperLS3_M2->Fill(float(lscounterM1), bbb1);
3140                       }
3141                     }
3142                   }
3143                   // HEdepth3
3144                   if (k1 + 1 == 3) {
3145                     h_sumADCAmplLS5->Fill(bbbc / bbb1);
3146                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth3_)
3147                       h_2DsumADCAmplLS5->Fill(double(ieta), double(k3), bbbc);
3148                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth3_)
3149                       h_2DsumADCAmplLS5_LSselected->Fill(double(ieta), double(k3), bbbc);
3150                     h_2D0sumADCAmplLS5->Fill(double(ieta), double(k3), bbb1);
3151                     h_sumADCAmplperLS5->Fill(float(lscounterM1), bbbc);
3152                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth3_)
3153                       h_sumCutADCAmplperLS5->Fill(float(lscounterM1), bbbc);
3154                     h_sum0ADCAmplperLS5->Fill(float(lscounterM1), bbb1);
3155                     if (ieta > 0) {
3156                       if (k3 < 36) {
3157                         h_sumADCAmplperLS3_P1->Fill(float(lscounterM1), bbbc);
3158                         h_sum0ADCAmplperLS3_P1->Fill(float(lscounterM1), bbb1);
3159                       } else {
3160                         h_sumADCAmplperLS3_P2->Fill(float(lscounterM1), bbbc);
3161                         h_sum0ADCAmplperLS3_P2->Fill(float(lscounterM1), bbb1);
3162                       }
3163                     } else {
3164                       if (k3 < 36) {
3165                         h_sumADCAmplperLS3_M1->Fill(float(lscounterM1), bbbc);
3166                         h_sum0ADCAmplperLS3_M1->Fill(float(lscounterM1), bbb1);
3167                       } else {
3168                         h_sumADCAmplperLS3_M2->Fill(float(lscounterM1), bbbc);
3169                         h_sum0ADCAmplperLS3_M2->Fill(float(lscounterM1), bbb1);
3170                       }
3171                     }
3172                   }  //if(k1+1  ==3
3173                   // HEdepth4 upgrade
3174                   if (k1 + 1 == 4) {
3175                     h_sumADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbbc);
3176                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth4_)
3177                       h_sumCutADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbbc);
3178                     h_sum0ADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbb1);
3179 
3180                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth4_)
3181                       h_2DsumADCAmplLSdepth4HEu->Fill(double(ieta), double(k3), bbbc);
3182                     h_2D0sumADCAmplLSdepth4HEu->Fill(double(ieta), double(k3), bbb1);
3183                   }  //if(k1+1  ==4)
3184 
3185                   // HEdepth5 upgrade
3186                   if (k1 + 1 == 5) {
3187                     h_sumADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbbc);
3188                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth5_)
3189                       h_sumCutADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbbc);
3190                     h_sum0ADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbb1);
3191 
3192                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth5_)
3193                       h_2DsumADCAmplLSdepth5HEu->Fill(double(ieta), double(k3), bbbc);
3194                     h_2D0sumADCAmplLSdepth5HEu->Fill(double(ieta), double(k3), bbb1);
3195                   }  //if(k1+1  ==5)
3196 
3197                   // HEdepth6 upgrade
3198                   if (k1 + 1 == 6) {
3199                     h_sumADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbbc);
3200                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth6_)
3201                       h_sumCutADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbbc);
3202                     h_sum0ADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbb1);
3203 
3204                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth6_)
3205                       h_2DsumADCAmplLSdepth6HEu->Fill(double(ieta), double(k3), bbbc);
3206                     h_2D0sumADCAmplLSdepth6HEu->Fill(double(ieta), double(k3), bbb1);
3207                   }  //if(k1+1  ==6)
3208 
3209                   // HEdepth7 upgrade
3210                   if (k1 + 1 == 7) {
3211                     h_sumADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbbc);
3212                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth7_)
3213                       h_sumCutADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbbc);
3214                     h_sum0ADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbb1);
3215 
3216                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth7_)
3217                       h_2DsumADCAmplLSdepth7HEu->Fill(double(ieta), double(k3), bbbc);
3218                     h_2D0sumADCAmplLSdepth7HEu->Fill(double(ieta), double(k3), bbb1);
3219                   }  //if(k1+1  ==7)
3220                 }    //if(k0==1) =HE
3221                 // HF:
3222                 if (k0 == 3) {
3223                   // HFdepth1
3224                   if (k1 + 1 == 1) {
3225                     h_sumADCAmplLS6->Fill(bbbc / bbb1);
3226                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth1_)
3227                       h_2DsumADCAmplLS6->Fill(double(ieta), double(k3), bbbc);
3228                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HFdepth1_)
3229                       h_2DsumADCAmplLS6_LSselected->Fill(double(ieta), double(k3), bbbc);
3230                     h_2D0sumADCAmplLS6->Fill(double(ieta), double(k3), bbb1);
3231                     h_sumADCAmplperLS6->Fill(float(lscounterM1), bbbc);
3232                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth1_)
3233                       h_sumCutADCAmplperLS6->Fill(float(lscounterM1), bbbc);
3234                     h_sum0ADCAmplperLS6->Fill(float(lscounterM1), bbb1);
3235 
3236                     ///////////////////////////////////////////////////////// error-A
3237                     if (ieta > 0) {
3238                       if (k3 < 36) {
3239                         h_sumADCAmplperLS6_P1->Fill(float(lscounterM1), bbbc);
3240                         h_sum0ADCAmplperLS6_P1->Fill(float(lscounterM1), bbb1);
3241                       } else {
3242                         h_sumADCAmplperLS6_P2->Fill(float(lscounterM1), bbbc);
3243                         h_sum0ADCAmplperLS6_P2->Fill(float(lscounterM1), bbb1);
3244                       }
3245                       ////////////////////////////// P
3246                       if (bbbc / bbb1 > 20.) {
3247                         pcountall6 += bbb1;
3248                         pcountmin6 += bbb1;
3249                       }
3250                       //////////////////////////////
3251 
3252                     } else {
3253                       if (k3 < 36) {
3254                         h_sumADCAmplperLS6_M1->Fill(float(lscounterM1), bbbc);
3255                         h_sum0ADCAmplperLS6_M1->Fill(float(lscounterM1), bbb1);
3256                       } else {
3257                         h_sumADCAmplperLS6_M2->Fill(float(lscounterM1), bbbc);
3258                         h_sum0ADCAmplperLS6_M2->Fill(float(lscounterM1), bbb1);
3259                       }
3260                       ////////////////////////////// M
3261                       if (bbbc / bbb1 > 20.) {
3262                         mcountall6 += bbb1;
3263                         mcountmin6 += bbb1;
3264                       }
3265                       //////////////////////////////
3266                     }
3267                     /////////////////////////////////////////////////////////
3268                   }  //if(k1+1  ==1)
3269 
3270                   // HFdepth2
3271                   if (k1 + 1 == 2) {
3272                     h_sumADCAmplLS7->Fill(bbbc / bbb1);
3273                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth2_)
3274                       h_2DsumADCAmplLS7->Fill(double(ieta), double(k3), bbbc);
3275                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HFdepth2_)
3276                       h_2DsumADCAmplLS7_LSselected->Fill(double(ieta), double(k3), bbbc);
3277                     h_2D0sumADCAmplLS7->Fill(double(ieta), double(k3), bbb1);
3278                     h_sumADCAmplperLS7->Fill(float(lscounterM1), bbbc);
3279                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth2_)
3280                       h_sumCutADCAmplperLS7->Fill(float(lscounterM1), bbbc);
3281                     h_sum0ADCAmplperLS7->Fill(float(lscounterM1), bbb1);
3282 
3283                     if (ieta > 0) {
3284                       if (k3 < 36) {
3285                         h_sumADCAmplperLS6_P1->Fill(float(lscounterM1), bbbc);
3286                         h_sum0ADCAmplperLS6_P1->Fill(float(lscounterM1), bbb1);
3287                       } else {
3288                         h_sumADCAmplperLS6_P2->Fill(float(lscounterM1), bbbc);
3289                         h_sum0ADCAmplperLS6_P2->Fill(float(lscounterM1), bbb1);
3290                       }
3291                     } else {
3292                       if (k3 < 36) {
3293                         h_sumADCAmplperLS6_M1->Fill(float(lscounterM1), bbbc);
3294                         h_sum0ADCAmplperLS6_M1->Fill(float(lscounterM1), bbb1);
3295                       } else {
3296                         h_sumADCAmplperLS6_M2->Fill(float(lscounterM1), bbbc);
3297                         h_sum0ADCAmplperLS6_M2->Fill(float(lscounterM1), bbb1);
3298                       }
3299                     }
3300                   }  //if(k1+1  ==2)
3301 
3302                   // HFdepth3 upgrade
3303                   if (k1 + 1 == 3) {
3304                     h_sumADCAmplperLS6u->Fill(float(lscounterM1), bbbc);
3305                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth3_)
3306                       h_sumCutADCAmplperLS6u->Fill(float(lscounterM1), bbbc);
3307                     h_sum0ADCAmplperLS6u->Fill(float(lscounterM1), bbb1);
3308 
3309                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth3_)
3310                       h_2DsumADCAmplLSdepth3HFu->Fill(double(ieta), double(k3), bbbc);
3311                     h_2D0sumADCAmplLSdepth3HFu->Fill(double(ieta), double(k3), bbb1);
3312                   }  //if(k1+1  ==3)
3313 
3314                   // HFdepth4 upgrade
3315                   if (k1 + 1 == 4) {
3316                     h_sumADCAmplperLS7u->Fill(float(lscounterM1), bbbc);
3317                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth4_)
3318                       h_sumCutADCAmplperLS7u->Fill(float(lscounterM1), bbbc);
3319                     h_sum0ADCAmplperLS7u->Fill(float(lscounterM1), bbb1);
3320 
3321                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth4_)
3322                       h_2DsumADCAmplLSdepth4HFu->Fill(double(ieta), double(k3), bbbc);
3323                     h_2D0sumADCAmplLSdepth4HFu->Fill(double(ieta), double(k3), bbb1);
3324                   }  //if(k1+1  ==4)
3325 
3326                 }  //end HF
3327 
3328                 // HO:
3329                 if (k0 == 2) {
3330                   // HOdepth4
3331                   if (k1 + 1 == 4) {
3332                     h_sumADCAmplLS8->Fill(bbbc / bbb1);
3333                     if (bbbc / bbb1 > lsdep_estimator1_HOdepth4_)
3334                       h_2DsumADCAmplLS8->Fill(double(ieta), double(k3), bbbc);
3335                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HOdepth4_)
3336                       h_2DsumADCAmplLS8_LSselected->Fill(double(ieta), double(k3), bbbc);
3337                     h_2D0sumADCAmplLS8->Fill(double(ieta), double(k3), bbb1);
3338                     h_sumADCAmplperLS8->Fill(float(lscounterM1), bbbc);
3339                     if (bbbc / bbb1 > lsdep_estimator1_HOdepth4_)
3340                       h_sumCutADCAmplperLS8->Fill(float(lscounterM1), bbbc);
3341                     h_sum0ADCAmplperLS8->Fill(float(lscounterM1), bbb1);
3342 
3343                     ///////////////////////////////////////////////////////// error-A
3344                     if (ieta > 0) {
3345                       if (k3 < 36) {
3346                         h_sumADCAmplperLS8_P1->Fill(float(lscounterM1), bbbc);
3347                         h_sum0ADCAmplperLS8_P1->Fill(float(lscounterM1), bbb1);
3348                       } else {
3349                         h_sumADCAmplperLS8_P2->Fill(float(lscounterM1), bbbc);
3350                         h_sum0ADCAmplperLS8_P2->Fill(float(lscounterM1), bbb1);
3351                       }
3352                       ////////////////////////////// P
3353                       if (bbbc / bbb1 > 80.) {
3354                         pcountall8 += bbb1;
3355                         pcountmin8 += bbb1;
3356                       }
3357                       //////////////////////////////
3358 
3359                     } else {
3360                       if (k3 < 36) {
3361                         h_sumADCAmplperLS8_M1->Fill(float(lscounterM1), bbbc);
3362                         h_sum0ADCAmplperLS8_M1->Fill(float(lscounterM1), bbb1);
3363                       } else {
3364                         h_sumADCAmplperLS8_M2->Fill(float(lscounterM1), bbbc);
3365                         h_sum0ADCAmplperLS8_M2->Fill(float(lscounterM1), bbb1);
3366                       }
3367                       ////////////////////////////// M
3368                       if (bbbc / bbb1 > 80.) {
3369                         mcountall8 += bbb1;
3370                         mcountmin8 += bbb1;
3371                       }
3372                       //////////////////////////////
3373                     }
3374                     /////////////////////////////////////////////////////////
3375                   }
3376                 }
3377               }  //if(sumEstimator1[k0][k1][k2][k3] != 0.
3378               // ------------------------------------------------------------------------------------------------------------------------sumEstimator2
3379               if (sumEstimator2[k0][k1][k2][k3] != 0.) {
3380                 // fill histoes:
3381                 double bbbc = 0.;
3382                 if (flagestimatornormalization_ == 0)
3383                   bbbc = sumEstimator2[k0][k1][k2][k3] / nevcounter0;
3384                 if (flagestimatornormalization_ == 1)
3385                   bbbc = sumEstimator2[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3386                 double bbb1 = 1.;
3387                 if (flagestimatornormalization_ == 2) {
3388                   bbbc = sumEstimator2[k0][k1][k2][k3];
3389                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3390                 }
3391 
3392                 // HB:
3393                 if (k0 == 0) {
3394                   // HBdepth1
3395                   if (k1 + 1 == 1) {
3396                     h_sumTSmeanALS1->Fill(bbbc / bbb1);
3397                     if (bbbc / bbb1 > lsdep_estimator2_HBdepth1_)
3398                       h_2DsumTSmeanALS1->Fill(double(ieta), double(k3), bbbc);
3399                     h_2D0sumTSmeanALS1->Fill(double(ieta), double(k3), bbb1);
3400                     h_sumTSmeanAperLS1->Fill(float(lscounterM1), bbbc);
3401                     if (bbbc / bbb1 > lsdep_estimator2_HBdepth1_)
3402                       h_sumCutTSmeanAperLS1->Fill(float(lscounterM1), bbbc);
3403                     h_sum0TSmeanAperLS1->Fill(float(lscounterM1), bbb1);
3404                     if (bbbc / bbb1 > 2. * lsdep_estimator2_HBdepth1_)
3405                       h_sumTSmeanAperLS1_LSselected->Fill(float(lscounterM1), bbbc);
3406                   }
3407                   if (k1 + 1 == 2) {
3408                     h_sumTSmeanALS2->Fill(bbbc / bbb1);
3409                     if (bbbc / bbb1 > lsdep_estimator2_HBdepth2_)
3410                       h_2DsumTSmeanALS2->Fill(double(ieta), double(k3), bbbc);
3411                     h_2D0sumTSmeanALS2->Fill(double(ieta), double(k3), bbb1);
3412                     h_sumTSmeanAperLS2->Fill(float(lscounterM1), bbbc);
3413                     if (bbbc / bbb1 > lsdep_estimator2_HBdepth2_)
3414                       h_sumCutTSmeanAperLS2->Fill(float(lscounterM1), bbbc);
3415                     h_sum0TSmeanAperLS2->Fill(float(lscounterM1), bbb1);
3416                   }
3417                 }
3418                 // HE:
3419                 if (k0 == 1) {
3420                   // HBdepth1
3421                   if (k1 + 1 == 1) {
3422                     h_sumTSmeanALS3->Fill(bbbc / bbb1);
3423                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth1_)
3424                       h_2DsumTSmeanALS3->Fill(double(ieta), double(k3), bbbc);
3425                     h_2D0sumTSmeanALS3->Fill(double(ieta), double(k3), bbb1);
3426                     h_sumTSmeanAperLS3->Fill(float(lscounterM1), bbbc);
3427                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth1_)
3428                       h_sumCutTSmeanAperLS3->Fill(float(lscounterM1), bbbc);
3429                     h_sum0TSmeanAperLS3->Fill(float(lscounterM1), bbb1);
3430                   }
3431                   if (k1 + 1 == 2) {
3432                     h_sumTSmeanALS4->Fill(bbbc / bbb1);
3433                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth2_)
3434                       h_2DsumTSmeanALS4->Fill(double(ieta), double(k3), bbbc);
3435                     h_2D0sumTSmeanALS4->Fill(double(ieta), double(k3), bbb1);
3436                     h_sumTSmeanAperLS4->Fill(float(lscounterM1), bbbc);
3437                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth2_)
3438                       h_sumCutTSmeanAperLS4->Fill(float(lscounterM1), bbbc);
3439                     h_sum0TSmeanAperLS4->Fill(float(lscounterM1), bbb1);
3440                   }
3441                   if (k1 + 1 == 3) {
3442                     h_sumTSmeanALS5->Fill(bbbc / bbb1);
3443                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth3_)
3444                       h_2DsumTSmeanALS5->Fill(double(ieta), double(k3), bbbc);
3445                     h_2D0sumTSmeanALS5->Fill(double(ieta), double(k3), bbb1);
3446                     h_sumTSmeanAperLS5->Fill(float(lscounterM1), bbbc);
3447                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth3_)
3448                       h_sumCutTSmeanAperLS5->Fill(float(lscounterM1), bbbc);
3449                     h_sum0TSmeanAperLS5->Fill(float(lscounterM1), bbb1);
3450                   }
3451                 }
3452                 // HF:
3453                 if (k0 == 3) {
3454                   // HBdepth1
3455                   if (k1 + 1 == 1) {
3456                     h_sumTSmeanALS6->Fill(bbbc / bbb1);
3457                     if (bbbc / bbb1 > lsdep_estimator2_HFdepth1_)
3458                       h_2DsumTSmeanALS6->Fill(double(ieta), double(k3), bbbc);
3459                     h_2D0sumTSmeanALS6->Fill(double(ieta), double(k3), bbb1);
3460                     h_sumTSmeanAperLS6->Fill(float(lscounterM1), bbbc);
3461                     if (bbbc / bbb1 > lsdep_estimator2_HFdepth1_)
3462                       h_sumCutTSmeanAperLS6->Fill(float(lscounterM1), bbbc);
3463                     h_sum0TSmeanAperLS6->Fill(float(lscounterM1), bbb1);
3464                   }
3465                   if (k1 + 1 == 2) {
3466                     h_sumTSmeanALS7->Fill(bbbc / bbb1);
3467                     if (bbbc / bbb1 > lsdep_estimator2_HFdepth2_)
3468                       h_2DsumTSmeanALS7->Fill(double(ieta), double(k3), bbbc);
3469                     h_2D0sumTSmeanALS7->Fill(double(ieta), double(k3), bbb1);
3470                     h_sumTSmeanAperLS7->Fill(float(lscounterM1), bbbc);
3471                     if (bbbc / bbb1 > lsdep_estimator2_HFdepth2_)
3472                       h_sumCutTSmeanAperLS7->Fill(float(lscounterM1), bbbc);
3473                     h_sum0TSmeanAperLS7->Fill(float(lscounterM1), bbb1);
3474                   }
3475                 }
3476                 // HO:
3477                 if (k0 == 2) {
3478                   // HBdepth1
3479                   if (k1 + 1 == 4) {
3480                     h_sumTSmeanALS8->Fill(bbbc / bbb1);
3481                     if (bbbc / bbb1 > lsdep_estimator2_HOdepth4_)
3482                       h_2DsumTSmeanALS8->Fill(double(ieta), double(k3), bbbc);
3483                     h_2D0sumTSmeanALS8->Fill(double(ieta), double(k3), bbb1);
3484                     h_sumTSmeanAperLS8->Fill(float(lscounterM1), bbbc);
3485                     if (bbbc / bbb1 > lsdep_estimator2_HOdepth4_)
3486                       h_sumCutTSmeanAperLS8->Fill(float(lscounterM1), bbbc);
3487                     h_sum0TSmeanAperLS8->Fill(float(lscounterM1), bbb1);
3488                   }
3489                 }
3490               }  //if(sumEstimator2[k0][k1][k2][k3] != 0.
3491 
3492               // ------------------------------------------------------------------------------------------------------------------------sumEstimator3
3493               if (sumEstimator3[k0][k1][k2][k3] != 0.) {
3494                 // fill histoes:
3495                 double bbbc = 0.;
3496                 if (flagestimatornormalization_ == 0)
3497                   bbbc = sumEstimator3[k0][k1][k2][k3] / nevcounter0;
3498                 if (flagestimatornormalization_ == 1)
3499                   bbbc = sumEstimator3[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3500                 double bbb1 = 1.;
3501                 if (flagestimatornormalization_ == 2) {
3502                   bbbc = sumEstimator3[k0][k1][k2][k3];
3503                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3504                 }
3505 
3506                 // HB:
3507                 if (k0 == 0) {
3508                   // HBdepth1
3509                   if (k1 + 1 == 1) {
3510                     h_sumTSmaxALS1->Fill(bbbc / bbb1);
3511                     if (bbbc / bbb1 > lsdep_estimator3_HBdepth1_)
3512                       h_2DsumTSmaxALS1->Fill(double(ieta), double(k3), bbbc);
3513                     h_2D0sumTSmaxALS1->Fill(double(ieta), double(k3), bbb1);
3514                     h_sumTSmaxAperLS1->Fill(float(lscounterM1), bbbc);
3515                     if (bbbc / bbb1 > lsdep_estimator3_HBdepth1_)
3516                       h_sumCutTSmaxAperLS1->Fill(float(lscounterM1), bbbc);
3517                     h_sum0TSmaxAperLS1->Fill(float(lscounterM1), bbb1);
3518                     if (bbbc / bbb1 > 2. * lsdep_estimator3_HBdepth1_)
3519                       h_sumTSmaxAperLS1_LSselected->Fill(float(lscounterM1), bbbc);
3520                   }
3521                   if (k1 + 1 == 2) {
3522                     h_sumTSmaxALS2->Fill(bbbc / bbb1);
3523                     if (bbbc / bbb1 > lsdep_estimator3_HBdepth2_)
3524                       h_2DsumTSmaxALS2->Fill(double(ieta), double(k3), bbbc);
3525                     h_2D0sumTSmaxALS2->Fill(double(ieta), double(k3), bbb1);
3526                     h_sumTSmaxAperLS2->Fill(float(lscounterM1), bbbc);
3527                     if (bbbc / bbb1 > lsdep_estimator3_HBdepth2_)
3528                       h_sumCutTSmaxAperLS2->Fill(float(lscounterM1), bbbc);
3529                     h_sum0TSmaxAperLS2->Fill(float(lscounterM1), bbb1);
3530                   }
3531                 }
3532                 // HE:
3533                 if (k0 == 1) {
3534                   // HBdepth1
3535                   if (k1 + 1 == 1) {
3536                     h_sumTSmaxALS3->Fill(bbbc / bbb1);
3537                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth1_)
3538                       h_2DsumTSmaxALS3->Fill(double(ieta), double(k3), bbbc);
3539                     h_2D0sumTSmaxALS3->Fill(double(ieta), double(k3), bbb1);
3540                     h_sumTSmaxAperLS3->Fill(float(lscounterM1), bbbc);
3541                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth1_)
3542                       h_sumCutTSmaxAperLS3->Fill(float(lscounterM1), bbbc);
3543                     h_sum0TSmaxAperLS3->Fill(float(lscounterM1), bbb1);
3544                   }
3545                   if (k1 + 1 == 2) {
3546                     h_sumTSmaxALS4->Fill(bbbc / bbb1);
3547                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth2_)
3548                       h_2DsumTSmaxALS4->Fill(double(ieta), double(k3), bbbc);
3549                     h_2D0sumTSmaxALS4->Fill(double(ieta), double(k3), bbb1);
3550                     h_sumTSmaxAperLS4->Fill(float(lscounterM1), bbbc);
3551                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth2_)
3552                       h_sumCutTSmaxAperLS4->Fill(float(lscounterM1), bbbc);
3553                     h_sum0TSmaxAperLS4->Fill(float(lscounterM1), bbb1);
3554                   }
3555                   if (k1 + 1 == 3) {
3556                     h_sumTSmaxALS5->Fill(bbbc / bbb1);
3557                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth3_)
3558                       h_2DsumTSmaxALS5->Fill(double(ieta), double(k3), bbbc);
3559                     h_2D0sumTSmaxALS5->Fill(double(ieta), double(k3), bbb1);
3560                     h_sumTSmaxAperLS5->Fill(float(lscounterM1), bbbc);
3561                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth3_)
3562                       h_sumCutTSmaxAperLS5->Fill(float(lscounterM1), bbbc);
3563                     h_sum0TSmaxAperLS5->Fill(float(lscounterM1), bbb1);
3564                   }
3565                 }
3566                 // HF:
3567                 if (k0 == 3) {
3568                   // HBdepth1
3569                   if (k1 + 1 == 1) {
3570                     h_sumTSmaxALS6->Fill(bbbc / bbb1);
3571                     if (bbbc / bbb1 > lsdep_estimator3_HFdepth1_)
3572                       h_2DsumTSmaxALS6->Fill(double(ieta), double(k3), bbbc);
3573                     h_2D0sumTSmaxALS6->Fill(double(ieta), double(k3), bbb1);
3574                     h_sumTSmaxAperLS6->Fill(float(lscounterM1), bbbc);
3575                     if (bbbc / bbb1 > lsdep_estimator3_HFdepth1_)
3576                       h_sumCutTSmaxAperLS6->Fill(float(lscounterM1), bbbc);
3577                     h_sum0TSmaxAperLS6->Fill(float(lscounterM1), bbb1);
3578                   }
3579                   if (k1 + 1 == 2) {
3580                     h_sumTSmaxALS7->Fill(bbbc / bbb1);
3581                     if (bbbc / bbb1 > lsdep_estimator3_HFdepth2_)
3582                       h_2DsumTSmaxALS7->Fill(double(ieta), double(k3), bbbc);
3583                     h_2D0sumTSmaxALS7->Fill(double(ieta), double(k3), bbb1);
3584                     h_sumTSmaxAperLS7->Fill(float(lscounterM1), bbbc);
3585                     if (bbbc / bbb1 > lsdep_estimator3_HFdepth2_)
3586                       h_sumCutTSmaxAperLS7->Fill(float(lscounterM1), bbbc);
3587                     h_sum0TSmaxAperLS7->Fill(float(lscounterM1), bbb1);
3588                   }
3589                 }
3590                 // HO:
3591                 if (k0 == 2) {
3592                   // HBdepth1
3593                   if (k1 + 1 == 4) {
3594                     h_sumTSmaxALS8->Fill(bbbc / bbb1);
3595                     if (bbbc / bbb1 > lsdep_estimator3_HOdepth4_)
3596                       h_2DsumTSmaxALS8->Fill(double(ieta), double(k3), bbbc);
3597                     h_2D0sumTSmaxALS8->Fill(double(ieta), double(k3), bbb1);
3598                     h_sumTSmaxAperLS8->Fill(float(lscounterM1), bbbc);
3599                     if (bbbc / bbb1 > lsdep_estimator3_HOdepth4_)
3600                       h_sumCutTSmaxAperLS8->Fill(float(lscounterM1), bbbc);
3601                     h_sum0TSmaxAperLS8->Fill(float(lscounterM1), bbb1);
3602                   }
3603                 }
3604               }  //if(sumEstimator3[k0][k1][k2][k3] != 0.
3605 
3606               // ------------------------------------------------------------------------------------------------------------------------sumEstimator4
3607               if (sumEstimator4[k0][k1][k2][k3] != 0.) {
3608                 // fill histoes:
3609                 double bbbc = 0.;
3610                 if (flagestimatornormalization_ == 0)
3611                   bbbc = sumEstimator4[k0][k1][k2][k3] / nevcounter0;
3612                 if (flagestimatornormalization_ == 1)
3613                   bbbc = sumEstimator4[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3614                 double bbb1 = 1.;
3615                 if (flagestimatornormalization_ == 2) {
3616                   bbbc = sumEstimator4[k0][k1][k2][k3];
3617                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3618                 }
3619 
3620                 // HB:
3621                 if (k0 == 0) {
3622                   // HBdepth1
3623                   if (k1 + 1 == 1) {
3624                     h_sumAmplitudeLS1->Fill(bbbc / bbb1);
3625                     if (bbbc / bbb1 > lsdep_estimator4_HBdepth1_)
3626                       h_2DsumAmplitudeLS1->Fill(double(ieta), double(k3), bbbc);
3627                     h_2D0sumAmplitudeLS1->Fill(double(ieta), double(k3), bbb1);
3628                     h_sumAmplitudeperLS1->Fill(float(lscounterM1), bbbc);
3629                     if (bbbc / bbb1 > lsdep_estimator4_HBdepth1_)
3630                       h_sumCutAmplitudeperLS1->Fill(float(lscounterM1), bbbc);
3631                     h_sum0AmplitudeperLS1->Fill(float(lscounterM1), bbb1);
3632                     if (bbbc / bbb1 > 2. * lsdep_estimator4_HBdepth1_)
3633                       h_sumAmplitudeperLS1_LSselected->Fill(float(lscounterM1), bbbc);
3634                   }
3635                   if (k1 + 1 == 2) {
3636                     h_sumAmplitudeLS2->Fill(bbbc / bbb1);
3637                     if (bbbc / bbb1 > lsdep_estimator4_HBdepth2_)
3638                       h_2DsumAmplitudeLS2->Fill(double(ieta), double(k3), bbbc);
3639                     h_2D0sumAmplitudeLS2->Fill(double(ieta), double(k3), bbb1);
3640                     h_sumAmplitudeperLS2->Fill(float(lscounterM1), bbbc);
3641                     if (bbbc / bbb1 > lsdep_estimator4_HBdepth2_)
3642                       h_sumCutAmplitudeperLS2->Fill(float(lscounterM1), bbbc);
3643                     h_sum0AmplitudeperLS2->Fill(float(lscounterM1), bbb1);
3644                   }
3645                 }
3646                 // HE:
3647                 if (k0 == 1) {
3648                   // HBdepth1
3649                   if (k1 + 1 == 1) {
3650                     h_sumAmplitudeLS3->Fill(bbbc / bbb1);
3651                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth1_)
3652                       h_2DsumAmplitudeLS3->Fill(double(ieta), double(k3), bbbc);
3653                     h_2D0sumAmplitudeLS3->Fill(double(ieta), double(k3), bbb1);
3654                     h_sumAmplitudeperLS3->Fill(float(lscounterM1), bbbc);
3655                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth1_)
3656                       h_sumCutAmplitudeperLS3->Fill(float(lscounterM1), bbbc);
3657                     h_sum0AmplitudeperLS3->Fill(float(lscounterM1), bbb1);
3658                   }
3659                   if (k1 + 1 == 2) {
3660                     h_sumAmplitudeLS4->Fill(bbbc / bbb1);
3661                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth2_)
3662                       h_2DsumAmplitudeLS4->Fill(double(ieta), double(k3), bbbc);
3663                     h_2D0sumAmplitudeLS4->Fill(double(ieta), double(k3), bbb1);
3664                     h_sumAmplitudeperLS4->Fill(float(lscounterM1), bbbc);
3665                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth2_)
3666                       h_sumCutAmplitudeperLS4->Fill(float(lscounterM1), bbbc);
3667                     h_sum0AmplitudeperLS4->Fill(float(lscounterM1), bbb1);
3668                   }
3669                   if (k1 + 1 == 3) {
3670                     h_sumAmplitudeLS5->Fill(bbbc / bbb1);
3671                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth3_)
3672                       h_2DsumAmplitudeLS5->Fill(double(ieta), double(k3), bbbc);
3673                     h_2D0sumAmplitudeLS5->Fill(double(ieta), double(k3), bbb1);
3674                     h_sumAmplitudeperLS5->Fill(float(lscounterM1), bbbc);
3675                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth3_)
3676                       h_sumCutAmplitudeperLS5->Fill(float(lscounterM1), bbbc);
3677                     h_sum0AmplitudeperLS5->Fill(float(lscounterM1), bbb1);
3678                   }
3679                 }
3680                 // HF:
3681                 if (k0 == 3) {
3682                   // HBdepth1
3683                   if (k1 + 1 == 1) {
3684                     h_sumAmplitudeLS6->Fill(bbbc / bbb1);
3685                     if (bbbc / bbb1 > lsdep_estimator4_HFdepth1_)
3686                       h_2DsumAmplitudeLS6->Fill(double(ieta), double(k3), bbbc);
3687                     h_2D0sumAmplitudeLS6->Fill(double(ieta), double(k3), bbb1);
3688                     h_sumAmplitudeperLS6->Fill(float(lscounterM1), bbbc);
3689                     if (bbbc / bbb1 > lsdep_estimator4_HFdepth1_)
3690                       h_sumCutAmplitudeperLS6->Fill(float(lscounterM1), bbbc);
3691                     h_sum0AmplitudeperLS6->Fill(float(lscounterM1), bbb1);
3692                   }
3693                   if (k1 + 1 == 2) {
3694                     h_sumAmplitudeLS7->Fill(bbbc / bbb1);
3695                     if (bbbc / bbb1 > lsdep_estimator4_HFdepth2_)
3696                       h_2DsumAmplitudeLS7->Fill(double(ieta), double(k3), bbbc);
3697                     h_2D0sumAmplitudeLS7->Fill(double(ieta), double(k3), bbb1);
3698                     h_sumAmplitudeperLS7->Fill(float(lscounterM1), bbbc);
3699                     if (bbbc / bbb1 > lsdep_estimator4_HFdepth2_)
3700                       h_sumCutAmplitudeperLS7->Fill(float(lscounterM1), bbbc);
3701                     h_sum0AmplitudeperLS7->Fill(float(lscounterM1), bbb1);
3702                   }
3703                 }
3704                 // HO:
3705                 if (k0 == 2) {
3706                   // HBdepth1
3707                   if (k1 + 1 == 4) {
3708                     h_sumAmplitudeLS8->Fill(bbbc / bbb1);
3709                     if (bbbc / bbb1 > lsdep_estimator4_HOdepth4_)
3710                       h_2DsumAmplitudeLS8->Fill(double(ieta), double(k3), bbbc);
3711                     h_2D0sumAmplitudeLS8->Fill(double(ieta), double(k3), bbb1);
3712                     h_sumAmplitudeperLS8->Fill(float(lscounterM1), bbbc);
3713                     if (bbbc / bbb1 > lsdep_estimator4_HOdepth4_)
3714                       h_sumCutAmplitudeperLS8->Fill(float(lscounterM1), bbbc);
3715                     h_sum0AmplitudeperLS8->Fill(float(lscounterM1), bbb1);
3716                   }
3717                 }
3718               }  //if(sumEstimator4[k0][k1][k2][k3] != 0.
3719               // ------------------------------------------------------------------------------------------------------------------------sumEstimator5
3720               if (sumEstimator5[k0][k1][k2][k3] != 0.) {
3721                 // fill histoes:
3722                 double bbbc = 0.;
3723                 if (flagestimatornormalization_ == 0)
3724                   bbbc = sumEstimator5[k0][k1][k2][k3] / nevcounter0;
3725                 if (flagestimatornormalization_ == 1)
3726                   bbbc = sumEstimator5[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3727                 double bbb1 = 1.;
3728                 if (flagestimatornormalization_ == 2) {
3729                   bbbc = sumEstimator5[k0][k1][k2][k3];
3730                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3731                 }
3732 
3733                 // HB:
3734                 if (k0 == 0) {
3735                   // HBdepth1
3736                   if (k1 + 1 == 1) {
3737                     h_sumAmplLS1->Fill(bbbc / bbb1);
3738                     if (bbbc / bbb1 > lsdep_estimator5_HBdepth1_)
3739                       h_2DsumAmplLS1->Fill(double(ieta), double(k3), bbbc);
3740                     h_2D0sumAmplLS1->Fill(double(ieta), double(k3), bbb1);
3741                     h_sumAmplperLS1->Fill(float(lscounterM1), bbbc);
3742                     if (bbbc / bbb1 > lsdep_estimator5_HBdepth1_)
3743                       h_sumCutAmplperLS1->Fill(float(lscounterM1), bbbc);
3744                     h_sum0AmplperLS1->Fill(float(lscounterM1), bbb1);
3745                     if (bbbc / bbb1 > 2. * lsdep_estimator5_HBdepth1_)
3746                       h_sumAmplperLS1_LSselected->Fill(float(lscounterM1), bbbc);
3747                   }
3748                   if (k1 + 1 == 2) {
3749                     h_sumAmplLS2->Fill(bbbc / bbb1);
3750                     if (bbbc / bbb1 > lsdep_estimator5_HBdepth2_)
3751                       h_2DsumAmplLS2->Fill(double(ieta), double(k3), bbbc);
3752                     h_2D0sumAmplLS2->Fill(double(ieta), double(k3), bbb1);
3753                     h_sumAmplperLS2->Fill(float(lscounterM1), bbbc);
3754                     if (bbbc / bbb1 > lsdep_estimator5_HBdepth2_)
3755                       h_sumCutAmplperLS2->Fill(float(lscounterM1), bbbc);
3756                     h_sum0AmplperLS2->Fill(float(lscounterM1), bbb1);
3757                   }
3758                 }
3759                 // HE:
3760                 if (k0 == 1) {
3761                   // HEdepth1
3762                   if (k1 + 1 == 1) {
3763                     h_sumAmplLS3->Fill(bbbc / bbb1);
3764                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth1_)
3765                       h_2DsumAmplLS3->Fill(double(ieta), double(k3), bbbc);
3766                     h_2D0sumAmplLS3->Fill(double(ieta), double(k3), bbb1);
3767                     h_sumAmplperLS3->Fill(float(lscounterM1), bbbc);
3768                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth1_)
3769                       h_sumCutAmplperLS3->Fill(float(lscounterM1), bbbc);
3770                     h_sum0AmplperLS3->Fill(float(lscounterM1), bbb1);
3771                   }
3772                   if (k1 + 1 == 2) {
3773                     h_sumAmplLS4->Fill(bbbc / bbb1);
3774                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth2_)
3775                       h_2DsumAmplLS4->Fill(double(ieta), double(k3), bbbc);
3776                     h_2D0sumAmplLS4->Fill(double(ieta), double(k3), bbb1);
3777                     h_sumAmplperLS4->Fill(float(lscounterM1), bbbc);
3778                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth2_)
3779                       h_sumCutAmplperLS4->Fill(float(lscounterM1), bbbc);
3780                     h_sum0AmplperLS4->Fill(float(lscounterM1), bbb1);
3781                   }
3782                   if (k1 + 1 == 3) {
3783                     h_sumAmplLS5->Fill(bbbc / bbb1);
3784                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth3_)
3785                       h_2DsumAmplLS5->Fill(double(ieta), double(k3), bbbc);
3786                     h_2D0sumAmplLS5->Fill(double(ieta), double(k3), bbb1);
3787                     h_sumAmplperLS5->Fill(float(lscounterM1), bbbc);
3788                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth3_)
3789                       h_sumCutAmplperLS5->Fill(float(lscounterM1), bbbc);
3790                     h_sum0AmplperLS5->Fill(float(lscounterM1), bbb1);
3791                   }
3792                 }
3793                 // HF:
3794                 if (k0 == 3) {
3795                   // HFdepth1
3796                   if (k1 + 1 == 1) {
3797                     h_sumAmplLS6->Fill(bbbc / bbb1);
3798                     if (bbbc / bbb1 > lsdep_estimator5_HFdepth1_)
3799                       h_2DsumAmplLS6->Fill(double(ieta), double(k3), bbbc);
3800                     h_2D0sumAmplLS6->Fill(double(ieta), double(k3), bbb1);
3801                     h_sumAmplperLS6->Fill(float(lscounterM1), bbbc);
3802                     if (bbbc / bbb1 > lsdep_estimator5_HFdepth1_)
3803                       h_sumCutAmplperLS6->Fill(float(lscounterM1), bbbc);
3804                     h_sum0AmplperLS6->Fill(float(lscounterM1), bbb1);
3805                   }
3806                   if (k1 + 1 == 2) {
3807                     h_sumAmplLS7->Fill(bbbc / bbb1);
3808                     if (bbbc / bbb1 > lsdep_estimator5_HFdepth2_)
3809                       h_2DsumAmplLS7->Fill(double(ieta), double(k3), bbbc);
3810                     h_2D0sumAmplLS7->Fill(double(ieta), double(k3), bbb1);
3811                     h_sumAmplperLS7->Fill(float(lscounterM1), bbbc);
3812                     if (bbbc / bbb1 > lsdep_estimator5_HFdepth2_)
3813                       h_sumCutAmplperLS7->Fill(float(lscounterM1), bbbc);
3814                     h_sum0AmplperLS7->Fill(float(lscounterM1), bbb1);
3815                   }
3816                 }
3817                 // HO:
3818                 if (k0 == 2) {
3819                   // HOdepth4
3820                   if (k1 + 1 == 4) {
3821                     h_sumAmplLS8->Fill(bbbc / bbb1);
3822                     if (bbbc / bbb1 > lsdep_estimator5_HOdepth4_)
3823                       h_2DsumAmplLS8->Fill(double(ieta), double(k3), bbbc);
3824                     h_2D0sumAmplLS8->Fill(double(ieta), double(k3), bbb1);
3825                     h_sumAmplperLS8->Fill(float(lscounterM1), bbbc);
3826                     if (bbbc / bbb1 > lsdep_estimator5_HOdepth4_)
3827                       h_sumCutAmplperLS8->Fill(float(lscounterM1), bbbc);
3828                     h_sum0AmplperLS8->Fill(float(lscounterM1), bbb1);
3829                   }
3830                 }
3831               }  //if(sumEstimator5[k0][k1][k2][k3] != 0.
3832               // ------------------------------------------------------------------------------------------------------------------------sumEstimator6 (Error-B)
3833               if (sumEstimator6[k0][k1][k2][k3] != 0.) {
3834                 // fill histoes:
3835                 double bbbc = 0.;
3836                 if (flagestimatornormalization_ == 0)
3837                   bbbc = sumEstimator6[k0][k1][k2][k3] / nevcounter0;
3838                 if (flagestimatornormalization_ == 1)
3839                   bbbc = sumEstimator6[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3840                 double bbb1 = 1.;
3841                 if (flagestimatornormalization_ == 2) {
3842                   bbbc = sumEstimator6[k0][k1][k2][k3];
3843                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3844                 }
3845 
3846                 // HB:
3847                 if (k0 == 0) {
3848                   // HBdepth1
3849                   if (k1 + 1 == 1) {
3850                     h_sumErrorBLS1->Fill(bbbc / bbb1);
3851                     h_2DsumErrorBLS1->Fill(double(ieta), double(k3), bbbc);
3852                     h_2D0sumErrorBLS1->Fill(double(ieta), double(k3), bbb1);
3853                     h_sumErrorBperLS1->Fill(float(lscounterM1), bbbc);
3854                     h_sum0ErrorBperLS1->Fill(float(lscounterM1), bbb1);
3855                   }
3856                   if (k1 + 1 == 2) {
3857                     h_sumErrorBLS2->Fill(bbbc / bbb1);
3858                     h_2DsumErrorBLS2->Fill(double(ieta), double(k3), bbbc);
3859                     h_2D0sumErrorBLS2->Fill(double(ieta), double(k3), bbb1);
3860                     h_sumErrorBperLS2->Fill(float(lscounterM1), bbbc);
3861                     h_sum0ErrorBperLS2->Fill(float(lscounterM1), bbb1);
3862                   }
3863                 }
3864                 // HE:
3865                 if (k0 == 1) {
3866                   // HEdepth1
3867                   if (k1 + 1 == 1) {
3868                     h_sumErrorBLS3->Fill(bbbc / bbb1);
3869                     h_2DsumErrorBLS3->Fill(double(ieta), double(k3), bbbc);
3870                     h_2D0sumErrorBLS3->Fill(double(ieta), double(k3), bbb1);
3871                     h_sumErrorBperLS3->Fill(float(lscounterM1), bbbc);
3872                     h_sum0ErrorBperLS3->Fill(float(lscounterM1), bbb1);
3873                   }
3874                   if (k1 + 1 == 2) {
3875                     h_sumErrorBLS4->Fill(bbbc / bbb1);
3876                     h_2DsumErrorBLS4->Fill(double(ieta), double(k3), bbbc);
3877                     h_2D0sumErrorBLS4->Fill(double(ieta), double(k3), bbb1);
3878                     h_sumErrorBperLS4->Fill(float(lscounterM1), bbbc);
3879                     h_sum0ErrorBperLS4->Fill(float(lscounterM1), bbb1);
3880                   }
3881                   if (k1 + 1 == 3) {
3882                     h_sumErrorBLS5->Fill(bbbc / bbb1);
3883                     h_2DsumErrorBLS5->Fill(double(ieta), double(k3), bbbc);
3884                     h_2D0sumErrorBLS5->Fill(double(ieta), double(k3), bbb1);
3885                     h_sumErrorBperLS5->Fill(float(lscounterM1), bbbc);
3886                     h_sum0ErrorBperLS5->Fill(float(lscounterM1), bbb1);
3887                   }
3888                 }
3889                 // HF:
3890                 if (k0 == 3) {
3891                   // HFdepth1
3892                   if (k1 + 1 == 1) {
3893                     h_sumErrorBLS6->Fill(bbbc / bbb1);
3894                     h_2DsumErrorBLS6->Fill(double(ieta), double(k3), bbbc);
3895                     h_2D0sumErrorBLS6->Fill(double(ieta), double(k3), bbb1);
3896                     h_sumErrorBperLS6->Fill(float(lscounterM1), bbbc);
3897                     h_sum0ErrorBperLS6->Fill(float(lscounterM1), bbb1);
3898                   }
3899                   if (k1 + 1 == 2) {
3900                     h_sumErrorBLS7->Fill(bbbc / bbb1);
3901                     h_2DsumErrorBLS7->Fill(double(ieta), double(k3), bbbc);
3902                     h_2D0sumErrorBLS7->Fill(double(ieta), double(k3), bbb1);
3903                     h_sumErrorBperLS7->Fill(float(lscounterM1), bbbc);
3904                     h_sum0ErrorBperLS7->Fill(float(lscounterM1), bbb1);
3905                   }
3906                 }
3907                 // HO:
3908                 if (k0 == 2) {
3909                   // HOdepth4
3910                   if (k1 + 1 == 4) {
3911                     h_sumErrorBLS8->Fill(bbbc / bbb1);
3912                     h_2DsumErrorBLS8->Fill(double(ieta), double(k3), bbbc);
3913                     h_2D0sumErrorBLS8->Fill(double(ieta), double(k3), bbb1);
3914                     h_sumErrorBperLS8->Fill(float(lscounterM1), bbbc);
3915                     h_sum0ErrorBperLS8->Fill(float(lscounterM1), bbb1);
3916                   }
3917                 }
3918                 ///
3919               }  //if(sumEstimator6[k0][k1][k2][k3] != 0.
3920             }    //for k2
3921             // occupancy distributions for error-A:
3922             // HB
3923             if (k0 == 0 && k1 == 0) {
3924               if (pcountmin1 > 0) {
3925                 if (pcountmin1 < pnnmin1)
3926                   pnnmin1 = pcountmin1;
3927                 pcountmin1 = 0;
3928               }
3929               if (mcountmin1 > 0) {
3930                 if (mcountmin1 < mnnmin1)
3931                   mnnmin1 = mcountmin1;
3932                 mcountmin1 = 0;
3933                 mnnbins1++;
3934               }
3935             }  //
3936             // HE
3937             if (k0 == 1 && k1 == 0) {
3938               if (pcountmin3 > 0) {
3939                 if (pcountmin3 < pnnmin3)
3940                   pnnmin3 = pcountmin3;
3941                 pcountmin3 = 0;
3942               }
3943               if (mcountmin3 > 0) {
3944                 if (mcountmin3 < mnnmin3)
3945                   mnnmin3 = mcountmin3;
3946                 mcountmin3 = 0;
3947                 mnnbins3++;
3948               }
3949             }  //
3950             // HO
3951             if (k0 == 2 && k1 == 3) {
3952               if (pcountmin8 > 0) {
3953                 if (pcountmin8 < pnnmin8)
3954                   pnnmin8 = pcountmin8;
3955                 pcountmin8 = 0;
3956               }
3957               if (mcountmin8 > 0) {
3958                 if (mcountmin8 < mnnmin8)
3959                   mnnmin8 = mcountmin8;
3960                 mcountmin8 = 0;
3961                 mnnbins8++;
3962               }
3963             }  //
3964             // HF
3965             if (k0 == 3 && k1 == 0) {
3966               if (pcountmin6 > 0) {
3967                 if (pcountmin6 < pnnmin6)
3968                   pnnmin6 = pcountmin6;
3969                 pcountmin6 = 0;
3970               }
3971               if (mcountmin6 > 0) {
3972                 if (mcountmin6 < mnnmin6)
3973                   mnnmin6 = mcountmin6;
3974                 mcountmin6 = 0;
3975                 mnnbins6++;
3976               }
3977             }  //
3978 
3979           }  //for k3
3980         }    //for k1
3981       }      //for k0
3982       ///////  int sub= cell.subdet();  1-HB, 2-HE, 3-HO, 4-HF
3983       ////////////            k0(sub): =0 HB; =1 HE; =2 HO; =3 HF;
3984       ////////////         k1(depth-1): = 0 - 3 or depth: = 1 - 4;
3985 
3986       //   cout<<"=============================== lscounterM1 = "<<   (float)lscounterM1    <<endl;
3987 
3988       float patiooccupancy1 = 0.;
3989       if (pcountall1 != 0)
3990         patiooccupancy1 = (float)pnnmin1 * mnnbins1 / pcountall1;
3991       h_RatioOccupancy_HBM->Fill(float(lscounterM1), patiooccupancy1);
3992       float matiooccupancy1 = 0.;
3993       if (mcountall1 != 0)
3994         matiooccupancy1 = (float)mnnmin1 * mnnbins1 / mcountall1;
3995       h_RatioOccupancy_HBP->Fill(float(lscounterM1), matiooccupancy1);
3996 
3997       float patiooccupancy3 = 0.;
3998       if (pcountall3 != 0)
3999         patiooccupancy3 = (float)pnnmin3 * mnnbins3 / pcountall3;
4000       h_RatioOccupancy_HEM->Fill(float(lscounterM1), patiooccupancy3);
4001       float matiooccupancy3 = 0.;
4002       if (mcountall3 != 0)
4003         matiooccupancy3 = (float)mnnmin3 * mnnbins3 / mcountall3;
4004       h_RatioOccupancy_HEP->Fill(float(lscounterM1), matiooccupancy3);
4005 
4006       float patiooccupancy6 = 0.;
4007       if (pcountall6 != 0)
4008         patiooccupancy6 = (float)pnnmin6 * mnnbins6 / pcountall6;
4009       h_RatioOccupancy_HFM->Fill(float(lscounterM1), patiooccupancy6);
4010       float matiooccupancy6 = 0.;
4011       if (mcountall6 != 0)
4012         matiooccupancy6 = (float)mnnmin6 * mnnbins6 / mcountall6;
4013       h_RatioOccupancy_HFP->Fill(float(lscounterM1), matiooccupancy6);
4014 
4015       float patiooccupancy8 = 0.;
4016       if (pcountall8 != 0)
4017         patiooccupancy8 = (float)pnnmin8 * mnnbins8 / pcountall8;
4018       h_RatioOccupancy_HOM->Fill(float(lscounterM1), patiooccupancy8);
4019       float matiooccupancy8 = 0.;
4020       if (mcountall8 != 0)
4021         matiooccupancy8 = (float)mnnmin8 * mnnbins8 / mcountall8;
4022       h_RatioOccupancy_HOP->Fill(float(lscounterM1), matiooccupancy8);
4023 
4024       for (int k0 = 0; k0 < nsub; k0++) {
4025         for (int k1 = 0; k1 < ndepth; k1++) {
4026           for (int k2 = 0; k2 < neta; k2++) {
4027             for (int k3 = 0; k3 < nphi; k3++) {
4028               // reset massives:
4029               sumEstimator0[k0][k1][k2][k3] = 0.;
4030               sumEstimator1[k0][k1][k2][k3] = 0.;
4031               sumEstimator2[k0][k1][k2][k3] = 0.;
4032               sumEstimator3[k0][k1][k2][k3] = 0.;
4033               sumEstimator4[k0][k1][k2][k3] = 0.;
4034               sumEstimator5[k0][k1][k2][k3] = 0.;
4035               sumEstimator6[k0][k1][k2][k3] = 0.;
4036               sum0Estimator[k0][k1][k2][k3] = 0.;
4037             }  //for
4038           }    //for
4039         }      //for
4040       }        //for
4041 
4042       //------------------------------------------------------                        averSIGNAL
4043       averSIGNALoccupancy_HB /= float(nevcounter0);
4044       h_averSIGNALoccupancy_HB->Fill(float(lscounterM1), averSIGNALoccupancy_HB);
4045       averSIGNALoccupancy_HE /= float(nevcounter0);
4046       h_averSIGNALoccupancy_HE->Fill(float(lscounterM1), averSIGNALoccupancy_HE);
4047       averSIGNALoccupancy_HF /= float(nevcounter0);
4048       h_averSIGNALoccupancy_HF->Fill(float(lscounterM1), averSIGNALoccupancy_HF);
4049       averSIGNALoccupancy_HO /= float(nevcounter0);
4050       h_averSIGNALoccupancy_HO->Fill(float(lscounterM1), averSIGNALoccupancy_HO);
4051 
4052       averSIGNALoccupancy_HB = 0.;
4053       averSIGNALoccupancy_HE = 0.;
4054       averSIGNALoccupancy_HF = 0.;
4055       averSIGNALoccupancy_HO = 0.;
4056 
4057       //------------------------------------------------------
4058       averSIGNALsumamplitude_HB /= float(nevcounter0);
4059       h_averSIGNALsumamplitude_HB->Fill(float(lscounterM1), averSIGNALsumamplitude_HB);
4060       averSIGNALsumamplitude_HE /= float(nevcounter0);
4061       h_averSIGNALsumamplitude_HE->Fill(float(lscounterM1), averSIGNALsumamplitude_HE);
4062       averSIGNALsumamplitude_HF /= float(nevcounter0);
4063       h_averSIGNALsumamplitude_HF->Fill(float(lscounterM1), averSIGNALsumamplitude_HF);
4064       averSIGNALsumamplitude_HO /= float(nevcounter0);
4065       h_averSIGNALsumamplitude_HO->Fill(float(lscounterM1), averSIGNALsumamplitude_HO);
4066 
4067       averSIGNALsumamplitude_HB = 0.;
4068       averSIGNALsumamplitude_HE = 0.;
4069       averSIGNALsumamplitude_HF = 0.;
4070       averSIGNALsumamplitude_HO = 0.;
4071 
4072       //------------------------------------------------------                        averNOSIGNAL
4073       averNOSIGNALoccupancy_HB /= float(nevcounter0);
4074       h_averNOSIGNALoccupancy_HB->Fill(float(lscounterM1), averNOSIGNALoccupancy_HB);
4075       averNOSIGNALoccupancy_HE /= float(nevcounter0);
4076       h_averNOSIGNALoccupancy_HE->Fill(float(lscounterM1), averNOSIGNALoccupancy_HE);
4077       averNOSIGNALoccupancy_HF /= float(nevcounter0);
4078       h_averNOSIGNALoccupancy_HF->Fill(float(lscounterM1), averNOSIGNALoccupancy_HF);
4079       averNOSIGNALoccupancy_HO /= float(nevcounter0);
4080       h_averNOSIGNALoccupancy_HO->Fill(float(lscounterM1), averNOSIGNALoccupancy_HO);
4081 
4082       averNOSIGNALoccupancy_HB = 0.;
4083       averNOSIGNALoccupancy_HE = 0.;
4084       averNOSIGNALoccupancy_HF = 0.;
4085       averNOSIGNALoccupancy_HO = 0.;
4086 
4087       //------------------------------------------------------
4088       averNOSIGNALsumamplitude_HB /= float(nevcounter0);
4089       h_averNOSIGNALsumamplitude_HB->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HB);
4090       averNOSIGNALsumamplitude_HE /= float(nevcounter0);
4091       h_averNOSIGNALsumamplitude_HE->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HE);
4092       averNOSIGNALsumamplitude_HF /= float(nevcounter0);
4093       h_averNOSIGNALsumamplitude_HF->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HF);
4094       averNOSIGNALsumamplitude_HO /= float(nevcounter0);
4095       h_averNOSIGNALsumamplitude_HO->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HO);
4096 
4097       averNOSIGNALsumamplitude_HB = 0.;
4098       averNOSIGNALsumamplitude_HE = 0.;
4099       averNOSIGNALsumamplitude_HF = 0.;
4100       averNOSIGNALsumamplitude_HO = 0.;
4101 
4102       //------------------------------------------------------   maxxSA and maxxOccupancy
4103       h_maxxSUMAmpl_HB->Fill(float(lscounterM1), maxxSUM1);
4104       h_maxxSUMAmpl_HE->Fill(float(lscounterM1), maxxSUM2);
4105       h_maxxSUMAmpl_HO->Fill(float(lscounterM1), maxxSUM3);
4106       h_maxxSUMAmpl_HF->Fill(float(lscounterM1), maxxSUM4);
4107       maxxSUM1 = 0.;
4108       maxxSUM2 = 0.;
4109       maxxSUM3 = 0.;
4110       maxxSUM4 = 0.;
4111       //------------------------------------------------------
4112       h_maxxOCCUP_HB->Fill(float(lscounterM1), maxxOCCUP1);
4113       h_maxxOCCUP_HE->Fill(float(lscounterM1), maxxOCCUP2);
4114       h_maxxOCCUP_HO->Fill(float(lscounterM1), maxxOCCUP3);
4115       h_maxxOCCUP_HF->Fill(float(lscounterM1), maxxOCCUP4);
4116       maxxOCCUP1 = 0.;
4117       maxxOCCUP2 = 0.;
4118       maxxOCCUP3 = 0.;
4119       maxxOCCUP4 = 0.;
4120 
4121       //------------------------------------------------------
4122     }  //if(nevcounter0 != 0)
4123        //  POINT1
4124 
4125     /////////////////////////////////////////////////// over DigiCollections:
4126     // for upgrade:
4127     for (int k1 = 0; k1 < ndepth; k1++) {
4128       for (int k2 = 0; k2 < neta; k2++) {
4129         for (int k3 = 0; k3 < nphi; k3++) {
4130           if (studyCalibCellsHist_) {
4131             signal[k1][k2][k3] = 0.;
4132             calibt[k1][k2][k3] = 0.;
4133             calibcapiderror[k1][k2][k3] = 0;
4134             caliba[k1][k2][k3] = 0.;
4135             calibw[k1][k2][k3] = 0.;
4136             calib0[k1][k2][k3] = 0.;
4137             signal3[k1][k2][k3] = 0.;
4138             calib3[k1][k2][k3] = 0.;
4139             calib2[k1][k2][k3] = 0.;
4140           }
4141           if (studyRunDependenceHist_) {
4142             for (int k0 = 0; k0 < nsub; k0++) {
4143               badchannels[k0][k1][k2][k3] = 0;
4144             }  //for
4145           }    //if
4146 
4147         }  //for
4148       }    //for
4149     }      //for
4150     for (int k0 = 0; k0 < nsub; k0++) {
4151       for (int k1 = 0; k1 < ndepth; k1++) {
4152         for (int k2 = 0; k2 < neta; k2++) {
4153           for (int k3 = 0; k3 < nphi; k3++) {
4154             amplitudechannel0[k0][k1][k2][k3] = 0.;
4155             amplitudechannel[k0][k1][k2][k3] = 0.;
4156             amplitudechannel2[k0][k1][k2][k3] = 0.;
4157 
4158             tocamplchannel[k0][k1][k2][k3] = 0.;
4159             maprphinorm[k0][k1][k2][k3] = 0.;
4160             // phi-symmetry monitoring for calibration group:
4161             // rec energy:
4162             recSignalEnergy0[k0][k1][k2][k3] = 0.;
4163             recSignalEnergy1[k0][k1][k2][k3] = 0.;
4164             recSignalEnergy2[k0][k1][k2][k3] = 0.;
4165             recNoiseEnergy0[k0][k1][k2][k3] = 0.;
4166             recNoiseEnergy1[k0][k1][k2][k3] = 0.;
4167             recNoiseEnergy2[k0][k1][k2][k3] = 0.;
4168 
4169           }  //k3
4170         }    //k2
4171       }      //k1
4172     }        //k0
4173     ///////////////////////////////////////////////////////////////////////////////////////////////////////////
4174     ///////////////////       END of GENERAL NULLING       ////////////////////////////////////////////////////
4175     ///////////////////////////////////////////////////////////////////////////////////////////////////////////
4176 
4177     if (flagToUseDigiCollectionsORNot_ != 0) {
4178       ///////////////////////////////////////////////////////////////////////////////////////////////////////////
4179       ////////////////////////      START of DigiCollections running:          ///////////////////////////////////
4180       ////////////////////////////////////////////////////////////////////
4181       if (flagupgradeqie1011_ != 2 && flagupgradeqie1011_ != 3 && flagupgradeqie1011_ != 6 &&
4182           flagupgradeqie1011_ != 7 && flagupgradeqie1011_ != 8) {
4183         edm::Handle<HFDigiCollection> hf;
4184         iEvent.getByToken(tok_hf_, hf);
4185         bool gotHFDigis = true;
4186         if (!(iEvent.getByToken(tok_hf_, hf))) {
4187           gotHFDigis = false;
4188         }  //this is a boolean set up to check if there are HFdigis in input root file
4189         if (!(hf.isValid())) {
4190           gotHFDigis = false;
4191         }  //if it is not there, leave it false
4192         if (!gotHFDigis) {
4193           std::cout << " ******************************  ===========================   No HFDigiCollection found "
4194                     << std::endl;
4195         } else {
4196           ////////////////////////////////////////////////////////////////////   qie8   QIE8 :
4197           for (HFDigiCollection::const_iterator digi = hf->begin(); digi != hf->end(); digi++) {
4198             eta = digi->id().ieta();
4199             phi = digi->id().iphi();
4200             depth = digi->id().depth();
4201             nTS = digi->size();
4202             ///////////////////
4203             counterhf++;
4204             ////////////////////////////////////////////////////////////  for zerrors.C script:
4205             if (recordHistoes_ && studyCapIDErrorsHist_)
4206               fillDigiErrorsHF(digi);
4207             //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4208             if (recordHistoes_)
4209               fillDigiAmplitudeHF(digi);
4210             //////////////////////////////////////////// calibration staff (often not needed):
4211             if (recordHistoes_ && studyCalibCellsHist_) {
4212               int iphi = phi - 1;
4213               int ieta = eta;
4214               if (ieta > 0)
4215                 ieta -= 1;
4216               if (nTS <= numOfTS)
4217                 for (int i = 0; i < nTS; i++) {
4218                   TS_data[i] = adc2fC[digi->sample(i).adc()];
4219                   signal[3][ieta + 41][iphi] += TS_data[i];
4220                   if (i > 1 && i < 6)
4221                     signal3[3][ieta + 41][iphi] += TS_data[i];
4222                 }  // TS
4223             }      // if(recordHistoes_ && studyCalibCellsHist_)
4224           }        // for
4225         }          // hf.isValid
4226       }            // end flagupgrade
4227 
4228       ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// HFQIE10 DigiCollection
4229       //////////////////////////////////////////////////////////////////////////////////////////////////upgradeHF upgradehf
4230       // upgrade:
4231       if (flagupgradeqie1011_ != 1) {
4232         edm::Handle<QIE10DigiCollection> hfqie10;
4233         iEvent.getByToken(tok_qie10_, hfqie10);
4234         const QIE10DigiCollection& qie10dc =
4235             *(hfqie10);  ////////////////////////////////////////////////    <<<=========  !!!!
4236         bool gotQIE10Digis = true;
4237         if (!(iEvent.getByToken(tok_qie10_, hfqie10))) {
4238           gotQIE10Digis = false;
4239         }  //this is a boolean set up to check if there are HFdigis in input root file
4240         if (!(hfqie10.isValid())) {
4241           gotQIE10Digis = false;
4242         }  //if it is not there, leave it false
4243         if (!gotQIE10Digis) {
4244           std::cout << " No QIE10DigiCollection collection is found " << std::endl;
4245         } else {
4246           ////////////////////////////////////////////////////////////////////   qie10   QIE10 :
4247           double totalAmplitudeHF = 0.;
4248           for (unsigned int j = 0; j < qie10dc.size(); j++) {
4249             QIE10DataFrame qie10df = static_cast<QIE10DataFrame>(qie10dc[j]);
4250             DetId detid = qie10df.detid();
4251             HcalDetId hcaldetid = HcalDetId(detid);
4252             int eta = hcaldetid.ieta();
4253             int phi = hcaldetid.iphi();
4254             //  int depth = hcaldetid.depth();
4255             // loop over the samples in the digi
4256             nTS = qie10df.samples();
4257             ///////////////////
4258             counterhfqie10++;
4259             ////////////////////////////////////////////////////////////  for zerrors.C script:
4260             if (recordHistoes_ && studyCapIDErrorsHist_)
4261               fillDigiErrorsHFQIE10(qie10df);
4262             //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4263             if (recordHistoes_)
4264               fillDigiAmplitudeHFQIE10(qie10df);
4265             ///////////////////
4266             //     if(recordHistoes_ ) {
4267             if (recordHistoes_ && studyCalibCellsHist_) {
4268               int iphi = phi - 1;
4269               int ieta = eta;
4270               if (ieta > 0)
4271                 ieta -= 1;
4272               double amplitudefullTSs = 0.;
4273               double nnnnnnTS = 0.;
4274               for (int i = 0; i < nTS; ++i) {
4275                 // j - QIE channel
4276                 // i - time sample (TS)
4277                 int adc = qie10df[i].adc();
4278                 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4279                 //        float charge = adc2fC_QIE10[ adc ];
4280                 TS_data[i] = adc2fC_QIE10[adc];
4281                 signal[3][ieta + 41][iphi] += TS_data[i];
4282                 totalAmplitudeHF += TS_data[i];
4283                 amplitudefullTSs += TS_data[i];
4284                 nnnnnnTS++;
4285                 if (i > 1 && i < 6)
4286                   signal3[3][ieta + 41][iphi] += TS_data[i];
4287 
4288               }  // TS
4289               h_numberofhitsHFtest->Fill(nnnnnnTS);
4290               h_AmplitudeHFtest->Fill(amplitudefullTSs);
4291             }  // if(recordHistoes_ && studyCalibCellsHist_)
4292           }    // for
4293           h_totalAmplitudeHF->Fill(totalAmplitudeHF);
4294           h_totalAmplitudeHFperEvent->Fill(float(eventcounter), totalAmplitudeHF);
4295         }  // hfqie10.isValid
4296       }    // end flagupgrade
4297       //end upgrade
4298       //
4299       //
4300       //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// HBHEDigiCollection  usual, <=2018
4301       int qwert1 = 0;
4302       int qwert2 = 0;
4303       int qwert3 = 0;
4304       int qwert4 = 0;
4305       int qwert5 = 0;
4306       if (flagupgradeqie1011_ != 2 && flagupgradeqie1011_ != 3) {
4307         edm::Handle<HBHEDigiCollection> hbhe;
4308         iEvent.getByToken(tok_hbhe_, hbhe);
4309         bool gotHBHEDigis = true;
4310         if (!(iEvent.getByToken(tok_hbhe_, hbhe)))
4311           gotHBHEDigis = false;  //this is a boolean set up to check if there are HBHEgigis in input root file
4312         if (!(hbhe.isValid()))
4313           gotHBHEDigis = false;  //if it is not there, leave it false
4314         if (!gotHBHEDigis) {
4315           std::cout << " No HBHEDigiCollection collection is found " << std::endl;
4316         } else {
4317           //      unsigned int NHBHEDigiCollectionsize =  hbhe->size();
4318           double totalAmplitudeHB = 0.;
4319           double totalAmplitudeHE = 0.;
4320           double nnnnnnTSHB = 0.;
4321           double nnnnnnTSHE = 0.;
4322 
4323           for (HBHEDigiCollection::const_iterator digi = hbhe->begin(); digi != hbhe->end(); digi++) {
4324             eta = digi->id().ieta();
4325             phi = digi->id().iphi();
4326             depth = digi->id().depth();
4327             nTS = digi->size();
4328             /////////////////////////////////////// counters of event*digis
4329             nnnnnnhbhe++;
4330             nnnnnn++;
4331             //////////////////////////////////  counters of event for subdet & depth
4332             if (digi->id().subdet() == HcalBarrel && depth == 1 && qwert1 == 0) {
4333               nnnnnn1++;
4334               qwert1 = 1;
4335             }
4336             if (digi->id().subdet() == HcalBarrel && depth == 2 && qwert2 == 0) {
4337               nnnnnn2++;
4338               qwert2 = 1;
4339             }
4340             if (digi->id().subdet() == HcalEndcap && depth == 1 && qwert3 == 0) {
4341               nnnnnn3++;
4342               qwert3 = 1;
4343             }
4344             if (digi->id().subdet() == HcalEndcap && depth == 2 && qwert4 == 0) {
4345               nnnnnn4++;
4346               qwert4 = 1;
4347             }
4348             if (digi->id().subdet() == HcalEndcap && depth == 3 && qwert5 == 0) {
4349               nnnnnn5++;
4350               qwert5 = 1;
4351             }
4352             ////////////////////////////////////////////////////////////  for zerrors.C script:
4353             if (recordHistoes_ && studyCapIDErrorsHist_)
4354               fillDigiErrors(digi);
4355             //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4356             if (recordHistoes_)
4357               fillDigiAmplitude(digi);
4358 
4359             if (recordHistoes_ && studyCalibCellsHist_) {
4360               int iphi = phi - 1;
4361               int ieta = eta;
4362               if (ieta > 0)
4363                 ieta -= 1;
4364               //////////////////////////////////////////    HB:
4365               if (digi->id().subdet() == HcalBarrel) {
4366                 double amplitudefullTSs = 0.;
4367                 nnnnnnTSHB++;
4368                 if (nTS <= numOfTS)
4369                   for (int i = 0; i < nTS; i++) {
4370                     TS_data[i] = adc2fC[digi->sample(i).adc()];
4371                     signal[0][ieta + 41][iphi] += TS_data[i];
4372                     amplitudefullTSs += TS_data[i];
4373                     totalAmplitudeHB += TS_data[i];
4374                     if (i > 1 && i < 6)
4375                       signal3[0][ieta + 41][iphi] += TS_data[i];
4376                   }
4377                 h_AmplitudeHBtest->Fill(amplitudefullTSs);
4378               }  // HB
4379               //////////////////////////////////////////    HE:
4380               if (digi->id().subdet() == HcalEndcap) {
4381                 double amplitudefullTSs = 0.;
4382                 nnnnnnTSHE++;
4383                 if (nTS <= numOfTS)
4384                   for (int i = 0; i < nTS; i++) {
4385                     TS_data[i] = adc2fC[digi->sample(i).adc()];
4386                     signal[1][ieta + 41][iphi] += TS_data[i];
4387                     totalAmplitudeHE += TS_data[i];
4388                     amplitudefullTSs += TS_data[i];
4389                     if (i > 1 && i < 6)
4390                       signal3[1][ieta + 41][iphi] += TS_data[i];
4391                   }
4392                 h_AmplitudeHEtest->Fill(amplitudefullTSs);
4393               }  // HE
4394 
4395             }  //if(recordHistoes_ && studyCalibCellsHist_)
4396             if (recordNtuples_ && nevent50 < maxNeventsInNtuple_) {
4397             }  //if(recordNtuples_)
4398           }    // for HBHE digis
4399           if (totalAmplitudeHB != 0.) {
4400             h_numberofhitsHBtest->Fill(nnnnnnTSHB);
4401             h_totalAmplitudeHB->Fill(totalAmplitudeHB);
4402             h_totalAmplitudeHBperEvent->Fill(float(eventcounter), totalAmplitudeHB);
4403           }
4404           if (totalAmplitudeHE != 0.) {
4405             h_numberofhitsHEtest->Fill(nnnnnnTSHE);
4406             h_totalAmplitudeHE->Fill(totalAmplitudeHE);
4407             h_totalAmplitudeHEperEvent->Fill(float(eventcounter), totalAmplitudeHE);
4408           }
4409         }  //hbhe.isValid
4410       }    // end flagupgrade
4411       //---------------------------------------------------------------
4412       //////////////////////////////////////////////////////////////////////////////////////////////////    upgradeHBHE upgradehe       HBHE with SiPM (both >=2020)
4413       // upgrade:
4414       if (flagupgradeqie1011_ != 1 && flagupgradeqie1011_ != 4 && flagupgradeqie1011_ != 5 &&
4415           flagupgradeqie1011_ != 10) {
4416         edm::Handle<QIE11DigiCollection> heqie11;
4417         iEvent.getByToken(tok_qie11_, heqie11);
4418         const QIE11DigiCollection& qie11dc =
4419             *(heqie11);  ////////////////////////////////////////////////    <<<=========  !!!!
4420         bool gotQIE11Digis = true;
4421         if (!(iEvent.getByToken(tok_qie11_, heqie11)))
4422           gotQIE11Digis = false;  //this is a boolean set up to check if there are QIE11gigis in input root file
4423         if (!(heqie11.isValid()))
4424           gotQIE11Digis = false;  //if it is not there, leave it false
4425         if (!gotQIE11Digis) {
4426           std::cout << " No QIE11DigiCollection collection is found " << std::endl;
4427         } else {
4428           ////////////////////////////////////////////////////////////////////   qie11   QIE11 :
4429           double totalAmplitudeHBQIE11 = 0.;
4430           double totalAmplitudeHEQIE11 = 0.;
4431           double nnnnnnTSHBQIE11 = 0.;
4432           double nnnnnnTSHEQIE11 = 0.;
4433           for (unsigned int j = 0; j < qie11dc.size(); j++) {
4434             QIE11DataFrame qie11df = static_cast<QIE11DataFrame>(qie11dc[j]);
4435             DetId detid = qie11df.detid();
4436             HcalDetId hcaldetid = HcalDetId(detid);
4437             int eta = hcaldetid.ieta();
4438             int phi = hcaldetid.iphi();
4439             int depth = hcaldetid.depth();
4440             if (depth == 0)
4441               return;
4442             int sub = hcaldetid.subdet();  // 1-HB, 2-HE (HFDigiCollection: 4-HF)
4443             // loop over the samples in the digi
4444             nTS = qie11df.samples();
4445             ///////////////////
4446             nnnnnnhbheqie11++;
4447             nnnnnn++;
4448             if (recordHistoes_ && studyCapIDErrorsHist_)
4449               fillDigiErrorsQIE11(qie11df);
4450             //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4451             if (recordHistoes_)
4452               fillDigiAmplitudeQIE11(qie11df);
4453             ///////////////////
4454             //////////////////////////////////  counters of event for subdet & depth
4455             if (sub == 1 && depth == 1 && qwert1 == 0) {
4456               nnnnnn1++;
4457               qwert1 = 1;
4458             }
4459             if (sub == 1 && depth == 2 && qwert2 == 0) {
4460               nnnnnn2++;
4461               qwert2 = 1;
4462             }
4463             if (sub == 2 && depth == 1 && qwert3 == 0) {
4464               nnnnnn3++;
4465               qwert3 = 1;
4466             }
4467             if (sub == 2 && depth == 2 && qwert4 == 0) {
4468               nnnnnn4++;
4469               qwert4 = 1;
4470             }
4471             if (sub == 2 && depth == 3 && qwert5 == 0) {
4472               nnnnnn5++;
4473               qwert5 = 1;
4474             }
4475 
4476             if (recordHistoes_ && studyCalibCellsHist_) {
4477               int iphi = phi - 1;
4478               int ieta = eta;
4479               if (ieta > 0)
4480                 ieta -= 1;
4481               // HB:
4482               if (sub == 1) {
4483                 double amplitudefullTSs1 = 0.;
4484                 double amplitudefullTSs6 = 0.;
4485                 nnnnnnTSHBQIE11++;
4486                 for (int i = 0; i < nTS; ++i) {
4487                   int adc = qie11df[i].adc();
4488                   double charge1 = adc2fC_QIE11_shunt1[adc];
4489                   double charge6 = adc2fC_QIE11_shunt6[adc];
4490                   amplitudefullTSs1 += charge1;
4491                   amplitudefullTSs6 += charge6;
4492                   double charge = charge6;
4493                   TS_data[i] = charge;
4494                   signal[0][ieta + 41][iphi] += charge;
4495                   if (i > 1 && i < 6)
4496                     signal3[0][ieta + 41][iphi] += charge;
4497                   totalAmplitudeHBQIE11 += charge;
4498                 }  //for
4499                 h_AmplitudeHBtest1->Fill(amplitudefullTSs1, 1.);
4500                 h_AmplitudeHBtest6->Fill(amplitudefullTSs6, 1.);
4501               }  //HB end
4502               // HE:
4503               if (sub == 2) {
4504                 double amplitudefullTSs1 = 0.;
4505                 double amplitudefullTSs6 = 0.;
4506                 nnnnnnTSHEQIE11++;
4507                 for (int i = 0; i < nTS; i++) {
4508                   int adc = qie11df[i].adc();
4509                   double charge1 = adc2fC_QIE11_shunt1[adc];
4510                   double charge6 = adc2fC_QIE11_shunt6[adc];
4511                   amplitudefullTSs1 += charge1;
4512                   amplitudefullTSs6 += charge6;
4513                   double charge = charge6;
4514                   TS_data[i] = charge;
4515                   signal[1][ieta + 41][iphi] += charge;
4516                   if (i > 1 && i < 6)
4517                     signal3[1][ieta + 41][iphi] += charge;
4518                   totalAmplitudeHEQIE11 += charge;
4519                 }  //for
4520                 h_AmplitudeHEtest1->Fill(amplitudefullTSs1, 1.);
4521                 h_AmplitudeHEtest6->Fill(amplitudefullTSs6, 1.);
4522 
4523               }  //HE end
4524             }    //if(recordHistoes_ && studyCalibCellsHist_)
4525           }      // for QIE11 digis
4526 
4527           if (totalAmplitudeHBQIE11 != 0.) {
4528             h_numberofhitsHBtest->Fill(nnnnnnTSHBQIE11);
4529             h_totalAmplitudeHB->Fill(totalAmplitudeHBQIE11);
4530             h_totalAmplitudeHBperEvent->Fill(float(eventcounter), totalAmplitudeHBQIE11);
4531           }
4532           if (totalAmplitudeHEQIE11 != 0.) {
4533             h_numberofhitsHEtest->Fill(nnnnnnTSHEQIE11);
4534             h_totalAmplitudeHE->Fill(totalAmplitudeHEQIE11);
4535             h_totalAmplitudeHEperEvent->Fill(float(eventcounter), totalAmplitudeHEQIE11);
4536           }
4537         }  //heqie11.isValid
4538       }    // end flagupgrade
4539 
4540       ///////////////////////////////////////////////////////////////////////////////////////////////////////////////   HODigiCollection
4541       edm::Handle<HODigiCollection> ho;
4542       iEvent.getByToken(tok_ho_, ho);
4543       bool gotHODigis = true;
4544       if (!(iEvent.getByToken(tok_ho_, ho)))
4545         gotHODigis = false;  //this is a boolean set up to check if there are HOgigis in input root file
4546       if (!(ho.isValid()))
4547         gotHODigis = false;  //if it is not there, leave it false
4548       if (!gotHODigis) {
4549         //  if(!ho.isValid()) {
4550         std::cout << " No HO collection is found " << std::endl;
4551       } else {
4552         int qwert6 = 0;
4553         double totalAmplitudeHO = 0.;
4554         for (HODigiCollection::const_iterator digi = ho->begin(); digi != ho->end(); digi++) {
4555           eta = digi->id().ieta();
4556           phi = digi->id().iphi();
4557           depth = digi->id().depth();
4558           nTS = digi->size();
4559           ///////////////////
4560           counterho++;
4561           //////////////////////////////////  counters of event
4562           if (qwert6 == 0) {
4563             nnnnnn6++;
4564             qwert6 = 1;
4565           }
4566           ////////////////////////////////////////////////////////////  for zerrors.C script:
4567           if (recordHistoes_ && studyCapIDErrorsHist_)
4568             fillDigiErrorsHO(digi);
4569           //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4570           if (recordHistoes_)
4571             fillDigiAmplitudeHO(digi);
4572           ///////////////////
4573           if (recordHistoes_ && studyCalibCellsHist_) {
4574             int iphi = phi - 1;
4575             int ieta = eta;
4576             if (ieta > 0)
4577               ieta -= 1;
4578             double nnnnnnTS = 0.;
4579             double amplitudefullTSs = 0.;
4580             if (nTS <= numOfTS)
4581               for (int i = 0; i < nTS; i++) {
4582                 TS_data[i] = adc2fC[digi->sample(i).adc()];
4583                 amplitudefullTSs += TS_data[i];
4584                 signal[2][ieta + 41][iphi] += TS_data[i];
4585                 totalAmplitudeHO += TS_data[i];
4586                 if (i > 1 && i < 6)
4587                   signal3[2][ieta + 41][iphi] += TS_data[i];
4588                 nnnnnnTS++;
4589               }  //if for
4590             h_AmplitudeHOtest->Fill(amplitudefullTSs);
4591             h_numberofhitsHOtest->Fill(nnnnnnTS);
4592           }  //if(recordHistoes_ && studyCalibCellsHist_)
4593         }    //for HODigiCollection
4594 
4595         h_totalAmplitudeHO->Fill(totalAmplitudeHO);
4596         h_totalAmplitudeHOperEvent->Fill(float(eventcounter), totalAmplitudeHO);
4597       }  //ho.isValid(
4598     }    // flagToUseDigiCollectionsORNot_
4599 
4600     //////////////////////////////////// RecHits for phi-symmetry monitoring of calibration group:
4601     // AZ 04.11.2019
4602     //////////////////////////////////////////////////////
4603     if (flagIterativeMethodCalibrationGroupReco_ > 0) {
4604       //////////////////////////////////////////////////////////////////////////////////////////////////////  Noise
4605       //////////////////////////////////////////////////////////////////////////////////////////////////////  Noise
4606       //////////////////////////////////////////////////////////////////////////////////////////////////////  Noise
4607       // HBHE:    HBHERecHitCollection hbheNoise Noise
4608       edm::Handle<HBHERecHitCollection> hbheNoise;
4609       iEvent.getByToken(tok_hbheNoise_, hbheNoise);
4610       bool gotHBHERecHitsNoise = true;
4611       if (!(iEvent.getByToken(tok_hbheNoise_, hbheNoise)))
4612         gotHBHERecHitsNoise =
4613             false;  //this is a boolean set up to check if there are HBHERecHitsNoise in input root file
4614       if (!(hbheNoise.isValid()))
4615         gotHBHERecHitsNoise = false;  //if it is not there, leave it false
4616       if (!gotHBHERecHitsNoise) {
4617         //  if(!hbheNoise.isValid()) {
4618         std::cout << " No RecHits HBHENoise collection is found " << std::endl;
4619       } else {
4620         for (HBHERecHitCollection::const_iterator hbheItr = hbheNoise->begin(); hbheItr != hbheNoise->end();
4621              hbheItr++) {
4622           // Recalibration of energy
4623           float icalconst = 1.;
4624           //      DetId mydetid = hbheItr->id().rawId();
4625           //      if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
4626           HBHERecHit aHit(hbheItr->id(), hbheItr->eraw() * icalconst, hbheItr->time());
4627           //        HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
4628           double energyhit = aHit.energy();
4629           DetId id = (*hbheItr).detid();
4630           HcalDetId hid = HcalDetId(id);
4631           int sub = ((hid).rawId() >> 25) & 0x7;
4632 
4633           if (sub == 1)
4634             h_energyhitNoise_HB->Fill(energyhit, 1.);
4635           if (sub == 2)
4636             h_energyhitNoise_HE->Fill(energyhit, 1.);
4637           //    if(fabs(energyhit) > 40. ) continue;
4638 
4639           //std::cout<<sub<<std::endl;
4640           if (hid.depth() == 1 && sub == 1 && hid.iphi() == 25) {
4641             if (verbosity < 0)
4642               std::cout << " Noise,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4643                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4644           }
4645           if (hid.depth() == 1 && sub == 2 && hid.iphi() == 25) {
4646             if (verbosity < 0)
4647               std::cout << " Noise,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4648                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4649           }
4650           int ieta = hid.ieta();  // -15 ... -1; 1... 15 for HB
4651           if (ieta > 0)
4652             ieta -= 1;  // -15 ... -1; 0... 14 for HB
4653           int iphi = hid.iphi() - 1;
4654           int mdepth = hid.depth();
4655           recNoiseEnergy0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
4656           recNoiseEnergy1[sub - 1][mdepth - 1][ieta + 41][iphi] += energyhit;
4657           recNoiseEnergy2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(energyhit, 2);
4658         }  // hbheNoise
4659       }    //hbheNoise.isValid(
4660       ////////////////////////////////////////////////////// /  HBHE Noise end
4661 
4662       // HF:    HFRecHitCollection hfNoise Noise
4663       edm::Handle<HFRecHitCollection> hfNoise;
4664       iEvent.getByToken(tok_hfNoise_, hfNoise);
4665       bool gotHFRecHitsNoise = true;
4666       if (!(iEvent.getByToken(tok_hfNoise_, hfNoise)))
4667         gotHFRecHitsNoise = false;  //this is a boolean set up to check if there are HFRecHitsNoise in input root file
4668       if (!(hfNoise.isValid()))
4669         gotHFRecHitsNoise = false;  //if it is not there, leave it false
4670       if (!gotHFRecHitsNoise) {
4671         //  if(!hfNoise.isValid()) {
4672         std::cout << " No RecHits HFNoise collection is found " << std::endl;
4673       } else {
4674         for (HFRecHitCollection::const_iterator hfItr = hfNoise->begin(); hfItr != hfNoise->end(); hfItr++) {
4675           // Recalibration of energy
4676           float icalconst = 1.;
4677           //      DetId mydetid = hfItr->id().rawId();
4678           //      if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
4679           HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
4680           double energyhit = aHit.energy();
4681           DetId id = (*hfItr).detid();
4682           HcalDetId hid = HcalDetId(id);
4683           int sub = ((hid).rawId() >> 25) & 0x7;
4684 
4685           h_energyhitNoise_HF->Fill(energyhit, 1.);
4686           //    if(fabs(energyhit) > 40. ) continue;
4687 
4688           //std::cout<<sub<<std::endl;
4689           if (hid.iphi() == 25) {
4690             if (verbosity < 0)
4691               std::cout << "HF Noise,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4692                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4693           }
4694           int ieta = hid.ieta();  // -15 ... -1; 1... 15 for HB
4695           if (ieta > 0)
4696             ieta -= 1;  // -15 ... -1; 0... 14 for HB
4697           int iphi = hid.iphi() - 1;
4698           int mdepth = hid.depth();
4699           recNoiseEnergy0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
4700           recNoiseEnergy1[sub - 1][mdepth - 1][ieta + 41][iphi] += energyhit;
4701           recNoiseEnergy2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(energyhit, 2);
4702         }  // hfNoise
4703       }    //hfNoise.isValid(
4704       ////////////////////////////////////////////////////// /  HF Noise end
4705 
4706       ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Signal
4707       ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Signal
4708       ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Signal
4709       // HBHE:    HBHERecHitCollection hbheSignal Signal
4710       edm::Handle<HBHERecHitCollection> hbheSignal;
4711       iEvent.getByToken(tok_hbheSignal_, hbheSignal);
4712       bool gotHBHERecHitsSignal = true;
4713       if (!(iEvent.getByToken(tok_hbheSignal_, hbheSignal)))
4714         gotHBHERecHitsSignal =
4715             false;  //this is a boolean set up to check if there are HBHERecHitsSignal in input root file
4716       if (!(hbheSignal.isValid()))
4717         gotHBHERecHitsSignal = false;  //if it is not there, leave it false
4718       if (!gotHBHERecHitsSignal) {
4719         //  if(!hbheSignal.isValid()) {
4720         std::cout << " No RecHits HBHESignal collection is found " << std::endl;
4721       } else {
4722         for (HBHERecHitCollection::const_iterator hbheItr = hbheSignal->begin(); hbheItr != hbheSignal->end();
4723              hbheItr++) {
4724           // Recalibration of energy
4725           float icalconst = 1.;
4726           //      DetId mydetid = hbheItr->id().rawId();
4727           //      if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
4728           HBHERecHit aHit(hbheItr->id(), hbheItr->eraw() * icalconst, hbheItr->time());
4729           //        HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
4730           double energyhit = aHit.energy();
4731           DetId id = (*hbheItr).detid();
4732           HcalDetId hid = HcalDetId(id);
4733           int sub = ((hid).rawId() >> 25) & 0x7;
4734 
4735           if (sub == 1)
4736             h_energyhitSignal_HB->Fill(energyhit, 1.);
4737           if (sub == 2)
4738             h_energyhitSignal_HE->Fill(energyhit, 1.);
4739 
4740           //std::cout<<sub<<std::endl;
4741           if (hid.depth() == 1 && sub == 1 && hid.iphi() == 25) {
4742             if (verbosity < 0)
4743               std::cout << "HBHE Signal,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4744                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4745           }
4746           if (hid.depth() == 1 && sub == 2 && hid.iphi() == 25) {
4747             if (verbosity < 0)
4748               std::cout << "HBHE Signal,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4749                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4750           }
4751           int ieta = hid.ieta();  // -15 ... -1; 1... 15 for HB
4752           if (ieta > 0)
4753             ieta -= 1;  // -15 ... -1; 0... 14 for HB
4754           int iphi = hid.iphi() - 1;
4755           int mdepth = hid.depth();
4756           recSignalEnergy0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
4757           recSignalEnergy1[sub - 1][mdepth - 1][ieta + 41][iphi] += energyhit;
4758           recSignalEnergy2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(energyhit, 2);
4759         }  // hbheSignal
4760       }    //hbheSignal.isValid(
4761       ////////////////////////////////////////////////////// /  HBHE Signal end
4762 
4763       // HF:    HFRecHitCollection hfSignal Signal
4764       edm::Handle<HFRecHitCollection> hfSignal;
4765       iEvent.getByToken(tok_hfSignal_, hfSignal);
4766       bool gotHFRecHitsSignal = true;
4767       if (!(iEvent.getByToken(tok_hfSignal_, hfSignal)))
4768         gotHFRecHitsSignal = false;  //this is a boolean set up to check if there are HFRecHitsSignal in input root file
4769       if (!(hfSignal.isValid()))
4770         gotHFRecHitsSignal = false;  //if it is not there, leave it false
4771       if (!gotHFRecHitsSignal) {
4772         //  if(!hfSignal.isValid()) {
4773         std::cout << " No RecHits HFSignal collection is found " << std::endl;
4774       } else {
4775         for (HFRecHitCollection::const_iterator hfItr = hfSignal->begin(); hfItr != hfSignal->end(); hfItr++) {
4776           // Recalibration of energy
4777           float icalconst = 1.;
4778           //      DetId mydetid = hfItr->id().rawId();
4779           //      if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
4780           HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
4781           double energyhit = aHit.energy();
4782           DetId id = (*hfItr).detid();
4783           HcalDetId hid = HcalDetId(id);
4784           int sub = ((hid).rawId() >> 25) & 0x7;
4785 
4786           h_energyhitSignal_HF->Fill(energyhit, 1.);
4787           //    if(fabs(energyhit) > 40. ) continue;
4788 
4789           //std::cout<<sub<<std::endl;
4790           if (hid.iphi() == 25) {
4791             if (verbosity < 0)
4792               std::cout << "HF Signal,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4793                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4794           }
4795           int ieta = hid.ieta();  // -15 ... -1; 1... 15 for HB
4796           if (ieta > 0)
4797             ieta -= 1;  // -15 ... -1; 0... 14 for HB
4798           int iphi = hid.iphi() - 1;
4799           int mdepth = hid.depth();
4800           recSignalEnergy0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
4801           recSignalEnergy1[sub - 1][mdepth - 1][ieta + 41][iphi] += energyhit;
4802           recSignalEnergy2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(energyhit, 2);
4803         }  // hfSignal
4804       }    //hfSignal.isValid(
4805       //////////////////////////////////////////////////////  HF Signal end
4806 
4807       //////////////////////////////////////////////////////
4808       // END of RecHits for phi-symmetry monitoring of calibration group
4809     }  // flagIterativeMethodCalibrationGroupReco_  >  0
4810     //////////////////////////////////////////////////////
4811 
4812     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
4813 
4814     //////////////////////////////////////////////////////
4815     /////////////////////////////////////////////////////////////
4816     ////////////////////////////////////////////////////////////////////////////////////////  TREATMENT OF OBTAINED DIGI-COLLECTION :
4817     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4818     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  Phi-Symmetry Monitoring DIGI
4819     //////////// k0(sub):       =0 HB;      =1 HE;       =2 HO;       =3 HF;
4820     //////////// k1(depth-1): = 0 - 6 or depth: = 1 - 7;
4821     if (flagIterativeMethodCalibrationGroupDigi_ > 0) {
4822       //////////////////////////////////////////////////////////////////////////
4823       ////////////////////////////////////////////////////////////////////////// Digi Digi Digi Digi Digi Digi
4824       //////////////////////////////////////////////////////////////////////////
4825       //      //      //      //      //      //      // tocdefault tocampl tocamplchannel: calibration group, Iterative method, coding start 29.08.2019
4826       for (int k0 = 0; k0 < nsub; k0++) {
4827         // HE only, temporary
4828         if (k0 == 1) {
4829           for (int k1 = 0; k1 < ndepth; k1++) {
4830             // k2: 0-81
4831             for (int k2 = 0; k2 < neta; k2++) {
4832               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
4833               int k2plot = k2 - 41;
4834               int kkk = k2plot;  //if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
4835               //preparation for PHI normalization:
4836               double sumoverphi = 0;
4837               int nsumoverphi = 0;
4838               for (int k3 = 0; k3 < nphi; k3++) {
4839                 if (tocamplchannel[k0][k1][k2][k3] != 0) {
4840                   sumoverphi += tocamplchannel[k0][k1][k2][k3];
4841                   ++nsumoverphi;
4842                   if (verbosity < 0)
4843                     std::cout << "==== nsumoverphi = " << nsumoverphi << "  sumoverphi = " << sumoverphi
4844                               << "  k1 = " << k1 << "  k2 = " << k2 << " kkk = " << kkk << "  k3 = " << k3 << std::endl;
4845                 }  //if != 0
4846               }    //k3
4847               // PHI normalization into new massive && filling plots:
4848               for (int k3 = 0; k3 < nphi; k3++) {
4849                 if (nsumoverphi != 0) {
4850                   maprphinorm[k0][k1][k2][k3] = tocamplchannel[k0][k1][k2][k3] / (sumoverphi / nsumoverphi);
4851                   if (verbosity < 0)
4852                     std::cout << "nsumoverphi= " << nsumoverphi << " sumoverphi= " << sumoverphi << " k1= " << k1
4853                               << " k2= " << k2 << " kkk= " << kkk << " k3= " << k3
4854                               << " maprphinorm= " << maprphinorm[k0][k1][k2][k3] << std::endl;
4855                   if (k1 == 0) {
4856                     h_mapenophinorm_HE1->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4857                     h_mapenophinorm2_HE1->Fill(
4858                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4859                     h_maprphinorm_HE1->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4860                     h_maprphinorm2_HE1->Fill(
4861                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4862                     h_maprphinorm0_HE1->Fill(double(kkk), double(k3), 1.);
4863                   }
4864                   if (k1 == 1) {
4865                     h_mapenophinorm_HE2->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4866                     h_mapenophinorm2_HE2->Fill(
4867                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4868                     h_maprphinorm_HE2->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4869                     h_maprphinorm2_HE2->Fill(
4870                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4871                     h_maprphinorm0_HE2->Fill(double(kkk), double(k3), 1.);
4872                   }
4873                   if (k1 == 2) {
4874                     h_mapenophinorm_HE3->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4875                     h_mapenophinorm2_HE3->Fill(
4876                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4877                     h_maprphinorm_HE3->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4878                     h_maprphinorm2_HE3->Fill(
4879                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4880                     h_maprphinorm0_HE3->Fill(double(kkk), double(k3), 1.);
4881                   }
4882                   if (k1 == 3) {
4883                     h_mapenophinorm_HE4->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4884                     h_mapenophinorm2_HE4->Fill(
4885                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4886                     h_maprphinorm_HE4->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4887                     h_maprphinorm2_HE4->Fill(
4888                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4889                     h_maprphinorm0_HE4->Fill(double(kkk), double(k3), 1.);
4890                   }
4891                   if (k1 == 4) {
4892                     h_mapenophinorm_HE5->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4893                     h_mapenophinorm2_HE5->Fill(
4894                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4895                     h_maprphinorm_HE5->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4896                     h_maprphinorm2_HE5->Fill(
4897                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4898                     h_maprphinorm0_HE5->Fill(double(kkk), double(k3), 1.);
4899                   }
4900                   if (k1 == 5) {
4901                     h_mapenophinorm_HE6->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4902                     h_mapenophinorm2_HE6->Fill(
4903                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4904                     h_maprphinorm_HE6->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4905                     h_maprphinorm2_HE6->Fill(
4906                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4907                     h_maprphinorm0_HE6->Fill(double(kkk), double(k3), 1.);
4908                   }
4909                   if (k1 == 6) {
4910                     h_mapenophinorm_HE7->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4911                     h_mapenophinorm2_HE7->Fill(
4912                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4913                     h_maprphinorm_HE7->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4914                     h_maprphinorm2_HE7->Fill(
4915                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4916                     h_maprphinorm0_HE7->Fill(double(kkk), double(k3), 1.);
4917                   }
4918                 }  //if nsumoverphi != 0
4919               }    //k3
4920             }      //k2
4921           }        //k1
4922         }          //if k0 == 1 HE
4923       }            //k0
4924       //      //      //      //      //      //        //    //      //      //      //      //        //    //      //      //      //      //        //    //      //      //      //      //
4925       //      //      //      //      //      //      // amplitudechannel amplitudechannel amplitudechannel: calibration group, Iterative method, coding start 11.11.2019
4926       for (int k0 = 0; k0 < nsub; k0++) {
4927         // HB:
4928         if (k0 == 0) {
4929           for (int k1 = 0; k1 < ndepth; k1++) {
4930             // k2: 0-81
4931             for (int k2 = 0; k2 < neta; k2++) {
4932               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
4933               int k2plot = k2 - 41;
4934               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
4935               for (int k3 = 0; k3 < nphi; k3++) {
4936                 if (k1 == 0) {
4937                   h_amplitudechannel0_HB1->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4938                   h_amplitudechannel1_HB1->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4939                   h_amplitudechannel2_HB1->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4940                 }
4941                 if (k1 == 1) {
4942                   h_amplitudechannel0_HB2->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4943                   h_amplitudechannel1_HB2->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4944                   h_amplitudechannel2_HB2->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4945                 }
4946                 if (k1 == 2) {
4947                   h_amplitudechannel0_HB3->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4948                   h_amplitudechannel1_HB3->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4949                   h_amplitudechannel2_HB3->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4950                 }
4951                 if (k1 == 3) {
4952                   h_amplitudechannel0_HB4->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4953                   h_amplitudechannel1_HB4->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4954                   h_amplitudechannel2_HB4->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4955                 }
4956               }  //k3
4957             }    //k2
4958           }      //k1
4959         }        //if k0 == 0 HB
4960 
4961         // HE:
4962         if (k0 == 1) {
4963           for (int k1 = 0; k1 < ndepth; k1++) {
4964             // k2: 0-81
4965             for (int k2 = 0; k2 < neta; k2++) {
4966               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
4967               int k2plot = k2 - 41;
4968               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
4969               for (int k3 = 0; k3 < nphi; k3++) {
4970                 if (k1 == 0) {
4971                   h_amplitudechannel0_HE1->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4972                   h_amplitudechannel1_HE1->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4973                   h_amplitudechannel2_HE1->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4974                 }
4975                 if (k1 == 1) {
4976                   h_amplitudechannel0_HE2->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4977                   h_amplitudechannel1_HE2->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4978                   h_amplitudechannel2_HE2->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4979                 }
4980                 if (k1 == 2) {
4981                   h_amplitudechannel0_HE3->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4982                   h_amplitudechannel1_HE3->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4983                   h_amplitudechannel2_HE3->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4984                 }
4985                 if (k1 == 3) {
4986                   h_amplitudechannel0_HE4->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4987                   h_amplitudechannel1_HE4->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4988                   h_amplitudechannel2_HE4->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4989                 }
4990                 if (k1 == 4) {
4991                   h_amplitudechannel0_HE5->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4992                   h_amplitudechannel1_HE5->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4993                   h_amplitudechannel2_HE5->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4994                 }
4995                 if (k1 == 5) {
4996                   h_amplitudechannel0_HE6->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
4997                   h_amplitudechannel1_HE6->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
4998                   h_amplitudechannel2_HE6->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
4999                 }
5000                 if (k1 == 6) {
5001                   h_amplitudechannel0_HE7->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5002                   h_amplitudechannel1_HE7->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5003                   h_amplitudechannel2_HE7->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5004                 }
5005               }  //k3
5006             }    //k2
5007           }      //k1
5008         }        //if k0 == 1 HE
5009 
5010         // HF: 4 depthes for Digis and only 2 - for Reco !!!
5011         if (k0 == 3) {
5012           for (int k1 = 0; k1 < ndepth; k1++) {
5013             // k2: 0-81
5014             for (int k2 = 0; k2 < neta; k2++) {
5015               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
5016               int k2plot = k2 - 41;
5017               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
5018               for (int k3 = 0; k3 < nphi; k3++) {
5019                 if (k1 == 0) {
5020                   h_amplitudechannel0_HF1->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5021                   h_amplitudechannel1_HF1->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5022                   h_amplitudechannel2_HF1->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5023                 }
5024                 if (k1 == 1) {
5025                   h_amplitudechannel0_HF2->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5026                   h_amplitudechannel1_HF2->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5027                   h_amplitudechannel2_HF2->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5028                 }
5029                 if (k1 == 2) {
5030                   h_amplitudechannel0_HF3->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5031                   h_amplitudechannel1_HF3->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5032                   h_amplitudechannel2_HF3->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5033                 }
5034                 if (k1 == 3) {
5035                   h_amplitudechannel0_HF4->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5036                   h_amplitudechannel1_HF4->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5037                   h_amplitudechannel2_HF4->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5038                 }
5039               }  //k3
5040             }    //k2
5041           }      //k1
5042         }        //if k0 == 3 HF
5043 
5044       }  //k0
5045 
5046     }  // if(flagIterativeMethodCalibrationGroupDigi
5047 
5048     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5049     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5050     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  Phi-Symmetry Monitoring Reco
5051     //////////// k0(sub):       =0 HB;      =1 HE;       =2 HO;       =3 HF;
5052     //////////// k1(depth-1): = 0 - 6 or depth: = 1 - 7;
5053     if (flagIterativeMethodCalibrationGroupReco_ > 0) {
5054       //////////////////////////////////////////////////////////////////////////
5055       ////////////////////////////////////////////////////////////////////////// Reco Reco Reco Reco Reco Reco
5056       //////////////////////////////////////////////////////////////////////////
5057       //
5058       for (int k0 = 0; k0 < nsub; k0++) {
5059         // HB:
5060         if (k0 == 0) {
5061           for (int k1 = 0; k1 < ndepth; k1++) {
5062             // k2: 0-81
5063             for (int k2 = 0; k2 < neta; k2++) {
5064               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
5065               int k2plot = k2 - 41;
5066               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
5067               for (int k3 = 0; k3 < nphi; k3++) {
5068                 if (k1 == 0) {
5069                   h_recSignalEnergy0_HB1->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5070                   h_recSignalEnergy1_HB1->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5071                   h_recSignalEnergy2_HB1->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5072                   h_recNoiseEnergy0_HB1->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5073                   h_recNoiseEnergy1_HB1->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5074                   h_recNoiseEnergy2_HB1->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5075                 }
5076                 if (k1 == 1) {
5077                   h_recSignalEnergy0_HB2->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5078                   h_recSignalEnergy1_HB2->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5079                   h_recSignalEnergy2_HB2->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5080                   h_recNoiseEnergy0_HB2->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5081                   h_recNoiseEnergy1_HB2->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5082                   h_recNoiseEnergy2_HB2->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5083                 }
5084                 if (k1 == 2) {
5085                   h_recSignalEnergy0_HB3->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5086                   h_recSignalEnergy1_HB3->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5087                   h_recSignalEnergy2_HB3->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5088                   h_recNoiseEnergy0_HB3->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5089                   h_recNoiseEnergy1_HB3->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5090                   h_recNoiseEnergy2_HB3->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5091                 }
5092                 if (k1 == 3) {
5093                   h_recSignalEnergy0_HB4->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5094                   h_recSignalEnergy1_HB4->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5095                   h_recSignalEnergy2_HB4->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5096                   h_recNoiseEnergy0_HB4->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5097                   h_recNoiseEnergy1_HB4->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][