Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-08 02:27:12

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