Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-12-20 03:13:37

0001 // -*- C++ -*-
0002 //
0003 // Package:    CMTRawAnalyzer
0004 //
0005 #include <fstream>
0006 #include <iostream>
0007 #include <cmath>
0008 #include <iosfwd>
0009 #include <bitset>
0010 #include <memory>
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "FWCore/ServiceRegistry/interface/Service.h"
0013 #include "FWCore/PluginManager/interface/ModuleDef.h"
0014 #include "FWCore/Framework/interface/Frameworkfwd.h"
0015 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/Framework/interface/MakerMacros.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0019 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0020 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0021 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0022 #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
0023 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0024 #include "DataFormats/HcalDigi/interface/HcalQIESample.h"
0025 #include "DataFormats/HcalDetId/interface/HcalCalibDetId.h"
0026 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0027 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0028 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
0029 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
0030 #include "DataFormats/HcalDigi/interface/HODataFrame.h"
0031 #include "DataFormats/HcalDigi/interface/QIE10DataFrame.h"
0032 #include "DataFormats/HcalDigi/interface/QIE11DataFrame.h"
0033 #include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h"
0034 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0035 #include "CalibCalorimetry/HcalAlgos/interface/HcalLogicalMapGenerator.h"
0036 #include "CondFormats/HcalObjects/interface/HcalLogicalMap.h"
0037 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
0038 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
0039 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
0040 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
0041 #include "CondFormats/HcalObjects/interface/HcalQIECoder.h"
0042 #include "CondFormats/HcalObjects/interface/HcalQIEShape.h"
0043 #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h"
0044 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
0045 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
0046 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0047 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
0048 #include "DataFormats/FEDRawData/interface/FEDTrailer.h"
0049 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0050 #include "Geometry/Records/interface/HcalGeometryRecord.h"
0051 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0052 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0053 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0054 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0055 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0056 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0057 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0058 #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
0059 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0060 #include "TFile.h"
0061 #include "TTree.h"
0062 #include "TH1.h"
0063 #include "TH2.h"
0064 #include "TF1.h"
0065 
0066 #define NUMADCS 256
0067 double const adc2fC_QIE10[NUMADCS] = {
0068     //subrange0
0069     1.58,
0070     4.73,
0071     7.88,
0072     11.0,
0073     14.2,
0074     17.3,
0075     20.5,
0076     23.6,
0077     26.8,
0078     29.9,
0079     33.1,
0080     36.2,
0081     39.4,
0082     42.5,
0083     45.7,
0084     48.8,
0085     //subrange1
0086     53.6,
0087     60.1,
0088     66.6,
0089     73.0,
0090     79.5,
0091     86.0,
0092     92.5,
0093     98.9,
0094     105,
0095     112,
0096     118,
0097     125,
0098     131,
0099     138,
0100     144,
0101     151,
0102     //subrange2
0103     157,
0104     164,
0105     170,
0106     177,
0107     186,
0108     199,
0109     212,
0110     225,
0111     238,
0112     251,
0113     264,
0114     277,
0115     289,
0116     302,
0117     315,
0118     328,
0119     //subrange3
0120     341,
0121     354,
0122     367,
0123     380,
0124     393,
0125     406,
0126     418,
0127     431,
0128     444,
0129     464,
0130     490,
0131     516,
0132     542,
0133     568,
0134     594,
0135     620,
0136 
0137     // - - - - - - - range 1 - - - - - - - -
0138     //subrange0
0139     569,
0140     594,
0141     619,
0142     645,
0143     670,
0144     695,
0145     720,
0146     745,
0147     771,
0148     796,
0149     821,
0150     846,
0151     871,
0152     897,
0153     922,
0154     947,
0155     //subrange1
0156     960,
0157     1010,
0158     1060,
0159     1120,
0160     1170,
0161     1220,
0162     1270,
0163     1320,
0164     1370,
0165     1430,
0166     1480,
0167     1530,
0168     1580,
0169     1630,
0170     1690,
0171     1740,
0172     //subrange2
0173     1790,
0174     1840,
0175     1890,
0176     1940,
0177     2020,
0178     2120,
0179     2230,
0180     2330,
0181     2430,
0182     2540,
0183     2640,
0184     2740,
0185     2850,
0186     2950,
0187     3050,
0188     3150,
0189     //subrange3
0190     3260,
0191     3360,
0192     3460,
0193     3570,
0194     3670,
0195     3770,
0196     3880,
0197     3980,
0198     4080,
0199     4240,
0200     4450,
0201     4650,
0202     4860,
0203     5070,
0204     5280,
0205     5490,
0206 
0207     // - - - - - - - range 2 - - - - - - - -
0208     //subrange0
0209     5080,
0210     5280,
0211     5480,
0212     5680,
0213     5880,
0214     6080,
0215     6280,
0216     6480,
0217     6680,
0218     6890,
0219     7090,
0220     7290,
0221     7490,
0222     7690,
0223     7890,
0224     8090,
0225     //subrange1
0226     8400,
0227     8810,
0228     9220,
0229     9630,
0230     10000,
0231     10400,
0232     10900,
0233     11300,
0234     11700,
0235     12100,
0236     12500,
0237     12900,
0238     13300,
0239     13700,
0240     14100,
0241     14500,
0242     //subrange2
0243     15000,
0244     15400,
0245     15800,
0246     16200,
0247     16800,
0248     17600,
0249     18400,
0250     19300,
0251     20100,
0252     20900,
0253     21700,
0254     22500,
0255     23400,
0256     24200,
0257     25000,
0258     25800,
0259     //subrange3
0260     26600,
0261     27500,
0262     28300,
0263     29100,
0264     29900,
0265     30700,
0266     31600,
0267     32400,
0268     33200,
0269     34400,
0270     36100,
0271     37700,
0272     39400,
0273     41000,
0274     42700,
0275     44300,
0276 
0277     // - - - - - - - range 3 - - - - - - - - -
0278     //subrange0
0279     41100,
0280     42700,
0281     44300,
0282     45900,
0283     47600,
0284     49200,
0285     50800,
0286     52500,
0287     54100,
0288     55700,
0289     57400,
0290     59000,
0291     60600,
0292     62200,
0293     63900,
0294     65500,
0295     //subrange1
0296     68000,
0297     71300,
0298     74700,
0299     78000,
0300     81400,
0301     84700,
0302     88000,
0303     91400,
0304     94700,
0305     98100,
0306     101000,
0307     105000,
0308     108000,
0309     111000,
0310     115000,
0311     118000,
0312     //subrange2
0313     121000,
0314     125000,
0315     128000,
0316     131000,
0317     137000,
0318     145000,
0319     152000,
0320     160000,
0321     168000,
0322     176000,
0323     183000,
0324     191000,
0325     199000,
0326     206000,
0327     214000,
0328     222000,
0329     //subrange3
0330     230000,
0331     237000,
0332     245000,
0333     253000,
0334     261000,
0335     268000,
0336     276000,
0337     284000,
0338     291000,
0339     302000,
0340     316000,
0341     329000,
0342     343000,
0343     356000,
0344     370000,
0345     384000
0346 
0347 };
0348 
0349 //shunt1
0350 double const adc2fC_QIE11_shunt1[NUMADCS] = {
0351     1.89,     5.07,     8.25,     11.43,    14.61,    17.78,    20.96,    24.14,    27.32,    30.50,    33.68,
0352     36.86,    40.04,    43.22,    46.40,    49.58,    54.35,    60.71,    67.07,    73.43,    79.79,    86.15,
0353     92.51,    98.87,    105.2,    111.6,    117.9,    124.3,    130.7,    137.0,    143.4,    149.7,    156.1,
0354     162.5,    168.8,    175.2,    184.7,    197.4,    210.2,    222.9,    235.6,    248.3,    261.0,    273.7,
0355     286.5,    299.2,    311.9,    324.6,    337.3,    350.1,    362.8,    375.5,    388.2,    400.9,    413.6,
0356     426.4,    439.1,    458.2,    483.6,    509.0,    534.5,    559.9,    585.3,    610.8,    558.9,    584.2,
0357     609.5,    634.7,    660.0,    685.3,    710.6,    735.9,    761.2,    786.5,    811.8,    837.1,    862.4,
0358     887.7,    913.0,    938.3,    976.2,    1026.8,   1077.4,   1128.0,   1178.6,   1229.1,   1279.7,   1330.3,
0359     1380.9,   1431.5,   1482.1,   1532.7,   1583.3,   1633.8,   1684.4,   1735.0,   1785.6,   1836.2,   1886.8,
0360     1937.4,   2013.2,   2114.4,   2215.6,   2316.8,   2417.9,   2519.1,   2620.3,   2721.5,   2822.6,   2923.8,
0361     3025.0,   3126.2,   3227.3,   3328.5,   3429.7,   3530.9,   3632.0,   3733.2,   3834.4,   3935.5,   4036.7,
0362     4188.5,   4390.8,   4593.2,   4795.5,   4997.9,   5200.2,   5402.6,   5057.5,   5262.3,   5467.1,   5671.8,
0363     5876.6,   6081.4,   6286.2,   6491.0,   6695.8,   6900.6,   7105.3,   7310.1,   7514.9,   7719.7,   7924.5,
0364     8129.3,   8436.4,   8846.0,   9255.6,   9665.1,   10074.7,  10484.3,  10893.9,  11303.4,  11713.0,  12122.6,
0365     12532.1,  12941.7,  13351.3,  13760.8,  14170.4,  14580.0,  14989.5,  15399.1,  15808.7,  16218.2,  16832.6,
0366     17651.7,  18470.9,  19290.0,  20109.2,  20928.3,  21747.4,  22566.6,  23385.7,  24204.8,  25024.0,  25843.1,
0367     26662.3,  27481.4,  28300.5,  29119.7,  29938.8,  30757.9,  31577.1,  32396.2,  33215.4,  34444.1,  36082.3,
0368     37720.6,  39358.9,  40997.2,  42635.4,  44273.7,  40908.7,  42542.6,  44176.5,  45810.4,  47444.3,  49078.3,
0369     50712.2,  52346.1,  53980.0,  55613.9,  57247.8,  58881.8,  60515.7,  62149.6,  63783.5,  65417.4,  67868.3,
0370     71136.1,  74404.0,  77671.8,  80939.7,  84207.5,  87475.3,  90743.2,  94011.0,  97278.8,  100546.7, 103814.5,
0371     107082.3, 110350.2, 113618.0, 116885.8, 120153.7, 123421.5, 126689.3, 129957.2, 134858.9, 141394.6, 147930.3,
0372     154465.9, 161001.6, 167537.3, 174072.9, 180608.6, 187144.3, 193679.9, 200215.6, 206751.3, 213287.0, 219822.6,
0373     226358.3, 232894.0, 239429.6, 245965.3, 252501.0, 259036.6, 265572.3, 275375.8, 288447.2, 301518.5, 314589.8,
0374     327661.2, 340732.5, 353803.8};
0375 //shunt6
0376 double const adc2fC_QIE11_shunt6[NUMADCS] = {
0377     9.56,      28.24,     46.91,     65.59,     84.27,     102.9,     121.6,     140.3,     159.0,     177.7,
0378     196.3,     215.0,     233.7,     252.4,     271.0,     289.7,     317.7,     355.1,     392.4,     429.8,
0379     467.1,     504.5,     541.9,     579.2,     616.6,     653.9,     691.3,     728.6,     766.0,     803.3,
0380     840.7,     878.0,     915.4,     952.8,     990.1,     1027.5,    1083.5,    1158.2,    1232.9,    1307.6,
0381     1382.3,    1457.0,    1531.7,    1606.4,    1681.2,    1755.9,    1830.6,    1905.3,    1980.0,    2054.7,
0382     2129.4,    2204.1,    2278.8,    2353.5,    2428.2,    2502.9,    2577.7,    2689.7,    2839.1,    2988.6,
0383     3138.0,    3287.4,    3436.8,    3586.2,    3263.0,    3411.3,    3559.6,    3707.9,    3856.2,    4004.5,
0384     4152.9,    4301.2,    4449.5,    4597.8,    4746.1,    4894.4,    5042.7,    5191.0,    5339.4,    5487.7,
0385     5710.1,    6006.8,    6303.4,    6600.0,    6896.6,    7193.3,    7489.9,    7786.5,    8083.1,    8379.8,
0386     8676.4,    8973.0,    9269.6,    9566.3,    9862.9,    10159.5,   10456.2,   10752.8,   11049.4,   11346.0,
0387     11791.0,   12384.2,   12977.5,   13570.7,   14164.0,   14757.2,   15350.5,   15943.7,   16537.0,   17130.2,
0388     17723.5,   18316.7,   18910.0,   19503.2,   20096.5,   20689.7,   21283.0,   21876.2,   22469.5,   23062.8,
0389     23656.0,   24545.9,   25732.4,   26918.9,   28105.4,   29291.9,   30478.4,   31664.9,   29399.4,   30590.1,
0390     31780.9,   32971.7,   34162.4,   35353.2,   36544.0,   37734.7,   38925.5,   40116.3,   41307.0,   42497.8,
0391     43688.5,   44879.3,   46070.1,   47260.8,   49047.0,   51428.5,   53810.1,   56191.6,   58573.1,   60954.6,
0392     63336.2,   65717.7,   68099.2,   70480.8,   72862.3,   75243.8,   77625.4,   80006.9,   82388.4,   84769.9,
0393     87151.5,   89533.0,   91914.5,   94296.1,   97868.4,   102631.4,  107394.5,  112157.5,  116920.6,  121683.7,
0394     126446.7,  131209.8,  135972.8,  140735.9,  145499.0,  150262.0,  155025.1,  159788.2,  164551.2,  169314.3,
0395     174077.3,  178840.4,  183603.5,  188366.5,  193129.6,  200274.2,  209800.3,  219326.4,  228852.5,  238378.7,
0396     247904.8,  257430.9,  237822.7,  247326.7,  256830.7,  266334.8,  275838.8,  285342.9,  294846.9,  304351.0,
0397     313855.0,  323359.1,  332863.1,  342367.1,  351871.2,  361375.2,  370879.3,  380383.3,  394639.4,  413647.5,
0398     432655.6,  451663.6,  470671.7,  489679.8,  508687.9,  527696.0,  546704.1,  565712.2,  584720.3,  603728.3,
0399     622736.4,  641744.5,  660752.6,  679760.7,  698768.8,  717776.9,  736785.0,  755793.0,  784305.2,  822321.3,
0400     860337.5,  898353.7,  936369.9,  974386.0,  1012402.2, 1050418.4, 1088434.6, 1126450.7, 1164466.9, 1202483.1,
0401     1240499.3, 1278515.4, 1316531.6, 1354547.8, 1392564.0, 1430580.1, 1468596.3, 1506612.5, 1544628.7, 1601652.9,
0402     1677685.3, 1753717.6, 1829750.0, 1905782.3, 1981814.7, 2057847.0};
0403 // for HPD:
0404 static const float adc2fC[128] = {
0405     -0.5,   0.5,    1.5,    2.5,    3.5,    4.5,    5.5,    6.5,    7.5,    8.5,    9.5,    10.5,   11.5,
0406     12.5,   13.5,   15.,    17.,    19.,    21.,    23.,    25.,    27.,    29.5,   32.5,   35.5,   38.5,
0407     42.,    46.,    50.,    54.5,   59.5,   64.5,   59.5,   64.5,   69.5,   74.5,   79.5,   84.5,   89.5,
0408     94.5,   99.5,   104.5,  109.5,  114.5,  119.5,  124.5,  129.5,  137.,   147.,   157.,   167.,   177.,
0409     187.,   197.,   209.5,  224.5,  239.5,  254.5,  272.,   292.,   312.,   334.5,  359.5,  384.5,  359.5,
0410     384.5,  409.5,  434.5,  459.5,  484.5,  509.5,  534.5,  559.5,  584.5,  609.5,  634.5,  659.5,  684.5,
0411     709.5,  747.,   797.,   847.,   897.,   947.,   997.,   1047.,  1109.5, 1184.5, 1259.5, 1334.5, 1422.,
0412     1522.,  1622.,  1734.5, 1859.5, 1984.5, 1859.5, 1984.5, 2109.5, 2234.5, 2359.5, 2484.5, 2609.5, 2734.5,
0413     2859.5, 2984.5, 3109.5, 3234.5, 3359.5, 3484.5, 3609.5, 3797.,  4047.,  4297.,  4547.,  4797.,  5047.,
0414     5297.,  5609.5, 5984.5, 6359.5, 6734.5, 7172.,  7672.,  8172.,  8734.5, 9359.5, 9984.5};
0415 const int nsub = 4;
0416 const int ndepth = 7;
0417 const int neta = 82;
0418 const int nphi = 72;
0419 const float bphi = 72.;
0420 const int zneta = 22;
0421 const int znphi = 18;
0422 const int npfit = 220;
0423 const float anpfit = 220.;  // for SiPM:
0424 
0425 //
0426 class CMTRawAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
0427 public:
0428   explicit CMTRawAnalyzer(const edm::ParameterSet&);
0429   ~CMTRawAnalyzer() override;
0430   void beginJob() override;
0431   void analyze(const edm::Event&, const edm::EventSetup&) override;
0432   void endJob() override;
0433   void beginRun(const edm::Run& r, const edm::EventSetup& iSetup) override;
0434   void endRun(const edm::Run& r, const edm::EventSetup& iSetup) override;
0435   virtual void fillMAP();
0436 
0437 private:
0438   double phi12(double phi1, double en1, double phi2, double en2);
0439   double dR(double eta1, double phi1, double eta2, double phi2);
0440   double dPhiWsign(double phi1, double phi2);
0441 
0442   edm::EDGetTokenT<HcalCalibDigiCollection> tok_calib_;
0443   edm::EDGetTokenT<HBHEDigiCollection> tok_hbhe_;
0444   edm::EDGetTokenT<HODigiCollection> tok_ho_;
0445   edm::EDGetTokenT<HFDigiCollection> tok_hf_;
0446   edm::EDGetTokenT<QIE11DigiCollection> tok_qie11_;
0447   edm::EDGetTokenT<QIE10DigiCollection> tok_qie10_;
0448   edm::EDGetTokenT<HBHERecHitCollection> tok_hbheSignal_;
0449   edm::EDGetTokenT<HBHERecHitCollection> tok_hbheNoise_;
0450   edm::EDGetTokenT<HFRecHitCollection> tok_hfSignal_;
0451   edm::EDGetTokenT<HFRecHitCollection> tok_hfNoise_;
0452 
0453   edm::Service<TFileService> fs_;
0454   edm::InputTag inputTag_;
0455   const edm::ESGetToken<HcalDbService, HcalDbRecord> tokDB_;
0456   const edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> tokTopo_;
0457   const HcalQIEShape* shape;
0458   const HcalDbService* conditions;
0459   const HcalTopology* topo;
0460   /////////////////////////////////////////////
0461   int verbosity;
0462   int MAPcreation;
0463   /////////////////////////////////////////////
0464   bool recordNtuples_;
0465   int maxNeventsInNtuple_;
0466   bool recordHistoes_;
0467   bool studyRunDependenceHist_;
0468   bool studyCapIDErrorsHist_;
0469   bool studyRMSshapeHist_;
0470   bool studyRatioShapeHist_;
0471   bool studyTSmaxShapeHist_;
0472   bool studyTSmeanShapeHist_;
0473   bool studyDiffAmplHist_;
0474   bool studyCalibCellsHist_;
0475   bool studyADCAmplHist_;
0476   bool studyPedestalsHist_;
0477   bool studyPedestalCorrelations_;
0478   bool usePedestalSubtraction_;
0479   bool useADCmassive_;
0480   bool useADCfC_;
0481   bool useADCcounts_;
0482   bool usecontinuousnumbering_;
0483   /////////////////////////////////////////////
0484   double ratioHBMin_;
0485   double ratioHBMax_;
0486   double ratioHEMin_;
0487   double ratioHEMax_;
0488   double ratioHFMin_;
0489   double ratioHFMax_;
0490   double ratioHOMin_;
0491   double ratioHOMax_;
0492   /////////////////////////////////////////////
0493   int flagfitshunt1pedorledlowintensity_;
0494   int flagLaserRaddam_;
0495   int flagToUseDigiCollectionsORNot_;
0496   int flagIterativeMethodCalibrationGroupDigi_;
0497   int flagIterativeMethodCalibrationGroupReco_;
0498   int flagtoaskrunsorls_;
0499   int flagtodefinebadchannel_;
0500   int howmanybinsonplots_;
0501   int splashesUpperLimit_;
0502   int flagabortgaprejected_;
0503   int bcnrejectedlow_;
0504   int bcnrejectedhigh_;
0505   int flagestimatornormalization_;
0506   int flagcpuoptimization_;
0507   int flagupgradeqie1011_;
0508   int flagsipmcorrection_;
0509   int flaguseshunt_;
0510   int lsdep_cut1_peak_HBdepth1_;
0511   int lsdep_cut1_peak_HBdepth2_;
0512   int lsdep_cut1_peak_HEdepth1_;
0513   int lsdep_cut1_peak_HEdepth2_;
0514   int lsdep_cut1_peak_HEdepth3_;
0515   int lsdep_cut1_peak_HFdepth1_;
0516   int lsdep_cut1_peak_HFdepth2_;
0517   int lsdep_cut1_peak_HOdepth4_;
0518   //
0519   int lsdep_cut3_max_HBdepth1_;
0520   int lsdep_cut3_max_HBdepth2_;
0521   int lsdep_cut3_max_HEdepth1_;
0522   int lsdep_cut3_max_HEdepth2_;
0523   int lsdep_cut3_max_HEdepth3_;
0524   int lsdep_cut3_max_HFdepth1_;
0525   int lsdep_cut3_max_HFdepth2_;
0526   int lsdep_cut3_max_HOdepth4_;
0527   double lsdep_estimator1_HBdepth1_;
0528   double lsdep_estimator1_HBdepth2_;
0529   double lsdep_estimator1_HEdepth1_;
0530   double lsdep_estimator1_HEdepth2_;
0531   double lsdep_estimator1_HEdepth3_;
0532   double lsdep_estimator1_HFdepth1_;
0533   double lsdep_estimator1_HFdepth2_;
0534   double lsdep_estimator1_HOdepth4_;
0535   double lsdep_estimator1_HEdepth4_;
0536   double lsdep_estimator1_HEdepth5_;
0537   double lsdep_estimator1_HEdepth6_;
0538   double lsdep_estimator1_HEdepth7_;
0539   double lsdep_estimator1_HFdepth3_;
0540   double lsdep_estimator1_HFdepth4_;
0541   double lsdep_estimator1_HBdepth3_;
0542   double lsdep_estimator1_HBdepth4_;
0543 
0544   double lsdep_estimator2_HBdepth1_;
0545   double lsdep_estimator2_HBdepth2_;
0546   double lsdep_estimator2_HEdepth1_;
0547   double lsdep_estimator2_HEdepth2_;
0548   double lsdep_estimator2_HEdepth3_;
0549   double lsdep_estimator2_HFdepth1_;
0550   double lsdep_estimator2_HFdepth2_;
0551   double lsdep_estimator2_HOdepth4_;
0552 
0553   double lsdep_estimator3_HBdepth1_;
0554   double lsdep_estimator3_HBdepth2_;
0555   double lsdep_estimator3_HEdepth1_;
0556   double lsdep_estimator3_HEdepth2_;
0557   double lsdep_estimator3_HEdepth3_;
0558   double lsdep_estimator3_HFdepth1_;
0559   double lsdep_estimator3_HFdepth2_;
0560   double lsdep_estimator3_HOdepth4_;
0561 
0562   double lsdep_estimator4_HBdepth1_;
0563   double lsdep_estimator4_HBdepth2_;
0564   double lsdep_estimator4_HEdepth1_;
0565   double lsdep_estimator4_HEdepth2_;
0566   double lsdep_estimator4_HEdepth3_;
0567   double lsdep_estimator4_HFdepth1_;
0568   double lsdep_estimator4_HFdepth2_;
0569   double lsdep_estimator4_HOdepth4_;
0570 
0571   double lsdep_estimator5_HBdepth1_;
0572   double lsdep_estimator5_HBdepth2_;
0573   double lsdep_estimator5_HEdepth1_;
0574   double lsdep_estimator5_HEdepth2_;
0575   double lsdep_estimator5_HEdepth3_;
0576   double lsdep_estimator5_HFdepth1_;
0577   double lsdep_estimator5_HFdepth2_;
0578   double lsdep_estimator5_HOdepth4_;
0579   double forallestimators_amplitude_bigger_;
0580   /////////////////////////////////////////////
0581   double rmsHBMin_;
0582   double rmsHBMax_;
0583   double rmsHEMin_;
0584   double rmsHEMax_;
0585   double rmsHFMin_;
0586   double rmsHFMax_;
0587   double rmsHOMin_;
0588   double rmsHOMax_;
0589   /////////////////////////////////////////////
0590   double TSpeakHBMin_;
0591   double TSpeakHBMax_;
0592   double TSpeakHEMin_;
0593   double TSpeakHEMax_;
0594   double TSpeakHFMin_;
0595   double TSpeakHFMax_;
0596   double TSpeakHOMin_;
0597   double TSpeakHOMax_;
0598   double TSmeanHBMin_;
0599   double TSmeanHBMax_;
0600   double TSmeanHEMin_;
0601   double TSmeanHEMax_;
0602   double TSmeanHFMin_;
0603   double TSmeanHFMax_;
0604   double TSmeanHOMin_;
0605   double TSmeanHOMax_;
0606   int lsmin_;
0607   int lsmax_;
0608   /////////////////////////////////////////////
0609   double ADCAmplHBMin_;
0610   double ADCAmplHEMin_;
0611   double ADCAmplHOMin_;
0612   double ADCAmplHFMin_;
0613   double ADCAmplHBMax_;
0614   double ADCAmplHEMax_;
0615   double ADCAmplHOMax_;
0616   double ADCAmplHFMax_;
0617   double calibrADCHBMin_;
0618   double calibrADCHEMin_;
0619   double calibrADCHOMin_;
0620   double calibrADCHFMin_;
0621   double calibrADCHBMax_;
0622   double calibrADCHEMax_;
0623   double calibrADCHOMax_;
0624   double calibrADCHFMax_;
0625   double calibrRatioHBMin_;
0626   double calibrRatioHEMin_;
0627   double calibrRatioHOMin_;
0628   double calibrRatioHFMin_;
0629   double calibrRatioHBMax_;
0630   double calibrRatioHEMax_;
0631   double calibrRatioHOMax_;
0632   double calibrRatioHFMax_;
0633   double calibrTSmaxHBMin_;
0634   double calibrTSmaxHEMin_;
0635   double calibrTSmaxHOMin_;
0636   double calibrTSmaxHFMin_;
0637   double calibrTSmaxHBMax_;
0638   double calibrTSmaxHEMax_;
0639   double calibrTSmaxHOMax_;
0640   double calibrTSmaxHFMax_;
0641   double calibrTSmeanHBMin_;
0642   double calibrTSmeanHEMin_;
0643   double calibrTSmeanHOMin_;
0644   double calibrTSmeanHFMin_;
0645   double calibrTSmeanHBMax_;
0646   double calibrTSmeanHEMax_;
0647   double calibrTSmeanHOMax_;
0648   double calibrTSmeanHFMax_;
0649   double calibrWidthHBMin_;
0650   double calibrWidthHEMin_;
0651   double calibrWidthHOMin_;
0652   double calibrWidthHFMin_;
0653   double calibrWidthHBMax_;
0654   double calibrWidthHEMax_;
0655   double calibrWidthHOMax_;
0656   double calibrWidthHFMax_;
0657   /////////////////////////////////////////////
0658   int nevent;
0659   int nevent50;
0660   int nnnnnn;
0661   int nnnnnnhbhe;
0662   int nnnnnnhbheqie11;
0663   int counterhf;
0664   int counterhfqie10;
0665   int counterho;
0666   int nnnnnn1;
0667   int nnnnnn2;
0668   int nnnnnn3;
0669   int nnnnnn4;
0670   int nnnnnn5;
0671   int nnnnnn6;
0672   double pedestalwHBMax_;
0673   double pedestalwHEMax_;
0674   double pedestalwHFMax_;
0675   double pedestalwHOMax_;
0676   double pedestalHBMax_;
0677   double pedestalHEMax_;
0678   double pedestalHFMax_;
0679   double pedestalHOMax_;
0680   /////////////////////////////////////////////
0681   TH1F* h_bcnvsamplitude_HB;
0682   TH1F* h_bcnvsamplitude0_HB;
0683   TH1F* h_bcnvsamplitude_HE;
0684   TH1F* h_bcnvsamplitude0_HE;
0685   TH1F* h_bcnvsamplitude_HF;
0686   TH1F* h_bcnvsamplitude0_HF;
0687   TH1F* h_bcnvsamplitude_HO;
0688   TH1F* h_bcnvsamplitude0_HO;
0689   TH1F* h_orbitNumvsamplitude_HB;
0690   TH1F* h_orbitNumvsamplitude0_HB;
0691   TH1F* h_orbitNumvsamplitude_HE;
0692   TH1F* h_orbitNumvsamplitude0_HE;
0693   TH1F* h_orbitNumvsamplitude_HF;
0694   TH1F* h_orbitNumvsamplitude0_HF;
0695   TH1F* h_orbitNumvsamplitude_HO;
0696   TH1F* h_orbitNumvsamplitude0_HO;
0697   TH2F* h_2DsumADCAmplEtaPhiLs0;
0698   TH2F* h_2DsumADCAmplEtaPhiLs1;
0699   TH2F* h_2DsumADCAmplEtaPhiLs2;
0700   TH2F* h_2DsumADCAmplEtaPhiLs3;
0701   TH2F* h_2DsumADCAmplEtaPhiLs00;
0702   TH2F* h_2DsumADCAmplEtaPhiLs10;
0703   TH2F* h_2DsumADCAmplEtaPhiLs20;
0704   TH2F* h_2DsumADCAmplEtaPhiLs30;
0705   TH1F* h_sumADCAmplEtaPhiLs;
0706   TH1F* h_sumADCAmplEtaPhiLs_bbbc;
0707   TH1F* h_sumADCAmplEtaPhiLs_bbb1;
0708   TH1F* h_sumADCAmplEtaPhiLs_lscounterM1;
0709   TH1F* h_sumADCAmplEtaPhiLs_ietaphi;
0710   TH1F* h_sumADCAmplEtaPhiLs_lscounterM1orbitNum;
0711   TH1F* h_sumADCAmplEtaPhiLs_orbitNum;
0712   TH2F* h_mapAiForLS_bad_HB;
0713   TH2F* h_map0AiForLS_bad_HB;
0714   TH2F* h_mapAiForLS_good_HB;
0715   TH2F* h_map0AiForLS_good_HB;
0716   TH2F* h_mapAiForLS_bad_HE;
0717   TH2F* h_map0AiForLS_bad_HE;
0718   TH2F* h_mapAiForLS_good_HE;
0719   TH2F* h_map0AiForLS_good_HE;
0720   TH2F* h_mapAiForLS_bad_HO;
0721   TH2F* h_map0AiForLS_bad_HO;
0722   TH2F* h_mapAiForLS_good_HO;
0723   TH2F* h_map0AiForLS_good_HO;
0724   TH2F* h_mapAiForLS_bad_HF;
0725   TH2F* h_map0AiForLS_bad_HF;
0726   TH2F* h_mapAiForLS_good_HF;
0727   TH2F* h_map0AiForLS_good_HF;
0728   TH1F* h_numberofhitsHBtest;
0729   TH1F* h_numberofhitsHEtest;
0730   TH1F* h_numberofhitsHFtest;
0731   TH1F* h_numberofhitsHOtest;
0732   TH1F* h_AmplitudeHBtest;
0733   TH1F* h_AmplitudeHBtest1;
0734   TH1F* h_AmplitudeHBtest6;
0735   TH1F* h_AmplitudeHEtest;
0736   TH1F* h_AmplitudeHEtest1;
0737   TH1F* h_AmplitudeHEtest6;
0738   TH1F* h_AmplitudeHFtest;
0739   TH1F* h_AmplitudeHOtest;
0740   TH1F* h_totalAmplitudeHB;
0741   TH1F* h_totalAmplitudeHE;
0742   TH1F* h_totalAmplitudeHF;
0743   TH1F* h_totalAmplitudeHO;
0744   TH1F* h_totalAmplitudeHBperEvent;
0745   TH1F* h_totalAmplitudeHEperEvent;
0746   TH1F* h_totalAmplitudeHFperEvent;
0747   TH1F* h_totalAmplitudeHOperEvent;
0748   TH1F* h_amplitudeaveragedbydepthes_HE;
0749   TH1F* h_ndepthesperamplitudebins_HE;
0750   TH1F* h_errorGeneral;
0751   TH1F* h_error1;
0752   TH1F* h_error2;
0753   TH1F* h_error3;
0754   TH1F* h_amplError;
0755   TH1F* h_amplFine;
0756   TH1F* h_errorGeneral_HB;
0757   TH1F* h_nadccounts8_HB;
0758   TH1F* h_nadccounts6_HB;
0759   TH1F* h_nadccounts4_HB;
0760   TH1F* h_nadccounts3_HB;
0761   TH1F* h_nadccounts2_HB;
0762   TH1F* h_nadccounts0_HB;
0763   TH1F* h_error1_HB;
0764   TH1F* h_error2_HB;
0765   TH1F* h_error3_HB;
0766   TH1F* h_error4_HB;
0767   TH1F* h_error5_HB;
0768   TH1F* h_error6_HB;
0769   TH1F* h_error7_HB;
0770   TH1F* h_amplError_HB;
0771   TH1F* h_amplFine_HB;
0772   TH2F* h_mapDepth1Error_HB;
0773   TH2F* h_mapDepth2Error_HB;
0774   TH2F* h_mapDepth3Error_HB;
0775   TH2F* h_mapDepth4Error_HB;
0776   TH1F* h_fiber0_HB;
0777   TH1F* h_fiber1_HB;
0778   TH1F* h_fiber2_HB;
0779   TH1F* h_repetedcapid_HB;
0780   TH1F* h_errorGeneral_HE;
0781   TH1F* h_nadccounts8_HE;
0782   TH1F* h_nadccounts6_HE;
0783   TH1F* h_nadccounts4_HE;
0784   TH1F* h_nadccounts3_HE;
0785   TH1F* h_nadccounts2_HE;
0786   TH1F* h_nadccounts0_HE;
0787   TH1F* h_error1_HE;
0788   TH1F* h_error2_HE;
0789   TH1F* h_error3_HE;
0790   TH1F* h_error4_HE;
0791   TH1F* h_error5_HE;
0792   TH1F* h_error6_HE;
0793   TH1F* h_error7_HE;
0794   TH1F* h_amplError_HE;
0795   TH1F* h_amplFine_HE;
0796   TH2F* h_mapDepth1Error_HE;
0797   TH2F* h_mapDepth2Error_HE;
0798   TH2F* h_mapDepth3Error_HE;
0799   TH2F* h_mapDepth4Error_HE;
0800   TH2F* h_mapDepth5Error_HE;
0801   TH2F* h_mapDepth6Error_HE;
0802   TH2F* h_mapDepth7Error_HE;
0803   TH1F* h_fiber0_HE;
0804   TH1F* h_fiber1_HE;
0805   TH1F* h_fiber2_HE;
0806   TH1F* h_repetedcapid_HE;
0807   TH1F* h_errorGeneral_HF;
0808   TH1F* h_error1_HF;
0809   TH1F* h_error2_HF;
0810   TH1F* h_error3_HF;
0811   TH1F* h_error4_HF;
0812   TH1F* h_error5_HF;
0813   TH1F* h_error6_HF;
0814   TH1F* h_error7_HF;
0815   TH1F* h_amplError_HF;
0816   TH1F* h_amplFine_HF;
0817   TH2F* h_mapDepth1Error_HF;
0818   TH2F* h_mapDepth2Error_HF;
0819   TH2F* h_mapDepth3Error_HF;
0820   TH2F* h_mapDepth4Error_HF;
0821   TH1F* h_fiber0_HF;
0822   TH1F* h_fiber1_HF;
0823   TH1F* h_fiber2_HF;
0824   TH1F* h_repetedcapid_HF;
0825   TH1F* h_errorGeneral_HO;
0826   TH1F* h_error1_HO;
0827   TH1F* h_error2_HO;
0828   TH1F* h_error3_HO;
0829   TH1F* h_error4_HO;
0830   TH1F* h_error5_HO;
0831   TH1F* h_error6_HO;
0832   TH1F* h_error7_HO;
0833   TH1F* h_amplError_HO;
0834   TH1F* h_amplFine_HO;
0835   TH2F* h_mapDepth4Error_HO;
0836   TH1F* h_fiber0_HO;
0837   TH1F* h_fiber1_HO;
0838   TH1F* h_fiber2_HO;
0839   TH1F* h_repetedcapid_HO;
0840   /////////////////////////////////////////////
0841   TH2F* h_mapDepth1ADCAmpl225Copy_HB;
0842   TH2F* h_mapDepth2ADCAmpl225Copy_HB;
0843   TH2F* h_mapDepth3ADCAmpl225Copy_HB;
0844   TH2F* h_mapDepth4ADCAmpl225Copy_HB;
0845   TH2F* h_mapDepth1ADCAmpl225Copy_HE;
0846   TH2F* h_mapDepth2ADCAmpl225Copy_HE;
0847   TH2F* h_mapDepth3ADCAmpl225Copy_HE;
0848   TH2F* h_mapDepth4ADCAmpl225Copy_HE;
0849   TH2F* h_mapDepth5ADCAmpl225Copy_HE;
0850   TH2F* h_mapDepth6ADCAmpl225Copy_HE;
0851   TH2F* h_mapDepth7ADCAmpl225Copy_HE;
0852   TH2F* h_mapDepth1ADCAmpl225Copy_HF;
0853   TH2F* h_mapDepth2ADCAmpl225Copy_HF;
0854   TH2F* h_mapDepth3ADCAmpl225Copy_HF;
0855   TH2F* h_mapDepth4ADCAmpl225Copy_HF;
0856   TH2F* h_mapDepth4ADCAmpl225Copy_HO;
0857   TH1F* h_ADCAmpl345Zoom_HE;
0858   TH1F* h_ADCAmpl345Zoom1_HE;
0859   TH1F* h_ADCAmpl345_HE;
0860   TH1F* h_ADCAmpl345Zoom_HB;
0861   TH1F* h_ADCAmpl345Zoom1_HB;
0862   TH1F* h_ADCAmpl345_HB;
0863   TH1F* h_ADCAmpl_HBCapIdNoError;
0864   TH1F* h_ADCAmpl345_HBCapIdNoError;
0865   TH1F* h_ADCAmpl_HBCapIdError;
0866   TH1F* h_ADCAmpl345_HBCapIdError;
0867   TH1F* h_ADCAmplZoom_HB;
0868   TH1F* h_ADCAmplZoom1_HB;
0869   TH1F* h_ADCAmpl_HB;
0870   TH1F* h_AmplitudeHBrest;
0871   TH1F* h_AmplitudeHBrest1;
0872   TH1F* h_AmplitudeHBrest6;
0873   TH2F* h_mapDepth1ADCAmpl_HB;
0874   TH2F* h_mapDepth2ADCAmpl_HB;
0875   TH2F* h_mapDepth1ADCAmpl225_HB;
0876   TH2F* h_mapDepth2ADCAmpl225_HB;
0877   TH2F* h_mapDepth3ADCAmpl_HB;
0878   TH2F* h_mapDepth4ADCAmpl_HB;
0879   TH2F* h_mapDepth3ADCAmpl225_HB;
0880   TH2F* h_mapDepth4ADCAmpl225_HB;
0881   TH1F* h_TSmeanA_HB;
0882   TH2F* h_mapDepth1TSmeanA_HB;
0883   TH2F* h_mapDepth2TSmeanA_HB;
0884   TH2F* h_mapDepth1TSmeanA225_HB;
0885   TH2F* h_mapDepth2TSmeanA225_HB;
0886   TH2F* h_mapDepth3TSmeanA_HB;
0887   TH2F* h_mapDepth4TSmeanA_HB;
0888   TH2F* h_mapDepth3TSmeanA225_HB;
0889   TH2F* h_mapDepth4TSmeanA225_HB;
0890   TH1F* h_TSmaxA_HB;
0891   TH2F* h_mapDepth1TSmaxA_HB;
0892   TH2F* h_mapDepth2TSmaxA_HB;
0893   TH2F* h_mapDepth1TSmaxA225_HB;
0894   TH2F* h_mapDepth2TSmaxA225_HB;
0895   TH2F* h_mapDepth3TSmaxA_HB;
0896   TH2F* h_mapDepth4TSmaxA_HB;
0897   TH2F* h_mapDepth3TSmaxA225_HB;
0898   TH2F* h_mapDepth4TSmaxA225_HB;
0899   TH1F* h_Amplitude_HB;
0900   TH2F* h_mapDepth1Amplitude_HB;
0901   TH2F* h_mapDepth2Amplitude_HB;
0902   TH2F* h_mapDepth1Amplitude225_HB;
0903   TH2F* h_mapDepth2Amplitude225_HB;
0904   TH2F* h_mapDepth3Amplitude_HB;
0905   TH2F* h_mapDepth4Amplitude_HB;
0906   TH2F* h_mapDepth3Amplitude225_HB;
0907   TH2F* h_mapDepth4Amplitude225_HB;
0908   TH1F* h_Ampl_HB;
0909   TH2F* h_mapDepth1Ampl047_HB;
0910   TH2F* h_mapDepth2Ampl047_HB;
0911   TH2F* h_mapDepth1Ampl_HB;
0912   TH2F* h_mapDepth2Ampl_HB;
0913   TH2F* h_mapDepth1AmplE34_HB;
0914   TH2F* h_mapDepth2AmplE34_HB;
0915   TH2F* h_mapDepth1_HB;
0916   TH2F* h_mapDepth2_HB;
0917   TH2F* h_mapDepth3Ampl047_HB;
0918   TH2F* h_mapDepth4Ampl047_HB;
0919   TH2F* h_mapDepth3Ampl_HB;
0920   TH2F* h_mapDepth4Ampl_HB;
0921   TH2F* h_mapDepth3AmplE34_HB;
0922   TH2F* h_mapDepth4AmplE34_HB;
0923   TH2F* h_mapDepth3_HB;
0924   TH2F* h_mapDepth4_HB;
0925   TH2F* h_mapDepth1ADCAmpl12_HB;
0926   TH2F* h_mapDepth2ADCAmpl12_HB;
0927   TH2F* h_mapDepth3ADCAmpl12_HB;
0928   TH2F* h_mapDepth4ADCAmpl12_HB;
0929   TH2F* h_mapDepth1ADCAmpl12_HE;
0930   TH2F* h_mapDepth2ADCAmpl12_HE;
0931   TH2F* h_mapDepth3ADCAmpl12_HE;
0932   TH2F* h_mapDepth4ADCAmpl12_HE;
0933   TH2F* h_mapDepth5ADCAmpl12_HE;
0934   TH2F* h_mapDepth6ADCAmpl12_HE;
0935   TH2F* h_mapDepth7ADCAmpl12_HE;
0936   TH2F* h_mapDepth1ADCAmpl12SiPM_HE;
0937   TH2F* h_mapDepth2ADCAmpl12SiPM_HE;
0938   TH2F* h_mapDepth3ADCAmpl12SiPM_HE;
0939   TH2F* h_mapDepth1ADCAmpl12_HF;
0940   TH2F* h_mapDepth2ADCAmpl12_HF;
0941   TH2F* h_mapDepth3ADCAmpl12_HF;
0942   TH2F* h_mapDepth4ADCAmpl12_HF;
0943   TH2F* h_mapDepth4ADCAmpl12_HO;
0944   TH2F* h_mapDepth1linADCAmpl12_HE;
0945   TH2F* h_mapDepth2linADCAmpl12_HE;
0946   TH2F* h_mapDepth3linADCAmpl12_HE;
0947 
0948   TH2F* h_mapDepth1TS2_HB;
0949   TH2F* h_mapDepth2TS2_HB;
0950   TH2F* h_mapDepth3TS2_HB;
0951   TH2F* h_mapDepth4TS2_HB;
0952   TH2F* h_mapDepth1TS2_HE;
0953   TH2F* h_mapDepth2TS2_HE;
0954   TH2F* h_mapDepth3TS2_HE;
0955   TH2F* h_mapDepth4TS2_HE;
0956   TH2F* h_mapDepth5TS2_HE;
0957   TH2F* h_mapDepth6TS2_HE;
0958   TH2F* h_mapDepth7TS2_HE;
0959   TH2F* h_mapDepth1TS1_HF;
0960   TH2F* h_mapDepth2TS1_HF;
0961   TH2F* h_mapDepth3TS1_HF;
0962   TH2F* h_mapDepth4TS1_HF;
0963   TH2F* h_mapDepth4TS012_HO;
0964 
0965   /////////////////////////////////////////////
0966   TH1F* h_ADCAmpl_HF;
0967   TH1F* h_ADCAmplrest1_HF;
0968   TH1F* h_ADCAmplrest6_HF;
0969   TH1F* h_ADCAmplZoom1_HF;
0970   TH2F* h_mapDepth1ADCAmpl_HF;
0971   TH2F* h_mapDepth2ADCAmpl_HF;
0972   TH2F* h_mapDepth1ADCAmpl225_HF;
0973   TH2F* h_mapDepth2ADCAmpl225_HF;
0974   TH2F* h_mapDepth3ADCAmpl_HF;
0975   TH2F* h_mapDepth4ADCAmpl_HF;
0976   TH2F* h_mapDepth3ADCAmpl225_HF;
0977   TH2F* h_mapDepth4ADCAmpl225_HF;
0978   TH1F* h_TSmeanA_HF;
0979   TH2F* h_mapDepth1TSmeanA_HF;
0980   TH2F* h_mapDepth2TSmeanA_HF;
0981   TH2F* h_mapDepth1TSmeanA225_HF;
0982   TH2F* h_mapDepth2TSmeanA225_HF;
0983   TH2F* h_mapDepth3TSmeanA_HF;
0984   TH2F* h_mapDepth4TSmeanA_HF;
0985   TH2F* h_mapDepth3TSmeanA225_HF;
0986   TH2F* h_mapDepth4TSmeanA225_HF;
0987   TH1F* h_TSmaxA_HF;
0988   TH2F* h_mapDepth1TSmaxA_HF;
0989   TH2F* h_mapDepth2TSmaxA_HF;
0990   TH2F* h_mapDepth1TSmaxA225_HF;
0991   TH2F* h_mapDepth2TSmaxA225_HF;
0992   TH2F* h_mapDepth3TSmaxA_HF;
0993   TH2F* h_mapDepth4TSmaxA_HF;
0994   TH2F* h_mapDepth3TSmaxA225_HF;
0995   TH2F* h_mapDepth4TSmaxA225_HF;
0996   TH1F* h_Amplitude_HF;
0997   TH2F* h_mapDepth1Amplitude_HF;
0998   TH2F* h_mapDepth2Amplitude_HF;
0999   TH2F* h_mapDepth1Amplitude225_HF;
1000   TH2F* h_mapDepth2Amplitude225_HF;
1001   TH2F* h_mapDepth3Amplitude_HF;
1002   TH2F* h_mapDepth4Amplitude_HF;
1003   TH2F* h_mapDepth3Amplitude225_HF;
1004   TH2F* h_mapDepth4Amplitude225_HF;
1005   TH1F* h_Ampl_HF;
1006   TH2F* h_mapDepth1Ampl047_HF;
1007   TH2F* h_mapDepth2Ampl047_HF;
1008   TH2F* h_mapDepth1Ampl_HF;
1009   TH2F* h_mapDepth2Ampl_HF;
1010   TH2F* h_mapDepth1AmplE34_HF;
1011   TH2F* h_mapDepth2AmplE34_HF;
1012   TH2F* h_mapDepth1_HF;
1013   TH2F* h_mapDepth2_HF;
1014   TH2F* h_mapDepth3Ampl047_HF;
1015   TH2F* h_mapDepth4Ampl047_HF;
1016   TH2F* h_mapDepth3Ampl_HF;
1017   TH2F* h_mapDepth4Ampl_HF;
1018   TH2F* h_mapDepth3AmplE34_HF;
1019   TH2F* h_mapDepth4AmplE34_HF;
1020   TH2F* h_mapDepth3_HF;
1021   TH2F* h_mapDepth4_HF;
1022   /////////////////////////////////////////////
1023   TH1F* h_ADCAmpl_HO;
1024   TH1F* h_ADCAmplrest1_HO;
1025   TH1F* h_ADCAmplrest6_HO;
1026   TH1F* h_ADCAmplZoom1_HO;
1027   TH1F* h_ADCAmpl_HO_copy;
1028   TH2F* h_mapDepth4ADCAmpl_HO;
1029   TH2F* h_mapDepth4ADCAmpl225_HO;
1030   TH1F* h_TSmeanA_HO;
1031   TH2F* h_mapDepth4TSmeanA_HO;
1032   TH2F* h_mapDepth4TSmeanA225_HO;
1033   TH1F* h_TSmaxA_HO;
1034   TH2F* h_mapDepth4TSmaxA_HO;
1035   TH2F* h_mapDepth4TSmaxA225_HO;
1036   TH1F* h_Amplitude_HO;
1037   TH2F* h_mapDepth4Amplitude_HO;
1038   TH2F* h_mapDepth4Amplitude225_HO;
1039   TH1F* h_Ampl_HO;
1040   TH2F* h_mapDepth4Ampl047_HO;
1041   TH2F* h_mapDepth4Ampl_HO;
1042   TH2F* h_mapDepth4AmplE34_HO;
1043   TH2F* h_mapDepth4_HO;
1044   /////////////////////////////////////////////
1045   //-----------------------------------
1046   TH1F* h_nbadchannels_depth1_HB;
1047   TH1F* h_runnbadchannels_depth1_HB;
1048   TH1F* h_runnbadchannelsC_depth1_HB;
1049   TH1F* h_runbadrate_depth1_HB;
1050   TH1F* h_runbadrateC_depth1_HB;
1051   TH1F* h_runbadrate0_depth1_HB;
1052   TH1F* h_nbadchannels_depth2_HB;
1053   TH1F* h_runnbadchannels_depth2_HB;
1054   TH1F* h_runnbadchannelsC_depth2_HB;
1055   TH1F* h_runbadrate_depth2_HB;
1056   TH1F* h_runbadrateC_depth2_HB;
1057   TH1F* h_runbadrate0_depth2_HB;
1058   TH1F* h_nbadchannels_depth3_HB;
1059   TH1F* h_runnbadchannels_depth3_HB;
1060   TH1F* h_runnbadchannelsC_depth3_HB;
1061   TH1F* h_runbadrate_depth3_HB;
1062   TH1F* h_runbadrateC_depth3_HB;
1063   TH1F* h_runbadrate0_depth3_HB;
1064   TH1F* h_nbadchannels_depth4_HB;
1065   TH1F* h_runnbadchannels_depth4_HB;
1066   TH1F* h_runnbadchannelsC_depth4_HB;
1067   TH1F* h_runbadrate_depth4_HB;
1068   TH1F* h_runbadrateC_depth4_HB;
1069   TH1F* h_runbadrate0_depth4_HB;
1070   //-----------------------------------
1071   TH1F* h_nbadchannels_depth1_HE;
1072   TH1F* h_runnbadchannels_depth1_HE;
1073   TH1F* h_runnbadchannelsC_depth1_HE;
1074   TH1F* h_runbadrate_depth1_HE;
1075   TH1F* h_runbadrateC_depth1_HE;
1076   TH1F* h_runbadrate0_depth1_HE;
1077   TH1F* h_nbadchannels_depth2_HE;
1078   TH1F* h_runnbadchannels_depth2_HE;
1079   TH1F* h_runnbadchannelsC_depth2_HE;
1080   TH1F* h_runbadrate_depth2_HE;
1081   TH1F* h_runbadrateC_depth2_HE;
1082   TH1F* h_runbadrate0_depth2_HE;
1083   TH1F* h_nbadchannels_depth3_HE;
1084   TH1F* h_runnbadchannels_depth3_HE;
1085   TH1F* h_runnbadchannelsC_depth3_HE;
1086   TH1F* h_runbadrate_depth3_HE;
1087   TH1F* h_runbadrateC_depth3_HE;
1088   TH1F* h_runbadrate0_depth3_HE;
1089   TH1F* h_nbadchannels_depth4_HE;
1090   TH1F* h_runnbadchannels_depth4_HE;
1091   TH1F* h_runnbadchannelsC_depth4_HE;
1092   TH1F* h_runbadrate_depth4_HE;
1093   TH1F* h_runbadrateC_depth4_HE;
1094   TH1F* h_runbadrate0_depth4_HE;
1095   TH1F* h_nbadchannels_depth5_HE;
1096   TH1F* h_runnbadchannels_depth5_HE;
1097   TH1F* h_runnbadchannelsC_depth5_HE;
1098   TH1F* h_runbadrate_depth5_HE;
1099   TH1F* h_runbadrateC_depth5_HE;
1100   TH1F* h_runbadrate0_depth5_HE;
1101   TH1F* h_nbadchannels_depth6_HE;
1102   TH1F* h_runnbadchannels_depth6_HE;
1103   TH1F* h_runnbadchannelsC_depth6_HE;
1104   TH1F* h_runbadrate_depth6_HE;
1105   TH1F* h_runbadrateC_depth6_HE;
1106   TH1F* h_runbadrate0_depth6_HE;
1107   TH1F* h_nbadchannels_depth7_HE;
1108   TH1F* h_runnbadchannels_depth7_HE;
1109   TH1F* h_runnbadchannelsC_depth7_HE;
1110   TH1F* h_runbadrate_depth7_HE;
1111   TH1F* h_runbadrateC_depth7_HE;
1112   TH1F* h_runbadrate0_depth7_HE;
1113   //-----------------------------------
1114   TH1F* h_nbadchannels_depth4_HO;
1115   TH1F* h_runnbadchannels_depth4_HO;
1116   TH1F* h_runnbadchannelsC_depth4_HO;
1117   TH1F* h_runbadrate_depth4_HO;
1118   TH1F* h_runbadrateC_depth4_HO;
1119   TH1F* h_runbadrate0_depth4_HO;
1120   //-----------------------------------
1121   TH1F* h_nbadchannels_depth1_HF;
1122   TH1F* h_runnbadchannels_depth1_HF;
1123   TH1F* h_runnbadchannelsC_depth1_HF;
1124   TH1F* h_runbadrate_depth1_HF;
1125   TH1F* h_runbadrateC_depth1_HF;
1126   TH1F* h_runbadrate0_depth1_HF;
1127   TH1F* h_nbadchannels_depth2_HF;
1128   TH1F* h_runnbadchannels_depth2_HF;
1129   TH1F* h_runnbadchannelsC_depth2_HF;
1130   TH1F* h_runbadrate_depth2_HF;
1131   TH1F* h_runbadrateC_depth2_HF;
1132   TH1F* h_runbadrate0_depth2_HF;
1133   TH1F* h_nbadchannels_depth3_HF;
1134   TH1F* h_runnbadchannels_depth3_HF;
1135   TH1F* h_runnbadchannelsC_depth3_HF;
1136   TH1F* h_runbadrate_depth3_HF;
1137   TH1F* h_runbadrateC_depth3_HF;
1138   TH1F* h_runbadrate0_depth3_HF;
1139   TH1F* h_nbadchannels_depth4_HF;
1140   TH1F* h_runnbadchannels_depth4_HF;
1141   TH1F* h_runnbadchannelsC_depth4_HF;
1142   TH1F* h_runbadrate_depth4_HF;
1143   TH1F* h_runbadrateC_depth4_HF;
1144   TH1F* h_runbadrate0_depth4_HF;
1145   //-----------------------------------
1146   TH1F* h_bcnnbadchannels_depth1_HB;
1147   TH1F* h_bcnnbadchannels_depth2_HB;
1148   TH1F* h_bcnnbadchannels_depth1_HE;
1149   TH1F* h_bcnnbadchannels_depth2_HE;
1150   TH1F* h_bcnnbadchannels_depth3_HE;
1151   TH1F* h_bcnnbadchannels_depth4_HO;
1152   TH1F* h_bcnnbadchannels_depth1_HF;
1153   TH1F* h_bcnnbadchannels_depth2_HF;
1154   //-----------------------------------
1155   TH1F* h_bcnbadrate0_depth1_HB;
1156   TH1F* h_bcnbadrate0_depth2_HB;
1157   TH1F* h_bcnbadrate0_depth1_HE;
1158   TH1F* h_bcnbadrate0_depth2_HE;
1159   TH1F* h_bcnbadrate0_depth3_HE;
1160   TH1F* h_bcnbadrate0_depth4_HO;
1161   TH1F* h_bcnbadrate0_depth1_HF;
1162   TH1F* h_bcnbadrate0_depth2_HF;
1163   //-----------------------------------
1164   TH1F* h_Amplitude_forCapIdErrors_HB1;
1165   TH1F* h_Amplitude_forCapIdErrors_HB2;
1166   TH1F* h_Amplitude_forCapIdErrors_HE1;
1167   TH1F* h_Amplitude_forCapIdErrors_HE2;
1168   TH1F* h_Amplitude_forCapIdErrors_HE3;
1169   TH1F* h_Amplitude_forCapIdErrors_HF1;
1170   TH1F* h_Amplitude_forCapIdErrors_HF2;
1171   TH1F* h_Amplitude_forCapIdErrors_HO4;
1172   TH1F* h_Amplitude_notCapIdErrors_HB1;
1173   TH1F* h_Amplitude_notCapIdErrors_HB2;
1174   TH1F* h_Amplitude_notCapIdErrors_HE1;
1175   TH1F* h_Amplitude_notCapIdErrors_HE2;
1176   TH1F* h_Amplitude_notCapIdErrors_HE3;
1177   TH1F* h_Amplitude_notCapIdErrors_HF1;
1178   TH1F* h_Amplitude_notCapIdErrors_HF2;
1179   TH1F* h_Amplitude_notCapIdErrors_HO4;
1180   //-----------------------------------
1181   /////////////////////////////////////////////
1182   TH1F* h_corrforxaMAIN_HE;
1183   TH1F* h_corrforxaMAIN0_HE;
1184   TH1F* h_corrforxaADDI_HE;
1185   TH1F* h_corrforxaADDI0_HE;
1186   TH1F* h_ADCAmpl_HE;
1187   TH1F* h_ADCAmplrest_HE;
1188   TH1F* h_ADCAmplrest1_HE;
1189   TH1F* h_ADCAmplrest6_HE;
1190   TH1F* h_ADCAmplZoom1_HE;
1191   TH2F* h_mapDepth1ADCAmpl_HE;
1192   TH2F* h_mapDepth2ADCAmpl_HE;
1193   TH2F* h_mapDepth3ADCAmpl_HE;
1194   TH2F* h_mapDepth4ADCAmpl_HE;
1195   TH2F* h_mapDepth5ADCAmpl_HE;
1196   TH2F* h_mapDepth6ADCAmpl_HE;
1197   TH2F* h_mapDepth7ADCAmpl_HE;
1198   TH2F* h_mapADCAmplfirstpeak_HE;
1199   TH2F* h_mapADCAmplfirstpeak0_HE;
1200   TH2F* h_mapADCAmplsecondpeak_HE;
1201   TH2F* h_mapADCAmplsecondpeak0_HE;
1202   TH2F* h_mapADCAmpl11firstpeak_HE;
1203   TH2F* h_mapADCAmpl11firstpeak0_HE;
1204   TH2F* h_mapADCAmpl11secondpeak_HE;
1205   TH2F* h_mapADCAmpl11secondpeak0_HE;
1206   TH2F* h_mapADCAmpl12firstpeak_HE;
1207   TH2F* h_mapADCAmpl12firstpeak0_HE;
1208   TH2F* h_mapADCAmpl12secondpeak_HE;
1209   TH2F* h_mapADCAmpl12secondpeak0_HE;
1210   TH1F* h_gsmdifferencefit1_HE;
1211   TH1F* h_gsmdifferencefit2_HE;
1212   TH1F* h_gsmdifferencefit3_HE;
1213   TH1F* h_gsmdifferencefit4_HE;
1214   TH1F* h_gsmdifferencefit5_HE;
1215   TH1F* h_gsmdifferencefit6_HE;
1216   TH2F* h_mapDepth1ADCAmplSiPM_HE;
1217   TH2F* h_mapDepth2ADCAmplSiPM_HE;
1218   TH2F* h_mapDepth3ADCAmplSiPM_HE;
1219   TH2F* h_mapDepth1ADCAmpl225_HE;
1220   TH2F* h_mapDepth2ADCAmpl225_HE;
1221   TH2F* h_mapDepth3ADCAmpl225_HE;
1222   TH2F* h_mapDepth4ADCAmpl225_HE;
1223   TH2F* h_mapDepth5ADCAmpl225_HE;
1224   TH2F* h_mapDepth6ADCAmpl225_HE;
1225   TH2F* h_mapDepth7ADCAmpl225_HE;
1226   TH1F* h_TSmeanA_HE;
1227   TH2F* h_mapDepth1TSmeanA_HE;
1228   TH2F* h_mapDepth2TSmeanA_HE;
1229   TH2F* h_mapDepth3TSmeanA_HE;
1230   TH2F* h_mapDepth4TSmeanA_HE;
1231   TH2F* h_mapDepth5TSmeanA_HE;
1232   TH2F* h_mapDepth6TSmeanA_HE;
1233   TH2F* h_mapDepth7TSmeanA_HE;
1234   TH2F* h_mapDepth1TSmeanA225_HE;
1235   TH2F* h_mapDepth2TSmeanA225_HE;
1236   TH2F* h_mapDepth3TSmeanA225_HE;
1237   TH2F* h_mapDepth4TSmeanA225_HE;
1238   TH2F* h_mapDepth5TSmeanA225_HE;
1239   TH2F* h_mapDepth6TSmeanA225_HE;
1240   TH2F* h_mapDepth7TSmeanA225_HE;
1241   TH1F* h_TSmaxA_HE;
1242   TH2F* h_mapDepth1TSmaxA_HE;
1243   TH2F* h_mapDepth2TSmaxA_HE;
1244   TH2F* h_mapDepth3TSmaxA_HE;
1245   TH2F* h_mapDepth4TSmaxA_HE;
1246   TH2F* h_mapDepth5TSmaxA_HE;
1247   TH2F* h_mapDepth6TSmaxA_HE;
1248   TH2F* h_mapDepth7TSmaxA_HE;
1249   TH2F* h_mapDepth1TSmaxA225_HE;
1250   TH2F* h_mapDepth2TSmaxA225_HE;
1251   TH2F* h_mapDepth3TSmaxA225_HE;
1252   TH2F* h_mapDepth4TSmaxA225_HE;
1253   TH2F* h_mapDepth5TSmaxA225_HE;
1254   TH2F* h_mapDepth6TSmaxA225_HE;
1255   TH2F* h_mapDepth7TSmaxA225_HE;
1256   TH1F* h_Amplitude_HE;
1257   TH2F* h_mapDepth1Amplitude_HE;
1258   TH2F* h_mapDepth2Amplitude_HE;
1259   TH2F* h_mapDepth3Amplitude_HE;
1260   TH2F* h_mapDepth4Amplitude_HE;
1261   TH2F* h_mapDepth5Amplitude_HE;
1262   TH2F* h_mapDepth6Amplitude_HE;
1263   TH2F* h_mapDepth7Amplitude_HE;
1264   TH2F* h_mapDepth1Amplitude225_HE;
1265   TH2F* h_mapDepth2Amplitude225_HE;
1266   TH2F* h_mapDepth3Amplitude225_HE;
1267   TH2F* h_mapDepth4Amplitude225_HE;
1268   TH2F* h_mapDepth5Amplitude225_HE;
1269   TH2F* h_mapDepth6Amplitude225_HE;
1270   TH2F* h_mapDepth7Amplitude225_HE;
1271   TH1F* h_Ampl_HE;
1272   TH2F* h_mapDepth1Ampl047_HE;
1273   TH2F* h_mapDepth2Ampl047_HE;
1274   TH2F* h_mapDepth3Ampl047_HE;
1275   TH2F* h_mapDepth4Ampl047_HE;
1276   TH2F* h_mapDepth5Ampl047_HE;
1277   TH2F* h_mapDepth6Ampl047_HE;
1278   TH2F* h_mapDepth7Ampl047_HE;
1279   TH2F* h_mapDepth1Ampl_HE;
1280   TH2F* h_mapDepth2Ampl_HE;
1281   TH2F* h_mapDepth3Ampl_HE;
1282   TH2F* h_mapDepth4Ampl_HE;
1283   TH2F* h_mapDepth5Ampl_HE;
1284   TH2F* h_mapDepth6Ampl_HE;
1285   TH2F* h_mapDepth7Ampl_HE;
1286   TH2F* h_mapDepth1AmplE34_HE;
1287   TH2F* h_mapDepth2AmplE34_HE;
1288   TH2F* h_mapDepth3AmplE34_HE;
1289   TH2F* h_mapDepth4AmplE34_HE;
1290   TH2F* h_mapDepth5AmplE34_HE;
1291   TH2F* h_mapDepth6AmplE34_HE;
1292   TH2F* h_mapDepth7AmplE34_HE;
1293   TH2F* h_mapDepth1_HE;
1294   TH2F* h_mapDepth2_HE;
1295   TH2F* h_mapDepth3_HE;
1296   TH2F* h_mapDepth4_HE;
1297   TH2F* h_mapDepth5_HE;
1298   TH2F* h_mapDepth6_HE;
1299   TH2F* h_mapDepth7_HE;
1300   TH2F* h_FullSignal3D_HB;
1301   TH2F* h_FullSignal3D0_HB;
1302   TH2F* h_FullSignal3D_HE;
1303   TH2F* h_FullSignal3D0_HE;
1304   TH2F* h_FullSignal3D_HO;
1305   TH2F* h_FullSignal3D0_HO;
1306   TH2F* h_FullSignal3D_HF;
1307   TH2F* h_FullSignal3D0_HF;
1308   TH2F* h_mapCapCalib047_HB;
1309   TH2F* h_mapCapCalib047_HE;
1310   TH2F* h_mapCapCalib047_HO;
1311   TH2F* h_mapCapCalib047_HF;
1312   TH1F* h_ADCCalib_HB;
1313   TH1F* h_ADCCalib1_HB;
1314   TH2F* h_mapADCCalib047_HB;
1315   TH2F* h_mapADCCalib_HB;
1316   TH1F* h_RatioCalib_HB;
1317   TH2F* h_mapRatioCalib047_HB;
1318   TH2F* h_mapRatioCalib_HB;
1319   TH1F* h_TSmaxCalib_HB;
1320   TH2F* h_mapTSmaxCalib047_HB;
1321   TH2F* h_mapTSmaxCalib_HB;
1322   TH1F* h_TSmeanCalib_HB;
1323   TH2F* h_mapTSmeanCalib047_HB;
1324   TH2F* h_mapTSmeanCalib_HB;
1325   TH1F* h_WidthCalib_HB;
1326   TH2F* h_mapWidthCalib047_HB;
1327   TH2F* h_mapWidthCalib_HB;
1328   TH2F* h_map_HB;
1329   TH1F* h_ADCCalib_HE;
1330   TH1F* h_ADCCalib1_HE;
1331   TH2F* h_mapADCCalib047_HE;
1332   TH2F* h_mapADCCalib_HE;
1333   TH1F* h_RatioCalib_HE;
1334   TH2F* h_mapRatioCalib047_HE;
1335   TH2F* h_mapRatioCalib_HE;
1336   TH1F* h_TSmaxCalib_HE;
1337   TH2F* h_mapTSmaxCalib047_HE;
1338   TH2F* h_mapTSmaxCalib_HE;
1339   TH1F* h_TSmeanCalib_HE;
1340   TH2F* h_mapTSmeanCalib047_HE;
1341   TH2F* h_mapTSmeanCalib_HE;
1342   TH1F* h_WidthCalib_HE;
1343   TH2F* h_mapWidthCalib047_HE;
1344   TH2F* h_mapWidthCalib_HE;
1345   TH2F* h_map_HE;
1346   TH1F* h_ADCCalib_HO;
1347   TH1F* h_ADCCalib1_HO;
1348   TH2F* h_mapADCCalib047_HO;
1349   TH2F* h_mapADCCalib_HO;
1350   TH1F* h_RatioCalib_HO;
1351   TH2F* h_mapRatioCalib047_HO;
1352   TH2F* h_mapRatioCalib_HO;
1353   TH1F* h_TSmaxCalib_HO;
1354   TH2F* h_mapTSmaxCalib047_HO;
1355   TH2F* h_mapTSmaxCalib_HO;
1356   TH1F* h_TSmeanCalib_HO;
1357   TH2F* h_mapTSmeanCalib047_HO;
1358   TH2F* h_mapTSmeanCalib_HO;
1359   TH1F* h_WidthCalib_HO;
1360   TH2F* h_mapWidthCalib047_HO;
1361   TH2F* h_mapWidthCalib_HO;
1362   TH2F* h_map_HO;
1363   TH1F* h_ADCCalib_HF;
1364   TH1F* h_ADCCalib1_HF;
1365   TH2F* h_mapADCCalib047_HF;
1366   TH2F* h_mapADCCalib_HF;
1367   TH1F* h_RatioCalib_HF;
1368   TH2F* h_mapRatioCalib047_HF;
1369   TH2F* h_mapRatioCalib_HF;
1370   TH1F* h_TSmaxCalib_HF;
1371   TH2F* h_mapTSmaxCalib047_HF;
1372   TH2F* h_mapTSmaxCalib_HF;
1373   TH1F* h_TSmeanCalib_HF;
1374   TH2F* h_mapTSmeanCalib047_HF;
1375   TH2F* h_mapTSmeanCalib_HF;
1376   TH1F* h_WidthCalib_HF;
1377   TH2F* h_mapWidthCalib047_HF;
1378   TH2F* h_mapWidthCalib_HF;
1379   TH2F* h_map_HF;
1380   TH1F* h_nls_per_run;
1381   TH1F* h_nls_per_run10;
1382   TH1F* h_nevents_per_LS;
1383   TH1F* h_nevents_per_LSzoom;
1384   TH1F* h_nevents_per_eachLS;
1385   TH1F* h_nevents_per_eachRealLS;
1386   TH1F* h_lsnumber_per_eachLS;
1387   TH1F* h_sumPedestalLS1;
1388   TH2F* h_2DsumPedestalLS1;
1389   TH1F* h_sumPedestalperLS1;
1390   TH2F* h_2D0sumPedestalLS1;
1391   TH1F* h_sum0PedestalperLS1;
1392   TH1F* h_sumPedestalLS2;
1393   TH2F* h_2DsumPedestalLS2;
1394   TH1F* h_sumPedestalperLS2;
1395   TH2F* h_2D0sumPedestalLS2;
1396   TH1F* h_sum0PedestalperLS2;
1397   TH1F* h_sumPedestalLS3;
1398   TH2F* h_2DsumPedestalLS3;
1399   TH1F* h_sumPedestalperLS3;
1400   TH2F* h_2D0sumPedestalLS3;
1401   TH1F* h_sum0PedestalperLS3;
1402   TH1F* h_sumPedestalLS4;
1403   TH2F* h_2DsumPedestalLS4;
1404   TH1F* h_sumPedestalperLS4;
1405   TH2F* h_2D0sumPedestalLS4;
1406   TH1F* h_sum0PedestalperLS4;
1407   TH1F* h_sumPedestalLS5;
1408   TH2F* h_2DsumPedestalLS5;
1409   TH1F* h_sumPedestalperLS5;
1410   TH2F* h_2D0sumPedestalLS5;
1411   TH1F* h_sum0PedestalperLS5;
1412   TH1F* h_sumPedestalLS6;
1413   TH2F* h_2DsumPedestalLS6;
1414   TH1F* h_sumPedestalperLS6;
1415   TH2F* h_2D0sumPedestalLS6;
1416   TH1F* h_sum0PedestalperLS6;
1417   TH1F* h_sumPedestalLS7;
1418   TH2F* h_2DsumPedestalLS7;
1419   TH1F* h_sumPedestalperLS7;
1420   TH2F* h_2D0sumPedestalLS7;
1421   TH1F* h_sum0PedestalperLS7;
1422   TH1F* h_sumPedestalLS8;
1423   TH2F* h_2DsumPedestalLS8;
1424   TH1F* h_sumPedestalperLS8;
1425   TH2F* h_2D0sumPedestalLS8;
1426   TH1F* h_sum0PedestalperLS8;
1427   TH2F* h_2DsumADCAmplLSdepth4HEu;
1428   TH2F* h_2D0sumADCAmplLSdepth4HEu;
1429   TH2F* h_2DsumADCAmplLSdepth5HEu;
1430   TH2F* h_2D0sumADCAmplLSdepth5HEu;
1431   TH2F* h_2DsumADCAmplLSdepth6HEu;
1432   TH2F* h_2D0sumADCAmplLSdepth6HEu;
1433   TH2F* h_2DsumADCAmplLSdepth7HEu;
1434   TH2F* h_2D0sumADCAmplLSdepth7HEu;
1435   TH2F* h_2DsumADCAmplLSdepth3HFu;
1436   TH2F* h_2D0sumADCAmplLSdepth3HFu;
1437   TH2F* h_2DsumADCAmplLSdepth4HFu;
1438   TH2F* h_2D0sumADCAmplLSdepth4HFu;
1439   TH2F* h_2DsumADCAmplLSdepth3HBu;
1440   TH2F* h_2D0sumADCAmplLSdepth3HBu;
1441   TH2F* h_2DsumADCAmplLSdepth4HBu;
1442   TH2F* h_2D0sumADCAmplLSdepth4HBu;
1443   TH1F* h_sumADCAmplLS1copy1;
1444   TH1F* h_sumADCAmplLS1copy2;
1445   TH1F* h_sumADCAmplLS1copy3;
1446   TH1F* h_sumADCAmplLS1copy4;
1447   TH1F* h_sumADCAmplLS1copy5;
1448   TH1F* h_sumADCAmplLS1;
1449   TH2F* h_2DsumADCAmplLS1;
1450   TH2F* h_2DsumADCAmplLS1_LSselected;
1451   TH1F* h_sumADCAmplperLS1;
1452   TH1F* h_sumCutADCAmplperLS1;
1453   TH2F* h_2D0sumADCAmplLS1;
1454   TH1F* h_sum0ADCAmplperLS1;
1455   TH1F* h_sumADCAmplLS2;
1456   TH2F* h_2DsumADCAmplLS2;
1457   TH2F* h_2DsumADCAmplLS2_LSselected;
1458   TH1F* h_sumADCAmplperLS2;
1459   TH1F* h_sumCutADCAmplperLS2;
1460   TH2F* h_2D0sumADCAmplLS2;
1461   TH1F* h_sum0ADCAmplperLS2;
1462   TH1F* h_sumADCAmplLS3;
1463   TH2F* h_2DsumADCAmplLS3;
1464   TH2F* h_2DsumADCAmplLS3_LSselected;
1465   TH1F* h_sumADCAmplperLS3;
1466   TH1F* h_sumCutADCAmplperLS3;
1467   TH2F* h_2D0sumADCAmplLS3;
1468   TH1F* h_sum0ADCAmplperLS3;
1469   TH1F* h_sumADCAmplLS4;
1470   TH2F* h_2DsumADCAmplLS4;
1471   TH2F* h_2DsumADCAmplLS4_LSselected;
1472   TH1F* h_sumADCAmplperLS4;
1473   TH1F* h_sumCutADCAmplperLS4;
1474   TH2F* h_2D0sumADCAmplLS4;
1475   TH1F* h_sum0ADCAmplperLS4;
1476   TH1F* h_sumADCAmplLS5;
1477   TH2F* h_2DsumADCAmplLS5;
1478   TH2F* h_2DsumADCAmplLS5_LSselected;
1479   TH1F* h_sumADCAmplperLS5;
1480   TH1F* h_sumCutADCAmplperLS5;
1481   TH2F* h_2D0sumADCAmplLS5;
1482   TH1F* h_sum0ADCAmplperLS5;
1483   TH1F* h_sumADCAmplLS6;
1484   TH2F* h_2DsumADCAmplLS6;
1485   TH2F* h_2DsumADCAmplLS6_LSselected;
1486   TH2F* h_2D0sumADCAmplLS6;
1487   TH1F* h_sumADCAmplperLS6;
1488   TH1F* h_sumCutADCAmplperLS6;
1489   TH1F* h_sum0ADCAmplperLS6;
1490   TH1F* h_sumADCAmplperLSdepth4HEu;
1491   TH1F* h_sumADCAmplperLSdepth5HEu;
1492   TH1F* h_sumADCAmplperLSdepth6HEu;
1493   TH1F* h_sumADCAmplperLSdepth7HEu;
1494   TH1F* h_sumCutADCAmplperLSdepth4HEu;
1495   TH1F* h_sumCutADCAmplperLSdepth5HEu;
1496   TH1F* h_sumCutADCAmplperLSdepth6HEu;
1497   TH1F* h_sumCutADCAmplperLSdepth7HEu;
1498   TH1F* h_sum0ADCAmplperLSdepth4HEu;
1499   TH1F* h_sum0ADCAmplperLSdepth5HEu;
1500   TH1F* h_sum0ADCAmplperLSdepth6HEu;
1501   TH1F* h_sum0ADCAmplperLSdepth7HEu;
1502   TH1F* h_sumADCAmplperLSdepth3HBu;
1503   TH1F* h_sumADCAmplperLSdepth4HBu;
1504   TH1F* h_sumCutADCAmplperLSdepth3HBu;
1505   TH1F* h_sumCutADCAmplperLSdepth4HBu;
1506   TH1F* h_sum0ADCAmplperLSdepth3HBu;
1507   TH1F* h_sum0ADCAmplperLSdepth4HBu;
1508   TH1F* h_sumADCAmplperLS6u;
1509   TH1F* h_sumCutADCAmplperLS6u;
1510   TH1F* h_sum0ADCAmplperLS6u;
1511   TH1F* h_sumADCAmplperLS1_P1;
1512   TH1F* h_sum0ADCAmplperLS1_P1;
1513   TH1F* h_sumADCAmplperLS1_P2;
1514   TH1F* h_sum0ADCAmplperLS1_P2;
1515   TH1F* h_sumADCAmplperLS1_M1;
1516   TH1F* h_sum0ADCAmplperLS1_M1;
1517   TH1F* h_sumADCAmplperLS1_M2;
1518   TH1F* h_sum0ADCAmplperLS1_M2;
1519   TH1F* h_sumADCAmplperLS3_P1;
1520   TH1F* h_sum0ADCAmplperLS3_P1;
1521   TH1F* h_sumADCAmplperLS3_P2;
1522   TH1F* h_sum0ADCAmplperLS3_P2;
1523   TH1F* h_sumADCAmplperLS3_M1;
1524   TH1F* h_sum0ADCAmplperLS3_M1;
1525   TH1F* h_sumADCAmplperLS3_M2;
1526   TH1F* h_sum0ADCAmplperLS3_M2;
1527   TH1F* h_sumADCAmplperLS6_P1;
1528   TH1F* h_sum0ADCAmplperLS6_P1;
1529   TH1F* h_sumADCAmplperLS6_P2;
1530   TH1F* h_sum0ADCAmplperLS6_P2;
1531   TH1F* h_sumADCAmplperLS6_M1;
1532   TH1F* h_sum0ADCAmplperLS6_M1;
1533   TH1F* h_sumADCAmplperLS6_M2;
1534   TH1F* h_sum0ADCAmplperLS6_M2;
1535   TH1F* h_sumADCAmplperLS8_P1;
1536   TH1F* h_sum0ADCAmplperLS8_P1;
1537   TH1F* h_sumADCAmplperLS8_P2;
1538   TH1F* h_sum0ADCAmplperLS8_P2;
1539   TH1F* h_sumADCAmplperLS8_M1;
1540   TH1F* h_sum0ADCAmplperLS8_M1;
1541   TH1F* h_sumADCAmplperLS8_M2;
1542   TH1F* h_sum0ADCAmplperLS8_M2;
1543   TH1F* h_sumADCAmplLS7;
1544   TH2F* h_2DsumADCAmplLS7;
1545   TH2F* h_2DsumADCAmplLS7_LSselected;
1546   TH2F* h_2D0sumADCAmplLS7;
1547   TH1F* h_sumADCAmplperLS7;
1548   TH1F* h_sumCutADCAmplperLS7;
1549   TH1F* h_sum0ADCAmplperLS7;
1550   TH1F* h_sumADCAmplperLS7u;
1551   TH1F* h_sumCutADCAmplperLS7u;
1552   TH1F* h_sum0ADCAmplperLS7u;
1553   TH1F* h_sumADCAmplLS8;
1554   TH2F* h_2DsumADCAmplLS8;
1555   TH2F* h_2DsumADCAmplLS8_LSselected;
1556   TH1F* h_sumADCAmplperLS8;
1557   TH1F* h_sumCutADCAmplperLS8;
1558   TH2F* h_2D0sumADCAmplLS8;
1559   TH1F* h_sum0ADCAmplperLS8;
1560   TH1F* h_sumTSmeanALS1;
1561   TH2F* h_2DsumTSmeanALS1;
1562   TH1F* h_sumTSmeanAperLS1;
1563   TH1F* h_sumTSmeanAperLS1_LSselected;
1564   TH1F* h_sumCutTSmeanAperLS1;
1565   TH2F* h_2D0sumTSmeanALS1;
1566   TH1F* h_sum0TSmeanAperLS1;
1567   TH1F* h_sumTSmeanALS2;
1568   TH2F* h_2DsumTSmeanALS2;
1569   TH1F* h_sumTSmeanAperLS2;
1570   TH1F* h_sumCutTSmeanAperLS2;
1571   TH2F* h_2D0sumTSmeanALS2;
1572   TH1F* h_sum0TSmeanAperLS2;
1573   TH1F* h_sumTSmeanALS3;
1574   TH2F* h_2DsumTSmeanALS3;
1575   TH1F* h_sumTSmeanAperLS3;
1576   TH1F* h_sumCutTSmeanAperLS3;
1577   TH2F* h_2D0sumTSmeanALS3;
1578   TH1F* h_sum0TSmeanAperLS3;
1579   TH1F* h_sumTSmeanALS4;
1580   TH2F* h_2DsumTSmeanALS4;
1581   TH1F* h_sumTSmeanAperLS4;
1582   TH1F* h_sumCutTSmeanAperLS4;
1583   TH2F* h_2D0sumTSmeanALS4;
1584   TH1F* h_sum0TSmeanAperLS4;
1585   TH1F* h_sumTSmeanALS5;
1586   TH2F* h_2DsumTSmeanALS5;
1587   TH1F* h_sumTSmeanAperLS5;
1588   TH1F* h_sumCutTSmeanAperLS5;
1589   TH2F* h_2D0sumTSmeanALS5;
1590   TH1F* h_sum0TSmeanAperLS5;
1591   TH1F* h_sumTSmeanALS6;
1592   TH2F* h_2DsumTSmeanALS6;
1593   TH1F* h_sumTSmeanAperLS6;
1594   TH1F* h_sumCutTSmeanAperLS6;
1595   TH2F* h_2D0sumTSmeanALS6;
1596   TH1F* h_sum0TSmeanAperLS6;
1597   TH1F* h_sumTSmeanALS7;
1598   TH2F* h_2DsumTSmeanALS7;
1599   TH1F* h_sumTSmeanAperLS7;
1600   TH1F* h_sumCutTSmeanAperLS7;
1601   TH2F* h_2D0sumTSmeanALS7;
1602   TH1F* h_sum0TSmeanAperLS7;
1603   TH1F* h_sumTSmeanALS8;
1604   TH2F* h_2DsumTSmeanALS8;
1605   TH1F* h_sumTSmeanAperLS8;
1606   TH1F* h_sumCutTSmeanAperLS8;
1607   TH2F* h_2D0sumTSmeanALS8;
1608   TH1F* h_sum0TSmeanAperLS8;
1609   TH1F* h_sumTSmaxALS1;
1610   TH2F* h_2DsumTSmaxALS1;
1611   TH1F* h_sumTSmaxAperLS1;
1612   TH1F* h_sumTSmaxAperLS1_LSselected;
1613   TH1F* h_sumCutTSmaxAperLS1;
1614   TH2F* h_2D0sumTSmaxALS1;
1615   TH1F* h_sum0TSmaxAperLS1;
1616   TH1F* h_sumTSmaxALS2;
1617   TH2F* h_2DsumTSmaxALS2;
1618   TH1F* h_sumTSmaxAperLS2;
1619   TH1F* h_sumCutTSmaxAperLS2;
1620   TH2F* h_2D0sumTSmaxALS2;
1621   TH1F* h_sum0TSmaxAperLS2;
1622   TH1F* h_sumTSmaxALS3;
1623   TH2F* h_2DsumTSmaxALS3;
1624   TH1F* h_sumTSmaxAperLS3;
1625   TH1F* h_sumCutTSmaxAperLS3;
1626   TH2F* h_2D0sumTSmaxALS3;
1627   TH1F* h_sum0TSmaxAperLS3;
1628   TH1F* h_sumTSmaxALS4;
1629   TH2F* h_2DsumTSmaxALS4;
1630   TH1F* h_sumTSmaxAperLS4;
1631   TH1F* h_sumCutTSmaxAperLS4;
1632   TH2F* h_2D0sumTSmaxALS4;
1633   TH1F* h_sum0TSmaxAperLS4;
1634   TH1F* h_sumTSmaxALS5;
1635   TH2F* h_2DsumTSmaxALS5;
1636   TH1F* h_sumTSmaxAperLS5;
1637   TH1F* h_sumCutTSmaxAperLS5;
1638   TH2F* h_2D0sumTSmaxALS5;
1639   TH1F* h_sum0TSmaxAperLS5;
1640   TH1F* h_sumTSmaxALS6;
1641   TH2F* h_2DsumTSmaxALS6;
1642   TH1F* h_sumTSmaxAperLS6;
1643   TH1F* h_sumCutTSmaxAperLS6;
1644   TH2F* h_2D0sumTSmaxALS6;
1645   TH1F* h_sum0TSmaxAperLS6;
1646   TH1F* h_sumTSmaxALS7;
1647   TH2F* h_2DsumTSmaxALS7;
1648   TH1F* h_sumTSmaxAperLS7;
1649   TH1F* h_sumCutTSmaxAperLS7;
1650   TH2F* h_2D0sumTSmaxALS7;
1651   TH1F* h_sum0TSmaxAperLS7;
1652   TH1F* h_sumTSmaxALS8;
1653   TH2F* h_2DsumTSmaxALS8;
1654   TH1F* h_sumTSmaxAperLS8;
1655   TH1F* h_sumCutTSmaxAperLS8;
1656   TH2F* h_2D0sumTSmaxALS8;
1657   TH1F* h_sum0TSmaxAperLS8;
1658   TH1F* h_sumAmplitudeLS1;
1659   TH2F* h_2DsumAmplitudeLS1;
1660   TH1F* h_sumAmplitudeperLS1;
1661   TH1F* h_sumAmplitudeperLS1_LSselected;
1662   TH1F* h_sumCutAmplitudeperLS1;
1663   TH2F* h_2D0sumAmplitudeLS1;
1664   TH1F* h_sum0AmplitudeperLS1;
1665   TH1F* h_sumAmplitudeLS2;
1666   TH2F* h_2DsumAmplitudeLS2;
1667   TH1F* h_sumAmplitudeperLS2;
1668   TH1F* h_sumCutAmplitudeperLS2;
1669   TH2F* h_2D0sumAmplitudeLS2;
1670   TH1F* h_sum0AmplitudeperLS2;
1671   TH1F* h_sumAmplitudeLS3;
1672   TH2F* h_2DsumAmplitudeLS3;
1673   TH1F* h_sumAmplitudeperLS3;
1674   TH1F* h_sumCutAmplitudeperLS3;
1675   TH2F* h_2D0sumAmplitudeLS3;
1676   TH1F* h_sum0AmplitudeperLS3;
1677   TH1F* h_sumAmplitudeLS4;
1678   TH2F* h_2DsumAmplitudeLS4;
1679   TH1F* h_sumAmplitudeperLS4;
1680   TH1F* h_sumCutAmplitudeperLS4;
1681   TH2F* h_2D0sumAmplitudeLS4;
1682   TH1F* h_sum0AmplitudeperLS4;
1683   TH1F* h_sumAmplitudeLS5;
1684   TH2F* h_2DsumAmplitudeLS5;
1685   TH1F* h_sumAmplitudeperLS5;
1686   TH1F* h_sumCutAmplitudeperLS5;
1687   TH2F* h_2D0sumAmplitudeLS5;
1688   TH1F* h_sum0AmplitudeperLS5;
1689   TH1F* h_sumAmplitudeLS6;
1690   TH2F* h_2DsumAmplitudeLS6;
1691   TH1F* h_sumAmplitudeperLS6;
1692   TH1F* h_sumCutAmplitudeperLS6;
1693   TH2F* h_2D0sumAmplitudeLS6;
1694   TH1F* h_sum0AmplitudeperLS6;
1695   TH1F* h_sumAmplitudeLS7;
1696   TH2F* h_2DsumAmplitudeLS7;
1697   TH1F* h_sumAmplitudeperLS7;
1698   TH1F* h_sumCutAmplitudeperLS7;
1699   TH2F* h_2D0sumAmplitudeLS7;
1700   TH1F* h_sum0AmplitudeperLS7;
1701   TH1F* h_sumAmplitudeLS8;
1702   TH2F* h_2DsumAmplitudeLS8;
1703   TH1F* h_sumAmplitudeperLS8;
1704   TH1F* h_sumCutAmplitudeperLS8;
1705   TH2F* h_2D0sumAmplitudeLS8;
1706   TH1F* h_sum0AmplitudeperLS8;
1707   TH1F* h_sumAmplLS1;
1708   TH2F* h_2DsumAmplLS1;
1709   TH1F* h_sumAmplperLS1;
1710   TH1F* h_sumAmplperLS1_LSselected;
1711   TH1F* h_sumCutAmplperLS1;
1712   TH2F* h_2D0sumAmplLS1;
1713   TH1F* h_sum0AmplperLS1;
1714   TH1F* h_sumAmplLS2;
1715   TH2F* h_2DsumAmplLS2;
1716   TH1F* h_sumAmplperLS2;
1717   TH1F* h_sumCutAmplperLS2;
1718   TH2F* h_2D0sumAmplLS2;
1719   TH1F* h_sum0AmplperLS2;
1720   TH1F* h_sumAmplLS3;
1721   TH2F* h_2DsumAmplLS3;
1722   TH1F* h_sumAmplperLS3;
1723   TH1F* h_sumCutAmplperLS3;
1724   TH2F* h_2D0sumAmplLS3;
1725   TH1F* h_sum0AmplperLS3;
1726   TH1F* h_sumAmplLS4;
1727   TH2F* h_2DsumAmplLS4;
1728   TH1F* h_sumAmplperLS4;
1729   TH1F* h_sumCutAmplperLS4;
1730   TH2F* h_2D0sumAmplLS4;
1731   TH1F* h_sum0AmplperLS4;
1732   TH1F* h_sumAmplLS5;
1733   TH2F* h_2DsumAmplLS5;
1734   TH1F* h_sumAmplperLS5;
1735   TH1F* h_sumCutAmplperLS5;
1736   TH2F* h_2D0sumAmplLS5;
1737   TH1F* h_sum0AmplperLS5;
1738   TH1F* h_sumAmplLS6;
1739   TH2F* h_2DsumAmplLS6;
1740   TH1F* h_sumAmplperLS6;
1741   TH1F* h_sumCutAmplperLS6;
1742   TH2F* h_2D0sumAmplLS6;
1743   TH1F* h_sum0AmplperLS6;
1744   TH1F* h_RatioOccupancy_HBP;
1745   TH1F* h_RatioOccupancy_HBM;
1746   TH1F* h_RatioOccupancy_HEP;
1747   TH1F* h_RatioOccupancy_HEM;
1748   TH1F* h_RatioOccupancy_HOP;
1749   TH1F* h_RatioOccupancy_HOM;
1750   TH1F* h_RatioOccupancy_HFP;
1751   TH1F* h_RatioOccupancy_HFM;
1752   TH1F* h_sumAmplLS7;
1753   TH2F* h_2DsumAmplLS7;
1754   TH1F* h_sumAmplperLS7;
1755   TH1F* h_sumCutAmplperLS7;
1756   TH2F* h_2D0sumAmplLS7;
1757   TH1F* h_sum0AmplperLS7;
1758   TH1F* h_sumAmplLS8;
1759   TH2F* h_2DsumAmplLS8;
1760   TH1F* h_sumAmplperLS8;
1761   TH1F* h_sumCutAmplperLS8;
1762   TH2F* h_2D0sumAmplLS8;
1763   TH1F* h_sum0AmplperLS8;
1764   TH1F* h_pedestal0_HB;
1765   TH1F* h_pedestal1_HB;
1766   TH1F* h_pedestal2_HB;
1767   TH1F* h_pedestal3_HB;
1768   TH1F* h_pedestalaver4_HB;
1769   TH1F* h_pedestalaver9_HB;
1770   TH1F* h_pedestalw0_HB;
1771   TH1F* h_pedestalw1_HB;
1772   TH1F* h_pedestalw2_HB;
1773   TH1F* h_pedestalw3_HB;
1774   TH1F* h_pedestalwaver4_HB;
1775   TH1F* h_pedestalwaver9_HB;
1776   TH1F* h_pedestal0_HE;
1777   TH1F* h_pedestal1_HE;
1778   TH1F* h_pedestal2_HE;
1779   TH1F* h_pedestal3_HE;
1780   TH1F* h_pedestalaver4_HE;
1781   TH1F* h_pedestalaver9_HE;
1782   TH1F* h_pedestalw0_HE;
1783   TH1F* h_pedestalw1_HE;
1784   TH1F* h_pedestalw2_HE;
1785   TH1F* h_pedestalw3_HE;
1786   TH1F* h_pedestalwaver4_HE;
1787   TH1F* h_pedestalwaver9_HE;
1788   TH1F* h_pedestal0_HF;
1789   TH1F* h_pedestal1_HF;
1790   TH1F* h_pedestal2_HF;
1791   TH1F* h_pedestal3_HF;
1792   TH1F* h_pedestalaver4_HF;
1793   TH1F* h_pedestalaver9_HF;
1794   TH1F* h_pedestalw0_HF;
1795   TH1F* h_pedestalw1_HF;
1796   TH1F* h_pedestalw2_HF;
1797   TH1F* h_pedestalw3_HF;
1798   TH1F* h_pedestalwaver4_HF;
1799   TH1F* h_pedestalwaver9_HF;
1800   TH1F* h_pedestal0_HO;
1801   TH1F* h_pedestal1_HO;
1802   TH1F* h_pedestal2_HO;
1803   TH1F* h_pedestal3_HO;
1804   TH1F* h_pedestalaver4_HO;
1805   TH1F* h_pedestalaver9_HO;
1806   TH1F* h_pedestalw0_HO;
1807   TH1F* h_pedestalw1_HO;
1808   TH1F* h_pedestalw2_HO;
1809   TH1F* h_pedestalw3_HO;
1810   TH1F* h_pedestalwaver4_HO;
1811   TH1F* h_pedestalwaver9_HO;
1812   TH2F* h_mapDepth1pedestalw_HB;
1813   TH2F* h_mapDepth2pedestalw_HB;
1814   TH2F* h_mapDepth3pedestalw_HB;
1815   TH2F* h_mapDepth4pedestalw_HB;
1816   TH2F* h_mapDepth1pedestalw_HE;
1817   TH2F* h_mapDepth2pedestalw_HE;
1818   TH2F* h_mapDepth3pedestalw_HE;
1819   TH2F* h_mapDepth4pedestalw_HE;
1820   TH2F* h_mapDepth5pedestalw_HE;
1821   TH2F* h_mapDepth6pedestalw_HE;
1822   TH2F* h_mapDepth7pedestalw_HE;
1823   TH2F* h_mapDepth1pedestalw_HF;
1824   TH2F* h_mapDepth2pedestalw_HF;
1825   TH2F* h_mapDepth3pedestalw_HF;
1826   TH2F* h_mapDepth4pedestalw_HF;
1827   TH2F* h_mapDepth4pedestalw_HO;
1828   TH2F* h_mapDepth1pedestal_HB;
1829   TH2F* h_mapDepth2pedestal_HB;
1830   TH2F* h_mapDepth3pedestal_HB;
1831   TH2F* h_mapDepth4pedestal_HB;
1832   TH2F* h_mapDepth1pedestal_HE;
1833   TH2F* h_mapDepth2pedestal_HE;
1834   TH2F* h_mapDepth3pedestal_HE;
1835   TH2F* h_mapDepth4pedestal_HE;
1836   TH2F* h_mapDepth5pedestal_HE;
1837   TH2F* h_mapDepth6pedestal_HE;
1838   TH2F* h_mapDepth7pedestal_HE;
1839   TH2F* h_mapDepth1pedestal_HF;
1840   TH2F* h_mapDepth2pedestal_HF;
1841   TH2F* h_mapDepth3pedestal_HF;
1842   TH2F* h_mapDepth4pedestal_HF;
1843   TH2F* h_mapDepth4pedestal_HO;
1844   TH1F* h_pedestal00_HB;
1845   TH1F* h_gain_HB;
1846   TH1F* h_respcorr_HB;
1847   TH1F* h_timecorr_HB;
1848   TH1F* h_lutcorr_HB;
1849   TH1F* h_difpedestal0_HB;
1850   TH1F* h_difpedestal1_HB;
1851   TH1F* h_difpedestal2_HB;
1852   TH1F* h_difpedestal3_HB;
1853   TH1F* h_pedestal00_HE;
1854   TH1F* h_gain_HE;
1855   TH1F* h_respcorr_HE;
1856   TH1F* h_timecorr_HE;
1857   TH1F* h_lutcorr_HE;
1858   TH1F* h_pedestal00_HF;
1859   TH1F* h_gain_HF;
1860   TH1F* h_respcorr_HF;
1861   TH1F* h_timecorr_HF;
1862   TH1F* h_lutcorr_HF;
1863   TH1F* h_pedestal00_HO;
1864   TH1F* h_gain_HO;
1865   TH1F* h_respcorr_HO;
1866   TH1F* h_timecorr_HO;
1867   TH1F* h_lutcorr_HO;
1868   TH2F* h2_pedvsampl_HB;
1869   TH2F* h2_pedwvsampl_HB;
1870   TH1F* h_pedvsampl_HB;
1871   TH1F* h_pedwvsampl_HB;
1872   TH1F* h_pedvsampl0_HB;
1873   TH1F* h_pedwvsampl0_HB;
1874   TH2F* h2_amplvsped_HB;
1875   TH2F* h2_amplvspedw_HB;
1876   TH1F* h_amplvsped_HB;
1877   TH1F* h_amplvspedw_HB;
1878   TH1F* h_amplvsped0_HB;
1879   TH2F* h2_pedvsampl_HE;
1880   TH2F* h2_pedwvsampl_HE;
1881   TH1F* h_pedvsampl_HE;
1882   TH1F* h_pedwvsampl_HE;
1883   TH1F* h_pedvsampl0_HE;
1884   TH1F* h_pedwvsampl0_HE;
1885   TH2F* h2_pedvsampl_HF;
1886   TH2F* h2_pedwvsampl_HF;
1887   TH1F* h_pedvsampl_HF;
1888   TH1F* h_pedwvsampl_HF;
1889   TH1F* h_pedvsampl0_HF;
1890   TH1F* h_pedwvsampl0_HF;
1891   TH2F* h2_pedvsampl_HO;
1892   TH2F* h2_pedwvsampl_HO;
1893   TH1F* h_pedvsampl_HO;
1894   TH1F* h_pedwvsampl_HO;
1895   TH1F* h_pedvsampl0_HO;
1896   TH1F* h_pedwvsampl0_HO;
1897   TH1F* h_shape_Ahigh_HB0;
1898   TH1F* h_shape0_Ahigh_HB0;
1899   TH1F* h_shape_Alow_HB0;
1900   TH1F* h_shape0_Alow_HB0;
1901   TH1F* h_shape_Ahigh_HB1;
1902   TH1F* h_shape0_Ahigh_HB1;
1903   TH1F* h_shape_Alow_HB1;
1904   TH1F* h_shape0_Alow_HB1;
1905   TH1F* h_shape_Ahigh_HB2;
1906   TH1F* h_shape0_Ahigh_HB2;
1907   TH1F* h_shape_Alow_HB2;
1908   TH1F* h_shape0_Alow_HB2;
1909   TH1F* h_shape_Ahigh_HB3;
1910   TH1F* h_shape0_Ahigh_HB3;
1911   TH1F* h_shape_Alow_HB3;
1912   TH1F* h_shape0_Alow_HB3;
1913   TH1F* h_shape_bad_channels_HB;
1914   TH1F* h_shape0_bad_channels_HB;
1915   TH1F* h_shape_good_channels_HB;
1916   TH1F* h_shape0_good_channels_HB;
1917   TH1F* h_shape_bad_channels_HE;
1918   TH1F* h_shape0_bad_channels_HE;
1919   TH1F* h_shape_good_channels_HE;
1920   TH1F* h_shape0_good_channels_HE;
1921   TH1F* h_shape_bad_channels_HF;
1922   TH1F* h_shape0_bad_channels_HF;
1923   TH1F* h_shape_good_channels_HF;
1924   TH1F* h_shape0_good_channels_HF;
1925   TH1F* h_shape_bad_channels_HO;
1926   TH1F* h_shape0_bad_channels_HO;
1927   TH1F* h_shape_good_channels_HO;
1928   TH1F* h_shape0_good_channels_HO;
1929   TH1F* h_sumamplitude_depth1_HB;
1930   TH1F* h_sumamplitude_depth2_HB;
1931   TH1F* h_sumamplitude_depth1_HE;
1932   TH1F* h_sumamplitude_depth2_HE;
1933   TH1F* h_sumamplitude_depth3_HE;
1934   TH1F* h_sumamplitude_depth1_HF;
1935   TH1F* h_sumamplitude_depth2_HF;
1936   TH1F* h_sumamplitude_depth4_HO;
1937   TH1F* h_sumamplitude_depth1_HB0;
1938   TH1F* h_sumamplitude_depth2_HB0;
1939   TH1F* h_sumamplitude_depth1_HE0;
1940   TH1F* h_sumamplitude_depth2_HE0;
1941   TH1F* h_sumamplitude_depth3_HE0;
1942   TH1F* h_sumamplitude_depth1_HF0;
1943   TH1F* h_sumamplitude_depth2_HF0;
1944   TH1F* h_sumamplitude_depth4_HO0;
1945   TH1F* h_sumamplitude_depth1_HB1;
1946   TH1F* h_sumamplitude_depth2_HB1;
1947   TH1F* h_sumamplitude_depth1_HE1;
1948   TH1F* h_sumamplitude_depth2_HE1;
1949   TH1F* h_sumamplitude_depth3_HE1;
1950   TH1F* h_sumamplitude_depth1_HF1;
1951   TH1F* h_sumamplitude_depth2_HF1;
1952   TH1F* h_sumamplitude_depth4_HO1;
1953   TH2F* h_mapDepth1Ped0_HB;
1954   TH2F* h_mapDepth1Ped1_HB;
1955   TH2F* h_mapDepth1Ped2_HB;
1956   TH2F* h_mapDepth1Ped3_HB;
1957   TH2F* h_mapDepth1Pedw0_HB;
1958   TH2F* h_mapDepth1Pedw1_HB;
1959   TH2F* h_mapDepth1Pedw2_HB;
1960   TH2F* h_mapDepth1Pedw3_HB;
1961   TH2F* h_mapDepth2Ped0_HB;
1962   TH2F* h_mapDepth2Ped1_HB;
1963   TH2F* h_mapDepth2Ped2_HB;
1964   TH2F* h_mapDepth2Ped3_HB;
1965   TH2F* h_mapDepth2Pedw0_HB;
1966   TH2F* h_mapDepth2Pedw1_HB;
1967   TH2F* h_mapDepth2Pedw2_HB;
1968   TH2F* h_mapDepth2Pedw3_HB;
1969   TH2F* h_mapDepth1Ped0_HE;
1970   TH2F* h_mapDepth1Ped1_HE;
1971   TH2F* h_mapDepth1Ped2_HE;
1972   TH2F* h_mapDepth1Ped3_HE;
1973   TH2F* h_mapDepth1Pedw0_HE;
1974   TH2F* h_mapDepth1Pedw1_HE;
1975   TH2F* h_mapDepth1Pedw2_HE;
1976   TH2F* h_mapDepth1Pedw3_HE;
1977   TH2F* h_mapDepth2Ped0_HE;
1978   TH2F* h_mapDepth2Ped1_HE;
1979   TH2F* h_mapDepth2Ped2_HE;
1980   TH2F* h_mapDepth2Ped3_HE;
1981   TH2F* h_mapDepth2Pedw0_HE;
1982   TH2F* h_mapDepth2Pedw1_HE;
1983   TH2F* h_mapDepth2Pedw2_HE;
1984   TH2F* h_mapDepth2Pedw3_HE;
1985   TH2F* h_mapDepth3Ped0_HE;
1986   TH2F* h_mapDepth3Ped1_HE;
1987   TH2F* h_mapDepth3Ped2_HE;
1988   TH2F* h_mapDepth3Ped3_HE;
1989   TH2F* h_mapDepth3Pedw0_HE;
1990   TH2F* h_mapDepth3Pedw1_HE;
1991   TH2F* h_mapDepth3Pedw2_HE;
1992   TH2F* h_mapDepth3Pedw3_HE;
1993   TH2F* h_mapDepth1Ped0_HF;
1994   TH2F* h_mapDepth1Ped1_HF;
1995   TH2F* h_mapDepth1Ped2_HF;
1996   TH2F* h_mapDepth1Ped3_HF;
1997   TH2F* h_mapDepth1Pedw0_HF;
1998   TH2F* h_mapDepth1Pedw1_HF;
1999   TH2F* h_mapDepth1Pedw2_HF;
2000   TH2F* h_mapDepth1Pedw3_HF;
2001   TH2F* h_mapDepth2Ped0_HF;
2002   TH2F* h_mapDepth2Ped1_HF;
2003   TH2F* h_mapDepth2Ped2_HF;
2004   TH2F* h_mapDepth2Ped3_HF;
2005   TH2F* h_mapDepth2Pedw0_HF;
2006   TH2F* h_mapDepth2Pedw1_HF;
2007   TH2F* h_mapDepth2Pedw2_HF;
2008   TH2F* h_mapDepth2Pedw3_HF;
2009   TH2F* h_mapDepth4Ped0_HO;
2010   TH2F* h_mapDepth4Ped1_HO;
2011   TH2F* h_mapDepth4Ped2_HO;
2012   TH2F* h_mapDepth4Ped3_HO;
2013   TH2F* h_mapDepth4Pedw0_HO;
2014   TH2F* h_mapDepth4Pedw1_HO;
2015   TH2F* h_mapDepth4Pedw2_HO;
2016   TH2F* h_mapDepth4Pedw3_HO;
2017   TH2F* h_mapGetRMSOverNormalizedSignal_HB;
2018   TH2F* h_mapGetRMSOverNormalizedSignal0_HB;
2019   TH2F* h_mapGetRMSOverNormalizedSignal_HE;
2020   TH2F* h_mapGetRMSOverNormalizedSignal0_HE;
2021   TH2F* h_mapGetRMSOverNormalizedSignal_HF;
2022   TH2F* h_mapGetRMSOverNormalizedSignal0_HF;
2023   TH2F* h_mapGetRMSOverNormalizedSignal_HO;
2024   TH2F* h_mapGetRMSOverNormalizedSignal0_HO;
2025   TH2F* h_2D0sumErrorBLS1;
2026   TH2F* h_2DsumErrorBLS1;
2027   TH1F* h_sumErrorBLS1;
2028   TH1F* h_sumErrorBperLS1;
2029   TH1F* h_sum0ErrorBperLS1;
2030   TH2F* h_2D0sumErrorBLS2;
2031   TH2F* h_2DsumErrorBLS2;
2032   TH1F* h_sumErrorBLS2;
2033   TH1F* h_sumErrorBperLS2;
2034   TH1F* h_sum0ErrorBperLS2;
2035   TH2F* h_2D0sumErrorBLS3;
2036   TH2F* h_2DsumErrorBLS3;
2037   TH1F* h_sumErrorBLS3;
2038   TH1F* h_sumErrorBperLS3;
2039   TH1F* h_sum0ErrorBperLS3;
2040   TH2F* h_2D0sumErrorBLS4;
2041   TH2F* h_2DsumErrorBLS4;
2042   TH1F* h_sumErrorBLS4;
2043   TH1F* h_sumErrorBperLS4;
2044   TH1F* h_sum0ErrorBperLS4;
2045   TH2F* h_2D0sumErrorBLS5;
2046   TH2F* h_2DsumErrorBLS5;
2047   TH1F* h_sumErrorBLS5;
2048   TH1F* h_sumErrorBperLS5;
2049   TH1F* h_sum0ErrorBperLS5;
2050   TH2F* h_2D0sumErrorBLS6;
2051   TH2F* h_2DsumErrorBLS6;
2052   TH1F* h_sumErrorBLS6;
2053   TH1F* h_sumErrorBperLS6;
2054   TH1F* h_sum0ErrorBperLS6;
2055   TH2F* h_2D0sumErrorBLS7;
2056   TH2F* h_2DsumErrorBLS7;
2057   TH1F* h_sumErrorBLS7;
2058   TH1F* h_sumErrorBperLS7;
2059   TH1F* h_sum0ErrorBperLS7;
2060   TH2F* h_2D0sumErrorBLS8;
2061   TH2F* h_2DsumErrorBLS8;
2062   TH1F* h_sumErrorBLS8;
2063   TH1F* h_sumErrorBperLS8;
2064   TH1F* h_sum0ErrorBperLS8;
2065   TH1F* h_averSIGNALoccupancy_HB;
2066   TH1F* h_averSIGNALoccupancy_HE;
2067   TH1F* h_averSIGNALoccupancy_HF;
2068   TH1F* h_averSIGNALoccupancy_HO;
2069   TH1F* h_averSIGNALsumamplitude_HB;
2070   TH1F* h_averSIGNALsumamplitude_HE;
2071   TH1F* h_averSIGNALsumamplitude_HF;
2072   TH1F* h_averSIGNALsumamplitude_HO;
2073   TH1F* h_averNOSIGNALoccupancy_HB;
2074   TH1F* h_averNOSIGNALoccupancy_HE;
2075   TH1F* h_averNOSIGNALoccupancy_HF;
2076   TH1F* h_averNOSIGNALoccupancy_HO;
2077   TH1F* h_averNOSIGNALsumamplitude_HB;
2078   TH1F* h_averNOSIGNALsumamplitude_HE;
2079   TH1F* h_averNOSIGNALsumamplitude_HF;
2080   TH1F* h_averNOSIGNALsumamplitude_HO;
2081   TH1F* h_maxxSUMAmpl_HB;
2082   TH1F* h_maxxSUMAmpl_HE;
2083   TH1F* h_maxxSUMAmpl_HF;
2084   TH1F* h_maxxSUMAmpl_HO;
2085   TH1F* h_maxxOCCUP_HB;
2086   TH1F* h_maxxOCCUP_HE;
2087   TH1F* h_maxxOCCUP_HF;
2088   TH1F* h_maxxOCCUP_HO;
2089   TH1F* h_sumamplitudechannel_HB;
2090   TH1F* h_sumamplitudechannel_HE;
2091   TH1F* h_sumamplitudechannel_HF;
2092   TH1F* h_sumamplitudechannel_HO;
2093   TH1F* h_eventamplitude_HB;
2094   TH1F* h_eventamplitude_HE;
2095   TH1F* h_eventamplitude_HF;
2096   TH1F* h_eventamplitude_HO;
2097   TH1F* h_eventoccupancy_HB;
2098   TH1F* h_eventoccupancy_HE;
2099   TH1F* h_eventoccupancy_HF;
2100   TH1F* h_eventoccupancy_HO;
2101   TH2F* h_2DAtaildepth1_HB;
2102   TH2F* h_2D0Ataildepth1_HB;
2103   TH2F* h_2DAtaildepth2_HB;
2104   TH2F* h_2D0Ataildepth2_HB;
2105   TH2F* h_mapenophinorm_HE1;
2106   TH2F* h_mapenophinorm_HE2;
2107   TH2F* h_mapenophinorm_HE3;
2108   TH2F* h_mapenophinorm_HE4;
2109   TH2F* h_mapenophinorm_HE5;
2110   TH2F* h_mapenophinorm_HE6;
2111   TH2F* h_mapenophinorm_HE7;
2112   TH2F* h_mapenophinorm2_HE1;
2113   TH2F* h_mapenophinorm2_HE2;
2114   TH2F* h_mapenophinorm2_HE3;
2115   TH2F* h_mapenophinorm2_HE4;
2116   TH2F* h_mapenophinorm2_HE5;
2117   TH2F* h_mapenophinorm2_HE6;
2118   TH2F* h_mapenophinorm2_HE7;
2119   TH2F* h_maprphinorm_HE1;
2120   TH2F* h_maprphinorm_HE2;
2121   TH2F* h_maprphinorm_HE3;
2122   TH2F* h_maprphinorm_HE4;
2123   TH2F* h_maprphinorm_HE5;
2124   TH2F* h_maprphinorm_HE6;
2125   TH2F* h_maprphinorm_HE7;
2126   TH2F* h_maprphinorm2_HE1;
2127   TH2F* h_maprphinorm2_HE2;
2128   TH2F* h_maprphinorm2_HE3;
2129   TH2F* h_maprphinorm2_HE4;
2130   TH2F* h_maprphinorm2_HE5;
2131   TH2F* h_maprphinorm2_HE6;
2132   TH2F* h_maprphinorm2_HE7;
2133   TH2F* h_maprphinorm0_HE1;
2134   TH2F* h_maprphinorm0_HE2;
2135   TH2F* h_maprphinorm0_HE3;
2136   TH2F* h_maprphinorm0_HE4;
2137   TH2F* h_maprphinorm0_HE5;
2138   TH2F* h_maprphinorm0_HE6;
2139   TH2F* h_maprphinorm0_HE7;
2140   // phy-symmetry, phi-symmetry:
2141   // Reco:
2142   TH1F* h_energyhitSignal_HB;
2143   TH1F* h_energyhitSignal_HE;
2144   TH1F* h_energyhitSignal_HF;
2145   TH1F* h_energyhitNoise_HB;
2146   TH1F* h_energyhitNoise_HE;
2147   TH1F* h_energyhitNoise_HF;
2148   //HB:
2149   TH2F* h_recSignalEnergy0_HB1;
2150   TH2F* h_recSignalEnergy1_HB1;
2151   TH2F* h_recSignalEnergy2_HB1;
2152   TH2F* h_recSignalEnergy0_HB2;
2153   TH2F* h_recSignalEnergy1_HB2;
2154   TH2F* h_recSignalEnergy2_HB2;
2155   TH2F* h_recSignalEnergy0_HB3;
2156   TH2F* h_recSignalEnergy1_HB3;
2157   TH2F* h_recSignalEnergy2_HB3;
2158   TH2F* h_recSignalEnergy0_HB4;
2159   TH2F* h_recSignalEnergy1_HB4;
2160   TH2F* h_recSignalEnergy2_HB4;
2161   TH2F* h_recNoiseEnergy0_HB1;
2162   TH2F* h_recNoiseEnergy1_HB1;
2163   TH2F* h_recNoiseEnergy2_HB1;
2164   TH2F* h_recNoiseEnergy0_HB2;
2165   TH2F* h_recNoiseEnergy1_HB2;
2166   TH2F* h_recNoiseEnergy2_HB2;
2167   TH2F* h_recNoiseEnergy0_HB3;
2168   TH2F* h_recNoiseEnergy1_HB3;
2169   TH2F* h_recNoiseEnergy2_HB3;
2170   TH2F* h_recNoiseEnergy0_HB4;
2171   TH2F* h_recNoiseEnergy1_HB4;
2172   TH2F* h_recNoiseEnergy2_HB4;
2173   //HE:
2174   TH2F* h_recSignalEnergy0_HE1;
2175   TH2F* h_recSignalEnergy1_HE1;
2176   TH2F* h_recSignalEnergy2_HE1;
2177   TH2F* h_recSignalEnergy0_HE2;
2178   TH2F* h_recSignalEnergy1_HE2;
2179   TH2F* h_recSignalEnergy2_HE2;
2180   TH2F* h_recSignalEnergy0_HE3;
2181   TH2F* h_recSignalEnergy1_HE3;
2182   TH2F* h_recSignalEnergy2_HE3;
2183   TH2F* h_recSignalEnergy0_HE4;
2184   TH2F* h_recSignalEnergy1_HE4;
2185   TH2F* h_recSignalEnergy2_HE4;
2186   TH2F* h_recSignalEnergy0_HE5;
2187   TH2F* h_recSignalEnergy1_HE5;
2188   TH2F* h_recSignalEnergy2_HE5;
2189   TH2F* h_recSignalEnergy0_HE6;
2190   TH2F* h_recSignalEnergy1_HE6;
2191   TH2F* h_recSignalEnergy2_HE6;
2192   TH2F* h_recSignalEnergy0_HE7;
2193   TH2F* h_recSignalEnergy1_HE7;
2194   TH2F* h_recSignalEnergy2_HE7;
2195   TH2F* h_recNoiseEnergy0_HE1;
2196   TH2F* h_recNoiseEnergy1_HE1;
2197   TH2F* h_recNoiseEnergy2_HE1;
2198   TH2F* h_recNoiseEnergy0_HE2;
2199   TH2F* h_recNoiseEnergy1_HE2;
2200   TH2F* h_recNoiseEnergy2_HE2;
2201   TH2F* h_recNoiseEnergy0_HE3;
2202   TH2F* h_recNoiseEnergy1_HE3;
2203   TH2F* h_recNoiseEnergy2_HE3;
2204   TH2F* h_recNoiseEnergy0_HE4;
2205   TH2F* h_recNoiseEnergy1_HE4;
2206   TH2F* h_recNoiseEnergy2_HE4;
2207   TH2F* h_recNoiseEnergy0_HE5;
2208   TH2F* h_recNoiseEnergy1_HE5;
2209   TH2F* h_recNoiseEnergy2_HE5;
2210   TH2F* h_recNoiseEnergy0_HE6;
2211   TH2F* h_recNoiseEnergy1_HE6;
2212   TH2F* h_recNoiseEnergy2_HE6;
2213   TH2F* h_recNoiseEnergy0_HE7;
2214   TH2F* h_recNoiseEnergy1_HE7;
2215   TH2F* h_recNoiseEnergy2_HE7;
2216   //HF:
2217   TH2F* h_recSignalEnergy0_HF1;
2218   TH2F* h_recSignalEnergy1_HF1;
2219   TH2F* h_recSignalEnergy2_HF1;
2220   TH2F* h_recSignalEnergy0_HF2;
2221   TH2F* h_recSignalEnergy1_HF2;
2222   TH2F* h_recSignalEnergy2_HF2;
2223   TH2F* h_recSignalEnergy0_HF3;
2224   TH2F* h_recSignalEnergy1_HF3;
2225   TH2F* h_recSignalEnergy2_HF3;
2226   TH2F* h_recSignalEnergy0_HF4;
2227   TH2F* h_recSignalEnergy1_HF4;
2228   TH2F* h_recSignalEnergy2_HF4;
2229 
2230   TH2F* h_recNoiseEnergy0_HF1;
2231   TH2F* h_recNoiseEnergy1_HF1;
2232   TH2F* h_recNoiseEnergy2_HF1;
2233   TH2F* h_recNoiseEnergy0_HF2;
2234   TH2F* h_recNoiseEnergy1_HF2;
2235   TH2F* h_recNoiseEnergy2_HF2;
2236   TH2F* h_recNoiseEnergy0_HF3;
2237   TH2F* h_recNoiseEnergy1_HF3;
2238   TH2F* h_recNoiseEnergy2_HF3;
2239   TH2F* h_recNoiseEnergy0_HF4;
2240   TH2F* h_recNoiseEnergy1_HF4;
2241   TH2F* h_recNoiseEnergy2_HF4;
2242 
2243   TH2F* h_amplitudechannel0_HB1;
2244   TH2F* h_amplitudechannel1_HB1;
2245   TH2F* h_amplitudechannel2_HB1;
2246   TH2F* h_amplitudechannel0_HB2;
2247   TH2F* h_amplitudechannel1_HB2;
2248   TH2F* h_amplitudechannel2_HB2;
2249   TH2F* h_amplitudechannel0_HB3;
2250   TH2F* h_amplitudechannel1_HB3;
2251   TH2F* h_amplitudechannel2_HB3;
2252   TH2F* h_amplitudechannel0_HB4;
2253   TH2F* h_amplitudechannel1_HB4;
2254   TH2F* h_amplitudechannel2_HB4;
2255   TH2F* h_amplitudechannel0_HE1;
2256   TH2F* h_amplitudechannel1_HE1;
2257   TH2F* h_amplitudechannel2_HE1;
2258   TH2F* h_amplitudechannel0_HE2;
2259   TH2F* h_amplitudechannel1_HE2;
2260   TH2F* h_amplitudechannel2_HE2;
2261   TH2F* h_amplitudechannel0_HE3;
2262   TH2F* h_amplitudechannel1_HE3;
2263   TH2F* h_amplitudechannel2_HE3;
2264   TH2F* h_amplitudechannel0_HE4;
2265   TH2F* h_amplitudechannel1_HE4;
2266   TH2F* h_amplitudechannel2_HE4;
2267   TH2F* h_amplitudechannel0_HE5;
2268   TH2F* h_amplitudechannel1_HE5;
2269   TH2F* h_amplitudechannel2_HE5;
2270   TH2F* h_amplitudechannel0_HE6;
2271   TH2F* h_amplitudechannel1_HE6;
2272   TH2F* h_amplitudechannel2_HE6;
2273   TH2F* h_amplitudechannel0_HE7;
2274   TH2F* h_amplitudechannel1_HE7;
2275   TH2F* h_amplitudechannel2_HE7;
2276   TH2F* h_amplitudechannel0_HF1;
2277   TH2F* h_amplitudechannel1_HF1;
2278   TH2F* h_amplitudechannel2_HF1;
2279   TH2F* h_amplitudechannel0_HF2;
2280   TH2F* h_amplitudechannel1_HF2;
2281   TH2F* h_amplitudechannel2_HF2;
2282   TH2F* h_amplitudechannel0_HF3;
2283   TH2F* h_amplitudechannel1_HF3;
2284   TH2F* h_amplitudechannel2_HF3;
2285   TH2F* h_amplitudechannel0_HF4;
2286   TH2F* h_amplitudechannel1_HF4;
2287   TH2F* h_amplitudechannel2_HF4;
2288 
2289   TH2F* h_mapDepth1RADDAM_HE;
2290   TH2F* h_mapDepth2RADDAM_HE;
2291   TH2F* h_mapDepth3RADDAM_HE;
2292   TH1F* h_sigLayer1RADDAM_HE;
2293   TH1F* h_sigLayer2RADDAM_HE;
2294   TH1F* h_sigLayer1RADDAM0_HE;
2295   TH1F* h_sigLayer2RADDAM0_HE;
2296   TH1F* h_mapDepth3RADDAM16_HE;
2297   TH2F* h_mapDepth1RADDAM0_HE;
2298   TH2F* h_mapDepth2RADDAM0_HE;
2299   TH2F* h_mapDepth3RADDAM0_HE;
2300   TH1F* h_AamplitudewithPedSubtr_RADDAM_HE;
2301   TH1F* h_AamplitudewithPedSubtr_RADDAM_HEzoom0;
2302   TH1F* h_AamplitudewithPedSubtr_RADDAM_HEzoom1;
2303   TH1F* h_A_Depth1RADDAM_HE;
2304   TH1F* h_A_Depth2RADDAM_HE;
2305   TH1F* h_A_Depth3RADDAM_HE;
2306   TH1F* h_sumphiEta16Depth3RADDAM_HED2;
2307   TH1F* h_Eta16Depth3RADDAM_HED2;
2308   TH1F* h_NphiForEta16Depth3RADDAM_HED2;
2309   TH1F* h_sumphiEta16Depth3RADDAM_HED2P;
2310   TH1F* h_Eta16Depth3RADDAM_HED2P;
2311   TH1F* h_NphiForEta16Depth3RADDAM_HED2P;
2312   TH1F* h_sumphiEta16Depth3RADDAM_HED2ALL;
2313   TH1F* h_Eta16Depth3RADDAM_HED2ALL;
2314   TH1F* h_NphiForEta16Depth3RADDAM_HED2ALL;
2315   TH1F* h_sigLayer1RADDAM5_HE;
2316   TH1F* h_sigLayer2RADDAM5_HE;
2317   TH1F* h_sigLayer1RADDAM6_HE;
2318   TH1F* h_sigLayer2RADDAM6_HE;
2319   TH1F* h_sigLayer1RADDAM5_HED2;
2320   TH1F* h_sigLayer1RADDAM6_HED2;
2321   TH1F* h_sigLayer2RADDAM5_HED2;
2322   TH1F* h_sigLayer2RADDAM6_HED2;
2323   TH2F* h2_TSnVsAyear2023_HB;
2324   TH2F* h2_TSnVsAyear2023_HE;
2325   TH2F* h2_TSnVsAyear2023_HF;
2326   TH2F* h2_TSnVsAyear2023_HO;
2327   TH1F* h1_TSnVsAyear2023_HB;
2328   TH1F* h1_TSnVsAyear2023_HE;
2329   TH1F* h1_TSnVsAyear2023_HF;
2330   TH1F* h1_TSnVsAyear2023_HO;
2331   TH1F* h1_TSnVsAyear20230_HB;
2332   TH1F* h1_TSnVsAyear20230_HE;
2333   TH1F* h1_TSnVsAyear20230_HF;
2334   TH1F* h1_TSnVsAyear20230_HO;
2335 
2336   int calibcapiderror[ndepth][neta][nphi];
2337   float calibt[ndepth][neta][nphi];
2338   double caliba[ndepth][neta][nphi];
2339   double calibw[ndepth][neta][nphi];
2340   double calib0[ndepth][neta][nphi];
2341   double signal[ndepth][neta][nphi];
2342   double calib3[ndepth][neta][nphi];
2343   double signal3[ndepth][neta][nphi];
2344   double calib2[ndepth][neta][nphi];
2345   int badchannels[nsub][ndepth][neta][nphi];
2346   double sumEstimator0[nsub][ndepth][neta][nphi];
2347   double sumEstimator1[nsub][ndepth][neta][nphi];
2348   double sumEstimator2[nsub][ndepth][neta][nphi];
2349   double sumEstimator3[nsub][ndepth][neta][nphi];
2350   double sumEstimator4[nsub][ndepth][neta][nphi];
2351   double sumEstimator5[nsub][ndepth][neta][nphi];
2352   double sumEstimator6[nsub][ndepth][neta][nphi];
2353   double sum0Estimator[nsub][ndepth][neta][nphi];
2354 
2355   // phi-symmetry monitoring for calibration group:
2356   double amplitudechannel0[nsub][ndepth][neta][nphi];
2357   double amplitudechannel[nsub][ndepth][neta][nphi];
2358   double amplitudechannel2[nsub][ndepth][neta][nphi];
2359   double tocamplchannel[nsub][ndepth][neta][nphi];
2360   double maprphinorm[nsub][ndepth][neta][nphi];
2361 
2362   double recNoiseEnergy0[nsub][ndepth][neta][nphi];
2363   double recNoiseEnergy1[nsub][ndepth][neta][nphi];
2364   double recNoiseEnergy2[nsub][ndepth][neta][nphi];
2365 
2366   double recSignalEnergy0[nsub][ndepth][neta][nphi];
2367   double recSignalEnergy1[nsub][ndepth][neta][nphi];
2368   double recSignalEnergy2[nsub][ndepth][neta][nphi];
2369 
2370   float TS_data[100];
2371   float TS_cal[100];
2372   double mapRADDAM_HE[ndepth][neta][nphi];
2373   int mapRADDAM0_HE[ndepth][neta][nphi];
2374   double mapRADDAM_HED2[ndepth][neta];
2375   int mapRADDAM_HED20[ndepth][neta];
2376   float binanpfit = anpfit / npfit;
2377   long int gsmdepth1sipm[npfit][neta][nphi][ndepth];
2378   /////////////////////////////////////////////
2379   long int Nevent;
2380   int Run;
2381   int run0;
2382   int runcounter;
2383   int eventcounter;
2384   long int orbitNum;
2385   int bcn;
2386   int lumi;
2387   int ls0;
2388   int lscounter;
2389   int lscounterM1;
2390   int lscounter10;
2391   int nevcounter;
2392   int lscounterrun;
2393   int lscounterrun10;
2394   int nevcounter0;
2395   int nevcounter00;
2396   double averSIGNALoccupancy_HB;
2397   double averSIGNALoccupancy_HE;
2398   double averSIGNALoccupancy_HF;
2399   double averSIGNALoccupancy_HO;
2400   double averSIGNALsumamplitude_HB;
2401   double averSIGNALsumamplitude_HE;
2402   double averSIGNALsumamplitude_HF;
2403   double averSIGNALsumamplitude_HO;
2404   double averNOSIGNALoccupancy_HB;
2405   double averNOSIGNALoccupancy_HE;
2406   double averNOSIGNALoccupancy_HF;
2407   double averNOSIGNALoccupancy_HO;
2408   double averNOSIGNALsumamplitude_HB;
2409   double averNOSIGNALsumamplitude_HE;
2410   double averNOSIGNALsumamplitude_HF;
2411   double averNOSIGNALsumamplitude_HO;
2412   double maxxSUM1;
2413   double maxxSUM2;
2414   double maxxSUM3;
2415   double maxxSUM4;
2416   double maxxOCCUP1;
2417   double maxxOCCUP2;
2418   double maxxOCCUP3;
2419   double maxxOCCUP4;
2420   TTree* myTree;
2421   TFile* hOutputFile;
2422   std::ofstream MAPfile;
2423   /////////////////////////////////////////
2424   // Get RBX number from 1-35 for Calibration box
2425   int getRBX(int& i, int& j, int& k);
2426   void fillDigiErrors(HBHEDigiCollection::const_iterator& digiItr);
2427   void fillDigiErrorsHF(HFDigiCollection::const_iterator& digiItr);
2428   void fillDigiErrorsHO(HODigiCollection::const_iterator& digiItr);
2429   // upgrade:
2430   void fillDigiErrorsHFQIE10(QIE10DataFrame qie10df);
2431   void fillDigiErrorsQIE11(QIE11DataFrame qie11df);
2432   void fillDigiAmplitude(HBHEDigiCollection::const_iterator& digiItr);
2433   void fillDigiAmplitudeHF(HFDigiCollection::const_iterator& digiItr);
2434   void fillDigiAmplitudeHO(HODigiCollection::const_iterator& digiItr);
2435   // upgrade:
2436   void fillDigiAmplitudeHFQIE10(QIE10DataFrame qie10df);
2437   void fillDigiAmplitudeQIE11(QIE11DataFrame qie11df);
2438   int local_event;
2439   int eta, phi, depth, nTS, cap_num;
2440   int numOfTS;
2441   int numOfLaserEv;
2442   int testmetka;
2443   float alsmin;
2444   float blsmax;
2445   int nlsminmax;
2446 };
2447 
2448 //
2449 /////////////////////////////// -------------------------------------------------------------------
2450 //
2451 void CMTRawAnalyzer::endJob() {
2452   if (verbosity > 0)
2453     std::cout << "==============    endJob  ===================================" << std::endl;
2454 
2455   std::cout << " --------------------------------------- " << std::endl;
2456   std::cout << " for Run = " << run0 << " with runcounter = " << runcounter << " #ev = " << eventcounter << std::endl;
2457   std::cout << " #LS =  " << lscounterrun << " #LS10 =  " << lscounterrun10 << " Last LS =  " << ls0 << std::endl;
2458   std::cout << " --------------------------------------------- " << std::endl;
2459   h_nls_per_run->Fill(float(lscounterrun));
2460   h_nls_per_run10->Fill(float(lscounterrun10));
2461 
2462   ///////////////////////////////////////////////////////////////////////////////////////////////
2463   std::cout << "===== full number of events =  " << nevent << std::endl;
2464   std::cout << "===== possible max number of events in ntuple(each 50th recorded) =  " << nevent50 << std::endl;
2465   std::cout << "===== but limited by maxNeventsInNtuple  =  " << maxNeventsInNtuple_ << std::endl;
2466   std::cout << "===== full number of events*HBHEdigis and qie11 =  " << nnnnnnhbhe << "   and  " << nnnnnnhbheqie11
2467             << std::endl;
2468   std::cout << "===== full number of events*HBHEdigis =  " << nnnnnn << std::endl;
2469   std::cout << "===== full number of events*HFdigis and qie10 =  " << counterhf << "   and  " << counterhfqie10
2470             << std::endl;
2471   std::cout << "===== full number of events*HOdigis =  " << counterho << std::endl;
2472 
2473   std::cout << "===== Start writing user histograms =====" << std::endl;
2474   //////////////////////////////////////////////////////////////////////   scaling of some histoes:
2475   ///////////////////////////////////////////->Write();
2476 }
2477 //
2478 
2479 //
2480 //
2481 CMTRawAnalyzer::CMTRawAnalyzer(const edm::ParameterSet& iConfig)
2482     : tokDB_(esConsumes<HcalDbService, HcalDbRecord>()), tokTopo_(esConsumes<HcalTopology, HcalRecNumberingRecord>()) {
2483   usesResource(TFileService::kSharedResource);
2484   verbosity = iConfig.getUntrackedParameter<int>("Verbosity");
2485   MAPcreation = iConfig.getUntrackedParameter<int>("MapCreation");
2486   recordNtuples_ = iConfig.getUntrackedParameter<bool>("recordNtuples");
2487   maxNeventsInNtuple_ = iConfig.getParameter<int>("maxNeventsInNtuple");
2488   tok_calib_ = consumes<HcalCalibDigiCollection>(iConfig.getParameter<edm::InputTag>("hcalCalibDigiCollectionTag"));  //
2489   tok_hbhe_ = consumes<HBHEDigiCollection>(iConfig.getParameter<edm::InputTag>("hbheDigiCollectionTag"));
2490   tok_ho_ = consumes<HODigiCollection>(iConfig.getParameter<edm::InputTag>("hoDigiCollectionTag"));
2491   tok_hf_ = consumes<HFDigiCollection>(iConfig.getParameter<edm::InputTag>("hfDigiCollectionTag"));  //
2492   tok_qie11_ = consumes<QIE11DigiCollection>(iConfig.getParameter<edm::InputTag>("hbheQIE11DigiCollectionTag"));
2493   tok_qie10_ = consumes<QIE10DigiCollection>(iConfig.getParameter<edm::InputTag>("hbheQIE10DigiCollectionTag"));
2494   // phi-symmetry monitoring for calibration group:
2495   tok_hbheSignal_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputSignalTag"));
2496   tok_hbheNoise_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputNoiseTag"));
2497   tok_hfSignal_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputSignalTag"));
2498   tok_hfNoise_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputNoiseTag"));
2499   recordHistoes_ = iConfig.getUntrackedParameter<bool>("recordHistoes");
2500   studyRunDependenceHist_ = iConfig.getUntrackedParameter<bool>("studyRunDependenceHist");
2501   studyCapIDErrorsHist_ = iConfig.getUntrackedParameter<bool>("studyCapIDErrorsHist");
2502   studyRMSshapeHist_ = iConfig.getUntrackedParameter<bool>("studyRMSshapeHist");
2503   studyRatioShapeHist_ = iConfig.getUntrackedParameter<bool>("studyRatioShapeHist");
2504   studyTSmaxShapeHist_ = iConfig.getUntrackedParameter<bool>("studyTSmaxShapeHist");
2505   studyTSmeanShapeHist_ = iConfig.getUntrackedParameter<bool>("studyTSmeanShapeHist");
2506   studyDiffAmplHist_ = iConfig.getUntrackedParameter<bool>("studyDiffAmplHist");
2507   studyCalibCellsHist_ = iConfig.getUntrackedParameter<bool>("studyCalibCellsHist");
2508   studyADCAmplHist_ = iConfig.getUntrackedParameter<bool>("studyADCAmplHist");
2509   studyPedestalsHist_ = iConfig.getUntrackedParameter<bool>("studyPedestalsHist");
2510   studyPedestalCorrelations_ = iConfig.getUntrackedParameter<bool>("studyPedestalCorrelations");
2511   useADCmassive_ = iConfig.getUntrackedParameter<bool>("useADCmassive");
2512   useADCfC_ = iConfig.getUntrackedParameter<bool>("useADCfC");
2513   useADCcounts_ = iConfig.getUntrackedParameter<bool>("useADCcounts");
2514   usePedestalSubtraction_ = iConfig.getUntrackedParameter<bool>("usePedestalSubtraction");
2515   usecontinuousnumbering_ = iConfig.getUntrackedParameter<bool>("usecontinuousnumbering");
2516   flagLaserRaddam_ = iConfig.getParameter<int>("flagLaserRaddam");
2517   flagToUseDigiCollectionsORNot_ = iConfig.getParameter<int>("flagToUseDigiCollectionsORNot");
2518   flagIterativeMethodCalibrationGroupDigi_ = iConfig.getParameter<int>("flagIterativeMethodCalibrationGroupDigi");
2519   flagIterativeMethodCalibrationGroupReco_ = iConfig.getParameter<int>("flagIterativeMethodCalibrationGroupReco");
2520   flagfitshunt1pedorledlowintensity_ = iConfig.getParameter<int>("flagfitshunt1pedorledlowintensity");
2521   flagabortgaprejected_ = iConfig.getParameter<int>("flagabortgaprejected");
2522   bcnrejectedlow_ = iConfig.getParameter<int>("bcnrejectedlow");
2523   bcnrejectedhigh_ = iConfig.getParameter<int>("bcnrejectedhigh");
2524   ratioHBMin_ = iConfig.getParameter<double>("ratioHBMin");
2525   ratioHBMax_ = iConfig.getParameter<double>("ratioHBMax");
2526   ratioHEMin_ = iConfig.getParameter<double>("ratioHEMin");
2527   ratioHEMax_ = iConfig.getParameter<double>("ratioHEMax");
2528   ratioHFMin_ = iConfig.getParameter<double>("ratioHFMin");
2529   ratioHFMax_ = iConfig.getParameter<double>("ratioHFMax");
2530   ratioHOMin_ = iConfig.getParameter<double>("ratioHOMin");
2531   ratioHOMax_ = iConfig.getParameter<double>("ratioHOMax");
2532   flagtodefinebadchannel_ = iConfig.getParameter<int>("flagtodefinebadchannel");
2533   howmanybinsonplots_ = iConfig.getParameter<int>("howmanybinsonplots");
2534   splashesUpperLimit_ = iConfig.getParameter<int>("splashesUpperLimit");
2535   flagtoaskrunsorls_ = iConfig.getParameter<int>("flagtoaskrunsorls");
2536   flagestimatornormalization_ = iConfig.getParameter<int>("flagestimatornormalization");
2537   flagcpuoptimization_ = iConfig.getParameter<int>("flagcpuoptimization");
2538   flagupgradeqie1011_ = iConfig.getParameter<int>("flagupgradeqie1011");
2539   flagsipmcorrection_ = iConfig.getParameter<int>("flagsipmcorrection");
2540   flaguseshunt_ = iConfig.getParameter<int>("flaguseshunt");
2541   lsdep_cut1_peak_HBdepth1_ = iConfig.getParameter<int>("lsdep_cut1_peak_HBdepth1");
2542   lsdep_cut1_peak_HBdepth2_ = iConfig.getParameter<int>("lsdep_cut1_peak_HBdepth2");
2543   lsdep_cut1_peak_HEdepth1_ = iConfig.getParameter<int>("lsdep_cut1_peak_HEdepth1");
2544   lsdep_cut1_peak_HEdepth2_ = iConfig.getParameter<int>("lsdep_cut1_peak_HEdepth2");
2545   lsdep_cut1_peak_HEdepth3_ = iConfig.getParameter<int>("lsdep_cut1_peak_HEdepth3");
2546   lsdep_cut1_peak_HFdepth1_ = iConfig.getParameter<int>("lsdep_cut1_peak_HFdepth1");
2547   lsdep_cut1_peak_HFdepth2_ = iConfig.getParameter<int>("lsdep_cut1_peak_HFdepth2");
2548   lsdep_cut1_peak_HOdepth4_ = iConfig.getParameter<int>("lsdep_cut1_peak_HOdepth4");
2549   lsdep_cut3_max_HBdepth1_ = iConfig.getParameter<int>("lsdep_cut3_max_HBdepth1");
2550   lsdep_cut3_max_HBdepth2_ = iConfig.getParameter<int>("lsdep_cut3_max_HBdepth2");
2551   lsdep_cut3_max_HEdepth1_ = iConfig.getParameter<int>("lsdep_cut3_max_HEdepth1");
2552   lsdep_cut3_max_HEdepth2_ = iConfig.getParameter<int>("lsdep_cut3_max_HEdepth2");
2553   lsdep_cut3_max_HEdepth3_ = iConfig.getParameter<int>("lsdep_cut3_max_HEdepth3");
2554   lsdep_cut3_max_HFdepth1_ = iConfig.getParameter<int>("lsdep_cut3_max_HFdepth1");
2555   lsdep_cut3_max_HFdepth2_ = iConfig.getParameter<int>("lsdep_cut3_max_HFdepth2");
2556   lsdep_cut3_max_HOdepth4_ = iConfig.getParameter<int>("lsdep_cut3_max_HOdepth4");
2557   lsdep_estimator1_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator1_HBdepth1");
2558   lsdep_estimator1_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator1_HBdepth2");
2559   lsdep_estimator1_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth1");
2560   lsdep_estimator1_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth2");
2561   lsdep_estimator1_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth3");
2562   lsdep_estimator1_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator1_HFdepth1");
2563   lsdep_estimator1_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator1_HFdepth2");
2564   lsdep_estimator1_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator1_HOdepth4");
2565   lsdep_estimator1_HEdepth4_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth4");
2566   lsdep_estimator1_HEdepth5_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth5");
2567   lsdep_estimator1_HEdepth6_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth6");
2568   lsdep_estimator1_HEdepth7_ = iConfig.getParameter<double>("lsdep_estimator1_HEdepth7");
2569   lsdep_estimator1_HFdepth3_ = iConfig.getParameter<double>("lsdep_estimator1_HFdepth3");
2570   lsdep_estimator1_HFdepth4_ = iConfig.getParameter<double>("lsdep_estimator1_HFdepth4");
2571   lsdep_estimator1_HBdepth3_ = iConfig.getParameter<double>("lsdep_estimator1_HBdepth3");
2572   lsdep_estimator1_HBdepth4_ = iConfig.getParameter<double>("lsdep_estimator1_HBdepth4");
2573   lsdep_estimator2_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator2_HBdepth1");
2574   lsdep_estimator2_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator2_HBdepth2");
2575   lsdep_estimator2_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator2_HEdepth1");
2576   lsdep_estimator2_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator2_HEdepth2");
2577   lsdep_estimator2_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator2_HEdepth3");
2578   lsdep_estimator2_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator2_HFdepth1");
2579   lsdep_estimator2_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator2_HFdepth2");
2580   lsdep_estimator2_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator2_HOdepth4");
2581   lsdep_estimator3_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator3_HBdepth1");
2582   lsdep_estimator3_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator3_HBdepth2");
2583   lsdep_estimator3_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator3_HEdepth1");
2584   lsdep_estimator3_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator3_HEdepth2");
2585   lsdep_estimator3_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator3_HEdepth3");
2586   lsdep_estimator3_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator3_HFdepth1");
2587   lsdep_estimator3_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator3_HFdepth2");
2588   lsdep_estimator3_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator3_HOdepth4");
2589   lsdep_estimator4_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator4_HBdepth1");
2590   lsdep_estimator4_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator4_HBdepth2");
2591   lsdep_estimator4_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator4_HEdepth1");
2592   lsdep_estimator4_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator4_HEdepth2");
2593   lsdep_estimator4_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator4_HEdepth3");
2594   lsdep_estimator4_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator4_HFdepth1");
2595   lsdep_estimator4_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator4_HFdepth2");
2596   lsdep_estimator4_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator4_HOdepth4");
2597   lsdep_estimator5_HBdepth1_ = iConfig.getParameter<double>("lsdep_estimator5_HBdepth1");
2598   lsdep_estimator5_HBdepth2_ = iConfig.getParameter<double>("lsdep_estimator5_HBdepth2");
2599   lsdep_estimator5_HEdepth1_ = iConfig.getParameter<double>("lsdep_estimator5_HEdepth1");
2600   lsdep_estimator5_HEdepth2_ = iConfig.getParameter<double>("lsdep_estimator5_HEdepth2");
2601   lsdep_estimator5_HEdepth3_ = iConfig.getParameter<double>("lsdep_estimator5_HEdepth3");
2602   lsdep_estimator5_HFdepth1_ = iConfig.getParameter<double>("lsdep_estimator5_HFdepth1");
2603   lsdep_estimator5_HFdepth2_ = iConfig.getParameter<double>("lsdep_estimator5_HFdepth2");
2604   lsdep_estimator5_HOdepth4_ = iConfig.getParameter<double>("lsdep_estimator5_HOdepth4");
2605   forallestimators_amplitude_bigger_ = iConfig.getParameter<double>("forallestimators_amplitude_bigger");
2606   rmsHBMin_ = iConfig.getParameter<double>("rmsHBMin");
2607   rmsHBMax_ = iConfig.getParameter<double>("rmsHBMax");
2608   rmsHEMin_ = iConfig.getParameter<double>("rmsHEMin");
2609   rmsHEMax_ = iConfig.getParameter<double>("rmsHEMax");
2610   rmsHFMin_ = iConfig.getParameter<double>("rmsHFMin");
2611   rmsHFMax_ = iConfig.getParameter<double>("rmsHFMax");
2612   rmsHOMin_ = iConfig.getParameter<double>("rmsHOMin");
2613   rmsHOMax_ = iConfig.getParameter<double>("rmsHOMax");
2614   ADCAmplHBMin_ = iConfig.getParameter<double>("ADCAmplHBMin");
2615   ADCAmplHEMin_ = iConfig.getParameter<double>("ADCAmplHEMin");
2616   ADCAmplHOMin_ = iConfig.getParameter<double>("ADCAmplHOMin");
2617   ADCAmplHFMin_ = iConfig.getParameter<double>("ADCAmplHFMin");
2618   ADCAmplHBMax_ = iConfig.getParameter<double>("ADCAmplHBMax");
2619   ADCAmplHEMax_ = iConfig.getParameter<double>("ADCAmplHEMax");
2620   ADCAmplHOMax_ = iConfig.getParameter<double>("ADCAmplHOMax");
2621   ADCAmplHFMax_ = iConfig.getParameter<double>("ADCAmplHFMax");
2622   pedestalwHBMax_ = iConfig.getParameter<double>("pedestalwHBMax");
2623   pedestalwHEMax_ = iConfig.getParameter<double>("pedestalwHEMax");
2624   pedestalwHFMax_ = iConfig.getParameter<double>("pedestalwHFMax");
2625   pedestalwHOMax_ = iConfig.getParameter<double>("pedestalwHOMax");
2626   pedestalHBMax_ = iConfig.getParameter<double>("pedestalHBMax");
2627   pedestalHEMax_ = iConfig.getParameter<double>("pedestalHEMax");
2628   pedestalHFMax_ = iConfig.getParameter<double>("pedestalHFMax");
2629   pedestalHOMax_ = iConfig.getParameter<double>("pedestalHOMax");
2630   calibrADCHBMin_ = iConfig.getParameter<double>("calibrADCHBMin");
2631   calibrADCHEMin_ = iConfig.getParameter<double>("calibrADCHEMin");
2632   calibrADCHOMin_ = iConfig.getParameter<double>("calibrADCHOMin");
2633   calibrADCHFMin_ = iConfig.getParameter<double>("calibrADCHFMin");
2634   calibrADCHBMax_ = iConfig.getParameter<double>("calibrADCHBMax");
2635   calibrADCHEMax_ = iConfig.getParameter<double>("calibrADCHEMax");
2636   calibrADCHOMax_ = iConfig.getParameter<double>("calibrADCHOMax");
2637   calibrADCHFMax_ = iConfig.getParameter<double>("calibrADCHFMax");
2638   calibrRatioHBMin_ = iConfig.getParameter<double>("calibrRatioHBMin");
2639   calibrRatioHEMin_ = iConfig.getParameter<double>("calibrRatioHEMin");
2640   calibrRatioHOMin_ = iConfig.getParameter<double>("calibrRatioHOMin");
2641   calibrRatioHFMin_ = iConfig.getParameter<double>("calibrRatioHFMin");
2642   calibrRatioHBMax_ = iConfig.getParameter<double>("calibrRatioHBMax");
2643   calibrRatioHEMax_ = iConfig.getParameter<double>("calibrRatioHEMax");
2644   calibrRatioHOMax_ = iConfig.getParameter<double>("calibrRatioHOMax");
2645   calibrRatioHFMax_ = iConfig.getParameter<double>("calibrRatioHFMax");
2646   calibrTSmaxHBMin_ = iConfig.getParameter<double>("calibrTSmaxHBMin");
2647   calibrTSmaxHEMin_ = iConfig.getParameter<double>("calibrTSmaxHEMin");
2648   calibrTSmaxHOMin_ = iConfig.getParameter<double>("calibrTSmaxHOMin");
2649   calibrTSmaxHFMin_ = iConfig.getParameter<double>("calibrTSmaxHFMin");
2650   calibrTSmaxHBMax_ = iConfig.getParameter<double>("calibrTSmaxHBMax");
2651   calibrTSmaxHEMax_ = iConfig.getParameter<double>("calibrTSmaxHEMax");
2652   calibrTSmaxHOMax_ = iConfig.getParameter<double>("calibrTSmaxHOMax");
2653   calibrTSmaxHFMax_ = iConfig.getParameter<double>("calibrTSmaxHFMax");
2654   calibrTSmeanHBMin_ = iConfig.getParameter<double>("calibrTSmeanHBMin");
2655   calibrTSmeanHEMin_ = iConfig.getParameter<double>("calibrTSmeanHEMin");
2656   calibrTSmeanHOMin_ = iConfig.getParameter<double>("calibrTSmeanHOMin");
2657   calibrTSmeanHFMin_ = iConfig.getParameter<double>("calibrTSmeanHFMin");
2658   calibrTSmeanHBMax_ = iConfig.getParameter<double>("calibrTSmeanHBMax");
2659   calibrTSmeanHEMax_ = iConfig.getParameter<double>("calibrTSmeanHEMax");
2660   calibrTSmeanHOMax_ = iConfig.getParameter<double>("calibrTSmeanHOMax");
2661   calibrTSmeanHFMax_ = iConfig.getParameter<double>("calibrTSmeanHFMax");
2662   calibrWidthHBMin_ = iConfig.getParameter<double>("calibrWidthHBMin");
2663   calibrWidthHEMin_ = iConfig.getParameter<double>("calibrWidthHEMin");
2664   calibrWidthHOMin_ = iConfig.getParameter<double>("calibrWidthHOMin");
2665   calibrWidthHFMin_ = iConfig.getParameter<double>("calibrWidthHFMin");
2666   calibrWidthHBMax_ = iConfig.getParameter<double>("calibrWidthHBMax");
2667   calibrWidthHEMax_ = iConfig.getParameter<double>("calibrWidthHEMax");
2668   calibrWidthHOMax_ = iConfig.getParameter<double>("calibrWidthHOMax");
2669   calibrWidthHFMax_ = iConfig.getParameter<double>("calibrWidthHFMax");
2670   TSpeakHBMin_ = iConfig.getParameter<double>("TSpeakHBMin");
2671   TSpeakHBMax_ = iConfig.getParameter<double>("TSpeakHBMax");
2672   TSpeakHEMin_ = iConfig.getParameter<double>("TSpeakHEMin");
2673   TSpeakHEMax_ = iConfig.getParameter<double>("TSpeakHEMax");
2674   TSpeakHFMin_ = iConfig.getParameter<double>("TSpeakHFMin");
2675   TSpeakHFMax_ = iConfig.getParameter<double>("TSpeakHFMax");
2676   TSpeakHOMin_ = iConfig.getParameter<double>("TSpeakHOMin");
2677   TSpeakHOMax_ = iConfig.getParameter<double>("TSpeakHOMax");
2678   TSmeanHBMin_ = iConfig.getParameter<double>("TSmeanHBMin");
2679   TSmeanHBMax_ = iConfig.getParameter<double>("TSmeanHBMax");
2680   TSmeanHEMin_ = iConfig.getParameter<double>("TSmeanHEMin");
2681   TSmeanHEMax_ = iConfig.getParameter<double>("TSmeanHEMax");
2682   TSmeanHFMin_ = iConfig.getParameter<double>("TSmeanHFMin");
2683   TSmeanHFMax_ = iConfig.getParameter<double>("TSmeanHFMax");
2684   TSmeanHOMin_ = iConfig.getParameter<double>("TSmeanHOMin");
2685   TSmeanHOMax_ = iConfig.getParameter<double>("TSmeanHOMax");
2686   lsmin_ = iConfig.getParameter<int>("lsmin");
2687   lsmax_ = iConfig.getParameter<int>("lsmax");
2688   alsmin = lsmin_;
2689   blsmax = lsmax_;
2690   nlsminmax = lsmax_ - lsmin_ + 1;
2691   numOfLaserEv = 0;
2692   local_event = 0;
2693   numOfTS = 10;
2694   run0 = -1;
2695   runcounter = 0;
2696   eventcounter = 0;
2697   lumi = 0;
2698   ls0 = -1;
2699   lscounter = 0;
2700   lscounterM1 = 0;
2701   lscounter10 = 0;
2702   nevcounter = 0;
2703   lscounterrun = 0;
2704   lscounterrun10 = 0;
2705   nevcounter0 = 0;
2706   nevcounter00 = 0;
2707   for (int k0 = 0; k0 < nsub; k0++) {
2708     for (int k1 = 0; k1 < ndepth; k1++) {
2709       for (int k2 = 0; k2 < neta; k2++) {
2710         if (k0 == 1) {
2711           mapRADDAM_HED2[k1][k2] = 0.;
2712           mapRADDAM_HED20[k1][k2] = 0.;
2713         }
2714         for (int k3 = 0; k3 < nphi; k3++) {
2715           sumEstimator0[k0][k1][k2][k3] = 0.;
2716           sumEstimator1[k0][k1][k2][k3] = 0.;
2717           sumEstimator2[k0][k1][k2][k3] = 0.;
2718           sumEstimator3[k0][k1][k2][k3] = 0.;
2719           sumEstimator4[k0][k1][k2][k3] = 0.;
2720           sumEstimator5[k0][k1][k2][k3] = 0.;
2721           sumEstimator6[k0][k1][k2][k3] = 0.;
2722           sum0Estimator[k0][k1][k2][k3] = 0.;
2723           if (k0 == 1) {
2724             mapRADDAM_HE[k1][k2][k3] = 0.;
2725             mapRADDAM0_HE[k1][k2][k3] = 0;
2726           }
2727         }
2728       }
2729     }
2730   }
2731   averSIGNALoccupancy_HB = 0.;
2732   averSIGNALoccupancy_HE = 0.;
2733   averSIGNALoccupancy_HF = 0.;
2734   averSIGNALoccupancy_HO = 0.;
2735   averSIGNALsumamplitude_HB = 0.;
2736   averSIGNALsumamplitude_HE = 0.;
2737   averSIGNALsumamplitude_HF = 0.;
2738   averSIGNALsumamplitude_HO = 0.;
2739   averNOSIGNALoccupancy_HB = 0.;
2740   averNOSIGNALoccupancy_HE = 0.;
2741   averNOSIGNALoccupancy_HF = 0.;
2742   averNOSIGNALoccupancy_HO = 0.;
2743   averNOSIGNALsumamplitude_HB = 0.;
2744   averNOSIGNALsumamplitude_HE = 0.;
2745   averNOSIGNALsumamplitude_HF = 0.;
2746   averNOSIGNALsumamplitude_HO = 0.;
2747   maxxSUM1 = 0.;
2748   maxxSUM2 = 0.;
2749   maxxSUM3 = 0.;
2750   maxxSUM4 = 0.;
2751   maxxOCCUP1 = 0.;
2752   maxxOCCUP2 = 0.;
2753   maxxOCCUP3 = 0.;
2754   maxxOCCUP4 = 0.;
2755   testmetka = 0;
2756 }
2757 CMTRawAnalyzer::~CMTRawAnalyzer() {}
2758 void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
2759   conditions = &iSetup.getData(tokDB_);
2760   topo = &iSetup.getData(tokTopo_);
2761   if (MAPcreation > 0) {
2762     if (flagupgradeqie1011_ == 1)
2763       fillMAP();
2764     MAPcreation = 0;
2765   }
2766   nevent++;
2767   nevent50 = nevent / 50;
2768   Run = iEvent.id().run();
2769   Nevent = iEvent.id().event();     // event number = global_event
2770   lumi = iEvent.luminosityBlock();  // lumi section
2771   bcn = iEvent.bunchCrossing();
2772   orbitNum = iEvent.orbitNumber();
2773   int outabortgap = 1;
2774   if (bcn >= bcnrejectedlow_ && bcn <= bcnrejectedhigh_)
2775     outabortgap = 0;  //  if(bcn>=3446 && bcn<=3564)
2776 
2777   if ((flagabortgaprejected_ == 1 && outabortgap == 1) || (flagabortgaprejected_ == 0 && outabortgap == 0) ||
2778       flagabortgaprejected_ == 2) {
2779     if (run0 != Run) {
2780       ++runcounter;
2781       if (runcounter != 1) {
2782         nevcounter00 = eventcounter;
2783         std::cout << " --------------------------------------- " << std::endl;
2784         std::cout << " for Run = " << run0 << " with runcounter = " << runcounter - 1 << " #ev = " << eventcounter
2785                   << std::endl;
2786         std::cout << " #LS =  " << lscounterrun << " #LS10 =  " << lscounterrun10 << " Last LS =  " << ls0 << std::endl;
2787         std::cout << " --------------------------------------------- " << std::endl;
2788         h_nls_per_run->Fill(float(lscounterrun));
2789         h_nls_per_run10->Fill(float(lscounterrun10));
2790         lscounterrun = 0;
2791         lscounterrun10 = 0;
2792       }  // runcounter > 1
2793       std::cout << " ---------***********************------------- " << std::endl;
2794       std::cout << " New Run =  " << Run << " runcounter =  " << runcounter << std::endl;
2795       std::cout << " ------- " << std::endl;
2796       run0 = Run;
2797       eventcounter = 0;
2798       ls0 = -1;
2799     }  // new run
2800     else {
2801       nevcounter00 = 0;
2802     }  //else new run
2803     ++eventcounter;
2804     if (ls0 != lumi) {
2805       if (ls0 != -1) {
2806         h_nevents_per_eachLS->Fill(float(lscounter), float(nevcounter));  //
2807         nevcounter0 = nevcounter;
2808       }  // ls0>-1
2809       lscounter++;
2810       lscounterrun++;
2811       if (usecontinuousnumbering_) {
2812         lscounterM1 = lscounter - 1;
2813       } else {
2814         lscounterM1 = ls0;
2815       }
2816       if (ls0 != -1)
2817         h_nevents_per_eachRealLS->Fill(float(lscounterM1), float(nevcounter));  //
2818       h_lsnumber_per_eachLS->Fill(float(lscounter), float(lumi));
2819       if (nevcounter > 10.) {
2820         ++lscounter10;
2821         ++lscounterrun10;
2822       }
2823       h_nevents_per_LS->Fill(float(nevcounter));
2824       h_nevents_per_LSzoom->Fill(float(nevcounter));
2825       nevcounter = 0;
2826       ls0 = lumi;
2827     }  // new lumi
2828     else {
2829       nevcounter0 = 0;
2830     }  //else new lumi
2831     ++nevcounter;  // #ev in LS
2832                    //////
2833     if (flagtoaskrunsorls_ == 0) {
2834       lscounterM1 = runcounter;
2835       nevcounter0 = nevcounter00;
2836     }
2837     if (nevcounter0 != 0 || nevcounter > 99999) {
2838       if (nevcounter > 99999)
2839         nevcounter0 = 1;
2840       ///////  int sub= cell.subdet();  1-HB, 2-HE, 3-HO, 4-HF
2841       ////////////            k0(sub): =0 HB; =1 HE; =2 HO; =3 HF;
2842       ////////////         k1(depth-1): = 0 - 3 or depth: = 1 - 4;
2843       unsigned long int pcountall1 = 0;
2844       unsigned long int pcountall3 = 0;
2845       unsigned long int pcountall6 = 0;
2846       unsigned long int pcountall8 = 0;
2847       int pcountmin1 = 0;
2848       int pcountmin3 = 0;
2849       int pcountmin6 = 0;
2850       int pcountmin8 = 0;
2851       unsigned long int mcountall1 = 0;
2852       unsigned long int mcountall3 = 0;
2853       unsigned long int mcountall6 = 0;
2854       unsigned long int mcountall8 = 0;
2855       int mcountmin1 = 0;
2856       int mcountmin3 = 0;
2857       int mcountmin6 = 0;
2858       int mcountmin8 = 0;
2859       int pnnmin1 = 999999999;
2860       int pnnmin3 = 999999999;
2861       int pnnmin6 = 999999999;
2862       int pnnmin8 = 999999999;
2863       int mnnbins1 = 0;
2864       int mnnbins3 = 0;
2865       int mnnbins6 = 0;
2866       int mnnbins8 = 0;
2867       int mnnmin1 = 999999999;
2868       int mnnmin3 = 999999999;
2869       int mnnmin6 = 999999999;
2870       int mnnmin8 = 999999999;
2871       for (int k0 = 0; k0 < nsub; k0++) {
2872         for (int k1 = 0; k1 < ndepth; k1++) {
2873           for (int k3 = 0; k3 < nphi; k3++) {
2874             for (int k2 = 0; k2 < neta; k2++) {
2875               int ieta = k2 - 41;
2876               // ------------------------------------------------------------sumEstimator0
2877               if (sumEstimator0[k0][k1][k2][k3] != 0.) {
2878                 // fill histoes:
2879                 double bbbc = 0.;
2880                 if (flagestimatornormalization_ == 0)
2881                   bbbc = sumEstimator0[k0][k1][k2][k3] / nevcounter0;
2882                 if (flagestimatornormalization_ == 1)
2883                   bbbc = sumEstimator0[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
2884                 double bbb1 = 1.;
2885                 if (flagestimatornormalization_ == 2) {
2886                   bbbc = sumEstimator0[k0][k1][k2][k3];
2887                   bbb1 = sum0Estimator[k0][k1][k2][k3];
2888                 }
2889 
2890                 // HB:
2891                 if (k0 == 0) {
2892                   // HBdepth1
2893                   if (k1 + 1 == 1) {
2894                     h_sumPedestalLS1->Fill(bbbc / bbb1);
2895                     h_2DsumPedestalLS1->Fill(double(ieta), double(k3), bbbc);
2896                     h_2D0sumPedestalLS1->Fill(double(ieta), double(k3), bbb1);
2897                     h_sumPedestalperLS1->Fill(float(lscounterM1), bbbc);
2898                     h_sum0PedestalperLS1->Fill(float(lscounterM1), bbb1);
2899                   }
2900                   if (k1 + 1 == 2) {
2901                     h_sumPedestalLS2->Fill(bbbc / bbb1);
2902                     h_2DsumPedestalLS2->Fill(double(ieta), double(k3), bbbc);
2903                     h_2D0sumPedestalLS2->Fill(double(ieta), double(k3), bbb1);
2904                     h_sumPedestalperLS2->Fill(float(lscounterM1), bbbc);
2905                     h_sum0PedestalperLS2->Fill(float(lscounterM1), bbb1);
2906                   }
2907                 }
2908                 // HE:
2909                 if (k0 == 1) {
2910                   // HEdepth1
2911                   if (k1 + 1 == 1) {
2912                     h_sumPedestalLS3->Fill(bbbc / bbb1);
2913                     h_2DsumPedestalLS3->Fill(double(ieta), double(k3), bbbc);
2914                     h_2D0sumPedestalLS3->Fill(double(ieta), double(k3), bbb1);
2915                     h_sumPedestalperLS3->Fill(float(lscounterM1), bbbc);
2916                     h_sum0PedestalperLS3->Fill(float(lscounterM1), bbb1);
2917                   }
2918                   if (k1 + 1 == 2) {
2919                     h_sumPedestalLS4->Fill(bbbc / bbb1);
2920                     h_2DsumPedestalLS4->Fill(double(ieta), double(k3), bbbc);
2921                     h_2D0sumPedestalLS4->Fill(double(ieta), double(k3), bbb1);
2922                     h_sumPedestalperLS4->Fill(float(lscounterM1), bbbc);
2923                     h_sum0PedestalperLS4->Fill(float(lscounterM1), bbb1);
2924                   }
2925                   if (k1 + 1 == 3) {
2926                     h_sumPedestalLS5->Fill(bbbc / bbb1);
2927                     h_2DsumPedestalLS5->Fill(double(ieta), double(k3), bbbc);
2928                     h_2D0sumPedestalLS5->Fill(double(ieta), double(k3), bbb1);
2929                     h_sumPedestalperLS5->Fill(float(lscounterM1), bbbc);
2930                     h_sum0PedestalperLS5->Fill(float(lscounterM1), bbb1);
2931                   }
2932                 }
2933                 // HF:
2934                 if (k0 == 3) {
2935                   // HFdepth1
2936                   if (k1 + 1 == 1) {
2937                     h_sumPedestalLS6->Fill(bbbc / bbb1);
2938                     h_2DsumPedestalLS6->Fill(double(ieta), double(k3), bbbc);
2939                     h_2D0sumPedestalLS6->Fill(double(ieta), double(k3), bbb1);
2940                     h_sumPedestalperLS6->Fill(float(lscounterM1), bbbc);
2941                     h_sum0PedestalperLS6->Fill(float(lscounterM1), bbb1);
2942                   }
2943                   if (k1 + 1 == 2) {
2944                     h_sumPedestalLS7->Fill(bbbc / bbb1);
2945                     h_2DsumPedestalLS7->Fill(double(ieta), double(k3), bbbc);
2946                     h_2D0sumPedestalLS7->Fill(double(ieta), double(k3), bbb1);
2947                     h_sumPedestalperLS7->Fill(float(lscounterM1), bbbc);
2948                     h_sum0PedestalperLS7->Fill(float(lscounterM1), bbb1);
2949                   }
2950                 }
2951                 // HO:
2952                 if (k0 == 2) {
2953                   // HOdepth4
2954                   if (k1 + 1 == 4) {
2955                     h_sumPedestalLS8->Fill(bbbc / bbb1);
2956                     h_2DsumPedestalLS8->Fill(double(ieta), double(k3), bbbc);
2957                     h_2D0sumPedestalLS8->Fill(double(ieta), double(k3), bbb1);
2958                     h_sumPedestalperLS8->Fill(float(lscounterM1), bbbc);
2959                     h_sum0PedestalperLS8->Fill(float(lscounterM1), bbb1);
2960                   }
2961                 }
2962               }  //if(sumEstimator0[k0][k1][k2][k3] != 0.
2963 
2964               // -------------------------------------------------------------------------------------   sumEstimator1
2965               if (sumEstimator1[k0][k1][k2][k3] != 0.) {
2966                 // fill histoes:
2967                 double bbbc = 0.;
2968                 if (flagestimatornormalization_ == 0)
2969                   bbbc = sumEstimator1[k0][k1][k2][k3] / nevcounter0;
2970                 if (flagestimatornormalization_ == 1)
2971                   bbbc = sumEstimator1[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
2972                 double bbb1 = 1.;
2973                 if (flagestimatornormalization_ == 2) {
2974                   bbbc = sumEstimator1[k0][k1][k2][k3];
2975                   bbb1 = sum0Estimator[k0][k1][k2][k3];
2976                 }
2977                 //flag for ask type of Normalization for CMT estimators:
2978                 //=0-normalizationOn#evOfLS;   =1-averagedMeanChannelVariable;   =2-averageVariable-normalizationOn#entriesInLS;
2979                 //flagestimatornormalization = cms.int32(2), !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2980                 // zhokin 18.10.2018 STUDY:               CALL  HFF2 (ID,NID,X,Y,W)
2981                 if (lscounterM1 >= lsmin_ && lscounterM1 < lsmax_) {
2982                   //                                       INDEXIES:
2983                   int kkkk2 = (k2 - 1) / 4;
2984                   if (k2 == 0)
2985                     kkkk2 = 1.;
2986                   else
2987                     kkkk2 += 2;              //kkkk2= 1-22
2988                   int kkkk3 = (k3) / 4 + 1;  //kkkk3= 1-18
2989                   //                                       PACKING
2990                   //kkkk2= 1-22 ;kkkk3= 1-18
2991                   int ietaphi = 0;
2992                   ietaphi = ((kkkk2)-1) * znphi + (kkkk3);
2993                   //  Outout is       ietaphi = 1 - 396 ( # =396; in histo,booking is: 1 - 397 )
2994 
2995                   double bbb3 = 0.;
2996                   if (bbb1 != 0.)
2997                     bbb3 = bbbc / bbb1;
2998                   // very very wrong if below:
2999                   //        if(bbb3 != 0.) {
3000 
3001                   if (k0 == 0) {
3002                     h_2DsumADCAmplEtaPhiLs0->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HB
3003                     h_2DsumADCAmplEtaPhiLs00->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HB
3004                   }
3005                   if (k0 == 1) {
3006                     h_2DsumADCAmplEtaPhiLs1->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HE
3007                     h_2DsumADCAmplEtaPhiLs10->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HE
3008                   }
3009                   if (k0 == 2) {
3010                     h_2DsumADCAmplEtaPhiLs2->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HO
3011                     h_2DsumADCAmplEtaPhiLs20->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HO
3012                   }
3013                   if (k0 == 3) {
3014                     h_2DsumADCAmplEtaPhiLs3->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HF
3015                     h_2DsumADCAmplEtaPhiLs30->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HF
3016                   }
3017 
3018                   h_sumADCAmplEtaPhiLs->Fill(bbb3);
3019                   h_sumADCAmplEtaPhiLs_bbbc->Fill(bbbc);
3020                   h_sumADCAmplEtaPhiLs_bbb1->Fill(bbb1);
3021                   h_sumADCAmplEtaPhiLs_lscounterM1orbitNum->Fill(float(lscounterM1), float(orbitNum));
3022                   h_sumADCAmplEtaPhiLs_orbitNum->Fill(float(orbitNum), 1.);
3023                   h_sumADCAmplEtaPhiLs_lscounterM1->Fill(float(lscounterM1), 1.);
3024                   h_sumADCAmplEtaPhiLs_ietaphi->Fill(float(ietaphi));
3025 
3026                   //        }// bb3
3027                 }  // lscounterM1 >= lsmin_ && lscounterM1 < lsmax_
3028 
3029                 // HB:
3030                 if (k0 == 0) {
3031                   // HBdepth1
3032                   if (k1 + 1 == 1) {
3033                     h_sumADCAmplLS1copy1->Fill(bbbc / bbb1);
3034                     h_sumADCAmplLS1copy2->Fill(bbbc / bbb1);
3035                     h_sumADCAmplLS1copy3->Fill(bbbc / bbb1);
3036                     h_sumADCAmplLS1copy4->Fill(bbbc / bbb1);
3037                     h_sumADCAmplLS1copy5->Fill(bbbc / bbb1);
3038                     h_sumADCAmplLS1->Fill(bbbc / bbb1);
3039                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth1_)
3040                       h_2DsumADCAmplLS1->Fill(double(ieta), double(k3), bbbc);
3041                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HBdepth1_)
3042                       h_2DsumADCAmplLS1_LSselected->Fill(double(ieta), double(k3), bbbc);
3043 
3044                     h_2D0sumADCAmplLS1->Fill(double(ieta), double(k3), bbb1);
3045 
3046                     h_sumADCAmplperLS1->Fill(float(lscounterM1), bbbc);
3047                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth1_)
3048                       h_sumCutADCAmplperLS1->Fill(float(lscounterM1), bbbc);
3049                     h_sum0ADCAmplperLS1->Fill(float(lscounterM1), bbb1);
3050 
3051                     if (ieta > 0) {
3052                       if (k3 < 36) {
3053                         h_sumADCAmplperLS1_P1->Fill(float(lscounterM1), bbbc);
3054                         h_sum0ADCAmplperLS1_P1->Fill(float(lscounterM1), bbb1);
3055                       } else {
3056                         h_sumADCAmplperLS1_P2->Fill(float(lscounterM1), bbbc);
3057                         h_sum0ADCAmplperLS1_P2->Fill(float(lscounterM1), bbb1);
3058                       }
3059                       ////////////////////////////// P
3060                       if (bbbc / bbb1 > 25.) {
3061                         pcountall1 += bbb1;
3062                         pcountmin1 += bbb1;
3063                       }
3064                       //////////////////////////////
3065 
3066                     } else {
3067                       if (k3 < 36) {
3068                         h_sumADCAmplperLS1_M1->Fill(float(lscounterM1), bbbc);
3069                         h_sum0ADCAmplperLS1_M1->Fill(float(lscounterM1), bbb1);
3070                       } else {
3071                         h_sumADCAmplperLS1_M2->Fill(float(lscounterM1), bbbc);
3072                         h_sum0ADCAmplperLS1_M2->Fill(float(lscounterM1), bbb1);
3073                       }
3074                       ////////////////////////////// M
3075                       if (bbbc / bbb1 > 25.) {
3076                         mcountall1 += bbb1;
3077                         mcountmin1 += bbb1;
3078                       }
3079                       //////////////////////////////
3080                     }
3081                   }
3082                   // HBdepth2
3083                   if (k1 + 1 == 2) {
3084                     h_sumADCAmplLS2->Fill(bbbc / bbb1);
3085                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth2_)
3086                       h_2DsumADCAmplLS2->Fill(double(ieta), double(k3), bbbc);
3087                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HBdepth2_)
3088                       h_2DsumADCAmplLS2_LSselected->Fill(double(ieta), double(k3), bbbc);
3089                     h_2D0sumADCAmplLS2->Fill(double(ieta), double(k3), bbb1);
3090                     h_sumADCAmplperLS2->Fill(float(lscounterM1), bbbc);
3091                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth2_)
3092                       h_sumCutADCAmplperLS2->Fill(float(lscounterM1), bbbc);
3093                     h_sum0ADCAmplperLS2->Fill(float(lscounterM1), bbb1);
3094                     if (ieta > 0) {
3095                       if (k3 < 36) {
3096                         h_sumADCAmplperLS1_P1->Fill(float(lscounterM1), bbbc);
3097                         h_sum0ADCAmplperLS1_P1->Fill(float(lscounterM1), bbb1);
3098                       } else {
3099                         h_sumADCAmplperLS1_P2->Fill(float(lscounterM1), bbbc);
3100                         h_sum0ADCAmplperLS1_P2->Fill(float(lscounterM1), bbb1);
3101                       }
3102                     } else {
3103                       if (k3 < 36) {
3104                         h_sumADCAmplperLS1_M1->Fill(float(lscounterM1), bbbc);
3105                         h_sum0ADCAmplperLS1_M1->Fill(float(lscounterM1), bbb1);
3106                       } else {
3107                         h_sumADCAmplperLS1_M2->Fill(float(lscounterM1), bbbc);
3108                         h_sum0ADCAmplperLS1_M2->Fill(float(lscounterM1), bbb1);
3109                       }
3110                     }
3111                   }
3112                   // HBdepth3 upgrade
3113                   if (k1 + 1 == 3) {
3114                     h_sumADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbbc);
3115                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth3_)
3116                       h_sumCutADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbbc);
3117                     h_sum0ADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbb1);
3118 
3119                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth3_)
3120                       h_2DsumADCAmplLSdepth3HBu->Fill(double(ieta), double(k3), bbbc);
3121                     h_2D0sumADCAmplLSdepth3HBu->Fill(double(ieta), double(k3), bbb1);
3122                   }  //if(k1+1  ==3)
3123 
3124                   // HBdepth4 upgrade
3125                   if (k1 + 1 == 4) {
3126                     h_sumADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbbc);
3127                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth4_)
3128                       h_sumCutADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbbc);
3129                     h_sum0ADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbb1);
3130 
3131                     if (bbbc / bbb1 > lsdep_estimator1_HBdepth4_)
3132                       h_2DsumADCAmplLSdepth4HBu->Fill(double(ieta), double(k3), bbbc);
3133                     h_2D0sumADCAmplLSdepth4HBu->Fill(double(ieta), double(k3), bbb1);
3134                   }  //if(k1+1  ==4)
3135                 }
3136 
3137                 // HE:
3138                 if (k0 == 1) {
3139                   // HEdepth1
3140                   if (k1 + 1 == 1) {
3141                     h_sumADCAmplLS3->Fill(bbbc / bbb1);
3142                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth1_)
3143                       h_2DsumADCAmplLS3->Fill(double(ieta), double(k3), bbbc);
3144                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth1_)
3145                       h_2DsumADCAmplLS3_LSselected->Fill(double(ieta), double(k3), bbbc);
3146                     h_2D0sumADCAmplLS3->Fill(double(ieta), double(k3), bbb1);
3147                     h_sumADCAmplperLS3->Fill(float(lscounterM1), bbbc);
3148                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth1_)
3149                       h_sumCutADCAmplperLS3->Fill(float(lscounterM1), bbbc);
3150                     h_sum0ADCAmplperLS3->Fill(float(lscounterM1), bbb1);
3151                     if (ieta > 0) {
3152                       if (k3 < 36) {
3153                         h_sumADCAmplperLS3_P1->Fill(float(lscounterM1), bbbc);
3154                         h_sum0ADCAmplperLS3_P1->Fill(float(lscounterM1), bbb1);
3155                       } else {
3156                         h_sumADCAmplperLS3_P2->Fill(float(lscounterM1), bbbc);
3157                         h_sum0ADCAmplperLS3_P2->Fill(float(lscounterM1), bbb1);
3158                       }
3159                       ////////////////////////////// P
3160                       if (bbbc / bbb1 > 15. && k3 % 2 == 0) {
3161                         pcountall3 += bbb1;
3162                         pcountmin3 += bbb1;
3163                       }
3164                       //////////////////////////////
3165                     } else {
3166                       if (k3 < 36) {
3167                         h_sumADCAmplperLS3_M1->Fill(float(lscounterM1), bbbc);
3168                         h_sum0ADCAmplperLS3_M1->Fill(float(lscounterM1), bbb1);
3169                       } else {
3170                         h_sumADCAmplperLS3_M2->Fill(float(lscounterM1), bbbc);
3171                         h_sum0ADCAmplperLS3_M2->Fill(float(lscounterM1), bbb1);
3172                       }
3173                       ////////////////////////////// M
3174                       if (bbbc / bbb1 > 15. && k3 % 2 == 0) {
3175                         mcountall3 += bbb1;
3176                         mcountmin3 += bbb1;
3177                       }
3178                       //////////////////////////////
3179                     }
3180                   }
3181                   // HEdepth2
3182                   if (k1 + 1 == 2) {
3183                     h_sumADCAmplLS4->Fill(bbbc / bbb1);
3184                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth2_)
3185                       h_2DsumADCAmplLS4->Fill(double(ieta), double(k3), bbbc);
3186                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth2_)
3187                       h_2DsumADCAmplLS4_LSselected->Fill(double(ieta), double(k3), bbbc);
3188                     h_2D0sumADCAmplLS4->Fill(double(ieta), double(k3), bbb1);
3189                     h_sumADCAmplperLS4->Fill(float(lscounterM1), bbbc);
3190                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth2_)
3191                       h_sumCutADCAmplperLS4->Fill(float(lscounterM1), bbbc);
3192                     h_sum0ADCAmplperLS4->Fill(float(lscounterM1), bbb1);
3193                     if (ieta > 0) {
3194                       if (k3 < 36) {
3195                         h_sumADCAmplperLS3_P1->Fill(float(lscounterM1), bbbc);
3196                         h_sum0ADCAmplperLS3_P1->Fill(float(lscounterM1), bbb1);
3197                       } else {
3198                         h_sumADCAmplperLS3_P2->Fill(float(lscounterM1), bbbc);
3199                         h_sum0ADCAmplperLS3_P2->Fill(float(lscounterM1), bbb1);
3200                       }
3201                     } else {
3202                       if (k3 < 36) {
3203                         h_sumADCAmplperLS3_M1->Fill(float(lscounterM1), bbbc);
3204                         h_sum0ADCAmplperLS3_M1->Fill(float(lscounterM1), bbb1);
3205                       } else {
3206                         h_sumADCAmplperLS3_M2->Fill(float(lscounterM1), bbbc);
3207                         h_sum0ADCAmplperLS3_M2->Fill(float(lscounterM1), bbb1);
3208                       }
3209                     }
3210                   }
3211                   // HEdepth3
3212                   if (k1 + 1 == 3) {
3213                     h_sumADCAmplLS5->Fill(bbbc / bbb1);
3214                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth3_)
3215                       h_2DsumADCAmplLS5->Fill(double(ieta), double(k3), bbbc);
3216                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth3_)
3217                       h_2DsumADCAmplLS5_LSselected->Fill(double(ieta), double(k3), bbbc);
3218                     h_2D0sumADCAmplLS5->Fill(double(ieta), double(k3), bbb1);
3219                     h_sumADCAmplperLS5->Fill(float(lscounterM1), bbbc);
3220                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth3_)
3221                       h_sumCutADCAmplperLS5->Fill(float(lscounterM1), bbbc);
3222                     h_sum0ADCAmplperLS5->Fill(float(lscounterM1), bbb1);
3223                     if (ieta > 0) {
3224                       if (k3 < 36) {
3225                         h_sumADCAmplperLS3_P1->Fill(float(lscounterM1), bbbc);
3226                         h_sum0ADCAmplperLS3_P1->Fill(float(lscounterM1), bbb1);
3227                       } else {
3228                         h_sumADCAmplperLS3_P2->Fill(float(lscounterM1), bbbc);
3229                         h_sum0ADCAmplperLS3_P2->Fill(float(lscounterM1), bbb1);
3230                       }
3231                     } else {
3232                       if (k3 < 36) {
3233                         h_sumADCAmplperLS3_M1->Fill(float(lscounterM1), bbbc);
3234                         h_sum0ADCAmplperLS3_M1->Fill(float(lscounterM1), bbb1);
3235                       } else {
3236                         h_sumADCAmplperLS3_M2->Fill(float(lscounterM1), bbbc);
3237                         h_sum0ADCAmplperLS3_M2->Fill(float(lscounterM1), bbb1);
3238                       }
3239                     }
3240                   }  //if(k1+1  ==3
3241                   // HEdepth4 upgrade
3242                   if (k1 + 1 == 4) {
3243                     h_sumADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbbc);
3244                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth4_)
3245                       h_sumCutADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbbc);
3246                     h_sum0ADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbb1);
3247 
3248                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth4_)
3249                       h_2DsumADCAmplLSdepth4HEu->Fill(double(ieta), double(k3), bbbc);
3250                     h_2D0sumADCAmplLSdepth4HEu->Fill(double(ieta), double(k3), bbb1);
3251                   }  //if(k1+1  ==4)
3252 
3253                   // HEdepth5 upgrade
3254                   if (k1 + 1 == 5) {
3255                     h_sumADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbbc);
3256                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth5_)
3257                       h_sumCutADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbbc);
3258                     h_sum0ADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbb1);
3259 
3260                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth5_)
3261                       h_2DsumADCAmplLSdepth5HEu->Fill(double(ieta), double(k3), bbbc);
3262                     h_2D0sumADCAmplLSdepth5HEu->Fill(double(ieta), double(k3), bbb1);
3263                   }  //if(k1+1  ==5)
3264 
3265                   // HEdepth6 upgrade
3266                   if (k1 + 1 == 6) {
3267                     h_sumADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbbc);
3268                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth6_)
3269                       h_sumCutADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbbc);
3270                     h_sum0ADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbb1);
3271 
3272                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth6_)
3273                       h_2DsumADCAmplLSdepth6HEu->Fill(double(ieta), double(k3), bbbc);
3274                     h_2D0sumADCAmplLSdepth6HEu->Fill(double(ieta), double(k3), bbb1);
3275                   }  //if(k1+1  ==6)
3276 
3277                   // HEdepth7 upgrade
3278                   if (k1 + 1 == 7) {
3279                     h_sumADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbbc);
3280                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth7_)
3281                       h_sumCutADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbbc);
3282                     h_sum0ADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbb1);
3283 
3284                     if (bbbc / bbb1 > lsdep_estimator1_HEdepth7_)
3285                       h_2DsumADCAmplLSdepth7HEu->Fill(double(ieta), double(k3), bbbc);
3286                     h_2D0sumADCAmplLSdepth7HEu->Fill(double(ieta), double(k3), bbb1);
3287                   }  //if(k1+1  ==7)
3288                 }  //if(k0==1) =HE
3289                 // HF:
3290                 if (k0 == 3) {
3291                   // HFdepth1
3292                   if (k1 + 1 == 1) {
3293                     h_sumADCAmplLS6->Fill(bbbc / bbb1);
3294                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth1_)
3295                       h_2DsumADCAmplLS6->Fill(double(ieta), double(k3), bbbc);
3296                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HFdepth1_)
3297                       h_2DsumADCAmplLS6_LSselected->Fill(double(ieta), double(k3), bbbc);
3298                     h_2D0sumADCAmplLS6->Fill(double(ieta), double(k3), bbb1);
3299                     h_sumADCAmplperLS6->Fill(float(lscounterM1), bbbc);
3300                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth1_)
3301                       h_sumCutADCAmplperLS6->Fill(float(lscounterM1), bbbc);
3302                     h_sum0ADCAmplperLS6->Fill(float(lscounterM1), bbb1);
3303 
3304                     ///////////////////////////////////////////////////////// error-A
3305                     if (ieta > 0) {
3306                       if (k3 < 36) {
3307                         h_sumADCAmplperLS6_P1->Fill(float(lscounterM1), bbbc);
3308                         h_sum0ADCAmplperLS6_P1->Fill(float(lscounterM1), bbb1);
3309                       } else {
3310                         h_sumADCAmplperLS6_P2->Fill(float(lscounterM1), bbbc);
3311                         h_sum0ADCAmplperLS6_P2->Fill(float(lscounterM1), bbb1);
3312                       }
3313                       ////////////////////////////// P
3314                       if (bbbc / bbb1 > 20.) {
3315                         pcountall6 += bbb1;
3316                         pcountmin6 += bbb1;
3317                       }
3318                       //////////////////////////////
3319 
3320                     } else {
3321                       if (k3 < 36) {
3322                         h_sumADCAmplperLS6_M1->Fill(float(lscounterM1), bbbc);
3323                         h_sum0ADCAmplperLS6_M1->Fill(float(lscounterM1), bbb1);
3324                       } else {
3325                         h_sumADCAmplperLS6_M2->Fill(float(lscounterM1), bbbc);
3326                         h_sum0ADCAmplperLS6_M2->Fill(float(lscounterM1), bbb1);
3327                       }
3328                       ////////////////////////////// M
3329                       if (bbbc / bbb1 > 20.) {
3330                         mcountall6 += bbb1;
3331                         mcountmin6 += bbb1;
3332                       }
3333                       //////////////////////////////
3334                     }
3335                     /////////////////////////////////////////////////////////
3336                   }  //if(k1+1  ==1)
3337 
3338                   // HFdepth2
3339                   if (k1 + 1 == 2) {
3340                     h_sumADCAmplLS7->Fill(bbbc / bbb1);
3341                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth2_)
3342                       h_2DsumADCAmplLS7->Fill(double(ieta), double(k3), bbbc);
3343                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HFdepth2_)
3344                       h_2DsumADCAmplLS7_LSselected->Fill(double(ieta), double(k3), bbbc);
3345                     h_2D0sumADCAmplLS7->Fill(double(ieta), double(k3), bbb1);
3346                     h_sumADCAmplperLS7->Fill(float(lscounterM1), bbbc);
3347                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth2_)
3348                       h_sumCutADCAmplperLS7->Fill(float(lscounterM1), bbbc);
3349                     h_sum0ADCAmplperLS7->Fill(float(lscounterM1), bbb1);
3350 
3351                     if (ieta > 0) {
3352                       if (k3 < 36) {
3353                         h_sumADCAmplperLS6_P1->Fill(float(lscounterM1), bbbc);
3354                         h_sum0ADCAmplperLS6_P1->Fill(float(lscounterM1), bbb1);
3355                       } else {
3356                         h_sumADCAmplperLS6_P2->Fill(float(lscounterM1), bbbc);
3357                         h_sum0ADCAmplperLS6_P2->Fill(float(lscounterM1), bbb1);
3358                       }
3359                     } else {
3360                       if (k3 < 36) {
3361                         h_sumADCAmplperLS6_M1->Fill(float(lscounterM1), bbbc);
3362                         h_sum0ADCAmplperLS6_M1->Fill(float(lscounterM1), bbb1);
3363                       } else {
3364                         h_sumADCAmplperLS6_M2->Fill(float(lscounterM1), bbbc);
3365                         h_sum0ADCAmplperLS6_M2->Fill(float(lscounterM1), bbb1);
3366                       }
3367                     }
3368                   }  //if(k1+1  ==2)
3369 
3370                   // HFdepth3 upgrade
3371                   if (k1 + 1 == 3) {
3372                     h_sumADCAmplperLS6u->Fill(float(lscounterM1), bbbc);
3373                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth3_)
3374                       h_sumCutADCAmplperLS6u->Fill(float(lscounterM1), bbbc);
3375                     h_sum0ADCAmplperLS6u->Fill(float(lscounterM1), bbb1);
3376 
3377                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth3_)
3378                       h_2DsumADCAmplLSdepth3HFu->Fill(double(ieta), double(k3), bbbc);
3379                     h_2D0sumADCAmplLSdepth3HFu->Fill(double(ieta), double(k3), bbb1);
3380                   }  //if(k1+1  ==3)
3381 
3382                   // HFdepth4 upgrade
3383                   if (k1 + 1 == 4) {
3384                     h_sumADCAmplperLS7u->Fill(float(lscounterM1), bbbc);
3385                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth4_)
3386                       h_sumCutADCAmplperLS7u->Fill(float(lscounterM1), bbbc);
3387                     h_sum0ADCAmplperLS7u->Fill(float(lscounterM1), bbb1);
3388 
3389                     if (bbbc / bbb1 > lsdep_estimator1_HFdepth4_)
3390                       h_2DsumADCAmplLSdepth4HFu->Fill(double(ieta), double(k3), bbbc);
3391                     h_2D0sumADCAmplLSdepth4HFu->Fill(double(ieta), double(k3), bbb1);
3392                   }  //if(k1+1  ==4)
3393 
3394                 }  //end HF
3395 
3396                 // HO:
3397                 if (k0 == 2) {
3398                   // HOdepth4
3399                   if (k1 + 1 == 4) {
3400                     h_sumADCAmplLS8->Fill(bbbc / bbb1);
3401                     if (bbbc / bbb1 > lsdep_estimator1_HOdepth4_)
3402                       h_2DsumADCAmplLS8->Fill(double(ieta), double(k3), bbbc);
3403                     if (bbbc / bbb1 > 2. * lsdep_estimator1_HOdepth4_)
3404                       h_2DsumADCAmplLS8_LSselected->Fill(double(ieta), double(k3), bbbc);
3405                     h_2D0sumADCAmplLS8->Fill(double(ieta), double(k3), bbb1);
3406                     h_sumADCAmplperLS8->Fill(float(lscounterM1), bbbc);
3407                     if (bbbc / bbb1 > lsdep_estimator1_HOdepth4_)
3408                       h_sumCutADCAmplperLS8->Fill(float(lscounterM1), bbbc);
3409                     h_sum0ADCAmplperLS8->Fill(float(lscounterM1), bbb1);
3410 
3411                     ///////////////////////////////////////////////////////// error-A
3412                     if (ieta > 0) {
3413                       if (k3 < 36) {
3414                         h_sumADCAmplperLS8_P1->Fill(float(lscounterM1), bbbc);
3415                         h_sum0ADCAmplperLS8_P1->Fill(float(lscounterM1), bbb1);
3416                       } else {
3417                         h_sumADCAmplperLS8_P2->Fill(float(lscounterM1), bbbc);
3418                         h_sum0ADCAmplperLS8_P2->Fill(float(lscounterM1), bbb1);
3419                       }
3420                       ////////////////////////////// P
3421                       if (bbbc / bbb1 > 80.) {
3422                         pcountall8 += bbb1;
3423                         pcountmin8 += bbb1;
3424                       }
3425                       //////////////////////////////
3426 
3427                     } else {
3428                       if (k3 < 36) {
3429                         h_sumADCAmplperLS8_M1->Fill(float(lscounterM1), bbbc);
3430                         h_sum0ADCAmplperLS8_M1->Fill(float(lscounterM1), bbb1);
3431                       } else {
3432                         h_sumADCAmplperLS8_M2->Fill(float(lscounterM1), bbbc);
3433                         h_sum0ADCAmplperLS8_M2->Fill(float(lscounterM1), bbb1);
3434                       }
3435                       ////////////////////////////// M
3436                       if (bbbc / bbb1 > 80.) {
3437                         mcountall8 += bbb1;
3438                         mcountmin8 += bbb1;
3439                       }
3440                       //////////////////////////////
3441                     }
3442                     /////////////////////////////////////////////////////////
3443                   }
3444                 }
3445               }  //if(sumEstimator1[k0][k1][k2][k3] != 0.
3446               // ------------------------------------------------------------------------------------------------------------------------sumEstimator2
3447               if (sumEstimator2[k0][k1][k2][k3] != 0.) {
3448                 // fill histoes:
3449                 double bbbc = 0.;
3450                 if (flagestimatornormalization_ == 0)
3451                   bbbc = sumEstimator2[k0][k1][k2][k3] / nevcounter0;
3452                 if (flagestimatornormalization_ == 1)
3453                   bbbc = sumEstimator2[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3454                 double bbb1 = 1.;
3455                 if (flagestimatornormalization_ == 2) {
3456                   bbbc = sumEstimator2[k0][k1][k2][k3];
3457                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3458                 }
3459 
3460                 // HB:
3461                 if (k0 == 0) {
3462                   // HBdepth1
3463                   if (k1 + 1 == 1) {
3464                     h_sumTSmeanALS1->Fill(bbbc / bbb1);
3465                     if (bbbc / bbb1 > lsdep_estimator2_HBdepth1_)
3466                       h_2DsumTSmeanALS1->Fill(double(ieta), double(k3), bbbc);
3467                     h_2D0sumTSmeanALS1->Fill(double(ieta), double(k3), bbb1);
3468                     h_sumTSmeanAperLS1->Fill(float(lscounterM1), bbbc);
3469                     if (bbbc / bbb1 > lsdep_estimator2_HBdepth1_)
3470                       h_sumCutTSmeanAperLS1->Fill(float(lscounterM1), bbbc);
3471                     h_sum0TSmeanAperLS1->Fill(float(lscounterM1), bbb1);
3472                     if (bbbc / bbb1 > 2. * lsdep_estimator2_HBdepth1_)
3473                       h_sumTSmeanAperLS1_LSselected->Fill(float(lscounterM1), bbbc);
3474                   }
3475                   if (k1 + 1 == 2) {
3476                     h_sumTSmeanALS2->Fill(bbbc / bbb1);
3477                     if (bbbc / bbb1 > lsdep_estimator2_HBdepth2_)
3478                       h_2DsumTSmeanALS2->Fill(double(ieta), double(k3), bbbc);
3479                     h_2D0sumTSmeanALS2->Fill(double(ieta), double(k3), bbb1);
3480                     h_sumTSmeanAperLS2->Fill(float(lscounterM1), bbbc);
3481                     if (bbbc / bbb1 > lsdep_estimator2_HBdepth2_)
3482                       h_sumCutTSmeanAperLS2->Fill(float(lscounterM1), bbbc);
3483                     h_sum0TSmeanAperLS2->Fill(float(lscounterM1), bbb1);
3484                   }
3485                 }
3486                 // HE:
3487                 if (k0 == 1) {
3488                   // HBdepth1
3489                   if (k1 + 1 == 1) {
3490                     h_sumTSmeanALS3->Fill(bbbc / bbb1);
3491                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth1_)
3492                       h_2DsumTSmeanALS3->Fill(double(ieta), double(k3), bbbc);
3493                     h_2D0sumTSmeanALS3->Fill(double(ieta), double(k3), bbb1);
3494                     h_sumTSmeanAperLS3->Fill(float(lscounterM1), bbbc);
3495                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth1_)
3496                       h_sumCutTSmeanAperLS3->Fill(float(lscounterM1), bbbc);
3497                     h_sum0TSmeanAperLS3->Fill(float(lscounterM1), bbb1);
3498                   }
3499                   if (k1 + 1 == 2) {
3500                     h_sumTSmeanALS4->Fill(bbbc / bbb1);
3501                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth2_)
3502                       h_2DsumTSmeanALS4->Fill(double(ieta), double(k3), bbbc);
3503                     h_2D0sumTSmeanALS4->Fill(double(ieta), double(k3), bbb1);
3504                     h_sumTSmeanAperLS4->Fill(float(lscounterM1), bbbc);
3505                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth2_)
3506                       h_sumCutTSmeanAperLS4->Fill(float(lscounterM1), bbbc);
3507                     h_sum0TSmeanAperLS4->Fill(float(lscounterM1), bbb1);
3508                   }
3509                   if (k1 + 1 == 3) {
3510                     h_sumTSmeanALS5->Fill(bbbc / bbb1);
3511                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth3_)
3512                       h_2DsumTSmeanALS5->Fill(double(ieta), double(k3), bbbc);
3513                     h_2D0sumTSmeanALS5->Fill(double(ieta), double(k3), bbb1);
3514                     h_sumTSmeanAperLS5->Fill(float(lscounterM1), bbbc);
3515                     if (bbbc / bbb1 > lsdep_estimator2_HEdepth3_)
3516                       h_sumCutTSmeanAperLS5->Fill(float(lscounterM1), bbbc);
3517                     h_sum0TSmeanAperLS5->Fill(float(lscounterM1), bbb1);
3518                   }
3519                 }
3520                 // HF:
3521                 if (k0 == 3) {
3522                   // HBdepth1
3523                   if (k1 + 1 == 1) {
3524                     h_sumTSmeanALS6->Fill(bbbc / bbb1);
3525                     if (bbbc / bbb1 > lsdep_estimator2_HFdepth1_)
3526                       h_2DsumTSmeanALS6->Fill(double(ieta), double(k3), bbbc);
3527                     h_2D0sumTSmeanALS6->Fill(double(ieta), double(k3), bbb1);
3528                     h_sumTSmeanAperLS6->Fill(float(lscounterM1), bbbc);
3529                     if (bbbc / bbb1 > lsdep_estimator2_HFdepth1_)
3530                       h_sumCutTSmeanAperLS6->Fill(float(lscounterM1), bbbc);
3531                     h_sum0TSmeanAperLS6->Fill(float(lscounterM1), bbb1);
3532                   }
3533                   if (k1 + 1 == 2) {
3534                     h_sumTSmeanALS7->Fill(bbbc / bbb1);
3535                     if (bbbc / bbb1 > lsdep_estimator2_HFdepth2_)
3536                       h_2DsumTSmeanALS7->Fill(double(ieta), double(k3), bbbc);
3537                     h_2D0sumTSmeanALS7->Fill(double(ieta), double(k3), bbb1);
3538                     h_sumTSmeanAperLS7->Fill(float(lscounterM1), bbbc);
3539                     if (bbbc / bbb1 > lsdep_estimator2_HFdepth2_)
3540                       h_sumCutTSmeanAperLS7->Fill(float(lscounterM1), bbbc);
3541                     h_sum0TSmeanAperLS7->Fill(float(lscounterM1), bbb1);
3542                   }
3543                 }
3544                 // HO:
3545                 if (k0 == 2) {
3546                   // HBdepth1
3547                   if (k1 + 1 == 4) {
3548                     h_sumTSmeanALS8->Fill(bbbc / bbb1);
3549                     if (bbbc / bbb1 > lsdep_estimator2_HOdepth4_)
3550                       h_2DsumTSmeanALS8->Fill(double(ieta), double(k3), bbbc);
3551                     h_2D0sumTSmeanALS8->Fill(double(ieta), double(k3), bbb1);
3552                     h_sumTSmeanAperLS8->Fill(float(lscounterM1), bbbc);
3553                     if (bbbc / bbb1 > lsdep_estimator2_HOdepth4_)
3554                       h_sumCutTSmeanAperLS8->Fill(float(lscounterM1), bbbc);
3555                     h_sum0TSmeanAperLS8->Fill(float(lscounterM1), bbb1);
3556                   }
3557                 }
3558               }  //if(sumEstimator2[k0][k1][k2][k3] != 0.
3559 
3560               // ------------------------------------------------------------------------------------------------------------------------sumEstimator3
3561               if (sumEstimator3[k0][k1][k2][k3] != 0.) {
3562                 // fill histoes:
3563                 double bbbc = 0.;
3564                 if (flagestimatornormalization_ == 0)
3565                   bbbc = sumEstimator3[k0][k1][k2][k3] / nevcounter0;
3566                 if (flagestimatornormalization_ == 1)
3567                   bbbc = sumEstimator3[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3568                 double bbb1 = 1.;
3569                 if (flagestimatornormalization_ == 2) {
3570                   bbbc = sumEstimator3[k0][k1][k2][k3];
3571                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3572                 }
3573 
3574                 // HB:
3575                 if (k0 == 0) {
3576                   // HBdepth1
3577                   if (k1 + 1 == 1) {
3578                     h_sumTSmaxALS1->Fill(bbbc / bbb1);
3579                     if (bbbc / bbb1 > lsdep_estimator3_HBdepth1_)
3580                       h_2DsumTSmaxALS1->Fill(double(ieta), double(k3), bbbc);
3581                     h_2D0sumTSmaxALS1->Fill(double(ieta), double(k3), bbb1);
3582                     h_sumTSmaxAperLS1->Fill(float(lscounterM1), bbbc);
3583                     if (bbbc / bbb1 > lsdep_estimator3_HBdepth1_)
3584                       h_sumCutTSmaxAperLS1->Fill(float(lscounterM1), bbbc);
3585                     h_sum0TSmaxAperLS1->Fill(float(lscounterM1), bbb1);
3586                     if (bbbc / bbb1 > 2. * lsdep_estimator3_HBdepth1_)
3587                       h_sumTSmaxAperLS1_LSselected->Fill(float(lscounterM1), bbbc);
3588                   }
3589                   if (k1 + 1 == 2) {
3590                     h_sumTSmaxALS2->Fill(bbbc / bbb1);
3591                     if (bbbc / bbb1 > lsdep_estimator3_HBdepth2_)
3592                       h_2DsumTSmaxALS2->Fill(double(ieta), double(k3), bbbc);
3593                     h_2D0sumTSmaxALS2->Fill(double(ieta), double(k3), bbb1);
3594                     h_sumTSmaxAperLS2->Fill(float(lscounterM1), bbbc);
3595                     if (bbbc / bbb1 > lsdep_estimator3_HBdepth2_)
3596                       h_sumCutTSmaxAperLS2->Fill(float(lscounterM1), bbbc);
3597                     h_sum0TSmaxAperLS2->Fill(float(lscounterM1), bbb1);
3598                   }
3599                 }
3600                 // HE:
3601                 if (k0 == 1) {
3602                   // HBdepth1
3603                   if (k1 + 1 == 1) {
3604                     h_sumTSmaxALS3->Fill(bbbc / bbb1);
3605                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth1_)
3606                       h_2DsumTSmaxALS3->Fill(double(ieta), double(k3), bbbc);
3607                     h_2D0sumTSmaxALS3->Fill(double(ieta), double(k3), bbb1);
3608                     h_sumTSmaxAperLS3->Fill(float(lscounterM1), bbbc);
3609                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth1_)
3610                       h_sumCutTSmaxAperLS3->Fill(float(lscounterM1), bbbc);
3611                     h_sum0TSmaxAperLS3->Fill(float(lscounterM1), bbb1);
3612                   }
3613                   if (k1 + 1 == 2) {
3614                     h_sumTSmaxALS4->Fill(bbbc / bbb1);
3615                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth2_)
3616                       h_2DsumTSmaxALS4->Fill(double(ieta), double(k3), bbbc);
3617                     h_2D0sumTSmaxALS4->Fill(double(ieta), double(k3), bbb1);
3618                     h_sumTSmaxAperLS4->Fill(float(lscounterM1), bbbc);
3619                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth2_)
3620                       h_sumCutTSmaxAperLS4->Fill(float(lscounterM1), bbbc);
3621                     h_sum0TSmaxAperLS4->Fill(float(lscounterM1), bbb1);
3622                   }
3623                   if (k1 + 1 == 3) {
3624                     h_sumTSmaxALS5->Fill(bbbc / bbb1);
3625                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth3_)
3626                       h_2DsumTSmaxALS5->Fill(double(ieta), double(k3), bbbc);
3627                     h_2D0sumTSmaxALS5->Fill(double(ieta), double(k3), bbb1);
3628                     h_sumTSmaxAperLS5->Fill(float(lscounterM1), bbbc);
3629                     if (bbbc / bbb1 > lsdep_estimator3_HEdepth3_)
3630                       h_sumCutTSmaxAperLS5->Fill(float(lscounterM1), bbbc);
3631                     h_sum0TSmaxAperLS5->Fill(float(lscounterM1), bbb1);
3632                   }
3633                 }
3634                 // HF:
3635                 if (k0 == 3) {
3636                   // HBdepth1
3637                   if (k1 + 1 == 1) {
3638                     h_sumTSmaxALS6->Fill(bbbc / bbb1);
3639                     if (bbbc / bbb1 > lsdep_estimator3_HFdepth1_)
3640                       h_2DsumTSmaxALS6->Fill(double(ieta), double(k3), bbbc);
3641                     h_2D0sumTSmaxALS6->Fill(double(ieta), double(k3), bbb1);
3642                     h_sumTSmaxAperLS6->Fill(float(lscounterM1), bbbc);
3643                     if (bbbc / bbb1 > lsdep_estimator3_HFdepth1_)
3644                       h_sumCutTSmaxAperLS6->Fill(float(lscounterM1), bbbc);
3645                     h_sum0TSmaxAperLS6->Fill(float(lscounterM1), bbb1);
3646                   }
3647                   if (k1 + 1 == 2) {
3648                     h_sumTSmaxALS7->Fill(bbbc / bbb1);
3649                     if (bbbc / bbb1 > lsdep_estimator3_HFdepth2_)
3650                       h_2DsumTSmaxALS7->Fill(double(ieta), double(k3), bbbc);
3651                     h_2D0sumTSmaxALS7->Fill(double(ieta), double(k3), bbb1);
3652                     h_sumTSmaxAperLS7->Fill(float(lscounterM1), bbbc);
3653                     if (bbbc / bbb1 > lsdep_estimator3_HFdepth2_)
3654                       h_sumCutTSmaxAperLS7->Fill(float(lscounterM1), bbbc);
3655                     h_sum0TSmaxAperLS7->Fill(float(lscounterM1), bbb1);
3656                   }
3657                 }
3658                 // HO:
3659                 if (k0 == 2) {
3660                   // HBdepth1
3661                   if (k1 + 1 == 4) {
3662                     h_sumTSmaxALS8->Fill(bbbc / bbb1);
3663                     if (bbbc / bbb1 > lsdep_estimator3_HOdepth4_)
3664                       h_2DsumTSmaxALS8->Fill(double(ieta), double(k3), bbbc);
3665                     h_2D0sumTSmaxALS8->Fill(double(ieta), double(k3), bbb1);
3666                     h_sumTSmaxAperLS8->Fill(float(lscounterM1), bbbc);
3667                     if (bbbc / bbb1 > lsdep_estimator3_HOdepth4_)
3668                       h_sumCutTSmaxAperLS8->Fill(float(lscounterM1), bbbc);
3669                     h_sum0TSmaxAperLS8->Fill(float(lscounterM1), bbb1);
3670                   }
3671                 }
3672               }  //if(sumEstimator3[k0][k1][k2][k3] != 0.
3673 
3674               // ------------------------------------------------------------------------------------------------------------------------sumEstimator4
3675               if (sumEstimator4[k0][k1][k2][k3] != 0.) {
3676                 // fill histoes:
3677                 double bbbc = 0.;
3678                 if (flagestimatornormalization_ == 0)
3679                   bbbc = sumEstimator4[k0][k1][k2][k3] / nevcounter0;
3680                 if (flagestimatornormalization_ == 1)
3681                   bbbc = sumEstimator4[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3682                 double bbb1 = 1.;
3683                 if (flagestimatornormalization_ == 2) {
3684                   bbbc = sumEstimator4[k0][k1][k2][k3];
3685                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3686                 }
3687 
3688                 // HB:
3689                 if (k0 == 0) {
3690                   // HBdepth1
3691                   if (k1 + 1 == 1) {
3692                     h_sumAmplitudeLS1->Fill(bbbc / bbb1);
3693                     if (bbbc / bbb1 > lsdep_estimator4_HBdepth1_)
3694                       h_2DsumAmplitudeLS1->Fill(double(ieta), double(k3), bbbc);
3695                     h_2D0sumAmplitudeLS1->Fill(double(ieta), double(k3), bbb1);
3696                     h_sumAmplitudeperLS1->Fill(float(lscounterM1), bbbc);
3697                     if (bbbc / bbb1 > lsdep_estimator4_HBdepth1_)
3698                       h_sumCutAmplitudeperLS1->Fill(float(lscounterM1), bbbc);
3699                     h_sum0AmplitudeperLS1->Fill(float(lscounterM1), bbb1);
3700                     if (bbbc / bbb1 > 2. * lsdep_estimator4_HBdepth1_)
3701                       h_sumAmplitudeperLS1_LSselected->Fill(float(lscounterM1), bbbc);
3702                   }
3703                   if (k1 + 1 == 2) {
3704                     h_sumAmplitudeLS2->Fill(bbbc / bbb1);
3705                     if (bbbc / bbb1 > lsdep_estimator4_HBdepth2_)
3706                       h_2DsumAmplitudeLS2->Fill(double(ieta), double(k3), bbbc);
3707                     h_2D0sumAmplitudeLS2->Fill(double(ieta), double(k3), bbb1);
3708                     h_sumAmplitudeperLS2->Fill(float(lscounterM1), bbbc);
3709                     if (bbbc / bbb1 > lsdep_estimator4_HBdepth2_)
3710                       h_sumCutAmplitudeperLS2->Fill(float(lscounterM1), bbbc);
3711                     h_sum0AmplitudeperLS2->Fill(float(lscounterM1), bbb1);
3712                   }
3713                 }
3714                 // HE:
3715                 if (k0 == 1) {
3716                   // HBdepth1
3717                   if (k1 + 1 == 1) {
3718                     h_sumAmplitudeLS3->Fill(bbbc / bbb1);
3719                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth1_)
3720                       h_2DsumAmplitudeLS3->Fill(double(ieta), double(k3), bbbc);
3721                     h_2D0sumAmplitudeLS3->Fill(double(ieta), double(k3), bbb1);
3722                     h_sumAmplitudeperLS3->Fill(float(lscounterM1), bbbc);
3723                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth1_)
3724                       h_sumCutAmplitudeperLS3->Fill(float(lscounterM1), bbbc);
3725                     h_sum0AmplitudeperLS3->Fill(float(lscounterM1), bbb1);
3726                   }
3727                   if (k1 + 1 == 2) {
3728                     h_sumAmplitudeLS4->Fill(bbbc / bbb1);
3729                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth2_)
3730                       h_2DsumAmplitudeLS4->Fill(double(ieta), double(k3), bbbc);
3731                     h_2D0sumAmplitudeLS4->Fill(double(ieta), double(k3), bbb1);
3732                     h_sumAmplitudeperLS4->Fill(float(lscounterM1), bbbc);
3733                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth2_)
3734                       h_sumCutAmplitudeperLS4->Fill(float(lscounterM1), bbbc);
3735                     h_sum0AmplitudeperLS4->Fill(float(lscounterM1), bbb1);
3736                   }
3737                   if (k1 + 1 == 3) {
3738                     h_sumAmplitudeLS5->Fill(bbbc / bbb1);
3739                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth3_)
3740                       h_2DsumAmplitudeLS5->Fill(double(ieta), double(k3), bbbc);
3741                     h_2D0sumAmplitudeLS5->Fill(double(ieta), double(k3), bbb1);
3742                     h_sumAmplitudeperLS5->Fill(float(lscounterM1), bbbc);
3743                     if (bbbc / bbb1 > lsdep_estimator4_HEdepth3_)
3744                       h_sumCutAmplitudeperLS5->Fill(float(lscounterM1), bbbc);
3745                     h_sum0AmplitudeperLS5->Fill(float(lscounterM1), bbb1);
3746                   }
3747                 }
3748                 // HF:
3749                 if (k0 == 3) {
3750                   // HBdepth1
3751                   if (k1 + 1 == 1) {
3752                     h_sumAmplitudeLS6->Fill(bbbc / bbb1);
3753                     if (bbbc / bbb1 > lsdep_estimator4_HFdepth1_)
3754                       h_2DsumAmplitudeLS6->Fill(double(ieta), double(k3), bbbc);
3755                     h_2D0sumAmplitudeLS6->Fill(double(ieta), double(k3), bbb1);
3756                     h_sumAmplitudeperLS6->Fill(float(lscounterM1), bbbc);
3757                     if (bbbc / bbb1 > lsdep_estimator4_HFdepth1_)
3758                       h_sumCutAmplitudeperLS6->Fill(float(lscounterM1), bbbc);
3759                     h_sum0AmplitudeperLS6->Fill(float(lscounterM1), bbb1);
3760                   }
3761                   if (k1 + 1 == 2) {
3762                     h_sumAmplitudeLS7->Fill(bbbc / bbb1);
3763                     if (bbbc / bbb1 > lsdep_estimator4_HFdepth2_)
3764                       h_2DsumAmplitudeLS7->Fill(double(ieta), double(k3), bbbc);
3765                     h_2D0sumAmplitudeLS7->Fill(double(ieta), double(k3), bbb1);
3766                     h_sumAmplitudeperLS7->Fill(float(lscounterM1), bbbc);
3767                     if (bbbc / bbb1 > lsdep_estimator4_HFdepth2_)
3768                       h_sumCutAmplitudeperLS7->Fill(float(lscounterM1), bbbc);
3769                     h_sum0AmplitudeperLS7->Fill(float(lscounterM1), bbb1);
3770                   }
3771                 }
3772                 // HO:
3773                 if (k0 == 2) {
3774                   // HBdepth1
3775                   if (k1 + 1 == 4) {
3776                     h_sumAmplitudeLS8->Fill(bbbc / bbb1);
3777                     if (bbbc / bbb1 > lsdep_estimator4_HOdepth4_)
3778                       h_2DsumAmplitudeLS8->Fill(double(ieta), double(k3), bbbc);
3779                     h_2D0sumAmplitudeLS8->Fill(double(ieta), double(k3), bbb1);
3780                     h_sumAmplitudeperLS8->Fill(float(lscounterM1), bbbc);
3781                     if (bbbc / bbb1 > lsdep_estimator4_HOdepth4_)
3782                       h_sumCutAmplitudeperLS8->Fill(float(lscounterM1), bbbc);
3783                     h_sum0AmplitudeperLS8->Fill(float(lscounterM1), bbb1);
3784                   }
3785                 }
3786               }  //if(sumEstimator4[k0][k1][k2][k3] != 0.
3787               // ------------------------------------------------------------------------------------------------------------------------sumEstimator5
3788               if (sumEstimator5[k0][k1][k2][k3] != 0.) {
3789                 // fill histoes:
3790                 double bbbc = 0.;
3791                 if (flagestimatornormalization_ == 0)
3792                   bbbc = sumEstimator5[k0][k1][k2][k3] / nevcounter0;
3793                 if (flagestimatornormalization_ == 1)
3794                   bbbc = sumEstimator5[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3795                 double bbb1 = 1.;
3796                 if (flagestimatornormalization_ == 2) {
3797                   bbbc = sumEstimator5[k0][k1][k2][k3];
3798                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3799                 }
3800 
3801                 // HB:
3802                 if (k0 == 0) {
3803                   // HBdepth1
3804                   if (k1 + 1 == 1) {
3805                     h_sumAmplLS1->Fill(bbbc / bbb1);
3806                     if (bbbc / bbb1 > lsdep_estimator5_HBdepth1_)
3807                       h_2DsumAmplLS1->Fill(double(ieta), double(k3), bbbc);
3808                     h_2D0sumAmplLS1->Fill(double(ieta), double(k3), bbb1);
3809                     h_sumAmplperLS1->Fill(float(lscounterM1), bbbc);
3810                     if (bbbc / bbb1 > lsdep_estimator5_HBdepth1_)
3811                       h_sumCutAmplperLS1->Fill(float(lscounterM1), bbbc);
3812                     h_sum0AmplperLS1->Fill(float(lscounterM1), bbb1);
3813                     if (bbbc / bbb1 > 2. * lsdep_estimator5_HBdepth1_)
3814                       h_sumAmplperLS1_LSselected->Fill(float(lscounterM1), bbbc);
3815                   }
3816                   if (k1 + 1 == 2) {
3817                     h_sumAmplLS2->Fill(bbbc / bbb1);
3818                     if (bbbc / bbb1 > lsdep_estimator5_HBdepth2_)
3819                       h_2DsumAmplLS2->Fill(double(ieta), double(k3), bbbc);
3820                     h_2D0sumAmplLS2->Fill(double(ieta), double(k3), bbb1);
3821                     h_sumAmplperLS2->Fill(float(lscounterM1), bbbc);
3822                     if (bbbc / bbb1 > lsdep_estimator5_HBdepth2_)
3823                       h_sumCutAmplperLS2->Fill(float(lscounterM1), bbbc);
3824                     h_sum0AmplperLS2->Fill(float(lscounterM1), bbb1);
3825                   }
3826                 }
3827                 // HE:
3828                 if (k0 == 1) {
3829                   // HEdepth1
3830                   if (k1 + 1 == 1) {
3831                     h_sumAmplLS3->Fill(bbbc / bbb1);
3832                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth1_)
3833                       h_2DsumAmplLS3->Fill(double(ieta), double(k3), bbbc);
3834                     h_2D0sumAmplLS3->Fill(double(ieta), double(k3), bbb1);
3835                     h_sumAmplperLS3->Fill(float(lscounterM1), bbbc);
3836                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth1_)
3837                       h_sumCutAmplperLS3->Fill(float(lscounterM1), bbbc);
3838                     h_sum0AmplperLS3->Fill(float(lscounterM1), bbb1);
3839                   }
3840                   if (k1 + 1 == 2) {
3841                     h_sumAmplLS4->Fill(bbbc / bbb1);
3842                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth2_)
3843                       h_2DsumAmplLS4->Fill(double(ieta), double(k3), bbbc);
3844                     h_2D0sumAmplLS4->Fill(double(ieta), double(k3), bbb1);
3845                     h_sumAmplperLS4->Fill(float(lscounterM1), bbbc);
3846                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth2_)
3847                       h_sumCutAmplperLS4->Fill(float(lscounterM1), bbbc);
3848                     h_sum0AmplperLS4->Fill(float(lscounterM1), bbb1);
3849                   }
3850                   if (k1 + 1 == 3) {
3851                     h_sumAmplLS5->Fill(bbbc / bbb1);
3852                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth3_)
3853                       h_2DsumAmplLS5->Fill(double(ieta), double(k3), bbbc);
3854                     h_2D0sumAmplLS5->Fill(double(ieta), double(k3), bbb1);
3855                     h_sumAmplperLS5->Fill(float(lscounterM1), bbbc);
3856                     if (bbbc / bbb1 > lsdep_estimator5_HEdepth3_)
3857                       h_sumCutAmplperLS5->Fill(float(lscounterM1), bbbc);
3858                     h_sum0AmplperLS5->Fill(float(lscounterM1), bbb1);
3859                   }
3860                 }
3861                 // HF:
3862                 if (k0 == 3) {
3863                   // HFdepth1
3864                   if (k1 + 1 == 1) {
3865                     h_sumAmplLS6->Fill(bbbc / bbb1);
3866                     if (bbbc / bbb1 > lsdep_estimator5_HFdepth1_)
3867                       h_2DsumAmplLS6->Fill(double(ieta), double(k3), bbbc);
3868                     h_2D0sumAmplLS6->Fill(double(ieta), double(k3), bbb1);
3869                     h_sumAmplperLS6->Fill(float(lscounterM1), bbbc);
3870                     if (bbbc / bbb1 > lsdep_estimator5_HFdepth1_)
3871                       h_sumCutAmplperLS6->Fill(float(lscounterM1), bbbc);
3872                     h_sum0AmplperLS6->Fill(float(lscounterM1), bbb1);
3873                   }
3874                   if (k1 + 1 == 2) {
3875                     h_sumAmplLS7->Fill(bbbc / bbb1);
3876                     if (bbbc / bbb1 > lsdep_estimator5_HFdepth2_)
3877                       h_2DsumAmplLS7->Fill(double(ieta), double(k3), bbbc);
3878                     h_2D0sumAmplLS7->Fill(double(ieta), double(k3), bbb1);
3879                     h_sumAmplperLS7->Fill(float(lscounterM1), bbbc);
3880                     if (bbbc / bbb1 > lsdep_estimator5_HFdepth2_)
3881                       h_sumCutAmplperLS7->Fill(float(lscounterM1), bbbc);
3882                     h_sum0AmplperLS7->Fill(float(lscounterM1), bbb1);
3883                   }
3884                 }
3885                 // HO:
3886                 if (k0 == 2) {
3887                   // HOdepth4
3888                   if (k1 + 1 == 4) {
3889                     h_sumAmplLS8->Fill(bbbc / bbb1);
3890                     if (bbbc / bbb1 > lsdep_estimator5_HOdepth4_)
3891                       h_2DsumAmplLS8->Fill(double(ieta), double(k3), bbbc);
3892                     h_2D0sumAmplLS8->Fill(double(ieta), double(k3), bbb1);
3893                     h_sumAmplperLS8->Fill(float(lscounterM1), bbbc);
3894                     if (bbbc / bbb1 > lsdep_estimator5_HOdepth4_)
3895                       h_sumCutAmplperLS8->Fill(float(lscounterM1), bbbc);
3896                     h_sum0AmplperLS8->Fill(float(lscounterM1), bbb1);
3897                   }
3898                 }
3899               }  //if(sumEstimator5[k0][k1][k2][k3] != 0.
3900               // ------------------------------------------------------------------------------------------------------------------------sumEstimator6 (Error-B)
3901               if (sumEstimator6[k0][k1][k2][k3] != 0.) {
3902                 // fill histoes:
3903                 double bbbc = 0.;
3904                 if (flagestimatornormalization_ == 0)
3905                   bbbc = sumEstimator6[k0][k1][k2][k3] / nevcounter0;
3906                 if (flagestimatornormalization_ == 1)
3907                   bbbc = sumEstimator6[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
3908                 double bbb1 = 1.;
3909                 if (flagestimatornormalization_ == 2) {
3910                   bbbc = sumEstimator6[k0][k1][k2][k3];
3911                   bbb1 = sum0Estimator[k0][k1][k2][k3];
3912                 }
3913 
3914                 // HB:
3915                 if (k0 == 0) {
3916                   // HBdepth1
3917                   if (k1 + 1 == 1) {
3918                     h_sumErrorBLS1->Fill(bbbc / bbb1);
3919                     h_2DsumErrorBLS1->Fill(double(ieta), double(k3), bbbc);
3920                     h_2D0sumErrorBLS1->Fill(double(ieta), double(k3), bbb1);
3921                     h_sumErrorBperLS1->Fill(float(lscounterM1), bbbc);
3922                     h_sum0ErrorBperLS1->Fill(float(lscounterM1), bbb1);
3923                   }
3924                   if (k1 + 1 == 2) {
3925                     h_sumErrorBLS2->Fill(bbbc / bbb1);
3926                     h_2DsumErrorBLS2->Fill(double(ieta), double(k3), bbbc);
3927                     h_2D0sumErrorBLS2->Fill(double(ieta), double(k3), bbb1);
3928                     h_sumErrorBperLS2->Fill(float(lscounterM1), bbbc);
3929                     h_sum0ErrorBperLS2->Fill(float(lscounterM1), bbb1);
3930                   }
3931                 }
3932                 // HE:
3933                 if (k0 == 1) {
3934                   // HEdepth1
3935                   if (k1 + 1 == 1) {
3936                     h_sumErrorBLS3->Fill(bbbc / bbb1);
3937                     h_2DsumErrorBLS3->Fill(double(ieta), double(k3), bbbc);
3938                     h_2D0sumErrorBLS3->Fill(double(ieta), double(k3), bbb1);
3939                     h_sumErrorBperLS3->Fill(float(lscounterM1), bbbc);
3940                     h_sum0ErrorBperLS3->Fill(float(lscounterM1), bbb1);
3941                   }
3942                   if (k1 + 1 == 2) {
3943                     h_sumErrorBLS4->Fill(bbbc / bbb1);
3944                     h_2DsumErrorBLS4->Fill(double(ieta), double(k3), bbbc);
3945                     h_2D0sumErrorBLS4->Fill(double(ieta), double(k3), bbb1);
3946                     h_sumErrorBperLS4->Fill(float(lscounterM1), bbbc);
3947                     h_sum0ErrorBperLS4->Fill(float(lscounterM1), bbb1);
3948                   }
3949                   if (k1 + 1 == 3) {
3950                     h_sumErrorBLS5->Fill(bbbc / bbb1);
3951                     h_2DsumErrorBLS5->Fill(double(ieta), double(k3), bbbc);
3952                     h_2D0sumErrorBLS5->Fill(double(ieta), double(k3), bbb1);
3953                     h_sumErrorBperLS5->Fill(float(lscounterM1), bbbc);
3954                     h_sum0ErrorBperLS5->Fill(float(lscounterM1), bbb1);
3955                   }
3956                 }
3957                 // HF:
3958                 if (k0 == 3) {
3959                   // HFdepth1
3960                   if (k1 + 1 == 1) {
3961                     h_sumErrorBLS6->Fill(bbbc / bbb1);
3962                     h_2DsumErrorBLS6->Fill(double(ieta), double(k3), bbbc);
3963                     h_2D0sumErrorBLS6->Fill(double(ieta), double(k3), bbb1);
3964                     h_sumErrorBperLS6->Fill(float(lscounterM1), bbbc);
3965                     h_sum0ErrorBperLS6->Fill(float(lscounterM1), bbb1);
3966                   }
3967                   if (k1 + 1 == 2) {
3968                     h_sumErrorBLS7->Fill(bbbc / bbb1);
3969                     h_2DsumErrorBLS7->Fill(double(ieta), double(k3), bbbc);
3970                     h_2D0sumErrorBLS7->Fill(double(ieta), double(k3), bbb1);
3971                     h_sumErrorBperLS7->Fill(float(lscounterM1), bbbc);
3972                     h_sum0ErrorBperLS7->Fill(float(lscounterM1), bbb1);
3973                   }
3974                 }
3975                 // HO:
3976                 if (k0 == 2) {
3977                   // HOdepth4
3978                   if (k1 + 1 == 4) {
3979                     h_sumErrorBLS8->Fill(bbbc / bbb1);
3980                     h_2DsumErrorBLS8->Fill(double(ieta), double(k3), bbbc);
3981                     h_2D0sumErrorBLS8->Fill(double(ieta), double(k3), bbb1);
3982                     h_sumErrorBperLS8->Fill(float(lscounterM1), bbbc);
3983                     h_sum0ErrorBperLS8->Fill(float(lscounterM1), bbb1);
3984                   }
3985                 }
3986                 ///
3987               }  //if(sumEstimator6[k0][k1][k2][k3] != 0.
3988             }  //for k2
3989             // occupancy distributions for error-A:
3990             // HB
3991             if (k0 == 0 && k1 == 0) {
3992               if (pcountmin1 > 0) {
3993                 if (pcountmin1 < pnnmin1)
3994                   pnnmin1 = pcountmin1;
3995                 pcountmin1 = 0;
3996               }
3997               if (mcountmin1 > 0) {
3998                 if (mcountmin1 < mnnmin1)
3999                   mnnmin1 = mcountmin1;
4000                 mcountmin1 = 0;
4001                 mnnbins1++;
4002               }
4003             }  //
4004             // HE
4005             if (k0 == 1 && k1 == 0) {
4006               if (pcountmin3 > 0) {
4007                 if (pcountmin3 < pnnmin3)
4008                   pnnmin3 = pcountmin3;
4009                 pcountmin3 = 0;
4010               }
4011               if (mcountmin3 > 0) {
4012                 if (mcountmin3 < mnnmin3)
4013                   mnnmin3 = mcountmin3;
4014                 mcountmin3 = 0;
4015                 mnnbins3++;
4016               }
4017             }  //
4018             // HO
4019             if (k0 == 2 && k1 == 3) {
4020               if (pcountmin8 > 0) {
4021                 if (pcountmin8 < pnnmin8)
4022                   pnnmin8 = pcountmin8;
4023                 pcountmin8 = 0;
4024               }
4025               if (mcountmin8 > 0) {
4026                 if (mcountmin8 < mnnmin8)
4027                   mnnmin8 = mcountmin8;
4028                 mcountmin8 = 0;
4029                 mnnbins8++;
4030               }
4031             }  //
4032             // HF
4033             if (k0 == 3 && k1 == 0) {
4034               if (pcountmin6 > 0) {
4035                 if (pcountmin6 < pnnmin6)
4036                   pnnmin6 = pcountmin6;
4037                 pcountmin6 = 0;
4038               }
4039               if (mcountmin6 > 0) {
4040                 if (mcountmin6 < mnnmin6)
4041                   mnnmin6 = mcountmin6;
4042                 mcountmin6 = 0;
4043                 mnnbins6++;
4044               }
4045             }  //
4046 
4047           }  //for k3
4048         }  //for k1
4049       }  //for k0
4050       ///////  int sub= cell.subdet();  1-HB, 2-HE, 3-HO, 4-HF
4051       ////////////            k0(sub): =0 HB; =1 HE; =2 HO; =3 HF;
4052       ////////////         k1(depth-1): = 0 - 3 or depth: = 1 - 4;
4053 
4054       //   cout<<"=============================== lscounterM1 = "<<   (float)lscounterM1    <<endl;
4055 
4056       float patiooccupancy1 = 0.;
4057       if (pcountall1 != 0)
4058         patiooccupancy1 = (float)pnnmin1 * mnnbins1 / pcountall1;
4059       h_RatioOccupancy_HBM->Fill(float(lscounterM1), patiooccupancy1);
4060       float matiooccupancy1 = 0.;
4061       if (mcountall1 != 0)
4062         matiooccupancy1 = (float)mnnmin1 * mnnbins1 / mcountall1;
4063       h_RatioOccupancy_HBP->Fill(float(lscounterM1), matiooccupancy1);
4064 
4065       float patiooccupancy3 = 0.;
4066       if (pcountall3 != 0)
4067         patiooccupancy3 = (float)pnnmin3 * mnnbins3 / pcountall3;
4068       h_RatioOccupancy_HEM->Fill(float(lscounterM1), patiooccupancy3);
4069       float matiooccupancy3 = 0.;
4070       if (mcountall3 != 0)
4071         matiooccupancy3 = (float)mnnmin3 * mnnbins3 / mcountall3;
4072       h_RatioOccupancy_HEP->Fill(float(lscounterM1), matiooccupancy3);
4073 
4074       float patiooccupancy6 = 0.;
4075       if (pcountall6 != 0)
4076         patiooccupancy6 = (float)pnnmin6 * mnnbins6 / pcountall6;
4077       h_RatioOccupancy_HFM->Fill(float(lscounterM1), patiooccupancy6);
4078       float matiooccupancy6 = 0.;
4079       if (mcountall6 != 0)
4080         matiooccupancy6 = (float)mnnmin6 * mnnbins6 / mcountall6;
4081       h_RatioOccupancy_HFP->Fill(float(lscounterM1), matiooccupancy6);
4082 
4083       float patiooccupancy8 = 0.;
4084       if (pcountall8 != 0)
4085         patiooccupancy8 = (float)pnnmin8 * mnnbins8 / pcountall8;
4086       h_RatioOccupancy_HOM->Fill(float(lscounterM1), patiooccupancy8);
4087       float matiooccupancy8 = 0.;
4088       if (mcountall8 != 0)
4089         matiooccupancy8 = (float)mnnmin8 * mnnbins8 / mcountall8;
4090       h_RatioOccupancy_HOP->Fill(float(lscounterM1), matiooccupancy8);
4091 
4092       for (int k0 = 0; k0 < nsub; k0++) {
4093         for (int k1 = 0; k1 < ndepth; k1++) {
4094           for (int k2 = 0; k2 < neta; k2++) {
4095             for (int k3 = 0; k3 < nphi; k3++) {
4096               // reset massives:
4097               sumEstimator0[k0][k1][k2][k3] = 0.;
4098               sumEstimator1[k0][k1][k2][k3] = 0.;
4099               sumEstimator2[k0][k1][k2][k3] = 0.;
4100               sumEstimator3[k0][k1][k2][k3] = 0.;
4101               sumEstimator4[k0][k1][k2][k3] = 0.;
4102               sumEstimator5[k0][k1][k2][k3] = 0.;
4103               sumEstimator6[k0][k1][k2][k3] = 0.;
4104               sum0Estimator[k0][k1][k2][k3] = 0.;
4105             }  //for
4106           }  //for
4107         }  //for
4108       }  //for
4109 
4110       //------------------------------------------------------                        averSIGNAL
4111       averSIGNALoccupancy_HB /= float(nevcounter0);
4112       h_averSIGNALoccupancy_HB->Fill(float(lscounterM1), averSIGNALoccupancy_HB);
4113       averSIGNALoccupancy_HE /= float(nevcounter0);
4114       h_averSIGNALoccupancy_HE->Fill(float(lscounterM1), averSIGNALoccupancy_HE);
4115       averSIGNALoccupancy_HF /= float(nevcounter0);
4116       h_averSIGNALoccupancy_HF->Fill(float(lscounterM1), averSIGNALoccupancy_HF);
4117       averSIGNALoccupancy_HO /= float(nevcounter0);
4118       h_averSIGNALoccupancy_HO->Fill(float(lscounterM1), averSIGNALoccupancy_HO);
4119 
4120       averSIGNALoccupancy_HB = 0.;
4121       averSIGNALoccupancy_HE = 0.;
4122       averSIGNALoccupancy_HF = 0.;
4123       averSIGNALoccupancy_HO = 0.;
4124 
4125       //------------------------------------------------------
4126       averSIGNALsumamplitude_HB /= float(nevcounter0);
4127       h_averSIGNALsumamplitude_HB->Fill(float(lscounterM1), averSIGNALsumamplitude_HB);
4128       averSIGNALsumamplitude_HE /= float(nevcounter0);
4129       h_averSIGNALsumamplitude_HE->Fill(float(lscounterM1), averSIGNALsumamplitude_HE);
4130       averSIGNALsumamplitude_HF /= float(nevcounter0);
4131       h_averSIGNALsumamplitude_HF->Fill(float(lscounterM1), averSIGNALsumamplitude_HF);
4132       averSIGNALsumamplitude_HO /= float(nevcounter0);
4133       h_averSIGNALsumamplitude_HO->Fill(float(lscounterM1), averSIGNALsumamplitude_HO);
4134 
4135       averSIGNALsumamplitude_HB = 0.;
4136       averSIGNALsumamplitude_HE = 0.;
4137       averSIGNALsumamplitude_HF = 0.;
4138       averSIGNALsumamplitude_HO = 0.;
4139 
4140       //------------------------------------------------------                        averNOSIGNAL
4141       averNOSIGNALoccupancy_HB /= float(nevcounter0);
4142       h_averNOSIGNALoccupancy_HB->Fill(float(lscounterM1), averNOSIGNALoccupancy_HB);
4143       averNOSIGNALoccupancy_HE /= float(nevcounter0);
4144       h_averNOSIGNALoccupancy_HE->Fill(float(lscounterM1), averNOSIGNALoccupancy_HE);
4145       averNOSIGNALoccupancy_HF /= float(nevcounter0);
4146       h_averNOSIGNALoccupancy_HF->Fill(float(lscounterM1), averNOSIGNALoccupancy_HF);
4147       averNOSIGNALoccupancy_HO /= float(nevcounter0);
4148       h_averNOSIGNALoccupancy_HO->Fill(float(lscounterM1), averNOSIGNALoccupancy_HO);
4149 
4150       averNOSIGNALoccupancy_HB = 0.;
4151       averNOSIGNALoccupancy_HE = 0.;
4152       averNOSIGNALoccupancy_HF = 0.;
4153       averNOSIGNALoccupancy_HO = 0.;
4154 
4155       //------------------------------------------------------
4156       averNOSIGNALsumamplitude_HB /= float(nevcounter0);
4157       h_averNOSIGNALsumamplitude_HB->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HB);
4158       averNOSIGNALsumamplitude_HE /= float(nevcounter0);
4159       h_averNOSIGNALsumamplitude_HE->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HE);
4160       averNOSIGNALsumamplitude_HF /= float(nevcounter0);
4161       h_averNOSIGNALsumamplitude_HF->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HF);
4162       averNOSIGNALsumamplitude_HO /= float(nevcounter0);
4163       h_averNOSIGNALsumamplitude_HO->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HO);
4164 
4165       averNOSIGNALsumamplitude_HB = 0.;
4166       averNOSIGNALsumamplitude_HE = 0.;
4167       averNOSIGNALsumamplitude_HF = 0.;
4168       averNOSIGNALsumamplitude_HO = 0.;
4169 
4170       //------------------------------------------------------   maxxSA and maxxOccupancy
4171       h_maxxSUMAmpl_HB->Fill(float(lscounterM1), maxxSUM1);
4172       h_maxxSUMAmpl_HE->Fill(float(lscounterM1), maxxSUM2);
4173       h_maxxSUMAmpl_HO->Fill(float(lscounterM1), maxxSUM3);
4174       h_maxxSUMAmpl_HF->Fill(float(lscounterM1), maxxSUM4);
4175       maxxSUM1 = 0.;
4176       maxxSUM2 = 0.;
4177       maxxSUM3 = 0.;
4178       maxxSUM4 = 0.;
4179       //------------------------------------------------------
4180       h_maxxOCCUP_HB->Fill(float(lscounterM1), maxxOCCUP1);
4181       h_maxxOCCUP_HE->Fill(float(lscounterM1), maxxOCCUP2);
4182       h_maxxOCCUP_HO->Fill(float(lscounterM1), maxxOCCUP3);
4183       h_maxxOCCUP_HF->Fill(float(lscounterM1), maxxOCCUP4);
4184       maxxOCCUP1 = 0.;
4185       maxxOCCUP2 = 0.;
4186       maxxOCCUP3 = 0.;
4187       maxxOCCUP4 = 0.;
4188 
4189       //------------------------------------------------------
4190     }  //if(nevcounter0 != 0)
4191     //  POINT1
4192 
4193     /////////////////////////////////////////////////// over DigiCollections:
4194     // for upgrade:
4195     for (int k1 = 0; k1 < ndepth; k1++) {
4196       for (int k2 = 0; k2 < neta; k2++) {
4197         for (int k3 = 0; k3 < nphi; k3++) {
4198           if (studyCalibCellsHist_) {
4199             signal[k1][k2][k3] = 0.;
4200             calibt[k1][k2][k3] = 0.;
4201             calibcapiderror[k1][k2][k3] = 0;
4202             caliba[k1][k2][k3] = 0.;
4203             calibw[k1][k2][k3] = 0.;
4204             calib0[k1][k2][k3] = 0.;
4205             signal3[k1][k2][k3] = 0.;
4206             calib3[k1][k2][k3] = 0.;
4207             calib2[k1][k2][k3] = 0.;
4208           }
4209           if (studyRunDependenceHist_) {
4210             for (int k0 = 0; k0 < nsub; k0++) {
4211               badchannels[k0][k1][k2][k3] = 0;
4212             }  //for
4213           }  //if
4214 
4215         }  //for
4216       }  //for
4217     }  //for
4218     for (int k0 = 0; k0 < nsub; k0++) {
4219       for (int k1 = 0; k1 < ndepth; k1++) {
4220         for (int k2 = 0; k2 < neta; k2++) {
4221           for (int k3 = 0; k3 < nphi; k3++) {
4222             amplitudechannel0[k0][k1][k2][k3] = 0.;
4223             amplitudechannel[k0][k1][k2][k3] = 0.;
4224             amplitudechannel2[k0][k1][k2][k3] = 0.;
4225 
4226             tocamplchannel[k0][k1][k2][k3] = 0.;
4227             maprphinorm[k0][k1][k2][k3] = 0.;
4228             // phi-symmetry monitoring for calibration group:
4229             // rec energy:
4230             recSignalEnergy0[k0][k1][k2][k3] = 0.;
4231             recSignalEnergy1[k0][k1][k2][k3] = 0.;
4232             recSignalEnergy2[k0][k1][k2][k3] = 0.;
4233             recNoiseEnergy0[k0][k1][k2][k3] = 0.;
4234             recNoiseEnergy1[k0][k1][k2][k3] = 0.;
4235             recNoiseEnergy2[k0][k1][k2][k3] = 0.;
4236 
4237           }  //k3
4238         }  //k2
4239       }  //k1
4240     }  //k0
4241     ///////////////////////////////////////////////////////////////////////////////////////////////////////////
4242     ///////////////////       END of GENERAL NULLING       ////////////////////////////////////////////////////
4243     ///////////////////////////////////////////////////////////////////////////////////////////////////////////
4244 
4245     if (flagToUseDigiCollectionsORNot_ != 0) {
4246       ///////////////////////////////////////////////////////////////////////////////////////////////////////////
4247       ////////////////////////      START of DigiCollections running:          ///////////////////////////////////
4248       ////////////////////////////////////////////////////////////////////
4249       if (flagupgradeqie1011_ != 2 && flagupgradeqie1011_ != 3 && flagupgradeqie1011_ != 6 &&
4250           flagupgradeqie1011_ != 7 && flagupgradeqie1011_ != 8) {
4251         edm::Handle<HFDigiCollection> hf;
4252         iEvent.getByToken(tok_hf_, hf);
4253         bool gotHFDigis = true;
4254         if (!(iEvent.getByToken(tok_hf_, hf))) {
4255           gotHFDigis = false;
4256         }  //this is a boolean set up to check if there are HFdigis in input root file
4257         if (!(hf.isValid())) {
4258           gotHFDigis = false;
4259         }  //if it is not there, leave it false
4260         if (!gotHFDigis) {
4261           std::cout << " ******************************  ===========================   No HFDigiCollection found "
4262                     << std::endl;
4263         } else {
4264           ////////////////////////////////////////////////////////////////////   qie8   QIE8 :
4265           for (HFDigiCollection::const_iterator digi = hf->begin(); digi != hf->end(); digi++) {
4266             eta = digi->id().ieta();
4267             phi = digi->id().iphi();
4268             depth = digi->id().depth();
4269             nTS = digi->size();
4270             ///////////////////
4271             counterhf++;
4272             ////////////////////////////////////////////////////////////  for zerrors.C script:
4273             if (recordHistoes_ && studyCapIDErrorsHist_)
4274               fillDigiErrorsHF(digi);
4275             //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4276             if (recordHistoes_)
4277               fillDigiAmplitudeHF(digi);
4278             //////////////////////////////////////////// calibration staff (often not needed):
4279             if (recordHistoes_ && studyCalibCellsHist_) {
4280               int iphi = phi - 1;
4281               int ieta = eta;
4282               if (ieta > 0)
4283                 ieta -= 1;
4284               if (nTS <= numOfTS)
4285                 for (int i = 0; i < nTS; i++) {
4286                   TS_data[i] = adc2fC[digi->sample(i).adc()];
4287                   signal[3][ieta + 41][iphi] += TS_data[i];
4288                   if (i > 1 && i < 6)
4289                     signal3[3][ieta + 41][iphi] += TS_data[i];
4290                 }  // TS
4291             }  // if(recordHistoes_ && studyCalibCellsHist_)
4292           }  // for
4293         }  // hf.isValid
4294       }  // end flagupgrade
4295 
4296       ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// HFQIE10 DigiCollection
4297       //////////////////////////////////////////////////////////////////////////////////////////////////upgradeHF upgradehf
4298       // upgrade:
4299       if (flagupgradeqie1011_ != 1) {
4300         edm::Handle<QIE10DigiCollection> hfqie10;
4301         iEvent.getByToken(tok_qie10_, hfqie10);
4302         const QIE10DigiCollection& qie10dc =
4303             *(hfqie10);  ////////////////////////////////////////////////    <<<=========  !!!!
4304         bool gotQIE10Digis = true;
4305         if (!(iEvent.getByToken(tok_qie10_, hfqie10))) {
4306           gotQIE10Digis = false;
4307         }  //this is a boolean set up to check if there are HFdigis in input root file
4308         if (!(hfqie10.isValid())) {
4309           gotQIE10Digis = false;
4310         }  //if it is not there, leave it false
4311         if (!gotQIE10Digis) {
4312           std::cout << " No QIE10DigiCollection collection is found " << std::endl;
4313         } else {
4314           ////////////////////////////////////////////////////////////////////   qie10   QIE10 :
4315           double totalAmplitudeHF = 0.;
4316           for (unsigned int j = 0; j < qie10dc.size(); j++) {
4317             QIE10DataFrame qie10df = static_cast<QIE10DataFrame>(qie10dc[j]);
4318             DetId detid = qie10df.detid();
4319             HcalDetId hcaldetid = HcalDetId(detid);
4320             int eta = hcaldetid.ieta();
4321             int phi = hcaldetid.iphi();
4322             //  int depth = hcaldetid.depth();
4323             // loop over the samples in the digi
4324             nTS = qie10df.samples();
4325             ///////////////////
4326             counterhfqie10++;
4327             ////////////////////////////////////////////////////////////  for zerrors.C script:
4328             if (recordHistoes_ && studyCapIDErrorsHist_)
4329               fillDigiErrorsHFQIE10(qie10df);
4330             //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4331             if (recordHistoes_)
4332               fillDigiAmplitudeHFQIE10(qie10df);
4333             ///////////////////
4334             //     if(recordHistoes_ ) {
4335             if (recordHistoes_ && studyCalibCellsHist_) {
4336               int iphi = phi - 1;
4337               int ieta = eta;
4338               if (ieta > 0)
4339                 ieta -= 1;
4340               double amplitudefullTSs = 0.;
4341               double nnnnnnTS = 0.;
4342               for (int i = 0; i < nTS; ++i) {
4343                 // j - QIE channel
4344                 // i - time sample (TS)
4345                 int adc = qie10df[i].adc();
4346                 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4347                 //        float charge = adc2fC_QIE10[ adc ];
4348                 TS_data[i] = adc2fC_QIE10[adc];
4349                 signal[3][ieta + 41][iphi] += TS_data[i];
4350                 totalAmplitudeHF += TS_data[i];
4351                 amplitudefullTSs += TS_data[i];
4352                 nnnnnnTS++;
4353                 if (i > 1 && i < 6)
4354                   signal3[3][ieta + 41][iphi] += TS_data[i];
4355 
4356               }  // TS
4357               h_numberofhitsHFtest->Fill(nnnnnnTS);
4358               h_AmplitudeHFtest->Fill(amplitudefullTSs);
4359             }  // if(recordHistoes_ && studyCalibCellsHist_)
4360           }  // for
4361           h_totalAmplitudeHF->Fill(totalAmplitudeHF);
4362           h_totalAmplitudeHFperEvent->Fill(float(eventcounter), totalAmplitudeHF);
4363         }  // hfqie10.isValid
4364       }  // end flagupgrade
4365       //end upgrade
4366       //
4367       //
4368       //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// HBHEDigiCollection  usual, <=2018
4369       int qwert1 = 0;
4370       int qwert2 = 0;
4371       int qwert3 = 0;
4372       int qwert4 = 0;
4373       int qwert5 = 0;
4374       if (flagupgradeqie1011_ != 2 && flagupgradeqie1011_ != 3) {
4375         edm::Handle<HBHEDigiCollection> hbhe;
4376         iEvent.getByToken(tok_hbhe_, hbhe);
4377         bool gotHBHEDigis = true;
4378         if (!(iEvent.getByToken(tok_hbhe_, hbhe)))
4379           gotHBHEDigis = false;  //this is a boolean set up to check if there are HBHEgigis in input root file
4380         if (!(hbhe.isValid()))
4381           gotHBHEDigis = false;  //if it is not there, leave it false
4382         if (!gotHBHEDigis) {
4383           std::cout << " No HBHEDigiCollection collection is found " << std::endl;
4384         } else {
4385           //      unsigned int NHBHEDigiCollectionsize =  hbhe->size();
4386           double totalAmplitudeHB = 0.;
4387           double totalAmplitudeHE = 0.;
4388           double nnnnnnTSHB = 0.;
4389           double nnnnnnTSHE = 0.;
4390 
4391           for (HBHEDigiCollection::const_iterator digi = hbhe->begin(); digi != hbhe->end(); digi++) {
4392             eta = digi->id().ieta();
4393             phi = digi->id().iphi();
4394             depth = digi->id().depth();
4395             nTS = digi->size();
4396             /////////////////////////////////////// counters of event*digis
4397             nnnnnnhbhe++;
4398             nnnnnn++;
4399             //////////////////////////////////  counters of event for subdet & depth
4400             if (digi->id().subdet() == HcalBarrel && depth == 1 && qwert1 == 0) {
4401               nnnnnn1++;
4402               qwert1 = 1;
4403             }
4404             if (digi->id().subdet() == HcalBarrel && depth == 2 && qwert2 == 0) {
4405               nnnnnn2++;
4406               qwert2 = 1;
4407             }
4408             if (digi->id().subdet() == HcalEndcap && depth == 1 && qwert3 == 0) {
4409               nnnnnn3++;
4410               qwert3 = 1;
4411             }
4412             if (digi->id().subdet() == HcalEndcap && depth == 2 && qwert4 == 0) {
4413               nnnnnn4++;
4414               qwert4 = 1;
4415             }
4416             if (digi->id().subdet() == HcalEndcap && depth == 3 && qwert5 == 0) {
4417               nnnnnn5++;
4418               qwert5 = 1;
4419             }
4420             ////////////////////////////////////////////////////////////  for zerrors.C script:
4421             if (recordHistoes_ && studyCapIDErrorsHist_)
4422               fillDigiErrors(digi);
4423             //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4424             if (recordHistoes_)
4425               fillDigiAmplitude(digi);
4426 
4427             if (recordHistoes_ && studyCalibCellsHist_) {
4428               int iphi = phi - 1;
4429               int ieta = eta;
4430               if (ieta > 0)
4431                 ieta -= 1;
4432               //////////////////////////////////////////    HB:
4433               if (digi->id().subdet() == HcalBarrel) {
4434                 double amplitudefullTSs = 0.;
4435                 nnnnnnTSHB++;
4436                 if (nTS <= numOfTS)
4437                   for (int i = 0; i < nTS; i++) {
4438                     TS_data[i] = adc2fC[digi->sample(i).adc()];
4439                     signal[0][ieta + 41][iphi] += TS_data[i];
4440                     amplitudefullTSs += TS_data[i];
4441                     totalAmplitudeHB += TS_data[i];
4442                     if (i > 1 && i < 6)
4443                       signal3[0][ieta + 41][iphi] += TS_data[i];
4444                   }
4445                 h_AmplitudeHBtest->Fill(amplitudefullTSs);
4446               }  // HB
4447               //////////////////////////////////////////    HE:
4448               if (digi->id().subdet() == HcalEndcap) {
4449                 double amplitudefullTSs = 0.;
4450                 nnnnnnTSHE++;
4451                 if (nTS <= numOfTS)
4452                   for (int i = 0; i < nTS; i++) {
4453                     TS_data[i] = adc2fC[digi->sample(i).adc()];
4454                     signal[1][ieta + 41][iphi] += TS_data[i];
4455                     totalAmplitudeHE += TS_data[i];
4456                     amplitudefullTSs += TS_data[i];
4457                     if (i > 1 && i < 6)
4458                       signal3[1][ieta + 41][iphi] += TS_data[i];
4459                   }
4460                 h_AmplitudeHEtest->Fill(amplitudefullTSs);
4461               }  // HE
4462 
4463             }  //if(recordHistoes_ && studyCalibCellsHist_)
4464             if (recordNtuples_ && nevent50 < maxNeventsInNtuple_) {
4465             }  //if(recordNtuples_)
4466           }  // for HBHE digis
4467           if (totalAmplitudeHB != 0.) {
4468             h_numberofhitsHBtest->Fill(nnnnnnTSHB);
4469             h_totalAmplitudeHB->Fill(totalAmplitudeHB);
4470             h_totalAmplitudeHBperEvent->Fill(float(eventcounter), totalAmplitudeHB);
4471           }
4472           if (totalAmplitudeHE != 0.) {
4473             h_numberofhitsHEtest->Fill(nnnnnnTSHE);
4474             h_totalAmplitudeHE->Fill(totalAmplitudeHE);
4475             h_totalAmplitudeHEperEvent->Fill(float(eventcounter), totalAmplitudeHE);
4476           }
4477         }  //hbhe.isValid
4478       }  // end flagupgrade
4479       //---------------------------------------------------------------
4480       //////////////////////////////////////////////////////////////////////////////////////////////////    upgradeHBHE upgradehe       HBHE with SiPM (both >=2020)
4481       // upgrade:
4482       if (flagupgradeqie1011_ != 1 && flagupgradeqie1011_ != 4 && flagupgradeqie1011_ != 5 &&
4483           flagupgradeqie1011_ != 10) {
4484         edm::Handle<QIE11DigiCollection> heqie11;
4485         iEvent.getByToken(tok_qie11_, heqie11);
4486         const QIE11DigiCollection& qie11dc =
4487             *(heqie11);  ////////////////////////////////////////////////    <<<=========  !!!!
4488         bool gotQIE11Digis = true;
4489         if (!(iEvent.getByToken(tok_qie11_, heqie11)))
4490           gotQIE11Digis = false;  //this is a boolean set up to check if there are QIE11gigis in input root file
4491         if (!(heqie11.isValid()))
4492           gotQIE11Digis = false;  //if it is not there, leave it false
4493         if (!gotQIE11Digis) {
4494           std::cout << " No QIE11DigiCollection collection is found " << std::endl;
4495         } else {
4496           ////////////////////////////////////////////////////////////////////   qie11   QIE11 :
4497           double totalAmplitudeHBQIE11 = 0.;
4498           double totalAmplitudeHEQIE11 = 0.;
4499           double nnnnnnTSHBQIE11 = 0.;
4500           double nnnnnnTSHEQIE11 = 0.;
4501           for (unsigned int j = 0; j < qie11dc.size(); j++) {
4502             QIE11DataFrame qie11df = static_cast<QIE11DataFrame>(qie11dc[j]);
4503             DetId detid = qie11df.detid();
4504             HcalDetId hcaldetid = HcalDetId(detid);
4505             int eta = hcaldetid.ieta();
4506             int phi = hcaldetid.iphi();
4507             int depth = hcaldetid.depth();
4508             if (depth == 0)
4509               return;
4510             int sub = hcaldetid.subdet();  // 1-HB, 2-HE (HFDigiCollection: 4-HF)
4511             // loop over the samples in the digi
4512             nTS = qie11df.samples();
4513             ///////////////////
4514             nnnnnnhbheqie11++;
4515             nnnnnn++;
4516             if (recordHistoes_ && studyCapIDErrorsHist_)
4517               fillDigiErrorsQIE11(qie11df);
4518             //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4519             if (recordHistoes_)
4520               fillDigiAmplitudeQIE11(qie11df);
4521             ///////////////////
4522             //////////////////////////////////  counters of event for subdet & depth
4523             if (sub == 1 && depth == 1 && qwert1 == 0) {
4524               nnnnnn1++;
4525               qwert1 = 1;
4526             }
4527             if (sub == 1 && depth == 2 && qwert2 == 0) {
4528               nnnnnn2++;
4529               qwert2 = 1;
4530             }
4531             if (sub == 2 && depth == 1 && qwert3 == 0) {
4532               nnnnnn3++;
4533               qwert3 = 1;
4534             }
4535             if (sub == 2 && depth == 2 && qwert4 == 0) {
4536               nnnnnn4++;
4537               qwert4 = 1;
4538             }
4539             if (sub == 2 && depth == 3 && qwert5 == 0) {
4540               nnnnnn5++;
4541               qwert5 = 1;
4542             }
4543 
4544             if (recordHistoes_ && studyCalibCellsHist_) {
4545               int iphi = phi - 1;
4546               int ieta = eta;
4547               if (ieta > 0)
4548                 ieta -= 1;
4549               // HB:
4550               if (sub == 1) {
4551                 double amplitudefullTSs1 = 0.;
4552                 double amplitudefullTSs6 = 0.;
4553                 nnnnnnTSHBQIE11++;
4554                 for (int i = 0; i < nTS; ++i) {
4555                   int adc = qie11df[i].adc();
4556                   double charge1 = adc2fC_QIE11_shunt1[adc];
4557                   double charge6 = adc2fC_QIE11_shunt6[adc];
4558                   amplitudefullTSs1 += charge1;
4559                   amplitudefullTSs6 += charge6;
4560                   double charge = charge6;
4561                   TS_data[i] = charge;
4562                   signal[0][ieta + 41][iphi] += charge;
4563                   if (i > 1 && i < 6)
4564                     signal3[0][ieta + 41][iphi] += charge;
4565                   totalAmplitudeHBQIE11 += charge;
4566                 }  //for
4567                 h_AmplitudeHBtest1->Fill(amplitudefullTSs1, 1.);
4568                 h_AmplitudeHBtest6->Fill(amplitudefullTSs6, 1.);
4569               }  //HB end
4570               // HE:
4571               if (sub == 2) {
4572                 double amplitudefullTSs1 = 0.;
4573                 double amplitudefullTSs6 = 0.;
4574                 nnnnnnTSHEQIE11++;
4575                 for (int i = 0; i < nTS; i++) {
4576                   int adc = qie11df[i].adc();
4577                   double charge1 = adc2fC_QIE11_shunt1[adc];
4578                   double charge6 = adc2fC_QIE11_shunt6[adc];
4579                   amplitudefullTSs1 += charge1;
4580                   amplitudefullTSs6 += charge6;
4581                   double charge = charge6;
4582                   TS_data[i] = charge;
4583                   signal[1][ieta + 41][iphi] += charge;
4584                   if (i > 1 && i < 6)
4585                     signal3[1][ieta + 41][iphi] += charge;
4586                   totalAmplitudeHEQIE11 += charge;
4587                 }  //for
4588                 h_AmplitudeHEtest1->Fill(amplitudefullTSs1, 1.);
4589                 h_AmplitudeHEtest6->Fill(amplitudefullTSs6, 1.);
4590 
4591               }  //HE end
4592             }  //if(recordHistoes_ && studyCalibCellsHist_)
4593           }  // for QIE11 digis
4594 
4595           if (totalAmplitudeHBQIE11 != 0.) {
4596             h_numberofhitsHBtest->Fill(nnnnnnTSHBQIE11);
4597             h_totalAmplitudeHB->Fill(totalAmplitudeHBQIE11);
4598             h_totalAmplitudeHBperEvent->Fill(float(eventcounter), totalAmplitudeHBQIE11);
4599           }
4600           if (totalAmplitudeHEQIE11 != 0.) {
4601             h_numberofhitsHEtest->Fill(nnnnnnTSHEQIE11);
4602             h_totalAmplitudeHE->Fill(totalAmplitudeHEQIE11);
4603             h_totalAmplitudeHEperEvent->Fill(float(eventcounter), totalAmplitudeHEQIE11);
4604           }
4605         }  //heqie11.isValid
4606       }  // end flagupgrade
4607 
4608       ///////////////////////////////////////////////////////////////////////////////////////////////////////////////   HODigiCollection
4609       edm::Handle<HODigiCollection> ho;
4610       iEvent.getByToken(tok_ho_, ho);
4611       bool gotHODigis = true;
4612       if (!(iEvent.getByToken(tok_ho_, ho)))
4613         gotHODigis = false;  //this is a boolean set up to check if there are HOgigis in input root file
4614       if (!(ho.isValid()))
4615         gotHODigis = false;  //if it is not there, leave it false
4616       if (!gotHODigis) {
4617         //  if(!ho.isValid()) {
4618         std::cout << " No HO collection is found " << std::endl;
4619       } else {
4620         int qwert6 = 0;
4621         double totalAmplitudeHO = 0.;
4622         for (HODigiCollection::const_iterator digi = ho->begin(); digi != ho->end(); digi++) {
4623           eta = digi->id().ieta();
4624           phi = digi->id().iphi();
4625           depth = digi->id().depth();
4626           nTS = digi->size();
4627           ///////////////////
4628           counterho++;
4629           //////////////////////////////////  counters of event
4630           if (qwert6 == 0) {
4631             nnnnnn6++;
4632             qwert6 = 1;
4633           }
4634           ////////////////////////////////////////////////////////////  for zerrors.C script:
4635           if (recordHistoes_ && studyCapIDErrorsHist_)
4636             fillDigiErrorsHO(digi);
4637           //////////////////////////////////////  for ztsmaxa.C,zratio34.C,zrms.C & zdifampl.C scripts:
4638           if (recordHistoes_)
4639             fillDigiAmplitudeHO(digi);
4640           ///////////////////
4641           if (recordHistoes_ && studyCalibCellsHist_) {
4642             int iphi = phi - 1;
4643             int ieta = eta;
4644             if (ieta > 0)
4645               ieta -= 1;
4646             double nnnnnnTS = 0.;
4647             double amplitudefullTSs = 0.;
4648             if (nTS <= numOfTS)
4649               for (int i = 0; i < nTS; i++) {
4650                 TS_data[i] = adc2fC[digi->sample(i).adc()];
4651                 amplitudefullTSs += TS_data[i];
4652                 signal[2][ieta + 41][iphi] += TS_data[i];
4653                 totalAmplitudeHO += TS_data[i];
4654                 if (i > 1 && i < 6)
4655                   signal3[2][ieta + 41][iphi] += TS_data[i];
4656                 nnnnnnTS++;
4657               }  //if for
4658             h_AmplitudeHOtest->Fill(amplitudefullTSs);
4659             h_numberofhitsHOtest->Fill(nnnnnnTS);
4660           }  //if(recordHistoes_ && studyCalibCellsHist_)
4661         }  //for HODigiCollection
4662 
4663         h_totalAmplitudeHO->Fill(totalAmplitudeHO);
4664         h_totalAmplitudeHOperEvent->Fill(float(eventcounter), totalAmplitudeHO);
4665       }  //ho.isValid(
4666     }  // flagToUseDigiCollectionsORNot_
4667 
4668     //////////////////////////////////// RecHits for phi-symmetry monitoring of calibration group:
4669     // AZ 04.11.2019
4670     //////////////////////////////////////////////////////
4671     if (flagIterativeMethodCalibrationGroupReco_ > 0) {
4672       //////////////////////////////////////////////////////////////////////////////////////////////////////  Noise
4673       //////////////////////////////////////////////////////////////////////////////////////////////////////  Noise
4674       //////////////////////////////////////////////////////////////////////////////////////////////////////  Noise
4675       // HBHE:    HBHERecHitCollection hbheNoise Noise
4676       edm::Handle<HBHERecHitCollection> hbheNoise;
4677       iEvent.getByToken(tok_hbheNoise_, hbheNoise);
4678       bool gotHBHERecHitsNoise = true;
4679       if (!(iEvent.getByToken(tok_hbheNoise_, hbheNoise)))
4680         gotHBHERecHitsNoise =
4681             false;  //this is a boolean set up to check if there are HBHERecHitsNoise in input root file
4682       if (!(hbheNoise.isValid()))
4683         gotHBHERecHitsNoise = false;  //if it is not there, leave it false
4684       if (!gotHBHERecHitsNoise) {
4685         //  if(!hbheNoise.isValid()) {
4686         std::cout << " No RecHits HBHENoise collection is found " << std::endl;
4687       } else {
4688         for (HBHERecHitCollection::const_iterator hbheItr = hbheNoise->begin(); hbheItr != hbheNoise->end();
4689              hbheItr++) {
4690           // Recalibration of energy
4691           float icalconst = 1.;
4692           //      DetId mydetid = hbheItr->id().rawId();
4693           //      if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
4694           HBHERecHit aHit(hbheItr->id(), hbheItr->eraw() * icalconst, hbheItr->time());
4695           //        HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
4696           double energyhit = aHit.energy();
4697           DetId id = (*hbheItr).detid();
4698           HcalDetId hid = HcalDetId(id);
4699           int sub = ((hid).rawId() >> 25) & 0x7;
4700 
4701           if (sub == 1)
4702             h_energyhitNoise_HB->Fill(energyhit, 1.);
4703           if (sub == 2)
4704             h_energyhitNoise_HE->Fill(energyhit, 1.);
4705           //    if(fabs(energyhit) > 40. ) continue;
4706 
4707           //std::cout<<sub<<std::endl;
4708           if (hid.depth() == 1 && sub == 1 && hid.iphi() == 25) {
4709             if (verbosity < 0)
4710               std::cout << " Noise,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4711                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4712           }
4713           if (hid.depth() == 1 && sub == 2 && hid.iphi() == 25) {
4714             if (verbosity < 0)
4715               std::cout << " Noise,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4716                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4717           }
4718           int ieta = hid.ieta();  // -15 ... -1; 1... 15 for HB
4719           if (ieta > 0)
4720             ieta -= 1;  // -15 ... -1; 0... 14 for HB
4721           int iphi = hid.iphi() - 1;
4722           int mdepth = hid.depth();
4723           recNoiseEnergy0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
4724           recNoiseEnergy1[sub - 1][mdepth - 1][ieta + 41][iphi] += energyhit;
4725           recNoiseEnergy2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(energyhit, 2);
4726         }  // hbheNoise
4727       }  //hbheNoise.isValid(
4728       ////////////////////////////////////////////////////// /  HBHE Noise end
4729 
4730       // HF:    HFRecHitCollection hfNoise Noise
4731       edm::Handle<HFRecHitCollection> hfNoise;
4732       iEvent.getByToken(tok_hfNoise_, hfNoise);
4733       bool gotHFRecHitsNoise = true;
4734       if (!(iEvent.getByToken(tok_hfNoise_, hfNoise)))
4735         gotHFRecHitsNoise = false;  //this is a boolean set up to check if there are HFRecHitsNoise in input root file
4736       if (!(hfNoise.isValid()))
4737         gotHFRecHitsNoise = false;  //if it is not there, leave it false
4738       if (!gotHFRecHitsNoise) {
4739         //  if(!hfNoise.isValid()) {
4740         std::cout << " No RecHits HFNoise collection is found " << std::endl;
4741       } else {
4742         for (HFRecHitCollection::const_iterator hfItr = hfNoise->begin(); hfItr != hfNoise->end(); hfItr++) {
4743           // Recalibration of energy
4744           float icalconst = 1.;
4745           //      DetId mydetid = hfItr->id().rawId();
4746           //      if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
4747           HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
4748           double energyhit = aHit.energy();
4749           DetId id = (*hfItr).detid();
4750           HcalDetId hid = HcalDetId(id);
4751           int sub = ((hid).rawId() >> 25) & 0x7;
4752 
4753           h_energyhitNoise_HF->Fill(energyhit, 1.);
4754           //    if(fabs(energyhit) > 40. ) continue;
4755 
4756           //std::cout<<sub<<std::endl;
4757           if (hid.iphi() == 25) {
4758             if (verbosity < 0)
4759               std::cout << "HF Noise,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4760                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4761           }
4762           int ieta = hid.ieta();  // -15 ... -1; 1... 15 for HB
4763           if (ieta > 0)
4764             ieta -= 1;  // -15 ... -1; 0... 14 for HB
4765           int iphi = hid.iphi() - 1;
4766           int mdepth = hid.depth();
4767           recNoiseEnergy0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
4768           recNoiseEnergy1[sub - 1][mdepth - 1][ieta + 41][iphi] += energyhit;
4769           recNoiseEnergy2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(energyhit, 2);
4770         }  // hfNoise
4771       }  //hfNoise.isValid(
4772       ////////////////////////////////////////////////////// /  HF Noise end
4773 
4774       ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Signal
4775       ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Signal
4776       ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Signal
4777       // HBHE:    HBHERecHitCollection hbheSignal Signal
4778       edm::Handle<HBHERecHitCollection> hbheSignal;
4779       iEvent.getByToken(tok_hbheSignal_, hbheSignal);
4780       bool gotHBHERecHitsSignal = true;
4781       if (!(iEvent.getByToken(tok_hbheSignal_, hbheSignal)))
4782         gotHBHERecHitsSignal =
4783             false;  //this is a boolean set up to check if there are HBHERecHitsSignal in input root file
4784       if (!(hbheSignal.isValid()))
4785         gotHBHERecHitsSignal = false;  //if it is not there, leave it false
4786       if (!gotHBHERecHitsSignal) {
4787         //  if(!hbheSignal.isValid()) {
4788         std::cout << " No RecHits HBHESignal collection is found " << std::endl;
4789       } else {
4790         for (HBHERecHitCollection::const_iterator hbheItr = hbheSignal->begin(); hbheItr != hbheSignal->end();
4791              hbheItr++) {
4792           // Recalibration of energy
4793           float icalconst = 1.;
4794           //      DetId mydetid = hbheItr->id().rawId();
4795           //      if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
4796           HBHERecHit aHit(hbheItr->id(), hbheItr->eraw() * icalconst, hbheItr->time());
4797           //        HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
4798           double energyhit = aHit.energy();
4799           DetId id = (*hbheItr).detid();
4800           HcalDetId hid = HcalDetId(id);
4801           int sub = ((hid).rawId() >> 25) & 0x7;
4802 
4803           if (sub == 1)
4804             h_energyhitSignal_HB->Fill(energyhit, 1.);
4805           if (sub == 2)
4806             h_energyhitSignal_HE->Fill(energyhit, 1.);
4807 
4808           //std::cout<<sub<<std::endl;
4809           if (hid.depth() == 1 && sub == 1 && hid.iphi() == 25) {
4810             if (verbosity < 0)
4811               std::cout << "HBHE Signal,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4812                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4813           }
4814           if (hid.depth() == 1 && sub == 2 && hid.iphi() == 25) {
4815             if (verbosity < 0)
4816               std::cout << "HBHE Signal,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4817                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4818           }
4819           int ieta = hid.ieta();  // -15 ... -1; 1... 15 for HB
4820           if (ieta > 0)
4821             ieta -= 1;  // -15 ... -1; 0... 14 for HB
4822           int iphi = hid.iphi() - 1;
4823           int mdepth = hid.depth();
4824           recSignalEnergy0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
4825           recSignalEnergy1[sub - 1][mdepth - 1][ieta + 41][iphi] += energyhit;
4826           recSignalEnergy2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(energyhit, 2);
4827         }  // hbheSignal
4828       }  //hbheSignal.isValid(
4829       ////////////////////////////////////////////////////// /  HBHE Signal end
4830 
4831       // HF:    HFRecHitCollection hfSignal Signal
4832       edm::Handle<HFRecHitCollection> hfSignal;
4833       iEvent.getByToken(tok_hfSignal_, hfSignal);
4834       bool gotHFRecHitsSignal = true;
4835       if (!(iEvent.getByToken(tok_hfSignal_, hfSignal)))
4836         gotHFRecHitsSignal = false;  //this is a boolean set up to check if there are HFRecHitsSignal in input root file
4837       if (!(hfSignal.isValid()))
4838         gotHFRecHitsSignal = false;  //if it is not there, leave it false
4839       if (!gotHFRecHitsSignal) {
4840         //  if(!hfSignal.isValid()) {
4841         std::cout << " No RecHits HFSignal collection is found " << std::endl;
4842       } else {
4843         for (HFRecHitCollection::const_iterator hfItr = hfSignal->begin(); hfItr != hfSignal->end(); hfItr++) {
4844           // Recalibration of energy
4845           float icalconst = 1.;
4846           //      DetId mydetid = hfItr->id().rawId();
4847           //      if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
4848           HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
4849           double energyhit = aHit.energy();
4850           DetId id = (*hfItr).detid();
4851           HcalDetId hid = HcalDetId(id);
4852           int sub = ((hid).rawId() >> 25) & 0x7;
4853 
4854           h_energyhitSignal_HF->Fill(energyhit, 1.);
4855           //    if(fabs(energyhit) > 40. ) continue;
4856 
4857           //std::cout<<sub<<std::endl;
4858           if (hid.iphi() == 25) {
4859             if (verbosity < 0)
4860               std::cout << "HF Signal,sub = " << sub << " mdepth = " << hid.depth() << "  ieta= " << hid.ieta()
4861                         << "  iphi= " << hid.iphi() << "  energyhit= " << energyhit << std::endl;
4862           }
4863           int ieta = hid.ieta();  // -15 ... -1; 1... 15 for HB
4864           if (ieta > 0)
4865             ieta -= 1;  // -15 ... -1; 0... 14 for HB
4866           int iphi = hid.iphi() - 1;
4867           int mdepth = hid.depth();
4868           recSignalEnergy0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
4869           recSignalEnergy1[sub - 1][mdepth - 1][ieta + 41][iphi] += energyhit;
4870           recSignalEnergy2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(energyhit, 2);
4871         }  // hfSignal
4872       }  //hfSignal.isValid(
4873       //////////////////////////////////////////////////////  HF Signal end
4874 
4875       //////////////////////////////////////////////////////
4876       // END of RecHits for phi-symmetry monitoring of calibration group
4877     }  // flagIterativeMethodCalibrationGroupReco_  >  0
4878     //////////////////////////////////////////////////////
4879 
4880     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
4881 
4882     //////////////////////////////////////////////////////
4883     /////////////////////////////////////////////////////////////
4884     ////////////////////////////////////////////////////////////////////////////////////////  TREATMENT OF OBTAINED DIGI-COLLECTION :
4885     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4886     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  Phi-Symmetry Monitoring DIGI
4887     //////////// k0(sub):       =0 HB;      =1 HE;       =2 HO;       =3 HF;
4888     //////////// k1(depth-1): = 0 - 6 or depth: = 1 - 7;
4889     if (flagIterativeMethodCalibrationGroupDigi_ > 0) {
4890       //////////////////////////////////////////////////////////////////////////
4891       ////////////////////////////////////////////////////////////////////////// Digi Digi Digi Digi Digi Digi
4892       //////////////////////////////////////////////////////////////////////////
4893       //      //      //      //      //      //      // tocdefault tocampl tocamplchannel: calibration group, Iterative method, coding start 29.08.2019
4894       for (int k0 = 0; k0 < nsub; k0++) {
4895         // HE only, temporary
4896         if (k0 == 1) {
4897           for (int k1 = 0; k1 < ndepth; k1++) {
4898             // k2: 0-81
4899             for (int k2 = 0; k2 < neta; k2++) {
4900               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
4901               int k2plot = k2 - 41;
4902               int kkk = k2plot;  //if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
4903               //preparation for PHI normalization:
4904               double sumoverphi = 0;
4905               int nsumoverphi = 0;
4906               for (int k3 = 0; k3 < nphi; k3++) {
4907                 if (tocamplchannel[k0][k1][k2][k3] != 0) {
4908                   sumoverphi += tocamplchannel[k0][k1][k2][k3];
4909                   ++nsumoverphi;
4910                   if (verbosity < 0)
4911                     std::cout << "==== nsumoverphi = " << nsumoverphi << "  sumoverphi = " << sumoverphi
4912                               << "  k1 = " << k1 << "  k2 = " << k2 << " kkk = " << kkk << "  k3 = " << k3 << std::endl;
4913                 }  //if != 0
4914               }  //k3
4915               // PHI normalization into new massive && filling plots:
4916               for (int k3 = 0; k3 < nphi; k3++) {
4917                 if (nsumoverphi != 0) {
4918                   maprphinorm[k0][k1][k2][k3] = tocamplchannel[k0][k1][k2][k3] / (sumoverphi / nsumoverphi);
4919                   if (verbosity < 0)
4920                     std::cout << "nsumoverphi= " << nsumoverphi << " sumoverphi= " << sumoverphi << " k1= " << k1
4921                               << " k2= " << k2 << " kkk= " << kkk << " k3= " << k3
4922                               << " maprphinorm= " << maprphinorm[k0][k1][k2][k3] << std::endl;
4923                   if (k1 == 0) {
4924                     h_mapenophinorm_HE1->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4925                     h_mapenophinorm2_HE1->Fill(
4926                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4927                     h_maprphinorm_HE1->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4928                     h_maprphinorm2_HE1->Fill(
4929                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4930                     h_maprphinorm0_HE1->Fill(double(kkk), double(k3), 1.);
4931                   }
4932                   if (k1 == 1) {
4933                     h_mapenophinorm_HE2->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4934                     h_mapenophinorm2_HE2->Fill(
4935                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4936                     h_maprphinorm_HE2->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4937                     h_maprphinorm2_HE2->Fill(
4938                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4939                     h_maprphinorm0_HE2->Fill(double(kkk), double(k3), 1.);
4940                   }
4941                   if (k1 == 2) {
4942                     h_mapenophinorm_HE3->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4943                     h_mapenophinorm2_HE3->Fill(
4944                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4945                     h_maprphinorm_HE3->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4946                     h_maprphinorm2_HE3->Fill(
4947                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4948                     h_maprphinorm0_HE3->Fill(double(kkk), double(k3), 1.);
4949                   }
4950                   if (k1 == 3) {
4951                     h_mapenophinorm_HE4->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4952                     h_mapenophinorm2_HE4->Fill(
4953                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4954                     h_maprphinorm_HE4->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4955                     h_maprphinorm2_HE4->Fill(
4956                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4957                     h_maprphinorm0_HE4->Fill(double(kkk), double(k3), 1.);
4958                   }
4959                   if (k1 == 4) {
4960                     h_mapenophinorm_HE5->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4961                     h_mapenophinorm2_HE5->Fill(
4962                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4963                     h_maprphinorm_HE5->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4964                     h_maprphinorm2_HE5->Fill(
4965                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4966                     h_maprphinorm0_HE5->Fill(double(kkk), double(k3), 1.);
4967                   }
4968                   if (k1 == 5) {
4969                     h_mapenophinorm_HE6->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4970                     h_mapenophinorm2_HE6->Fill(
4971                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4972                     h_maprphinorm_HE6->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4973                     h_maprphinorm2_HE6->Fill(
4974                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4975                     h_maprphinorm0_HE6->Fill(double(kkk), double(k3), 1.);
4976                   }
4977                   if (k1 == 6) {
4978                     h_mapenophinorm_HE7->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]);
4979                     h_mapenophinorm2_HE7->Fill(
4980                         double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3] * tocamplchannel[k0][k1][k2][k3]);
4981                     h_maprphinorm_HE7->Fill(double(kkk), double(k3), maprphinorm[k0][k1][k2][k3]);
4982                     h_maprphinorm2_HE7->Fill(
4983                         double(kkk), double(k3), maprphinorm[k0][k1][k2][k3] * maprphinorm[k0][k1][k2][k3]);
4984                     h_maprphinorm0_HE7->Fill(double(kkk), double(k3), 1.);
4985                   }
4986                 }  //if nsumoverphi != 0
4987               }  //k3
4988             }  //k2
4989           }  //k1
4990         }  //if k0 == 1 HE
4991       }  //k0
4992       //      //      //      //      //      //        //    //      //      //      //      //        //    //      //      //      //      //        //    //      //      //      //      //
4993       //      //      //      //      //      //      // amplitudechannel amplitudechannel amplitudechannel: calibration group, Iterative method, coding start 11.11.2019
4994       for (int k0 = 0; k0 < nsub; k0++) {
4995         // HB:
4996         if (k0 == 0) {
4997           for (int k1 = 0; k1 < ndepth; k1++) {
4998             // k2: 0-81
4999             for (int k2 = 0; k2 < neta; k2++) {
5000               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
5001               int k2plot = k2 - 41;
5002               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
5003               for (int k3 = 0; k3 < nphi; k3++) {
5004                 if (k1 == 0) {
5005                   h_amplitudechannel0_HB1->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5006                   h_amplitudechannel1_HB1->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5007                   h_amplitudechannel2_HB1->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5008                 }
5009                 if (k1 == 1) {
5010                   h_amplitudechannel0_HB2->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5011                   h_amplitudechannel1_HB2->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5012                   h_amplitudechannel2_HB2->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5013                 }
5014                 if (k1 == 2) {
5015                   h_amplitudechannel0_HB3->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5016                   h_amplitudechannel1_HB3->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5017                   h_amplitudechannel2_HB3->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5018                 }
5019                 if (k1 == 3) {
5020                   h_amplitudechannel0_HB4->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5021                   h_amplitudechannel1_HB4->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5022                   h_amplitudechannel2_HB4->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5023                 }
5024               }  //k3
5025             }  //k2
5026           }  //k1
5027         }  //if k0 == 0 HB
5028 
5029         // HE:
5030         if (k0 == 1) {
5031           for (int k1 = 0; k1 < ndepth; k1++) {
5032             // k2: 0-81
5033             for (int k2 = 0; k2 < neta; k2++) {
5034               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
5035               int k2plot = k2 - 41;
5036               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
5037               for (int k3 = 0; k3 < nphi; k3++) {
5038                 if (k1 == 0) {
5039                   h_amplitudechannel0_HE1->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5040                   h_amplitudechannel1_HE1->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5041                   h_amplitudechannel2_HE1->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5042                 }
5043                 if (k1 == 1) {
5044                   h_amplitudechannel0_HE2->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5045                   h_amplitudechannel1_HE2->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5046                   h_amplitudechannel2_HE2->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5047                 }
5048                 if (k1 == 2) {
5049                   h_amplitudechannel0_HE3->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5050                   h_amplitudechannel1_HE3->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5051                   h_amplitudechannel2_HE3->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5052                 }
5053                 if (k1 == 3) {
5054                   h_amplitudechannel0_HE4->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5055                   h_amplitudechannel1_HE4->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5056                   h_amplitudechannel2_HE4->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5057                 }
5058                 if (k1 == 4) {
5059                   h_amplitudechannel0_HE5->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5060                   h_amplitudechannel1_HE5->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5061                   h_amplitudechannel2_HE5->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5062                 }
5063                 if (k1 == 5) {
5064                   h_amplitudechannel0_HE6->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5065                   h_amplitudechannel1_HE6->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5066                   h_amplitudechannel2_HE6->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5067                 }
5068                 if (k1 == 6) {
5069                   h_amplitudechannel0_HE7->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5070                   h_amplitudechannel1_HE7->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5071                   h_amplitudechannel2_HE7->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5072                 }
5073               }  //k3
5074             }  //k2
5075           }  //k1
5076         }  //if k0 == 1 HE
5077 
5078         // HF: 4 depthes for Digis and only 2 - for Reco !!!
5079         if (k0 == 3) {
5080           for (int k1 = 0; k1 < ndepth; k1++) {
5081             // k2: 0-81
5082             for (int k2 = 0; k2 < neta; k2++) {
5083               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
5084               int k2plot = k2 - 41;
5085               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
5086               for (int k3 = 0; k3 < nphi; k3++) {
5087                 if (k1 == 0) {
5088                   h_amplitudechannel0_HF1->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5089                   h_amplitudechannel1_HF1->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5090                   h_amplitudechannel2_HF1->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5091                 }
5092                 if (k1 == 1) {
5093                   h_amplitudechannel0_HF2->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5094                   h_amplitudechannel1_HF2->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5095                   h_amplitudechannel2_HF2->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5096                 }
5097                 if (k1 == 2) {
5098                   h_amplitudechannel0_HF3->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5099                   h_amplitudechannel1_HF3->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5100                   h_amplitudechannel2_HF3->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5101                 }
5102                 if (k1 == 3) {
5103                   h_amplitudechannel0_HF4->Fill(double(kkk), double(k3), amplitudechannel0[k0][k1][k2][k3]);
5104                   h_amplitudechannel1_HF4->Fill(double(kkk), double(k3), amplitudechannel[k0][k1][k2][k3]);
5105                   h_amplitudechannel2_HF4->Fill(double(kkk), double(k3), amplitudechannel2[k0][k1][k2][k3]);
5106                 }
5107               }  //k3
5108             }  //k2
5109           }  //k1
5110         }  //if k0 == 3 HF
5111 
5112       }  //k0
5113 
5114     }  // if(flagIterativeMethodCalibrationGroupDigi
5115 
5116     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5117     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5118     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  Phi-Symmetry Monitoring Reco
5119     //////////// k0(sub):       =0 HB;      =1 HE;       =2 HO;       =3 HF;
5120     //////////// k1(depth-1): = 0 - 6 or depth: = 1 - 7;
5121     if (flagIterativeMethodCalibrationGroupReco_ > 0) {
5122       //////////////////////////////////////////////////////////////////////////
5123       ////////////////////////////////////////////////////////////////////////// Reco Reco Reco Reco Reco Reco
5124       //////////////////////////////////////////////////////////////////////////
5125       //
5126       for (int k0 = 0; k0 < nsub; k0++) {
5127         // HB:
5128         if (k0 == 0) {
5129           for (int k1 = 0; k1 < ndepth; k1++) {
5130             // k2: 0-81
5131             for (int k2 = 0; k2 < neta; k2++) {
5132               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
5133               int k2plot = k2 - 41;
5134               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
5135               for (int k3 = 0; k3 < nphi; k3++) {
5136                 if (k1 == 0) {
5137                   h_recSignalEnergy0_HB1->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5138                   h_recSignalEnergy1_HB1->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5139                   h_recSignalEnergy2_HB1->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5140                   h_recNoiseEnergy0_HB1->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5141                   h_recNoiseEnergy1_HB1->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5142                   h_recNoiseEnergy2_HB1->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5143                 }
5144                 if (k1 == 1) {
5145                   h_recSignalEnergy0_HB2->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5146                   h_recSignalEnergy1_HB2->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5147                   h_recSignalEnergy2_HB2->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5148                   h_recNoiseEnergy0_HB2->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5149                   h_recNoiseEnergy1_HB2->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5150                   h_recNoiseEnergy2_HB2->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5151                 }
5152                 if (k1 == 2) {
5153                   h_recSignalEnergy0_HB3->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5154                   h_recSignalEnergy1_HB3->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5155                   h_recSignalEnergy2_HB3->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5156                   h_recNoiseEnergy0_HB3->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5157                   h_recNoiseEnergy1_HB3->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5158                   h_recNoiseEnergy2_HB3->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5159                 }
5160                 if (k1 == 3) {
5161                   h_recSignalEnergy0_HB4->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5162                   h_recSignalEnergy1_HB4->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5163                   h_recSignalEnergy2_HB4->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5164                   h_recNoiseEnergy0_HB4->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5165                   h_recNoiseEnergy1_HB4->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5166                   h_recNoiseEnergy2_HB4->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5167                 }
5168               }  //k3
5169             }  //k2
5170           }  //k1
5171         }  //if k0 == 0 HB
5172 
5173         // HE:
5174         if (k0 == 1) {
5175           for (int k1 = 0; k1 < ndepth; k1++) {
5176             // k2: 0-81
5177             for (int k2 = 0; k2 < neta; k2++) {
5178               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
5179               int k2plot = k2 - 41;
5180               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
5181               for (int k3 = 0; k3 < nphi; k3++) {
5182                 if (k1 == 0) {
5183                   h_recSignalEnergy0_HE1->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5184                   h_recSignalEnergy1_HE1->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5185                   h_recSignalEnergy2_HE1->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5186                   h_recNoiseEnergy0_HE1->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5187                   h_recNoiseEnergy1_HE1->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5188                   h_recNoiseEnergy2_HE1->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5189                 }
5190                 if (k1 == 1) {
5191                   h_recSignalEnergy0_HE2->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5192                   h_recSignalEnergy1_HE2->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5193                   h_recSignalEnergy2_HE2->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5194                   h_recNoiseEnergy0_HE2->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5195                   h_recNoiseEnergy1_HE2->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5196                   h_recNoiseEnergy2_HE2->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5197                 }
5198                 if (k1 == 2) {
5199                   h_recSignalEnergy0_HE3->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5200                   h_recSignalEnergy1_HE3->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5201                   h_recSignalEnergy2_HE3->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5202                   h_recNoiseEnergy0_HE3->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5203                   h_recNoiseEnergy1_HE3->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5204                   h_recNoiseEnergy2_HE3->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5205                 }
5206                 if (k1 == 3) {
5207                   h_recSignalEnergy0_HE4->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5208                   h_recSignalEnergy1_HE4->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5209                   h_recSignalEnergy2_HE4->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5210                   h_recNoiseEnergy0_HE4->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5211                   h_recNoiseEnergy1_HE4->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5212                   h_recNoiseEnergy2_HE4->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5213                 }
5214                 if (k1 == 4) {
5215                   h_recSignalEnergy0_HE5->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5216                   h_recSignalEnergy1_HE5->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5217                   h_recSignalEnergy2_HE5->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5218                   h_recNoiseEnergy0_HE5->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5219                   h_recNoiseEnergy1_HE5->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5220                   h_recNoiseEnergy2_HE5->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5221                 }
5222                 if (k1 == 5) {
5223                   h_recSignalEnergy0_HE6->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5224                   h_recSignalEnergy1_HE6->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5225                   h_recSignalEnergy2_HE6->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5226                   h_recNoiseEnergy0_HE6->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5227                   h_recNoiseEnergy1_HE6->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5228                   h_recNoiseEnergy2_HE6->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5229                 }
5230                 if (k1 == 6) {
5231                   h_recSignalEnergy0_HE7->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5232                   h_recSignalEnergy1_HE7->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5233                   h_recSignalEnergy2_HE7->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5234                   h_recNoiseEnergy0_HE7->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5235                   h_recNoiseEnergy1_HE7->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5236                   h_recNoiseEnergy2_HE7->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5237                 }
5238               }  //k3
5239             }  //k2
5240           }  //k1
5241         }  //if k0 == 1 HE
5242 
5243         // HF: 4 depthes for Digis and only 2 - for Reco !!! ('ve tried to enter 4 for reco since 31.10.2021 AZ)
5244         if (k0 == 3) {
5245           for (int k1 = 0; k1 < ndepth; k1++) {
5246             // k2: 0-81
5247             for (int k2 = 0; k2 < neta; k2++) {
5248               //          int k2plot = k2-41;int kkk = k2; if(k2plot >0 ) kkk=k2+1; //-41 +41 !=0
5249               int k2plot = k2 - 41;
5250               int kkk = k2plot;  // if(k2plot >=0 ) kkk=k2plot+1; //-41 +40 !=0
5251               for (int k3 = 0; k3 < nphi; k3++) {
5252                 if (k1 == 0) {
5253                   h_recSignalEnergy0_HF1->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5254                   h_recSignalEnergy1_HF1->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5255                   h_recSignalEnergy2_HF1->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5256                   h_recNoiseEnergy0_HF1->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5257                   h_recNoiseEnergy1_HF1->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5258                   h_recNoiseEnergy2_HF1->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5259                 }
5260                 if (k1 == 1) {
5261                   h_recSignalEnergy0_HF2->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5262                   h_recSignalEnergy1_HF2->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5263                   h_recSignalEnergy2_HF2->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5264                   h_recNoiseEnergy0_HF2->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5265                   h_recNoiseEnergy1_HF2->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5266                   h_recNoiseEnergy2_HF2->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5267                 }
5268                 // AZ 31.10.2021: k1=3 and 4 added for HF recoSignal,recNoise
5269                 if (k1 == 2) {
5270                   h_recSignalEnergy0_HF3->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5271                   h_recSignalEnergy1_HF3->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5272                   h_recSignalEnergy2_HF3->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5273                   h_recNoiseEnergy0_HF3->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5274                   h_recNoiseEnergy1_HF3->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5275                   h_recNoiseEnergy2_HF3->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5276                 }
5277                 if (k1 == 3) {
5278                   h_recSignalEnergy0_HF4->Fill(double(kkk), double(k3), recSignalEnergy0[k0][k1][k2][k3]);
5279                   h_recSignalEnergy1_HF4->Fill(double(kkk), double(k3), recSignalEnergy1[k0][k1][k2][k3]);
5280                   h_recSignalEnergy2_HF4->Fill(double(kkk), double(k3), recSignalEnergy2[k0][k1][k2][k3]);
5281                   h_recNoiseEnergy0_HF4->Fill(double(kkk), double(k3), recNoiseEnergy0[k0][k1][k2][k3]);
5282                   h_recNoiseEnergy1_HF4->Fill(double(kkk), double(k3), recNoiseEnergy1[k0][k1][k2][k3]);
5283                   h_recNoiseEnergy2_HF4->Fill(double(kkk), double(k3), recNoiseEnergy2[k0][k1][k2][k3]);
5284                 }
5285               }  //k3
5286             }  //k2
5287           }  //k1
5288         }  //if k0 == 3 HF
5289 
5290       }  //k0
5291 
5292     }  // if(flagIterativeMethodCalibrationGroupReco
5293 
5294     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////   END PHY-SYMMERTY for calibration group
5295 
5296     //////////////////////////////////////////////////////
5297     if (flagLaserRaddam_ > 1) {
5298       ////////////////////////////////////////////////////// RADDAM treatment:
5299       for (int k1 = 0; k1 < ndepth; k1++) {
5300         for (int k2 = 0; k2 < neta; k2++) {
5301           for (int k3 = 0; k3 < nphi; k3++) {
5302             if (mapRADDAM0_HE[k1][k2][k3] != 0) {
5303               // ----------------------------------------    D2 sum over phi before!!! any dividing:
5304               mapRADDAM_HED2[k1][k2] += mapRADDAM_HE[k1][k2][k3];
5305               // N phi sectors w/ digihits
5306               ++mapRADDAM_HED20[k1][k2];
5307             }  //if
5308           }  //for
5309         }  //for
5310       }  //for
5311 
5312       //////////////---------------------------------------------------------------------------------  2D treatment, zraddam2.cc script
5313       for (int k1 = 0; k1 < ndepth; k1++) {
5314         for (int k2 = 0; k2 < neta; k2++) {
5315           if (mapRADDAM_HED20[k1][k2] != 0) {
5316             // validation of channels at eta16:
5317             if (k1 == 2 && k2 == 25) {
5318               h_sumphiEta16Depth3RADDAM_HED2->Fill(mapRADDAM_HED2[k1][k2]);
5319               h_Eta16Depth3RADDAM_HED2->Fill(mapRADDAM_HED2[k1][k2] / mapRADDAM_HED20[k1][k2]);
5320               h_NphiForEta16Depth3RADDAM_HED2->Fill(mapRADDAM_HED20[k1][k2]);
5321             } else if (k1 == 2 && k2 == 56) {
5322               h_sumphiEta16Depth3RADDAM_HED2P->Fill(mapRADDAM_HED2[k1][k2]);
5323               h_Eta16Depth3RADDAM_HED2P->Fill(mapRADDAM_HED2[k1][k2] / mapRADDAM_HED20[k1][k2]);
5324               h_NphiForEta16Depth3RADDAM_HED2P->Fill(mapRADDAM_HED20[k1][k2]);
5325             } else {
5326               h_sumphiEta16Depth3RADDAM_HED2ALL->Fill(mapRADDAM_HED2[k1][k2]);
5327               h_Eta16Depth3RADDAM_HED2ALL->Fill(mapRADDAM_HED2[k1][k2] / mapRADDAM_HED20[k1][k2]);
5328               h_NphiForEta16Depth3RADDAM_HED2ALL->Fill(mapRADDAM_HED20[k1][k2]);
5329             }
5330             //////////////-----------------------  aver per N-phi_sectors ???
5331             mapRADDAM_HED2[k1][k2] /= mapRADDAM_HED20[k1][k2];
5332           }  // if(mapRADDAM_HED20[k1][k2] != 0
5333         }  //for
5334       }  //for
5335       ///////////////////////////////////////////
5336       for (int k1 = 0; k1 < ndepth; k1++) {
5337         for (int k2 = 0; k2 < neta; k2++) {
5338           if (k1 == 2 && (k2 == 25 || k2 == 56)) {
5339           } else {
5340             //  if(k2!=25 && k2!=56) {
5341             int k2plot = k2 - 41;
5342             int kkk = k2;
5343             if (k2plot > 0)
5344               kkk = k2 + 1;
5345             int kk2 = 25;
5346             if (k2plot > 0)
5347               kk2 = 56;
5348             if (mapRADDAM_HED2[k1][k2] != 0. && mapRADDAM_HED2[2][kk2] != 0) {
5349               mapRADDAM_HED2[k1][k2] /= mapRADDAM_HED2[2][kk2];
5350               // (d1 & eta 17-29)                       L1
5351               int LLLLLL111111 = 0;
5352               if ((k1 == 0 && std::abs(kkk - 41) > 16 && std::abs(kkk - 41) < 30))
5353                 LLLLLL111111 = 1;
5354               // (d2 & eta 17-26) && (d3 & eta 27-28)   L2
5355               int LLLLLL222222 = 0;
5356               if ((k1 == 1 && std::abs(kkk - 41) > 16 && std::abs(kkk - 41) < 27) ||
5357                   (k1 == 2 && std::abs(kkk - 41) > 26 && std::abs(kkk - 41) < 29))
5358                 LLLLLL222222 = 1;
5359               //
5360               if (LLLLLL111111 == 1) {
5361                 h_sigLayer1RADDAM5_HED2->Fill(double(kkk - 41), mapRADDAM_HED2[k1][k2]);
5362                 h_sigLayer1RADDAM6_HED2->Fill(double(kkk - 41), 1.);
5363               }
5364               if (LLLLLL222222 == 1) {
5365                 h_sigLayer2RADDAM5_HED2->Fill(double(kkk - 41), mapRADDAM_HED2[k1][k2]);
5366                 h_sigLayer2RADDAM6_HED2->Fill(double(kkk - 41), 1.);
5367               }
5368             }  //if
5369           }  // if(k2!=25 && k2!=56
5370         }  //for
5371       }  //for
5372 
5373       //////////////---------------------------------------------------------------------------------  3D treatment, zraddam1.cc script
5374 
5375       //------------------------------------------------------        aver per eta 16(depth=3-> k1=2, k2=16(15) :
5376       //////////// k1(depth-1): = 0 - 6 or depth: = 1 - 7;
5377       for (int k1 = 0; k1 < ndepth; k1++) {
5378         for (int k2 = 0; k2 < neta; k2++) {
5379           if (k1 == 2 && (k2 == 25 || k2 == 56)) {
5380           } else {
5381             int k2plot = k2 - 41;
5382             int kk2 = 25;
5383             if (k2plot > 0)
5384               kk2 = 56;
5385             int kkk = k2;
5386             if (k2plot > 0)
5387               kkk = k2 + 1;
5388             for (int k3 = 0; k3 < nphi; k3++) {
5389               if (mapRADDAM_HE[k1][k2][k3] != 0. && mapRADDAM_HE[2][kk2][k3] != 0) {
5390                 mapRADDAM_HE[k1][k2][k3] /= mapRADDAM_HE[2][kk2][k3];
5391                 int LLLLLL111111 = 0;
5392                 if ((k1 == 0 && std::abs(kkk - 41) > 16 && std::abs(kkk - 41) < 30))
5393                   LLLLLL111111 = 1;
5394                 int LLLLLL222222 = 0;
5395                 if ((k1 == 1 && std::abs(kkk - 41) > 16 && std::abs(kkk - 41) < 27) ||
5396                     (k1 == 2 && std::abs(kkk - 41) > 26 && std::abs(kkk - 41) < 29))
5397                   LLLLLL222222 = 1;
5398                 if (LLLLLL111111 == 1) {
5399                   h_sigLayer1RADDAM5_HE->Fill(double(kkk - 41), mapRADDAM_HE[k1][k2][k3]);
5400                   h_sigLayer1RADDAM6_HE->Fill(double(kkk - 41), 1.);
5401                 }
5402                 if (LLLLLL222222 == 1) {
5403                   h_sigLayer2RADDAM5_HE->Fill(double(kkk - 41), mapRADDAM_HE[k1][k2][k3]);
5404                   h_sigLayer2RADDAM6_HE->Fill(double(kkk - 41), 1.);
5405                 }
5406               }  //if
5407             }  //for
5408           }  // if(k2!=25 && k2!=56
5409         }  //for
5410       }  //for
5411       //
5412       ////////////////////////////////////////////////////////////////////////////////////////////////
5413       for (int k1 = 0; k1 < ndepth; k1++) {
5414         for (int k2 = 0; k2 < neta; k2++) {
5415           mapRADDAM_HED2[k1][k2] = 0.;
5416           mapRADDAM_HED20[k1][k2] = 0.;
5417           for (int k3 = 0; k3 < nphi; k3++) {
5418             mapRADDAM_HE[k1][k2][k3] = 0.;
5419             mapRADDAM0_HE[k1][k2][k3] = 0;
5420           }  //for
5421         }  //for
5422       }  //for
5423 
5424       //////////////////////////////////END of RADDAM treatment:
5425     }  // END TREATMENT : if(flagLaserRaddam_ == 1
5426     //////////////////////////////////////////////////////////////////////////
5427 
5428     //////////////////////////////////////////////////////////////////////////
5429     //    //      //      //      //      //      //sumamplitudes:
5430     ////////////////////////////////////////  // k0, k2, k3 loops LOOPS  //////////   /////  ///// NO k1 loop over depthes !!!
5431     for (int k0 = 0; k0 < nsub; k0++) {
5432       int sumofchannels = 0;
5433       double sumamplitudesubdet = 0.;
5434       int sumofchannels0 = 0;
5435       double sumamplitudesubdet0 = 0.;
5436       for (int k2 = 0; k2 < neta; k2++) {
5437         for (int k3 = 0; k3 < nphi; k3++) {
5438           // HB
5439           if (k0 == 0) {
5440             double sumamplitudechannel_HB = amplitudechannel[k0][0][k2][k3] + amplitudechannel[k0][1][k2][k3];
5441             h_sumamplitudechannel_HB->Fill(sumamplitudechannel_HB);
5442             if (sumamplitudechannel_HB > 80.) {
5443               sumamplitudesubdet += sumamplitudechannel_HB;
5444               sumofchannels++;
5445             } else {
5446               if (sumamplitudechannel_HB > 0.) {
5447                 sumamplitudesubdet0 += sumamplitudechannel_HB;
5448                 sumofchannels0++;
5449               }
5450             }
5451           }  //
5452 
5453           // HE
5454           if (k0 == 1) {
5455             double sumamplitudechannel_HE =
5456                 amplitudechannel[k0][0][k2][k3] + amplitudechannel[k0][1][k2][k3] + amplitudechannel[k0][2][k2][k3];
5457             h_sumamplitudechannel_HE->Fill(sumamplitudechannel_HE);
5458             if (sumamplitudechannel_HE > 200.) {
5459               sumamplitudesubdet += sumamplitudechannel_HE;
5460               sumofchannels++;
5461             } else {
5462               if (sumamplitudechannel_HE > 0.) {
5463                 sumamplitudesubdet0 += sumamplitudechannel_HE;
5464                 sumofchannels0++;
5465               }
5466             }
5467           }  //
5468 
5469           // HO
5470           if (k0 == 2) {
5471             double sumamplitudechannel_HO = amplitudechannel[k0][3][k2][k3];
5472             h_sumamplitudechannel_HO->Fill(sumamplitudechannel_HO);
5473             if (sumamplitudechannel_HO > 1200.) {
5474               sumamplitudesubdet += sumamplitudechannel_HO;
5475               sumofchannels++;
5476             } else {
5477               if (sumamplitudechannel_HO > 0.) {
5478                 sumamplitudesubdet0 += sumamplitudechannel_HO;
5479                 sumofchannels0++;
5480               }
5481             }
5482           }  //
5483           // HF
5484           if (k0 == 3) {
5485             double sumamplitudechannel_HF = amplitudechannel[k0][0][k2][k3] + amplitudechannel[k0][1][k2][k3];
5486             h_sumamplitudechannel_HF->Fill(sumamplitudechannel_HF);
5487             if (sumamplitudechannel_HF > 600.) {
5488               sumamplitudesubdet += sumamplitudechannel_HF;
5489               sumofchannels++;
5490             } else {
5491               if (sumamplitudechannel_HF > 0.) {
5492                 sumamplitudesubdet0 += sumamplitudechannel_HF;
5493                 sumofchannels0++;
5494               }
5495             }
5496           }  //
5497 
5498         }  //k3
5499       }  //k2
5500       //  }//k1
5501       // SA of each sub-detector DONE. Then: summarize or find maximum throught events of LS
5502       if (k0 == 0) {
5503         h_eventamplitude_HB->Fill((sumamplitudesubdet + sumamplitudesubdet0));
5504         h_eventoccupancy_HB->Fill((sumofchannels + sumofchannels0));
5505         if ((sumamplitudesubdet + sumamplitudesubdet0) > maxxSUM1)
5506           maxxSUM1 = sumamplitudesubdet + sumamplitudesubdet0;
5507         if ((sumofchannels + sumofchannels0) > maxxOCCUP1)
5508           maxxOCCUP1 = sumofchannels + sumofchannels0;
5509         averSIGNALoccupancy_HB += sumofchannels;
5510         averSIGNALsumamplitude_HB += sumamplitudesubdet;
5511         averNOSIGNALoccupancy_HB += sumofchannels0;
5512         averNOSIGNALsumamplitude_HB += sumamplitudesubdet0;
5513         if ((sumamplitudesubdet + sumamplitudesubdet0) > 60000) {
5514           for (int k2 = 0; k2 < neta; k2++) {
5515             for (int k3 = 0; k3 < nphi; k3++) {
5516               int ieta = k2 - 41;
5517               /// HB depth1:
5518               if (amplitudechannel[k0][0][k2][k3] != 0.) {
5519                 h_2DAtaildepth1_HB->Fill(double(ieta), double(k3), amplitudechannel[k0][0][k2][k3]);
5520                 h_2D0Ataildepth1_HB->Fill(double(ieta), double(k3), 1.);
5521               }
5522               /// HB depth2:
5523               if (amplitudechannel[k0][1][k2][k3] != 0.) {
5524                 h_2DAtaildepth2_HB->Fill(double(ieta), double(k3), amplitudechannel[k0][1][k2][k3]);
5525                 h_2D0Ataildepth2_HB->Fill(double(ieta), double(k3), 1.);
5526               }
5527             }  //for
5528           }  //for
5529         }  //>60000
5530       }  //HB
5531       if (k0 == 1) {
5532         h_eventamplitude_HE->Fill((sumamplitudesubdet + sumamplitudesubdet0));
5533         h_eventoccupancy_HE->Fill((sumofchannels + sumofchannels0));
5534         if ((sumamplitudesubdet + sumamplitudesubdet0) > maxxSUM2)
5535           maxxSUM2 = sumamplitudesubdet + sumamplitudesubdet0;
5536         if ((sumofchannels + sumofchannels0) > maxxOCCUP2)
5537           maxxOCCUP2 = sumofchannels + sumofchannels0;
5538         averSIGNALoccupancy_HE += sumofchannels;
5539         averSIGNALsumamplitude_HE += sumamplitudesubdet;
5540         averNOSIGNALoccupancy_HE += sumofchannels0;
5541         averNOSIGNALsumamplitude_HE += sumamplitudesubdet0;
5542       }  //HE
5543       if (k0 == 2) {
5544         h_eventamplitude_HO->Fill((sumamplitudesubdet + sumamplitudesubdet0));
5545         h_eventoccupancy_HO->Fill((sumofchannels + sumofchannels0));
5546         if ((sumamplitudesubdet + sumamplitudesubdet0) > maxxSUM3)
5547           maxxSUM3 = sumamplitudesubdet + sumamplitudesubdet0;
5548         if ((sumofchannels + sumofchannels0) > maxxOCCUP3)
5549           maxxOCCUP3 = sumofchannels + sumofchannels0;
5550         averSIGNALoccupancy_HO += sumofchannels;
5551         averSIGNALsumamplitude_HO += sumamplitudesubdet;
5552         averNOSIGNALoccupancy_HO += sumofchannels0;
5553         averNOSIGNALsumamplitude_HO += sumamplitudesubdet0;
5554       }  //HO
5555       if (k0 == 3) {
5556         h_eventamplitude_HF->Fill((sumamplitudesubdet + sumamplitudesubdet0));
5557         h_eventoccupancy_HF->Fill((sumofchannels + sumofchannels0));
5558         if ((sumamplitudesubdet + sumamplitudesubdet0) > maxxSUM4)
5559           maxxSUM4 = sumamplitudesubdet + sumamplitudesubdet0;
5560         if ((sumofchannels + sumofchannels0) > maxxOCCUP4)
5561           maxxOCCUP4 = sumofchannels + sumofchannels0;
5562         averSIGNALoccupancy_HF += sumofchannels;
5563         averSIGNALsumamplitude_HF += sumamplitudesubdet;
5564         averNOSIGNALoccupancy_HF += sumofchannels0;
5565         averNOSIGNALsumamplitude_HF += sumamplitudesubdet0;
5566       }  //HF
5567     }  //k0
5568 
5569     ///////////////////// ///////////////////// //////////////////////////////////////////
5570     ///////////////////////////////////////////////  for zRunRatio34.C & zRunNbadchan.C scripts:
5571     if (recordHistoes_ && studyRunDependenceHist_) {
5572       int eeeeee;
5573       eeeeee = lscounterM1;
5574       if (flagtoaskrunsorls_ == 0)
5575         eeeeee = runcounter;
5576 
5577       //////////// k0(sub): =0 HB; =1 HE; =2 HO; =3 HF;
5578       for (int k0 = 0; k0 < nsub; k0++) {
5579         //////////// k1(depth-1): = 0 - 3 or depth: = 1 - 4;
5580         //////////// for upgrade    k1(depth-1): = 0 - 6 or depth: = 1 - 7;
5581         for (int k1 = 0; k1 < ndepth; k1++) {
5582           //////////
5583           int nbadchannels = 0;
5584           for (int k2 = 0; k2 < neta; k2++) {
5585             for (int k3 = 0; k3 < nphi; k3++) {
5586               if (badchannels[k0][k1][k2][k3] != 0)
5587                 ++nbadchannels;
5588             }  //k3
5589           }  //k2
5590           //////////
5591           //HB
5592           if (k0 == 0) {
5593             if (k1 == 0) {
5594               h_nbadchannels_depth1_HB->Fill(float(nbadchannels));
5595               h_runnbadchannels_depth1_HB->Fill(float(eeeeee), float(nbadchannels));
5596               if (nbadchannels > lsdep_cut1_peak_HBdepth1_)
5597                 h_runnbadchannelsC_depth1_HB->Fill(float(eeeeee), float(nbadchannels));
5598               if (nbadchannels != 0)
5599                 h_runbadrate_depth1_HB->Fill(float(eeeeee), 1.);
5600               if (nbadchannels > lsdep_cut3_max_HBdepth1_)
5601                 h_runbadrateC_depth1_HB->Fill(float(eeeeee), 1.);
5602               h_bcnnbadchannels_depth1_HB->Fill(float(bcn), float(nbadchannels));
5603               h_runbadrate0_depth1_HB->Fill(float(eeeeee), 1.);
5604               h_bcnbadrate0_depth1_HB->Fill(float(bcn), 1.);
5605             }
5606             if (k1 == 1) {
5607               h_nbadchannels_depth2_HB->Fill(float(nbadchannels));
5608               h_runnbadchannels_depth2_HB->Fill(float(eeeeee), float(nbadchannels));
5609               if (nbadchannels > lsdep_cut1_peak_HBdepth2_)
5610                 h_runnbadchannelsC_depth2_HB->Fill(float(eeeeee), float(nbadchannels));
5611               if (nbadchannels != 0)
5612                 h_runbadrate_depth2_HB->Fill(float(eeeeee), 1.);
5613               if (nbadchannels > lsdep_cut3_max_HBdepth2_)
5614                 h_runbadrateC_depth2_HB->Fill(float(eeeeee), 1.);
5615               h_bcnnbadchannels_depth2_HB->Fill(float(bcn), float(nbadchannels));
5616               h_runbadrate0_depth2_HB->Fill(float(eeeeee), 1.);
5617               h_bcnbadrate0_depth2_HB->Fill(float(bcn), 1.);
5618             }
5619             if (k1 == 2) {
5620               h_nbadchannels_depth3_HB->Fill(float(nbadchannels));
5621               h_runnbadchannels_depth3_HB->Fill(float(eeeeee), float(nbadchannels));
5622               if (nbadchannels > 0.)
5623                 h_runnbadchannelsC_depth3_HB->Fill(float(eeeeee), float(nbadchannels));
5624               if (nbadchannels != 0)
5625                 h_runbadrate_depth3_HB->Fill(float(eeeeee), 1.);
5626               if (nbadchannels > 0.)
5627                 h_runbadrateC_depth3_HB->Fill(float(eeeeee), 1.);
5628               h_runbadrate0_depth3_HB->Fill(float(eeeeee), 1.);
5629             }
5630             if (k1 == 3) {
5631               h_nbadchannels_depth4_HB->Fill(float(nbadchannels));
5632               h_runnbadchannels_depth4_HB->Fill(float(eeeeee), float(nbadchannels));
5633               if (nbadchannels > 0.)
5634                 h_runnbadchannelsC_depth4_HB->Fill(float(eeeeee), float(nbadchannels));
5635               if (nbadchannels != 0)
5636                 h_runbadrate_depth4_HB->Fill(float(eeeeee), 1.);
5637               if (nbadchannels > 0.)
5638                 h_runbadrateC_depth4_HB->Fill(float(eeeeee), 1.);
5639               h_runbadrate0_depth4_HB->Fill(float(eeeeee), 1.);
5640             }
5641           }  ////if(k0 == 0)
5642           //HE
5643           if (k0 == 1) {
5644             if (k1 == 0) {
5645               h_nbadchannels_depth1_HE->Fill(float(nbadchannels));
5646               h_runnbadchannels_depth1_HE->Fill(float(eeeeee), float(nbadchannels));
5647               if (nbadchannels > lsdep_cut1_peak_HEdepth1_)
5648                 h_runnbadchannelsC_depth1_HE->Fill(float(eeeeee), float(nbadchannels));
5649               if (nbadchannels != 0)
5650                 h_runbadrate_depth1_HE->Fill(float(eeeeee), 1.);
5651               if (nbadchannels > lsdep_cut3_max_HEdepth1_)
5652                 h_runbadrateC_depth1_HE->Fill(float(eeeeee), 1.);
5653               h_bcnnbadchannels_depth1_HE->Fill(float(bcn), float(nbadchannels));
5654               h_runbadrate0_depth1_HE->Fill(float(eeeeee), 1.);
5655               h_bcnbadrate0_depth1_HE->Fill(float(bcn), 1.);
5656             }
5657             if (k1 == 1) {
5658               h_nbadchannels_depth2_HE->Fill(float(nbadchannels));
5659               h_runnbadchannels_depth2_HE->Fill(float(eeeeee), float(nbadchannels));
5660               if (nbadchannels > lsdep_cut1_peak_HEdepth2_)
5661                 h_runnbadchannelsC_depth2_HE->Fill(float(eeeeee), float(nbadchannels));
5662               if (nbadchannels != 0)
5663                 h_runbadrate_depth2_HE->Fill(float(eeeeee), 1.);
5664               if (nbadchannels > lsdep_cut3_max_HEdepth2_)
5665                 h_runbadrateC_depth2_HE->Fill(float(eeeeee), 1.);
5666               h_bcnnbadchannels_depth2_HE->Fill(float(bcn), float(nbadchannels));
5667               h_runbadrate0_depth2_HE->Fill(float(eeeeee), 1.);
5668               h_bcnbadrate0_depth2_HE->Fill(float(bcn), 1.);
5669             }
5670             if (k1 == 2) {
5671               h_nbadchannels_depth3_HE->Fill(float(nbadchannels));
5672               h_runnbadchannels_depth3_HE->Fill(float(eeeeee), float(nbadchannels));
5673               if (nbadchannels > lsdep_cut1_peak_HEdepth3_)
5674                 h_runnbadchannelsC_depth3_HE->Fill(float(eeeeee), float(nbadchannels));
5675               if (nbadchannels != 0)
5676                 h_runbadrate_depth3_HE->Fill(float(eeeeee), 1.);
5677               if (nbadchannels > lsdep_cut3_max_HEdepth3_)
5678                 h_runbadrateC_depth3_HE->Fill(float(eeeeee), 1.);
5679               h_bcnnbadchannels_depth3_HE->Fill(float(bcn), float(nbadchannels));
5680               h_runbadrate0_depth3_HE->Fill(float(eeeeee), 1.);
5681               h_bcnbadrate0_depth3_HE->Fill(float(bcn), 1.);
5682             }
5683             if (k1 == 3) {
5684               h_nbadchannels_depth4_HE->Fill(float(nbadchannels));
5685               h_runnbadchannels_depth4_HE->Fill(float(eeeeee), float(nbadchannels));
5686               if (nbadchannels > 0.)
5687                 h_runnbadchannelsC_depth4_HE->Fill(float(eeeeee), float(nbadchannels));
5688               if (nbadchannels != 0)
5689                 h_runbadrate_depth4_HE->Fill(float(eeeeee), 1.);
5690               if (nbadchannels > 0.)
5691                 h_runbadrateC_depth4_HE->Fill(float(eeeeee), 1.);
5692               h_runbadrate0_depth4_HE->Fill(float(eeeeee), 1.);
5693             }
5694             if (k1 == 4) {
5695               h_nbadchannels_depth5_HE->Fill(float(nbadchannels));
5696               h_runnbadchannels_depth5_HE->Fill(float(eeeeee), float(nbadchannels));
5697               if (nbadchannels > 0.)
5698                 h_runnbadchannelsC_depth5_HE->Fill(float(eeeeee), float(nbadchannels));
5699               if (nbadchannels != 0)
5700                 h_runbadrate_depth5_HE->Fill(float(eeeeee), 1.);
5701               if (nbadchannels > 0.)
5702                 h_runbadrateC_depth5_HE->Fill(float(eeeeee), 1.);
5703               h_runbadrate0_depth5_HE->Fill(float(eeeeee), 1.);
5704             }
5705             if (k1 == 5) {
5706               h_nbadchannels_depth6_HE->Fill(float(nbadchannels));
5707               h_runnbadchannels_depth6_HE->Fill(float(eeeeee), float(nbadchannels));
5708               if (nbadchannels > 0.)
5709                 h_runnbadchannelsC_depth6_HE->Fill(float(eeeeee), float(nbadchannels));
5710               if (nbadchannels != 0)
5711                 h_runbadrate_depth6_HE->Fill(float(eeeeee), 1.);
5712               if (nbadchannels > 0.)
5713                 h_runbadrateC_depth6_HE->Fill(float(eeeeee), 1.);
5714               h_runbadrate0_depth6_HE->Fill(float(eeeeee), 1.);
5715             }
5716             if (k1 == 6) {
5717               h_nbadchannels_depth7_HE->Fill(float(nbadchannels));
5718               h_runnbadchannels_depth7_HE->Fill(float(eeeeee), float(nbadchannels));
5719               if (nbadchannels > 0.)
5720                 h_runnbadchannelsC_depth7_HE->Fill(float(eeeeee), float(nbadchannels));
5721               if (nbadchannels != 0)
5722                 h_runbadrate_depth7_HE->Fill(float(eeeeee), 1.);
5723               if (nbadchannels > 0.)
5724                 h_runbadrateC_depth7_HE->Fill(float(eeeeee), 1.);
5725               h_runbadrate0_depth7_HE->Fill(float(eeeeee), 1.);
5726             }
5727           }  ////if(k0 == 1)
5728           //HO
5729           if (k0 == 2) {
5730             if (k1 == 3) {
5731               h_nbadchannels_depth4_HO->Fill(float(nbadchannels));
5732               h_runnbadchannels_depth4_HO->Fill(float(eeeeee), float(nbadchannels));
5733               if (nbadchannels > lsdep_cut1_peak_HOdepth4_)
5734                 h_runnbadchannelsC_depth4_HO->Fill(float(eeeeee), float(nbadchannels));
5735               if (nbadchannels != 0)
5736                 h_runbadrate_depth4_HO->Fill(float(eeeeee), 1.);
5737               if (nbadchannels > lsdep_cut3_max_HOdepth4_)
5738                 h_runbadrateC_depth4_HO->Fill(float(eeeeee), 1.);
5739               h_bcnnbadchannels_depth4_HO->Fill(float(bcn), float(nbadchannels));
5740               h_runbadrate0_depth4_HO->Fill(float(eeeeee), 1.);
5741               h_bcnbadrate0_depth4_HO->Fill(float(bcn), 1.);
5742             }
5743           }  ////if(k0 == 2)
5744           //HF
5745           if (k0 == 3) {
5746             if (k1 == 0) {
5747               h_nbadchannels_depth1_HF->Fill(float(nbadchannels));
5748               h_runnbadchannels_depth1_HF->Fill(float(eeeeee), float(nbadchannels));
5749               if (nbadchannels > lsdep_cut1_peak_HFdepth1_)
5750                 h_runnbadchannelsC_depth1_HF->Fill(float(eeeeee), float(nbadchannels));
5751               if (nbadchannels != 0)
5752                 h_runbadrate_depth1_HF->Fill(float(eeeeee), 1.);
5753               if (nbadchannels > lsdep_cut3_max_HFdepth1_)
5754                 h_runbadrateC_depth1_HF->Fill(float(eeeeee), 1.);
5755               h_bcnnbadchannels_depth1_HF->Fill(float(bcn), float(nbadchannels));
5756               h_runbadrate0_depth1_HF->Fill(float(eeeeee), 1.);
5757               h_bcnbadrate0_depth1_HF->Fill(float(bcn), 1.);
5758             }
5759             if (k1 == 1) {
5760               h_nbadchannels_depth2_HF->Fill(float(nbadchannels));
5761               h_runnbadchannels_depth2_HF->Fill(float(eeeeee), float(nbadchannels));
5762               if (nbadchannels > lsdep_cut1_peak_HFdepth2_)
5763                 h_runnbadchannelsC_depth2_HF->Fill(float(eeeeee), float(nbadchannels));
5764               if (nbadchannels != 0)
5765                 h_runbadrate_depth2_HF->Fill(float(eeeeee), 1.);
5766               if (nbadchannels > lsdep_cut3_max_HFdepth2_)
5767                 h_runbadrateC_depth2_HF->Fill(float(eeeeee), 1.);
5768               h_bcnnbadchannels_depth2_HF->Fill(float(bcn), float(nbadchannels));
5769               h_runbadrate0_depth2_HF->Fill(float(eeeeee), 1.);
5770               h_bcnbadrate0_depth2_HF->Fill(float(bcn), 1.);
5771             }
5772             if (k1 == 2) {
5773               h_nbadchannels_depth3_HF->Fill(float(nbadchannels));
5774               h_runnbadchannels_depth3_HF->Fill(float(eeeeee), float(nbadchannels));
5775               if (nbadchannels > 0.)
5776                 h_runnbadchannelsC_depth3_HF->Fill(float(eeeeee), float(nbadchannels));
5777               if (nbadchannels != 0)
5778                 h_runbadrate_depth3_HF->Fill(float(eeeeee), 1.);
5779               if (nbadchannels > 0.)
5780                 h_runbadrateC_depth3_HF->Fill(float(eeeeee), 1.);
5781               h_runbadrate0_depth3_HF->Fill(float(eeeeee), 1.);
5782             }
5783             if (k1 == 3) {
5784               h_nbadchannels_depth4_HF->Fill(float(nbadchannels));
5785               h_runnbadchannels_depth4_HF->Fill(float(eeeeee), float(nbadchannels));
5786               if (nbadchannels > 0.)
5787                 h_runnbadchannelsC_depth4_HF->Fill(float(eeeeee), float(nbadchannels));
5788               if (nbadchannels != 0)
5789                 h_runbadrate_depth4_HF->Fill(float(eeeeee), 1.);
5790               if (nbadchannels > 0.)
5791                 h_runbadrateC_depth4_HF->Fill(float(eeeeee), 1.);
5792               h_runbadrate0_depth4_HF->Fill(float(eeeeee), 1.);
5793             }
5794           }  ////if(k0 == 3)
5795 
5796           //////////
5797         }  //k1
5798       }  //k0
5799       ////////////
5800     }  //if(recordHistoes_&& studyRunDependenceHist_)
5801 
5802     /////////////////////////////////////////////////////////////////////////////////////// HcalCalibDigiCollection
5803     edm::Handle<HcalCalibDigiCollection> calib;
5804     iEvent.getByToken(tok_calib_, calib);
5805 
5806     bool gotCALIBDigis = true;
5807     if (!(iEvent.getByToken(tok_calib_, calib))) {
5808       gotCALIBDigis = false;  //this is a boolean set up to check if there are CALIBgigis in input root file
5809     }
5810     if (!(calib.isValid())) {
5811       gotCALIBDigis = false;  //if it is not there, leave it false
5812     }
5813     if (!gotCALIBDigis) {
5814     } else {
5815       for (HcalCalibDigiCollection::const_iterator digi = calib->begin(); digi != calib->end(); digi++) {
5816         int cal_det = digi->id().hcalSubdet();  // 1-HB,2-HE,3-HO,4-HF
5817         int cal_phi = digi->id().iphi();
5818         int cal_eta = digi->id().ieta();
5819         int cal_cbox = digi->id().cboxChannel();
5820 
5821         /////////////////////////////////////////////
5822         if (recordHistoes_ && studyCalibCellsHist_) {
5823           if (cal_det > 0 && cal_det < 5 && cal_cbox == 0) {
5824             int iphi = cal_phi - 1;
5825             int ieta = cal_eta;
5826             if (ieta > 0)
5827               ieta -= 1;
5828             nTS = digi->size();
5829             double max_signal = -100.;
5830             int ts_with_max_signal = -100;
5831             double timew = 0.;
5832 
5833             //
5834             if (nTS <= numOfTS)
5835               for (int i = 0; i < nTS; i++) {
5836                 double ampldefault = adc2fC[digi->sample(i).adc() & 0xff];
5837                 if (max_signal < ampldefault) {
5838                   max_signal = ampldefault;
5839                   ts_with_max_signal = i;
5840                 }
5841                 if (i > 1 && i < 6)
5842                   calib3[cal_det - 1][ieta + 41][iphi] += ampldefault;
5843                 calib0[cal_det - 1][ieta + 41][iphi] += ampldefault;
5844                 timew += (i + 1) * ampldefault;
5845               }  // for
5846             //
5847 
5848             double amplitude = calib0[cal_det - 1][ieta + 41][iphi];
5849             double aveamplitude = -100.;
5850             if (amplitude > 0 && timew > 0)
5851               aveamplitude = timew / amplitude;       // average_TS +1
5852             double aveamplitude1 = aveamplitude - 1;  // means iTS=0-9
5853             caliba[cal_det - 1][ieta + 41][iphi] = aveamplitude1;
5854 
5855             double rmsamp = 0.;
5856             for (int ii = 0; ii < nTS; ii++) {
5857               double ampldefault = adc2fC[digi->sample(ii).adc() & 0xff];
5858               double aaaaaa = (ii + 1) - aveamplitude;
5859               double aaaaaa2 = aaaaaa * aaaaaa;
5860               rmsamp += (aaaaaa2 * ampldefault);  // fC
5861             }  //for 2
5862             double rmsamplitude = -100.;
5863             if ((amplitude > 0 && rmsamp > 0) || (amplitude < 0 && rmsamp < 0))
5864               rmsamplitude = sqrt(rmsamp / amplitude);
5865             calibw[cal_det - 1][ieta + 41][iphi] = rmsamplitude;
5866             //
5867             calibt[cal_det - 1][ieta + 41][iphi] = ts_with_max_signal;
5868             //
5869 
5870             if (ts_with_max_signal > -1 && ts_with_max_signal < nTS)
5871               calib2[cal_det - 1][ieta + 41][iphi] = adc2fC[digi->sample(ts_with_max_signal).adc() & 0xff];
5872             if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < nTS)
5873               calib2[cal_det - 1][ieta + 41][iphi] += adc2fC[digi->sample(ts_with_max_signal + 1).adc() & 0xff];
5874             if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < nTS)
5875               calib2[cal_det - 1][ieta + 41][iphi] += adc2fC[digi->sample(ts_with_max_signal + 2).adc() & 0xff];
5876             if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < nTS)
5877               calib2[cal_det - 1][ieta + 41][iphi] += adc2fC[digi->sample(ts_with_max_signal - 1).adc() & 0xff];
5878             if (ts_with_max_signal - 2 > -1 && ts_with_max_signal - 2 < nTS)
5879               calib2[cal_det - 1][ieta + 41][iphi] += adc2fC[digi->sample(ts_with_max_signal - 2).adc() & 0xff];
5880             //
5881             bool anycapid = true;
5882             bool anyer = false;
5883             bool anydv = true;
5884             int error1 = 0, error2 = 0, error3 = 0;
5885             int lastcapid = 0, capid = 0;
5886             for (int ii = 0; ii < (*digi).size(); ii++) {
5887               capid = (*digi)[ii].capid();  // capId (0-3, sequential)
5888               bool er = (*digi)[ii].er();   // error
5889               bool dv = (*digi)[ii].dv();   // valid data
5890               if (ii != 0 && ((lastcapid + 1) % 4) != capid)
5891                 anycapid = false;
5892               lastcapid = capid;
5893               if (er)
5894                 anyer = true;
5895               if (!dv)
5896                 anydv = false;
5897             }
5898             if (!anycapid)
5899               error1 = 1;
5900             if (anyer)
5901               error2 = 1;
5902             if (!anydv)
5903               error3 = 1;
5904             if (error1 != 0 || error2 != 0 || error3 != 0)
5905               calibcapiderror[cal_det - 1][ieta + 41][iphi] = 100;
5906 
5907           }  // if(cal_det>0 && cal_det<5
5908         }  //if(recordHistoes_ && studyCalibCellsHist_)
5909         /////////////////////////////////////////////
5910 
5911         if (recordNtuples_ && nevent50 < maxNeventsInNtuple_) {
5912         }  //if(recordNtuples_) {
5913 
5914       }  //for(HcalCalibDigiCollection
5915     }  //if(calib.isValid(
5916     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5917     if (recordHistoes_ && studyCalibCellsHist_) {
5918       ////////////////////////////////////for loop for zcalib.C and zgain.C scripts:
5919       for (int k1 = 0; k1 < nsub; k1++) {
5920         for (int k2 = 0; k2 < neta; k2++) {
5921           for (int k3 = 0; k3 < nphi; k3++) {
5922             int k2plot = k2 - 41;
5923             if (flagcpuoptimization_ == 0) {
5924               ////////////////////////////////////////////////////////////////  for zgain.C script:
5925 
5926               if (signal[k1][k2][k3] > 0.) {
5927                 if (k1 == 0) {
5928                   h_FullSignal3D_HB->Fill(double(k2plot), double(k3), signal[k1][k2][k3]);
5929                   h_FullSignal3D0_HB->Fill(double(k2plot), double(k3), 1.);
5930                 }
5931                 if (k1 == 1) {
5932                   h_FullSignal3D_HE->Fill(double(k2plot), double(k3), signal[k1][k2][k3]);
5933                   h_FullSignal3D0_HE->Fill(double(k2plot), double(k3), 1.);
5934                 }
5935                 if (k1 == 2) {
5936                   h_FullSignal3D_HO->Fill(double(k2plot), double(k3), signal[k1][k2][k3]);
5937                   h_FullSignal3D0_HO->Fill(double(k2plot), double(k3), 1.);
5938                 }
5939                 if (k1 == 3) {
5940                   h_FullSignal3D_HF->Fill(double(k2plot), double(k3), signal[k1][k2][k3]);
5941                   h_FullSignal3D0_HF->Fill(double(k2plot), double(k3), 1.);
5942                 }
5943               }
5944 
5945             }  // optimization
5946             ////////////////////////////////////////////////////////////////
5947 
5948             ////////////////////////////////////////////////////////////////  for zcalib.C script:
5949             // k2 = 0-81, k3= 0-71
5950             // return to real indexes in eta and phi ( k20 and k30)
5951             int k20 = k2 - 41;  // k20 = -41 - 40
5952             if (k20 > 0 || k20 == 0)
5953               k20 += 1;        // k20 = -41 - -1 and +1 - +41
5954             int k30 = k3 + 1;  // k30= 1-nphi
5955 
5956             // find calibration indexes in eta and phi ( kk2 and kk3)
5957             int kk2 = 0, kk3 = 0;
5958             if (k1 == 0 || k1 == 1) {
5959               if (k20 > 0)
5960                 kk2 = 1;
5961               else
5962                 kk2 = -1;
5963               if (k30 == 71 || k30 == nphi || k30 == 1 || k30 == 2)
5964                 kk3 = 71;
5965               else
5966                 kk3 = ((k30 - 3) / 4) * 4 + 3;
5967             } else if (k1 == 2) {
5968               if (abs(k20) <= 4) {
5969                 kk2 = 0;
5970                 if (k30 == 71 || k30 == nphi || k30 == 1 || k30 == 2 || k30 == 3 || k30 == 4)
5971                   kk3 = 71;
5972                 else
5973                   kk3 = ((k30 - 5) / 6) * 6 + 5;
5974               } else {
5975                 if (abs(k20) > 4 && abs(k20) <= 10)
5976                   kk2 = 1;
5977                 if (abs(k20) > 10 && abs(k20) <= 15)
5978                   kk2 = 2;
5979                 if (k20 < 0)
5980                   kk2 = -kk2;
5981                 if (k30 == 71 || k30 == nphi || (k30 >= 1 && k30 <= 10))
5982                   kk3 = 71;
5983                 else
5984                   kk3 = ((k30 - 11) / 12) * 12 + 11;
5985               }
5986             } else if (k1 == 3) {
5987               if (k20 > 0)
5988                 kk2 = 1;
5989               else
5990                 kk2 = -1;
5991               if (k30 >= 1 && k30 <= 18)
5992                 kk3 = 1;
5993               if (k30 >= 19 && k30 <= 36)
5994                 kk3 = 19;
5995               if (k30 >= 37 && k30 <= 54)
5996                 kk3 = 37;
5997               if (k30 >= 55 && k30 <= nphi)
5998                 kk3 = 55;
5999             }
6000             // return to indexes in massiv
6001             int kkk2 = kk2 + 41;
6002             if (kk2 > 0)
6003               kkk2 -= 1;
6004             int kkk3 = kk3;
6005             kkk3 -= 1;
6006 
6007             if (flagcpuoptimization_ == 0) {
6008               double GetRMSOverNormalizedSignal = -1.;
6009               if (signal[k1][k2][k3] > 0. && calib0[k1][kkk2][kkk3] > 0.) {
6010                 GetRMSOverNormalizedSignal = signal[k1][k2][k3] / calib0[k1][kkk2][kkk3];
6011                 if (k1 == 0) {
6012                   h_mapGetRMSOverNormalizedSignal_HB->Fill(double(k2plot), double(k3), GetRMSOverNormalizedSignal);
6013                   h_mapGetRMSOverNormalizedSignal0_HB->Fill(double(k2plot), double(k3), 1.);
6014                 }
6015                 if (k1 == 1) {
6016                   h_mapGetRMSOverNormalizedSignal_HE->Fill(double(k2plot), double(k3), GetRMSOverNormalizedSignal);
6017                   h_mapGetRMSOverNormalizedSignal0_HE->Fill(double(k2plot), double(k3), 1.);
6018                 }
6019                 if (k1 == 2) {
6020                   h_mapGetRMSOverNormalizedSignal_HO->Fill(double(k2plot), double(k3), GetRMSOverNormalizedSignal);
6021                   h_mapGetRMSOverNormalizedSignal0_HO->Fill(double(k2plot), double(k3), 1.);
6022                 }
6023                 if (k1 == 3) {
6024                   h_mapGetRMSOverNormalizedSignal_HF->Fill(double(k2plot), double(k3), GetRMSOverNormalizedSignal);
6025                   h_mapGetRMSOverNormalizedSignal0_HF->Fill(double(k2plot), double(k3), 1.);
6026                 }
6027               }
6028             }  //optimization
6029             ////////////////////////////////////////////////////////////////  for zcalib....C script:
6030             if (signal[k1][k2][k3] > 0.) {
6031               // ADC
6032               double adc = 0.;
6033               if (calib0[k1][kkk2][kkk3] > 0.)
6034                 adc = calib0[k1][kkk2][kkk3];
6035               // Ratio
6036               double ratio = 2.;
6037               if (calib0[k1][kkk2][kkk3] > 0.)
6038                 ratio = calib2[k1][kkk2][kkk3] / calib0[k1][kkk2][kkk3];
6039               // TSmax
6040               float calibtsmax = calibt[k1][kkk2][kkk3];
6041               // TSmean
6042               float calibtsmean = caliba[k1][kkk2][kkk3];
6043               // Width
6044               float calibwidth = calibw[k1][kkk2][kkk3];
6045               // CapIdErrors
6046               float calibcap = -100.;
6047               calibcap = calibcapiderror[k1][kkk2][kkk3];
6048 
6049               //                 HB:
6050               if (k1 == 0) {
6051                 // ADC
6052                 h_ADCCalib_HB->Fill(adc, 1.);
6053                 h_ADCCalib1_HB->Fill(adc, 1.);
6054                 if (adc < calibrADCHBMin_ || adc > calibrADCHBMax_)
6055                   h_mapADCCalib047_HB->Fill(double(k2plot), double(k3), 1.);
6056                 h_mapADCCalib_HB->Fill(double(k2plot), double(k3), adc);
6057                 // Ratio
6058                 h_RatioCalib_HB->Fill(ratio, 1.);
6059                 if (ratio < calibrRatioHBMin_ || ratio > calibrRatioHBMax_)
6060                   h_mapRatioCalib047_HB->Fill(double(k2plot), double(k3), 1.);
6061                 h_mapRatioCalib_HB->Fill(double(k2plot), double(k3), ratio);
6062                 // TSmax
6063                 if (calibtsmax > -0.5) {
6064                   h_TSmaxCalib_HB->Fill(calibtsmax, 1.);
6065                   if (calibtsmax < calibrTSmaxHBMin_ || calibtsmax > calibrTSmaxHBMax_)
6066                     h_mapTSmaxCalib047_HB->Fill(double(k2plot), double(k3), 1.);
6067                   h_mapTSmaxCalib_HB->Fill(double(k2plot), double(k3), calibtsmax);
6068                 }
6069                 // TSmean
6070                 if (calibtsmean > -0.5) {
6071                   h_TSmeanCalib_HB->Fill(calibtsmean, 1.);
6072                   if (calibtsmean < calibrTSmeanHBMin_ || calibtsmean > calibrTSmeanHBMax_)
6073                     h_mapTSmeanCalib047_HB->Fill(double(k2plot), double(k3), 1.);
6074                   h_mapTSmeanCalib_HB->Fill(double(k2plot), double(k3), calibtsmean);
6075                 }
6076                 // Width
6077                 if (calibwidth > -0.5) {
6078                   h_WidthCalib_HB->Fill(calibwidth, 1.);
6079                   if (calibwidth < calibrWidthHBMin_ || calibwidth > calibrWidthHBMax_)
6080                     h_mapWidthCalib047_HB->Fill(double(k2plot), double(k3), 1.);
6081                   h_mapWidthCalib_HB->Fill(double(k2plot), double(k3), calibwidth);
6082                 }
6083                 // CapIdErrors
6084                 if (calibcap > 0)
6085                   h_mapCapCalib047_HB->Fill(double(k2plot), double(k3), 1.);
6086                 //
6087                 h_map_HB->Fill(double(k2plot), double(k3), 1.);
6088               }
6089               //                 HE:
6090               if (k1 == 1) {
6091                 // ADC
6092                 h_ADCCalib_HE->Fill(adc, 1.);
6093                 h_ADCCalib1_HE->Fill(adc, 1.);
6094                 if (adc < calibrADCHEMin_ || adc > calibrADCHEMax_)
6095                   h_mapADCCalib047_HE->Fill(double(k2plot), double(k3), 1.);
6096                 h_mapADCCalib_HE->Fill(double(k2plot), double(k3), adc);
6097                 // Ratio
6098                 h_RatioCalib_HE->Fill(ratio, 1.);
6099                 if (ratio < calibrRatioHEMin_ || ratio > calibrRatioHEMax_)
6100                   h_mapRatioCalib047_HE->Fill(double(k2plot), double(k3), 1.);
6101                 h_mapRatioCalib_HE->Fill(double(k2plot), double(k3), ratio);
6102                 // TSmax
6103                 if (calibtsmax > -0.5) {
6104                   h_TSmaxCalib_HE->Fill(calibtsmax, 1.);
6105                   if (calibtsmax < calibrTSmaxHEMin_ || calibtsmax > calibrTSmaxHEMax_)
6106                     h_mapTSmaxCalib047_HE->Fill(double(k2plot), double(k3), 1.);
6107                   h_mapTSmaxCalib_HE->Fill(double(k2plot), double(k3), calibtsmax);
6108                 }
6109                 // TSmean
6110                 if (calibtsmean > -0.5) {
6111                   h_TSmeanCalib_HE->Fill(calibtsmean, 1.);
6112                   if (calibtsmean < calibrTSmeanHEMin_ || calibtsmean > calibrTSmeanHEMax_)
6113                     h_mapTSmeanCalib047_HE->Fill(double(k2plot), double(k3), 1.);
6114                   h_mapTSmeanCalib_HE->Fill(double(k2plot), double(k3), calibtsmean);
6115                 }
6116                 // Width
6117                 if (calibwidth > -0.5) {
6118                   h_WidthCalib_HE->Fill(calibwidth, 1.);
6119                   if (calibwidth < calibrWidthHEMin_ || calibwidth > calibrWidthHEMax_)
6120                     h_mapWidthCalib047_HE->Fill(double(k2plot), double(k3), 1.);
6121                   h_mapWidthCalib_HE->Fill(double(k2plot), double(k3), calibwidth);
6122                 }
6123                 // CapIdErrors
6124                 if (calibcap > 0)
6125                   h_mapCapCalib047_HE->Fill(double(k2plot), double(k3), 1.);
6126                 //
6127                 h_map_HE->Fill(double(k2plot), double(k3), 1.);
6128               }
6129               //                 HO:
6130               if (k1 == 2) {
6131                 // ADC
6132                 h_ADCCalib_HO->Fill(adc, 1.);
6133                 h_ADCCalib1_HO->Fill(adc, 1.);
6134                 if (adc < calibrADCHOMin_ || adc > calibrADCHOMax_)
6135                   h_mapADCCalib047_HO->Fill(double(k2plot), double(k3), 1.);
6136                 h_mapADCCalib_HO->Fill(double(k2plot), double(k3), adc);
6137                 // Ratio
6138                 h_RatioCalib_HO->Fill(ratio, 1.);
6139                 if (ratio < calibrRatioHOMin_ || ratio > calibrRatioHOMax_)
6140                   h_mapRatioCalib047_HO->Fill(double(k2plot), double(k3), 1.);
6141                 h_mapRatioCalib_HO->Fill(double(k2plot), double(k3), ratio);
6142                 // TSmax
6143                 if (calibtsmax > -0.5) {
6144                   h_TSmaxCalib_HO->Fill(calibtsmax, 1.);
6145                   if (calibtsmax < calibrTSmaxHOMin_ || calibtsmax > calibrTSmaxHOMax_)
6146                     h_mapTSmaxCalib047_HO->Fill(double(k2plot), double(k3), 1.);
6147                   h_mapTSmaxCalib_HO->Fill(double(k2plot), double(k3), calibtsmax);
6148                 }
6149                 // TSmean
6150                 if (calibtsmean > -0.5) {
6151                   h_TSmeanCalib_HO->Fill(calibtsmean, 1.);
6152                   if (calibtsmean < calibrTSmeanHOMin_ || calibtsmean > calibrTSmeanHOMax_)
6153                     h_mapTSmeanCalib047_HO->Fill(double(k2plot), double(k3), 1.);
6154                   h_mapTSmeanCalib_HO->Fill(double(k2plot), double(k3), calibtsmean);
6155                 }
6156                 // Width
6157                 if (calibwidth > -0.5) {
6158                   h_WidthCalib_HO->Fill(calibwidth, 1.);
6159                   if (calibwidth < calibrWidthHOMin_ || calibwidth > calibrWidthHOMax_)
6160                     h_mapWidthCalib047_HO->Fill(double(k2plot), double(k3), 1.);
6161                   h_mapWidthCalib_HO->Fill(double(k2plot), double(k3), calibwidth);
6162                 }
6163                 // CapIdErrors
6164                 if (calibcap > 0)
6165                   h_mapCapCalib047_HO->Fill(double(k2plot), double(k3), 1.);
6166                 //
6167                 h_map_HO->Fill(double(k2plot), double(k3), 1.);
6168               }
6169               //                 HF:
6170               if (k1 == 3) {
6171                 // ADC
6172                 h_ADCCalib_HF->Fill(adc, 1.);
6173                 h_ADCCalib1_HF->Fill(adc, 1.);
6174                 if (adc < calibrADCHFMin_ || adc > calibrADCHFMax_)
6175                   h_mapADCCalib047_HF->Fill(double(k2plot), double(k3), 1.);
6176                 h_mapADCCalib_HF->Fill(double(k2plot), double(k3), adc);
6177                 // Ratio
6178                 h_RatioCalib_HF->Fill(ratio, 1.);
6179                 if (ratio < calibrRatioHFMin_ || ratio > calibrRatioHFMax_)
6180                   h_mapRatioCalib047_HF->Fill(double(k2plot), double(k3), 1.);
6181                 h_mapRatioCalib_HF->Fill(double(k2plot), double(k3), ratio);
6182                 // TSmax
6183                 if (calibtsmax > -0.5) {
6184                   h_TSmaxCalib_HF->Fill(calibtsmax, 1.);
6185                   if (calibtsmax < calibrTSmaxHFMin_ || calibtsmax > calibrTSmaxHFMax_)
6186                     h_mapTSmaxCalib047_HF->Fill(double(k2plot), double(k3), 1.);
6187                   h_mapTSmaxCalib_HF->Fill(double(k2plot), double(k3), calibtsmax);
6188                 }
6189                 // TSmean
6190                 if (calibtsmean > -0.5) {
6191                   h_TSmeanCalib_HF->Fill(calibtsmean, 1.);
6192                   if (calibtsmean < calibrTSmeanHFMin_ || calibtsmean > calibrTSmeanHFMax_)
6193                     h_mapTSmeanCalib047_HF->Fill(double(k2plot), double(k3), 1.);
6194                   h_mapTSmeanCalib_HF->Fill(double(k2plot), double(k3), calibtsmean);
6195                 }
6196                 // Width
6197                 if (calibwidth > -0.5) {
6198                   h_WidthCalib_HF->Fill(calibwidth, 1.);
6199                   if (calibwidth < calibrWidthHFMin_ || calibwidth > calibrWidthHFMax_)
6200                     h_mapWidthCalib047_HF->Fill(double(k2plot), double(k3), 1.);
6201                   h_mapWidthCalib_HF->Fill(double(k2plot), double(k3), calibwidth);
6202                 }
6203                 // CapIdErrors
6204                 if (calibcap > 0)
6205                   h_mapCapCalib047_HF->Fill(double(k2plot), double(k3), 1.);
6206                 //
6207                 h_map_HF->Fill(double(k2plot), double(k3), 1.);
6208               }
6209               //////////
6210             }  // if(signal[k1][k2][k3]>0.)
6211             //////////
6212           }  // k3
6213         }  // k2
6214       }  // k1
6215 
6216       /////
6217 
6218     }  //if(recordHistoes_&& studyCalibCellsHist_)
6219 
6220     ///////////////////////////////////////////////////
6221     if (recordNtuples_ && nevent50 < maxNeventsInNtuple_)
6222       myTree->Fill();
6223     //  if(recordNtuples_ && nevent < maxNeventsInNtuple_) myTree->Fill();
6224 
6225     ///////////////////////////////////////////////////
6226     if (++local_event % 100 == 0) {
6227       if (verbosity < 0)
6228         std::cout << "run " << Run << " processing events " << local_event << " ok, "
6229                   << ", lumi " << lumi << ", numOfLaserEv " << numOfLaserEv << std::endl;
6230     }
6231   }  // bcn
6232 
6233   //EndAnalyzer
6234 }
6235 
6236 // ------------ method called once each job just before starting event loop  -----------
6237 void CMTRawAnalyzer::beginJob() {
6238   if (verbosity > 0)
6239     std::cout << "========================   beignJob START   +++++++++++++++++++++++++++" << std::endl;
6240   nnnnnn = 0;
6241   nnnnnnhbhe = 0;
6242   nnnnnnhbheqie11 = 0;
6243   nevent = 0;
6244   nevent50 = 0;
6245   counterhf = 0;
6246   counterhfqie10 = 0;
6247   counterho = 0;
6248   nnnnnn1 = 0;
6249   nnnnnn2 = 0;
6250   nnnnnn3 = 0;
6251   nnnnnn4 = 0;
6252   nnnnnn5 = 0;
6253   nnnnnn6 = 0;
6254   //////////////////////////////////////////////////////////////////////////////////    book histoes
6255 
6256   if (recordHistoes_) {
6257     //  ha2 = fs_->make<TH2F>("ha2"," ", neta, -41., 41., nphi, 0., bphi);
6258 
6259     h_errorGeneral = fs_->make<TH1F>("h_errorGeneral", " ", 5, 0., 5.);
6260     h_error1 = fs_->make<TH1F>("h_error1", " ", 5, 0., 5.);
6261     h_error2 = fs_->make<TH1F>("h_error2", " ", 5, 0., 5.);
6262     h_error3 = fs_->make<TH1F>("h_error3", " ", 5, 0., 5.);
6263     h_amplError = fs_->make<TH1F>("h_amplError", " ", 100, -2., 98.);
6264     h_amplFine = fs_->make<TH1F>("h_amplFine", " ", 100, -2., 98.);
6265 
6266     h_errorGeneral_HB = fs_->make<TH1F>("h_errorGeneral_HB", " ", 5, 0., 5.);
6267     h_nadccounts8_HB = fs_->make<TH1F>("h_nadccounts8_HB", " ", 257, 0., 256.);
6268     h_nadccounts6_HB = fs_->make<TH1F>("h_nadccounts6_HB", " ", 257, 0., 256.);
6269     h_nadccounts4_HB = fs_->make<TH1F>("h_nadccounts4_HB", " ", 257, 0., 256.);
6270     h_nadccounts3_HB = fs_->make<TH1F>("h_nadccounts3_HB", " ", 257, 0., 256.);
6271     h_nadccounts2_HB = fs_->make<TH1F>("h_nadccounts2_HB", " ", 257, 0., 256.);
6272     h_nadccounts0_HB = fs_->make<TH1F>("h_nadccounts0_HB", " ", 257, 0., 256.);
6273     h_error1_HB = fs_->make<TH1F>("h_error1_HB", " ", 5, 0., 5.);
6274     h_error2_HB = fs_->make<TH1F>("h_error2_HB", " ", 5, 0., 5.);
6275     h_error3_HB = fs_->make<TH1F>("h_error3_HB", " ", 5, 0., 5.);
6276     h_error4_HB = fs_->make<TH1F>("h_error4_HB", " ", 5, 0., 5.);
6277     h_error5_HB = fs_->make<TH1F>("h_error5_HB", " ", 5, 0., 5.);
6278     h_error6_HB = fs_->make<TH1F>("h_error6_HB", " ", 5, 0., 5.);
6279     h_error7_HB = fs_->make<TH1F>("h_error7_HB", " ", 5, 0., 5.);
6280     h_amplError_HB = fs_->make<TH1F>("h_amplError_HB", " ", 100, -2., 98.);
6281     h_amplFine_HB = fs_->make<TH1F>("h_amplFine_HB", " ", 100, -2., 98.);
6282     h_mapDepth1Error_HB = fs_->make<TH2F>("h_mapDepth1Error_HB", " ", neta, -41., 41., nphi, 0., bphi);
6283     h_mapDepth2Error_HB = fs_->make<TH2F>("h_mapDepth2Error_HB", " ", neta, -41., 41., nphi, 0., bphi);
6284     h_mapDepth3Error_HB = fs_->make<TH2F>("h_mapDepth3Error_HB", " ", neta, -41., 41., nphi, 0., bphi);
6285     h_mapDepth4Error_HB = fs_->make<TH2F>("h_mapDepth4Error_HB", " ", neta, -41., 41., nphi, 0., bphi);
6286     h_fiber0_HB = fs_->make<TH1F>("h_fiber0_HB", " ", 10, 0., 10.);
6287     h_fiber1_HB = fs_->make<TH1F>("h_fiber1_HB", " ", 10, 0., 10.);
6288     h_fiber2_HB = fs_->make<TH1F>("h_fiber2_HB", " ", 40, 0., 40.);
6289     h_repetedcapid_HB = fs_->make<TH1F>("h_repetedcapid_HB", " ", 5, 0., 5.);
6290 
6291     h_errorGeneral_HE = fs_->make<TH1F>("h_errorGeneral_HE", " ", 5, 0., 5.);
6292     h_nadccounts8_HE = fs_->make<TH1F>("h_nadccounts8_HE", " ", 257, 0., 256.);
6293     h_nadccounts6_HE = fs_->make<TH1F>("h_nadccounts6_HE", " ", 257, 0., 256.);
6294     h_nadccounts4_HE = fs_->make<TH1F>("h_nadccounts4_HE", " ", 257, 0., 256.);
6295     h_nadccounts3_HE = fs_->make<TH1F>("h_nadccounts3_HE", " ", 257, 0., 256.);
6296     h_nadccounts2_HE = fs_->make<TH1F>("h_nadccounts2_HE", " ", 257, 0., 256.);
6297     h_nadccounts0_HE = fs_->make<TH1F>("h_nadccounts0_HE", " ", 257, 0., 256.);
6298     h_error1_HE = fs_->make<TH1F>("h_error1_HE", " ", 5, 0., 5.);
6299     h_error2_HE = fs_->make<TH1F>("h_error2_HE", " ", 5, 0., 5.);
6300     h_error3_HE = fs_->make<TH1F>("h_error3_HE", " ", 5, 0., 5.);
6301     h_error4_HE = fs_->make<TH1F>("h_error4_HE", " ", 5, 0., 5.);
6302     h_error5_HE = fs_->make<TH1F>("h_error5_HE", " ", 5, 0., 5.);
6303     h_error6_HE = fs_->make<TH1F>("h_error6_HE", " ", 5, 0., 5.);
6304     h_error7_HE = fs_->make<TH1F>("h_error7_HE", " ", 5, 0., 5.);
6305     h_amplError_HE = fs_->make<TH1F>("h_amplError_HE", " ", 100, -2., 98.);
6306     h_amplFine_HE = fs_->make<TH1F>("h_amplFine_HE", " ", 100, -2., 98.);
6307     h_mapDepth1Error_HE = fs_->make<TH2F>("h_mapDepth1Error_HE", " ", neta, -41., 41., nphi, 0., bphi);
6308     h_mapDepth2Error_HE = fs_->make<TH2F>("h_mapDepth2Error_HE", " ", neta, -41., 41., nphi, 0., bphi);
6309     h_mapDepth3Error_HE = fs_->make<TH2F>("h_mapDepth3Error_HE", " ", neta, -41., 41., nphi, 0., bphi);
6310     h_mapDepth4Error_HE = fs_->make<TH2F>("h_mapDepth4Error_HE", " ", neta, -41., 41., nphi, 0., bphi);
6311     h_mapDepth5Error_HE = fs_->make<TH2F>("h_mapDepth5Error_HE", " ", neta, -41., 41., nphi, 0., bphi);
6312     h_mapDepth6Error_HE = fs_->make<TH2F>("h_mapDepth6Error_HE", " ", neta, -41., 41., nphi, 0., bphi);
6313     h_mapDepth7Error_HE = fs_->make<TH2F>("h_mapDepth7Error_HE", " ", neta, -41., 41., nphi, 0., bphi);
6314     h_fiber0_HE = fs_->make<TH1F>("h_fiber0_HE", " ", 10, 0., 10.);
6315     h_fiber1_HE = fs_->make<TH1F>("h_fiber1_HE", " ", 10, 0., 10.);
6316     h_fiber2_HE = fs_->make<TH1F>("h_fiber2_HE", " ", 40, 0., 40.);
6317     h_repetedcapid_HE = fs_->make<TH1F>("h_repetedcapid_HE", " ", 5, 0., 5.);
6318 
6319     h_errorGeneral_HF = fs_->make<TH1F>("h_errorGeneral_HF", " ", 5, 0., 5.);
6320     h_error1_HF = fs_->make<TH1F>("h_error1_HF", " ", 5, 0., 5.);
6321     h_error2_HF = fs_->make<TH1F>("h_error2_HF", " ", 5, 0., 5.);
6322     h_error3_HF = fs_->make<TH1F>("h_error3_HF", " ", 5, 0., 5.);
6323     h_error4_HF = fs_->make<TH1F>("h_error4_HF", " ", 5, 0., 5.);
6324     h_error5_HF = fs_->make<TH1F>("h_error5_HF", " ", 5, 0., 5.);
6325     h_error6_HF = fs_->make<TH1F>("h_error6_HF", " ", 5, 0., 5.);
6326     h_error7_HF = fs_->make<TH1F>("h_error7_HF", " ", 5, 0., 5.);
6327     h_amplError_HF = fs_->make<TH1F>("h_amplError_HF", " ", 100, -2., 98.);
6328     h_amplFine_HF = fs_->make<TH1F>("h_amplFine_HF", " ", 100, -2., 98.);
6329     h_mapDepth1Error_HF = fs_->make<TH2F>("h_mapDepth1Error_HF", " ", neta, -41., 41., nphi, 0., bphi);
6330     h_mapDepth2Error_HF = fs_->make<TH2F>("h_mapDepth2Error_HF", " ", neta, -41., 41., nphi, 0., bphi);
6331     h_mapDepth3Error_HF = fs_->make<TH2F>("h_mapDepth3Error_HF", " ", neta, -41., 41., nphi, 0., bphi);
6332     h_mapDepth4Error_HF = fs_->make<TH2F>("h_mapDepth4Error_HF", " ", neta, -41., 41., nphi, 0., bphi);
6333     h_fiber0_HF = fs_->make<TH1F>("h_fiber0_HF", " ", 10, 0., 10.);
6334     h_fiber1_HF = fs_->make<TH1F>("h_fiber1_HF", " ", 10, 0., 10.);
6335     h_fiber2_HF = fs_->make<TH1F>("h_fiber2_HF", " ", 40, 0., 40.);
6336     h_repetedcapid_HF = fs_->make<TH1F>("h_repetedcapid_HF", " ", 5, 0., 5.);
6337 
6338     h_errorGeneral_HO = fs_->make<TH1F>("h_errorGeneral_HO", " ", 5, 0., 5.);
6339     h_error1_HO = fs_->make<TH1F>("h_error1_HO", " ", 5, 0., 5.);
6340     h_error2_HO = fs_->make<TH1F>("h_error2_HO", " ", 5, 0., 5.);
6341     h_error3_HO = fs_->make<TH1F>("h_error3_HO", " ", 5, 0., 5.);
6342     h_error4_HO = fs_->make<TH1F>("h_error4_HO", " ", 5, 0., 5.);
6343     h_error5_HO = fs_->make<TH1F>("h_error5_HO", " ", 5, 0., 5.);
6344     h_error6_HO = fs_->make<TH1F>("h_error6_HO", " ", 5, 0., 5.);
6345     h_error7_HO = fs_->make<TH1F>("h_error7_HO", " ", 5, 0., 5.);
6346     h_amplError_HO = fs_->make<TH1F>("h_amplError_HO", " ", 100, -2., 98.);
6347     h_amplFine_HO = fs_->make<TH1F>("h_amplFine_HO", " ", 100, -2., 98.);
6348     h_mapDepth4Error_HO = fs_->make<TH2F>("h_mapDepth4Error_HO", " ", neta, -41., 41., nphi, 0., bphi);
6349     h_fiber0_HO = fs_->make<TH1F>("h_fiber0_HO", " ", 10, 0., 10.);
6350     h_fiber1_HO = fs_->make<TH1F>("h_fiber1_HO", " ", 10, 0., 10.);
6351     h_fiber2_HO = fs_->make<TH1F>("h_fiber2_HO", " ", 40, 0., 40.);
6352     h_repetedcapid_HO = fs_->make<TH1F>("h_repetedcapid_HO", " ", 5, 0., 5.);
6353 
6354     /////////////////////////////////////////////////////////////////////////////////////////////////             HB
6355 
6356     h_numberofhitsHBtest = fs_->make<TH1F>("h_numberofhitsHBtest", " ", 100, 0., 100.);
6357     h_AmplitudeHBtest = fs_->make<TH1F>("h_AmplitudeHBtest", " ", 100, 0., 10000.);
6358     h_AmplitudeHBtest1 = fs_->make<TH1F>("h_AmplitudeHBtest1", " ", 100, 0., 1000000.);
6359     h_AmplitudeHBtest6 = fs_->make<TH1F>("h_AmplitudeHBtest6", " ", 100, 0., 2000000.);
6360     h_totalAmplitudeHB = fs_->make<TH1F>("h_totalAmplitudeHB", " ", 100, 0., 3000000.);
6361     h_totalAmplitudeHBperEvent = fs_->make<TH1F>("h_totalAmplitudeHBperEvent", " ", 1000, 1., 1001.);
6362     // fullAmplitude:
6363     h_ADCAmpl345Zoom_HB = fs_->make<TH1F>("h_ADCAmpl345Zoom_HB", " ", 100, 0., 400.);
6364     h_ADCAmpl345Zoom1_HB = fs_->make<TH1F>("h_ADCAmpl345Zoom1_HB", " ", 100, 0., 100.);
6365     h_ADCAmpl345_HB = fs_->make<TH1F>("h_ADCAmpl345_HB", " ", 100, 10., 3000.);
6366 
6367     h_AmplitudeHBrest = fs_->make<TH1F>("h_AmplitudeHBrest", " ", 100, 0., 10000.);
6368     h_AmplitudeHBrest1 = fs_->make<TH1F>("h_AmplitudeHBrest1", " ", 100, 0., 1000000.);
6369     h_AmplitudeHBrest6 = fs_->make<TH1F>("h_AmplitudeHBrest6", " ", 100, 0., 2000000.);
6370 
6371     h_ADCAmpl345_HBCapIdError = fs_->make<TH1F>("h_ADCAmpl345_HBCapIdError", " ", 100, 10., 3000.);
6372     h_ADCAmpl345_HBCapIdNoError = fs_->make<TH1F>("h_ADCAmpl345_HBCapIdNoError", " ", 100, 10., 3000.);
6373     h_ADCAmpl_HBCapIdError = fs_->make<TH1F>("h_ADCAmpl_HBCapIdError", " ", 100, 10., 3000.);
6374     h_ADCAmpl_HBCapIdNoError = fs_->make<TH1F>("h_ADCAmpl_HBCapIdNoError", " ", 100, 10., 3000.);
6375 
6376     h_ADCAmplZoom_HB = fs_->make<TH1F>("h_ADCAmplZoom_HB", " ", 100, 0., 400.);
6377     h_ADCAmplZoom1_HB = fs_->make<TH1F>("h_ADCAmplZoom1_HB", " ", 100, -20., 80.);
6378     h_ADCAmpl_HB = fs_->make<TH1F>("h_ADCAmpl_HB", " ", 100, 10., 5000.);
6379     h_mapDepth1ADCAmpl225_HB = fs_->make<TH2F>("h_mapDepth1ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6380     h_mapDepth2ADCAmpl225_HB = fs_->make<TH2F>("h_mapDepth2ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6381     h_mapDepth3ADCAmpl225_HB = fs_->make<TH2F>("h_mapDepth3ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6382     h_mapDepth4ADCAmpl225_HB = fs_->make<TH2F>("h_mapDepth4ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6383     h_mapDepth1ADCAmpl225Copy_HB =
6384         fs_->make<TH2F>("h_mapDepth1ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi);
6385     h_mapDepth2ADCAmpl225Copy_HB =
6386         fs_->make<TH2F>("h_mapDepth2ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi);
6387     h_mapDepth3ADCAmpl225Copy_HB =
6388         fs_->make<TH2F>("h_mapDepth3ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi);
6389     h_mapDepth4ADCAmpl225Copy_HB =
6390         fs_->make<TH2F>("h_mapDepth4ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi);
6391     h_mapDepth1ADCAmpl_HB = fs_->make<TH2F>("h_mapDepth1ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi);
6392     h_mapDepth2ADCAmpl_HB = fs_->make<TH2F>("h_mapDepth2ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi);
6393     h_mapDepth3ADCAmpl_HB = fs_->make<TH2F>("h_mapDepth3ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi);
6394     h_mapDepth4ADCAmpl_HB = fs_->make<TH2F>("h_mapDepth4ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi);
6395     h_TSmeanA_HB = fs_->make<TH1F>("h_TSmeanA_HB", " ", 100, -1., 11.);
6396     h_mapDepth1TSmeanA225_HB = fs_->make<TH2F>("h_mapDepth1TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6397     h_mapDepth2TSmeanA225_HB = fs_->make<TH2F>("h_mapDepth2TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6398     h_mapDepth3TSmeanA225_HB = fs_->make<TH2F>("h_mapDepth3TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6399     h_mapDepth4TSmeanA225_HB = fs_->make<TH2F>("h_mapDepth4TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6400     h_mapDepth1TSmeanA_HB = fs_->make<TH2F>("h_mapDepth1TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi);
6401     h_mapDepth2TSmeanA_HB = fs_->make<TH2F>("h_mapDepth2TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi);
6402     h_mapDepth3TSmeanA_HB = fs_->make<TH2F>("h_mapDepth3TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi);
6403     h_mapDepth4TSmeanA_HB = fs_->make<TH2F>("h_mapDepth4TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi);
6404     h_TSmaxA_HB = fs_->make<TH1F>("h_TSmaxA_HB", " ", 100, -1., 11.);
6405     h_mapDepth1TSmaxA225_HB = fs_->make<TH2F>("h_mapDepth1TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6406     h_mapDepth2TSmaxA225_HB = fs_->make<TH2F>("h_mapDepth2TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6407     h_mapDepth3TSmaxA225_HB = fs_->make<TH2F>("h_mapDepth3TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6408     h_mapDepth4TSmaxA225_HB = fs_->make<TH2F>("h_mapDepth4TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6409     h_mapDepth1TSmaxA_HB = fs_->make<TH2F>("h_mapDepth1TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi);
6410     h_mapDepth2TSmaxA_HB = fs_->make<TH2F>("h_mapDepth2TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi);
6411     h_mapDepth3TSmaxA_HB = fs_->make<TH2F>("h_mapDepth3TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi);
6412     h_mapDepth4TSmaxA_HB = fs_->make<TH2F>("h_mapDepth4TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi);
6413     // RMS:
6414     h_Amplitude_HB = fs_->make<TH1F>("h_Amplitude_HB", " ", 100, 0., 5.);
6415     h_mapDepth1Amplitude225_HB = fs_->make<TH2F>("h_mapDepth1Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6416     h_mapDepth2Amplitude225_HB = fs_->make<TH2F>("h_mapDepth2Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6417     h_mapDepth3Amplitude225_HB = fs_->make<TH2F>("h_mapDepth3Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6418     h_mapDepth4Amplitude225_HB = fs_->make<TH2F>("h_mapDepth4Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi);
6419     h_mapDepth1Amplitude_HB = fs_->make<TH2F>("h_mapDepth1Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi);
6420     h_mapDepth2Amplitude_HB = fs_->make<TH2F>("h_mapDepth2Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi);
6421     h_mapDepth3Amplitude_HB = fs_->make<TH2F>("h_mapDepth3Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi);
6422     h_mapDepth4Amplitude_HB = fs_->make<TH2F>("h_mapDepth4Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi);
6423     // Ratio:
6424     h_Ampl_HB = fs_->make<TH1F>("h_Ampl_HB", " ", 100, 0., 1.1);
6425     h_mapDepth1Ampl047_HB = fs_->make<TH2F>("h_mapDepth1Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi);
6426     h_mapDepth2Ampl047_HB = fs_->make<TH2F>("h_mapDepth2Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi);
6427     h_mapDepth3Ampl047_HB = fs_->make<TH2F>("h_mapDepth3Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi);
6428     h_mapDepth4Ampl047_HB = fs_->make<TH2F>("h_mapDepth4Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi);
6429     h_mapDepth1Ampl_HB = fs_->make<TH2F>("h_mapDepth1Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi);
6430     h_mapDepth2Ampl_HB = fs_->make<TH2F>("h_mapDepth2Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi);
6431     h_mapDepth3Ampl_HB = fs_->make<TH2F>("h_mapDepth3Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi);
6432     h_mapDepth4Ampl_HB = fs_->make<TH2F>("h_mapDepth4Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi);
6433     h_mapDepth1AmplE34_HB = fs_->make<TH2F>("h_mapDepth1AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi);
6434     h_mapDepth2AmplE34_HB = fs_->make<TH2F>("h_mapDepth2AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi);
6435     h_mapDepth3AmplE34_HB = fs_->make<TH2F>("h_mapDepth3AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi);
6436     h_mapDepth4AmplE34_HB = fs_->make<TH2F>("h_mapDepth4AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi);
6437     h_mapDepth1_HB = fs_->make<TH2F>("h_mapDepth1_HB", " ", neta, -41., 41., nphi, 0., bphi);
6438     h_mapDepth2_HB = fs_->make<TH2F>("h_mapDepth2_HB", " ", neta, -41., 41., nphi, 0., bphi);
6439     h_mapDepth3_HB = fs_->make<TH2F>("h_mapDepth3_HB", " ", neta, -41., 41., nphi, 0., bphi);
6440     h_mapDepth4_HB = fs_->make<TH2F>("h_mapDepth4_HB", " ", neta, -41., 41., nphi, 0., bphi);
6441 
6442     h_mapDepth1TS2_HB = fs_->make<TH2F>("h_mapDepth1TS2_HB", " ", neta, -41., 41., nphi, 0., bphi);
6443     h_mapDepth2TS2_HB = fs_->make<TH2F>("h_mapDepth2TS2_HB", " ", neta, -41., 41., nphi, 0., bphi);
6444     h_mapDepth3TS2_HB = fs_->make<TH2F>("h_mapDepth3TS2_HB", " ", neta, -41., 41., nphi, 0., bphi);
6445     h_mapDepth4TS2_HB = fs_->make<TH2F>("h_mapDepth4TS2_HB", " ", neta, -41., 41., nphi, 0., bphi);
6446     h_mapDepth1TS2_HE = fs_->make<TH2F>("h_mapDepth1TS2_HE", " ", neta, -41., 41., nphi, 0., bphi);
6447     h_mapDepth2TS2_HE = fs_->make<TH2F>("h_mapDepth2TS2_HE", " ", neta, -41., 41., nphi, 0., bphi);
6448     h_mapDepth3TS2_HE = fs_->make<TH2F>("h_mapDepth3TS2_HE", " ", neta, -41., 41., nphi, 0., bphi);
6449     h_mapDepth4TS2_HE = fs_->make<TH2F>("h_mapDepth4TS2_HE", " ", neta, -41., 41., nphi, 0., bphi);
6450     h_mapDepth5TS2_HE = fs_->make<TH2F>("h_mapDepth5TS2_HE", " ", neta, -41., 41., nphi, 0., bphi);
6451     h_mapDepth6TS2_HE = fs_->make<TH2F>("h_mapDepth6TS2_HE", " ", neta, -41., 41., nphi, 0., bphi);
6452     h_mapDepth7TS2_HE = fs_->make<TH2F>("h_mapDepth7TS2_HE", " ", neta, -41., 41., nphi, 0., bphi);
6453     h_recSignalEnergy0_HF3 = fs_->make<TH2F>("h_recSignalEnergy0_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6454     h_recSignalEnergy1_HF3 = fs_->make<TH2F>("h_recSignalEnergy1_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6455     h_recSignalEnergy2_HF3 = fs_->make<TH2F>("h_recSignalEnergy2_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6456     h_recSignalEnergy0_HF4 = fs_->make<TH2F>("h_recSignalEnergy0_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6457     h_recSignalEnergy1_HF4 = fs_->make<TH2F>("h_recSignalEnergy1_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6458     h_recSignalEnergy2_HF4 = fs_->make<TH2F>("h_recSignalEnergy2_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6459     h_recNoiseEnergy0_HF3 = fs_->make<TH2F>("h_recNoiseEnergy0_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6460     h_recNoiseEnergy1_HF3 = fs_->make<TH2F>("h_recNoiseEnergy1_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6461     h_recNoiseEnergy2_HF3 = fs_->make<TH2F>("h_recNoiseEnergy2_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6462     h_recNoiseEnergy0_HF4 = fs_->make<TH2F>("h_recNoiseEnergy0_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6463     h_recNoiseEnergy1_HF4 = fs_->make<TH2F>("h_recNoiseEnergy1_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6464     h_recNoiseEnergy2_HF4 = fs_->make<TH2F>("h_recNoiseEnergy2_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6465     h_mapDepth1TS1_HF = fs_->make<TH2F>("h_mapDepth1TS1_HF", " ", neta, -41., 41., nphi, 0., bphi);
6466     h_mapDepth2TS1_HF = fs_->make<TH2F>("h_mapDepth2TS1_HF", " ", neta, -41., 41., nphi, 0., bphi);
6467     h_mapDepth3TS1_HF = fs_->make<TH2F>("h_mapDepth3TS1_HF", " ", neta, -41., 41., nphi, 0., bphi);
6468     h_mapDepth4TS1_HF = fs_->make<TH2F>("h_mapDepth4TS1_HF", " ", neta, -41., 41., nphi, 0., bphi);
6469     h_mapDepth4TS012_HO = fs_->make<TH2F>("h_mapDepth4TS012_HO", " ", neta, -41., 41., nphi, 0., bphi);
6470 
6471     //////////////////////////////////////////////////////////////////////////////////////////////             HE
6472 
6473     // stuff regarding summed(total) Amplitude vs iEvent (histo-name is  h_totalAmplitudeHEperEvent)
6474     // to see from which event ALL channels are available(related to quality of the run)
6475     h_numberofhitsHEtest = fs_->make<TH1F>("h_numberofhitsHEtest", " ", 100, 0., 10000.);
6476     h_AmplitudeHEtest = fs_->make<TH1F>("h_AmplitudeHEtest", " ", 100, 0., 1000000.);
6477     h_AmplitudeHEtest1 = fs_->make<TH1F>("h_AmplitudeHEtest1", " ", 100, 0., 1000000.);
6478     h_AmplitudeHEtest6 = fs_->make<TH1F>("h_AmplitudeHEtest6", " ", 100, 0., 2000000.);
6479     h_totalAmplitudeHE = fs_->make<TH1F>("h_totalAmplitudeHE", " ", 100, 0., 10000000000.);
6480     h_totalAmplitudeHEperEvent = fs_->make<TH1F>("h_totalAmplitudeHEperEvent", " ", 1000, 1., 1001.);
6481 
6482     // Aijk Amplitude:
6483     h_ADCAmplZoom1_HE = fs_->make<TH1F>("h_ADCAmplZoom1_HE", " ", npfit, 0., anpfit);        // for amplmaxts 1TS w/ max
6484     h_ADCAmpl345Zoom1_HE = fs_->make<TH1F>("h_ADCAmpl345Zoom1_HE", " ", npfit, 0., anpfit);  // for ampl3ts 3TSs
6485     h_ADCAmpl345Zoom_HE = fs_->make<TH1F>("h_ADCAmpl345Zoom_HE", " ", npfit, 0., anpfit);    // for ampl 4TSs
6486     h_amplitudeaveragedbydepthes_HE =
6487         fs_->make<TH1F>("h_amplitudeaveragedbydepthes_HE", " ", npfit, 0., anpfit);  // for cross-check: A spectrum
6488     h_ndepthesperamplitudebins_HE =
6489         fs_->make<TH1F>("h_ndepthesperamplitudebins_HE", " ", 10, 0., 10.);  // for cross-check: ndepthes
6490 
6491     // Ampl12 4TSs to work with "ped-Gsel0" or "led-low-intensity" to clarify gain diff peak2-peak1
6492     h_mapADCAmplfirstpeak_HE =
6493         fs_->make<TH2F>("h_mapADCAmplfirstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for amplmaxts 1TS w/ max
6494     h_mapADCAmplfirstpeak0_HE =
6495         fs_->make<TH2F>("h_mapADCAmplfirstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for amplmaxts 1TS w/ max
6496     h_mapADCAmplsecondpeak_HE =
6497         fs_->make<TH2F>("h_mapADCAmplsecondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for amplmaxts 1TS w/ max
6498     h_mapADCAmplsecondpeak0_HE = fs_->make<TH2F>(
6499         "h_mapADCAmplsecondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for amplmaxts 1TS w/ max
6500 
6501     h_mapADCAmpl11firstpeak_HE =
6502         fs_->make<TH2F>("h_mapADCAmpl11firstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for ampl3ts 3TSs
6503     h_mapADCAmpl11firstpeak0_HE =
6504         fs_->make<TH2F>("h_mapADCAmpl11firstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for ampl3ts 3TSs
6505     h_mapADCAmpl11secondpeak_HE =
6506         fs_->make<TH2F>("h_mapADCAmpl11secondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for ampl3ts 3TSs
6507     h_mapADCAmpl11secondpeak0_HE =
6508         fs_->make<TH2F>("h_mapADCAmpl11secondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for ampl3ts 3TSs
6509 
6510     h_mapADCAmpl12firstpeak_HE =
6511         fs_->make<TH2F>("h_mapADCAmpl12firstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for ampl 4TSs
6512     h_mapADCAmpl12firstpeak0_HE =
6513         fs_->make<TH2F>("h_mapADCAmpl12firstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for ampl 4TSs
6514     h_mapADCAmpl12secondpeak_HE =
6515         fs_->make<TH2F>("h_mapADCAmpl12secondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for ampl 4TSs
6516     h_mapADCAmpl12secondpeak0_HE =
6517         fs_->make<TH2F>("h_mapADCAmpl12secondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi);  // for ampl 4TSs
6518 
6519     // Ampl12 4TSs to work with "ped-Gsel0" or "led-low-intensity" to clarify gain diff peak2-peak1  fit results:
6520     h_gsmdifferencefit1_HE = fs_->make<TH1F>("h_gsmdifferencefit1_HE", " ", 80, 20., 60.);
6521     h_gsmdifferencefit2_HE = fs_->make<TH1F>("h_gsmdifferencefit2_HE", " ", 80, 20., 60.);
6522     h_gsmdifferencefit3_HE = fs_->make<TH1F>("h_gsmdifferencefit3_HE", " ", 80, 20., 60.);
6523     h_gsmdifferencefit4_HE = fs_->make<TH1F>("h_gsmdifferencefit4_HE", " ", 80, 20., 60.);
6524     h_gsmdifferencefit5_HE = fs_->make<TH1F>("h_gsmdifferencefit5_HE", " ", 80, 20., 60.);
6525     h_gsmdifferencefit6_HE = fs_->make<TH1F>("h_gsmdifferencefit6_HE", " ", 80, 20., 60.);
6526 
6527     // Aijk Amplitude:
6528     h_ADCAmpl_HE = fs_->make<TH1F>("h_ADCAmpl_HE", " ", 200, 0., 2000000.);
6529     h_ADCAmplrest_HE = fs_->make<TH1F>("h_ADCAmplrest_HE", " ", 100, 0., 500.);
6530     h_ADCAmplrest1_HE = fs_->make<TH1F>("h_ADCAmplrest1_HE", " ", 100, 0., 100.);
6531     h_ADCAmplrest6_HE = fs_->make<TH1F>("h_ADCAmplrest6_HE", " ", 100, 0., 10000.);
6532 
6533     h_ADCAmpl345_HE = fs_->make<TH1F>("h_ADCAmpl345_HE", " ", 70, 0., 700000.);
6534 
6535     // SiPM corrections:
6536     h_corrforxaMAIN_HE = fs_->make<TH1F>("h_corrforxaMAIN_HE", " ", 70, 0., 700000.);
6537     h_corrforxaMAIN0_HE = fs_->make<TH1F>("h_corrforxaMAIN0_HE", " ", 70, 0., 700000.);
6538     h_corrforxaADDI_HE = fs_->make<TH1F>("h_corrforxaADDI_HE", " ", 70, 0., 700000.);
6539     h_corrforxaADDI0_HE = fs_->make<TH1F>("h_corrforxaADDI0_HE", " ", 70, 0., 700000.);
6540 
6541     h_mapDepth1ADCAmpl225_HE = fs_->make<TH2F>("h_mapDepth1ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6542     h_mapDepth2ADCAmpl225_HE = fs_->make<TH2F>("h_mapDepth2ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6543     h_mapDepth3ADCAmpl225_HE = fs_->make<TH2F>("h_mapDepth3ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6544     h_mapDepth4ADCAmpl225_HE = fs_->make<TH2F>("h_mapDepth4ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6545     h_mapDepth5ADCAmpl225_HE = fs_->make<TH2F>("h_mapDepth5ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6546     h_mapDepth6ADCAmpl225_HE = fs_->make<TH2F>("h_mapDepth6ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6547     h_mapDepth7ADCAmpl225_HE = fs_->make<TH2F>("h_mapDepth7ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6548     h_mapDepth1ADCAmpl225Copy_HE =
6549         fs_->make<TH2F>("h_mapDepth1ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi);
6550     h_mapDepth2ADCAmpl225Copy_HE =
6551         fs_->make<TH2F>("h_mapDepth2ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi);
6552     h_mapDepth3ADCAmpl225Copy_HE =
6553         fs_->make<TH2F>("h_mapDepth3ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi);
6554     h_mapDepth4ADCAmpl225Copy_HE =
6555         fs_->make<TH2F>("h_mapDepth4ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi);
6556     h_mapDepth5ADCAmpl225Copy_HE =
6557         fs_->make<TH2F>("h_mapDepth5ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi);
6558     h_mapDepth6ADCAmpl225Copy_HE =
6559         fs_->make<TH2F>("h_mapDepth6ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi);
6560     h_mapDepth7ADCAmpl225Copy_HE =
6561         fs_->make<TH2F>("h_mapDepth7ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi);
6562 
6563     h_mapDepth1ADCAmpl_HE = fs_->make<TH2F>("h_mapDepth1ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6564     h_mapDepth2ADCAmpl_HE = fs_->make<TH2F>("h_mapDepth2ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6565     h_mapDepth3ADCAmpl_HE = fs_->make<TH2F>("h_mapDepth3ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6566     h_mapDepth4ADCAmpl_HE = fs_->make<TH2F>("h_mapDepth4ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6567     h_mapDepth5ADCAmpl_HE = fs_->make<TH2F>("h_mapDepth5ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6568     h_mapDepth6ADCAmpl_HE = fs_->make<TH2F>("h_mapDepth6ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6569     h_mapDepth7ADCAmpl_HE = fs_->make<TH2F>("h_mapDepth7ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6570     h_mapDepth1ADCAmplSiPM_HE = fs_->make<TH2F>("h_mapDepth1ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi);
6571     h_mapDepth2ADCAmplSiPM_HE = fs_->make<TH2F>("h_mapDepth2ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi);
6572     h_mapDepth3ADCAmplSiPM_HE = fs_->make<TH2F>("h_mapDepth3ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi);
6573 
6574     h_TSmeanA_HE = fs_->make<TH1F>("h_TSmeanA_HE", " ", 100, -2., 8.);
6575     h_mapDepth1TSmeanA225_HE = fs_->make<TH2F>("h_mapDepth1TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6576     h_mapDepth2TSmeanA225_HE = fs_->make<TH2F>("h_mapDepth2TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6577     h_mapDepth3TSmeanA225_HE = fs_->make<TH2F>("h_mapDepth3TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6578     h_mapDepth4TSmeanA225_HE = fs_->make<TH2F>("h_mapDepth4TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6579     h_mapDepth5TSmeanA225_HE = fs_->make<TH2F>("h_mapDepth5TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6580     h_mapDepth6TSmeanA225_HE = fs_->make<TH2F>("h_mapDepth6TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6581     h_mapDepth7TSmeanA225_HE = fs_->make<TH2F>("h_mapDepth7TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6582     h_mapDepth1TSmeanA_HE = fs_->make<TH2F>("h_mapDepth1TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6583     h_mapDepth2TSmeanA_HE = fs_->make<TH2F>("h_mapDepth2TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6584     h_mapDepth3TSmeanA_HE = fs_->make<TH2F>("h_mapDepth3TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6585     h_mapDepth4TSmeanA_HE = fs_->make<TH2F>("h_mapDepth4TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6586     h_mapDepth5TSmeanA_HE = fs_->make<TH2F>("h_mapDepth5TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6587     h_mapDepth6TSmeanA_HE = fs_->make<TH2F>("h_mapDepth6TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6588     h_mapDepth7TSmeanA_HE = fs_->make<TH2F>("h_mapDepth7TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6589     h_TSmaxA_HE = fs_->make<TH1F>("h_TSmaxA_HE", " ", 100, -1., 11.);
6590     h_mapDepth1TSmaxA225_HE = fs_->make<TH2F>("h_mapDepth1TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6591     h_mapDepth2TSmaxA225_HE = fs_->make<TH2F>("h_mapDepth2TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6592     h_mapDepth3TSmaxA225_HE = fs_->make<TH2F>("h_mapDepth3TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6593     h_mapDepth4TSmaxA225_HE = fs_->make<TH2F>("h_mapDepth4TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6594     h_mapDepth5TSmaxA225_HE = fs_->make<TH2F>("h_mapDepth5TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6595     h_mapDepth6TSmaxA225_HE = fs_->make<TH2F>("h_mapDepth6TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6596     h_mapDepth7TSmaxA225_HE = fs_->make<TH2F>("h_mapDepth7TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6597     h_mapDepth1TSmaxA_HE = fs_->make<TH2F>("h_mapDepth1TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6598     h_mapDepth2TSmaxA_HE = fs_->make<TH2F>("h_mapDepth2TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6599     h_mapDepth3TSmaxA_HE = fs_->make<TH2F>("h_mapDepth3TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6600     h_mapDepth4TSmaxA_HE = fs_->make<TH2F>("h_mapDepth4TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6601     h_mapDepth5TSmaxA_HE = fs_->make<TH2F>("h_mapDepth5TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6602     h_mapDepth6TSmaxA_HE = fs_->make<TH2F>("h_mapDepth6TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6603     h_mapDepth7TSmaxA_HE = fs_->make<TH2F>("h_mapDepth7TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi);
6604     // RMS:
6605     h_Amplitude_HE = fs_->make<TH1F>("h_Amplitude_HE", " ", 100, 0., 5.5);
6606     h_mapDepth1Amplitude225_HE = fs_->make<TH2F>("h_mapDepth1Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6607     h_mapDepth2Amplitude225_HE = fs_->make<TH2F>("h_mapDepth2Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6608     h_mapDepth3Amplitude225_HE = fs_->make<TH2F>("h_mapDepth3Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6609     h_mapDepth4Amplitude225_HE = fs_->make<TH2F>("h_mapDepth4Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6610     h_mapDepth5Amplitude225_HE = fs_->make<TH2F>("h_mapDepth5Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6611     h_mapDepth6Amplitude225_HE = fs_->make<TH2F>("h_mapDepth6Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6612     h_mapDepth7Amplitude225_HE = fs_->make<TH2F>("h_mapDepth7Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi);
6613     h_mapDepth1Amplitude_HE = fs_->make<TH2F>("h_mapDepth1Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi);
6614     h_mapDepth2Amplitude_HE = fs_->make<TH2F>("h_mapDepth2Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi);
6615     h_mapDepth3Amplitude_HE = fs_->make<TH2F>("h_mapDepth3Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi);
6616     h_mapDepth4Amplitude_HE = fs_->make<TH2F>("h_mapDepth4Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi);
6617     h_mapDepth5Amplitude_HE = fs_->make<TH2F>("h_mapDepth5Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi);
6618     h_mapDepth6Amplitude_HE = fs_->make<TH2F>("h_mapDepth6Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi);
6619     h_mapDepth7Amplitude_HE = fs_->make<TH2F>("h_mapDepth7Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi);
6620 
6621     // Ratio:
6622     h_Ampl_HE = fs_->make<TH1F>("h_Ampl_HE", " ", 100, 0., 1.1);
6623     h_mapDepth1Ampl047_HE = fs_->make<TH2F>("h_mapDepth1Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi);
6624     h_mapDepth2Ampl047_HE = fs_->make<TH2F>("h_mapDepth2Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi);
6625     h_mapDepth3Ampl047_HE = fs_->make<TH2F>("h_mapDepth3Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi);
6626     h_mapDepth4Ampl047_HE = fs_->make<TH2F>("h_mapDepth4Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi);
6627     h_mapDepth5Ampl047_HE = fs_->make<TH2F>("h_mapDepth5Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi);
6628     h_mapDepth6Ampl047_HE = fs_->make<TH2F>("h_mapDepth6Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi);
6629     h_mapDepth7Ampl047_HE = fs_->make<TH2F>("h_mapDepth7Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi);
6630     h_mapDepth1Ampl_HE = fs_->make<TH2F>("h_mapDepth1Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6631     h_mapDepth2Ampl_HE = fs_->make<TH2F>("h_mapDepth2Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6632     h_mapDepth3Ampl_HE = fs_->make<TH2F>("h_mapDepth3Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6633     h_mapDepth4Ampl_HE = fs_->make<TH2F>("h_mapDepth4Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6634     h_mapDepth5Ampl_HE = fs_->make<TH2F>("h_mapDepth5Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6635     h_mapDepth6Ampl_HE = fs_->make<TH2F>("h_mapDepth6Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6636     h_mapDepth7Ampl_HE = fs_->make<TH2F>("h_mapDepth7Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi);
6637     h_mapDepth1AmplE34_HE = fs_->make<TH2F>("h_mapDepth1AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi);
6638     h_mapDepth2AmplE34_HE = fs_->make<TH2F>("h_mapDepth2AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi);
6639     h_mapDepth3AmplE34_HE = fs_->make<TH2F>("h_mapDepth3AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi);
6640     h_mapDepth4AmplE34_HE = fs_->make<TH2F>("h_mapDepth4AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi);
6641     h_mapDepth5AmplE34_HE = fs_->make<TH2F>("h_mapDepth5AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi);
6642     h_mapDepth6AmplE34_HE = fs_->make<TH2F>("h_mapDepth6AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi);
6643     h_mapDepth7AmplE34_HE = fs_->make<TH2F>("h_mapDepth7AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi);
6644     h_mapDepth1_HE = fs_->make<TH2F>("h_mapDepth1_HE", " ", neta, -41., 41., nphi, 0., bphi);
6645     h_mapDepth2_HE = fs_->make<TH2F>("h_mapDepth2_HE", " ", neta, -41., 41., nphi, 0., bphi);
6646     h_mapDepth3_HE = fs_->make<TH2F>("h_mapDepth3_HE", " ", neta, -41., 41., nphi, 0., bphi);
6647     h_mapDepth4_HE = fs_->make<TH2F>("h_mapDepth4_HE", " ", neta, -41., 41., nphi, 0., bphi);
6648     h_mapDepth5_HE = fs_->make<TH2F>("h_mapDepth5_HE", " ", neta, -41., 41., nphi, 0., bphi);
6649     h_mapDepth6_HE = fs_->make<TH2F>("h_mapDepth6_HE", " ", neta, -41., 41., nphi, 0., bphi);
6650     h_mapDepth7_HE = fs_->make<TH2F>("h_mapDepth7_HE", " ", neta, -41., 41., nphi, 0., bphi);
6651     ///////////////////////////////////////////////////////////////////////////////////////////////////  IterativeMethodCalibrationGroup
6652     h_mapenophinorm_HE1 = fs_->make<TH2F>("h_mapenophinorm_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6653     h_mapenophinorm_HE2 = fs_->make<TH2F>("h_mapenophinorm_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6654     h_mapenophinorm_HE3 = fs_->make<TH2F>("h_mapenophinorm_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6655     h_mapenophinorm_HE4 = fs_->make<TH2F>("h_mapenophinorm_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6656     h_mapenophinorm_HE5 = fs_->make<TH2F>("h_mapenophinorm_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6657     h_mapenophinorm_HE6 = fs_->make<TH2F>("h_mapenophinorm_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6658     h_mapenophinorm_HE7 = fs_->make<TH2F>("h_mapenophinorm_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6659     h_mapenophinorm2_HE1 = fs_->make<TH2F>("h_mapenophinorm2_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6660     h_mapenophinorm2_HE2 = fs_->make<TH2F>("h_mapenophinorm2_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6661     h_mapenophinorm2_HE3 = fs_->make<TH2F>("h_mapenophinorm2_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6662     h_mapenophinorm2_HE4 = fs_->make<TH2F>("h_mapenophinorm2_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6663     h_mapenophinorm2_HE5 = fs_->make<TH2F>("h_mapenophinorm2_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6664     h_mapenophinorm2_HE6 = fs_->make<TH2F>("h_mapenophinorm2_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6665     h_mapenophinorm2_HE7 = fs_->make<TH2F>("h_mapenophinorm2_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6666 
6667     h_maprphinorm_HE1 = fs_->make<TH2F>("h_maprphinorm_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6668     h_maprphinorm_HE2 = fs_->make<TH2F>("h_maprphinorm_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6669     h_maprphinorm_HE3 = fs_->make<TH2F>("h_maprphinorm_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6670     h_maprphinorm_HE4 = fs_->make<TH2F>("h_maprphinorm_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6671     h_maprphinorm_HE5 = fs_->make<TH2F>("h_maprphinorm_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6672     h_maprphinorm_HE6 = fs_->make<TH2F>("h_maprphinorm_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6673     h_maprphinorm_HE7 = fs_->make<TH2F>("h_maprphinorm_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6674     h_maprphinorm2_HE1 = fs_->make<TH2F>("h_maprphinorm2_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6675     h_maprphinorm2_HE2 = fs_->make<TH2F>("h_maprphinorm2_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6676     h_maprphinorm2_HE3 = fs_->make<TH2F>("h_maprphinorm2_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6677     h_maprphinorm2_HE4 = fs_->make<TH2F>("h_maprphinorm2_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6678     h_maprphinorm2_HE5 = fs_->make<TH2F>("h_maprphinorm2_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6679     h_maprphinorm2_HE6 = fs_->make<TH2F>("h_maprphinorm2_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6680     h_maprphinorm2_HE7 = fs_->make<TH2F>("h_maprphinorm2_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6681 
6682     h_maprphinorm0_HE1 = fs_->make<TH2F>("h_maprphinorm0_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6683     h_maprphinorm0_HE2 = fs_->make<TH2F>("h_maprphinorm0_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6684     h_maprphinorm0_HE3 = fs_->make<TH2F>("h_maprphinorm0_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6685     h_maprphinorm0_HE4 = fs_->make<TH2F>("h_maprphinorm0_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6686     h_maprphinorm0_HE5 = fs_->make<TH2F>("h_maprphinorm0_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6687     h_maprphinorm0_HE6 = fs_->make<TH2F>("h_maprphinorm0_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6688     h_maprphinorm0_HE7 = fs_->make<TH2F>("h_maprphinorm0_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6689 
6690     //
6691     // Didi as done in Reco
6692     //HB:
6693     h_amplitudechannel0_HB1 = fs_->make<TH2F>("h_amplitudechannel0_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6694     h_amplitudechannel1_HB1 = fs_->make<TH2F>("h_amplitudechannel1_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6695     h_amplitudechannel2_HB1 = fs_->make<TH2F>("h_amplitudechannel2_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6696     h_amplitudechannel0_HB2 = fs_->make<TH2F>("h_amplitudechannel0_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6697     h_amplitudechannel1_HB2 = fs_->make<TH2F>("h_amplitudechannel1_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6698     h_amplitudechannel2_HB2 = fs_->make<TH2F>("h_amplitudechannel2_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6699     h_amplitudechannel0_HB3 = fs_->make<TH2F>("h_amplitudechannel0_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6700     h_amplitudechannel1_HB3 = fs_->make<TH2F>("h_amplitudechannel1_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6701     h_amplitudechannel2_HB3 = fs_->make<TH2F>("h_amplitudechannel2_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6702     h_amplitudechannel0_HB4 = fs_->make<TH2F>("h_amplitudechannel0_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6703     h_amplitudechannel1_HB4 = fs_->make<TH2F>("h_amplitudechannel1_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6704     h_amplitudechannel2_HB4 = fs_->make<TH2F>("h_amplitudechannel2_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6705     //HE:
6706     h_amplitudechannel0_HE1 = fs_->make<TH2F>("h_amplitudechannel0_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6707     h_amplitudechannel1_HE1 = fs_->make<TH2F>("h_amplitudechannel1_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6708     h_amplitudechannel2_HE1 = fs_->make<TH2F>("h_amplitudechannel2_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6709     h_amplitudechannel0_HE2 = fs_->make<TH2F>("h_amplitudechannel0_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6710     h_amplitudechannel1_HE2 = fs_->make<TH2F>("h_amplitudechannel1_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6711     h_amplitudechannel2_HE2 = fs_->make<TH2F>("h_amplitudechannel2_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6712     h_amplitudechannel0_HE3 = fs_->make<TH2F>("h_amplitudechannel0_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6713     h_amplitudechannel1_HE3 = fs_->make<TH2F>("h_amplitudechannel1_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6714     h_amplitudechannel2_HE3 = fs_->make<TH2F>("h_amplitudechannel2_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6715     h_amplitudechannel0_HE4 = fs_->make<TH2F>("h_amplitudechannel0_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6716     h_amplitudechannel1_HE4 = fs_->make<TH2F>("h_amplitudechannel1_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6717     h_amplitudechannel2_HE4 = fs_->make<TH2F>("h_amplitudechannel2_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6718     h_amplitudechannel0_HE5 = fs_->make<TH2F>("h_amplitudechannel0_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6719     h_amplitudechannel1_HE5 = fs_->make<TH2F>("h_amplitudechannel1_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6720     h_amplitudechannel2_HE5 = fs_->make<TH2F>("h_amplitudechannel2_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6721     h_amplitudechannel0_HE6 = fs_->make<TH2F>("h_amplitudechannel0_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6722     h_amplitudechannel1_HE6 = fs_->make<TH2F>("h_amplitudechannel1_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6723     h_amplitudechannel2_HE6 = fs_->make<TH2F>("h_amplitudechannel2_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6724     h_amplitudechannel0_HE7 = fs_->make<TH2F>("h_amplitudechannel0_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6725     h_amplitudechannel1_HE7 = fs_->make<TH2F>("h_amplitudechannel1_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6726     h_amplitudechannel2_HE7 = fs_->make<TH2F>("h_amplitudechannel2_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6727     //HF:
6728     h_amplitudechannel0_HF1 = fs_->make<TH2F>("h_amplitudechannel0_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6729     h_amplitudechannel1_HF1 = fs_->make<TH2F>("h_amplitudechannel1_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6730     h_amplitudechannel2_HF1 = fs_->make<TH2F>("h_amplitudechannel2_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6731     h_amplitudechannel0_HF2 = fs_->make<TH2F>("h_amplitudechannel0_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6732     h_amplitudechannel1_HF2 = fs_->make<TH2F>("h_amplitudechannel1_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6733     h_amplitudechannel2_HF2 = fs_->make<TH2F>("h_amplitudechannel2_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6734     h_amplitudechannel0_HF3 = fs_->make<TH2F>("h_amplitudechannel0_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6735     h_amplitudechannel1_HF3 = fs_->make<TH2F>("h_amplitudechannel1_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6736     h_amplitudechannel2_HF3 = fs_->make<TH2F>("h_amplitudechannel2_HF3", " ", neta, -41., 41., nphi, 0., bphi);
6737     h_amplitudechannel0_HF4 = fs_->make<TH2F>("h_amplitudechannel0_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6738     h_amplitudechannel1_HF4 = fs_->make<TH2F>("h_amplitudechannel1_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6739     h_amplitudechannel2_HF4 = fs_->make<TH2F>("h_amplitudechannel2_HF4", " ", neta, -41., 41., nphi, 0., bphi);
6740 
6741     // Reco
6742     h_energyhitSignal_HB = fs_->make<TH1F>("h_energyhitSignal_HB", " ", npfit, -0.22, 0.22);
6743     h_energyhitSignal_HE = fs_->make<TH1F>("h_energyhitSignal_HE", " ", npfit, -0.22, 0.22);
6744     h_energyhitSignal_HF = fs_->make<TH1F>("h_energyhitSignal_HF", " ", npfit, -6.6, 6.6);
6745     h_energyhitNoise_HB = fs_->make<TH1F>("h_energyhitNoise_HB", " ", npfit, -0.22, 0.22);
6746     h_energyhitNoise_HE = fs_->make<TH1F>("h_energyhitNoise_HE", " ", npfit, -0.22, 0.22);
6747     h_energyhitNoise_HF = fs_->make<TH1F>("h_energyhitNoise_HF", " ", npfit, -4.4, 4.4);
6748 
6749     //HB:
6750     h_recSignalEnergy0_HB1 = fs_->make<TH2F>("h_recSignalEnergy0_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6751     h_recSignalEnergy1_HB1 = fs_->make<TH2F>("h_recSignalEnergy1_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6752     h_recSignalEnergy2_HB1 = fs_->make<TH2F>("h_recSignalEnergy2_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6753     h_recSignalEnergy0_HB2 = fs_->make<TH2F>("h_recSignalEnergy0_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6754     h_recSignalEnergy1_HB2 = fs_->make<TH2F>("h_recSignalEnergy1_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6755     h_recSignalEnergy2_HB2 = fs_->make<TH2F>("h_recSignalEnergy2_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6756     h_recSignalEnergy0_HB3 = fs_->make<TH2F>("h_recSignalEnergy0_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6757     h_recSignalEnergy1_HB3 = fs_->make<TH2F>("h_recSignalEnergy1_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6758     h_recSignalEnergy2_HB3 = fs_->make<TH2F>("h_recSignalEnergy2_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6759     h_recSignalEnergy0_HB4 = fs_->make<TH2F>("h_recSignalEnergy0_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6760     h_recSignalEnergy1_HB4 = fs_->make<TH2F>("h_recSignalEnergy1_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6761     h_recSignalEnergy2_HB4 = fs_->make<TH2F>("h_recSignalEnergy2_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6762 
6763     h_recNoiseEnergy0_HB1 = fs_->make<TH2F>("h_recNoiseEnergy0_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6764     h_recNoiseEnergy1_HB1 = fs_->make<TH2F>("h_recNoiseEnergy1_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6765     h_recNoiseEnergy2_HB1 = fs_->make<TH2F>("h_recNoiseEnergy2_HB1", " ", neta, -41., 41., nphi, 0., bphi);
6766     h_recNoiseEnergy0_HB2 = fs_->make<TH2F>("h_recNoiseEnergy0_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6767     h_recNoiseEnergy1_HB2 = fs_->make<TH2F>("h_recNoiseEnergy1_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6768     h_recNoiseEnergy2_HB2 = fs_->make<TH2F>("h_recNoiseEnergy2_HB2", " ", neta, -41., 41., nphi, 0., bphi);
6769     h_recNoiseEnergy0_HB3 = fs_->make<TH2F>("h_recNoiseEnergy0_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6770     h_recNoiseEnergy1_HB3 = fs_->make<TH2F>("h_recNoiseEnergy1_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6771     h_recNoiseEnergy2_HB3 = fs_->make<TH2F>("h_recNoiseEnergy2_HB3", " ", neta, -41., 41., nphi, 0., bphi);
6772     h_recNoiseEnergy0_HB4 = fs_->make<TH2F>("h_recNoiseEnergy0_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6773     h_recNoiseEnergy1_HB4 = fs_->make<TH2F>("h_recNoiseEnergy1_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6774     h_recNoiseEnergy2_HB4 = fs_->make<TH2F>("h_recNoiseEnergy2_HB4", " ", neta, -41., 41., nphi, 0., bphi);
6775 
6776     //HE:
6777     h_recSignalEnergy0_HE1 = fs_->make<TH2F>("h_recSignalEnergy0_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6778     h_recSignalEnergy1_HE1 = fs_->make<TH2F>("h_recSignalEnergy1_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6779     h_recSignalEnergy2_HE1 = fs_->make<TH2F>("h_recSignalEnergy2_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6780     h_recSignalEnergy0_HE2 = fs_->make<TH2F>("h_recSignalEnergy0_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6781     h_recSignalEnergy1_HE2 = fs_->make<TH2F>("h_recSignalEnergy1_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6782     h_recSignalEnergy2_HE2 = fs_->make<TH2F>("h_recSignalEnergy2_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6783     h_recSignalEnergy0_HE3 = fs_->make<TH2F>("h_recSignalEnergy0_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6784     h_recSignalEnergy1_HE3 = fs_->make<TH2F>("h_recSignalEnergy1_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6785     h_recSignalEnergy2_HE3 = fs_->make<TH2F>("h_recSignalEnergy2_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6786     h_recSignalEnergy0_HE4 = fs_->make<TH2F>("h_recSignalEnergy0_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6787     h_recSignalEnergy1_HE4 = fs_->make<TH2F>("h_recSignalEnergy1_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6788     h_recSignalEnergy2_HE4 = fs_->make<TH2F>("h_recSignalEnergy2_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6789     h_recSignalEnergy0_HE5 = fs_->make<TH2F>("h_recSignalEnergy0_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6790     h_recSignalEnergy1_HE5 = fs_->make<TH2F>("h_recSignalEnergy1_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6791     h_recSignalEnergy2_HE5 = fs_->make<TH2F>("h_recSignalEnergy2_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6792     h_recSignalEnergy0_HE6 = fs_->make<TH2F>("h_recSignalEnergy0_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6793     h_recSignalEnergy1_HE6 = fs_->make<TH2F>("h_recSignalEnergy1_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6794     h_recSignalEnergy2_HE6 = fs_->make<TH2F>("h_recSignalEnergy2_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6795     h_recSignalEnergy0_HE7 = fs_->make<TH2F>("h_recSignalEnergy0_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6796     h_recSignalEnergy1_HE7 = fs_->make<TH2F>("h_recSignalEnergy1_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6797     h_recSignalEnergy2_HE7 = fs_->make<TH2F>("h_recSignalEnergy2_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6798 
6799     h_recNoiseEnergy0_HE1 = fs_->make<TH2F>("h_recNoiseEnergy0_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6800     h_recNoiseEnergy1_HE1 = fs_->make<TH2F>("h_recNoiseEnergy1_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6801     h_recNoiseEnergy2_HE1 = fs_->make<TH2F>("h_recNoiseEnergy2_HE1", " ", neta, -41., 41., nphi, 0., bphi);
6802     h_recNoiseEnergy0_HE2 = fs_->make<TH2F>("h_recNoiseEnergy0_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6803     h_recNoiseEnergy1_HE2 = fs_->make<TH2F>("h_recNoiseEnergy1_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6804     h_recNoiseEnergy2_HE2 = fs_->make<TH2F>("h_recNoiseEnergy2_HE2", " ", neta, -41., 41., nphi, 0., bphi);
6805     h_recNoiseEnergy0_HE3 = fs_->make<TH2F>("h_recNoiseEnergy0_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6806     h_recNoiseEnergy1_HE3 = fs_->make<TH2F>("h_recNoiseEnergy1_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6807     h_recNoiseEnergy2_HE3 = fs_->make<TH2F>("h_recNoiseEnergy2_HE3", " ", neta, -41., 41., nphi, 0., bphi);
6808     h_recNoiseEnergy0_HE4 = fs_->make<TH2F>("h_recNoiseEnergy0_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6809     h_recNoiseEnergy1_HE4 = fs_->make<TH2F>("h_recNoiseEnergy1_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6810     h_recNoiseEnergy2_HE4 = fs_->make<TH2F>("h_recNoiseEnergy2_HE4", " ", neta, -41., 41., nphi, 0., bphi);
6811     h_recNoiseEnergy0_HE5 = fs_->make<TH2F>("h_recNoiseEnergy0_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6812     h_recNoiseEnergy1_HE5 = fs_->make<TH2F>("h_recNoiseEnergy1_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6813     h_recNoiseEnergy2_HE5 = fs_->make<TH2F>("h_recNoiseEnergy2_HE5", " ", neta, -41., 41., nphi, 0., bphi);
6814     h_recNoiseEnergy0_HE6 = fs_->make<TH2F>("h_recNoiseEnergy0_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6815     h_recNoiseEnergy1_HE6 = fs_->make<TH2F>("h_recNoiseEnergy1_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6816     h_recNoiseEnergy2_HE6 = fs_->make<TH2F>("h_recNoiseEnergy2_HE6", " ", neta, -41., 41., nphi, 0., bphi);
6817     h_recNoiseEnergy0_HE7 = fs_->make<TH2F>("h_recNoiseEnergy0_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6818     h_recNoiseEnergy1_HE7 = fs_->make<TH2F>("h_recNoiseEnergy1_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6819     h_recNoiseEnergy2_HE7 = fs_->make<TH2F>("h_recNoiseEnergy2_HE7", " ", neta, -41., 41., nphi, 0., bphi);
6820 
6821     //HF:
6822     h_recSignalEnergy0_HF1 = fs_->make<TH2F>("h_recSignalEnergy0_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6823     h_recSignalEnergy1_HF1 = fs_->make<TH2F>("h_recSignalEnergy1_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6824     h_recSignalEnergy2_HF1 = fs_->make<TH2F>("h_recSignalEnergy2_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6825     h_recSignalEnergy0_HF2 = fs_->make<TH2F>("h_recSignalEnergy0_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6826     h_recSignalEnergy1_HF2 = fs_->make<TH2F>("h_recSignalEnergy1_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6827     h_recSignalEnergy2_HF2 = fs_->make<TH2F>("h_recSignalEnergy2_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6828 
6829     h_recNoiseEnergy0_HF1 = fs_->make<TH2F>("h_recNoiseEnergy0_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6830     h_recNoiseEnergy1_HF1 = fs_->make<TH2F>("h_recNoiseEnergy1_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6831     h_recNoiseEnergy2_HF1 = fs_->make<TH2F>("h_recNoiseEnergy2_HF1", " ", neta, -41., 41., nphi, 0., bphi);
6832     h_recNoiseEnergy0_HF2 = fs_->make<TH2F>("h_recNoiseEnergy0_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6833     h_recNoiseEnergy1_HF2 = fs_->make<TH2F>("h_recNoiseEnergy1_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6834     h_recNoiseEnergy2_HF2 = fs_->make<TH2F>("h_recNoiseEnergy2_HF2", " ", neta, -41., 41., nphi, 0., bphi);
6835 
6836     ///////////////////////////////////////////////////////////////////////////////////////////////////  raddam:
6837     // RADDAM:
6838     //    if(flagLaserRaddam_ == 1 ) {
6839     //    }
6840     int min80 = -100.;
6841     int max80 = 9000.;
6842     // fill for each digi (=each event, each channel)
6843     h_mapDepth1RADDAM_HE = fs_->make<TH2F>("h_mapDepth1RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi);
6844     h_mapDepth2RADDAM_HE = fs_->make<TH2F>("h_mapDepth2RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi);
6845     h_mapDepth3RADDAM_HE = fs_->make<TH2F>("h_mapDepth3RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi);
6846     h_mapDepth1RADDAM0_HE = fs_->make<TH2F>("h_mapDepth1RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi);
6847     h_mapDepth2RADDAM0_HE = fs_->make<TH2F>("h_mapDepth2RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi);
6848     h_mapDepth3RADDAM0_HE = fs_->make<TH2F>("h_mapDepth3RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi);
6849 
6850     h_sigLayer1RADDAM_HE = fs_->make<TH1F>("h_sigLayer1RADDAM_HE", " ", neta, -41., 41.);
6851     h_sigLayer2RADDAM_HE = fs_->make<TH1F>("h_sigLayer2RADDAM_HE", " ", neta, -41., 41.);
6852     h_sigLayer1RADDAM0_HE = fs_->make<TH1F>("h_sigLayer1RADDAM0_HE", " ", neta, -41., 41.);
6853     h_sigLayer2RADDAM0_HE = fs_->make<TH1F>("h_sigLayer2RADDAM0_HE", " ", neta, -41., 41.);
6854     h_AamplitudewithPedSubtr_RADDAM_HE = fs_->make<TH1F>("h_AamplitudewithPedSubtr_RADDAM_HE", " ", 100, min80, max80);
6855     h_AamplitudewithPedSubtr_RADDAM_HEzoom0 =
6856         fs_->make<TH1F>("h_AamplitudewithPedSubtr_RADDAM_HEzoom0", " ", 100, min80, 4000.);
6857     h_AamplitudewithPedSubtr_RADDAM_HEzoom1 =
6858         fs_->make<TH1F>("h_AamplitudewithPedSubtr_RADDAM_HEzoom1", " ", 100, min80, 1000.);
6859     h_mapDepth3RADDAM16_HE = fs_->make<TH1F>("h_mapDepth3RADDAM16_HE", " ", 100, min80, max80);
6860     h_A_Depth1RADDAM_HE = fs_->make<TH1F>("h_A_Depth1RADDAM_HE", " ", 100, min80, max80);
6861     h_A_Depth2RADDAM_HE = fs_->make<TH1F>("h_A_Depth2RADDAM_HE", " ", 100, min80, max80);
6862     h_A_Depth3RADDAM_HE = fs_->make<TH1F>("h_A_Depth3RADDAM_HE", " ", 100, min80, max80);
6863     int min90 = 0.;
6864     int max90 = 5000.;
6865     h_sumphiEta16Depth3RADDAM_HED2 = fs_->make<TH1F>("h_sumphiEta16Depth3RADDAM_HED2", " ", 100, min90, 70. * max90);
6866     h_Eta16Depth3RADDAM_HED2 = fs_->make<TH1F>("h_Eta16Depth3RADDAM_HED2", " ", 100, min90, max90);
6867     h_NphiForEta16Depth3RADDAM_HED2 = fs_->make<TH1F>("h_NphiForEta16Depth3RADDAM_HED2", " ", 100, 0, 100.);
6868     h_sumphiEta16Depth3RADDAM_HED2P = fs_->make<TH1F>("h_sumphiEta16Depth3RADDAM_HED2P", " ", 100, min90, 70. * max90);
6869     h_Eta16Depth3RADDAM_HED2P = fs_->make<TH1F>("h_Eta16Depth3RADDAM_HED2P", " ", 100, min90, max90);
6870     h_NphiForEta16Depth3RADDAM_HED2P = fs_->make<TH1F>("h_NphiForEta16Depth3RADDAM_HED2P", " ", 100, 0, 100.);
6871     h_sumphiEta16Depth3RADDAM_HED2ALL =
6872         fs_->make<TH1F>("h_sumphiEta16Depth3RADDAM_HED2ALL", " ", 100, min90, 70. * max90);
6873     h_Eta16Depth3RADDAM_HED2ALL = fs_->make<TH1F>("h_Eta16Depth3RADDAM_HED2ALL", " ", 100, min90, max90);
6874     h_NphiForEta16Depth3RADDAM_HED2ALL = fs_->make<TH1F>("h_NphiForEta16Depth3RADDAM_HED2ALL", " ", 100, 0, 100.);
6875     h_sigLayer1RADDAM5_HE = fs_->make<TH1F>("h_sigLayer1RADDAM5_HE", " ", neta, -41., 41.);
6876     h_sigLayer2RADDAM5_HE = fs_->make<TH1F>("h_sigLayer2RADDAM5_HE", " ", neta, -41., 41.);
6877     h_sigLayer1RADDAM6_HE = fs_->make<TH1F>("h_sigLayer1RADDAM6_HE", " ", neta, -41., 41.);
6878     h_sigLayer2RADDAM6_HE = fs_->make<TH1F>("h_sigLayer2RADDAM6_HE", " ", neta, -41., 41.);
6879     h_sigLayer1RADDAM5_HED2 = fs_->make<TH1F>("h_sigLayer1RADDAM5_HED2", " ", neta, -41., 41.);
6880     h_sigLayer2RADDAM5_HED2 = fs_->make<TH1F>("h_sigLayer2RADDAM5_HED2", " ", neta, -41., 41.);
6881     h_sigLayer1RADDAM6_HED2 = fs_->make<TH1F>("h_sigLayer1RADDAM6_HED2", " ", neta, -41., 41.);
6882     h_sigLayer2RADDAM6_HED2 = fs_->make<TH1F>("h_sigLayer2RADDAM6_HED2", " ", neta, -41., 41.);
6883 
6884     h_numberofhitsHFtest = fs_->make<TH1F>("h_numberofhitsHFtest", " ", 100, 0., 30000.);
6885     h_AmplitudeHFtest = fs_->make<TH1F>("h_AmplitudeHFtest", " ", 100, 0., 300000.);
6886     h_totalAmplitudeHF = fs_->make<TH1F>("h_totalAmplitudeHF", " ", 100, 0., 100000000000.);
6887     h_totalAmplitudeHFperEvent = fs_->make<TH1F>("h_totalAmplitudeHFperEvent", " ", 1000, 1., 1001.);
6888     // fullAmplitude:
6889     h_ADCAmplZoom1_HF = fs_->make<TH1F>("h_ADCAmplZoom1_HF", " ", 100, 0., 1000000.);
6890     h_ADCAmpl_HF = fs_->make<TH1F>("h_ADCAmpl_HF", " ", 250, 0., 500000.);
6891     h_ADCAmplrest1_HF = fs_->make<TH1F>("h_ADCAmplrest1_HF", " ", 100, 0., 1000.);
6892     h_ADCAmplrest6_HF = fs_->make<TH1F>("h_ADCAmplrest6_HF", " ", 100, 0., 10000.);
6893 
6894     h_mapDepth1ADCAmpl225_HF = fs_->make<TH2F>("h_mapDepth1ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6895     h_mapDepth2ADCAmpl225_HF = fs_->make<TH2F>("h_mapDepth2ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6896     h_mapDepth1ADCAmpl225Copy_HF =
6897         fs_->make<TH2F>("h_mapDepth1ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi);
6898     h_mapDepth2ADCAmpl225Copy_HF =
6899         fs_->make<TH2F>("h_mapDepth2ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi);
6900     h_mapDepth1ADCAmpl_HF = fs_->make<TH2F>("h_mapDepth1ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi);
6901     h_mapDepth2ADCAmpl_HF = fs_->make<TH2F>("h_mapDepth2ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi);
6902     h_mapDepth3ADCAmpl225_HF = fs_->make<TH2F>("h_mapDepth3ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6903     h_mapDepth4ADCAmpl225_HF = fs_->make<TH2F>("h_mapDepth4ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6904     h_mapDepth3ADCAmpl225Copy_HF =
6905         fs_->make<TH2F>("h_mapDepth3ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi);
6906     h_mapDepth4ADCAmpl225Copy_HF =
6907         fs_->make<TH2F>("h_mapDepth4ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi);
6908     h_mapDepth3ADCAmpl_HF = fs_->make<TH2F>("h_mapDepth3ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi);
6909     h_mapDepth4ADCAmpl_HF = fs_->make<TH2F>("h_mapDepth4ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi);
6910     h_TSmeanA_HF = fs_->make<TH1F>("h_TSmeanA_HF", " ", 100, -1., 11.);
6911     h_mapDepth1TSmeanA225_HF = fs_->make<TH2F>("h_mapDepth1TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6912     h_mapDepth2TSmeanA225_HF = fs_->make<TH2F>("h_mapDepth2TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6913     h_mapDepth1TSmeanA_HF = fs_->make<TH2F>("h_mapDepth1TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi);
6914     h_mapDepth2TSmeanA_HF = fs_->make<TH2F>("h_mapDepth2TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi);
6915     h_mapDepth3TSmeanA225_HF = fs_->make<TH2F>("h_mapDepth3TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6916     h_mapDepth4TSmeanA225_HF = fs_->make<TH2F>("h_mapDepth4TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6917     h_mapDepth3TSmeanA_HF = fs_->make<TH2F>("h_mapDepth3TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi);
6918     h_mapDepth4TSmeanA_HF = fs_->make<TH2F>("h_mapDepth4TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi);
6919     h_Amplitude_HF = fs_->make<TH1F>("h_Amplitude_HF", " ", 100, 0., 5.);
6920     h_TSmaxA_HF = fs_->make<TH1F>("h_TSmaxA_HF", " ", 100, -1., 11.);
6921     h_mapDepth1TSmaxA225_HF = fs_->make<TH2F>("h_mapDepth1TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6922     h_mapDepth2TSmaxA225_HF = fs_->make<TH2F>("h_mapDepth2TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6923     h_mapDepth1TSmaxA_HF = fs_->make<TH2F>("h_mapDepth1TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi);
6924     h_mapDepth2TSmaxA_HF = fs_->make<TH2F>("h_mapDepth2TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi);
6925     h_mapDepth3TSmaxA225_HF = fs_->make<TH2F>("h_mapDepth3TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6926     h_mapDepth4TSmaxA225_HF = fs_->make<TH2F>("h_mapDepth4TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6927     h_mapDepth3TSmaxA_HF = fs_->make<TH2F>("h_mapDepth3TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi);
6928     h_mapDepth4TSmaxA_HF = fs_->make<TH2F>("h_mapDepth4TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi);
6929     h_Amplitude_HF = fs_->make<TH1F>("h_Amplitude_HF", " ", 100, 0., 5.);
6930     h_mapDepth1Amplitude225_HF = fs_->make<TH2F>("h_mapDepth1Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6931     h_mapDepth2Amplitude225_HF = fs_->make<TH2F>("h_mapDepth2Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6932     h_mapDepth1Amplitude_HF = fs_->make<TH2F>("h_mapDepth1Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi);
6933     h_mapDepth2Amplitude_HF = fs_->make<TH2F>("h_mapDepth2Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi);
6934     h_mapDepth3Amplitude225_HF = fs_->make<TH2F>("h_mapDepth3Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6935     h_mapDepth4Amplitude225_HF = fs_->make<TH2F>("h_mapDepth4Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi);
6936     h_mapDepth3Amplitude_HF = fs_->make<TH2F>("h_mapDepth3Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi);
6937     h_mapDepth4Amplitude_HF = fs_->make<TH2F>("h_mapDepth4Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi);
6938     // Ratio:
6939     h_Ampl_HF = fs_->make<TH1F>("h_Ampl_HF", " ", 100, 0., 1.1);
6940     h_mapDepth1Ampl047_HF = fs_->make<TH2F>("h_mapDepth1Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi);
6941     h_mapDepth2Ampl047_HF = fs_->make<TH2F>("h_mapDepth2Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi);
6942     h_mapDepth1Ampl_HF = fs_->make<TH2F>("h_mapDepth1Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi);
6943     h_mapDepth2Ampl_HF = fs_->make<TH2F>("h_mapDepth2Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi);
6944     h_mapDepth1AmplE34_HF = fs_->make<TH2F>("h_mapDepth1AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi);
6945     h_mapDepth2AmplE34_HF = fs_->make<TH2F>("h_mapDepth2AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi);
6946     h_mapDepth1_HF = fs_->make<TH2F>("h_mapDepth1_HF", " ", neta, -41., 41., nphi, 0., bphi);
6947     h_mapDepth2_HF = fs_->make<TH2F>("h_mapDepth2_HF", " ", neta, -41., 41., nphi, 0., bphi);
6948     h_mapDepth3Ampl047_HF = fs_->make<TH2F>("h_mapDepth3Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi);
6949     h_mapDepth4Ampl047_HF = fs_->make<TH2F>("h_mapDepth4Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi);
6950     h_mapDepth3Ampl_HF = fs_->make<TH2F>("h_mapDepth3Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi);
6951     h_mapDepth4Ampl_HF = fs_->make<TH2F>("h_mapDepth4Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi);
6952     h_mapDepth3AmplE34_HF = fs_->make<TH2F>("h_mapDepth3AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi);
6953     h_mapDepth4AmplE34_HF = fs_->make<TH2F>("h_mapDepth4AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi);
6954     h_mapDepth3_HF = fs_->make<TH2F>("h_mapDepth3_HF", " ", neta, -41., 41., nphi, 0., bphi);
6955     h_mapDepth4_HF = fs_->make<TH2F>("h_mapDepth4_HF", " ", neta, -41., 41., nphi, 0., bphi);
6956 
6957     ////////////////////////////////////////////////////////////////////////////////////////////////                  HO
6958     h_numberofhitsHOtest = fs_->make<TH1F>("h_numberofhitsHOtest", " ", 100, 0., 30000.);
6959     h_AmplitudeHOtest = fs_->make<TH1F>("h_AmplitudeHOtest", " ", 100, 0., 300000.);
6960     h_totalAmplitudeHO = fs_->make<TH1F>("h_totalAmplitudeHO", " ", 100, 0., 100000000.);
6961     h_totalAmplitudeHOperEvent = fs_->make<TH1F>("h_totalAmplitudeHOperEvent", " ", 1000, 1., 1001.);
6962     // fullAmplitude:
6963     h_ADCAmpl_HO = fs_->make<TH1F>("h_ADCAmpl_HO", " ", 100, 0., 7000.);
6964     h_ADCAmplrest1_HO = fs_->make<TH1F>("h_ADCAmplrest1_HO", " ", 100, 0., 150.);
6965     h_ADCAmplrest6_HO = fs_->make<TH1F>("h_ADCAmplrest6_HO", " ", 100, 0., 500.);
6966 
6967     h_ADCAmplZoom1_HO = fs_->make<TH1F>("h_ADCAmplZoom1_HO", " ", 100, -20., 280.);
6968     h_ADCAmpl_HO_copy = fs_->make<TH1F>("h_ADCAmpl_HO_copy", " ", 100, 0., 30000.);
6969     h_mapDepth4ADCAmpl225_HO = fs_->make<TH2F>("h_mapDepth4ADCAmpl225_HO", " ", neta, -41., 41., nphi, 0., bphi);
6970     h_mapDepth4ADCAmpl225Copy_HO =
6971         fs_->make<TH2F>("h_mapDepth4ADCAmpl225Copy_HO", " ", neta, -41., 41., nphi, 0., bphi);
6972     h_mapDepth4ADCAmpl_HO = fs_->make<TH2F>("h_mapDepth4ADCAmpl_HO", " ", neta, -41., 41., nphi, 0., bphi);
6973     h_TSmeanA_HO = fs_->make<TH1F>("h_TSmeanA_HO", " ", 100, 0., 10.);
6974     h_mapDepth4TSmeanA225_HO = fs_->make<TH2F>("h_mapDepth4TSmeanA225_HO", " ", neta, -41., 41., nphi, 0., bphi);
6975     h_mapDepth4TSmeanA_HO = fs_->make<TH2F>("h_mapDepth4TSmeanA_HO", " ", neta, -41., 41., nphi, 0., bphi);
6976     h_TSmaxA_HO = fs_->make<TH1F>("h_TSmaxA_HO", " ", 100, 0., 10.);
6977     h_mapDepth4TSmaxA225_HO = fs_->make<TH2F>("h_mapDepth4TSmaxA225_HO", " ", neta, -41., 41., nphi, 0., bphi);
6978     h_mapDepth4TSmaxA_HO = fs_->make<TH2F>("h_mapDepth4TSmaxA_HO", " ", neta, -41., 41., nphi, 0., bphi);
6979     h_Amplitude_HO = fs_->make<TH1F>("h_Amplitude_HO", " ", 100, 0., 5.);
6980     h_mapDepth4Amplitude225_HO = fs_->make<TH2F>("h_mapDepth4Amplitude225_HO", " ", neta, -41., 41., nphi, 0., bphi);
6981     h_mapDepth4Amplitude_HO = fs_->make<TH2F>("h_mapDepth4Amplitude_HO", " ", neta, -41., 41., nphi, 0., bphi);
6982     // Ratio:
6983     h_Ampl_HO = fs_->make<TH1F>("h_Ampl_HO", " ", 100, 0., 1.1);
6984     h_mapDepth4Ampl047_HO = fs_->make<TH2F>("h_mapDepth4Ampl047_HO", " ", neta, -41., 41., nphi, 0., bphi);
6985     h_mapDepth4Ampl_HO = fs_->make<TH2F>("h_mapDepth4Ampl_HO", " ", neta, -41., 41., nphi, 0., bphi);
6986     h_mapDepth4AmplE34_HO = fs_->make<TH2F>("h_mapDepth4AmplE34_HO", " ", neta, -41., 41., nphi, 0., bphi);
6987     h_mapDepth4_HO = fs_->make<TH2F>("h_mapDepth4_HO", " ", neta, -41., 41., nphi, 0., bphi);
6988 
6989     //////////////////////////////////////////////////////////////////////////////////////
6990     int baP = 4000;
6991     float baR = 0.;
6992     float baR2 = baP;
6993     h_bcnnbadchannels_depth1_HB = fs_->make<TH1F>("h_bcnnbadchannels_depth1_HB", " ", baP, baR, baR2);
6994     h_bcnnbadchannels_depth2_HB = fs_->make<TH1F>("h_bcnnbadchannels_depth2_HB", " ", baP, baR, baR2);
6995     h_bcnnbadchannels_depth1_HE = fs_->make<TH1F>("h_bcnnbadchannels_depth1_HE", " ", baP, baR, baR2);
6996     h_bcnnbadchannels_depth2_HE = fs_->make<TH1F>("h_bcnnbadchannels_depth2_HE", " ", baP, baR, baR2);
6997     h_bcnnbadchannels_depth3_HE = fs_->make<TH1F>("h_bcnnbadchannels_depth3_HE", " ", baP, baR, baR2);
6998     h_bcnnbadchannels_depth4_HO = fs_->make<TH1F>("h_bcnnbadchannels_depth4_HO", " ", baP, baR, baR2);
6999     h_bcnnbadchannels_depth1_HF = fs_->make<TH1F>("h_bcnnbadchannels_depth1_HF", " ", baP, baR, baR2);
7000     h_bcnnbadchannels_depth2_HF = fs_->make<TH1F>("h_bcnnbadchannels_depth2_HF", " ", baP, baR, baR2);
7001     h_bcnbadrate0_depth1_HB = fs_->make<TH1F>("h_bcnbadrate0_depth1_HB", " ", baP, baR, baR2);
7002     h_bcnbadrate0_depth2_HB = fs_->make<TH1F>("h_bcnbadrate0_depth2_HB", " ", baP, baR, baR2);
7003     h_bcnbadrate0_depth1_HE = fs_->make<TH1F>("h_bcnbadrate0_depth1_HE", " ", baP, baR, baR2);
7004     h_bcnbadrate0_depth2_HE = fs_->make<TH1F>("h_bcnbadrate0_depth2_HE", " ", baP, baR, baR2);
7005     h_bcnbadrate0_depth3_HE = fs_->make<TH1F>("h_bcnbadrate0_depth3_HE", " ", baP, baR, baR2);
7006     h_bcnbadrate0_depth4_HO = fs_->make<TH1F>("h_bcnbadrate0_depth4_HO", " ", baP, baR, baR2);
7007     h_bcnbadrate0_depth1_HF = fs_->make<TH1F>("h_bcnbadrate0_depth1_HF", " ", baP, baR, baR2);
7008     h_bcnbadrate0_depth2_HF = fs_->make<TH1F>("h_bcnbadrate0_depth2_HF", " ", baP, baR, baR2);
7009 
7010     h_bcnvsamplitude_HB = fs_->make<TH1F>("h_bcnvsamplitude_HB", " ", baP, baR, baR2);
7011     h_bcnvsamplitude_HE = fs_->make<TH1F>("h_bcnvsamplitude_HE", " ", baP, baR, baR2);
7012     h_bcnvsamplitude_HF = fs_->make<TH1F>("h_bcnvsamplitude_HF", " ", baP, baR, baR2);
7013     h_bcnvsamplitude_HO = fs_->make<TH1F>("h_bcnvsamplitude_HO", " ", baP, baR, baR2);
7014     h_bcnvsamplitude0_HB = fs_->make<TH1F>("h_bcnvsamplitude0_HB", " ", baP, baR, baR2);
7015     h_bcnvsamplitude0_HE = fs_->make<TH1F>("h_bcnvsamplitude0_HE", " ", baP, baR, baR2);
7016     h_bcnvsamplitude0_HF = fs_->make<TH1F>("h_bcnvsamplitude0_HF", " ", baP, baR, baR2);
7017     h_bcnvsamplitude0_HO = fs_->make<TH1F>("h_bcnvsamplitude0_HO", " ", baP, baR, baR2);
7018 
7019     int zaP = 1000;
7020     float zaR = 10000000.;
7021     float zaR2 = 50000000.;
7022     h_orbitNumvsamplitude_HB = fs_->make<TH1F>("h_orbitNumvsamplitude_HB", " ", zaP, zaR, zaR2);
7023     h_orbitNumvsamplitude_HE = fs_->make<TH1F>("h_orbitNumvsamplitude_HE", " ", zaP, zaR, zaR2);
7024     h_orbitNumvsamplitude_HF = fs_->make<TH1F>("h_orbitNumvsamplitude_HF", " ", zaP, zaR, zaR2);
7025     h_orbitNumvsamplitude_HO = fs_->make<TH1F>("h_orbitNumvsamplitude_HO", " ", zaP, zaR, zaR2);
7026     h_orbitNumvsamplitude0_HB = fs_->make<TH1F>("h_orbitNumvsamplitude0_HB", " ", zaP, zaR, zaR2);
7027     h_orbitNumvsamplitude0_HE = fs_->make<TH1F>("h_orbitNumvsamplitude0_HE", " ", zaP, zaR, zaR2);
7028     h_orbitNumvsamplitude0_HF = fs_->make<TH1F>("h_orbitNumvsamplitude0_HF", " ", zaP, zaR, zaR2);
7029     h_orbitNumvsamplitude0_HO = fs_->make<TH1F>("h_orbitNumvsamplitude0_HO", " ", zaP, zaR, zaR2);
7030 
7031     h_2DsumADCAmplEtaPhiLs0 = fs_->make<TH2F>(
7032         "h_2DsumADCAmplEtaPhiLs0", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.);
7033     h_2DsumADCAmplEtaPhiLs1 = fs_->make<TH2F>(
7034         "h_2DsumADCAmplEtaPhiLs1", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.);
7035     h_2DsumADCAmplEtaPhiLs2 = fs_->make<TH2F>(
7036         "h_2DsumADCAmplEtaPhiLs2", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.);
7037     h_2DsumADCAmplEtaPhiLs3 = fs_->make<TH2F>(
7038         "h_2DsumADCAmplEtaPhiLs3", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.);
7039 
7040     h_2DsumADCAmplEtaPhiLs00 = fs_->make<TH2F>(
7041         "h_2DsumADCAmplEtaPhiLs00", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.);
7042     h_2DsumADCAmplEtaPhiLs10 = fs_->make<TH2F>(
7043         "h_2DsumADCAmplEtaPhiLs10", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.);
7044     h_2DsumADCAmplEtaPhiLs20 = fs_->make<TH2F>(
7045         "h_2DsumADCAmplEtaPhiLs20", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.);
7046     h_2DsumADCAmplEtaPhiLs30 = fs_->make<TH2F>(
7047         "h_2DsumADCAmplEtaPhiLs30", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.);
7048 
7049     h_sumADCAmplEtaPhiLs = fs_->make<TH1F>("h_sumADCAmplEtaPhiLs", " ", 1000, 0., 14000.);
7050     h_sumADCAmplEtaPhiLs_bbbc = fs_->make<TH1F>("h_sumADCAmplEtaPhiLs_bbbc", " ", 1000, 0., 300000.);
7051     h_sumADCAmplEtaPhiLs_bbb1 = fs_->make<TH1F>("h_sumADCAmplEtaPhiLs_bbb1", " ", 100, 0., 3000.);
7052     h_sumADCAmplEtaPhiLs_lscounterM1 = fs_->make<TH1F>("h_sumADCAmplEtaPhiLs_lscounterM1", " ", 600, 1., 601.);
7053     h_sumADCAmplEtaPhiLs_ietaphi = fs_->make<TH1F>("h_sumADCAmplEtaPhiLs_ietaphi", " ", 400, 0., 400.);
7054     h_sumADCAmplEtaPhiLs_lscounterM1orbitNum =
7055         fs_->make<TH1F>("h_sumADCAmplEtaPhiLs_lscounterM1orbitNum", " ", 600, 1., 601.);
7056     h_sumADCAmplEtaPhiLs_orbitNum = fs_->make<TH1F>("h_sumADCAmplEtaPhiLs_orbitNum", " ", 1000, 25000000., 40000000.);
7057 
7058     // for LS :
7059 
7060     // for LS binning:
7061     int bac = howmanybinsonplots_;
7062     //  int bac= 15;
7063     float bac2 = bac + 1.;
7064     // bac,         1.,     bac2  );
7065 
7066     h_nbadchannels_depth1_HB = fs_->make<TH1F>("h_nbadchannels_depth1_HB", " ", 30, 1., 31.);
7067     h_runnbadchannels_depth1_HB = fs_->make<TH1F>("h_runnbadchannels_depth1_HB", " ", bac, 1., bac2);
7068     h_runnbadchannelsC_depth1_HB = fs_->make<TH1F>("h_runnbadchannelsC_depth1_HB", " ", bac, 1., bac2);
7069     h_runbadrate_depth1_HB = fs_->make<TH1F>("h_runbadrate_depth1_HB", " ", bac, 1., bac2);
7070     h_runbadrateC_depth1_HB = fs_->make<TH1F>("h_runbadrateC_depth1_HB", " ", bac, 1., bac2);
7071     h_runbadrate0_depth1_HB = fs_->make<TH1F>("h_runbadrate0_depth1_HB", " ", bac, 1., bac2);
7072 
7073     h_nbadchannels_depth2_HB = fs_->make<TH1F>("h_nbadchannels_depth2_HB", " ", 30, 1., 31.);
7074     h_runnbadchannels_depth2_HB = fs_->make<TH1F>("h_runnbadchannels_depth2_HB", " ", bac, 1., bac2);
7075     h_runnbadchannelsC_depth2_HB = fs_->make<TH1F>("h_runnbadchannelsC_depth2_HB", " ", bac, 1., bac2);
7076     h_runbadrate_depth2_HB = fs_->make<TH1F>("h_runbadrate_depth2_HB", " ", bac, 1., bac2);
7077     h_runbadrateC_depth2_HB = fs_->make<TH1F>("h_runbadrateC_depth2_HB", " ", bac, 1., bac2);
7078     h_runbadrate0_depth2_HB = fs_->make<TH1F>("h_runbadrate0_depth2_HB", " ", bac, 1., bac2);
7079 
7080     h_nbadchannels_depth3_HB = fs_->make<TH1F>("h_nbadchannels_depth3_HB", " ", 30, 1., 31.);
7081     h_runnbadchannels_depth3_HB = fs_->make<TH1F>("h_runnbadchannels_depth3_HB", " ", bac, 1., bac2);
7082     h_runnbadchannelsC_depth3_HB = fs_->make<TH1F>("h_runnbadchannelsC_depth3_HB", " ", bac, 1., bac2);
7083     h_runbadrate_depth3_HB = fs_->make<TH1F>("h_runbadrate_depth3_HB", " ", bac, 1., bac2);
7084     h_runbadrateC_depth3_HB = fs_->make<TH1F>("h_runbadrateC_depth3_HB", " ", bac, 1., bac2);
7085     h_runbadrate0_depth3_HB = fs_->make<TH1F>("h_runbadrate0_depth3_HB", " ", bac, 1., bac2);
7086 
7087     h_nbadchannels_depth4_HB = fs_->make<TH1F>("h_nbadchannels_depth4_HB", " ", 30, 1., 31.);
7088     h_runnbadchannels_depth4_HB = fs_->make<TH1F>("h_runnbadchannels_depth4_HB", " ", bac, 1., bac2);
7089     h_runnbadchannelsC_depth4_HB = fs_->make<TH1F>("h_runnbadchannelsC_depth4_HB", " ", bac, 1., bac2);
7090     h_runbadrate_depth4_HB = fs_->make<TH1F>("h_runbadrate_depth4_HB", " ", bac, 1., bac2);
7091     h_runbadrateC_depth4_HB = fs_->make<TH1F>("h_runbadrateC_depth4_HB", " ", bac, 1., bac2);
7092     h_runbadrate0_depth4_HB = fs_->make<TH1F>("h_runbadrate0_depth4_HB", " ", bac, 1., bac2);
7093 
7094     h_nbadchannels_depth1_HE = fs_->make<TH1F>("h_nbadchannels_depth1_HE", " ", 30, 1., 31.);
7095     h_runnbadchannels_depth1_HE = fs_->make<TH1F>("h_runnbadchannels_depth1_HE", " ", bac, 1., bac2);
7096     h_runnbadchannelsC_depth1_HE = fs_->make<TH1F>("h_runnbadchannelsC_depth1_HE", " ", bac, 1., bac2);
7097     h_runbadrate_depth1_HE = fs_->make<TH1F>("h_runbadrate_depth1_HE", " ", bac, 1., bac2);
7098     h_runbadrateC_depth1_HE = fs_->make<TH1F>("h_runbadrateC_depth1_HE", " ", bac, 1., bac2);
7099     h_runbadrate0_depth1_HE = fs_->make<TH1F>("h_runbadrate0_depth1_HE", " ", bac, 1., bac2);
7100 
7101     h_nbadchannels_depth2_HE = fs_->make<TH1F>("h_nbadchannels_depth2_HE", " ", 30, 1., 31.);
7102     h_runnbadchannels_depth2_HE = fs_->make<TH1F>("h_runnbadchannels_depth2_HE", " ", bac, 1., bac2);
7103     h_runnbadchannelsC_depth2_HE = fs_->make<TH1F>("h_runnbadchannelsC_depth2_HE", " ", bac, 1., bac2);
7104     h_runbadrate_depth2_HE = fs_->make<TH1F>("h_runbadrate_depth2_HE", " ", bac, 1., bac2);
7105     h_runbadrateC_depth2_HE = fs_->make<TH1F>("h_runbadrateC_depth2_HE", " ", bac, 1., bac2);
7106     h_runbadrate0_depth2_HE = fs_->make<TH1F>("h_runbadrate0_depth2_HE", " ", bac, 1., bac2);
7107 
7108     h_nbadchannels_depth3_HE = fs_->make<TH1F>("h_nbadchannels_depth3_HE", " ", 30, 1., 31.);
7109     h_runnbadchannels_depth3_HE = fs_->make<TH1F>("h_runnbadchannels_depth3_HE", " ", bac, 1., bac2);
7110     h_runnbadchannelsC_depth3_HE = fs_->make<TH1F>("h_runnbadchannelsC_depth3_HE", " ", bac, 1., bac2);
7111     h_runbadrate_depth3_HE = fs_->make<TH1F>("h_runbadrate_depth3_HE", " ", bac, 1., bac2);
7112     h_runbadrateC_depth3_HE = fs_->make<TH1F>("h_runbadrateC_depth3_HE", " ", bac, 1., bac2);
7113     h_runbadrate0_depth3_HE = fs_->make<TH1F>("h_runbadrate0_depth3_HE", " ", bac, 1., bac2);
7114 
7115     h_nbadchannels_depth4_HE = fs_->make<TH1F>("h_nbadchannels_depth4_HE", " ", 30, 1., 31.);
7116     h_runnbadchannels_depth4_HE = fs_->make<TH1F>("h_runnbadchannels_depth4_HE", " ", bac, 1., bac2);
7117     h_runnbadchannelsC_depth4_HE = fs_->make<TH1F>("h_runnbadchannelsC_depth4_HE", " ", bac, 1., bac2);
7118     h_runbadrate_depth4_HE = fs_->make<TH1F>("h_runbadrate_depth4_HE", " ", bac, 1., bac2);
7119     h_runbadrateC_depth4_HE = fs_->make<TH1F>("h_runbadrateC_depth4_HE", " ", bac, 1., bac2);
7120     h_runbadrate0_depth4_HE = fs_->make<TH1F>("h_runbadrate0_depth4_HE", " ", bac, 1., bac2);
7121 
7122     h_nbadchannels_depth5_HE = fs_->make<TH1F>("h_nbadchannels_depth5_HE", " ", 30, 1., 31.);
7123     h_runnbadchannels_depth5_HE = fs_->make<TH1F>("h_runnbadchannels_depth5_HE", " ", bac, 1., bac2);
7124     h_runnbadchannelsC_depth5_HE = fs_->make<TH1F>("h_runnbadchannelsC_depth5_HE", " ", bac, 1., bac2);
7125     h_runbadrate_depth5_HE = fs_->make<TH1F>("h_runbadrate_depth5_HE", " ", bac, 1., bac2);
7126     h_runbadrateC_depth5_HE = fs_->make<TH1F>("h_runbadrateC_depth5_HE", " ", bac, 1., bac2);
7127     h_runbadrate0_depth5_HE = fs_->make<TH1F>("h_runbadrate0_depth5_HE", " ", bac, 1., bac2);
7128 
7129     h_nbadchannels_depth6_HE = fs_->make<TH1F>("h_nbadchannels_depth6_HE", " ", 30, 1., 31.);
7130     h_runnbadchannels_depth6_HE = fs_->make<TH1F>("h_runnbadchannels_depth6_HE", " ", bac, 1., bac2);
7131     h_runnbadchannelsC_depth6_HE = fs_->make<TH1F>("h_runnbadchannelsC_depth6_HE", " ", bac, 1., bac2);
7132     h_runbadrate_depth6_HE = fs_->make<TH1F>("h_runbadrate_depth6_HE", " ", bac, 1., bac2);
7133     h_runbadrateC_depth6_HE = fs_->make<TH1F>("h_runbadrateC_depth6_HE", " ", bac, 1., bac2);
7134     h_runbadrate0_depth6_HE = fs_->make<TH1F>("h_runbadrate0_depth6_HE", " ", bac, 1., bac2);
7135 
7136     h_nbadchannels_depth7_HE = fs_->make<TH1F>("h_nbadchannels_depth7_HE", " ", 30, 1., 31.);
7137     h_runnbadchannels_depth7_HE = fs_->make<TH1F>("h_runnbadchannels_depth7_HE", " ", bac, 1., bac2);
7138     h_runnbadchannelsC_depth7_HE = fs_->make<TH1F>("h_runnbadchannelsC_depth7_HE", " ", bac, 1., bac2);
7139     h_runbadrate_depth7_HE = fs_->make<TH1F>("h_runbadrate_depth7_HE", " ", bac, 1., bac2);
7140     h_runbadrateC_depth7_HE = fs_->make<TH1F>("h_runbadrateC_depth7_HE", " ", bac, 1., bac2);
7141     h_runbadrate0_depth7_HE = fs_->make<TH1F>("h_runbadrate0_depth7_HE", " ", bac, 1., bac2);
7142 
7143     h_nbadchannels_depth1_HF = fs_->make<TH1F>("h_nbadchannels_depth1_HF", " ", 30, 1., 31.);
7144     h_runnbadchannels_depth1_HF = fs_->make<TH1F>("h_runnbadchannels_depth1_HF", " ", bac, 1., bac2);
7145     h_runnbadchannelsC_depth1_HF = fs_->make<TH1F>("h_runnbadchannelsC_depth1_HF", " ", bac, 1., bac2);
7146     h_runbadrate_depth1_HF = fs_->make<TH1F>("h_runbadrate_depth1_HF", " ", bac, 1., bac2);
7147     h_runbadrateC_depth1_HF = fs_->make<TH1F>("h_runbadrateC_depth1_HF", " ", bac, 1., bac2);
7148     h_runbadrate0_depth1_HF = fs_->make<TH1F>("h_runbadrate0_depth1_HF", " ", bac, 1., bac2);
7149 
7150     h_nbadchannels_depth2_HF = fs_->make<TH1F>("h_nbadchannels_depth2_HF", " ", 30, 1., 31.);
7151     h_runnbadchannels_depth2_HF = fs_->make<TH1F>("h_runnbadchannels_depth2_HF", " ", bac, 1., bac2);
7152     h_runnbadchannelsC_depth2_HF = fs_->make<TH1F>("h_runnbadchannelsC_depth2_HF", " ", bac, 1., bac2);
7153     h_runbadrate_depth2_HF = fs_->make<TH1F>("h_runbadrate_depth2_HF", " ", bac, 1., bac2);
7154     h_runbadrateC_depth2_HF = fs_->make<TH1F>("h_runbadrateC_depth2_HF", " ", bac, 1., bac2);
7155     h_runbadrate0_depth2_HF = fs_->make<TH1F>("h_runbadrate0_depth2_HF", " ", bac, 1., bac2);
7156 
7157     h_nbadchannels_depth3_HF = fs_->make<TH1F>("h_nbadchannels_depth3_HF", " ", 30, 1., 31.);
7158     h_runnbadchannels_depth3_HF = fs_->make<TH1F>("h_runnbadchannels_depth3_HF", " ", bac, 1., bac2);
7159     h_runnbadchannelsC_depth3_HF = fs_->make<TH1F>("h_runnbadchannelsC_depth3_HF", " ", bac, 1., bac2);
7160     h_runbadrate_depth3_HF = fs_->make<TH1F>("h_runbadrate_depth3_HF", " ", bac, 1., bac2);
7161     h_runbadrateC_depth3_HF = fs_->make<TH1F>("h_runbadrateC_depth3_HF", " ", bac, 1., bac2);
7162     h_runbadrate0_depth3_HF = fs_->make<TH1F>("h_runbadrate0_depth3_HF", " ", bac, 1., bac2);
7163 
7164     h_nbadchannels_depth4_HF = fs_->make<TH1F>("h_nbadchannels_depth4_HF", " ", 30, 1., 31.);
7165     h_runnbadchannels_depth4_HF = fs_->make<TH1F>("h_runnbadchannels_depth4_HF", " ", bac, 1., bac2);
7166     h_runnbadchannelsC_depth4_HF = fs_->make<TH1F>("h_runnbadchannelsC_depth4_HF", " ", bac, 1., bac2);
7167     h_runbadrate_depth4_HF = fs_->make<TH1F>("h_runbadrate_depth4_HF", " ", bac, 1., bac2);
7168     h_runbadrateC_depth4_HF = fs_->make<TH1F>("h_runbadrateC_depth4_HF", " ", bac, 1., bac2);
7169     h_runbadrate0_depth4_HF = fs_->make<TH1F>("h_runbadrate0_depth4_HF", " ", bac, 1., bac2);
7170 
7171     h_nbadchannels_depth4_HO = fs_->make<TH1F>("h_nbadchannels_depth4_HO", " ", 30, 1., 31.);
7172     h_runnbadchannels_depth4_HO = fs_->make<TH1F>("h_runnbadchannels_depth4_HO", " ", bac, 1., bac2);
7173     h_runnbadchannelsC_depth4_HO = fs_->make<TH1F>("h_runnbadchannelsC_depth4_HO", " ", bac, 1., bac2);
7174     h_runbadrate_depth4_HO = fs_->make<TH1F>("h_runbadrate_depth4_HO", " ", bac, 1., bac2);
7175     h_runbadrateC_depth4_HO = fs_->make<TH1F>("h_runbadrateC_depth4_HO", " ", bac, 1., bac2);
7176     h_runbadrate0_depth4_HO = fs_->make<TH1F>("h_runbadrate0_depth4_HO", " ", bac, 1., bac2);
7177 
7178     ///////////////////////////////////////////////////////////////////////////////////////////////
7179     h_FullSignal3D_HB = fs_->make<TH2F>("h_FullSignal3D_HB", " ", neta, -41., 41., nphi, 0., bphi);
7180     h_FullSignal3D0_HB = fs_->make<TH2F>("h_FullSignal3D0_HB", " ", neta, -41., 41., nphi, 0., bphi);
7181     h_FullSignal3D_HE = fs_->make<TH2F>("h_FullSignal3D_HE", " ", neta, -41., 41., nphi, 0., bphi);
7182     h_FullSignal3D0_HE = fs_->make<TH2F>("h_FullSignal3D0_HE", " ", neta, -41., 41., nphi, 0., bphi);
7183     h_FullSignal3D_HO = fs_->make<TH2F>("h_FullSignal3D_HO", " ", neta, -41., 41., nphi, 0., bphi);
7184     h_FullSignal3D0_HO = fs_->make<TH2F>("h_FullSignal3D0_HO", " ", neta, -41., 41., nphi, 0., bphi);
7185     h_FullSignal3D_HF = fs_->make<TH2F>("h_FullSignal3D_HF", " ", neta, -41., 41., nphi, 0., bphi);
7186     h_FullSignal3D0_HF = fs_->make<TH2F>("h_FullSignal3D0_HF", " ", neta, -41., 41., nphi, 0., bphi);
7187 
7188     //////////////////////////////////////////////////////////////////////////////////////////////////
7189     h_ADCCalib_HB = fs_->make<TH1F>("h_ADCCalib_HB", " ", 100, 10., 10000.);
7190     h_ADCCalib1_HB = fs_->make<TH1F>("h_ADCCalib1_HB", " ", 100, 0.1, 100.1);
7191     h_mapADCCalib047_HB = fs_->make<TH2F>("h_mapADCCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi);
7192     h_mapADCCalib_HB = fs_->make<TH2F>("h_mapADCCalib_HB", " ", neta, -41., 41., nphi, 0., bphi);
7193     h_RatioCalib_HB = fs_->make<TH1F>("h_RatioCalib_HB", " ", 100, 0., 1.);
7194     h_mapRatioCalib047_HB = fs_->make<TH2F>("h_mapRatioCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi);
7195     h_mapRatioCalib_HB = fs_->make<TH2F>("h_mapRatioCalib_HB", " ", neta, -41., 41., nphi, 0., bphi);
7196     h_TSmaxCalib_HB = fs_->make<TH1F>("h_TSmaxCalib_HB", " ", 100, 0., 10.);
7197     h_mapTSmaxCalib047_HB = fs_->make<TH2F>("h_mapTSmaxCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi);
7198     h_mapTSmaxCalib_HB = fs_->make<TH2F>("h_mapTSmaxCalib_HB", " ", neta, -41., 41., nphi, 0., bphi);
7199     h_TSmeanCalib_HB = fs_->make<TH1F>("h_TSmeanCalib_HB", " ", 100, 0., 10.);
7200     h_mapTSmeanCalib047_HB = fs_->make<TH2F>("h_mapTSmeanCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi);
7201     h_mapTSmeanCalib_HB = fs_->make<TH2F>("h_mapTSmeanCalib_HB", " ", neta, -41., 41., nphi, 0., bphi);
7202     h_WidthCalib_HB = fs_->make<TH1F>("h_WidthCalib_HB", " ", 100, 0., 5.);
7203     h_mapWidthCalib047_HB = fs_->make<TH2F>("h_mapWidthCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi);
7204     h_mapCapCalib047_HB = fs_->make<TH2F>("h_mapCapCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi);
7205     h_mapWidthCalib_HB = fs_->make<TH2F>("h_mapWidthCalib_HB", " ", neta, -41., 41., nphi, 0., bphi);
7206     h_map_HB = fs_->make<TH2F>("h_map_HB", " ", neta, -41., 41., nphi, 0., bphi);
7207     h_ADCCalib_HE = fs_->make<TH1F>("h_ADCCalib_HE", " ", 100, 10., 10000.);
7208     h_ADCCalib1_HE = fs_->make<TH1F>("h_ADCCalib1_HE", " ", 100, 0.1, 100.1);
7209     h_mapADCCalib047_HE = fs_->make<TH2F>("h_mapADCCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi);
7210     h_mapADCCalib_HE = fs_->make<TH2F>("h_mapADCCalib_HE", " ", neta, -41., 41., nphi, 0., bphi);
7211     h_RatioCalib_HE = fs_->make<TH1F>("h_RatioCalib_HE", " ", 100, 0., 1.);
7212     h_mapRatioCalib047_HE = fs_->make<TH2F>("h_mapRatioCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi);
7213     h_mapRatioCalib_HE = fs_->make<TH2F>("h_mapRatioCalib_HE", " ", neta, -41., 41., nphi, 0., bphi);
7214     h_TSmaxCalib_HE = fs_->make<TH1F>("h_TSmaxCalib_HE", " ", 100, 0., 10.);
7215     h_mapTSmaxCalib047_HE = fs_->make<TH2F>("h_mapTSmaxCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi);
7216     h_mapTSmaxCalib_HE = fs_->make<TH2F>("h_mapTSmaxCalib_HE", " ", neta, -41., 41., nphi, 0., bphi);
7217     h_TSmeanCalib_HE = fs_->make<TH1F>("h_TSmeanCalib_HE", " ", 100, 0., 10.);
7218     h_mapTSmeanCalib047_HE = fs_->make<TH2F>("h_mapTSmeanCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi);
7219     h_mapTSmeanCalib_HE = fs_->make<TH2F>("h_mapTSmeanCalib_HE", " ", neta, -41., 41., nphi, 0., bphi);
7220     h_WidthCalib_HE = fs_->make<TH1F>("h_WidthCalib_HE", " ", 100, 0., 5.);
7221     h_mapWidthCalib047_HE = fs_->make<TH2F>("h_mapWidthCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi);
7222     h_mapCapCalib047_HE = fs_->make<TH2F>("h_mapCapCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi);
7223     h_mapWidthCalib_HE = fs_->make<TH2F>("h_mapWidthCalib_HE", " ", neta, -41., 41., nphi, 0., bphi);
7224     h_map_HE = fs_->make<TH2F>("h_map_HE", " ", neta, -41., 41., nphi, 0., bphi);
7225     h_ADCCalib_HO = fs_->make<TH1F>("h_ADCCalib_HO", " ", 100, 10., 10000.);
7226     h_ADCCalib1_HO = fs_->make<TH1F>("h_ADCCalib1_HO", " ", 100, 0.1, 100.1);
7227     h_mapADCCalib047_HO = fs_->make<TH2F>("h_mapADCCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi);
7228     h_mapADCCalib_HO = fs_->make<TH2F>("h_mapADCCalib_HO", " ", neta, -41., 41., nphi, 0., bphi);
7229     h_RatioCalib_HO = fs_->make<TH1F>("h_RatioCalib_HO", " ", 100, 0., 1.);
7230     h_mapRatioCalib047_HO = fs_->make<TH2F>("h_mapRatioCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi);
7231     h_mapRatioCalib_HO = fs_->make<TH2F>("h_mapRatioCalib_HO", " ", neta, -41., 41., nphi, 0., bphi);
7232     h_TSmaxCalib_HO = fs_->make<TH1F>("h_TSmaxCalib_HO", " ", 100, 0., 10.);
7233     h_mapTSmaxCalib047_HO = fs_->make<TH2F>("h_mapTSmaxCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi);
7234     h_mapTSmaxCalib_HO = fs_->make<TH2F>("h_mapTSmaxCalib_HO", " ", neta, -41., 41., nphi, 0., bphi);
7235     h_TSmeanCalib_HO = fs_->make<TH1F>("h_TSmeanCalib_HO", " ", 100, 0., 10.);
7236     h_mapTSmeanCalib047_HO = fs_->make<TH2F>("h_mapTSmeanCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi);
7237     h_mapTSmeanCalib_HO = fs_->make<TH2F>("h_mapTSmeanCalib_HO", " ", neta, -41., 41., nphi, 0., bphi);
7238     h_WidthCalib_HO = fs_->make<TH1F>("h_WidthCalib_HO", " ", 100, 0., 5.);
7239     h_mapWidthCalib047_HO = fs_->make<TH2F>("h_mapWidthCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi);
7240     h_mapCapCalib047_HO = fs_->make<TH2F>("h_mapCapCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi);
7241     h_mapWidthCalib_HO = fs_->make<TH2F>("h_mapWidthCalib_HO", " ", neta, -41., 41., nphi, 0., bphi);
7242     h_map_HO = fs_->make<TH2F>("h_map_HO", " ", neta, -41., 41., nphi, 0., bphi);
7243     h_ADCCalib_HF = fs_->make<TH1F>("h_ADCCalib_HF", " ", 100, 10., 2000.);
7244     h_ADCCalib1_HF = fs_->make<TH1F>("h_ADCCalib1_HF", " ", 100, 0.1, 100.1);
7245     h_mapADCCalib047_HF = fs_->make<TH2F>("h_mapADCCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi);
7246     h_mapADCCalib_HF = fs_->make<TH2F>("h_mapADCCalib_HF", " ", neta, -41., 41., nphi, 0., bphi);
7247     h_RatioCalib_HF = fs_->make<TH1F>("h_RatioCalib_HF", " ", 100, 0., 1.);
7248     h_mapRatioCalib047_HF = fs_->make<TH2F>("h_mapRatioCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi);
7249     h_mapRatioCalib_HF = fs_->make<TH2F>("h_mapRatioCalib_HF", " ", neta, -41., 41., nphi, 0., bphi);
7250     h_TSmaxCalib_HF = fs_->make<TH1F>("h_TSmaxCalib_HF", " ", 100, 0., 10.);
7251     h_mapTSmaxCalib047_HF = fs_->make<TH2F>("h_mapTSmaxCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi);
7252     h_mapTSmaxCalib_HF = fs_->make<TH2F>("h_mapTSmaxCalib_HF", " ", neta, -41., 41., nphi, 0., bphi);
7253     h_TSmeanCalib_HF = fs_->make<TH1F>("h_TSmeanCalib_HF", " ", 100, 0., 10.);
7254     h_mapTSmeanCalib047_HF = fs_->make<TH2F>("h_mapTSmeanCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi);
7255     h_mapTSmeanCalib_HF = fs_->make<TH2F>("h_mapTSmeanCalib_HF", " ", neta, -41., 41., nphi, 0., bphi);
7256     h_WidthCalib_HF = fs_->make<TH1F>("h_WidthCalib_HF", " ", 100, 0., 5.);
7257     h_mapWidthCalib047_HF = fs_->make<TH2F>("h_mapWidthCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi);
7258     h_mapCapCalib047_HF = fs_->make<TH2F>("h_mapCapCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi);
7259     h_mapWidthCalib_HF = fs_->make<TH2F>("h_mapWidthCalib_HF", " ", neta, -41., 41., nphi, 0., bphi);
7260     h_map_HF = fs_->make<TH2F>("h_map_HF", " ", neta, -41., 41., nphi, 0., bphi);
7261 
7262     h_nls_per_run = fs_->make<TH1F>("h_nls_per_run", " ", 100, 0., 800.);
7263     h_nls_per_run10 = fs_->make<TH1F>("h_nls_per_run10", " ", 100, 0., 60.);
7264     h_nevents_per_LS = fs_->make<TH1F>("h_nevents_per_LS", " ", 100, 0., 600.);
7265     h_nevents_per_LSzoom = fs_->make<TH1F>("h_nevents_per_LSzoom", " ", 50, 0., 50.);
7266     h_nevents_per_eachLS = fs_->make<TH1F>("h_nevents_per_eachLS", " ", bac, 1., bac2);
7267     h_nevents_per_eachRealLS = fs_->make<TH1F>("h_nevents_per_eachRealLS", " ", bac, 1., bac2);
7268     h_lsnumber_per_eachLS = fs_->make<TH1F>("h_lsnumber_per_eachLS", " ", bac, 1., bac2);
7269     //--------------------------------------------------
7270     // for estimator0:
7271     float pst1 = 30.;
7272     h_sumPedestalLS1 = fs_->make<TH1F>("h_sumPedestalLS1", " ", 100, 0., pst1);
7273     h_2DsumPedestalLS1 = fs_->make<TH2F>("h_2DsumPedestalLS1", " ", neta, -41., 41., nphi, 0., bphi);
7274     h_sumPedestalperLS1 = fs_->make<TH1F>("h_sumPedestalperLS1", " ", bac, 1., bac2);
7275     h_2D0sumPedestalLS1 = fs_->make<TH2F>("h_2D0sumPedestalLS1", " ", neta, -41., 41., nphi, 0., bphi);
7276     h_sum0PedestalperLS1 = fs_->make<TH1F>("h_sum0PedestalperLS1", " ", bac, 1., bac2);
7277 
7278     h_sumPedestalLS2 = fs_->make<TH1F>("h_sumPedestalLS2", " ", 100, 0., pst1);
7279     h_2DsumPedestalLS2 = fs_->make<TH2F>("h_2DsumPedestalLS2", " ", neta, -41., 41., nphi, 0., bphi);
7280     h_sumPedestalperLS2 = fs_->make<TH1F>("h_sumPedestalperLS2", " ", bac, 1., bac2);
7281     h_2D0sumPedestalLS2 = fs_->make<TH2F>("h_2D0sumPedestalLS2", " ", neta, -41., 41., nphi, 0., bphi);
7282     h_sum0PedestalperLS2 = fs_->make<TH1F>("h_sum0PedestalperLS2", " ", bac, 1., bac2);
7283 
7284     h_sumPedestalLS3 = fs_->make<TH1F>("h_sumPedestalLS3", " ", 100, 0., pst1);
7285     h_2DsumPedestalLS3 = fs_->make<TH2F>("h_2DsumPedestalLS3", " ", neta, -41., 41., nphi, 0., bphi);
7286     h_sumPedestalperLS3 = fs_->make<TH1F>("h_sumPedestalperLS3", " ", bac, 1., bac2);
7287     h_2D0sumPedestalLS3 = fs_->make<TH2F>("h_2D0sumPedestalLS3", " ", neta, -41., 41., nphi, 0., bphi);
7288     h_sum0PedestalperLS3 = fs_->make<TH1F>("h_sum0PedestalperLS3", " ", bac, 1., bac2);
7289 
7290     h_sumPedestalLS4 = fs_->make<TH1F>("h_sumPedestalLS4", " ", 100, 0., pst1);
7291     h_2DsumPedestalLS4 = fs_->make<TH2F>("h_2DsumPedestalLS4", " ", neta, -41., 41., nphi, 0., bphi);
7292     h_sumPedestalperLS4 = fs_->make<TH1F>("h_sumPedestalperLS4", " ", bac, 1., bac2);
7293     h_2D0sumPedestalLS4 = fs_->make<TH2F>("h_2D0sumPedestalLS4", " ", neta, -41., 41., nphi, 0., bphi);
7294     h_sum0PedestalperLS4 = fs_->make<TH1F>("h_sum0PedestalperLS4", " ", bac, 1., bac2);
7295 
7296     h_sumPedestalLS5 = fs_->make<TH1F>("h_sumPedestalLS5", " ", 100, 0., pst1);
7297     h_2DsumPedestalLS5 = fs_->make<TH2F>("h_2DsumPedestalLS5", " ", neta, -41., 41., nphi, 0., bphi);
7298     h_sumPedestalperLS5 = fs_->make<TH1F>("h_sumPedestalperLS5", " ", bac, 1., bac2);
7299     h_2D0sumPedestalLS5 = fs_->make<TH2F>("h_2D0sumPedestalLS5", " ", neta, -41., 41., nphi, 0., bphi);
7300     h_sum0PedestalperLS5 = fs_->make<TH1F>("h_sum0PedestalperLS5", " ", bac, 1., bac2);
7301 
7302     h_sumPedestalLS6 = fs_->make<TH1F>("h_sumPedestalLS6", " ", 100, 0., pst1);
7303     h_2DsumPedestalLS6 = fs_->make<TH2F>("h_2DsumPedestalLS6", " ", neta, -41., 41., nphi, 0., bphi);
7304     h_sumPedestalperLS6 = fs_->make<TH1F>("h_sumPedestalperLS6", " ", bac, 1., bac2);
7305     h_2D0sumPedestalLS6 = fs_->make<TH2F>("h_2D0sumPedestalLS6", " ", neta, -41., 41., nphi, 0., bphi);
7306     h_sum0PedestalperLS6 = fs_->make<TH1F>("h_sum0PedestalperLS6", " ", bac, 1., bac2);
7307 
7308     h_sumPedestalLS7 = fs_->make<TH1F>("h_sumPedestalLS7", " ", 100, 0., pst1);
7309     h_2DsumPedestalLS7 = fs_->make<TH2F>("h_2DsumPedestalLS7", " ", neta, -41., 41., nphi, 0., bphi);
7310     h_sumPedestalperLS7 = fs_->make<TH1F>("h_sumPedestalperLS7", " ", bac, 1., bac2);
7311     h_2D0sumPedestalLS7 = fs_->make<TH2F>("h_2D0sumPedestalLS7", " ", neta, -41., 41., nphi, 0., bphi);
7312     h_sum0PedestalperLS7 = fs_->make<TH1F>("h_sum0PedestalperLS7", " ", bac, 1., bac2);
7313 
7314     h_sumPedestalLS8 = fs_->make<TH1F>("h_sumPedestalLS8", " ", 100, 0., pst1);
7315     h_2DsumPedestalLS8 = fs_->make<TH2F>("h_2DsumPedestalLS8", " ", neta, -41., 41., nphi, 0., bphi);
7316     h_sumPedestalperLS8 = fs_->make<TH1F>("h_sumPedestalperLS8", " ", bac, 1., bac2);
7317     h_2D0sumPedestalLS8 = fs_->make<TH2F>("h_2D0sumPedestalLS8", " ", neta, -41., 41., nphi, 0., bphi);
7318     h_sum0PedestalperLS8 = fs_->make<TH1F>("h_sum0PedestalperLS8", " ", bac, 1., bac2);
7319 
7320     //--------------------------------------------------
7321     // for estimator1:
7322     h_sumADCAmplLS1copy1 = fs_->make<TH1F>("h_sumADCAmplLS1copy1", " ", 100, 0., 10000);
7323     h_sumADCAmplLS1copy2 = fs_->make<TH1F>("h_sumADCAmplLS1copy2", " ", 100, 0., 20000);
7324     h_sumADCAmplLS1copy3 = fs_->make<TH1F>("h_sumADCAmplLS1copy3", " ", 100, 0., 50000);
7325     h_sumADCAmplLS1copy4 = fs_->make<TH1F>("h_sumADCAmplLS1copy4", " ", 100, 0., 100000);
7326     h_sumADCAmplLS1copy5 = fs_->make<TH1F>("h_sumADCAmplLS1copy5", " ", 100, 0., 150000);
7327     h_sumADCAmplLS1 = fs_->make<TH1F>("h_sumADCAmplLS1", " ", 100, 0., lsdep_estimator1_HBdepth1_);
7328     h_2DsumADCAmplLS1 = fs_->make<TH2F>("h_2DsumADCAmplLS1", " ", neta, -41., 41., nphi, 0., bphi);
7329     h_2DsumADCAmplLS1_LSselected =
7330         fs_->make<TH2F>("h_2DsumADCAmplLS1_LSselected", " ", neta, -41., 41., nphi, 0., bphi);
7331     h_sumADCAmplperLS1 = fs_->make<TH1F>("h_sumADCAmplperLS1", " ", bac, 1., bac2);
7332     h_sumCutADCAmplperLS1 = fs_->make<TH1F>("h_sumCutADCAmplperLS1", " ", bac, 1., bac2);
7333     h_2D0sumADCAmplLS1 = fs_->make<TH2F>("h_2D0sumADCAmplLS1", " ", neta, -41., 41., nphi, 0., bphi);
7334     h_sum0ADCAmplperLS1 = fs_->make<TH1F>("h_sum0ADCAmplperLS1", " ", bac, 1., bac2);
7335 
7336     h_sumADCAmplLS2 = fs_->make<TH1F>("h_sumADCAmplLS2", " ", 100, 0., lsdep_estimator1_HBdepth2_);
7337     h_2DsumADCAmplLS2 = fs_->make<TH2F>("h_2DsumADCAmplLS2", " ", neta, -41., 41., nphi, 0., bphi);
7338     h_2DsumADCAmplLS2_LSselected =
7339         fs_->make<TH2F>("h_2DsumADCAmplLS2_LSselected", " ", neta, -41., 41., nphi, 0., bphi);
7340     h_sumADCAmplperLS2 = fs_->make<TH1F>("h_sumADCAmplperLS2", " ", bac, 1., bac2);
7341     h_sumCutADCAmplperLS2 = fs_->make<TH1F>("h_sumCutADCAmplperLS2", " ", bac, 1., bac2);
7342     h_2D0sumADCAmplLS2 = fs_->make<TH2F>("h_2D0sumADCAmplLS2", " ", neta, -41., 41., nphi, 0., bphi);
7343     h_sum0ADCAmplperLS2 = fs_->make<TH1F>("h_sum0ADCAmplperLS2", " ", bac, 1., bac2);
7344 
7345     h_sumADCAmplLS3 = fs_->make<TH1F>("h_sumADCAmplLS3", " ", 100, 0., lsdep_estimator1_HEdepth1_);
7346     h_2DsumADCAmplLS3 = fs_->make<TH2F>("h_2DsumADCAmplLS3", " ", neta, -41., 41., nphi, 0., bphi);
7347     h_2DsumADCAmplLS3_LSselected =
7348         fs_->make<TH2F>("h_2DsumADCAmplLS3_LSselected", " ", neta, -41., 41., nphi, 0., bphi);
7349     h_sumADCAmplperLS3 = fs_->make<TH1F>("h_sumADCAmplperLS3", " ", bac, 1., bac2);
7350     h_sumCutADCAmplperLS3 = fs_->make<TH1F>("h_sumCutADCAmplperLS3", " ", bac, 1., bac2);
7351     h_2D0sumADCAmplLS3 = fs_->make<TH2F>("h_2D0sumADCAmplLS3", " ", neta, -41., 41., nphi, 0., bphi);
7352     h_sum0ADCAmplperLS3 = fs_->make<TH1F>("h_sum0ADCAmplperLS3", " ", bac, 1., bac2);
7353 
7354     h_sumADCAmplLS4 = fs_->make<TH1F>("h_sumADCAmplLS4", " ", 100, 0., lsdep_estimator1_HEdepth2_);
7355     h_2DsumADCAmplLS4 = fs_->make<TH2F>("h_2DsumADCAmplLS4", " ", neta, -41., 41., nphi, 0., bphi);
7356     h_2DsumADCAmplLS4_LSselected =
7357         fs_->make<TH2F>("h_2DsumADCAmplLS4_LSselected", " ", neta, -41., 41., nphi, 0., bphi);
7358     h_sumADCAmplperLS4 = fs_->make<TH1F>("h_sumADCAmplperLS4", " ", bac, 1., bac2);
7359     h_sumCutADCAmplperLS4 = fs_->make<TH1F>("h_sumCutADCAmplperLS4", " ", bac, 1., bac2);
7360     h_2D0sumADCAmplLS4 = fs_->make<TH2F>("h_2D0sumADCAmplLS4", " ", neta, -41., 41., nphi, 0., bphi);
7361     h_sum0ADCAmplperLS4 = fs_->make<TH1F>("h_sum0ADCAmplperLS4", " ", bac, 1., bac2);
7362 
7363     h_sumADCAmplLS5 = fs_->make<TH1F>("h_sumADCAmplLS5", " ", 100, 0., lsdep_estimator1_HEdepth3_);
7364     h_2DsumADCAmplLS5 = fs_->make<TH2F>("h_2DsumADCAmplLS5", " ", neta, -41., 41., nphi, 0., bphi);
7365     h_2DsumADCAmplLS5_LSselected =
7366         fs_->make<TH2F>("h_2DsumADCAmplLS5_LSselected", " ", neta, -41., 41., nphi, 0., bphi);
7367     h_sumADCAmplperLS5 = fs_->make<TH1F>("h_sumADCAmplperLS5", " ", bac, 1., bac2);
7368     h_sumCutADCAmplperLS5 = fs_->make<TH1F>("h_sumCutADCAmplperLS5", " ", bac, 1., bac2);
7369     h_2D0sumADCAmplLS5 = fs_->make<TH2F>("h_2D0sumADCAmplLS5", " ", neta, -41., 41., nphi, 0., bphi);
7370     h_sum0ADCAmplperLS5 = fs_->make<TH1F>("h_sum0ADCAmplperLS5", " ", bac, 1., bac2);
7371     // HE upgrade depth4
7372     h_sumADCAmplperLSdepth4HEu = fs_->make<TH1F>("h_sumADCAmplperLSdepth4HEu", " ", bac, 1., bac2);
7373     h_sumCutADCAmplperLSdepth4HEu = fs_->make<TH1F>("h_sumCutADCAmplperLSdepth4HEu", " ", bac, 1., bac2);
7374     h_sum0ADCAmplperLSdepth4HEu = fs_->make<TH1F>("h_sum0ADCAmplperLSdepth4HEu", " ", bac, 1., bac2);
7375 
7376     // HE upgrade depth5
7377     h_sumADCAmplperLSdepth5HEu = fs_->make<TH1F>("h_sumADCAmplperLSdepth5HEu", " ", bac, 1., bac2);
7378     h_sumCutADCAmplperLSdepth5HEu = fs_->make<TH1F>("h_sumCutADCAmplperLSdepth5HEu", " ", bac, 1., bac2);
7379     h_sum0ADCAmplperLSdepth5HEu = fs_->make<TH1F>("h_sum0ADCAmplperLSdepth5HEu", " ", bac, 1., bac2);
7380     // HE upgrade depth6
7381     h_sumADCAmplperLSdepth6HEu = fs_->make<TH1F>("h_sumADCAmplperLSdepth6HEu", " ", bac, 1., bac2);
7382     h_sumCutADCAmplperLSdepth6HEu = fs_->make<TH1F>("h_sumCutADCAmplperLSdepth6HEu", " ", bac, 1., bac2);
7383     h_sum0ADCAmplperLSdepth6HEu = fs_->make<TH1F>("h_sum0ADCAmplperLSdepth6HEu", " ", bac, 1., bac2);
7384     // HE upgrade depth7
7385     h_sumADCAmplperLSdepth7HEu = fs_->make<TH1F>("h_sumADCAmplperLSdepth7HEu", " ", bac, 1., bac2);
7386     h_sumCutADCAmplperLSdepth7HEu = fs_->make<TH1F>("h_sumCutADCAmplperLSdepth7HEu", " ", bac, 1., bac2);
7387     h_sum0ADCAmplperLSdepth7HEu = fs_->make<TH1F>("h_sum0ADCAmplperLSdepth7HEu", " ", bac, 1., bac2);
7388     // for HE gain stability vs LS:
7389     h_2DsumADCAmplLSdepth4HEu = fs_->make<TH2F>("h_2DsumADCAmplLSdepth4HEu", " ", neta, -41., 41., nphi, 0., bphi);
7390     h_2D0sumADCAmplLSdepth4HEu = fs_->make<TH2F>("h_2D0sumADCAmplLSdepth4HEu", " ", neta, -41., 41., nphi, 0., bphi);
7391     h_2DsumADCAmplLSdepth5HEu = fs_->make<TH2F>("h_2DsumADCAmplLSdepth5HEu", " ", neta, -41., 41., nphi, 0., bphi);
7392     h_2D0sumADCAmplLSdepth5HEu = fs_->make<TH2F>("h_2D0sumADCAmplLSdepth5HEu", " ", neta, -41., 41., nphi, 0., bphi);
7393     h_2DsumADCAmplLSdepth6HEu = fs_->make<TH2F>("h_2DsumADCAmplLSdepth6HEu", " ", neta, -41., 41., nphi, 0., bphi);
7394     h_2D0sumADCAmplLSdepth6HEu = fs_->make<TH2F>("h_2D0sumADCAmplLSdepth6HEu", " ", neta, -41., 41., nphi, 0., bphi);
7395     h_2DsumADCAmplLSdepth7HEu = fs_->make<TH2F>("h_2DsumADCAmplLSdepth7HEu", " ", neta, -41., 41., nphi, 0., bphi);
7396     h_2D0sumADCAmplLSdepth7HEu = fs_->make<TH2F>("h_2D0sumADCAmplLSdepth7HEu", " ", neta, -41., 41., nphi, 0., bphi);
7397     h_2DsumADCAmplLSdepth3HFu = fs_->make<TH2F>("h_2DsumADCAmplLSdepth3HFu", " ", neta, -41., 41., nphi, 0., bphi);
7398     h_2D0sumADCAmplLSdepth3HFu = fs_->make<TH2F>("h_2D0sumADCAmplLSdepth3HFu", " ", neta, -41., 41., nphi, 0., bphi);
7399     h_2DsumADCAmplLSdepth4HFu = fs_->make<TH2F>("h_2DsumADCAmplLSdepth4HFu", " ", neta, -41., 41., nphi, 0., bphi);
7400     h_2D0sumADCAmplLSdepth4HFu = fs_->make<TH2F>("h_2D0sumADCAmplLSdepth4HFu", " ", neta, -41., 41., nphi, 0., bphi);
7401 
7402     h_sumADCAmplLS6 = fs_->make<TH1F>("h_sumADCAmplLS6", " ", 100, 0., lsdep_estimator1_HFdepth1_);
7403     h_2DsumADCAmplLS6 = fs_->make<TH2F>("h_2DsumADCAmplLS6", " ", neta, -41., 41., nphi, 0., bphi);
7404     h_2DsumADCAmplLS6_LSselected =
7405         fs_->make<TH2F>("h_2DsumADCAmplLS6_LSselected", " ", neta, -41., 41., nphi, 0., bphi);
7406     h_2D0sumADCAmplLS6 = fs_->make<TH2F>("h_2D0sumADCAmplLS6", " ", neta, -41., 41., nphi, 0., bphi);
7407     h_sumADCAmplperLS6 = fs_->make<TH1F>("h_sumADCAmplperLS6", " ", bac, 1., bac2);
7408     h_sumCutADCAmplperLS6 = fs_->make<TH1F>("h_sumCutADCAmplperLS6", " ", bac, 1., bac2);
7409     h_sum0ADCAmplperLS6 = fs_->make<TH1F>("h_sum0ADCAmplperLS6", " ", bac, 1., bac2);
7410     // HF upgrade depth3
7411     h_sumADCAmplperLS6u = fs_->make<TH1F>("h_sumADCAmplperLS6u", " ", bac, 1., bac2);
7412     h_sumCutADCAmplperLS6u = fs_->make<TH1F>("h_sumCutADCAmplperLS6u", " ", bac, 1., bac2);
7413     h_sum0ADCAmplperLS6u = fs_->make<TH1F>("h_sum0ADCAmplperLS6u", " ", bac, 1., bac2);
7414 
7415     h_sumADCAmplLS7 = fs_->make<TH1F>("h_sumADCAmplLS7", " ", 100, 0., lsdep_estimator1_HFdepth2_);
7416     h_2DsumADCAmplLS7 = fs_->make<TH2F>("h_2DsumADCAmplLS7", " ", neta, -41., 41., nphi, 0., bphi);
7417     h_2DsumADCAmplLS7_LSselected =
7418         fs_->make<TH2F>("h_2DsumADCAmplLS7_LSselected", " ", neta, -41., 41., nphi, 0., bphi);
7419     h_2D0sumADCAmplLS7 = fs_->make<TH2F>("h_2D0sumADCAmplLS7", " ", neta, -41., 41., nphi, 0., bphi);
7420     h_sumADCAmplperLS7 = fs_->make<TH1F>("h_sumADCAmplperLS7", " ", bac, 1., bac2);
7421     h_sumCutADCAmplperLS7 = fs_->make<TH1F>("h_sumCutADCAmplperLS7", " ", bac, 1., bac2);
7422     h_sum0ADCAmplperLS7 = fs_->make<TH1F>("h_sum0ADCAmplperLS7", " ", bac, 1., bac2);
7423     // HF upgrade depth4
7424     h_sumADCAmplperLS7u = fs_->make<TH1F>("h_sumADCAmplperLS7u", " ", bac, 1., bac2);
7425     h_sumCutADCAmplperLS7u = fs_->make<TH1F>("h_sumCutADCAmplperLS7u", " ", bac, 1., bac2);
7426     h_sum0ADCAmplperLS7u = fs_->make<TH1F>("h_sum0ADCAmplperLS7u", " ", bac, 1., bac2);
7427 
7428     h_sumADCAmplLS8 = fs_->make<TH1F>("h_sumADCAmplLS8", " ", 100, 0., lsdep_estimator1_HOdepth4_);
7429     h_2DsumADCAmplLS8 = fs_->make<TH2F>("h_2DsumADCAmplLS8", " ", neta, -41., 41., nphi, 0., bphi);
7430     h_2DsumADCAmplLS8_LSselected =
7431         fs_->make<TH2F>("h_2DsumADCAmplLS8_LSselected", " ", neta, -41., 41., nphi, 0., bphi);
7432     h_sumADCAmplperLS8 = fs_->make<TH1F>("h_sumADCAmplperLS8", " ", bac, 1., bac2);
7433     h_sumCutADCAmplperLS8 = fs_->make<TH1F>("h_sumCutADCAmplperLS8", " ", bac, 1., bac2);
7434     h_2D0sumADCAmplLS8 = fs_->make<TH2F>("h_2D0sumADCAmplLS8", " ", neta, -41., 41., nphi, 0., bphi);
7435     h_sum0ADCAmplperLS8 = fs_->make<TH1F>("h_sum0ADCAmplperLS8", " ", bac, 1., bac2);
7436 
7437     // HB upgrade depth3
7438     h_sumADCAmplperLSdepth3HBu = fs_->make<TH1F>("h_sumADCAmplperLSdepth3HBu", " ", bac, 1., bac2);
7439     h_sumCutADCAmplperLSdepth3HBu = fs_->make<TH1F>("h_sumCutADCAmplperLSdepth3HBu", " ", bac, 1., bac2);
7440     h_sum0ADCAmplperLSdepth3HBu = fs_->make<TH1F>("h_sum0ADCAmplperLSdepth3HBu", " ", bac, 1., bac2);
7441     // HB upgrade depth4
7442     h_sumADCAmplperLSdepth4HBu = fs_->make<TH1F>("h_sumADCAmplperLSdepth4HBu", " ", bac, 1., bac2);
7443     h_sumCutADCAmplperLSdepth4HBu = fs_->make<TH1F>("h_sumCutADCAmplperLSdepth4HBu", " ", bac, 1., bac2);
7444     h_sum0ADCAmplperLSdepth4HBu = fs_->make<TH1F>("h_sum0ADCAmplperLSdepth4HBu", " ", bac, 1., bac2);
7445 
7446     // for HB gain stability vs LS:
7447     h_2DsumADCAmplLSdepth3HBu = fs_->make<TH2F>("h_2DsumADCAmplLSdepth3HBu", " ", neta, -41., 41., nphi, 0., bphi);
7448     h_2D0sumADCAmplLSdepth3HBu = fs_->make<TH2F>("h_2D0sumADCAmplLSdepth3HBu", " ", neta, -41., 41., nphi, 0., bphi);
7449     h_2DsumADCAmplLSdepth4HBu = fs_->make<TH2F>("h_2DsumADCAmplLSdepth4HBu", " ", neta, -41., 41., nphi, 0., bphi);
7450     h_2D0sumADCAmplLSdepth4HBu = fs_->make<TH2F>("h_2D0sumADCAmplLSdepth4HBu", " ", neta, -41., 41., nphi, 0., bphi);
7451 
7452     // error-A for HB( depth1 only)
7453     h_sumADCAmplperLS1_P1 = fs_->make<TH1F>("h_sumADCAmplperLS1_P1", " ", bac, 1., bac2);
7454     h_sum0ADCAmplperLS1_P1 = fs_->make<TH1F>("h_sum0ADCAmplperLS1_P1", " ", bac, 1., bac2);
7455     h_sumADCAmplperLS1_P2 = fs_->make<TH1F>("h_sumADCAmplperLS1_P2", " ", bac, 1., bac2);
7456     h_sum0ADCAmplperLS1_P2 = fs_->make<TH1F>("h_sum0ADCAmplperLS1_P2", " ", bac, 1., bac2);
7457     h_sumADCAmplperLS1_M1 = fs_->make<TH1F>("h_sumADCAmplperLS1_M1", " ", bac, 1., bac2);
7458     h_sum0ADCAmplperLS1_M1 = fs_->make<TH1F>("h_sum0ADCAmplperLS1_M1", " ", bac, 1., bac2);
7459     h_sumADCAmplperLS1_M2 = fs_->make<TH1F>("h_sumADCAmplperLS1_M2", " ", bac, 1., bac2);
7460     h_sum0ADCAmplperLS1_M2 = fs_->make<TH1F>("h_sum0ADCAmplperLS1_M2", " ", bac, 1., bac2);
7461 
7462     // error-A for HE( depth1 only)
7463     h_sumADCAmplperLS3_P1 = fs_->make<TH1F>("h_sumADCAmplperLS3_P1", " ", bac, 1., bac2);
7464     h_sum0ADCAmplperLS3_P1 = fs_->make<TH1F>("h_sum0ADCAmplperLS3_P1", " ", bac, 1., bac2);
7465     h_sumADCAmplperLS3_P2 = fs_->make<TH1F>("h_sumADCAmplperLS3_P2", " ", bac, 1., bac2);
7466     h_sum0ADCAmplperLS3_P2 = fs_->make<TH1F>("h_sum0ADCAmplperLS3_P2", " ", bac, 1., bac2);
7467     h_sumADCAmplperLS3_M1 = fs_->make<TH1F>("h_sumADCAmplperLS3_M1", " ", bac, 1., bac2);
7468     h_sum0ADCAmplperLS3_M1 = fs_->make<TH1F>("h_sum0ADCAmplperLS3_M1", " ", bac, 1., bac2);
7469     h_sumADCAmplperLS3_M2 = fs_->make<TH1F>("h_sumADCAmplperLS3_M2", " ", bac, 1., bac2);
7470     h_sum0ADCAmplperLS3_M2 = fs_->make<TH1F>("h_sum0ADCAmplperLS3_M2", " ", bac, 1., bac2);
7471 
7472     // error-A for HF( depth1 only)
7473     h_sumADCAmplperLS6_P1 = fs_->make<TH1F>("h_sumADCAmplperLS6_P1", " ", bac, 1., bac2);
7474     h_sum0ADCAmplperLS6_P1 = fs_->make<TH1F>("h_sum0ADCAmplperLS6_P1", " ", bac, 1., bac2);
7475     h_sumADCAmplperLS6_P2 = fs_->make<TH1F>("h_sumADCAmplperLS6_P2", " ", bac, 1., bac2);
7476     h_sum0ADCAmplperLS6_P2 = fs_->make<TH1F>("h_sum0ADCAmplperLS6_P2", " ", bac, 1., bac2);
7477     h_sumADCAmplperLS6_M1 = fs_->make<TH1F>("h_sumADCAmplperLS6_M1", " ", bac, 1., bac2);
7478     h_sum0ADCAmplperLS6_M1 = fs_->make<TH1F>("h_sum0ADCAmplperLS6_M1", " ", bac, 1., bac2);
7479     h_sumADCAmplperLS6_M2 = fs_->make<TH1F>("h_sumADCAmplperLS6_M2", " ", bac, 1., bac2);
7480     h_sum0ADCAmplperLS6_M2 = fs_->make<TH1F>("h_sum0ADCAmplperLS6_M2", " ", bac, 1., bac2);
7481 
7482     // error-A for HO( depth4 only)
7483     h_sumADCAmplperLS8_P1 = fs_->make<TH1F>("h_sumADCAmplperLS8_P1", " ", bac, 1., bac2);
7484     h_sum0ADCAmplperLS8_P1 = fs_->make<TH1F>("h_sum0ADCAmplperLS8_P1", " ", bac, 1., bac2);
7485     h_sumADCAmplperLS8_P2 = fs_->make<TH1F>("h_sumADCAmplperLS8_P2", " ", bac, 1., bac2);
7486     h_sum0ADCAmplperLS8_P2 = fs_->make<TH1F>("h_sum0ADCAmplperLS8_P2", " ", bac, 1., bac2);
7487     h_sumADCAmplperLS8_M1 = fs_->make<TH1F>("h_sumADCAmplperLS8_M1", " ", bac, 1., bac2);
7488     h_sum0ADCAmplperLS8_M1 = fs_->make<TH1F>("h_sum0ADCAmplperLS8_M1", " ", bac, 1., bac2);
7489     h_sumADCAmplperLS8_M2 = fs_->make<TH1F>("h_sumADCAmplperLS8_M2", " ", bac, 1., bac2);
7490     h_sum0ADCAmplperLS8_M2 = fs_->make<TH1F>("h_sum0ADCAmplperLS8_M2", " ", bac, 1., bac2);
7491 
7492     //--------------------------------------------------
7493     h_sumTSmeanALS1 = fs_->make<TH1F>("h_sumTSmeanALS1", " ", 100, 0., lsdep_estimator2_HBdepth1_);
7494     h_2DsumTSmeanALS1 = fs_->make<TH2F>("h_2DsumTSmeanALS1", " ", neta, -41., 41., nphi, 0., bphi);
7495     h_sumTSmeanAperLS1 = fs_->make<TH1F>("h_sumTSmeanAperLS1", " ", bac, 1., bac2);
7496     h_sumTSmeanAperLS1_LSselected = fs_->make<TH1F>("h_sumTSmeanAperLS1_LSselected", " ", bac, 1., bac2);
7497     h_sumCutTSmeanAperLS1 = fs_->make<TH1F>("h_sumCutTSmeanAperLS1", " ", bac, 1., bac2);
7498     h_2D0sumTSmeanALS1 = fs_->make<TH2F>("h_2D0sumTSmeanALS1", " ", neta, -41., 41., nphi, 0., bphi);
7499     h_sum0TSmeanAperLS1 = fs_->make<TH1F>("h_sum0TSmeanAperLS1", " ", bac, 1., bac2);
7500 
7501     h_sumTSmeanALS2 = fs_->make<TH1F>("h_sumTSmeanALS2", " ", 100, 0., lsdep_estimator2_HBdepth2_);
7502     h_2DsumTSmeanALS2 = fs_->make<TH2F>("h_2DsumTSmeanALS2", " ", neta, -41., 41., nphi, 0., bphi);
7503     h_sumTSmeanAperLS2 = fs_->make<TH1F>("h_sumTSmeanAperLS2", " ", bac, 1., bac2);
7504     h_sumCutTSmeanAperLS2 = fs_->make<TH1F>("h_sumCutTSmeanAperLS2", " ", bac, 1., bac2);
7505     h_2D0sumTSmeanALS2 = fs_->make<TH2F>("h_2D0sumTSmeanALS2", " ", neta, -41., 41., nphi, 0., bphi);
7506     h_sum0TSmeanAperLS2 = fs_->make<TH1F>("h_sum0TSmeanAperLS2", " ", bac, 1., bac2);
7507 
7508     h_sumTSmeanALS3 = fs_->make<TH1F>("h_sumTSmeanALS3", " ", 100, 0., lsdep_estimator2_HEdepth1_);
7509     h_2DsumTSmeanALS3 = fs_->make<TH2F>("h_2DsumTSmeanALS3", " ", neta, -41., 41., nphi, 0., bphi);
7510     h_sumTSmeanAperLS3 = fs_->make<TH1F>("h_sumTSmeanAperLS3", " ", bac, 1., bac2);
7511     h_sumCutTSmeanAperLS3 = fs_->make<TH1F>("h_sumCutTSmeanAperLS3", " ", bac, 1., bac2);
7512     h_2D0sumTSmeanALS3 = fs_->make<TH2F>("h_2D0sumTSmeanALS3", " ", neta, -41., 41., nphi, 0., bphi);
7513     h_sum0TSmeanAperLS3 = fs_->make<TH1F>("h_sum0TSmeanAperLS3", " ", bac, 1., bac2);
7514 
7515     h_sumTSmeanALS4 = fs_->make<TH1F>("h_sumTSmeanALS4", " ", 100, 0., lsdep_estimator2_HEdepth2_);
7516     h_2DsumTSmeanALS4 = fs_->make<TH2F>("h_2DsumTSmeanALS4", " ", neta, -41., 41., nphi, 0., bphi);
7517     h_sumTSmeanAperLS4 = fs_->make<TH1F>("h_sumTSmeanAperLS4", " ", bac, 1., bac2);
7518     h_sumCutTSmeanAperLS4 = fs_->make<TH1F>("h_sumCutTSmeanAperLS4", " ", bac, 1., bac2);
7519     h_2D0sumTSmeanALS4 = fs_->make<TH2F>("h_2D0sumTSmeanALS4", " ", neta, -41., 41., nphi, 0., bphi);
7520     h_sum0TSmeanAperLS4 = fs_->make<TH1F>("h_sum0TSmeanAperLS4", " ", bac, 1., bac2);
7521 
7522     h_sumTSmeanALS5 = fs_->make<TH1F>("h_sumTSmeanALS5", " ", 100, 0., lsdep_estimator2_HEdepth3_);
7523     h_2DsumTSmeanALS5 = fs_->make<TH2F>("h_2DsumTSmeanALS5", " ", neta, -41., 41., nphi, 0., bphi);
7524     h_sumTSmeanAperLS5 = fs_->make<TH1F>("h_sumTSmeanAperLS5", " ", bac, 1., bac2);
7525     h_sumCutTSmeanAperLS5 = fs_->make<TH1F>("h_sumCutTSmeanAperLS5", " ", bac, 1., bac2);
7526     h_2D0sumTSmeanALS5 = fs_->make<TH2F>("h_2D0sumTSmeanALS5", " ", neta, -41., 41., nphi, 0., bphi);
7527     h_sum0TSmeanAperLS5 = fs_->make<TH1F>("h_sum0TSmeanAperLS5", " ", bac, 1., bac2);
7528 
7529     h_sumTSmeanALS6 = fs_->make<TH1F>("h_sumTSmeanALS6", " ", 100, 0., lsdep_estimator2_HFdepth1_);
7530     h_2DsumTSmeanALS6 = fs_->make<TH2F>("h_2DsumTSmeanALS6", " ", neta, -41., 41., nphi, 0., bphi);
7531     h_sumTSmeanAperLS6 = fs_->make<TH1F>("h_sumTSmeanAperLS6", " ", bac, 1., bac2);
7532     h_sumCutTSmeanAperLS6 = fs_->make<TH1F>("h_sumCutTSmeanAperLS6", " ", bac, 1., bac2);
7533     h_2D0sumTSmeanALS6 = fs_->make<TH2F>("h_2D0sumTSmeanALS6", " ", neta, -41., 41., nphi, 0., bphi);
7534     h_sum0TSmeanAperLS6 = fs_->make<TH1F>("h_sum0TSmeanAperLS6", " ", bac, 1., bac2);
7535 
7536     h_sumTSmeanALS7 = fs_->make<TH1F>("h_sumTSmeanALS7", " ", 100, 0., lsdep_estimator2_HFdepth2_);
7537     h_2DsumTSmeanALS7 = fs_->make<TH2F>("h_2DsumTSmeanALS7", " ", neta, -41., 41., nphi, 0., bphi);
7538     h_sumTSmeanAperLS7 = fs_->make<TH1F>("h_sumTSmeanAperLS7", " ", bac, 1., bac2);
7539     h_sumCutTSmeanAperLS7 = fs_->make<TH1F>("h_sumCutTSmeanAperLS7", " ", bac, 1., bac2);
7540     h_2D0sumTSmeanALS7 = fs_->make<TH2F>("h_2D0sumTSmeanALS7", " ", neta, -41., 41., nphi, 0., bphi);
7541     h_sum0TSmeanAperLS7 = fs_->make<TH1F>("h_sum0TSmeanAperLS7", " ", bac, 1., bac2);
7542 
7543     h_sumTSmeanALS8 = fs_->make<TH1F>("h_sumTSmeanALS8", " ", 100, 0., lsdep_estimator2_HOdepth4_);
7544     h_2DsumTSmeanALS8 = fs_->make<TH2F>("h_2DsumTSmeanALS8", " ", neta, -41., 41., nphi, 0., bphi);
7545     h_sumTSmeanAperLS8 = fs_->make<TH1F>("h_sumTSmeanAperLS8", " ", bac, 1., bac2);
7546     h_sumCutTSmeanAperLS8 = fs_->make<TH1F>("h_sumCutTSmeanAperLS8", " ", bac, 1., bac2);
7547     h_2D0sumTSmeanALS8 = fs_->make<TH2F>("h_2D0sumTSmeanALS8", " ", neta, -41., 41., nphi, 0., bphi);
7548     h_sum0TSmeanAperLS8 = fs_->make<TH1F>("h_sum0TSmeanAperLS8", " ", bac, 1., bac2);
7549     //--------------------------------------------------
7550     // for estimator3:
7551     h_sumTSmaxALS1 = fs_->make<TH1F>("h_sumTSmaxALS1", " ", 100, 0., lsdep_estimator3_HBdepth1_);
7552     h_2DsumTSmaxALS1 = fs_->make<TH2F>("h_2DsumTSmaxALS1", " ", neta, -41., 41., nphi, 0., bphi);
7553     h_sumTSmaxAperLS1 = fs_->make<TH1F>("h_sumTSmaxAperLS1", " ", bac, 1., bac2);
7554     h_sumTSmaxAperLS1_LSselected = fs_->make<TH1F>("h_sumTSmaxAperLS1_LSselected", " ", bac, 1., bac2);
7555     h_sumCutTSmaxAperLS1 = fs_->make<TH1F>("h_sumCutTSmaxAperLS1", " ", bac, 1., bac2);
7556     h_2D0sumTSmaxALS1 = fs_->make<TH2F>("h_2D0sumTSmaxALS1", " ", neta, -41., 41., nphi, 0., bphi);
7557     h_sum0TSmaxAperLS1 = fs_->make<TH1F>("h_sum0TSmaxAperLS1", " ", bac, 1., bac2);
7558 
7559     h_sumTSmaxALS2 = fs_->make<TH1F>("h_sumTSmaxALS2", " ", 100, 0., lsdep_estimator3_HBdepth2_);
7560     h_2DsumTSmaxALS2 = fs_->make<TH2F>("h_2DsumTSmaxALS2", " ", neta, -41., 41., nphi, 0., bphi);
7561     h_sumTSmaxAperLS2 = fs_->make<TH1F>("h_sumTSmaxAperLS2", " ", bac, 1., bac2);
7562     h_sumCutTSmaxAperLS2 = fs_->make<TH1F>("h_sumCutTSmaxAperLS2", " ", bac, 1., bac2);
7563     h_2D0sumTSmaxALS2 = fs_->make<TH2F>("h_2D0sumTSmaxALS2", " ", neta, -41., 41., nphi, 0., bphi);
7564     h_sum0TSmaxAperLS2 = fs_->make<TH1F>("h_sum0TSmaxAperLS2", " ", bac, 1., bac2);
7565 
7566     h_sumTSmaxALS3 = fs_->make<TH1F>("h_sumTSmaxALS3", " ", 100, 0., lsdep_estimator3_HEdepth1_);
7567     h_2DsumTSmaxALS3 = fs_->make<TH2F>("h_2DsumTSmaxALS3", " ", neta, -41., 41., nphi, 0., bphi);
7568     h_sumTSmaxAperLS3 = fs_->make<TH1F>("h_sumTSmaxAperLS3", " ", bac, 1., bac2);
7569     h_sumCutTSmaxAperLS3 = fs_->make<TH1F>("h_sumCutTSmaxAperLS3", " ", bac, 1., bac2);
7570     h_2D0sumTSmaxALS3 = fs_->make<TH2F>("h_2D0sumTSmaxALS3", " ", neta, -41., 41., nphi, 0., bphi);
7571     h_sum0TSmaxAperLS3 = fs_->make<TH1F>("h_sum0TSmaxAperLS3", " ", bac, 1., bac2);
7572 
7573     h_sumTSmaxALS4 = fs_->make<TH1F>("h_sumTSmaxALS4", " ", 100, 0., lsdep_estimator3_HEdepth2_);
7574     h_2DsumTSmaxALS4 = fs_->make<TH2F>("h_2DsumTSmaxALS4", " ", neta, -41., 41., nphi, 0., bphi);
7575     h_sumTSmaxAperLS4 = fs_->make<TH1F>("h_sumTSmaxAperLS4", " ", bac, 1., bac2);
7576     h_sumCutTSmaxAperLS4 = fs_->make<TH1F>("h_sumCutTSmaxAperLS4", " ", bac, 1., bac2);
7577     h_2D0sumTSmaxALS4 = fs_->make<TH2F>("h_2D0sumTSmaxALS4", " ", neta, -41., 41., nphi, 0., bphi);
7578     h_sum0TSmaxAperLS4 = fs_->make<TH1F>("h_sum0TSmaxAperLS4", " ", bac, 1., bac2);
7579 
7580     h_sumTSmaxALS5 = fs_->make<TH1F>("h_sumTSmaxALS5", " ", 100, 0., lsdep_estimator3_HEdepth3_);
7581     h_2DsumTSmaxALS5 = fs_->make<TH2F>("h_2DsumTSmaxALS5", " ", neta, -41., 41., nphi, 0., bphi);
7582     h_sumTSmaxAperLS5 = fs_->make<TH1F>("h_sumTSmaxAperLS5", " ", bac, 1., bac2);
7583     h_sumCutTSmaxAperLS5 = fs_->make<TH1F>("h_sumCutTSmaxAperLS5", " ", bac, 1., bac2);
7584     h_2D0sumTSmaxALS5 = fs_->make<TH2F>("h_2D0sumTSmaxALS5", " ", neta, -41., 41., nphi, 0., bphi);
7585     h_sum0TSmaxAperLS5 = fs_->make<TH1F>("h_sum0TSmaxAperLS5", " ", bac, 1., bac2);
7586 
7587     h_sumTSmaxALS6 = fs_->make<TH1F>("h_sumTSmaxALS6", " ", 100, 0., lsdep_estimator3_HFdepth1_);
7588     h_2DsumTSmaxALS6 = fs_->make<TH2F>("h_2DsumTSmaxALS6", " ", neta, -41., 41., nphi, 0., bphi);
7589     h_sumTSmaxAperLS6 = fs_->make<TH1F>("h_sumTSmaxAperLS6", " ", bac, 1., bac2);
7590     h_sumCutTSmaxAperLS6 = fs_->make<TH1F>("h_sumCutTSmaxAperLS6", " ", bac, 1., bac2);
7591     h_2D0sumTSmaxALS6 = fs_->make<TH2F>("h_2D0sumTSmaxALS6", " ", neta, -41., 41., nphi, 0., bphi);
7592     h_sum0TSmaxAperLS6 = fs_->make<TH1F>("h_sum0TSmaxAperLS6", " ", bac, 1., bac2);
7593 
7594     h_sumTSmaxALS7 = fs_->make<TH1F>("h_sumTSmaxALS7", " ", 100, 0., lsdep_estimator3_HFdepth2_);
7595     h_2DsumTSmaxALS7 = fs_->make<TH2F>("h_2DsumTSmaxALS7", " ", neta, -41., 41., nphi, 0., bphi);
7596     h_sumTSmaxAperLS7 = fs_->make<TH1F>("h_sumTSmaxAperLS7", " ", bac, 1., bac2);
7597     h_sumCutTSmaxAperLS7 = fs_->make<TH1F>("h_sumCutTSmaxAperLS7", " ", bac, 1., bac2);
7598     h_2D0sumTSmaxALS7 = fs_->make<TH2F>("h_2D0sumTSmaxALS7", " ", neta, -41., 41., nphi, 0., bphi);
7599     h_sum0TSmaxAperLS7 = fs_->make<TH1F>("h_sum0TSmaxAperLS7", " ", bac, 1., bac2);
7600 
7601     h_sumTSmaxALS8 = fs_->make<TH1F>("h_sumTSmaxALS8", " ", 100, 0., lsdep_estimator3_HOdepth4_);
7602     h_2DsumTSmaxALS8 = fs_->make<TH2F>("h_2DsumTSmaxALS8", " ", neta, -41., 41., nphi, 0., bphi);
7603     h_sumTSmaxAperLS8 = fs_->make<TH1F>("h_sumTSmaxAperLS8", " ", bac, 1., bac2);
7604     h_sumCutTSmaxAperLS8 = fs_->make<TH1F>("h_sumCutTSmaxAperLS8", " ", bac, 1., bac2);
7605     h_2D0sumTSmaxALS8 = fs_->make<TH2F>("h_2D0sumTSmaxALS8", " ", neta, -41., 41., nphi, 0., bphi);
7606     h_sum0TSmaxAperLS8 = fs_->make<TH1F>("h_sum0TSmaxAperLS8", " ", bac, 1., bac2);
7607     //--------------------------------------------------
7608     // for estimator4:
7609     h_sumAmplitudeLS1 = fs_->make<TH1F>("h_sumAmplitudeLS1", " ", 100, 0.0, lsdep_estimator4_HBdepth1_);
7610     h_2DsumAmplitudeLS1 = fs_->make<TH2F>("h_2DsumAmplitudeLS1", " ", neta, -41., 41., nphi, 0., bphi);
7611     h_sumAmplitudeperLS1 = fs_->make<TH1F>("h_sumAmplitudeperLS1", " ", bac, 1., bac2);
7612     h_sumAmplitudeperLS1_LSselected = fs_->make<TH1F>("h_sumAmplitudeperLS1_LSselected", " ", bac, 1., bac2);
7613     h_sumCutAmplitudeperLS1 = fs_->make<TH1F>("h_sumCutAmplitudeperLS1", " ", bac, 1., bac2);
7614     h_2D0sumAmplitudeLS1 = fs_->make<TH2F>("h_2D0sumAmplitudeLS1", " ", neta, -41., 41., nphi, 0., bphi);
7615     h_sum0AmplitudeperLS1 = fs_->make<TH1F>("h_sum0AmplitudeperLS1", " ", bac, 1., bac2);
7616 
7617     h_sumAmplitudeLS2 = fs_->make<TH1F>("h_sumAmplitudeLS2", " ", 100, 0.0, lsdep_estimator4_HBdepth2_);
7618     h_2DsumAmplitudeLS2 = fs_->make<TH2F>("h_2DsumAmplitudeLS2", " ", neta, -41., 41., nphi, 0., bphi);
7619     h_sumAmplitudeperLS2 = fs_->make<TH1F>("h_sumAmplitudeperLS2", " ", bac, 1., bac2);
7620     h_sumCutAmplitudeperLS2 = fs_->make<TH1F>("h_sumCutAmplitudeperLS2", " ", bac, 1., bac2);
7621     h_2D0sumAmplitudeLS2 = fs_->make<TH2F>("h_2D0sumAmplitudeLS2", " ", neta, -41., 41., nphi, 0., bphi);
7622     h_sum0AmplitudeperLS2 = fs_->make<TH1F>("h_sum0AmplitudeperLS2", " ", bac, 1., bac2);
7623 
7624     h_sumAmplitudeLS3 = fs_->make<TH1F>("h_sumAmplitudeLS3", " ", 100, 0.0, lsdep_estimator4_HEdepth1_);
7625     h_2DsumAmplitudeLS3 = fs_->make<TH2F>("h_2DsumAmplitudeLS3", " ", neta, -41., 41., nphi, 0., bphi);
7626     h_sumAmplitudeperLS3 = fs_->make<TH1F>("h_sumAmplitudeperLS3", " ", bac, 1., bac2);
7627     h_sumCutAmplitudeperLS3 = fs_->make<TH1F>("h_sumCutAmplitudeperLS3", " ", bac, 1., bac2);
7628     h_2D0sumAmplitudeLS3 = fs_->make<TH2F>("h_2D0sumAmplitudeLS3", " ", neta, -41., 41., nphi, 0., bphi);
7629     h_sum0AmplitudeperLS3 = fs_->make<TH1F>("h_sum0AmplitudeperLS3", " ", bac, 1., bac2);
7630 
7631     h_sumAmplitudeLS4 = fs_->make<TH1F>("h_sumAmplitudeLS4", " ", 100, 0.0, lsdep_estimator4_HEdepth2_);
7632     h_2DsumAmplitudeLS4 = fs_->make<TH2F>("h_2DsumAmplitudeLS4", " ", neta, -41., 41., nphi, 0., bphi);
7633     h_sumAmplitudeperLS4 = fs_->make<TH1F>("h_sumAmplitudeperLS4", " ", bac, 1., bac2);
7634     h_sumCutAmplitudeperLS4 = fs_->make<TH1F>("h_sumCutAmplitudeperLS4", " ", bac, 1., bac2);
7635     h_2D0sumAmplitudeLS4 = fs_->make<TH2F>("h_2D0sumAmplitudeLS4", " ", neta, -41., 41., nphi, 0., bphi);
7636     h_sum0AmplitudeperLS4 = fs_->make<TH1F>("h_sum0AmplitudeperLS4", " ", bac, 1., bac2);
7637 
7638     h_sumAmplitudeLS5 = fs_->make<TH1F>("h_sumAmplitudeLS5", " ", 100, 0.0, lsdep_estimator4_HEdepth3_);
7639     h_2DsumAmplitudeLS5 = fs_->make<TH2F>("h_2DsumAmplitudeLS5", " ", neta, -41., 41., nphi, 0., bphi);
7640     h_sumAmplitudeperLS5 = fs_->make<TH1F>("h_sumAmplitudeperLS5", " ", bac, 1., bac2);
7641     h_sumCutAmplitudeperLS5 = fs_->make<TH1F>("h_sumCutAmplitudeperLS5", " ", bac, 1., bac2);
7642     h_2D0sumAmplitudeLS5 = fs_->make<TH2F>("h_2D0sumAmplitudeLS5", " ", neta, -41., 41., nphi, 0., bphi);
7643     h_sum0AmplitudeperLS5 = fs_->make<TH1F>("h_sum0AmplitudeperLS5", " ", bac, 1., bac2);
7644 
7645     h_sumAmplitudeLS6 = fs_->make<TH1F>("h_sumAmplitudeLS6", " ", 100, 0., lsdep_estimator4_HFdepth1_);
7646     h_2DsumAmplitudeLS6 = fs_->make<TH2F>("h_2DsumAmplitudeLS6", " ", neta, -41., 41., nphi, 0., bphi);
7647     h_sumAmplitudeperLS6 = fs_->make<TH1F>("h_sumAmplitudeperLS6", " ", bac, 1., bac2);
7648     h_sumCutAmplitudeperLS6 = fs_->make<TH1F>("h_sumCutAmplitudeperLS6", " ", bac, 1., bac2);
7649     h_2D0sumAmplitudeLS6 = fs_->make<TH2F>("h_2D0sumAmplitudeLS6", " ", neta, -41., 41., nphi, 0., bphi);
7650     h_sum0AmplitudeperLS6 = fs_->make<TH1F>("h_sum0AmplitudeperLS6", " ", bac, 1., bac2);
7651 
7652     h_sumAmplitudeLS7 = fs_->make<TH1F>("h_sumAmplitudeLS7", " ", 100, 0., lsdep_estimator4_HFdepth2_);
7653     h_2DsumAmplitudeLS7 = fs_->make<TH2F>("h_2DsumAmplitudeLS7", " ", neta, -41., 41., nphi, 0., bphi);
7654     h_sumAmplitudeperLS7 = fs_->make<TH1F>("h_sumAmplitudeperLS7", " ", bac, 1., bac2);
7655     h_sumCutAmplitudeperLS7 = fs_->make<TH1F>("h_sumCutAmplitudeperLS7", " ", bac, 1., bac2);
7656     h_2D0sumAmplitudeLS7 = fs_->make<TH2F>("h_2D0sumAmplitudeLS7", " ", neta, -41., 41., nphi, 0., bphi);
7657     h_sum0AmplitudeperLS7 = fs_->make<TH1F>("h_sum0AmplitudeperLS7", " ", bac, 1., bac2);
7658 
7659     h_sumAmplitudeLS8 = fs_->make<TH1F>("h_sumAmplitudeLS8", " ", 100, 0., lsdep_estimator4_HOdepth4_);
7660     h_2DsumAmplitudeLS8 = fs_->make<TH2F>("h_2DsumAmplitudeLS8", " ", neta, -41., 41., nphi, 0., bphi);
7661     h_sumAmplitudeperLS8 = fs_->make<TH1F>("h_sumAmplitudeperLS8", " ", bac, 1., bac2);
7662     h_sumCutAmplitudeperLS8 = fs_->make<TH1F>("h_sumCutAmplitudeperLS8", " ", bac, 1., bac2);
7663     h_2D0sumAmplitudeLS8 = fs_->make<TH2F>("h_2D0sumAmplitudeLS8", " ", neta, -41., 41., nphi, 0., bphi);
7664     h_sum0AmplitudeperLS8 = fs_->make<TH1F>("h_sum0AmplitudeperLS8", " ", bac, 1., bac2);
7665     //--------------------------------------------------
7666     // for estimator5:
7667     h_sumAmplLS1 = fs_->make<TH1F>("h_sumAmplLS1", " ", 100, 0.0, lsdep_estimator5_HBdepth1_);
7668     h_2DsumAmplLS1 = fs_->make<TH2F>("h_2DsumAmplLS1", " ", neta, -41., 41., nphi, 0., bphi);
7669     h_sumAmplperLS1 = fs_->make<TH1F>("h_sumAmplperLS1", " ", bac, 1., bac2);
7670     h_sumAmplperLS1_LSselected = fs_->make<TH1F>("h_sumAmplperLS1_LSselected", " ", bac, 1., bac2);
7671     h_sumCutAmplperLS1 = fs_->make<TH1F>("h_sumCutAmplperLS1", " ", bac, 1., bac2);
7672     h_2D0sumAmplLS1 = fs_->make<TH2F>("h_2D0sumAmplLS1", " ", neta, -41., 41., nphi, 0., bphi);
7673     h_sum0AmplperLS1 = fs_->make<TH1F>("h_sum0AmplperLS1", " ", bac, 1., bac2);
7674 
7675     h_sumAmplLS2 = fs_->make<TH1F>("h_sumAmplLS2", " ", 100, 0.0, lsdep_estimator5_HBdepth2_);
7676     h_2DsumAmplLS2 = fs_->make<TH2F>("h_2DsumAmplLS2", " ", neta, -41., 41., nphi, 0., bphi);
7677     h_sumAmplperLS2 = fs_->make<TH1F>("h_sumAmplperLS2", " ", bac, 1., bac2);
7678     h_sumCutAmplperLS2 = fs_->make<TH1F>("h_sumCutAmplperLS2", " ", bac, 1., bac2);
7679     h_2D0sumAmplLS2 = fs_->make<TH2F>("h_2D0sumAmplLS2", " ", neta, -41., 41., nphi, 0., bphi);
7680     h_sum0AmplperLS2 = fs_->make<TH1F>("h_sum0AmplperLS2", " ", bac, 1., bac2);
7681 
7682     h_sumAmplLS3 = fs_->make<TH1F>("h_sumAmplLS3", " ", 100, 0.0, lsdep_estimator5_HEdepth1_);
7683     h_2DsumAmplLS3 = fs_->make<TH2F>("h_2DsumAmplLS3", " ", neta, -41., 41., nphi, 0., bphi);
7684     h_sumAmplperLS3 = fs_->make<TH1F>("h_sumAmplperLS3", " ", bac, 1., bac2);
7685     h_sumCutAmplperLS3 = fs_->make<TH1F>("h_sumCutAmplperLS3", " ", bac, 1., bac2);
7686     h_2D0sumAmplLS3 = fs_->make<TH2F>("h_2D0sumAmplLS3", " ", neta, -41., 41., nphi, 0., bphi);
7687     h_sum0AmplperLS3 = fs_->make<TH1F>("h_sum0AmplperLS3", " ", bac, 1., bac2);
7688 
7689     h_sumAmplLS4 = fs_->make<TH1F>("h_sumAmplLS4", " ", 100, 0.0, lsdep_estimator5_HEdepth2_);
7690     h_2DsumAmplLS4 = fs_->make<TH2F>("h_2DsumAmplLS4", " ", neta, -41., 41., nphi, 0., bphi);
7691     h_sumAmplperLS4 = fs_->make<TH1F>("h_sumAmplperLS4", " ", bac, 1., bac2);
7692     h_sumCutAmplperLS4 = fs_->make<TH1F>("h_sumCutAmplperLS4", " ", bac, 1., bac2);
7693     h_2D0sumAmplLS4 = fs_->make<TH2F>("h_2D0sumAmplLS4", " ", neta, -41., 41., nphi, 0., bphi);
7694     h_sum0AmplperLS4 = fs_->make<TH1F>("h_sum0AmplperLS4", " ", bac, 1., bac2);
7695 
7696     h_sumAmplLS5 = fs_->make<TH1F>("h_sumAmplLS5", " ", 100, 0.0, lsdep_estimator5_HEdepth3_);
7697     h_2DsumAmplLS5 = fs_->make<TH2F>("h_2DsumAmplLS5", " ", neta, -41., 41., nphi, 0., bphi);
7698     h_sumAmplperLS5 = fs_->make<TH1F>("h_sumAmplperLS5", " ", bac, 1., bac2);
7699     h_sumCutAmplperLS5 = fs_->make<TH1F>("h_sumCutAmplperLS5", " ", bac, 1., bac2);
7700     h_2D0sumAmplLS5 = fs_->make<TH2F>("h_2D0sumAmplLS5", " ", neta, -41., 41., nphi, 0., bphi);
7701     h_sum0AmplperLS5 = fs_->make<TH1F>("h_sum0AmplperLS5", " ", bac, 1., bac2);
7702 
7703     h_sumAmplLS6 = fs_->make<TH1F>("h_sumAmplLS6", " ", 100, 0.0, lsdep_estimator5_HFdepth1_);
7704     h_2DsumAmplLS6 = fs_->make<TH2F>("h_2DsumAmplLS6", " ", neta, -41., 41., nphi, 0., bphi);
7705     h_sumAmplperLS6 = fs_->make<TH1F>("h_sumAmplperLS6", " ", bac, 1., bac2);
7706     h_sumCutAmplperLS6 = fs_->make<TH1F>("h_sumCutAmplperLS6", " ", bac, 1., bac2);
7707     h_2D0sumAmplLS6 = fs_->make<TH2F>("h_2D0sumAmplLS6", " ", neta, -41., 41., nphi, 0., bphi);
7708     h_sum0AmplperLS6 = fs_->make<TH1F>("h_sum0AmplperLS6", " ", bac, 1., bac2);
7709 
7710     h_RatioOccupancy_HBP = fs_->make<TH1F>("h_RatioOccupancy_HBP", " ", bac, 1., bac2);
7711     h_RatioOccupancy_HBM = fs_->make<TH1F>("h_RatioOccupancy_HBM", " ", bac, 1., bac2);
7712     h_RatioOccupancy_HEP = fs_->make<TH1F>("h_RatioOccupancy_HEP", " ", bac, 1., bac2);
7713     h_RatioOccupancy_HEM = fs_->make<TH1F>("h_RatioOccupancy_HEM", " ", bac, 1., bac2);
7714     h_RatioOccupancy_HOP = fs_->make<TH1F>("h_RatioOccupancy_HOP", " ", bac, 1., bac2);
7715     h_RatioOccupancy_HOM = fs_->make<TH1F>("h_RatioOccupancy_HOM", " ", bac, 1., bac2);
7716     h_RatioOccupancy_HFP = fs_->make<TH1F>("h_RatioOccupancy_HFP", " ", bac, 1., bac2);
7717     h_RatioOccupancy_HFM = fs_->make<TH1F>("h_RatioOccupancy_HFM", " ", bac, 1., bac2);
7718 
7719     h_sumAmplLS7 = fs_->make<TH1F>("h_sumAmplLS7", " ", 100, 0.0, lsdep_estimator5_HFdepth2_);
7720     h_2DsumAmplLS7 = fs_->make<TH2F>("h_2DsumAmplLS7", " ", neta, -41., 41., nphi, 0., bphi);
7721     h_sumAmplperLS7 = fs_->make<TH1F>("h_sumAmplperLS7", " ", bac, 1., bac2);
7722     h_sumCutAmplperLS7 = fs_->make<TH1F>("h_sumCutAmplperLS7", " ", bac, 1., bac2);
7723     h_2D0sumAmplLS7 = fs_->make<TH2F>("h_2D0sumAmplLS7", " ", neta, -41., 41., nphi, 0., bphi);
7724     h_sum0AmplperLS7 = fs_->make<TH1F>("h_sum0AmplperLS7", " ", bac, 1., bac2);
7725 
7726     h_sumAmplLS8 = fs_->make<TH1F>("h_sumAmplLS8", " ", 100, 0.0, lsdep_estimator5_HOdepth4_);
7727     h_2DsumAmplLS8 = fs_->make<TH2F>("h_2DsumAmplLS8", " ", neta, -41., 41., nphi, 0., bphi);
7728     h_sumAmplperLS8 = fs_->make<TH1F>("h_sumAmplperLS8", " ", bac, 1., bac2);
7729     h_sumCutAmplperLS8 = fs_->make<TH1F>("h_sumCutAmplperLS8", " ", bac, 1., bac2);
7730     h_2D0sumAmplLS8 = fs_->make<TH2F>("h_2D0sumAmplLS8", " ", neta, -41., 41., nphi, 0., bphi);
7731     h_sum0AmplperLS8 = fs_->make<TH1F>("h_sum0AmplperLS8", " ", bac, 1., bac2);
7732     //--------------------------------------------------
7733     // for estimator6:
7734     h_sumErrorBLS1 = fs_->make<TH1F>("h_sumErrorBLS1", " ", 10, 0., 10.);
7735     h_sumErrorBperLS1 = fs_->make<TH1F>("h_sumErrorBperLS1", " ", bac, 1., bac2);
7736     h_sum0ErrorBperLS1 = fs_->make<TH1F>("h_sum0ErrorBperLS1", " ", bac, 1., bac2);
7737     h_2D0sumErrorBLS1 = fs_->make<TH2F>("h_2D0sumErrorBLS1", " ", neta, -41., 41., nphi, 0., bphi);
7738     h_2DsumErrorBLS1 = fs_->make<TH2F>("h_2DsumErrorBLS1", " ", neta, -41., 41., nphi, 0., bphi);
7739     h_sumErrorBLS2 = fs_->make<TH1F>("h_sumErrorBLS2", " ", 10, 0., 10.);
7740     h_sumErrorBperLS2 = fs_->make<TH1F>("h_sumErrorBperLS2", " ", bac, 1., bac2);
7741     h_sum0ErrorBperLS2 = fs_->make<TH1F>("h_sum0ErrorBperLS2", " ", bac, 1., bac2);
7742     h_2D0sumErrorBLS2 = fs_->make<TH2F>("h_2D0sumErrorBLS2", " ", neta, -41., 41., nphi, 0., bphi);
7743     h_2DsumErrorBLS2 = fs_->make<TH2F>("h_2DsumErrorBLS2", " ", neta, -41., 41., nphi, 0., bphi);
7744 
7745     h_sumErrorBLS3 = fs_->make<TH1F>("h_sumErrorBLS3", " ", 10, 0., 10.);
7746     h_sumErrorBperLS3 = fs_->make<TH1F>("h_sumErrorBperLS3", " ", bac, 1., bac2);
7747     h_sum0ErrorBperLS3 = fs_->make<TH1F>("h_sum0ErrorBperLS3", " ", bac, 1., bac2);
7748     h_2D0sumErrorBLS3 = fs_->make<TH2F>("h_2D0sumErrorBLS3", " ", neta, -41., 41., nphi, 0., bphi);
7749     h_2DsumErrorBLS3 = fs_->make<TH2F>("h_2DsumErrorBLS3", " ", neta, -41., 41., nphi, 0., bphi);
7750     h_sumErrorBLS4 = fs_->make<TH1F>("h_sumErrorBLS4", " ", 10, 0., 10.);
7751     h_sumErrorBperLS4 = fs_->make<TH1F>("h_sumErrorBperLS4", " ", bac, 1., bac2);
7752     h_sum0ErrorBperLS4 = fs_->make<TH1F>("h_sum0ErrorBperLS4", " ", bac, 1., bac2);
7753     h_2D0sumErrorBLS4 = fs_->make<TH2F>("h_2D0sumErrorBLS4", " ", neta, -41., 41., nphi, 0., bphi);
7754     h_2DsumErrorBLS4 = fs_->make<TH2F>("h_2DsumErrorBLS4", " ", neta, -41., 41., nphi, 0., bphi);
7755     h_sumErrorBLS5 = fs_->make<TH1F>("h_sumErrorBLS5", " ", 10, 0., 10.);
7756     h_sumErrorBperLS5 = fs_->make<TH1F>("h_sumErrorBperLS5", " ", bac, 1., bac2);
7757     h_sum0ErrorBperLS5 = fs_->make<TH1F>("h_sum0ErrorBperLS5", " ", bac, 1., bac2);
7758     h_2D0sumErrorBLS5 = fs_->make<TH2F>("h_2D0sumErrorBLS5", " ", neta, -41., 41., nphi, 0., bphi);
7759     h_2DsumErrorBLS5 = fs_->make<TH2F>("h_2DsumErrorBLS5", " ", neta, -41., 41., nphi, 0., bphi);
7760 
7761     h_sumErrorBLS6 = fs_->make<TH1F>("h_sumErrorBLS6", " ", 10, 0., 10.);
7762     h_sumErrorBperLS6 = fs_->make<TH1F>("h_sumErrorBperLS6", " ", bac, 1., bac2);
7763     h_sum0ErrorBperLS6 = fs_->make<TH1F>("h_sum0ErrorBperLS6", " ", bac, 1., bac2);
7764     h_2D0sumErrorBLS6 = fs_->make<TH2F>("h_2D0sumErrorBLS6", " ", neta, -41., 41., nphi, 0., bphi);
7765     h_2DsumErrorBLS6 = fs_->make<TH2F>("h_2DsumErrorBLS6", " ", neta, -41., 41., nphi, 0., bphi);
7766     h_sumErrorBLS7 = fs_->make<TH1F>("h_sumErrorBLS7", " ", 10, 0., 10.);
7767     h_sumErrorBperLS7 = fs_->make<TH1F>("h_sumErrorBperLS7", " ", bac, 1., bac2);
7768     h_sum0ErrorBperLS7 = fs_->make<TH1F>("h_sum0ErrorBperLS7", " ", bac, 1., bac2);
7769     h_2D0sumErrorBLS7 = fs_->make<TH2F>("h_2D0sumErrorBLS7", " ", neta, -41., 41., nphi, 0., bphi);
7770     h_2DsumErrorBLS7 = fs_->make<TH2F>("h_2DsumErrorBLS7", " ", neta, -41., 41., nphi, 0., bphi);
7771 
7772     h_sumErrorBLS8 = fs_->make<TH1F>("h_sumErrorBLS8", " ", 10, 0., 10.);
7773     h_sumErrorBperLS8 = fs_->make<TH1F>("h_sumErrorBperLS8", " ", bac, 1., bac2);
7774     h_sum0ErrorBperLS8 = fs_->make<TH1F>("h_sum0ErrorBperLS8", " ", bac, 1., bac2);
7775     h_2D0sumErrorBLS8 = fs_->make<TH2F>("h_2D0sumErrorBLS8", " ", neta, -41., 41., nphi, 0., bphi);
7776     h_2DsumErrorBLS8 = fs_->make<TH2F>("h_2DsumErrorBLS8", " ", neta, -41., 41., nphi, 0., bphi);
7777 
7778     //--------------------------------------------------
7779     // for averSIGNALOCCUPANCY :
7780     h_averSIGNALoccupancy_HB = fs_->make<TH1F>("h_averSIGNALoccupancy_HB", " ", bac, 1., bac2);
7781     h_averSIGNALoccupancy_HE = fs_->make<TH1F>("h_averSIGNALoccupancy_HE", " ", bac, 1., bac2);
7782     h_averSIGNALoccupancy_HF = fs_->make<TH1F>("h_averSIGNALoccupancy_HF", " ", bac, 1., bac2);
7783     h_averSIGNALoccupancy_HO = fs_->make<TH1F>("h_averSIGNALoccupancy_HO", " ", bac, 1., bac2);
7784 
7785     // for averSIGNALsumamplitude :
7786     h_averSIGNALsumamplitude_HB = fs_->make<TH1F>("h_averSIGNALsumamplitude_HB", " ", bac, 1., bac2);
7787     h_averSIGNALsumamplitude_HE = fs_->make<TH1F>("h_averSIGNALsumamplitude_HE", " ", bac, 1., bac2);
7788     h_averSIGNALsumamplitude_HF = fs_->make<TH1F>("h_averSIGNALsumamplitude_HF", " ", bac, 1., bac2);
7789     h_averSIGNALsumamplitude_HO = fs_->make<TH1F>("h_averSIGNALsumamplitude_HO", " ", bac, 1., bac2);
7790 
7791     // for averNOSIGNALOCCUPANCY :
7792     h_averNOSIGNALoccupancy_HB = fs_->make<TH1F>("h_averNOSIGNALoccupancy_HB", " ", bac, 1., bac2);
7793     h_averNOSIGNALoccupancy_HE = fs_->make<TH1F>("h_averNOSIGNALoccupancy_HE", " ", bac, 1., bac2);
7794     h_averNOSIGNALoccupancy_HF = fs_->make<TH1F>("h_averNOSIGNALoccupancy_HF", " ", bac, 1., bac2);
7795     h_averNOSIGNALoccupancy_HO = fs_->make<TH1F>("h_averNOSIGNALoccupancy_HO", " ", bac, 1., bac2);
7796 
7797     // for averNOSIGNALsumamplitude :
7798     h_averNOSIGNALsumamplitude_HB = fs_->make<TH1F>("h_averNOSIGNALsumamplitude_HB", " ", bac, 1., bac2);
7799     h_averNOSIGNALsumamplitude_HE = fs_->make<TH1F>("h_averNOSIGNALsumamplitude_HE", " ", bac, 1., bac2);
7800     h_averNOSIGNALsumamplitude_HF = fs_->make<TH1F>("h_averNOSIGNALsumamplitude_HF", " ", bac, 1., bac2);
7801     h_averNOSIGNALsumamplitude_HO = fs_->make<TH1F>("h_averNOSIGNALsumamplitude_HO", " ", bac, 1., bac2);
7802 
7803     // for channel SUM over depthes Amplitudes for each sub-detector
7804     h_sumamplitudechannel_HB = fs_->make<TH1F>("h_sumamplitudechannel_HB", " ", 100, 0., 10000.);
7805     h_sumamplitudechannel_HE = fs_->make<TH1F>("h_sumamplitudechannel_HE", " ", 100, 0., 10000.);
7806     h_sumamplitudechannel_HF = fs_->make<TH1F>("h_sumamplitudechannel_HF", " ", 100, 0., 10000.);
7807     h_sumamplitudechannel_HO = fs_->make<TH1F>("h_sumamplitudechannel_HO", " ", 100, 0., 10000.);
7808 
7809     // for event Amplitudes for each sub-detector
7810     h_eventamplitude_HB = fs_->make<TH1F>("h_eventamplitude_HB", " ", 100, 0., 300000.);
7811     h_eventamplitude_HE = fs_->make<TH1F>("h_eventamplitude_HE", " ", 100, 0., 300000.);
7812     h_eventamplitude_HF = fs_->make<TH1F>("h_eventamplitude_HF", " ", 100, 0., 300000.);
7813     h_eventamplitude_HO = fs_->make<TH1F>("h_eventamplitude_HO", " ", 100, 0., 250000.);
7814 
7815     // for event Occupancy for each sub-detector
7816     h_eventoccupancy_HB = fs_->make<TH1F>("h_eventoccupancy_HB", " ", 100, 0., 3000.);
7817     h_eventoccupancy_HE = fs_->make<TH1F>("h_eventoccupancy_HE", " ", 100, 0., 2000.);
7818     h_eventoccupancy_HF = fs_->make<TH1F>("h_eventoccupancy_HF", " ", 100, 0., 1000.);
7819     h_eventoccupancy_HO = fs_->make<TH1F>("h_eventoccupancy_HO", " ", 100, 0., 2500.);
7820 
7821     // for maxxSUMAmplitude
7822     h_maxxSUMAmpl_HB = fs_->make<TH1F>("h_maxxSUMAmpl_HB", " ", bac, 1., bac2);
7823     h_maxxSUMAmpl_HE = fs_->make<TH1F>("h_maxxSUMAmpl_HE", " ", bac, 1., bac2);
7824     h_maxxSUMAmpl_HF = fs_->make<TH1F>("h_maxxSUMAmpl_HF", " ", bac, 1., bac2);
7825     h_maxxSUMAmpl_HO = fs_->make<TH1F>("h_maxxSUMAmpl_HO", " ", bac, 1., bac2);
7826 
7827     // for maxxOCCUP
7828     h_maxxOCCUP_HB = fs_->make<TH1F>("h_maxxOCCUP_HB", " ", bac, 1., bac2);
7829     h_maxxOCCUP_HE = fs_->make<TH1F>("h_maxxOCCUP_HE", " ", bac, 1., bac2);
7830     h_maxxOCCUP_HF = fs_->make<TH1F>("h_maxxOCCUP_HF", " ", bac, 1., bac2);
7831     h_maxxOCCUP_HO = fs_->make<TH1F>("h_maxxOCCUP_HO", " ", bac, 1., bac2);
7832     //--------------------------------------------------
7833     // pedestals
7834     h_pedestal0_HB = fs_->make<TH1F>("h_pedestal0_HB", " ", 100, 0., 10.);
7835     h_pedestal1_HB = fs_->make<TH1F>("h_pedestal1_HB", " ", 100, 0., 10.);
7836     h_pedestal2_HB = fs_->make<TH1F>("h_pedestal2_HB", " ", 100, 0., 10.);
7837     h_pedestal3_HB = fs_->make<TH1F>("h_pedestal3_HB", " ", 100, 0., 10.);
7838     h_pedestalaver4_HB = fs_->make<TH1F>("h_pedestalaver4_HB", " ", 100, 0., 10.);
7839     h_pedestalaver9_HB = fs_->make<TH1F>("h_pedestalaver9_HB", " ", 100, 0., 10.);
7840     h_pedestalw0_HB = fs_->make<TH1F>("h_pedestalw0_HB", " ", 100, 0., 2.5);
7841     h_pedestalw1_HB = fs_->make<TH1F>("h_pedestalw1_HB", " ", 100, 0., 2.5);
7842     h_pedestalw2_HB = fs_->make<TH1F>("h_pedestalw2_HB", " ", 100, 0., 2.5);
7843     h_pedestalw3_HB = fs_->make<TH1F>("h_pedestalw3_HB", " ", 100, 0., 2.5);
7844     h_pedestalwaver4_HB = fs_->make<TH1F>("h_pedestalwaver4_HB", " ", 100, 0., 2.5);
7845     h_pedestalwaver9_HB = fs_->make<TH1F>("h_pedestalwaver9_HB", " ", 100, 0., 2.5);
7846 
7847     h_pedestal0_HE = fs_->make<TH1F>("h_pedestal0_HE", " ", 100, 0., 10.);
7848     h_pedestal1_HE = fs_->make<TH1F>("h_pedestal1_HE", " ", 100, 0., 10.);
7849     h_pedestal2_HE = fs_->make<TH1F>("h_pedestal2_HE", " ", 100, 0., 10.);
7850     h_pedestal3_HE = fs_->make<TH1F>("h_pedestal3_HE", " ", 100, 0., 10.);
7851     h_pedestalaver4_HE = fs_->make<TH1F>("h_pedestalaver4_HE", " ", 100, 0., 10.);
7852     h_pedestalaver9_HE = fs_->make<TH1F>("h_pedestalaver9_HE", " ", 100, 0., 10.);
7853     h_pedestalw0_HE = fs_->make<TH1F>("h_pedestalw0_HE", " ", 100, 0., 2.5);
7854     h_pedestalw1_HE = fs_->make<TH1F>("h_pedestalw1_HE", " ", 100, 0., 2.5);
7855     h_pedestalw2_HE = fs_->make<TH1F>("h_pedestalw2_HE", " ", 100, 0., 2.5);
7856     h_pedestalw3_HE = fs_->make<TH1F>("h_pedestalw3_HE", " ", 100, 0., 2.5);
7857     h_pedestalwaver4_HE = fs_->make<TH1F>("h_pedestalwaver4_HE", " ", 100, 0., 2.5);
7858     h_pedestalwaver9_HE = fs_->make<TH1F>("h_pedestalwaver9_HE", " ", 100, 0., 2.5);
7859 
7860     h_pedestal0_HF = fs_->make<TH1F>("h_pedestal0_HF", " ", 100, 0., 20.);
7861     h_pedestal1_HF = fs_->make<TH1F>("h_pedestal1_HF", " ", 100, 0., 20.);
7862     h_pedestal2_HF = fs_->make<TH1F>("h_pedestal2_HF", " ", 100, 0., 20.);
7863     h_pedestal3_HF = fs_->make<TH1F>("h_pedestal3_HF", " ", 100, 0., 20.);
7864     h_pedestalaver4_HF = fs_->make<TH1F>("h_pedestalaver4_HF", " ", 100, 0., 20.);
7865     h_pedestalaver9_HF = fs_->make<TH1F>("h_pedestalaver9_HF", " ", 100, 0., 20.);
7866     h_pedestalw0_HF = fs_->make<TH1F>("h_pedestalw0_HF", " ", 100, 0., 2.5);
7867     h_pedestalw1_HF = fs_->make<TH1F>("h_pedestalw1_HF", " ", 100, 0., 2.5);
7868     h_pedestalw2_HF = fs_->make<TH1F>("h_pedestalw2_HF", " ", 100, 0., 2.5);
7869     h_pedestalw3_HF = fs_->make<TH1F>("h_pedestalw3_HF", " ", 100, 0., 2.5);
7870     h_pedestalwaver4_HF = fs_->make<TH1F>("h_pedestalwaver4_HF", " ", 100, 0., 2.5);
7871     h_pedestalwaver9_HF = fs_->make<TH1F>("h_pedestalwaver9_HF", " ", 100, 0., 2.5);
7872 
7873     h_pedestal0_HO = fs_->make<TH1F>("h_pedestal0_HO", " ", 100, 0., 20.);
7874     h_pedestal1_HO = fs_->make<TH1F>("h_pedestal1_HO", " ", 100, 0., 20.);
7875     h_pedestal2_HO = fs_->make<TH1F>("h_pedestal2_HO", " ", 100, 0., 20.);
7876     h_pedestal3_HO = fs_->make<TH1F>("h_pedestal3_HO", " ", 100, 0., 20.);
7877     h_pedestalaver4_HO = fs_->make<TH1F>("h_pedestalaver4_HO", " ", 100, 0., 20.);
7878     h_pedestalaver9_HO = fs_->make<TH1F>("h_pedestalaver9_HO", " ", 100, 0., 20.);
7879     h_pedestalw0_HO = fs_->make<TH1F>("h_pedestalw0_HO", " ", 100, 0., 2.5);
7880     h_pedestalw1_HO = fs_->make<TH1F>("h_pedestalw1_HO", " ", 100, 0., 2.5);
7881     h_pedestalw2_HO = fs_->make<TH1F>("h_pedestalw2_HO", " ", 100, 0., 2.5);
7882     h_pedestalw3_HO = fs_->make<TH1F>("h_pedestalw3_HO", " ", 100, 0., 2.5);
7883     h_pedestalwaver4_HO = fs_->make<TH1F>("h_pedestalwaver4_HO", " ", 100, 0., 2.5);
7884     h_pedestalwaver9_HO = fs_->make<TH1F>("h_pedestalwaver9_HO", " ", 100, 0., 2.5);
7885     //--------------------------------------------------
7886     h_mapDepth1pedestalw_HB = fs_->make<TH2F>("h_mapDepth1pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi);
7887     h_mapDepth2pedestalw_HB = fs_->make<TH2F>("h_mapDepth2pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi);
7888     h_mapDepth3pedestalw_HB = fs_->make<TH2F>("h_mapDepth3pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi);
7889     h_mapDepth4pedestalw_HB = fs_->make<TH2F>("h_mapDepth4pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi);
7890     h_mapDepth1pedestalw_HE = fs_->make<TH2F>("h_mapDepth1pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi);
7891     h_mapDepth2pedestalw_HE = fs_->make<TH2F>("h_mapDepth2pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi);
7892     h_mapDepth3pedestalw_HE = fs_->make<TH2F>("h_mapDepth3pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi);
7893     h_mapDepth4pedestalw_HE = fs_->make<TH2F>("h_mapDepth4pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi);
7894     h_mapDepth5pedestalw_HE = fs_->make<TH2F>("h_mapDepth5pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi);
7895     h_mapDepth6pedestalw_HE = fs_->make<TH2F>("h_mapDepth6pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi);
7896     h_mapDepth7pedestalw_HE = fs_->make<TH2F>("h_mapDepth7pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi);
7897     h_mapDepth1pedestalw_HF = fs_->make<TH2F>("h_mapDepth1pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi);
7898     h_mapDepth2pedestalw_HF = fs_->make<TH2F>("h_mapDepth2pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi);
7899     h_mapDepth3pedestalw_HF = fs_->make<TH2F>("h_mapDepth3pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi);
7900     h_mapDepth4pedestalw_HF = fs_->make<TH2F>("h_mapDepth4pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi);
7901     h_mapDepth4pedestalw_HO = fs_->make<TH2F>("h_mapDepth4pedestalw_HO", " ", neta, -41., 41., nphi, 0., bphi);
7902 
7903     h_mapDepth1pedestal_HB = fs_->make<TH2F>("h_mapDepth1pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi);
7904     h_mapDepth2pedestal_HB = fs_->make<TH2F>("h_mapDepth2pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi);
7905     h_mapDepth3pedestal_HB = fs_->make<TH2F>("h_mapDepth3pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi);
7906     h_mapDepth4pedestal_HB = fs_->make<TH2F>("h_mapDepth4pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi);
7907     h_mapDepth1pedestal_HE = fs_->make<TH2F>("h_mapDepth1pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi);
7908     h_mapDepth2pedestal_HE = fs_->make<TH2F>("h_mapDepth2pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi);
7909     h_mapDepth3pedestal_HE = fs_->make<TH2F>("h_mapDepth3pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi);
7910     h_mapDepth4pedestal_HE = fs_->make<TH2F>("h_mapDepth4pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi);
7911     h_mapDepth5pedestal_HE = fs_->make<TH2F>("h_mapDepth5pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi);
7912     h_mapDepth6pedestal_HE = fs_->make<TH2F>("h_mapDepth6pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi);
7913     h_mapDepth7pedestal_HE = fs_->make<TH2F>("h_mapDepth7pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi);
7914     h_mapDepth1pedestal_HF = fs_->make<TH2F>("h_mapDepth1pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi);
7915     h_mapDepth2pedestal_HF = fs_->make<TH2F>("h_mapDepth2pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi);
7916     h_mapDepth3pedestal_HF = fs_->make<TH2F>("h_mapDepth3pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi);
7917     h_mapDepth4pedestal_HF = fs_->make<TH2F>("h_mapDepth4pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi);
7918     h_mapDepth4pedestal_HO = fs_->make<TH2F>("h_mapDepth4pedestal_HO", " ", neta, -41., 41., nphi, 0., bphi);
7919     //--------------------------------------------------
7920     h_pedestal00_HB = fs_->make<TH1F>("h_pedestal00_HB", " ", 100, 0., 10.);
7921     h_gain_HB = fs_->make<TH1F>("h_gain_HB", " ", 100, 0., 1.);
7922     h_respcorr_HB = fs_->make<TH1F>("h_respcorr_HB", " ", 100, 0., 2.5);
7923     h_timecorr_HB = fs_->make<TH1F>("h_timecorr_HB", " ", 100, 0., 30.);
7924     h_lutcorr_HB = fs_->make<TH1F>("h_lutcorr_HB", " ", 100, 0., 10.);
7925     h_difpedestal0_HB = fs_->make<TH1F>("h_difpedestal0_HB", " ", 100, -3., 3.);
7926     h_difpedestal1_HB = fs_->make<TH1F>("h_difpedestal1_HB", " ", 100, -3., 3.);
7927     h_difpedestal2_HB = fs_->make<TH1F>("h_difpedestal2_HB", " ", 100, -3., 3.);
7928     h_difpedestal3_HB = fs_->make<TH1F>("h_difpedestal3_HB", " ", 100, -3., 3.);
7929 
7930     h_pedestal00_HE = fs_->make<TH1F>("h_pedestal00_HE", " ", 100, 0., 10.);
7931     h_gain_HE = fs_->make<TH1F>("h_gain_HE", " ", 100, 0., 1.);
7932     h_respcorr_HE = fs_->make<TH1F>("h_respcorr_HE", " ", 100, 0., 2.5);
7933     h_timecorr_HE = fs_->make<TH1F>("h_timecorr_HE", " ", 100, 0., 30.);
7934     h_lutcorr_HE = fs_->make<TH1F>("h_lutcorr_HE", " ", 100, 0., 10.);
7935 
7936     h_pedestal00_HF = fs_->make<TH1F>("h_pedestal00_HF", " ", 100, 0., 10.);
7937     h_gain_HF = fs_->make<TH1F>("h_gain_HF", " ", 100, 0., 1.);
7938     h_respcorr_HF = fs_->make<TH1F>("h_respcorr_HF", " ", 100, 0., 2.5);
7939     h_timecorr_HF = fs_->make<TH1F>("h_timecorr_HF", " ", 100, 0., 30.);
7940     h_lutcorr_HF = fs_->make<TH1F>("h_lutcorr_HF", " ", 100, 0., 10.);
7941 
7942     h_pedestal00_HO = fs_->make<TH1F>("h_pedestal00_HO", " ", 100, 0., 10.);
7943     h_gain_HO = fs_->make<TH1F>("h_gain_HO", " ", 100, 0., 1.);
7944     h_respcorr_HO = fs_->make<TH1F>("h_respcorr_HO", " ", 100, 0., 2.5);
7945     h_timecorr_HO = fs_->make<TH1F>("h_timecorr_HO", " ", 100, 0., 30.);
7946     h_lutcorr_HO = fs_->make<TH1F>("h_lutcorr_HO", " ", 100, 0., 10.);
7947     //--------------------------------------------------
7948     h2_TSnVsAyear2023_HB = fs_->make<TH2F>("h2_TSnVsAyear2023_HB", " ", 100, 200., 30200., 100, 0., 175.);
7949     h2_TSnVsAyear2023_HE = fs_->make<TH2F>("h2_TSnVsAyear2023_HE", " ", 100, 200., 75200., 100, 0., 175.);
7950     h2_TSnVsAyear2023_HF = fs_->make<TH2F>("h2_TSnVsAyear2023_HF", " ", 100, 0., 2000., 100, 0., 50.);
7951     h2_TSnVsAyear2023_HO = fs_->make<TH2F>("h2_TSnVsAyear2023_HO", " ", 100, 0., 1000., 100, 0., 225.);
7952     //-----------------------------
7953     h1_TSnVsAyear2023_HB = fs_->make<TH1F>("h1_TSnVsAyear2023_HB", " ", 100, 200., 15200);
7954     h1_TSnVsAyear2023_HE = fs_->make<TH1F>("h1_TSnVsAyear2023_HE", " ", 100, 200., 25200);
7955     h1_TSnVsAyear2023_HF = fs_->make<TH1F>("h1_TSnVsAyear2023_HF", " ", 100, 0., 1500);
7956     h1_TSnVsAyear2023_HO = fs_->make<TH1F>("h1_TSnVsAyear2023_HO", " ", 100, 0., 750);
7957     h1_TSnVsAyear20230_HB = fs_->make<TH1F>("h1_TSnVsAyear20230_HB", " ", 100, 200., 15200);
7958     h1_TSnVsAyear20230_HE = fs_->make<TH1F>("h1_TSnVsAyear20230_HE", " ", 100, 200., 25200);
7959     h1_TSnVsAyear20230_HF = fs_->make<TH1F>("h1_TSnVsAyear20230_HF", " ", 100, 0., 1500);
7960     h1_TSnVsAyear20230_HO = fs_->make<TH1F>("h1_TSnVsAyear20230_HO", " ", 100, 0., 750);
7961     //--------------------------------------------------
7962     float est6 = 2500.;
7963     int ist6 = 30;
7964     int ist2 = 60;
7965     h2_pedvsampl_HB = fs_->make<TH2F>("h2_pedvsampl_HB", " ", ist2, 0., 7.0, ist2, 0., est6);
7966     h2_pedwvsampl_HB = fs_->make<TH2F>("h2_pedwvsampl_HB", " ", ist2, 0., 2.5, ist2, 0., est6);
7967     h_pedvsampl_HB = fs_->make<TH1F>("h_pedvsampl_HB", " ", ist6, 0., 7.0);
7968     h_pedwvsampl_HB = fs_->make<TH1F>("h_pedwvsampl_HB", " ", ist6, 0., 2.5);
7969     h_pedvsampl0_HB = fs_->make<TH1F>("h_pedvsampl0_HB", " ", ist6, 0., 7.);
7970     h_pedwvsampl0_HB = fs_->make<TH1F>("h_pedwvsampl0_HB", " ", ist6, 0., 2.5);
7971     h2_amplvsped_HB = fs_->make<TH2F>("h2_amplvsped_HB", " ", ist2, 0., est6, ist2, 0., 7.0);
7972     h2_amplvspedw_HB = fs_->make<TH2F>("h2_amplvspedw_HB", " ", ist2, 0., est6, ist2, 0., 2.5);
7973     h_amplvsped_HB = fs_->make<TH1F>("h_amplvsped_HB", " ", ist6, 0., est6);
7974     h_amplvspedw_HB = fs_->make<TH1F>("h_amplvspedw_HB", " ", ist6, 0., est6);
7975     h_amplvsped0_HB = fs_->make<TH1F>("h_amplvsped0_HB", " ", ist6, 0., est6);
7976 
7977     h2_pedvsampl_HE = fs_->make<TH2F>("h2_pedvsampl_HE", " ", ist2, 0., 7.0, ist2, 0., est6);
7978     h2_pedwvsampl_HE = fs_->make<TH2F>("h2_pedwvsampl_HE", " ", ist2, 0., 2.5, ist2, 0., est6);
7979     h_pedvsampl_HE = fs_->make<TH1F>("h_pedvsampl_HE", " ", ist6, 0., 7.0);
7980     h_pedwvsampl_HE = fs_->make<TH1F>("h_pedwvsampl_HE", " ", ist6, 0., 2.5);
7981     h_pedvsampl0_HE = fs_->make<TH1F>("h_pedvsampl0_HE", " ", ist6, 0., 7.);
7982     h_pedwvsampl0_HE = fs_->make<TH1F>("h_pedwvsampl0_HE", " ", ist6, 0., 2.5);
7983 
7984     h2_pedvsampl_HF = fs_->make<TH2F>("h2_pedvsampl_HF", " ", ist2, 0., 20.0, ist2, 0., est6);
7985     h2_pedwvsampl_HF = fs_->make<TH2F>("h2_pedwvsampl_HF", " ", ist2, 0., 2.0, ist2, 0., est6);
7986     h_pedvsampl_HF = fs_->make<TH1F>("h_pedvsampl_HF", " ", ist6, 0., 20.0);
7987     h_pedwvsampl_HF = fs_->make<TH1F>("h_pedwvsampl_HF", " ", ist6, 0., 2.0);
7988     h_pedvsampl0_HF = fs_->make<TH1F>("h_pedvsampl0_HF", " ", ist6, 0., 20.);
7989     h_pedwvsampl0_HF = fs_->make<TH1F>("h_pedwvsampl0_HF", " ", ist6, 0., 2.0);
7990 
7991     h2_pedvsampl_HO = fs_->make<TH2F>("h2_pedvsampl_HO", " ", ist2, 0., 20.0, ist2, 0., est6);
7992     h2_pedwvsampl_HO = fs_->make<TH2F>("h2_pedwvsampl_HO", " ", ist2, 0., 2.5, ist2, 0., est6);
7993     h_pedvsampl_HO = fs_->make<TH1F>("h_pedvsampl_HO", " ", ist6, 0., 20.0);
7994     h_pedwvsampl_HO = fs_->make<TH1F>("h_pedwvsampl_HO", " ", ist6, 0., 2.5);
7995     h_pedvsampl0_HO = fs_->make<TH1F>("h_pedvsampl0_HO", " ", ist6, 0., 20.);
7996     h_pedwvsampl0_HO = fs_->make<TH1F>("h_pedwvsampl0_HO", " ", ist6, 0., 2.5);
7997     //--------------------------------------------------
7998     h_mapDepth1Ped0_HB = fs_->make<TH2F>("h_mapDepth1Ped0_HB", " ", neta, -41., 41., nphi, 0., bphi);
7999     h_mapDepth1Ped1_HB = fs_->make<TH2F>("h_mapDepth1Ped1_HB", " ", neta, -41., 41., nphi, 0., bphi);
8000     h_mapDepth1Ped2_HB = fs_->make<TH2F>("h_mapDepth1Ped2_HB", " ", neta, -41., 41., nphi, 0., bphi);
8001     h_mapDepth1Ped3_HB = fs_->make<TH2F>("h_mapDepth1Ped3_HB", " ", neta, -41., 41., nphi, 0., bphi);
8002     h_mapDepth1Pedw0_HB = fs_->make<TH2F>("h_mapDepth1Pedw0_HB", " ", neta, -41., 41., nphi, 0., bphi);
8003     h_mapDepth1Pedw1_HB = fs_->make<TH2F>("h_mapDepth1Pedw1_HB", " ", neta, -41., 41., nphi, 0., bphi);
8004     h_mapDepth1Pedw2_HB = fs_->make<TH2F>("h_mapDepth1Pedw2_HB", " ", neta, -41., 41., nphi, 0., bphi);
8005     h_mapDepth1Pedw3_HB = fs_->make<TH2F>("h_mapDepth1Pedw3_HB", " ", neta, -41., 41., nphi, 0., bphi);
8006     h_mapDepth2Ped0_HB = fs_->make<TH2F>("h_mapDepth2Ped0_HB", " ", neta, -41., 41., nphi, 0., bphi);
8007     h_mapDepth2Ped1_HB = fs_->make<TH2F>("h_mapDepth2Ped1_HB", " ", neta, -41., 41., nphi, 0., bphi);
8008     h_mapDepth2Ped2_HB = fs_->make<TH2F>("h_mapDepth2Ped2_HB", " ", neta, -41., 41., nphi, 0., bphi);
8009     h_mapDepth2Ped3_HB = fs_->make<TH2F>("h_mapDepth2Ped3_HB", " ", neta, -41., 41., nphi, 0., bphi);
8010     h_mapDepth2Pedw0_HB = fs_->make<TH2F>("h_mapDepth2Pedw0_HB", " ", neta, -41., 41., nphi, 0., bphi);
8011     h_mapDepth2Pedw1_HB = fs_->make<TH2F>("h_mapDepth2Pedw1_HB", " ", neta, -41., 41., nphi, 0., bphi);
8012     h_mapDepth2Pedw2_HB = fs_->make<TH2F>("h_mapDepth2Pedw2_HB", " ", neta, -41., 41., nphi, 0., bphi);
8013     h_mapDepth2Pedw3_HB = fs_->make<TH2F>("h_mapDepth2Pedw3_HB", " ", neta, -41., 41., nphi, 0., bphi);
8014 
8015     h_mapDepth1Ped0_HE = fs_->make<TH2F>("h_mapDepth1Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi);
8016     h_mapDepth1Ped1_HE = fs_->make<TH2F>("h_mapDepth1Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi);
8017     h_mapDepth1Ped2_HE = fs_->make<TH2F>("h_mapDepth1Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi);
8018     h_mapDepth1Ped3_HE = fs_->make<TH2F>("h_mapDepth1Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi);
8019     h_mapDepth1Pedw0_HE = fs_->make<TH2F>("h_mapDepth1Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi);
8020     h_mapDepth1Pedw1_HE = fs_->make<TH2F>("h_mapDepth1Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi);
8021     h_mapDepth1Pedw2_HE = fs_->make<TH2F>("h_mapDepth1Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi);
8022     h_mapDepth1Pedw3_HE = fs_->make<TH2F>("h_mapDepth1Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi);
8023     h_mapDepth2Ped0_HE = fs_->make<TH2F>("h_mapDepth2Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi);
8024     h_mapDepth2Ped1_HE = fs_->make<TH2F>("h_mapDepth2Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi);
8025     h_mapDepth2Ped2_HE = fs_->make<TH2F>("h_mapDepth2Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi);
8026     h_mapDepth2Ped3_HE = fs_->make<TH2F>("h_mapDepth2Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi);
8027     h_mapDepth2Pedw0_HE = fs_->make<TH2F>("h_mapDepth2Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi);
8028     h_mapDepth2Pedw1_HE = fs_->make<TH2F>("h_mapDepth2Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi);
8029     h_mapDepth2Pedw2_HE = fs_->make<TH2F>("h_mapDepth2Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi);
8030     h_mapDepth2Pedw3_HE = fs_->make<TH2F>("h_mapDepth2Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi);
8031     h_mapDepth3Ped0_HE = fs_->make<TH2F>("h_mapDepth3Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi);
8032     h_mapDepth3Ped1_HE = fs_->make<TH2F>("h_mapDepth3Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi);
8033     h_mapDepth3Ped2_HE = fs_->make<TH2F>("h_mapDepth3Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi);
8034     h_mapDepth3Ped3_HE = fs_->make<TH2F>("h_mapDepth3Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi);
8035     h_mapDepth3Pedw0_HE = fs_->make<TH2F>("h_mapDepth3Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi);
8036     h_mapDepth3Pedw1_HE = fs_->make<TH2F>("h_mapDepth3Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi);
8037     h_mapDepth3Pedw2_HE = fs_->make<TH2F>("h_mapDepth3Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi);
8038     h_mapDepth3Pedw3_HE = fs_->make<TH2F>("h_mapDepth3Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi);
8039 
8040     h_mapDepth1Ped0_HF = fs_->make<TH2F>("h_mapDepth1Ped0_HF", " ", neta, -41., 41., nphi, 0., bphi);
8041     h_mapDepth1Ped1_HF = fs_->make<TH2F>("h_mapDepth1Ped1_HF", " ", neta, -41., 41., nphi, 0., bphi);
8042     h_mapDepth1Ped2_HF = fs_->make<TH2F>("h_mapDepth1Ped2_HF", " ", neta, -41., 41., nphi, 0., bphi);
8043     h_mapDepth1Ped3_HF = fs_->make<TH2F>("h_mapDepth1Ped3_HF", " ", neta, -41., 41., nphi, 0., bphi);
8044     h_mapDepth1Pedw0_HF = fs_->make<TH2F>("h_mapDepth1Pedw0_HF", " ", neta, -41., 41., nphi, 0., bphi);
8045     h_mapDepth1Pedw1_HF = fs_->make<TH2F>("h_mapDepth1Pedw1_HF", " ", neta, -41., 41., nphi, 0., bphi);
8046     h_mapDepth1Pedw2_HF = fs_->make<TH2F>("h_mapDepth1Pedw2_HF", " ", neta, -41., 41., nphi, 0., bphi);
8047     h_mapDepth1Pedw3_HF = fs_->make<TH2F>("h_mapDepth1Pedw3_HF", " ", neta, -41., 41., nphi, 0., bphi);
8048     h_mapDepth2Ped0_HF = fs_->make<TH2F>("h_mapDepth2Ped0_HF", " ", neta, -41., 41., nphi, 0., bphi);
8049     h_mapDepth2Ped1_HF = fs_->make<TH2F>("h_mapDepth2Ped1_HF", " ", neta, -41., 41., nphi, 0., bphi);
8050     h_mapDepth2Ped2_HF = fs_->make<TH2F>("h_mapDepth2Ped2_HF", " ", neta, -41., 41., nphi, 0., bphi);
8051     h_mapDepth2Ped3_HF = fs_->make<TH2F>("h_mapDepth2Ped3_HF", " ", neta, -41., 41., nphi, 0., bphi);
8052     h_mapDepth2Pedw0_HF = fs_->make<TH2F>("h_mapDepth2Pedw0_HF", " ", neta, -41., 41., nphi, 0., bphi);
8053     h_mapDepth2Pedw1_HF = fs_->make<TH2F>("h_mapDepth2Pedw1_HF", " ", neta, -41., 41., nphi, 0., bphi);
8054     h_mapDepth2Pedw2_HF = fs_->make<TH2F>("h_mapDepth2Pedw2_HF", " ", neta, -41., 41., nphi, 0., bphi);
8055     h_mapDepth2Pedw3_HF = fs_->make<TH2F>("h_mapDepth2Pedw3_HF", " ", neta, -41., 41., nphi, 0., bphi);
8056 
8057     h_mapDepth4Ped0_HO = fs_->make<TH2F>("h_mapDepth4Ped0_HO", " ", neta, -41., 41., nphi, 0., bphi);
8058     h_mapDepth4Ped1_HO = fs_->make<TH2F>("h_mapDepth4Ped1_HO", " ", neta, -41., 41., nphi, 0., bphi);
8059     h_mapDepth4Ped2_HO = fs_->make<TH2F>("h_mapDepth4Ped2_HO", " ", neta, -41., 41., nphi, 0., bphi);
8060     h_mapDepth4Ped3_HO = fs_->make<TH2F>("h_mapDepth4Ped3_HO", " ", neta, -41., 41., nphi, 0., bphi);
8061     h_mapDepth4Pedw0_HO = fs_->make<TH2F>("h_mapDepth4Pedw0_HO", " ", neta, -41., 41., nphi, 0., bphi);
8062     h_mapDepth4Pedw1_HO = fs_->make<TH2F>("h_mapDepth4Pedw1_HO", " ", neta, -41., 41., nphi, 0., bphi);
8063     h_mapDepth4Pedw2_HO = fs_->make<TH2F>("h_mapDepth4Pedw2_HO", " ", neta, -41., 41., nphi, 0., bphi);
8064     h_mapDepth4Pedw3_HO = fs_->make<TH2F>("h_mapDepth4Pedw3_HO", " ", neta, -41., 41., nphi, 0., bphi);
8065     //--------------------------------------------------
8066     h_mapDepth1ADCAmpl12_HB = fs_->make<TH2F>("h_mapDepth1ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi);
8067     h_mapDepth2ADCAmpl12_HB = fs_->make<TH2F>("h_mapDepth2ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi);
8068     h_mapDepth3ADCAmpl12_HB = fs_->make<TH2F>("h_mapDepth3ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi);
8069     h_mapDepth4ADCAmpl12_HB = fs_->make<TH2F>("h_mapDepth4ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi);
8070     h_mapDepth1ADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth1ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8071     h_mapDepth2ADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth2ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8072     h_mapDepth3ADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth3ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8073     h_mapDepth4ADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth4ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8074     h_mapDepth5ADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth5ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8075     h_mapDepth6ADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth6ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8076     h_mapDepth7ADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth7ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8077     h_mapDepth1ADCAmpl12SiPM_HE = fs_->make<TH2F>("h_mapDepth1ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi);
8078     h_mapDepth2ADCAmpl12SiPM_HE = fs_->make<TH2F>("h_mapDepth2ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi);
8079     h_mapDepth3ADCAmpl12SiPM_HE = fs_->make<TH2F>("h_mapDepth3ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi);
8080 
8081     h_mapDepth1ADCAmpl12_HF = fs_->make<TH2F>("h_mapDepth1ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi);
8082     h_mapDepth2ADCAmpl12_HF = fs_->make<TH2F>("h_mapDepth2ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi);
8083     h_mapDepth3ADCAmpl12_HF = fs_->make<TH2F>("h_mapDepth3ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi);
8084     h_mapDepth4ADCAmpl12_HF = fs_->make<TH2F>("h_mapDepth4ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi);
8085 
8086     h_mapDepth4ADCAmpl12_HO = fs_->make<TH2F>("h_mapDepth4ADCAmpl12_HO", " ", neta, -41., 41., nphi, 0., bphi);
8087 
8088     h_mapDepth1linADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth1linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8089     h_mapDepth2linADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth2linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8090     h_mapDepth3linADCAmpl12_HE = fs_->make<TH2F>("h_mapDepth3linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi);
8091     //--------------------------------------------------
8092     h_mapGetRMSOverNormalizedSignal_HB =
8093         fs_->make<TH2F>("h_mapGetRMSOverNormalizedSignal_HB", " ", neta, -41., 41., nphi, 0., bphi);
8094     h_mapGetRMSOverNormalizedSignal0_HB =
8095         fs_->make<TH2F>("h_mapGetRMSOverNormalizedSignal0_HB", " ", neta, -41., 41., nphi, 0., bphi);
8096     h_mapGetRMSOverNormalizedSignal_HE =
8097         fs_->make<TH2F>("h_mapGetRMSOverNormalizedSignal_HE", " ", neta, -41., 41., nphi, 0., bphi);
8098     h_mapGetRMSOverNormalizedSignal0_HE =
8099         fs_->make<TH2F>("h_mapGetRMSOverNormalizedSignal0_HE", " ", neta, -41., 41., nphi, 0., bphi);
8100     h_mapGetRMSOverNormalizedSignal_HF =
8101         fs_->make<TH2F>("h_mapGetRMSOverNormalizedSignal_HF", " ", neta, -41., 41., nphi, 0., bphi);
8102     h_mapGetRMSOverNormalizedSignal0_HF =
8103         fs_->make<TH2F>("h_mapGetRMSOverNormalizedSignal0_HF", " ", neta, -41., 41., nphi, 0., bphi);
8104     h_mapGetRMSOverNormalizedSignal_HO =
8105         fs_->make<TH2F>("h_mapGetRMSOverNormalizedSignal_HO", " ", neta, -41., 41., nphi, 0., bphi);
8106     h_mapGetRMSOverNormalizedSignal0_HO =
8107         fs_->make<TH2F>("h_mapGetRMSOverNormalizedSignal0_HO", " ", neta, -41., 41., nphi, 0., bphi);
8108     //--------------------------------------------------
8109     h_shape_Ahigh_HB0 = fs_->make<TH1F>("h_shape_Ahigh_HB0", " ", 10, 0., 10.);
8110     h_shape0_Ahigh_HB0 = fs_->make<TH1F>("h_shape0_Ahigh_HB0", " ", 10, 0., 10.);
8111     h_shape_Alow_HB0 = fs_->make<TH1F>("h_shape_Alow_HB0", " ", 10, 0., 10.);
8112     h_shape0_Alow_HB0 = fs_->make<TH1F>("h_shape0_Alow_HB0", " ", 10, 0., 10.);
8113     h_shape_Ahigh_HB1 = fs_->make<TH1F>("h_shape_Ahigh_HB1", " ", 10, 0., 10.);
8114     h_shape0_Ahigh_HB1 = fs_->make<TH1F>("h_shape0_Ahigh_HB1", " ", 10, 0., 10.);
8115     h_shape_Alow_HB1 = fs_->make<TH1F>("h_shape_Alow_HB1", " ", 10, 0., 10.);
8116     h_shape0_Alow_HB1 = fs_->make<TH1F>("h_shape0_Alow_HB1", " ", 10, 0., 10.);
8117     h_shape_Ahigh_HB2 = fs_->make<TH1F>("h_shape_Ahigh_HB2", " ", 10, 0., 10.);
8118     h_shape0_Ahigh_HB2 = fs_->make<TH1F>("h_shape0_Ahigh_HB2", " ", 10, 0., 10.);
8119     h_shape_Alow_HB2 = fs_->make<TH1F>("h_shape_Alow_HB2", " ", 10, 0., 10.);
8120     h_shape0_Alow_HB2 = fs_->make<TH1F>("h_shape0_Alow_HB2", " ", 10, 0., 10.);
8121     h_shape_Ahigh_HB3 = fs_->make<TH1F>("h_shape_Ahigh_HB3", " ", 10, 0., 10.);
8122     h_shape0_Ahigh_HB3 = fs_->make<TH1F>("h_shape0_Ahigh_HB3", " ", 10, 0., 10.);
8123     h_shape_Alow_HB3 = fs_->make<TH1F>("h_shape_Alow_HB3", " ", 10, 0., 10.);
8124     h_shape0_Alow_HB3 = fs_->make<TH1F>("h_shape0_Alow_HB3", " ", 10, 0., 10.);
8125     //--------------------------------------------------
8126     h_shape_bad_channels_HB = fs_->make<TH1F>("h_shape_bad_channels_HB", " ", 10, 0., 10.);
8127     h_shape0_bad_channels_HB = fs_->make<TH1F>("h_shape0_bad_channels_HB", " ", 10, 0., 10.);
8128     h_shape_good_channels_HB = fs_->make<TH1F>("h_shape_good_channels_HB", " ", 10, 0., 10.);
8129     h_shape0_good_channels_HB = fs_->make<TH1F>("h_shape0_good_channels_HB", " ", 10, 0., 10.);
8130     h_shape_bad_channels_HE = fs_->make<TH1F>("h_shape_bad_channels_HE", " ", 10, 0., 10.);
8131     h_shape0_bad_channels_HE = fs_->make<TH1F>("h_shape0_bad_channels_HE", " ", 10, 0., 10.);
8132     h_shape_good_channels_HE = fs_->make<TH1F>("h_shape_good_channels_HE", " ", 10, 0., 10.);
8133     h_shape0_good_channels_HE = fs_->make<TH1F>("h_shape0_good_channels_HE", " ", 10, 0., 10.);
8134     h_shape_bad_channels_HF = fs_->make<TH1F>("h_shape_bad_channels_HF", " ", 10, 0., 10.);
8135     h_shape0_bad_channels_HF = fs_->make<TH1F>("h_shape0_bad_channels_HF", " ", 10, 0., 10.);
8136     h_shape_good_channels_HF = fs_->make<TH1F>("h_shape_good_channels_HF", " ", 10, 0., 10.);
8137     h_shape0_good_channels_HF = fs_->make<TH1F>("h_shape0_good_channels_HF", " ", 10, 0., 10.);
8138     h_shape_bad_channels_HO = fs_->make<TH1F>("h_shape_bad_channels_HO", " ", 10, 0., 10.);
8139     h_shape0_bad_channels_HO = fs_->make<TH1F>("h_shape0_bad_channels_HO", " ", 10, 0., 10.);
8140     h_shape_good_channels_HO = fs_->make<TH1F>("h_shape_good_channels_HO", " ", 10, 0., 10.);
8141     h_shape0_good_channels_HO = fs_->make<TH1F>("h_shape0_good_channels_HO", " ", 10, 0., 10.);
8142     //--------------------------------------------------
8143     //    if(flagcpuoptimization_== 0 ) {
8144 
8145     int spl = 1000;
8146     float spls = 5000;
8147     h_sumamplitude_depth1_HB = fs_->make<TH1F>("h_sumamplitude_depth1_HB", " ", spl, 0., spls);
8148     h_sumamplitude_depth2_HB = fs_->make<TH1F>("h_sumamplitude_depth2_HB", " ", spl, 0., spls);
8149     h_sumamplitude_depth1_HE = fs_->make<TH1F>("h_sumamplitude_depth1_HE", " ", spl, 0., spls);
8150     h_sumamplitude_depth2_HE = fs_->make<TH1F>("h_sumamplitude_depth2_HE", " ", spl, 0., spls);
8151     h_sumamplitude_depth3_HE = fs_->make<TH1F>("h_sumamplitude_depth3_HE", " ", spl, 0., spls);
8152     h_sumamplitude_depth1_HF = fs_->make<TH1F>("h_sumamplitude_depth1_HF", " ", spl, 0., spls);
8153     h_sumamplitude_depth2_HF = fs_->make<TH1F>("h_sumamplitude_depth2_HF", " ", spl, 0., spls);
8154     h_sumamplitude_depth4_HO = fs_->make<TH1F>("h_sumamplitude_depth4_HO", " ", spl, 0., spls);
8155     int spl0 = 1000;
8156     float spls0 = 10000;
8157     h_sumamplitude_depth1_HB0 = fs_->make<TH1F>("h_sumamplitude_depth1_HB0", " ", spl0, 0., spls0);
8158     h_sumamplitude_depth2_HB0 = fs_->make<TH1F>("h_sumamplitude_depth2_HB0", " ", spl0, 0., spls0);
8159     h_sumamplitude_depth1_HE0 = fs_->make<TH1F>("h_sumamplitude_depth1_HE0", " ", spl0, 0., spls0);
8160     h_sumamplitude_depth2_HE0 = fs_->make<TH1F>("h_sumamplitude_depth2_HE0", " ", spl0, 0., spls0);
8161     h_sumamplitude_depth3_HE0 = fs_->make<TH1F>("h_sumamplitude_depth3_HE0", " ", spl0, 0., spls0);
8162     h_sumamplitude_depth1_HF0 = fs_->make<TH1F>("h_sumamplitude_depth1_HF0", " ", spl0, 0., spls0);
8163     h_sumamplitude_depth2_HF0 = fs_->make<TH1F>("h_sumamplitude_depth2_HF0", " ", spl0, 0., spls0);
8164     h_sumamplitude_depth4_HO0 = fs_->make<TH1F>("h_sumamplitude_depth4_HO0", " ", spl0, 0., spls0);
8165     int spl1 = 1000;
8166     float spls1 = 100000;
8167     h_sumamplitude_depth1_HB1 = fs_->make<TH1F>("h_sumamplitude_depth1_HB1", " ", spl1, 0., spls1);
8168     h_sumamplitude_depth2_HB1 = fs_->make<TH1F>("h_sumamplitude_depth2_HB1", " ", spl1, 0., spls1);
8169     h_sumamplitude_depth1_HE1 = fs_->make<TH1F>("h_sumamplitude_depth1_HE1", " ", spl1, 0., spls1);
8170     h_sumamplitude_depth2_HE1 = fs_->make<TH1F>("h_sumamplitude_depth2_HE1", " ", spl1, 0., spls1);
8171     h_sumamplitude_depth3_HE1 = fs_->make<TH1F>("h_sumamplitude_depth3_HE1", " ", spl1, 0., spls1);
8172     h_sumamplitude_depth1_HF1 = fs_->make<TH1F>("h_sumamplitude_depth1_HF1", " ", spl1, 0., spls1);
8173     h_sumamplitude_depth2_HF1 = fs_->make<TH1F>("h_sumamplitude_depth2_HF1", " ", spl1, 0., spls1);
8174     h_sumamplitude_depth4_HO1 = fs_->make<TH1F>("h_sumamplitude_depth4_HO1", " ", spl1, 0., spls1);
8175 
8176     h_Amplitude_forCapIdErrors_HB1 = fs_->make<TH1F>("h_Amplitude_forCapIdErrors_HB1", " ", 100, 0., 30000.);
8177     h_Amplitude_forCapIdErrors_HB2 = fs_->make<TH1F>("h_Amplitude_forCapIdErrors_HB2", " ", 100, 0., 30000.);
8178     h_Amplitude_forCapIdErrors_HE1 = fs_->make<TH1F>("h_Amplitude_forCapIdErrors_HE1", " ", 100, 0., 30000.);
8179     h_Amplitude_forCapIdErrors_HE2 = fs_->make<TH1F>("h_Amplitude_forCapIdErrors_HE2", " ", 100, 0., 30000.);
8180     h_Amplitude_forCapIdErrors_HE3 = fs_->make<TH1F>("h_Amplitude_forCapIdErrors_HE3", " ", 100, 0., 30000.);
8181     h_Amplitude_forCapIdErrors_HF1 = fs_->make<TH1F>("h_Amplitude_forCapIdErrors_HF1", " ", 100, 0., 30000.);
8182     h_Amplitude_forCapIdErrors_HF2 = fs_->make<TH1F>("h_Amplitude_forCapIdErrors_HF2", " ", 100, 0., 30000.);
8183     h_Amplitude_forCapIdErrors_HO4 = fs_->make<TH1F>("h_Amplitude_forCapIdErrors_HO4", " ", 100, 0., 30000.);
8184 
8185     h_Amplitude_notCapIdErrors_HB1 = fs_->make<TH1F>("h_Amplitude_notCapIdErrors_HB1", " ", 100, 0., 30000.);
8186     h_Amplitude_notCapIdErrors_HB2 = fs_->make<TH1F>("h_Amplitude_notCapIdErrors_HB2", " ", 100, 0., 30000.);
8187     h_Amplitude_notCapIdErrors_HE1 = fs_->make<TH1F>("h_Amplitude_notCapIdErrors_HE1", " ", 100, 0., 30000.);
8188     h_Amplitude_notCapIdErrors_HE2 = fs_->make<TH1F>("h_Amplitude_notCapIdErrors_HE2", " ", 100, 0., 30000.);
8189     h_Amplitude_notCapIdErrors_HE3 = fs_->make<TH1F>("h_Amplitude_notCapIdErrors_HE3", " ", 100, 0., 30000.);
8190     h_Amplitude_notCapIdErrors_HF1 = fs_->make<TH1F>("h_Amplitude_notCapIdErrors_HF1", " ", 100, 0., 30000.);
8191     h_Amplitude_notCapIdErrors_HF2 = fs_->make<TH1F>("h_Amplitude_notCapIdErrors_HF2", " ", 100, 0., 30000.);
8192     h_Amplitude_notCapIdErrors_HO4 = fs_->make<TH1F>("h_Amplitude_notCapIdErrors_HO4", " ", 100, 0., 30000.);
8193 
8194     h_2DAtaildepth1_HB = fs_->make<TH2F>("h_2DAtaildepth1_HB", " ", neta, -41., 41., nphi, 0., bphi);
8195     h_2D0Ataildepth1_HB = fs_->make<TH2F>("h_2D0Ataildepth1_HB", " ", neta, -41., 41., nphi, 0., bphi);
8196     h_2DAtaildepth2_HB = fs_->make<TH2F>("h_2DAtaildepth2_HB", " ", neta, -41., 41., nphi, 0., bphi);
8197     h_2D0Ataildepth2_HB = fs_->make<TH2F>("h_2D0Ataildepth2_HB", " ", neta, -41., 41., nphi, 0., bphi);
8198 
8199     ////////////////////////////////////////////////////////////////////////////////////
8200   }  //if(recordHistoes_
8201   if (verbosity > 0)
8202     std::cout << "========================   booking DONE   +++++++++++++++++++++++++++" << std::endl;
8203   ///////////////////////////////////////////////////////            ntuples:
8204   if (recordNtuples_) {
8205     myTree = fs_->make<TTree>("Hcal", "Hcal Tree");
8206     myTree->Branch("Nevent", &Nevent, "Nevent/I");
8207     myTree->Branch("Run", &Run, "Run/I");
8208 
8209   }  //if(recordNtuples_
8210   if (verbosity > 0)
8211     std::cout << "========================   beignJob  finish   +++++++++++++++++++++++++++" << std::endl;
8212   //////////////////////////////////////////////////////////////////
8213 }
8214 
8215 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8216 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8217 // ------------ method called for each event  ------------
8218 void CMTRawAnalyzer::fillDigiErrors(HBHEDigiCollection::const_iterator& digiItr) {
8219   CaloSamples toolOriginal;  // TS
8220   //    double tool[100];
8221   if (verbosity < 0)
8222     std::cout << "**************   in loop over Digis   counter =     " << nnnnnnhbhe << std::endl;
8223   HcalDetId cell(digiItr->id());
8224   int mdepth = cell.depth();
8225   int iphi = cell.iphi() - 1;
8226   int ieta = cell.ieta();
8227   if (ieta > 0)
8228     ieta -= 1;
8229   int sub = cell.subdet();  // 1-HB, 2-HE (HFDigiCollection: 4-HF)
8230   // !!!!!!
8231   int errorGeneral = 0;
8232   int error1 = 0;
8233   int error2 = 0;
8234   int error3 = 0;
8235   int error4 = 0;
8236   int error5 = 0;
8237   int error6 = 0;
8238   int error7 = 0;
8239   // !!!!!!
8240   bool anycapid = true;
8241   bool anyer = false;
8242   bool anydv = true;
8243   // for help:
8244   int firstcapid = 0;
8245   int lastcapid = 0, capid = 0;
8246   int ERRORfiber = -10;
8247   int ERRORfiberChan = -10;
8248   int ERRORfiberAndChan = -10;
8249   int repetedcapid = 0;
8250   int TSsize = 10;
8251   TSsize = digiItr->size();
8252 
8253   ///////////////////////////////////////
8254   for (int ii = 0; ii < TSsize; ii++) {
8255     capid = (*digiItr)[ii].capid();                    // capId (0-3, sequential)
8256     bool er = (*digiItr)[ii].er();                     // error
8257     bool dv = (*digiItr)[ii].dv();                     // valid data
8258     int fiber = (*digiItr)[ii].fiber();                // get the fiber number
8259     int fiberChan = (*digiItr)[ii].fiberChan();        // get the fiber channel number
8260     int fiberAndChan = (*digiItr)[ii].fiberAndChan();  // get the id channel
8261     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
8262       anycapid = false;
8263       ERRORfiber = fiber;
8264       ERRORfiberChan = fiberChan;
8265       ERRORfiberAndChan = fiberAndChan;
8266       if (capid != lastcapid) {
8267       } else {
8268         repetedcapid = 1;
8269       }
8270     }
8271     lastcapid = capid;
8272 
8273     if (ii == 0)
8274       firstcapid = capid;
8275 
8276     if (er) {
8277       anyer = true;
8278       ERRORfiber = fiber;
8279       ERRORfiberChan = fiberChan;
8280       ERRORfiberAndChan = fiberAndChan;
8281     }
8282     if (!dv) {
8283       anydv = false;
8284       ERRORfiber = fiber;
8285       ERRORfiberChan = fiberChan;
8286       ERRORfiberAndChan = fiberAndChan;
8287     }
8288 
8289   }  // for
8290 
8291   ///////////////////////////////////////
8292   if (firstcapid == 0 && !anycapid)
8293     errorGeneral = 1;
8294   if (firstcapid == 1 && !anycapid)
8295     errorGeneral = 2;
8296   if (firstcapid == 2 && !anycapid)
8297     errorGeneral = 3;
8298   if (firstcapid == 3 && !anycapid)
8299     errorGeneral = 4;
8300   if (!anycapid)
8301     error1 = 1;
8302   if (anyer)
8303     error2 = 1;
8304   if (!anydv)
8305     error3 = 1;
8306 
8307   if (!anycapid && anyer)
8308     error4 = 1;
8309   if (!anycapid && !anydv)
8310     error5 = 1;
8311   if (!anycapid && anyer && !anydv)
8312     error6 = 1;
8313   if (anyer && !anydv)
8314     error7 = 1;
8315   ///////////////////////////////////////Energy
8316   // Energy:
8317 
8318   double ampl = 0.;
8319   for (int ii = 0; ii < TSsize; ii++) {
8320     double ampldefault = adc2fC[digiItr->sample(ii).adc()];
8321     ampl += ampldefault;  // fC
8322   }
8323 
8324   ///////////////////////////////////////Digis
8325   // Digis:
8326   // HB
8327   if (sub == 1) {
8328     h_errorGeneral_HB->Fill(double(errorGeneral), 1.);
8329     h_error1_HB->Fill(double(error1), 1.);
8330     h_error2_HB->Fill(double(error2), 1.);
8331     h_error3_HB->Fill(double(error3), 1.);
8332     h_error4_HB->Fill(double(error4), 1.);
8333     h_error5_HB->Fill(double(error5), 1.);
8334     h_error6_HB->Fill(double(error6), 1.);
8335     h_error7_HB->Fill(double(error7), 1.);
8336     h_repetedcapid_HB->Fill(double(repetedcapid), 1.);
8337 
8338     if (error1 != 0 || error2 != 0 || error3 != 0) {
8339       if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 0)
8340         ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
8341       h_amplError_HB->Fill(ampl, 1.);
8342       if (mdepth == 1)
8343         h_mapDepth1Error_HB->Fill(double(ieta), double(iphi));
8344       if (mdepth == 2)
8345         h_mapDepth2Error_HB->Fill(double(ieta), double(iphi));
8346       h_fiber0_HB->Fill(double(ERRORfiber), 1.);
8347       h_fiber1_HB->Fill(double(ERRORfiberChan), 1.);
8348       h_fiber2_HB->Fill(double(ERRORfiberAndChan), 1.);
8349     } else {
8350       h_amplFine_HB->Fill(ampl, 1.);
8351     }
8352   }
8353   // HE
8354   if (sub == 2) {
8355     h_errorGeneral_HE->Fill(double(errorGeneral), 1.);
8356     h_error1_HE->Fill(double(error1), 1.);
8357     h_error2_HE->Fill(double(error2), 1.);
8358     h_error3_HE->Fill(double(error3), 1.);
8359     h_error4_HE->Fill(double(error4), 1.);
8360     h_error5_HE->Fill(double(error5), 1.);
8361     h_error6_HE->Fill(double(error6), 1.);
8362     h_error7_HE->Fill(double(error7), 1.);
8363     h_repetedcapid_HE->Fill(double(repetedcapid), 1.);
8364 
8365     if (error1 != 0 || error2 != 0 || error3 != 0) {
8366       if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 0)
8367         ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
8368       h_amplError_HE->Fill(ampl, 1.);
8369       if (mdepth == 1)
8370         h_mapDepth1Error_HE->Fill(double(ieta), double(iphi));
8371       if (mdepth == 2)
8372         h_mapDepth2Error_HE->Fill(double(ieta), double(iphi));
8373       if (mdepth == 3)
8374         h_mapDepth3Error_HE->Fill(double(ieta), double(iphi));
8375       h_fiber0_HE->Fill(double(ERRORfiber), 1.);
8376       h_fiber1_HE->Fill(double(ERRORfiberChan), 1.);
8377       h_fiber2_HE->Fill(double(ERRORfiberAndChan), 1.);
8378     } else {
8379       h_amplFine_HE->Fill(ampl, 1.);
8380     }
8381   }
8382   //    ha2->Fill(double(ieta), double(iphi));
8383 }  //fillDigiErrors
8384 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8385 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    fillDigiErrorsHBHEQIE11
8386 // ------------ method called for each event  ------------
8387 void CMTRawAnalyzer::fillDigiErrorsQIE11(QIE11DataFrame qie11df) {
8388   CaloSamples toolOriginal;  // TS
8389   //  double tool[100];
8390   DetId detid = qie11df.detid();
8391   HcalDetId hcaldetid = HcalDetId(detid);
8392   int ieta = hcaldetid.ieta();
8393   if (ieta > 0)
8394     ieta -= 1;
8395   int iphi = hcaldetid.iphi() - 1;
8396   int mdepth = hcaldetid.depth();
8397   int sub = hcaldetid.subdet();  // 1-HB, 2-HE (HFDigiCollection: 4-HF)
8398   int ampts[10];
8399   int icapid[10];
8400   for (int ii = 0; ii < 10; ii++) {
8401     ampts[ii] = 0.;
8402     icapid[ii] = 0.;
8403   }
8404   bool sticking = false;
8405   int error1 = 0;
8406   bool anycapid = true;
8407   bool anyer = false;
8408   bool anydv = true;
8409   int error2 = 0, error3 = 0;
8410   // for help:
8411   int firstcapid = 0;
8412   int lastcapid = 0, capid = 0;
8413   int repetedcapid = 0;
8414   // loop over the samples in the digi
8415   nTS = qie11df.samples();
8416   /////////////////////////////////////////////////////////////////
8417   if (mdepth == 0 || sub > 4)
8418     return;
8419   if (mdepth > 3 && flagupgradeqie1011_ == 3)
8420     return;
8421   if (mdepth > 3 && flagupgradeqie1011_ == 7)
8422     return;
8423   if (mdepth > 3 && flagupgradeqie1011_ == 8)
8424     return;
8425   if (mdepth > 3 && flagupgradeqie1011_ == 9)
8426     return;
8427   ///////////////////////////////////////
8428   for (int ii = 0; ii < nTS; ii++) {
8429     capid = qie11df[ii].capid();  // capId (0-3, sequential)
8430     bool er = false;
8431     bool dv = true;
8432     icapid[ii] = capid;
8433     // valid data
8434     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
8435       anycapid = false;
8436       if (capid != lastcapid) {
8437       } else {
8438         repetedcapid = 1;
8439       }
8440     }
8441     lastcapid = capid;
8442     if (er)
8443       anyer = true;
8444     if (!dv)
8445       anydv = false;
8446     if (ii == 0)
8447       firstcapid = capid;
8448   }  // for
8449   if (!anycapid)
8450     error1 = 1;
8451   if (anyer)
8452     error2 = 1;
8453   if (!anydv)
8454     error3 = 1;
8455   double ampl = 0.;
8456   for (int ii = 0; ii < nTS; ii++) {
8457     int adc = qie11df[ii].adc();
8458     ampts[ii] = adc;
8459     if (sub == 1) {
8460       h_nadccounts0_HB->Fill(float(ampts[ii]), 1.);
8461     }
8462     if (sub == 2) {
8463       h_nadccounts0_HE->Fill(float(ampts[ii]), 1.);
8464     }
8465     double ampldefault = adc2fC_QIE11_shunt6[adc];
8466     if (flaguseshunt_ == 1)
8467       ampldefault = adc2fC_QIE11_shunt1[adc];
8468     ampl += ampldefault;  //
8469   }
8470   if (sub == 1 || sub == 2) {
8471     if (verbosity == 111111 && (ampts[0] == ampts[1]) && (ampts[1] == ampts[2]) && (ampts[2] == ampts[3]) &&
8472         (ampts[3] == ampts[4]) && (ampts[4] == ampts[5]) && (ampts[5] == ampts[6]) && (ampts[6] == ampts[7])) {
8473       std::cout << " HBHE DIGI A,fC =  " << ampl << " sub = " << sub << " mdepth = " << mdepth << " nTS = " << nTS
8474                 << std::endl;
8475       std::cout << " Ai,adc counts:  " << std::endl;
8476       std::cout << " A1 =  " << ampts[0] << " A2 =  " << ampts[1] << " A3 =  " << ampts[2] << " A4 =  " << ampts[3]
8477                 << std::endl;
8478       std::cout << " A5 =  " << ampts[4] << " A6 =  " << ampts[5] << " A7 =  " << ampts[6] << " A8 =  " << ampts[7]
8479                 << std::endl;
8480       std::cout << " icapid:  " << std::endl;
8481       std::cout << " icapid1 =  " << icapid[0] << " icapid2 =  " << icapid[1] << " icapid3 =  " << icapid[2]
8482                 << " icapid4 =  " << icapid[3] << std::endl;
8483       std::cout << " icapid5 =  " << icapid[4] << " icapid6 =  " << icapid[5] << " icapid7 =  " << icapid[6]
8484                 << " icapid8 =  " << icapid[7] << std::endl;
8485     }
8486     if (verbosity == 222222 && (ampts[3] > 95 && (ampts[3] == ampts[4]) && (ampts[4] == ampts[5]))) {
8487       std::cout << " HBHE DIGI A,fC =  " << ampl << " sub = " << sub << " mdepth = " << mdepth << " nTS = " << nTS
8488                 << std::endl;
8489       std::cout << " Ai,adc counts:  " << std::endl;
8490       std::cout << " A1 =  " << ampts[0] << " A2 =  " << ampts[1] << " A3 =  " << ampts[2] << " A4 =  " << ampts[3]
8491                 << std::endl;
8492       std::cout << " A5 =  " << ampts[4] << " A6 =  " << ampts[5] << " A7 =  " << ampts[6] << " A8 =  " << ampts[7]
8493                 << std::endl;
8494       std::cout << " icapid:  " << std::endl;
8495       std::cout << " icapid1 =  " << icapid[0] << " icapid2 =  " << icapid[1] << " icapid3 =  " << icapid[2]
8496                 << " icapid4 =  " << icapid[3] << std::endl;
8497       std::cout << " icapid5 =  " << icapid[4] << " icapid6 =  " << icapid[5] << " icapid7 =  " << icapid[6]
8498                 << " icapid8 =  " << icapid[7] << std::endl;
8499     }
8500     if (verbosity == 333333 && (ampts[0] > 14 && ampts[0] == ampts[1]) && (ampts[1] == ampts[2]) &&
8501         (ampts[2] == ampts[3]) && (ampts[3] == ampts[4]) && (ampts[4] == ampts[5]) && (ampts[5] == ampts[6]) &&
8502         (ampts[6] == ampts[7])) {
8503       std::cout << " HBHE DIGI A,fC =  " << ampl << " sub = " << sub << " mdepth = " << mdepth << " nTS = " << nTS
8504                 << std::endl;
8505       std::cout << " Ai,adc counts:  " << std::endl;
8506       std::cout << " A1 =  " << ampts[0] << " A2 =  " << ampts[1] << " A3 =  " << ampts[2] << " A4 =  " << ampts[3]
8507                 << std::endl;
8508       std::cout << " A5 =  " << ampts[4] << " A6 =  " << ampts[5] << " A7 =  " << ampts[6] << " A8 =  " << ampts[7]
8509                 << std::endl;
8510       std::cout << " icapid:  " << std::endl;
8511       std::cout << " icapid1 =  " << icapid[0] << " icapid2 =  " << icapid[1] << " icapid3 =  " << icapid[2]
8512                 << " icapid4 =  " << icapid[3] << std::endl;
8513       std::cout << " icapid5 =  " << icapid[4] << " icapid6 =  " << icapid[5] << " icapid7 =  " << icapid[6]
8514                 << " icapid8 =  " << icapid[7] << std::endl;
8515     }
8516     if ((ampts[0] == ampts[1]) && (ampts[1] == ampts[2]) && (ampts[2] == ampts[3]) && (ampts[3] == ampts[4]) &&
8517         (ampts[4] == ampts[5]) && (ampts[5] == ampts[6]) && (ampts[6] == ampts[7])) {
8518       if (sub == 1) {
8519         h_nadccounts8_HB->Fill(float(ampts[0]), 1.);
8520       }
8521       if (sub == 2) {
8522         h_nadccounts8_HE->Fill(float(ampts[0]), 1.);
8523       }
8524       if (ampts[4] > 139)
8525         sticking = true;
8526     }  // nadccounts8
8527     if (((ampts[0] == ampts[1]) && (ampts[1] == ampts[2]) && (ampts[2] == ampts[3]) && (ampts[3] == ampts[4]) &&
8528          (ampts[4] == ampts[5])) ||
8529         ((ampts[1] == ampts[2]) && (ampts[2] == ampts[3]) && (ampts[3] == ampts[4]) && (ampts[4] == ampts[5]) &&
8530          (ampts[5] == ampts[6])) ||
8531         ((ampts[2] == ampts[3]) && (ampts[3] == ampts[4]) && (ampts[4] == ampts[5]) && (ampts[5] == ampts[6]) &&
8532          (ampts[6] == ampts[7]))) {
8533       if (sub == 1) {
8534         h_nadccounts6_HB->Fill(float(ampts[3]), 1.);
8535       }
8536       if (sub == 2) {
8537         h_nadccounts6_HE->Fill(float(ampts[3]), 1.);
8538       }
8539     }  // nadccounts6
8540     if (((ampts[0] == ampts[1]) && (ampts[1] == ampts[2]) && (ampts[2] == ampts[3])) ||
8541         ((ampts[1] == ampts[2]) && (ampts[2] == ampts[3]) && (ampts[3] == ampts[4])) ||
8542         ((ampts[2] == ampts[3]) && (ampts[3] == ampts[4]) && (ampts[4] == ampts[5])) ||
8543         ((ampts[3] == ampts[4]) && (ampts[4] == ampts[5]) && (ampts[5] == ampts[6]))) {
8544       if (sub == 1) {
8545         h_nadccounts4_HB->Fill(float(ampts[3]), 1.);
8546       }
8547       if (sub == 2) {
8548         h_nadccounts4_HE->Fill(float(ampts[3]), 1.);
8549       }
8550     }  // nadccounts4
8551     if (((ampts[4] == ampts[5]) && (ampts[5] == ampts[6]) && (ampts[6] == ampts[7]))) {
8552       if (sub == 1) {
8553         h_nadccounts4_HB->Fill(float(ampts[4]), 1.);
8554       }
8555       if (sub == 2) {
8556         h_nadccounts4_HE->Fill(float(ampts[4]), 1.);
8557       }
8558     }  // nadccounts4
8559     if (((ampts[0] == ampts[1]) && (ampts[1] == ampts[2])) || ((ampts[1] == ampts[2]) && (ampts[2] == ampts[3])) ||
8560         ((ampts[2] == ampts[3]) && (ampts[3] == ampts[4]))) {
8561       if (sub == 1) {
8562         h_nadccounts3_HB->Fill(float(ampts[2]), 1.);
8563       }
8564       if (sub == 2) {
8565         h_nadccounts3_HE->Fill(float(ampts[2]), 1.);
8566       }
8567     }  // nadccounts3
8568     if (((ampts[3] == ampts[4]) && (ampts[4] == ampts[5])) || ((ampts[4] == ampts[5]) && (ampts[5] == ampts[6])) ||
8569         ((ampts[5] == ampts[6]) && (ampts[6] == ampts[7]))) {
8570       if (sub == 1) {
8571         h_nadccounts3_HB->Fill(float(ampts[5]), 1.);
8572       }
8573       if (sub == 2) {
8574         h_nadccounts3_HE->Fill(float(ampts[5]), 1.);
8575       }
8576     }  // nadccounts3
8577     if (ampts[0] == ampts[1]) {
8578       if (sub == 1) {
8579         h_nadccounts2_HB->Fill(float(ampts[1]), 1.);
8580       }
8581       if (sub == 2) {
8582         h_nadccounts2_HE->Fill(float(ampts[1]), 1.);
8583       }
8584     }  // nadccounts2
8585     if (ampts[1] == ampts[2]) {
8586       if (sub == 1) {
8587         h_nadccounts2_HB->Fill(float(ampts[2]), 1.);
8588       }
8589       if (sub == 2) {
8590         h_nadccounts2_HE->Fill(float(ampts[2]), 1.);
8591       }
8592     }  // nadccounts2
8593     if (ampts[2] == ampts[3]) {
8594       if (sub == 1) {
8595         h_nadccounts2_HB->Fill(float(ampts[3]), 1.);
8596       }
8597       if (sub == 2) {
8598         h_nadccounts2_HE->Fill(float(ampts[3]), 1.);
8599       }
8600     }  // nadccounts2
8601     if (ampts[3] == ampts[4]) {
8602       if (sub == 1) {
8603         h_nadccounts2_HB->Fill(float(ampts[4]), 1.);
8604       }
8605       if (sub == 2) {
8606         h_nadccounts2_HE->Fill(float(ampts[4]), 1.);
8607       }
8608     }  // nadccounts2
8609     if (ampts[4] == ampts[5]) {
8610       if (sub == 1) {
8611         h_nadccounts2_HB->Fill(float(ampts[5]), 1.);
8612       }
8613       if (sub == 2) {
8614         h_nadccounts2_HE->Fill(float(ampts[5]), 1.);
8615       }
8616     }  // nadccounts2
8617     if (ampts[5] == ampts[6]) {
8618       if (sub == 1) {
8619         h_nadccounts2_HB->Fill(float(ampts[6]), 1.);
8620       }
8621       if (sub == 2) {
8622         h_nadccounts2_HE->Fill(float(ampts[6]), 1.);
8623       }
8624     }  // nadccounts2
8625     if (ampts[6] == ampts[7]) {
8626       if (sub == 1) {
8627         h_nadccounts2_HB->Fill(float(ampts[7]), 1.);
8628       }
8629       if (sub == 2) {
8630         h_nadccounts2_HE->Fill(float(ampts[7]), 1.);
8631       }
8632     }  // nadccounts2
8633   }  // sub
8634   if (sticking) {
8635     error1 = 1;
8636     if (verbosity == 444444) {
8637       std::cout << " A>139, sticking =  " << sticking << " sub =  " << sub << " ampts0 =  " << ampts[0]
8638                 << " ampts1 =  " << ampts[1] << " ampts2 =  " << ampts[2] << " ampts3 =  " << ampts[3]
8639                 << " ampts4 =  " << ampts[4] << " ampts5 =  " << ampts[5] << " ampts6 =  " << ampts[6]
8640                 << " ampts7 =  " << ampts[7] << std::endl;
8641       std::cout << " icapid0 =  " << icapid[0] << " icapid1 =  " << icapid[1] << " icapid2 =  " << icapid[2]
8642                 << " icapid3 =  " << icapid[3] << " icapid4 =  " << icapid[4] << " icapid5 =  " << icapid[5]
8643                 << " icapid6 =  " << icapid[6] << " icapid7 =  " << icapid[7] << std::endl;
8644     }
8645   }
8646   ///////////////////////////////////////Digis
8647   // Digis:HBHE
8648   if (sub == 1) {
8649     h_error1_HB->Fill(double(error1), 1.);
8650     h_repetedcapid_HB->Fill(double(repetedcapid), 1.);
8651     //  if (error1 != 0) {
8652     if (error1 != 0 || error2 != 0 || error3 != 0) {
8653       if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 0)
8654         ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
8655       h_amplError_HB->Fill(ampl, 1.);
8656       if (mdepth == 1)
8657         h_mapDepth1Error_HB->Fill(double(ieta), double(iphi));
8658       if (mdepth == 2)
8659         h_mapDepth2Error_HB->Fill(double(ieta), double(iphi));
8660       if (mdepth == 3)
8661         h_mapDepth3Error_HB->Fill(double(ieta), double(iphi));
8662       if (mdepth == 4)
8663         h_mapDepth4Error_HB->Fill(double(ieta), double(iphi));
8664       h_errorGeneral_HB->Fill(double(firstcapid), 1.);
8665     } else {
8666       h_amplFine_HB->Fill(ampl, 1.);
8667     }
8668   }
8669   if (sub == 2) {
8670     h_error1_HE->Fill(double(error1), 1.);
8671     h_repetedcapid_HE->Fill(double(repetedcapid), 1.);
8672     //     if (error1 != 0) {
8673     if (error1 != 0 || error2 != 0 || error3 != 0) {
8674       if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 0)
8675         ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
8676       h_amplError_HE->Fill(ampl, 1.);
8677       if (mdepth == 1)
8678         h_mapDepth1Error_HE->Fill(double(ieta), double(iphi));
8679       if (mdepth == 2)
8680         h_mapDepth2Error_HE->Fill(double(ieta), double(iphi));
8681       if (mdepth == 3)
8682         h_mapDepth3Error_HE->Fill(double(ieta), double(iphi));
8683       if (mdepth == 4)
8684         h_mapDepth4Error_HE->Fill(double(ieta), double(iphi));
8685       if (mdepth == 5)
8686         h_mapDepth5Error_HE->Fill(double(ieta), double(iphi));
8687       if (mdepth == 6)
8688         h_mapDepth6Error_HE->Fill(double(ieta), double(iphi));
8689       if (mdepth == 7)
8690         h_mapDepth7Error_HE->Fill(double(ieta), double(iphi));
8691       h_errorGeneral_HE->Fill(double(firstcapid), 1.);
8692     } else {
8693       h_amplFine_HE->Fill(ampl, 1.);
8694     }
8695   }
8696 }  //fillDigiErrorsQIE11
8697 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    fillDigiErrorsHF
8698 // ------------ method called for each event  ------------
8699 void CMTRawAnalyzer::fillDigiErrorsHF(HFDigiCollection::const_iterator& digiItr) {
8700   CaloSamples toolOriginal;  // TS
8701   //  double tool[100];
8702   HcalDetId cell(digiItr->id());
8703   int mdepth = cell.depth();
8704   int iphi = cell.iphi() - 1;
8705   int ieta = cell.ieta();
8706   if (ieta > 0)
8707     ieta -= 1;
8708   int sub = cell.subdet();  // 1-HB, 2-HE (HFDigiCollection: 4-HF)
8709   if (mdepth > 2)
8710     std::cout << " HF DIGI ??????????????   ERROR       mdepth =  " << mdepth << std::endl;
8711   // !!!!!!
8712   int errorGeneral = 0;
8713   int error1 = 0;
8714   int error2 = 0;
8715   int error3 = 0;
8716   int error4 = 0;
8717   int error5 = 0;
8718   int error6 = 0;
8719   int error7 = 0;
8720   // !!!!!!
8721   bool anycapid = true;
8722   bool anyer = false;
8723   bool anydv = true;
8724   // for help:
8725   int firstcapid = 0;
8726   int lastcapid = 0, capid = 0;
8727   int ERRORfiber = -10;
8728   int ERRORfiberChan = -10;
8729   int ERRORfiberAndChan = -10;
8730   int repetedcapid = 0;
8731 
8732   int TSsize = 10;
8733   TSsize = digiItr->size();
8734   ///////////////////////////////////////
8735   for (int ii = 0; ii < TSsize; ii++) {
8736     capid = (*digiItr)[ii].capid();                    // capId (0-3, sequential)
8737     bool er = (*digiItr)[ii].er();                     // error
8738     bool dv = (*digiItr)[ii].dv();                     // valid data
8739     int fiber = (*digiItr)[ii].fiber();                // get the fiber number
8740     int fiberChan = (*digiItr)[ii].fiberChan();        // get the fiber channel number
8741     int fiberAndChan = (*digiItr)[ii].fiberAndChan();  // get the id channel
8742     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
8743       anycapid = false;
8744       ERRORfiber = fiber;
8745       ERRORfiberChan = fiberChan;
8746       ERRORfiberAndChan = fiberAndChan;
8747       if (capid != lastcapid) {
8748       } else {
8749         repetedcapid = 1;
8750       }
8751     }
8752     lastcapid = capid;
8753     if (ii == 0)
8754       firstcapid = capid;
8755     if (er) {
8756       anyer = true;
8757       ERRORfiber = fiber;
8758       ERRORfiberChan = fiberChan;
8759       ERRORfiberAndChan = fiberAndChan;
8760     }
8761     if (!dv) {
8762       anydv = false;
8763       ERRORfiber = fiber;
8764       ERRORfiberChan = fiberChan;
8765       ERRORfiberAndChan = fiberAndChan;
8766     }
8767   }  // for
8768   ///////////////////////////////////////
8769   if (firstcapid == 0 && !anycapid)
8770     errorGeneral = 1;
8771   if (firstcapid == 1 && !anycapid)
8772     errorGeneral = 2;
8773   if (firstcapid == 2 && !anycapid)
8774     errorGeneral = 3;
8775   if (firstcapid == 3 && !anycapid)
8776     errorGeneral = 4;
8777   if (!anycapid)
8778     error1 = 1;
8779   if (anyer)
8780     error2 = 1;
8781   if (!anydv)
8782     error3 = 1;
8783   if (!anycapid && anyer)
8784     error4 = 1;
8785   if (!anycapid && !anydv)
8786     error5 = 1;
8787   if (!anycapid && anyer && !anydv)
8788     error6 = 1;
8789   if (anyer && !anydv)
8790     error7 = 1;
8791   ///////////////////////////////////////Ampl
8792   double ampl = 0.;
8793   for (int ii = 0; ii < TSsize; ii++) {
8794     double ampldefault = adc2fC[digiItr->sample(ii).adc()];
8795     ampl += ampldefault;  // fC
8796   }
8797   ///////////////////////////////////////Digis
8798   // Digis: HF
8799   if (sub == 4) {
8800     h_errorGeneral_HF->Fill(double(errorGeneral), 1.);
8801     h_error1_HF->Fill(double(error1), 1.);
8802     h_error2_HF->Fill(double(error2), 1.);
8803     h_error3_HF->Fill(double(error3), 1.);
8804     h_error4_HF->Fill(double(error4), 1.);
8805     h_error5_HF->Fill(double(error5), 1.);
8806     h_error6_HF->Fill(double(error6), 1.);
8807     h_error7_HF->Fill(double(error7), 1.);
8808     h_repetedcapid_HF->Fill(double(repetedcapid), 1.);
8809     if (error1 != 0 || error2 != 0 || error3 != 0) {
8810       if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 0)
8811         ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
8812       h_amplError_HF->Fill(ampl, 1.);
8813       if (mdepth == 1)
8814         h_mapDepth1Error_HF->Fill(double(ieta), double(iphi));
8815       if (mdepth == 2)
8816         h_mapDepth2Error_HF->Fill(double(ieta), double(iphi));
8817       h_fiber0_HF->Fill(double(ERRORfiber), 1.);
8818       h_fiber1_HF->Fill(double(ERRORfiberChan), 1.);
8819       h_fiber2_HF->Fill(double(ERRORfiberAndChan), 1.);
8820     } else {
8821       h_amplFine_HF->Fill(ampl, 1.);
8822     }
8823   }
8824 }
8825 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8826 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8827 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8828 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    fillDigiErrorsHFQIE10
8829 // ------------ method called for each event  ------------
8830 void CMTRawAnalyzer::fillDigiErrorsHFQIE10(QIE10DataFrame qie10df) {
8831   CaloSamples toolOriginal;  // TS
8832   //  double tool[100];
8833   DetId detid = qie10df.detid();
8834   HcalDetId hcaldetid = HcalDetId(detid);
8835   int ieta = hcaldetid.ieta();
8836   if (ieta > 0)
8837     ieta -= 1;
8838   int iphi = hcaldetid.iphi() - 1;
8839   int mdepth = hcaldetid.depth();
8840   int sub = hcaldetid.subdet();  // 1-HB, 2-HE (HFDigiCollection: 4-HF)
8841   // !!!!!!
8842   int error1 = 0;
8843   // !!!!!!
8844   bool anycapid = true;
8845   //    bool anyer      =  false;
8846   //    bool anydv      =  true;
8847   // for help:
8848   int firstcapid = 0;
8849   int lastcapid = 0, capid = 0;
8850   int repetedcapid = 0;
8851   // loop over the samples in the digi
8852   nTS = qie10df.samples();
8853   ///////////////////////////////////////
8854   for (int ii = 0; ii < nTS; ii++) {
8855     capid = qie10df[ii].capid();  // capId (0-3, sequential)
8856     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
8857       anycapid = false;
8858       if (capid != lastcapid) {
8859       } else {
8860         repetedcapid = 1;
8861       }
8862     }
8863     lastcapid = capid;
8864     if (ii == 0)
8865       firstcapid = capid;
8866   }  // for
8867   ///////////////////////////////////////
8868   if (!anycapid)
8869     error1 = 1;
8870   // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
8871   double ampl = 0.;
8872   for (int ii = 0; ii < nTS; ii++) {
8873     int adc = qie10df[ii].adc();
8874     double ampldefault = adc2fC_QIE10[adc];
8875     ampl += ampldefault;  //
8876   }
8877   ///////////////////////////////////////Digis
8878   // Digis:HF
8879   if (sub == 4) {
8880     h_error1_HF->Fill(double(error1), 1.);
8881     h_repetedcapid_HF->Fill(double(repetedcapid), 1.);
8882     if (error1 != 0) {
8883       //      if(error1 !=0 || error2 !=0 || error3 !=0 ) {
8884       if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 0)
8885         ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
8886       h_amplError_HF->Fill(ampl, 1.);
8887       if (mdepth == 1)
8888         h_mapDepth1Error_HF->Fill(double(ieta), double(iphi));
8889       if (mdepth == 2)
8890         h_mapDepth2Error_HF->Fill(double(ieta), double(iphi));
8891       if (mdepth == 3)
8892         h_mapDepth3Error_HF->Fill(double(ieta), double(iphi));
8893       if (mdepth == 4)
8894         h_mapDepth4Error_HF->Fill(double(ieta), double(iphi));
8895       h_errorGeneral_HF->Fill(double(firstcapid), 1.);
8896     } else {
8897       h_amplFine_HF->Fill(ampl, 1.);
8898     }
8899   }
8900 }
8901 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8902 // ------------ method called for each event  ------------
8903 void CMTRawAnalyzer::fillDigiErrorsHO(HODigiCollection::const_iterator& digiItr) {
8904   CaloSamples toolOriginal;  // TS
8905   HcalDetId cell(digiItr->id());
8906   int mdepth = cell.depth();
8907   int iphi = cell.iphi() - 1;
8908   int ieta = cell.ieta();
8909   if (ieta > 0)
8910     ieta -= 1;
8911   int sub = cell.subdet();  // 1-HB, 2-HE, 3-HO, 4-HF
8912   int errorGeneral = 0;
8913   int error1 = 0;
8914   int error2 = 0;
8915   int error3 = 0;
8916   int error4 = 0;
8917   int error5 = 0;
8918   int error6 = 0;
8919   int error7 = 0;
8920   // !!!!!!
8921   bool anycapid = true;
8922   bool anyer = false;
8923   bool anydv = true;
8924   // for help:
8925   int firstcapid = 0;
8926   int lastcapid = 0, capid = 0;
8927   int ERRORfiber = -10;
8928   int ERRORfiberChan = -10;
8929   int ERRORfiberAndChan = -10;
8930   int repetedcapid = 0;
8931   for (int ii = 0; ii < (*digiItr).size(); ii++) {
8932     capid = (*digiItr)[ii].capid();                    // capId (0-3, sequential)
8933     bool er = (*digiItr)[ii].er();                     // error
8934     bool dv = (*digiItr)[ii].dv();                     // valid data
8935     int fiber = (*digiItr)[ii].fiber();                // get the fiber number
8936     int fiberChan = (*digiItr)[ii].fiberChan();        // get the fiber channel number
8937     int fiberAndChan = (*digiItr)[ii].fiberAndChan();  // get the id channel
8938     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
8939       anycapid = false;
8940       ERRORfiber = fiber;
8941       ERRORfiberChan = fiberChan;
8942       ERRORfiberAndChan = fiberAndChan;
8943       if (capid != lastcapid) {
8944       } else {
8945         repetedcapid = 1;
8946       }
8947     }
8948     lastcapid = capid;
8949 
8950     if (ii == 0)
8951       firstcapid = capid;
8952 
8953     if (er) {
8954       anyer = true;
8955       ERRORfiber = fiber;
8956       ERRORfiberChan = fiberChan;
8957       ERRORfiberAndChan = fiberAndChan;
8958     }
8959     if (!dv) {
8960       anydv = false;
8961       ERRORfiber = fiber;
8962       ERRORfiberChan = fiberChan;
8963       ERRORfiberAndChan = fiberAndChan;
8964     }
8965 
8966   }  // for
8967 
8968   ///////////////////////////////////////
8969   if (firstcapid == 0 && !anycapid)
8970     errorGeneral = 1;
8971   if (firstcapid == 1 && !anycapid)
8972     errorGeneral = 2;
8973   if (firstcapid == 2 && !anycapid)
8974     errorGeneral = 3;
8975   if (firstcapid == 3 && !anycapid)
8976     errorGeneral = 4;
8977   if (!anycapid)
8978     error1 = 1;
8979   if (anyer)
8980     error2 = 1;
8981   if (!anydv)
8982     error3 = 1;
8983 
8984   if (!anycapid && anyer)
8985     error4 = 1;
8986   if (!anycapid && !anydv)
8987     error5 = 1;
8988   if (!anycapid && anyer && !anydv)
8989     error6 = 1;
8990   if (anyer && !anydv)
8991     error7 = 1;
8992   ///////////////////////////////////////Energy
8993   // Energy:
8994   double ampl = 0.;
8995   for (int ii = 0; ii < (*digiItr).size(); ii++) {
8996     double ampldefault = adc2fC[digiItr->sample(ii).adc()];
8997     ampl += ampldefault;  // fC
8998   }
8999   ///////////////////////////////////////Digis
9000   // Digis:
9001   // HO
9002   if (sub == 3) {
9003     h_errorGeneral_HO->Fill(double(errorGeneral), 1.);
9004     h_error1_HO->Fill(double(error1), 1.);
9005     h_error2_HO->Fill(double(error2), 1.);
9006     h_error3_HO->Fill(double(error3), 1.);
9007     h_error4_HO->Fill(double(error4), 1.);
9008     h_error5_HO->Fill(double(error5), 1.);
9009     h_error6_HO->Fill(double(error6), 1.);
9010     h_error7_HO->Fill(double(error7), 1.);
9011     h_repetedcapid_HO->Fill(double(repetedcapid), 1.);
9012 
9013     if (error1 != 0 || error2 != 0 || error3 != 0) {
9014       if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 0)
9015         ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9016       h_amplError_HO->Fill(ampl, 1.);
9017       if (mdepth == 4)
9018         h_mapDepth4Error_HO->Fill(double(ieta), double(iphi));
9019       // to be divided by h_mapDepth4_HO
9020 
9021       if (mdepth != 4)
9022         std::cout << " mdepth HO = " << mdepth << std::endl;
9023       h_fiber0_HO->Fill(double(ERRORfiber), 1.);
9024       h_fiber1_HO->Fill(double(ERRORfiberChan), 1.);
9025       h_fiber2_HO->Fill(double(ERRORfiberAndChan), 1.);
9026     } else {
9027       h_amplFine_HO->Fill(ampl, 1.);
9028     }
9029   }
9030 }
9031 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9032 void CMTRawAnalyzer::fillDigiAmplitude(HBHEDigiCollection::const_iterator& digiItr) {
9033   CaloSamples toolOriginal;  // TS
9034   double tool[100];
9035   double toolwithPedSubtr[100];        // TS
9036   double lintoolwithoutPedSubtr[100];  // TS
9037   HcalDetId cell(digiItr->id());
9038   int mdepth = cell.depth();
9039   int iphi = cell.iphi() - 1;  // 0-71
9040   int ieta0 = cell.ieta();     //-41 +41 !=0
9041   int ieta = ieta0;
9042   if (ieta > 0)
9043     ieta -= 1;              //-41 +41
9044   int sub = cell.subdet();  // 1-HB, 2-HE (HFDigiCollection: 4-HF)
9045   const HcalPedestal* pedestal00 = conditions->getPedestal(cell);
9046   const HcalGain* gain = conditions->getGain(cell);
9047   //    const HcalGainWidth* gainWidth = conditions->getGainWidth(cell);
9048   const HcalRespCorr* respcorr = conditions->getHcalRespCorr(cell);
9049   const HcalTimeCorr* timecorr = conditions->getHcalTimeCorr(cell);
9050   const HcalLUTCorr* lutcorr = conditions->getHcalLUTCorr(cell);
9051   //    HcalCalibrations calib = conditions->getHcalCalibrations(cell);
9052   const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
9053   const HcalPedestalWidth* pedw = conditions->getPedestalWidth(cell);
9054   HcalCoderDb coder(*channelCoder, *shape);
9055   if (useADCfC_)
9056     coder.adc2fC(*digiItr, toolOriginal);
9057   double pedestalaver9 = 0.;
9058   double pedestalaver4 = 0.;
9059   double pedestal0 = 0.;
9060   double pedestal1 = 0.;
9061   double pedestal2 = 0.;
9062   double pedestal3 = 0.;
9063   double pedestalwaver9 = 0.;
9064   double pedestalwaver4 = 0.;
9065   double pedestalw0 = 0.;
9066   double pedestalw1 = 0.;
9067   double pedestalw2 = 0.;
9068   double pedestalw3 = 0.;
9069   double difpedestal0 = 0.;
9070   double difpedestal1 = 0.;
9071   double difpedestal2 = 0.;
9072   double difpedestal3 = 0.;
9073 
9074   double amplitude = 0.;
9075   double absamplitude = 0.;
9076   double amplitude345 = 0.;
9077   double ampl = 0.;
9078   double linamplitudewithoutPedSubtr = 0.;
9079   double timew = 0.;
9080   double timeww = 0.;
9081   double max_signal = -100.;
9082   int ts_with_max_signal = -100;
9083   int c0 = 0;
9084   int c1 = 0;
9085   int c2 = 0;
9086   int c3 = 0;
9087   int c4 = 0;
9088   double errorBtype = 0.;
9089 
9090   int TSsize = 10;  //HEHB for Run2
9091   TSsize = digiItr->size();
9092   if ((*digiItr).size() != 10)
9093     errorBtype = 1.;
9094   //     ii = 0 to 9
9095   for (int ii = 0; ii < TSsize; ii++) {
9096     //  for (int ii=0; ii<digiItr->size(); ii++) {
9097     double ampldefaultwithPedSubtr = 0.;
9098     double linampldefaultwithoutPedSubtr = 0.;
9099     double ampldefault = 0.;
9100     double ampldefault0 = 0.;
9101     double ampldefault1 = 0.;
9102     double ampldefault2 = 0.;
9103     ampldefault0 = adc2fC[digiItr->sample(ii).adc()];  // massive ADCcounts
9104     if (useADCfC_)
9105       ampldefault1 = toolOriginal[ii];    //adcfC
9106     ampldefault2 = (*digiItr)[ii].adc();  //ADCcounts linearized
9107     if (useADCmassive_) {
9108       ampldefault = ampldefault0;
9109     }
9110     if (useADCfC_) {
9111       ampldefault = ampldefault1;
9112     }
9113     if (useADCcounts_) {
9114       ampldefault = ampldefault2;
9115     }
9116     ampldefaultwithPedSubtr = ampldefault0;
9117     linampldefaultwithoutPedSubtr = ampldefault2;
9118 
9119     int capid = ((*digiItr)[ii]).capid();
9120     //      double pedestal = calib.pedestal(capid);
9121     double pedestalINI = pedestal00->getValue(capid);
9122     double pedestal = pedestal00->getValue(capid);
9123     double pedestalw = pedw->getSigma(capid, capid);
9124     ampldefaultwithPedSubtr -= pedestal;  // pedestal subtraction
9125     if (usePedestalSubtraction_)
9126       ampldefault -= pedestal;  // pedestal subtraction
9127     //      ampldefault*= calib.respcorrgain(capid) ; // fC --> GeV
9128     tool[ii] = ampldefault;
9129     toolwithPedSubtr[ii] = ampldefaultwithPedSubtr;
9130     lintoolwithoutPedSubtr[ii] = linampldefaultwithoutPedSubtr;
9131 
9132     pedestalaver9 += pedestal;
9133     pedestalwaver9 += pedestalw * pedestalw;
9134 
9135     if (capid == 0 && c0 == 0) {
9136       c0++;
9137       c4++;
9138       pedestalaver4 += pedestal;
9139       pedestal0 = pedestal;
9140       pedestalw0 = pedestalw;
9141       pedestalwaver4 += pedestalw * pedestalw;
9142       difpedestal0 = pedestal - pedestalINI;
9143     }
9144 
9145     if (capid == 1 && c1 == 0) {
9146       c1++;
9147       c4++;
9148       pedestalaver4 += pedestal;
9149       pedestal1 = pedestal;
9150       pedestalw1 = pedestalw;
9151       pedestalwaver4 += pedestalw * pedestalw;
9152       difpedestal1 = pedestal - pedestalINI;
9153     }
9154     if (capid == 2 && c2 == 0) {
9155       c2++;
9156       c4++;
9157       pedestalaver4 += pedestal;
9158       pedestal2 = pedestal;
9159       pedestalw2 = pedestalw;
9160       pedestalwaver4 += pedestalw * pedestalw;
9161       difpedestal2 = pedestal - pedestalINI;
9162     }
9163     if (capid == 3 && c3 == 0) {
9164       c3++;
9165       c4++;
9166       pedestalaver4 += pedestal;
9167       pedestal3 = pedestal;
9168       pedestalw3 = pedestalw;
9169       pedestalwaver4 += pedestalw * pedestalw;
9170       difpedestal3 = pedestal - pedestalINI;
9171     }
9172 
9173     if (max_signal < ampldefault) {
9174       max_signal = ampldefault;
9175       ts_with_max_signal = ii;
9176     }
9177     ///   for choice TSs, raddam only:
9178     //     TS = 1 to 10:  1  2  3  4  5  6  7  8  9  10
9179     //     ii = 0 to  9:  0  1  2  3  4  5  6  7  8   9
9180     //     var.1             ----------------------
9181     //     var.2                ----------------
9182     //     var.3                   ----------
9183     //     var.4                   -------
9184     //
9185     // TS = 2-9      for raddam only  var.1
9186     // TS = 3-8      for raddam only  var.2
9187     // TS = 4-7      for raddam only  var.3
9188     // TS = 4-6      for raddam only  var.4
9189     amplitude += ampldefault;          //
9190     absamplitude += abs(ampldefault);  //
9191 
9192     if (ii == 3 || ii == 4 || ii == 5)
9193       amplitude345 += ampldefault;
9194     if (flagcpuoptimization_ == 0) {
9195       //////
9196     }  //flagcpuoptimization
9197     timew += (ii + 1) * abs(ampldefault);
9198     timeww += (ii + 1) * ampldefault;
9199   }  //for 1
9200   /////////////////////////////////////////////////////////////////////////////////////////////////////////    fillDigiAmplitude
9201   // sub=1||2 HBHE
9202   if (sub == 1 || sub == 2) {
9203     amplitudechannel0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;                 // 0-neta ; 0-71 HBHE
9204     amplitudechannel[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;           // 0-neta ; 0-71 HBHE
9205     amplitudechannel2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(amplitude, 2);  // 0-neta ; 0-71 HBHE
9206   }
9207   pedestalaver9 /= TSsize;
9208   pedestalaver4 /= c4;
9209   pedestalwaver9 = sqrt(pedestalwaver9 / TSsize);
9210   pedestalwaver4 = sqrt(pedestalwaver4 / c4);
9211   if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
9212     ampl = tool[ts_with_max_signal];
9213   if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
9214     ampl += tool[ts_with_max_signal + 2];
9215   if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
9216     ampl += tool[ts_with_max_signal + 1];
9217   if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
9218     ampl += tool[ts_with_max_signal - 1];
9219 
9220   ///----------------------------------------------------------------------------------------------------  for raddam:
9221   if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
9222     linamplitudewithoutPedSubtr = lintoolwithoutPedSubtr[ts_with_max_signal];
9223   if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
9224     linamplitudewithoutPedSubtr += lintoolwithoutPedSubtr[ts_with_max_signal + 2];
9225   if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
9226     linamplitudewithoutPedSubtr += lintoolwithoutPedSubtr[ts_with_max_signal + 1];
9227   if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
9228     linamplitudewithoutPedSubtr += lintoolwithoutPedSubtr[ts_with_max_signal - 1];
9229 
9230   double ratio = 0.;
9231   if (amplitude != 0.)
9232     ratio = ampl / amplitude;
9233   if (ratio < 0. || ratio > 1.02)
9234     ratio = 0.;
9235   double aveamplitude = 0.;
9236   double aveamplitudew = 0.;
9237   if (absamplitude > 0 && timew > 0)
9238     aveamplitude = timew / absamplitude;  // average_TS +1
9239   if (amplitude > 0 && timeww > 0)
9240     aveamplitudew = timeww / amplitude;  // average_TS +1
9241   double rmsamp = 0.;
9242   // and CapIdErrors:
9243   int error = 0;
9244   bool anycapid = true;
9245   bool anyer = false;
9246   bool anydv = true;
9247   int lastcapid = 0;
9248   int capid = 0;
9249   for (int ii = 0; ii < TSsize; ii++) {
9250     double aaaaaa = (ii + 1) - aveamplitudew;
9251     double aaaaaa2 = aaaaaa * aaaaaa;
9252     double ampldefault = tool[ii];
9253     rmsamp += (aaaaaa2 * ampldefault);  // fC
9254     capid = ((*digiItr)[ii]).capid();
9255     bool er = (*digiItr)[ii].er();  // error
9256     bool dv = (*digiItr)[ii].dv();  // valid data
9257     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
9258       anycapid = false;
9259     }
9260     //    std::cout << " ii = " << ii  << " capid = " << capid  << " ((lastcapid+1)%4) = " << ((lastcapid+1)%4)  << std::endl;
9261     lastcapid = capid;
9262     if (er) {
9263       anyer = true;
9264     }
9265     if (!dv) {
9266       anydv = false;
9267     }
9268   }  //for 2
9269   if (!anycapid || anyer || !anydv)
9270     error = 1;
9271 
9272   double rmsamplitude = 0.;
9273   if ((amplitude > 0 && rmsamp > 0) || (amplitude < 0 && rmsamp < 0))
9274     rmsamplitude = sqrt(rmsamp / amplitude);
9275   double aveamplitude1 = aveamplitude - 1;  // means iTS=0-9
9276 
9277   // CapIdErrors end  /////////////////////////////////////////////////////////
9278 
9279   // AZ 1.10.2015:
9280   if (error == 1) {
9281     if (sub == 1 && mdepth == 1)
9282       h_Amplitude_forCapIdErrors_HB1->Fill(amplitude, 1.);
9283     if (sub == 1 && mdepth == 2)
9284       h_Amplitude_forCapIdErrors_HB2->Fill(amplitude, 1.);
9285     if (sub == 2 && mdepth == 1)
9286       h_Amplitude_forCapIdErrors_HE1->Fill(amplitude, 1.);
9287     if (sub == 2 && mdepth == 2)
9288       h_Amplitude_forCapIdErrors_HE2->Fill(amplitude, 1.);
9289     if (sub == 2 && mdepth == 3)
9290       h_Amplitude_forCapIdErrors_HE3->Fill(amplitude, 1.);
9291   }
9292   if (error != 1) {
9293     if (sub == 1 && mdepth == 1)
9294       h_Amplitude_notCapIdErrors_HB1->Fill(amplitude, 1.);
9295     if (sub == 1 && mdepth == 2)
9296       h_Amplitude_notCapIdErrors_HB2->Fill(amplitude, 1.);
9297     if (sub == 2 && mdepth == 1)
9298       h_Amplitude_notCapIdErrors_HE1->Fill(amplitude, 1.);
9299     if (sub == 2 && mdepth == 2)
9300       h_Amplitude_notCapIdErrors_HE2->Fill(amplitude, 1.);
9301     if (sub == 2 && mdepth == 3)
9302       h_Amplitude_notCapIdErrors_HE3->Fill(amplitude, 1.);
9303   }
9304 
9305   for (int ii = 0; ii < TSsize; ii++) {
9306     //  for (int ii=0; ii<10; ii++) {
9307     double ampldefault = tool[ii];
9308     ///
9309     if (sub == 1) {
9310       if (amplitude > 120) {
9311         h_shape_Ahigh_HB0->Fill(float(ii), ampldefault);
9312         h_shape0_Ahigh_HB0->Fill(float(ii), 1.);
9313       } else {
9314         h_shape_Alow_HB0->Fill(float(ii), ampldefault);
9315         h_shape0_Alow_HB0->Fill(float(ii), 1.);
9316       }  //HB0
9317       ///
9318       if (pedestal2 < pedestalHBMax_ || pedestal3 < pedestalHBMax_ || pedestal2 < pedestalHBMax_ ||
9319           pedestal3 < pedestalHBMax_) {
9320         h_shape_Ahigh_HB1->Fill(float(ii), ampldefault);
9321         h_shape0_Ahigh_HB1->Fill(float(ii), 1.);
9322       } else {
9323         h_shape_Alow_HB1->Fill(float(ii), ampldefault);
9324         h_shape0_Alow_HB1->Fill(float(ii), 1.);
9325       }  //HB1
9326       if (error == 0) {
9327         h_shape_Ahigh_HB2->Fill(float(ii), ampldefault);
9328         h_shape0_Ahigh_HB2->Fill(float(ii), 1.);
9329       } else {
9330         h_shape_Alow_HB2->Fill(float(ii), ampldefault);
9331         h_shape0_Alow_HB2->Fill(float(ii), 1.);
9332       }  //HB2
9333       ///
9334       if (pedestalw0 < pedestalwHBMax_ || pedestalw1 < pedestalwHBMax_ || pedestalw2 < pedestalwHBMax_ ||
9335           pedestalw3 < pedestalwHBMax_) {
9336         h_shape_Ahigh_HB3->Fill(float(ii), ampldefault);
9337         h_shape0_Ahigh_HB3->Fill(float(ii), 1.);
9338       } else {
9339         h_shape_Alow_HB3->Fill(float(ii), ampldefault);
9340         h_shape0_Alow_HB3->Fill(float(ii), 1.);
9341       }  //HB3
9342 
9343     }  // sub   HB
9344 
9345   }  //for 3 over TSs
9346 
9347   if (sub == 1) {
9348     // bad_channels with C,A,W,P,pW,
9349     if (error == 1 || amplitude < ADCAmplHBMin_ || amplitude > ADCAmplHBMax_ || rmsamplitude < rmsHBMin_ ||
9350         rmsamplitude > rmsHBMax_ || pedestal0 < pedestalHBMax_ || pedestal1 < pedestalHBMax_ ||
9351         pedestal2 < pedestalHBMax_ || pedestal3 < pedestalHBMax_ || pedestalw0 < pedestalwHBMax_ ||
9352         pedestalw1 < pedestalwHBMax_ || pedestalw2 < pedestalwHBMax_ || pedestalw3 < pedestalwHBMax_) {
9353       for (int ii = 0; ii < TSsize; ii++) {
9354         double ampldefault = tool[ii];
9355         h_shape_bad_channels_HB->Fill(float(ii), ampldefault);
9356         h_shape0_bad_channels_HB->Fill(float(ii), 1.);
9357       }
9358     }
9359     // good_channels with C,A,W,P,pW
9360     else {
9361       for (int ii = 0; ii < TSsize; ii++) {
9362         double ampldefault = tool[ii];
9363         h_shape_good_channels_HB->Fill(float(ii), ampldefault);
9364         h_shape0_good_channels_HB->Fill(float(ii), 1.);
9365       }
9366     }
9367   }  // sub   HB
9368   if (sub == 2) {
9369     // bad_channels with C,A,W,P,pW,
9370     if (error == 1 || amplitude < ADCAmplHEMin_ || amplitude > ADCAmplHEMax_ || rmsamplitude < rmsHEMin_ ||
9371         rmsamplitude > rmsHEMax_ || pedestal0 < pedestalHEMax_ || pedestal1 < pedestalHEMax_ ||
9372         pedestal2 < pedestalHEMax_ || pedestal3 < pedestalHEMax_ || pedestalw0 < pedestalwHEMax_ ||
9373         pedestalw1 < pedestalwHEMax_ || pedestalw2 < pedestalwHEMax_ || pedestalw3 < pedestalwHEMax_) {
9374       for (int ii = 0; ii < TSsize; ii++) {
9375         double ampldefault = tool[ii];
9376         h_shape_bad_channels_HE->Fill(float(ii), ampldefault);
9377         h_shape0_bad_channels_HE->Fill(float(ii), 1.);
9378       }
9379     }
9380     // good_channels with C,A,W,P,pW,
9381     else {
9382       for (int ii = 0; ii < TSsize; ii++) {
9383         double ampldefault = tool[ii];
9384         h_shape_good_channels_HE->Fill(float(ii), ampldefault);
9385         h_shape0_good_channels_HE->Fill(float(ii), 1.);
9386       }
9387     }
9388   }  // sub   HE
9389 
9390   ///////////////////////////////////////Digis : over all digiHits
9391   sum0Estimator[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
9392   //      for Error B-type
9393   sumEstimator6[sub - 1][mdepth - 1][ieta + 41][iphi] += errorBtype;
9394   sumEstimator0[sub - 1][mdepth - 1][ieta + 41][iphi] += pedestal0;  //Pedestals
9395   // HB
9396   if (sub == 1) {
9397     if (studyPedestalCorrelations_) {
9398       //   //   //   //   //   //   //   //   //  HB       PedestalCorrelations :
9399       double mypedestal = pedestal0;
9400       double mypedestalw = pedestalw0;
9401       h2_pedvsampl_HB->Fill(mypedestal, amplitude);
9402       h2_pedwvsampl_HB->Fill(mypedestalw, amplitude);
9403       h_pedvsampl_HB->Fill(mypedestal, amplitude);
9404       h_pedwvsampl_HB->Fill(mypedestalw, amplitude);
9405       h_pedvsampl0_HB->Fill(mypedestal, 1.);
9406       h_pedwvsampl0_HB->Fill(mypedestalw, 1.);
9407 
9408       h2_amplvsped_HB->Fill(amplitude, mypedestal);
9409       h2_amplvspedw_HB->Fill(amplitude, mypedestalw);
9410       h_amplvsped_HB->Fill(amplitude, mypedestal);
9411       h_amplvspedw_HB->Fill(amplitude, mypedestalw);
9412       h_amplvsped0_HB->Fill(amplitude, 1.);
9413     }  //
9414     //   //   //   //   //   //   //   //   //  HB       Pedestals:
9415     if (studyPedestalsHist_) {
9416       h_pedestal0_HB->Fill(pedestal0, 1.);
9417       h_pedestal1_HB->Fill(pedestal1, 1.);
9418       h_pedestal2_HB->Fill(pedestal2, 1.);
9419       h_pedestal3_HB->Fill(pedestal3, 1.);
9420       h_pedestalaver4_HB->Fill(pedestalaver4, 1.);
9421       h_pedestalaver9_HB->Fill(pedestalaver9, 1.);
9422       h_pedestalw0_HB->Fill(pedestalw0, 1.);
9423       h_pedestalw1_HB->Fill(pedestalw1, 1.);
9424       h_pedestalw2_HB->Fill(pedestalw2, 1.);
9425       h_pedestalw3_HB->Fill(pedestalw3, 1.);
9426       h_pedestalwaver4_HB->Fill(pedestalwaver4, 1.);
9427       h_pedestalwaver9_HB->Fill(pedestalwaver9, 1.);
9428       // for averaged values:
9429       if (mdepth == 1) {
9430         h_mapDepth1Ped0_HB->Fill(double(ieta), double(iphi), pedestal0);
9431         h_mapDepth1Ped1_HB->Fill(double(ieta), double(iphi), pedestal1);
9432         h_mapDepth1Ped2_HB->Fill(double(ieta), double(iphi), pedestal2);
9433         h_mapDepth1Ped3_HB->Fill(double(ieta), double(iphi), pedestal3);
9434         h_mapDepth1Pedw0_HB->Fill(double(ieta), double(iphi), pedestalw0);
9435         h_mapDepth1Pedw1_HB->Fill(double(ieta), double(iphi), pedestalw1);
9436         h_mapDepth1Pedw2_HB->Fill(double(ieta), double(iphi), pedestalw2);
9437         h_mapDepth1Pedw3_HB->Fill(double(ieta), double(iphi), pedestalw3);
9438       }
9439       if (mdepth == 2) {
9440         h_mapDepth2Ped0_HB->Fill(double(ieta), double(iphi), pedestal0);
9441         h_mapDepth2Ped1_HB->Fill(double(ieta), double(iphi), pedestal1);
9442         h_mapDepth2Ped2_HB->Fill(double(ieta), double(iphi), pedestal2);
9443         h_mapDepth2Ped3_HB->Fill(double(ieta), double(iphi), pedestal3);
9444         h_mapDepth2Pedw0_HB->Fill(double(ieta), double(iphi), pedestalw0);
9445         h_mapDepth2Pedw1_HB->Fill(double(ieta), double(iphi), pedestalw1);
9446         h_mapDepth2Pedw2_HB->Fill(double(ieta), double(iphi), pedestalw2);
9447         h_mapDepth2Pedw3_HB->Fill(double(ieta), double(iphi), pedestalw3);
9448       }
9449       if (pedestalw0 < pedestalwHBMax_ || pedestalw1 < pedestalwHBMax_ || pedestalw2 < pedestalwHBMax_ ||
9450           pedestalw3 < pedestalwHBMax_) {
9451         if (mdepth == 1)
9452           h_mapDepth1pedestalw_HB->Fill(double(ieta), double(iphi), 1.);
9453         if (mdepth == 2)
9454           h_mapDepth2pedestalw_HB->Fill(double(ieta), double(iphi), 1.);
9455         if (mdepth == 3)
9456           h_mapDepth3pedestalw_HB->Fill(double(ieta), double(iphi), 1.);
9457         if (mdepth == 4)
9458           h_mapDepth4pedestalw_HB->Fill(double(ieta), double(iphi), 1.);
9459       }
9460       if (pedestal0 < pedestalHBMax_ || pedestal1 < pedestalHBMax_ || pedestal2 < pedestalHBMax_ ||
9461           pedestal3 < pedestalHBMax_) {
9462         if (mdepth == 1)
9463           h_mapDepth1pedestal_HB->Fill(double(ieta), double(iphi), 1.);
9464         if (mdepth == 2)
9465           h_mapDepth2pedestal_HB->Fill(double(ieta), double(iphi), 1.);
9466         if (mdepth == 3)
9467           h_mapDepth3pedestal_HB->Fill(double(ieta), double(iphi), 1.);
9468         if (mdepth == 4)
9469           h_mapDepth4pedestal_HB->Fill(double(ieta), double(iphi), 1.);
9470       }
9471       for (int ii = 0; ii < TSsize; ii++) {
9472         h_pedestal00_HB->Fill(pedestal00->getValue(ii), 1.);
9473         h_gain_HB->Fill(gain->getValue(ii), 1.);
9474       }
9475       h_respcorr_HB->Fill(respcorr->getValue(), 1.);
9476       h_timecorr_HB->Fill(timecorr->getValue(), 1.);
9477       h_lutcorr_HB->Fill(lutcorr->getValue(), 1.);
9478       h_difpedestal0_HB->Fill(difpedestal0, 1.);
9479       h_difpedestal1_HB->Fill(difpedestal1, 1.);
9480       h_difpedestal2_HB->Fill(difpedestal2, 1.);
9481       h_difpedestal3_HB->Fill(difpedestal3, 1.);
9482     }  //
9483     //   //   //   //   //   //   //   //   //  HB       ADCAmpl:
9484     if (studyADCAmplHist_) {
9485       h_ADCAmpl345Zoom_HB->Fill(amplitude345, 1.);
9486       h_ADCAmpl345Zoom1_HB->Fill(amplitude345, 1.);
9487       h_ADCAmpl345_HB->Fill(amplitude345, 1.);
9488       if (error == 0) {
9489         h_ADCAmpl_HBCapIdNoError->Fill(amplitude, 1.);
9490         h_ADCAmpl345_HBCapIdNoError->Fill(amplitude345, 1.);
9491       }
9492       if (error == 1) {
9493         h_ADCAmpl_HBCapIdError->Fill(amplitude, 1.);
9494         h_ADCAmpl345_HBCapIdError->Fill(amplitude345, 1.);
9495       }
9496       h_ADCAmplZoom_HB->Fill(amplitude, 1.);
9497       h_ADCAmplZoom1_HB->Fill(amplitude, 1.);
9498       h_ADCAmpl_HB->Fill(amplitude, 1.);
9499 
9500       h_AmplitudeHBrest->Fill(amplitude, 1.);
9501       h_AmplitudeHBrest1->Fill(amplitude, 1.);
9502       h_AmplitudeHBrest6->Fill(amplitude, 1.);
9503 
9504       if (amplitude < ADCAmplHBMin_ || amplitude > ADCAmplHBMax_) {
9505         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 5)
9506           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9507         if (mdepth == 1)
9508           h_mapDepth1ADCAmpl225_HB->Fill(double(ieta), double(iphi), 1.);
9509         if (mdepth == 2)
9510           h_mapDepth2ADCAmpl225_HB->Fill(double(ieta), double(iphi), 1.);
9511       }  // if
9512       //    if(amplitude >400.) averSIGNALoccupancy_HB += 1.;
9513       if (amplitude < 35.) {
9514         if (mdepth == 1)
9515           h_mapDepth1ADCAmpl225Copy_HB->Fill(double(ieta), double(iphi), 1.);
9516         if (mdepth == 2)
9517           h_mapDepth2ADCAmpl225Copy_HB->Fill(double(ieta), double(iphi), 1.);
9518       }  // if
9519       // for averaged values:
9520       if (mdepth == 1)
9521         h_mapDepth1ADCAmpl_HB->Fill(double(ieta), double(iphi), amplitude);
9522       if (mdepth == 2)
9523         h_mapDepth2ADCAmpl_HB->Fill(double(ieta), double(iphi), amplitude);
9524       if (mdepth == 1)
9525         h_mapDepth1ADCAmpl12_HB->Fill(double(ieta), double(iphi), ampl);
9526       if (mdepth == 2)
9527         h_mapDepth2ADCAmpl12_HB->Fill(double(ieta), double(iphi), ampl);
9528       h_bcnvsamplitude_HB->Fill(float(bcn), amplitude);
9529       h_bcnvsamplitude0_HB->Fill(float(bcn), 1.);
9530       h_orbitNumvsamplitude_HB->Fill(float(orbitNum), amplitude);
9531       h_orbitNumvsamplitude0_HB->Fill(float(orbitNum), 1.);
9532       if (amplitude > forallestimators_amplitude_bigger_)
9533         sumEstimator1[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;
9534     }  //if(studyADCAmplHist_
9535     ///////////////////////////////
9536 
9537     //   //   //   //   //   //   //   //   //  HB       TSmean:
9538     if (studyTSmeanShapeHist_) {
9539       h_TSmeanA_HB->Fill(aveamplitude1, 1.);
9540       //      h2_TSnVsAyear2023_HB->Fill(25.*aveamplitude1, amplitude);
9541       h2_TSnVsAyear2023_HB->Fill(amplitude, 25. * aveamplitude1);
9542       h1_TSnVsAyear2023_HB->Fill(amplitude, 25. * aveamplitude1);
9543       h1_TSnVsAyear20230_HB->Fill(amplitude, 1.);
9544       if (aveamplitude1 < TSmeanHBMin_ || aveamplitude1 > TSmeanHBMax_) {
9545         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 4)
9546           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9547         if (mdepth == 1)
9548           h_mapDepth1TSmeanA225_HB->Fill(double(ieta), double(iphi), 1.);
9549         if (mdepth == 2)
9550           h_mapDepth2TSmeanA225_HB->Fill(double(ieta), double(iphi), 1.);
9551       }  // if
9552       // for averaged values:
9553       if (mdepth == 1)
9554         h_mapDepth1TSmeanA_HB->Fill(double(ieta), double(iphi), aveamplitude1);
9555       if (mdepth == 2)
9556         h_mapDepth2TSmeanA_HB->Fill(double(ieta), double(iphi), aveamplitude1);
9557       if (amplitude > forallestimators_amplitude_bigger_)
9558         sumEstimator2[sub - 1][mdepth - 1][ieta + 41][iphi] += aveamplitude1;
9559     }  //if(studyTSmeanShapeHist_
9560     ///////////////////////////////
9561 
9562     //   //   //   //   //   //   //   //   //  HB       TSmax:
9563     if (studyTSmaxShapeHist_) {
9564       h_TSmaxA_HB->Fill(float(ts_with_max_signal), 1.);
9565       if (ts_with_max_signal < TSpeakHBMin_ || ts_with_max_signal > TSpeakHBMax_) {
9566         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 3)
9567           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9568         if (mdepth == 1)
9569           h_mapDepth1TSmaxA225_HB->Fill(double(ieta), double(iphi), 1.);
9570         if (mdepth == 2)
9571           h_mapDepth2TSmaxA225_HB->Fill(double(ieta), double(iphi), 1.);
9572       }  // if
9573       // for averaged values:
9574       if (mdepth == 1)
9575         h_mapDepth1TSmaxA_HB->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
9576       if (mdepth == 2)
9577         h_mapDepth2TSmaxA_HB->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
9578       if (amplitude > forallestimators_amplitude_bigger_)
9579         sumEstimator3[sub - 1][mdepth - 1][ieta + 41][iphi] += float(ts_with_max_signal);
9580     }  //if(studyTSmaxShapeHist_
9581     ///////////////////////////////
9582 
9583     //   //   //   //   //   //   //   //   //  HB       RMS:
9584     if (studyRMSshapeHist_) {
9585       h_Amplitude_HB->Fill(rmsamplitude, 1.);
9586       if (rmsamplitude < rmsHBMin_ || rmsamplitude > rmsHBMax_) {
9587         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 2)
9588           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9589         if (mdepth == 1)
9590           h_mapDepth1Amplitude225_HB->Fill(double(ieta), double(iphi), 1.);
9591         if (mdepth == 2)
9592           h_mapDepth2Amplitude225_HB->Fill(double(ieta), double(iphi), 1.);
9593       }  // if
9594       // for averaged values:
9595       if (mdepth == 1)
9596         h_mapDepth1Amplitude_HB->Fill(double(ieta), double(iphi), rmsamplitude);
9597       if (mdepth == 2)
9598         h_mapDepth2Amplitude_HB->Fill(double(ieta), double(iphi), rmsamplitude);
9599       if (amplitude > forallestimators_amplitude_bigger_)
9600         sumEstimator4[sub - 1][mdepth - 1][ieta + 41][iphi] += rmsamplitude;
9601     }  //if(studyRMSshapeHist_)
9602     ///////////////////////////////
9603 
9604     //   //   //   //   //   //   //   //   //  HB       Ratio:
9605     if (studyRatioShapeHist_) {
9606       h_Ampl_HB->Fill(ratio, 1.);
9607       if (ratio < ratioHBMin_ || ratio > ratioHBMax_) {
9608         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 1)
9609           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9610         if (mdepth == 1)
9611           h_mapDepth1Ampl047_HB->Fill(double(ieta), double(iphi), 1.);
9612         if (mdepth == 2)
9613           h_mapDepth2Ampl047_HB->Fill(double(ieta), double(iphi), 1.);
9614         // //
9615       }  //if(ratio
9616       // for averaged values:
9617       if (mdepth == 1)
9618         h_mapDepth1Ampl_HB->Fill(double(ieta), double(iphi), ratio);
9619       if (mdepth == 2)
9620         h_mapDepth2Ampl_HB->Fill(double(ieta), double(iphi), ratio);
9621       if (amplitude > forallestimators_amplitude_bigger_)
9622         sumEstimator5[sub - 1][mdepth - 1][ieta + 41][iphi] += ratio;
9623     }  //if(studyRatioShapeHist_)
9624     ///////////////////////////////
9625 
9626     //   //   //   //   //   //   //   //   //  HB      DiffAmplitude:
9627     if (studyDiffAmplHist_) {
9628       if (mdepth == 1)
9629         h_mapDepth1AmplE34_HB->Fill(double(ieta), double(iphi), amplitude);
9630       if (mdepth == 2)
9631         h_mapDepth2AmplE34_HB->Fill(double(ieta), double(iphi), amplitude);
9632     }  // if(studyDiffAmplHist_)
9633 
9634     ///////////////////////////////    for HB All
9635     if (mdepth == 1)
9636       h_mapDepth1_HB->Fill(double(ieta), double(iphi), 1.);
9637     if (mdepth == 2)
9638       h_mapDepth2_HB->Fill(double(ieta), double(iphi), 1.);
9639   }  //if ( sub == 1 )
9640 
9641   // HE
9642   if (sub == 2) {
9643     //   //   //   //   //   //   //   //   //  HE       PedestalCorrelations :
9644     if (studyPedestalCorrelations_) {
9645       double mypedestal = pedestal0;
9646       double mypedestalw = pedestalw0;
9647       h2_pedvsampl_HE->Fill(mypedestal, amplitude);
9648       h2_pedwvsampl_HE->Fill(mypedestalw, amplitude);
9649       h_pedvsampl_HE->Fill(mypedestal, amplitude);
9650       h_pedwvsampl_HE->Fill(mypedestalw, amplitude);
9651       h_pedvsampl0_HE->Fill(mypedestal, 1.);
9652       h_pedwvsampl0_HE->Fill(mypedestalw, 1.);
9653     }  //
9654     //   //   //   //   //   //   //   //   //  HE       Pedestals:
9655     if (studyPedestalsHist_) {
9656       h_pedestal0_HE->Fill(pedestal0, 1.);
9657       h_pedestal1_HE->Fill(pedestal1, 1.);
9658       h_pedestal2_HE->Fill(pedestal2, 1.);
9659       h_pedestal3_HE->Fill(pedestal3, 1.);
9660       h_pedestalaver4_HE->Fill(pedestalaver4, 1.);
9661       h_pedestalaver9_HE->Fill(pedestalaver9, 1.);
9662       h_pedestalw0_HE->Fill(pedestalw0, 1.);
9663       h_pedestalw1_HE->Fill(pedestalw1, 1.);
9664       h_pedestalw2_HE->Fill(pedestalw2, 1.);
9665       h_pedestalw3_HE->Fill(pedestalw3, 1.);
9666       h_pedestalwaver4_HE->Fill(pedestalwaver4, 1.);
9667       h_pedestalwaver9_HE->Fill(pedestalwaver9, 1.);
9668       // for averaged values:
9669       if (mdepth == 1) {
9670         h_mapDepth1Ped0_HE->Fill(double(ieta), double(iphi), pedestal0);
9671         h_mapDepth1Ped1_HE->Fill(double(ieta), double(iphi), pedestal1);
9672         h_mapDepth1Ped2_HE->Fill(double(ieta), double(iphi), pedestal2);
9673         h_mapDepth1Ped3_HE->Fill(double(ieta), double(iphi), pedestal3);
9674         h_mapDepth1Pedw0_HE->Fill(double(ieta), double(iphi), pedestalw0);
9675         h_mapDepth1Pedw1_HE->Fill(double(ieta), double(iphi), pedestalw1);
9676         h_mapDepth1Pedw2_HE->Fill(double(ieta), double(iphi), pedestalw2);
9677         h_mapDepth1Pedw3_HE->Fill(double(ieta), double(iphi), pedestalw3);
9678       }
9679       if (mdepth == 2) {
9680         h_mapDepth2Ped0_HE->Fill(double(ieta), double(iphi), pedestal0);
9681         h_mapDepth2Ped1_HE->Fill(double(ieta), double(iphi), pedestal1);
9682         h_mapDepth2Ped2_HE->Fill(double(ieta), double(iphi), pedestal2);
9683         h_mapDepth2Ped3_HE->Fill(double(ieta), double(iphi), pedestal3);
9684         h_mapDepth2Pedw0_HE->Fill(double(ieta), double(iphi), pedestalw0);
9685         h_mapDepth2Pedw1_HE->Fill(double(ieta), double(iphi), pedestalw1);
9686         h_mapDepth2Pedw2_HE->Fill(double(ieta), double(iphi), pedestalw2);
9687         h_mapDepth2Pedw3_HE->Fill(double(ieta), double(iphi), pedestalw3);
9688       }
9689       if (mdepth == 3) {
9690         h_mapDepth3Ped0_HE->Fill(double(ieta), double(iphi), pedestal0);
9691         h_mapDepth3Ped1_HE->Fill(double(ieta), double(iphi), pedestal1);
9692         h_mapDepth3Ped2_HE->Fill(double(ieta), double(iphi), pedestal2);
9693         h_mapDepth3Ped3_HE->Fill(double(ieta), double(iphi), pedestal3);
9694         h_mapDepth3Pedw0_HE->Fill(double(ieta), double(iphi), pedestalw0);
9695         h_mapDepth3Pedw1_HE->Fill(double(ieta), double(iphi), pedestalw1);
9696         h_mapDepth3Pedw2_HE->Fill(double(ieta), double(iphi), pedestalw2);
9697         h_mapDepth3Pedw3_HE->Fill(double(ieta), double(iphi), pedestalw3);
9698       }
9699       if (pedestalw0 < pedestalwHEMax_ || pedestalw1 < pedestalwHEMax_ || pedestalw2 < pedestalwHEMax_ ||
9700           pedestalw3 < pedestalwHEMax_) {
9701         if (mdepth == 1)
9702           h_mapDepth1pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
9703         if (mdepth == 2)
9704           h_mapDepth2pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
9705         if (mdepth == 3)
9706           h_mapDepth3pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
9707       }
9708       if (pedestal0 < pedestalHEMax_ || pedestal1 < pedestalHEMax_ || pedestal2 < pedestalHEMax_ ||
9709           pedestal3 < pedestalHEMax_) {
9710         if (mdepth == 1)
9711           h_mapDepth1pedestal_HE->Fill(double(ieta), double(iphi), 1.);
9712         if (mdepth == 2)
9713           h_mapDepth2pedestal_HE->Fill(double(ieta), double(iphi), 1.);
9714         if (mdepth == 3)
9715           h_mapDepth3pedestal_HE->Fill(double(ieta), double(iphi), 1.);
9716       }
9717       for (int ii = 0; ii < TSsize; ii++) {
9718         h_pedestal00_HE->Fill(pedestal00->getValue(ii), 1.);
9719         h_gain_HE->Fill(gain->getValue(ii), 1.);
9720       }
9721       h_respcorr_HE->Fill(respcorr->getValue(), 1.);
9722       h_timecorr_HE->Fill(timecorr->getValue(), 1.);
9723       h_lutcorr_HE->Fill(lutcorr->getValue(), 1.);
9724     }  //
9725 
9726     //     h_mapDepth1ADCAmpl12SiPM_HE
9727     //   //   //   //   //   //   //   //   //  HE       ADCAmpl:
9728     if (studyADCAmplHist_) {
9729       h_ADCAmpl345Zoom_HE->Fill(ampl, 1.);
9730       h_ADCAmpl345Zoom1_HE->Fill(amplitude345, 1.);
9731       h_ADCAmpl345_HE->Fill(amplitude345, 1.);
9732       h_ADCAmpl_HE->Fill(amplitude, 1.);
9733 
9734       h_ADCAmplrest_HE->Fill(amplitude, 1.);
9735       h_ADCAmplrest1_HE->Fill(amplitude, 1.);
9736       h_ADCAmplrest6_HE->Fill(amplitude, 1.);
9737 
9738       h_ADCAmplZoom1_HE->Fill(amplitude, 1.);
9739       if (amplitude < ADCAmplHEMin_ || amplitude > ADCAmplHEMax_) {
9740         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 5)
9741           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9742         if (mdepth == 1)
9743           h_mapDepth1ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
9744         if (mdepth == 2)
9745           h_mapDepth2ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
9746         if (mdepth == 3)
9747           h_mapDepth3ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
9748       }  // if
9749       //    if(amplitude > 700.) averSIGNALoccupancy_HE += 1.;
9750       if (amplitude < 500.) {
9751         if (mdepth == 1)
9752           h_mapDepth1ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
9753         if (mdepth == 2)
9754           h_mapDepth2ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
9755         if (mdepth == 3)
9756           h_mapDepth3ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
9757       }  // if
9758       // for averaged values:
9759       if (mdepth == 1)
9760         h_mapDepth1ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
9761       if (mdepth == 2)
9762         h_mapDepth2ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
9763       if (mdepth == 3)
9764         h_mapDepth3ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
9765 
9766       if (mdepth == 1) {
9767         h_mapDepth1ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
9768         h_mapDepth1linADCAmpl12_HE->Fill(double(ieta), double(iphi), linamplitudewithoutPedSubtr);
9769       }
9770       if (mdepth == 2) {
9771         h_mapDepth2ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
9772         h_mapDepth2linADCAmpl12_HE->Fill(double(ieta), double(iphi), linamplitudewithoutPedSubtr);
9773       }
9774       if (mdepth == 3) {
9775         h_mapDepth3ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
9776         h_mapDepth3linADCAmpl12_HE->Fill(double(ieta), double(iphi), linamplitudewithoutPedSubtr);
9777       }
9778 
9779       ///////////////////////////////////////////////////////////////////////////////   //AZ: 21.09.2018 for Pavel Bunin:
9780       ///////////////////////////////////////////////////////////////////////////////   //AZ: 25.10.2018 for Pavel Bunin: gain stability vs LSs using LED from abort gap
9781       h_bcnvsamplitude_HE->Fill(float(bcn), amplitude);
9782       h_bcnvsamplitude0_HE->Fill(float(bcn), 1.);
9783       h_orbitNumvsamplitude_HE->Fill(float(orbitNum), amplitude);
9784       h_orbitNumvsamplitude0_HE->Fill(float(orbitNum), 1.);
9785 
9786       ////////////////////////////////////////////////////////////////////////////////////////////////////////////
9787 
9788       if (amplitude > forallestimators_amplitude_bigger_)
9789         sumEstimator1[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;
9790 
9791     }  //if(studyADCAmplHist_
9792     ///////////////////////////////
9793     //   //   //   //   //   //   //   //   //  HE       TSmean:
9794     if (studyTSmeanShapeHist_) {
9795       h_TSmeanA_HE->Fill(aveamplitude1, 1.);
9796       //      h2_TSnVsAyear2023_HE->Fill(25.*aveamplitude1, amplitude);
9797       h2_TSnVsAyear2023_HE->Fill(amplitude, 25. * aveamplitude1);
9798       h1_TSnVsAyear2023_HE->Fill(amplitude, 25. * aveamplitude1);
9799       h1_TSnVsAyear20230_HE->Fill(amplitude, 1.);
9800       if (aveamplitude1 < TSmeanHEMin_ || aveamplitude1 > TSmeanHEMax_) {
9801         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 4)
9802           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9803         if (mdepth == 1)
9804           h_mapDepth1TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
9805         if (mdepth == 2)
9806           h_mapDepth2TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
9807         if (mdepth == 3)
9808           h_mapDepth3TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
9809       }  // if
9810       // for averaged values:
9811       if (mdepth == 1)
9812         h_mapDepth1TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
9813       if (mdepth == 2)
9814         h_mapDepth2TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
9815       if (mdepth == 3)
9816         h_mapDepth3TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
9817       if (amplitude > forallestimators_amplitude_bigger_)
9818         sumEstimator2[sub - 1][mdepth - 1][ieta + 41][iphi] += aveamplitude1;
9819     }  //if(studyTSmeanShapeHist_) {
9820     ///////////////////////////////
9821     //   //   //   //   //   //   //   //   //  HE       TSmax:
9822     if (studyTSmaxShapeHist_) {
9823       h_TSmaxA_HE->Fill(float(ts_with_max_signal), 1.);
9824       if (ts_with_max_signal < TSpeakHEMin_ || ts_with_max_signal > TSpeakHEMax_) {
9825         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 3)
9826           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9827         if (mdepth == 1)
9828           h_mapDepth1TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
9829         if (mdepth == 2)
9830           h_mapDepth2TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
9831         if (mdepth == 3)
9832           h_mapDepth3TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
9833       }  // if
9834       // for averaged values:
9835       if (mdepth == 1)
9836         h_mapDepth1TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
9837       if (mdepth == 2)
9838         h_mapDepth2TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
9839       if (mdepth == 3)
9840         h_mapDepth3TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
9841       if (amplitude > forallestimators_amplitude_bigger_)
9842         sumEstimator3[sub - 1][mdepth - 1][ieta + 41][iphi] += float(ts_with_max_signal);
9843     }  //if(studyTSmaxShapeHist_) {
9844     ///////////////////////////////
9845     //   //   //   //   //   //   //   //   //  HE       RMS:
9846     if (studyRMSshapeHist_) {
9847       h_Amplitude_HE->Fill(rmsamplitude, 1.);
9848       if (rmsamplitude < rmsHEMin_ || rmsamplitude > rmsHEMax_) {
9849         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 2)
9850           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9851         if (mdepth == 1)
9852           h_mapDepth1Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
9853         if (mdepth == 2)
9854           h_mapDepth2Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
9855         if (mdepth == 3)
9856           h_mapDepth3Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
9857       }
9858       // for averaged values:
9859       if (mdepth == 1)
9860         h_mapDepth1Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
9861       if (mdepth == 2)
9862         h_mapDepth2Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
9863       if (mdepth == 3)
9864         h_mapDepth3Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
9865       if (amplitude > forallestimators_amplitude_bigger_)
9866         sumEstimator4[sub - 1][mdepth - 1][ieta + 41][iphi] += rmsamplitude;
9867     }  //if(studyRMSshapeHist_)
9868     ///////////////////////////////
9869 
9870     //   //   //   //   //   //   //   //   //  HE       Ratio:
9871     if (studyRatioShapeHist_) {
9872       h_Ampl_HE->Fill(ratio, 1.);
9873       if (ratio < ratioHEMin_ || ratio > ratioHEMax_) {
9874         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 1)
9875           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
9876         if (mdepth == 1)
9877           h_mapDepth1Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
9878         if (mdepth == 2)
9879           h_mapDepth2Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
9880         if (mdepth == 3)
9881           h_mapDepth3Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
9882       }
9883       // for averaged values:
9884       if (mdepth == 1)
9885         h_mapDepth1Ampl_HE->Fill(double(ieta), double(iphi), ratio);
9886       if (mdepth == 2)
9887         h_mapDepth2Ampl_HE->Fill(double(ieta), double(iphi), ratio);
9888       if (mdepth == 3)
9889         h_mapDepth3Ampl_HE->Fill(double(ieta), double(iphi), ratio);
9890       if (amplitude > forallestimators_amplitude_bigger_)
9891         sumEstimator5[sub - 1][mdepth - 1][ieta + 41][iphi] += ratio;
9892     }  //if(studyRatioShapeHist_)
9893     ///////////////////////////////
9894     //   //   //   //   //   //   //   //   //  HE       DiffAmplitude:
9895     if (studyDiffAmplHist_) {
9896       // gain stability:
9897       if (mdepth == 1)
9898         h_mapDepth1AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
9899       if (mdepth == 2)
9900         h_mapDepth2AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
9901       if (mdepth == 3)
9902         h_mapDepth3AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
9903 
9904     }  // if(studyDiffAmplHist_)
9905 
9906     // RADDAM filling:
9907     if (flagLaserRaddam_ > 0) {
9908       double amplitudewithPedSubtr = 0.;
9909 
9910       //for cut on A_channel:
9911       if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
9912         amplitudewithPedSubtr = toolwithPedSubtr[ts_with_max_signal];
9913       if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
9914         amplitudewithPedSubtr += toolwithPedSubtr[ts_with_max_signal + 2];
9915       if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
9916         amplitudewithPedSubtr += toolwithPedSubtr[ts_with_max_signal + 1];
9917       if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
9918         amplitudewithPedSubtr += toolwithPedSubtr[ts_with_max_signal - 1];
9919 
9920       h_AamplitudewithPedSubtr_RADDAM_HE->Fill(amplitudewithPedSubtr);
9921       h_AamplitudewithPedSubtr_RADDAM_HEzoom0->Fill(amplitudewithPedSubtr);
9922       h_AamplitudewithPedSubtr_RADDAM_HEzoom1->Fill(amplitudewithPedSubtr);
9923 
9924       if (amplitudewithPedSubtr > 50.) {
9925         if (flagLaserRaddam_ > 1) {
9926           mapRADDAM_HE[mdepth - 1][ieta + 41][iphi] += amplitudewithPedSubtr;
9927           ++mapRADDAM0_HE[mdepth - 1][ieta + 41][iphi];
9928         }
9929 
9930         if (mdepth == 1) {
9931           h_mapDepth1RADDAM_HE->Fill(double(ieta), double(iphi), amplitudewithPedSubtr);
9932           h_mapDepth1RADDAM0_HE->Fill(double(ieta), double(iphi), 1.);
9933           h_A_Depth1RADDAM_HE->Fill(amplitudewithPedSubtr);
9934         }
9935         if (mdepth == 2) {
9936           h_mapDepth2RADDAM_HE->Fill(double(ieta), double(iphi), amplitudewithPedSubtr);
9937           h_mapDepth2RADDAM0_HE->Fill(double(ieta), double(iphi), 1.);
9938           h_A_Depth2RADDAM_HE->Fill(amplitudewithPedSubtr);
9939         }
9940         if (mdepth == 3) {
9941           h_mapDepth3RADDAM_HE->Fill(double(ieta), double(iphi), amplitudewithPedSubtr);
9942           h_mapDepth3RADDAM0_HE->Fill(double(ieta), double(iphi), 1.);
9943           h_A_Depth3RADDAM_HE->Fill(amplitudewithPedSubtr);
9944         }
9945 
9946         // (d1 & eta 17-29)                       L1
9947         int LLLLLL111111 = 0;
9948         if ((mdepth == 1 && std::abs(ieta0) > 16 && std::abs(ieta0) < 30))
9949           LLLLLL111111 = 1;
9950         // (d2 & eta 17-26) && (d3 & eta 27-28)   L2
9951         int LLLLLL222222 = 0;
9952         if ((mdepth == 2 && std::abs(ieta0) > 16 && std::abs(ieta0) < 27) ||
9953             (mdepth == 3 && std::abs(ieta0) > 26 && std::abs(ieta0) < 29))
9954           LLLLLL222222 = 1;
9955         //
9956         if (LLLLLL111111 == 1) {
9957           //forStudy        h_mapLayer1RADDAM_HE->Fill(fabs(double(ieta0)), amplitudewithPedSubtr); h_mapLayer1RADDAM0_HE->Fill(fabs(double(ieta0)), 1.); h_A_Layer1RADDAM_HE->Fill(amplitudewithPedSubtr);
9958           h_sigLayer1RADDAM_HE->Fill(double(ieta0), amplitudewithPedSubtr);
9959           h_sigLayer1RADDAM0_HE->Fill(double(ieta0), 1.);
9960         }
9961         if (LLLLLL222222 == 1) {
9962           //forStudy    h_mapLayer2RADDAM_HE->Fill(fabs(double(ieta0)), amplitudewithPedSubtr); h_mapLayer2RADDAM0_HE->Fill(fabs(double(ieta0)), 1.); h_A_Layer2RADDAM_HE->Fill(amplitudewithPedSubtr);
9963           h_sigLayer2RADDAM_HE->Fill(double(ieta0), amplitudewithPedSubtr);
9964           h_sigLayer2RADDAM0_HE->Fill(double(ieta0), 1.);
9965         }
9966 
9967         //
9968         if (mdepth == 3 && std::abs(ieta0) == 16) {
9969           h_mapDepth3RADDAM16_HE->Fill(amplitudewithPedSubtr);
9970           // forStudy     h_mapDepth3RADDAM160_HE->Fill(1.);
9971         }
9972         //
9973       }  //amplitude > 60.
9974     }  // END RADDAM
9975 
9976     ///////////////////////////////    for HE All
9977     if (mdepth == 1)
9978       h_mapDepth1_HE->Fill(double(ieta), double(iphi), 1.);
9979     if (mdepth == 2)
9980       h_mapDepth2_HE->Fill(double(ieta), double(iphi), 1.);
9981     if (mdepth == 3)
9982       h_mapDepth3_HE->Fill(double(ieta), double(iphi), 1.);
9983   }  //if ( sub == 2 )
9984   //
9985 }  // fillDigiAmplitude
9986 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9987 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9988 void CMTRawAnalyzer::fillDigiAmplitudeQIE11(QIE11DataFrame qie11df) {
9989   CaloSamples toolOriginal;  // TS
9990   double tool[100];
9991   DetId detid = qie11df.detid();
9992   HcalDetId hcaldetid = HcalDetId(detid);
9993   int ieta = hcaldetid.ieta();
9994   if (ieta > 0)
9995     ieta -= 1;
9996   int iphi = hcaldetid.iphi() - 1;
9997   int mdepth = hcaldetid.depth();
9998   int sub = hcaldetid.subdet();  // 1-HB, 2-HE QIE11DigiCollection
9999   nTS = qie11df.samples();
10000   /////////////////////////////////////////////////////////////////
10001   if (mdepth == 0 || sub > 4)
10002     return;
10003   if (mdepth > 3 && flagupgradeqie1011_ == 3)
10004     return;
10005   if (mdepth > 3 && flagupgradeqie1011_ == 7)
10006     return;
10007   if (mdepth > 3 && flagupgradeqie1011_ == 8)
10008     return;
10009   if (mdepth > 3 && flagupgradeqie1011_ == 9)
10010     return;
10011 
10012   // for some CMSSW versions and GT this line uncommented, can help to run job
10013   //if(mdepth ==4  && sub==1  && (ieta == -16 || ieta == 15)   ) return;// HB depth4 eta=-16, 15 since I did:if(ieta > 0) ieta -= 1;
10014   /////////////////////////////////////////////////////////////////
10015   /////////////////////////////////////////////////////////////////
10016   const HcalGain* gain = conditions->getGain(hcaldetid);
10017   //    const HcalGainWidth* gainWidth = conditions->getGainWidth(hcaldetid);
10018   const HcalRespCorr* respcorr = conditions->getHcalRespCorr(hcaldetid);
10019   const HcalTimeCorr* timecorr = conditions->getHcalTimeCorr(hcaldetid);
10020   const HcalLUTCorr* lutcorr = conditions->getHcalLUTCorr(hcaldetid);
10021   const HcalQIECoder* channelCoder = conditions->getHcalCoder(hcaldetid);
10022   const HcalPedestalWidth* pedw = conditions->getPedestalWidth(hcaldetid);
10023   const HcalPedestal* pedestal00 = conditions->getPedestal(hcaldetid);
10024   HcalCoderDb coder(*channelCoder, *shape);
10025   if (useADCfC_)
10026     coder.adc2fC(qie11df, toolOriginal);
10027   double pedestalaver9 = 0.;
10028   double pedestalaver4 = 0.;
10029   double pedestal0 = 0.;
10030   double pedestal1 = 0.;
10031   double pedestal2 = 0.;
10032   double pedestal3 = 0.;
10033   double pedestalwaver9 = 0.;
10034   double pedestalwaver4 = 0.;
10035   double pedestalw0 = 0.;
10036   double pedestalw1 = 0.;
10037   double pedestalw2 = 0.;
10038   double pedestalw3 = 0.;
10039   double difpedestal0 = 0.;
10040   double difpedestal1 = 0.;
10041   double difpedestal2 = 0.;
10042   double difpedestal3 = 0.;
10043 
10044   double amplitude = 0.;
10045   double amplitude0 = 0.;
10046   double absamplitude = 0.;
10047   double tocampl = 0.;
10048 
10049   double amplitude345 = 0.;
10050   double ampl = 0.;
10051   double ampl3ts = 0.;
10052   double timew = 0.;
10053   double timeww = 0.;
10054   double max_signal = -100.;
10055   int ts_with_max_signal = -100;
10056   int c0 = 0;
10057   int c1 = 0;
10058   int c2 = 0;
10059   int c3 = 0;
10060   int c4 = 0;
10061   double errorBtype = 0.;
10062 
10063   int TSsize = 8;  // sub= 1 HB
10064   if (sub == 2)
10065     TSsize = 8;  // sub = 2 HE
10066   if (nTS != TSsize)
10067     errorBtype = 1.;
10068   TSsize = nTS;  //nTS = qie11df.samples();
10069   ///////   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10070   // double ADC_ped = 0.;
10071   int flagTS2 = 0;
10072   for (int ii = 0; ii < TSsize; ii++) {
10073     double ampldefault = 0.;
10074     double tocdefault = 0.;
10075     double ampldefault0 = 0.;
10076     double ampldefault1 = 0.;
10077     double ampldefault2 = 0.;
10078 
10079     ampldefault0 = adc2fC_QIE11_shunt6[qie11df[ii].adc()];  // massive !!!!!!    (use for local runs as default shunt6)
10080     if (flaguseshunt_ == 1)
10081       ampldefault0 = adc2fC_QIE11_shunt1[qie11df[ii].adc()];  // massive !!!!!!
10082     if (useADCfC_)
10083       ampldefault1 = toolOriginal[ii];  //adcfC
10084     ampldefault2 = qie11df[ii].adc();   //ADCcounts
10085 
10086     if (useADCmassive_) {
10087       ampldefault = ampldefault0;
10088     }  // !!!!!!
10089     if (useADCfC_) {
10090       ampldefault = ampldefault1;
10091     }
10092     if (useADCcounts_) {
10093       ampldefault = ampldefault2;
10094     }
10095     tocdefault = ampldefault;
10096 
10097     int capid = (qie11df[ii]).capid();
10098     double pedestal = pedestal00->getValue(capid);
10099     double pedestalw = pedw->getSigma(capid, capid);
10100     double pedestalINI = pedestal00->getValue(capid);
10101     tocdefault -= pedestal;  // pedestal subtraction
10102     if (usePedestalSubtraction_)
10103       ampldefault -= pedestal;  // pedestal subtraction
10104     tool[ii] = ampldefault;
10105     pedestalaver9 += pedestal;
10106     pedestalwaver9 += pedestalw * pedestalw;
10107 
10108     if (capid == 0 && c0 == 0) {
10109       c0++;
10110       c4++;
10111       pedestalaver4 += pedestal;
10112       pedestal0 = pedestal;
10113       pedestalw0 = pedestalw;
10114       pedestalwaver4 += pedestalw * pedestalw;
10115       difpedestal0 = pedestal - pedestalINI;
10116     }
10117 
10118     if (capid == 1 && c1 == 0) {
10119       c1++;
10120       c4++;
10121       pedestalaver4 += pedestal;
10122       pedestal1 = pedestal;
10123       pedestalw1 = pedestalw;
10124       pedestalwaver4 += pedestalw * pedestalw;
10125       difpedestal1 = pedestal - pedestalINI;
10126     }
10127     if (capid == 2 && c2 == 0) {
10128       c2++;
10129       c4++;
10130       pedestalaver4 += pedestal;
10131       pedestal2 = pedestal;
10132       pedestalw2 = pedestalw;
10133       pedestalwaver4 += pedestalw * pedestalw;
10134       difpedestal2 = pedestal - pedestalINI;
10135     }
10136     if (capid == 3 && c3 == 0) {
10137       c3++;
10138       c4++;
10139       pedestalaver4 += pedestal;
10140       pedestal3 = pedestal;
10141       pedestalw3 = pedestalw;
10142       pedestalwaver4 += pedestalw * pedestalw;
10143       difpedestal3 = pedestal - pedestalINI;
10144     }
10145 
10146     if (max_signal < ampldefault) {
10147       max_signal = ampldefault;
10148       ts_with_max_signal = ii;
10149     }
10150     amplitude += ampldefault;          //
10151     absamplitude += abs(ampldefault);  //
10152     tocampl += tocdefault;             //
10153 
10154     if (ii == 1 || ii == 2 || ii == 3 || ii == 4 || ii == 5 || ii == 6 || ii == 7 || ii == 8)
10155       amplitude345 += ampldefault;
10156 
10157     if (flagcpuoptimization_ == 0) {
10158     }  //flagcpuoptimization
10159 
10160     timew += (ii + 1) * abs(ampldefault);
10161     timeww += (ii + 1) * ampldefault;
10162 
10163     if (ii == 2 && ampldefault > 0.)
10164       flagTS2 = 1;
10165   }  //for 1
10166   //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10167   amplitude0 = amplitude;
10168 
10169   pedestalaver9 /= TSsize;
10170   pedestalaver4 /= c4;
10171   pedestalwaver9 = sqrt(pedestalwaver9 / TSsize);
10172   pedestalwaver4 = sqrt(pedestalwaver4 / c4);
10173 
10174   // ------------ to get signal in TS: -2 max +1  ------------
10175   if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize) {
10176     ampl = tool[ts_with_max_signal];
10177     ampl3ts = tool[ts_with_max_signal];
10178   }
10179   if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize) {
10180     ampl += tool[ts_with_max_signal - 1];
10181     ampl3ts += tool[ts_with_max_signal - 1];
10182   }
10183   if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize) {
10184     ampl += tool[ts_with_max_signal + 1];
10185     ampl3ts += tool[ts_with_max_signal + 1];
10186   }
10187   if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize) {
10188     ampl += tool[ts_with_max_signal + 2];
10189   }
10190   // HE charge correction for SiPMs:
10191   if (flagsipmcorrection_ != 0) {
10192     if (sub == 2) {
10193       double xa = amplitude / 40.;
10194       double xb = ampl / 40.;
10195       double xc = amplitude345 / 40.;
10196       double xd = ampl3ts / 40.;
10197       double txa = tocampl / 40.;
10198       // ADDI case:
10199       if (((ieta == -16 || ieta == 15) && mdepth == 4) ||
10200           ((ieta == -17 || ieta == 16) && (mdepth == 2 || mdepth == 3)) ||
10201           ((ieta == -18 || ieta == 17) && mdepth == 5)) {
10202         double c0 = 1.000000;
10203         double b1 = 2.59096e-05;
10204         double a2 = 4.60721e-11;
10205         double corrforxa = a2 * xa * xa + b1 * xa + c0;
10206         double corrforxb = a2 * xb * xb + b1 * xb + c0;
10207         double corrforxc = a2 * xc * xc + b1 * xc + c0;
10208         double corrforxd = a2 * xd * xd + b1 * xd + c0;
10209         double corrfortxa = a2 * txa * txa + b1 * txa + c0;
10210         h_corrforxaADDI_HE->Fill(amplitude, corrforxa);
10211         h_corrforxaADDI0_HE->Fill(amplitude, 1.);
10212         amplitude *= corrforxa;
10213         ampl *= corrforxb;
10214         amplitude345 *= corrforxc;
10215         ampl3ts *= corrforxd;
10216         tocampl *= corrfortxa;
10217       }
10218       // MAIN case:
10219       else {
10220         double c0 = 1.000000;
10221         double b1 = 2.71238e-05;
10222         double a2 = 1.32877e-10;
10223         double corrforxa = a2 * xa * xa + b1 * xa + c0;
10224         double corrforxb = a2 * xb * xb + b1 * xb + c0;
10225         double corrforxc = a2 * xc * xc + b1 * xc + c0;
10226         double corrforxd = a2 * xd * xd + b1 * xd + c0;
10227         double corrfortxa = a2 * txa * txa + b1 * txa + c0;
10228         h_corrforxaMAIN_HE->Fill(amplitude, corrforxa);
10229         h_corrforxaMAIN0_HE->Fill(amplitude, 1.);
10230         amplitude *= corrforxa;
10231         ampl *= corrforxb;
10232         amplitude345 *= corrforxc;
10233         ampl3ts *= corrforxd;
10234         tocampl *= corrfortxa;
10235       }
10236     }  // sub == 2   HE charge correction end
10237   }  //flagsipmcorrection_
10238   ///////   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!      !!!!!!!!!!!!!!!!!!                      fillDigiAmplitudeQIE11
10239   // sub=1||2 HBHE
10240   if (sub == 1 || sub == 2) {
10241     amplitudechannel0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;                 // 0-neta ; 0-71  HBHE
10242     amplitudechannel[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;           // 0-neta ; 0-71  HBHE
10243     amplitudechannel2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(amplitude, 2);  // 0-neta ; 0-71  HBHE
10244   }
10245   tocamplchannel[sub - 1][mdepth - 1][ieta + 41][iphi] += tocampl;  // 0-neta ; 0-71  HBHE
10246 
10247   double ratio = 0.;
10248   //    if(amplallTS != 0.) ratio = ampl/amplallTS;
10249   if (amplitude != 0.)
10250     ratio = ampl / amplitude;
10251   if (ratio < 0. || ratio > 1.02)
10252     ratio = 0.;
10253   double aveamplitude = 0.;
10254   double aveamplitudew = 0.;
10255   if (absamplitude > 0 && timew > 0)
10256     aveamplitude = timew / absamplitude;  // average_TS +1
10257   if (amplitude0 > 0 && timeww > 0)
10258     aveamplitudew = timeww / amplitude0;  // average_TS +1
10259   double rmsamp = 0.;
10260   // and CapIdErrors:
10261   int error = 0;
10262   bool anycapid = true;
10263   int lastcapid = 0;
10264   int capid = 0;
10265   for (int ii = 0; ii < TSsize; ii++) {
10266     double aaaaaa = (ii + 1) - aveamplitudew;
10267     double aaaaaa2 = aaaaaa * aaaaaa;
10268     double ampldefault = tool[ii];
10269     rmsamp += (aaaaaa2 * ampldefault);  // fC
10270     capid = (qie11df[ii]).capid();
10271     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
10272       anycapid = false;
10273     }
10274     lastcapid = capid;
10275   }  //for 2
10276 
10277   if (!anycapid)
10278     error = 1;
10279   double rmsamplitude = 0.;
10280   if ((amplitude0 > 0 && rmsamp > 0) || (amplitude0 < 0 && rmsamp < 0))
10281     rmsamplitude = sqrt(rmsamp / amplitude0);
10282   double aveamplitude1 = aveamplitude - 1;  // means iTS=0-9
10283   // CapIdErrors end  /////////////////////////////////////////////////////////
10284 
10285   // AZ 1.10.2015:
10286   if (error == 1) {
10287     if (sub == 1 && mdepth == 1)
10288       h_Amplitude_forCapIdErrors_HB1->Fill(amplitude, 1.);
10289     if (sub == 1 && mdepth == 2)
10290       h_Amplitude_forCapIdErrors_HB2->Fill(amplitude, 1.);
10291     if (sub == 2 && mdepth == 1)
10292       h_Amplitude_forCapIdErrors_HE1->Fill(amplitude, 1.);
10293     if (sub == 2 && mdepth == 2)
10294       h_Amplitude_forCapIdErrors_HE2->Fill(amplitude, 1.);
10295     if (sub == 2 && mdepth == 3)
10296       h_Amplitude_forCapIdErrors_HE3->Fill(amplitude, 1.);
10297   }
10298   if (error != 1) {
10299     if (sub == 1 && mdepth == 1)
10300       h_Amplitude_notCapIdErrors_HB1->Fill(amplitude, 1.);
10301     if (sub == 1 && mdepth == 2)
10302       h_Amplitude_notCapIdErrors_HB2->Fill(amplitude, 1.);
10303     if (sub == 2 && mdepth == 1)
10304       h_Amplitude_notCapIdErrors_HE1->Fill(amplitude, 1.);
10305     if (sub == 2 && mdepth == 2)
10306       h_Amplitude_notCapIdErrors_HE2->Fill(amplitude, 1.);
10307     if (sub == 2 && mdepth == 3)
10308       h_Amplitude_notCapIdErrors_HE3->Fill(amplitude, 1.);
10309   }
10310 
10311   for (int ii = 0; ii < TSsize; ii++) {
10312     //  for (int ii=0; ii<10; ii++) {
10313     double ampldefault = tool[ii];
10314     ///
10315     if (sub == 1) {
10316       if (amplitude0 > 120) {
10317         h_shape_Ahigh_HB0->Fill(float(ii), ampldefault);
10318         h_shape0_Ahigh_HB0->Fill(float(ii), 1.);
10319       } else {
10320         h_shape_Alow_HB0->Fill(float(ii), ampldefault);
10321         h_shape0_Alow_HB0->Fill(float(ii), 1.);
10322       }  //HB0
10323       ///
10324       if (pedestal2 < pedestalHBMax_ || pedestal3 < pedestalHBMax_ || pedestal2 < pedestalHBMax_ ||
10325           pedestal3 < pedestalHBMax_) {
10326         h_shape_Ahigh_HB1->Fill(float(ii), ampldefault);
10327         h_shape0_Ahigh_HB1->Fill(float(ii), 1.);
10328       } else {
10329         h_shape_Alow_HB1->Fill(float(ii), ampldefault);
10330         h_shape0_Alow_HB1->Fill(float(ii), 1.);
10331       }  //HB1
10332       if (error == 0) {
10333         h_shape_Ahigh_HB2->Fill(float(ii), ampldefault);
10334         h_shape0_Ahigh_HB2->Fill(float(ii), 1.);
10335       } else {
10336         h_shape_Alow_HB2->Fill(float(ii), ampldefault);
10337         h_shape0_Alow_HB2->Fill(float(ii), 1.);
10338       }  //HB2
10339       ///
10340       if (pedestalw0 < pedestalwHBMax_ || pedestalw1 < pedestalwHBMax_ || pedestalw2 < pedestalwHBMax_ ||
10341           pedestalw3 < pedestalwHBMax_) {
10342         h_shape_Ahigh_HB3->Fill(float(ii), ampldefault);
10343         h_shape0_Ahigh_HB3->Fill(float(ii), 1.);
10344       } else {
10345         h_shape_Alow_HB3->Fill(float(ii), ampldefault);
10346         h_shape0_Alow_HB3->Fill(float(ii), 1.);
10347       }  //HB3
10348 
10349     }  // sub   HB
10350 
10351   }  //for 3 over TSs
10352 
10353   if (sub == 1) {
10354     // bad_channels with C,A,W,P,pW,
10355     if (error == 1 || amplitude0 < ADCAmplHBMin_ || amplitude0 > ADCAmplHBMax_ || rmsamplitude < rmsHBMin_ ||
10356         rmsamplitude > rmsHBMax_ || pedestal0 < pedestalHBMax_ || pedestal1 < pedestalHBMax_ ||
10357         pedestal2 < pedestalHBMax_ || pedestal3 < pedestalHBMax_ || pedestalw0 < pedestalwHBMax_ ||
10358         pedestalw1 < pedestalwHBMax_ || pedestalw2 < pedestalwHBMax_ || pedestalw3 < pedestalwHBMax_) {
10359       for (int ii = 0; ii < TSsize; ii++) {
10360         double ampldefault = tool[ii];
10361         h_shape_bad_channels_HB->Fill(float(ii), ampldefault);
10362         h_shape0_bad_channels_HB->Fill(float(ii), 1.);
10363       }
10364     }
10365     // good_channels with C,A,W,P,pW
10366     else {
10367       for (int ii = 0; ii < TSsize; ii++) {
10368         double ampldefault = tool[ii];
10369         h_shape_good_channels_HB->Fill(float(ii), ampldefault);
10370         h_shape0_good_channels_HB->Fill(float(ii), 1.);
10371       }
10372     }
10373   }  // sub   HB
10374 
10375   // HE starts:
10376   if (sub == 2) {
10377     // shape bad_channels with C,A,W,P,pW,
10378     if (error == 1 || amplitude0 < ADCAmplHEMin_ || amplitude0 > ADCAmplHEMax_ || rmsamplitude < rmsHEMin_ ||
10379         rmsamplitude > rmsHEMax_ || pedestal0 < pedestalHEMax_ || pedestal1 < pedestalHEMax_ ||
10380         pedestal2 < pedestalHEMax_ || pedestal3 < pedestalHEMax_ || pedestalw0 < pedestalwHEMax_ ||
10381         pedestalw1 < pedestalwHEMax_ || pedestalw2 < pedestalwHEMax_ || pedestalw3 < pedestalwHEMax_) {
10382       for (int ii = 0; ii < TSsize; ii++) {
10383         double ampldefault = tool[ii];
10384         h_shape_bad_channels_HE->Fill(float(ii), ampldefault);
10385         h_shape0_bad_channels_HE->Fill(float(ii), 1.);
10386       }
10387     }
10388     // shape good_channels with C,A,W,P,pW,
10389     else {
10390       for (int ii = 0; ii < TSsize; ii++) {
10391         double ampldefault = tool[ii];
10392         h_shape_good_channels_HE->Fill(float(ii), ampldefault);
10393         h_shape0_good_channels_HE->Fill(float(ii), 1.);
10394       }  // ii
10395     }  // else for good channels
10396   }  // sub   HE
10397   ///////////////////////////////////////Digis : over all digiHits
10398   sum0Estimator[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
10399   //      for Error B-type
10400   sumEstimator6[sub - 1][mdepth - 1][ieta + 41][iphi] += errorBtype;
10401   //    sumEstimator0[sub-1][mdepth-1][ieta+41][iphi] += pedestalw0;//Sig_Pedestals
10402   sumEstimator0[sub - 1][mdepth - 1][ieta + 41][iphi] += pedestal0;  //Pedestals
10403   // HB
10404   if (sub == 1) {
10405     if (studyPedestalCorrelations_) {
10406       //   //   //   //   //   //   //   //   //  HB       PedestalCorrelations :
10407       double mypedestal = pedestal0;
10408       double mypedestalw = pedestalw0;
10409       h2_pedvsampl_HB->Fill(mypedestal, amplitude);
10410       h2_pedwvsampl_HB->Fill(mypedestalw, amplitude);
10411       h_pedvsampl_HB->Fill(mypedestal, amplitude);
10412       h_pedwvsampl_HB->Fill(mypedestalw, amplitude);
10413       h_pedvsampl0_HB->Fill(mypedestal, 1.);
10414       h_pedwvsampl0_HB->Fill(mypedestalw, 1.);
10415 
10416       h2_amplvsped_HB->Fill(amplitude, mypedestal);
10417       h2_amplvspedw_HB->Fill(amplitude, mypedestalw);
10418       h_amplvsped_HB->Fill(amplitude, mypedestal);
10419       h_amplvspedw_HB->Fill(amplitude, mypedestalw);
10420       h_amplvsped0_HB->Fill(amplitude, 1.);
10421     }  //
10422     //   //   //   //   //   //   //   //   //  HB       Pedestals:
10423     if (studyPedestalsHist_) {
10424       h_pedestal0_HB->Fill(pedestal0, 1.);
10425       h_pedestal1_HB->Fill(pedestal1, 1.);
10426       h_pedestal2_HB->Fill(pedestal2, 1.);
10427       h_pedestal3_HB->Fill(pedestal3, 1.);
10428       h_pedestalaver4_HB->Fill(pedestalaver4, 1.);
10429       h_pedestalaver9_HB->Fill(pedestalaver9, 1.);
10430       h_pedestalw0_HB->Fill(pedestalw0, 1.);
10431       h_pedestalw1_HB->Fill(pedestalw1, 1.);
10432       h_pedestalw2_HB->Fill(pedestalw2, 1.);
10433       h_pedestalw3_HB->Fill(pedestalw3, 1.);
10434       h_pedestalwaver4_HB->Fill(pedestalwaver4, 1.);
10435       h_pedestalwaver9_HB->Fill(pedestalwaver9, 1.);
10436       // for averaged values:
10437       if (mdepth == 1) {
10438         h_mapDepth1Ped0_HB->Fill(double(ieta), double(iphi), pedestal0);
10439         h_mapDepth1Ped1_HB->Fill(double(ieta), double(iphi), pedestal1);
10440         h_mapDepth1Ped2_HB->Fill(double(ieta), double(iphi), pedestal2);
10441         h_mapDepth1Ped3_HB->Fill(double(ieta), double(iphi), pedestal3);
10442         h_mapDepth1Pedw0_HB->Fill(double(ieta), double(iphi), pedestalw0);
10443         h_mapDepth1Pedw1_HB->Fill(double(ieta), double(iphi), pedestalw1);
10444         h_mapDepth1Pedw2_HB->Fill(double(ieta), double(iphi), pedestalw2);
10445         h_mapDepth1Pedw3_HB->Fill(double(ieta), double(iphi), pedestalw3);
10446       }
10447       if (mdepth == 2) {
10448         h_mapDepth2Ped0_HB->Fill(double(ieta), double(iphi), pedestal0);
10449         h_mapDepth2Ped1_HB->Fill(double(ieta), double(iphi), pedestal1);
10450         h_mapDepth2Ped2_HB->Fill(double(ieta), double(iphi), pedestal2);
10451         h_mapDepth2Ped3_HB->Fill(double(ieta), double(iphi), pedestal3);
10452         h_mapDepth2Pedw0_HB->Fill(double(ieta), double(iphi), pedestalw0);
10453         h_mapDepth2Pedw1_HB->Fill(double(ieta), double(iphi), pedestalw1);
10454         h_mapDepth2Pedw2_HB->Fill(double(ieta), double(iphi), pedestalw2);
10455         h_mapDepth2Pedw3_HB->Fill(double(ieta), double(iphi), pedestalw3);
10456       }
10457       if (pedestalw0 < pedestalwHBMax_ || pedestalw1 < pedestalwHBMax_ || pedestalw2 < pedestalwHBMax_ ||
10458           pedestalw3 < pedestalwHBMax_) {
10459         if (mdepth == 1)
10460           h_mapDepth1pedestalw_HB->Fill(double(ieta), double(iphi), 1.);
10461         if (mdepth == 2)
10462           h_mapDepth2pedestalw_HB->Fill(double(ieta), double(iphi), 1.);
10463         if (mdepth == 3)
10464           h_mapDepth3pedestalw_HB->Fill(double(ieta), double(iphi), 1.);
10465         if (mdepth == 3)
10466           h_mapDepth4pedestalw_HB->Fill(double(ieta), double(iphi), 1.);
10467       }
10468       if (pedestal0 < pedestalHBMax_ || pedestal1 < pedestalHBMax_ || pedestal2 < pedestalHBMax_ ||
10469           pedestal3 < pedestalHBMax_) {
10470         if (mdepth == 1)
10471           h_mapDepth1pedestal_HB->Fill(double(ieta), double(iphi), 1.);
10472         if (mdepth == 2)
10473           h_mapDepth2pedestal_HB->Fill(double(ieta), double(iphi), 1.);
10474         if (mdepth == 3)
10475           h_mapDepth3pedestal_HB->Fill(double(ieta), double(iphi), 1.);
10476         if (mdepth == 4)
10477           h_mapDepth4pedestal_HB->Fill(double(ieta), double(iphi), 1.);
10478       }
10479       for (int ii = 0; ii < TSsize; ii++) {
10480         h_pedestal00_HB->Fill(pedestal00->getValue(ii), 1.);
10481         h_gain_HB->Fill(gain->getValue(ii), 1.);
10482       }
10483       h_respcorr_HB->Fill(respcorr->getValue(), 1.);
10484       h_timecorr_HB->Fill(timecorr->getValue(), 1.);
10485       h_lutcorr_HB->Fill(lutcorr->getValue(), 1.);
10486       h_difpedestal0_HB->Fill(difpedestal0, 1.);
10487       h_difpedestal1_HB->Fill(difpedestal1, 1.);
10488       h_difpedestal2_HB->Fill(difpedestal2, 1.);
10489       h_difpedestal3_HB->Fill(difpedestal3, 1.);
10490     }  //
10491     //   //   //   //   //   //   //   //   //  HB       ADCAmpl:
10492     if (studyADCAmplHist_) {
10493       h_ADCAmpl345Zoom_HB->Fill(amplitude345, 1.);
10494       h_ADCAmpl345Zoom1_HB->Fill(amplitude345, 1.);
10495       h_ADCAmpl345_HB->Fill(amplitude345, 1.);
10496       if (error == 0) {
10497         h_ADCAmpl_HBCapIdNoError->Fill(amplitude, 1.);
10498         h_ADCAmpl345_HBCapIdNoError->Fill(amplitude345, 1.);
10499       }
10500       if (error == 1) {
10501         h_ADCAmpl_HBCapIdError->Fill(amplitude, 1.);
10502         h_ADCAmpl345_HBCapIdError->Fill(amplitude345, 1.);
10503       }
10504       h_ADCAmplZoom_HB->Fill(amplitude, 1.);
10505       h_ADCAmplZoom1_HB->Fill(amplitude, 1.);
10506       h_ADCAmpl_HB->Fill(amplitude, 1.);
10507 
10508       h_AmplitudeHBrest->Fill(amplitude, 1.);
10509       h_AmplitudeHBrest1->Fill(amplitude, 1.);
10510       h_AmplitudeHBrest6->Fill(amplitude, 1.);
10511 
10512       if (amplitude < ADCAmplHBMin_ || amplitude > ADCAmplHBMax_) {
10513         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 5)
10514           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
10515         if (mdepth == 1)
10516           h_mapDepth1ADCAmpl225_HB->Fill(double(ieta), double(iphi), 1.);
10517         if (mdepth == 2)
10518           h_mapDepth2ADCAmpl225_HB->Fill(double(ieta), double(iphi), 1.);
10519         if (mdepth == 3)
10520           h_mapDepth3ADCAmpl225_HB->Fill(double(ieta), double(iphi), 1.);
10521         if (mdepth == 4)
10522           h_mapDepth4ADCAmpl225_HB->Fill(double(ieta), double(iphi), 1.);
10523       }  // if
10524       //    if(amplitude >400.) averSIGNALoccupancy_HB += 1.;
10525       if (amplitude < 35.) {
10526         if (mdepth == 1)
10527           h_mapDepth1ADCAmpl225Copy_HB->Fill(double(ieta), double(iphi), 1.);
10528         if (mdepth == 2)
10529           h_mapDepth2ADCAmpl225Copy_HB->Fill(double(ieta), double(iphi), 1.);
10530         if (mdepth == 3)
10531           h_mapDepth3ADCAmpl225Copy_HB->Fill(double(ieta), double(iphi), 1.);
10532         if (mdepth == 4)
10533           h_mapDepth4ADCAmpl225Copy_HB->Fill(double(ieta), double(iphi), 1.);
10534       }  // if
10535       // for averaged values:
10536       if (mdepth == 1)
10537         h_mapDepth1ADCAmpl_HB->Fill(double(ieta), double(iphi), amplitude);
10538       if (mdepth == 2)
10539         h_mapDepth2ADCAmpl_HB->Fill(double(ieta), double(iphi), amplitude);
10540       if (mdepth == 3)
10541         h_mapDepth3ADCAmpl_HB->Fill(double(ieta), double(iphi), amplitude);
10542       if (mdepth == 4)
10543         h_mapDepth4ADCAmpl_HB->Fill(double(ieta), double(iphi), amplitude);
10544       if (mdepth == 1)
10545         h_mapDepth1ADCAmpl12_HB->Fill(double(ieta), double(iphi), ampl);
10546       if (mdepth == 2)
10547         h_mapDepth2ADCAmpl12_HB->Fill(double(ieta), double(iphi), ampl);
10548       if (mdepth == 3)
10549         h_mapDepth3ADCAmpl12_HB->Fill(double(ieta), double(iphi), ampl);
10550       if (mdepth == 4)
10551         h_mapDepth4ADCAmpl12_HB->Fill(double(ieta), double(iphi), ampl);
10552       ///////////////////////////////////////////////////////////////////////////////   //AZ: 21.09.2018 for Pavel Bunin:
10553       ///////////////////////////////////////////////////////////////////////////////   //AZ: 25.10.2018 for Pavel Bunin: gain stability vs LSs using LED from abort gap
10554       h_bcnvsamplitude_HB->Fill(float(bcn), amplitude);
10555       h_bcnvsamplitude0_HB->Fill(float(bcn), 1.);
10556       h_orbitNumvsamplitude_HB->Fill(float(orbitNum), amplitude);
10557       h_orbitNumvsamplitude0_HB->Fill(float(orbitNum), 1.);
10558       if (amplitude > forallestimators_amplitude_bigger_)
10559         sumEstimator1[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;
10560     }  //if(studyADCAmplHist_
10561     ///////////////////////////////
10562 
10563     //   //   //   //   //   //   //   //   //  HB       TSmean:
10564     if (studyTSmeanShapeHist_) {
10565       h_TSmeanA_HB->Fill(aveamplitude1, 1.);
10566       //      h2_TSnVsAyear2023_HB->Fill(25.*aveamplitude1, amplitude);
10567       h2_TSnVsAyear2023_HB->Fill(amplitude, 25. * aveamplitude1);
10568       h1_TSnVsAyear2023_HB->Fill(amplitude, 25. * aveamplitude1);
10569       h1_TSnVsAyear20230_HB->Fill(amplitude, 1.);
10570       if (aveamplitude1 < TSmeanHBMin_ || aveamplitude1 > TSmeanHBMax_) {
10571         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 4)
10572           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
10573         if (mdepth == 1)
10574           h_mapDepth1TSmeanA225_HB->Fill(double(ieta), double(iphi), 1.);
10575         if (mdepth == 2)
10576           h_mapDepth2TSmeanA225_HB->Fill(double(ieta), double(iphi), 1.);
10577         if (mdepth == 3)
10578           h_mapDepth3TSmeanA225_HB->Fill(double(ieta), double(iphi), 1.);
10579         if (mdepth == 4)
10580           h_mapDepth4TSmeanA225_HB->Fill(double(ieta), double(iphi), 1.);
10581       }  // if
10582       // for averaged values:
10583       if (mdepth == 1)
10584         h_mapDepth1TSmeanA_HB->Fill(double(ieta), double(iphi), aveamplitude1);
10585       if (mdepth == 2)
10586         h_mapDepth2TSmeanA_HB->Fill(double(ieta), double(iphi), aveamplitude1);
10587       if (mdepth == 3)
10588         h_mapDepth3TSmeanA_HB->Fill(double(ieta), double(iphi), aveamplitude1);
10589       if (mdepth == 4)
10590         h_mapDepth4TSmeanA_HB->Fill(double(ieta), double(iphi), aveamplitude1);
10591       if (amplitude > forallestimators_amplitude_bigger_)
10592         sumEstimator2[sub - 1][mdepth - 1][ieta + 41][iphi] += aveamplitude1;
10593     }  //if(studyTSmeanShapeHist_
10594     ///////////////////////////////
10595 
10596     //   //   //   //   //   //   //   //   //  HB       TSmax:
10597     if (studyTSmaxShapeHist_) {
10598       h_TSmaxA_HB->Fill(float(ts_with_max_signal), 1.);
10599       if (ts_with_max_signal < TSpeakHBMin_ || ts_with_max_signal > TSpeakHBMax_) {
10600         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 3)
10601           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
10602         if (mdepth == 1)
10603           h_mapDepth1TSmaxA225_HB->Fill(double(ieta), double(iphi), 1.);
10604         if (mdepth == 2)
10605           h_mapDepth2TSmaxA225_HB->Fill(double(ieta), double(iphi), 1.);
10606         if (mdepth == 3)
10607           h_mapDepth3TSmaxA225_HB->Fill(double(ieta), double(iphi), 1.);
10608         if (mdepth == 4)
10609           h_mapDepth4TSmaxA225_HB->Fill(double(ieta), double(iphi), 1.);
10610       }  // if
10611       // for averaged values:
10612       if (mdepth == 1)
10613         h_mapDepth1TSmaxA_HB->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
10614       if (mdepth == 2)
10615         h_mapDepth2TSmaxA_HB->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
10616       if (mdepth == 3)
10617         h_mapDepth3TSmaxA_HB->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
10618       if (mdepth == 4)
10619         h_mapDepth4TSmaxA_HB->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
10620       if (amplitude > forallestimators_amplitude_bigger_)
10621         sumEstimator3[sub - 1][mdepth - 1][ieta + 41][iphi] += float(ts_with_max_signal);
10622     }  //if(studyTSmaxShapeHist_
10623     ///////////////////////////////
10624 
10625     //   //   //   //   //   //   //   //   //  HB       RMS:
10626     if (studyRMSshapeHist_) {
10627       h_Amplitude_HB->Fill(rmsamplitude, 1.);
10628       if (rmsamplitude < rmsHBMin_ || rmsamplitude > rmsHBMax_) {
10629         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 2)
10630           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
10631         if (mdepth == 1)
10632           h_mapDepth1Amplitude225_HB->Fill(double(ieta), double(iphi), 1.);
10633         if (mdepth == 2)
10634           h_mapDepth2Amplitude225_HB->Fill(double(ieta), double(iphi), 1.);
10635         if (mdepth == 3)
10636           h_mapDepth3Amplitude225_HB->Fill(double(ieta), double(iphi), 1.);
10637         if (mdepth == 4)
10638           h_mapDepth4Amplitude225_HB->Fill(double(ieta), double(iphi), 1.);
10639       }  // if
10640       // for averaged values:
10641       if (mdepth == 1)
10642         h_mapDepth1Amplitude_HB->Fill(double(ieta), double(iphi), rmsamplitude);
10643       if (mdepth == 2)
10644         h_mapDepth2Amplitude_HB->Fill(double(ieta), double(iphi), rmsamplitude);
10645       if (mdepth == 3)
10646         h_mapDepth3Amplitude_HB->Fill(double(ieta), double(iphi), rmsamplitude);
10647       if (mdepth == 4)
10648         h_mapDepth4Amplitude_HB->Fill(double(ieta), double(iphi), rmsamplitude);
10649       if (amplitude > forallestimators_amplitude_bigger_)
10650         sumEstimator4[sub - 1][mdepth - 1][ieta + 41][iphi] += rmsamplitude;
10651     }  //if(studyRMSshapeHist_)
10652     ///////////////////////////////
10653 
10654     //   //   //   //   //   //   //   //   //  HB       Ratio:
10655     if (studyRatioShapeHist_) {
10656       h_Ampl_HB->Fill(ratio, 1.);
10657       if (ratio < ratioHBMin_ || ratio > ratioHBMax_) {
10658         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 1)
10659           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
10660         if (mdepth == 1)
10661           h_mapDepth1Ampl047_HB->Fill(double(ieta), double(iphi), 1.);
10662         if (mdepth == 2)
10663           h_mapDepth2Ampl047_HB->Fill(double(ieta), double(iphi), 1.);
10664         if (mdepth == 3)
10665           h_mapDepth3Ampl047_HB->Fill(double(ieta), double(iphi), 1.);
10666         if (mdepth == 4)
10667           h_mapDepth4Ampl047_HB->Fill(double(ieta), double(iphi), 1.);
10668         // //
10669       }  //if(ratio
10670       // for averaged values:
10671       if (mdepth == 1)
10672         h_mapDepth1Ampl_HB->Fill(double(ieta), double(iphi), ratio);
10673       if (mdepth == 2)
10674         h_mapDepth2Ampl_HB->Fill(double(ieta), double(iphi), ratio);
10675       if (mdepth == 3)
10676         h_mapDepth3Ampl_HB->Fill(double(ieta), double(iphi), ratio);
10677       if (mdepth == 4)
10678         h_mapDepth4Ampl_HB->Fill(double(ieta), double(iphi), ratio);
10679       if (amplitude > forallestimators_amplitude_bigger_)
10680         sumEstimator5[sub - 1][mdepth - 1][ieta + 41][iphi] += ratio;
10681     }  //if(studyRatioShapeHist_)
10682     ///////////////////////////////
10683 
10684     //   //   //   //   //   //   //   //   //  HB      DiffAmplitude:
10685     if (studyDiffAmplHist_) {
10686       if (mdepth == 1)
10687         h_mapDepth1AmplE34_HB->Fill(double(ieta), double(iphi), amplitude);
10688       if (mdepth == 2)
10689         h_mapDepth2AmplE34_HB->Fill(double(ieta), double(iphi), amplitude);
10690       if (mdepth == 3)
10691         h_mapDepth3AmplE34_HB->Fill(double(ieta), double(iphi), amplitude);
10692       if (mdepth == 4)
10693         h_mapDepth4AmplE34_HB->Fill(double(ieta), double(iphi), amplitude);
10694     }  // if(studyDiffAmplHist_)
10695 
10696     ///////////////////////////////    for HB All
10697     if (mdepth == 1)
10698       h_mapDepth1_HB->Fill(double(ieta), double(iphi), 1.);
10699     if (mdepth == 2)
10700       h_mapDepth2_HB->Fill(double(ieta), double(iphi), 1.);
10701     if (mdepth == 3)
10702       h_mapDepth3_HB->Fill(double(ieta), double(iphi), 1.);
10703     if (mdepth == 4)
10704       h_mapDepth4_HB->Fill(double(ieta), double(iphi), 1.);
10705 
10706     if (flagTS2 == 1) {
10707       if (mdepth == 1)
10708         h_mapDepth1TS2_HB->Fill(double(ieta), double(iphi), 1.);
10709       if (mdepth == 2)
10710         h_mapDepth2TS2_HB->Fill(double(ieta), double(iphi), 1.);
10711       if (mdepth == 3)
10712         h_mapDepth3TS2_HB->Fill(double(ieta), double(iphi), 1.);
10713       if (mdepth == 4)
10714         h_mapDepth4TS2_HB->Fill(double(ieta), double(iphi), 1.);
10715     }  // select entries only in TS=2
10716 
10717   }  //if ( sub == 1 )
10718 
10719   // HE   QIE11
10720   if (sub == 2) {
10721     //   //   //   //   //   //   //   //   //  HE   QIE11    PedestalCorrelations :
10722     if (studyPedestalCorrelations_) {
10723       //    double mypedestal  = pedestalaver9;
10724       //    double mypedestalw = pedestalwaver9;
10725       double mypedestal = pedestal0;
10726       double mypedestalw = pedestalw0;
10727       h2_pedvsampl_HE->Fill(mypedestal, amplitude);
10728       h2_pedwvsampl_HE->Fill(mypedestalw, amplitude);
10729       h_pedvsampl_HE->Fill(mypedestal, amplitude);
10730       h_pedwvsampl_HE->Fill(mypedestalw, amplitude);
10731       h_pedvsampl0_HE->Fill(mypedestal, 1.);
10732       h_pedwvsampl0_HE->Fill(mypedestalw, 1.);
10733     }  //
10734     //   //   //   //   //   //   //   //   //  HE   QIE11    Pedestals:
10735     if (studyPedestalsHist_) {
10736       h_pedestal0_HE->Fill(pedestal0, 1.);
10737       h_pedestal1_HE->Fill(pedestal1, 1.);
10738       h_pedestal2_HE->Fill(pedestal2, 1.);
10739       h_pedestal3_HE->Fill(pedestal3, 1.);
10740       h_pedestalaver4_HE->Fill(pedestalaver4, 1.);
10741       h_pedestalaver9_HE->Fill(pedestalaver9, 1.);
10742       h_pedestalw0_HE->Fill(pedestalw0, 1.);
10743       h_pedestalw1_HE->Fill(pedestalw1, 1.);
10744       h_pedestalw2_HE->Fill(pedestalw2, 1.);
10745       h_pedestalw3_HE->Fill(pedestalw3, 1.);
10746       h_pedestalwaver4_HE->Fill(pedestalwaver4, 1.);
10747       h_pedestalwaver9_HE->Fill(pedestalwaver9, 1.);
10748       // for averaged values:
10749       if (mdepth == 1) {
10750         h_mapDepth1Ped0_HE->Fill(double(ieta), double(iphi), pedestal0);
10751         h_mapDepth1Ped1_HE->Fill(double(ieta), double(iphi), pedestal1);
10752         h_mapDepth1Ped2_HE->Fill(double(ieta), double(iphi), pedestal2);
10753         h_mapDepth1Ped3_HE->Fill(double(ieta), double(iphi), pedestal3);
10754         h_mapDepth1Pedw0_HE->Fill(double(ieta), double(iphi), pedestalw0);
10755         h_mapDepth1Pedw1_HE->Fill(double(ieta), double(iphi), pedestalw1);
10756         h_mapDepth1Pedw2_HE->Fill(double(ieta), double(iphi), pedestalw2);
10757         h_mapDepth1Pedw3_HE->Fill(double(ieta), double(iphi), pedestalw3);
10758       }
10759       if (mdepth == 2) {
10760         h_mapDepth2Ped0_HE->Fill(double(ieta), double(iphi), pedestal0);
10761         h_mapDepth2Ped1_HE->Fill(double(ieta), double(iphi), pedestal1);
10762         h_mapDepth2Ped2_HE->Fill(double(ieta), double(iphi), pedestal2);
10763         h_mapDepth2Ped3_HE->Fill(double(ieta), double(iphi), pedestal3);
10764         h_mapDepth2Pedw0_HE->Fill(double(ieta), double(iphi), pedestalw0);
10765         h_mapDepth2Pedw1_HE->Fill(double(ieta), double(iphi), pedestalw1);
10766         h_mapDepth2Pedw2_HE->Fill(double(ieta), double(iphi), pedestalw2);
10767         h_mapDepth2Pedw3_HE->Fill(double(ieta), double(iphi), pedestalw3);
10768       }
10769       if (mdepth == 3) {
10770         h_mapDepth3Ped0_HE->Fill(double(ieta), double(iphi), pedestal0);
10771         h_mapDepth3Ped1_HE->Fill(double(ieta), double(iphi), pedestal1);
10772         h_mapDepth3Ped2_HE->Fill(double(ieta), double(iphi), pedestal2);
10773         h_mapDepth3Ped3_HE->Fill(double(ieta), double(iphi), pedestal3);
10774         h_mapDepth3Pedw0_HE->Fill(double(ieta), double(iphi), pedestalw0);
10775         h_mapDepth3Pedw1_HE->Fill(double(ieta), double(iphi), pedestalw1);
10776         h_mapDepth3Pedw2_HE->Fill(double(ieta), double(iphi), pedestalw2);
10777         h_mapDepth3Pedw3_HE->Fill(double(ieta), double(iphi), pedestalw3);
10778       }
10779       if (pedestalw0 < pedestalwHEMax_ || pedestalw1 < pedestalwHEMax_ || pedestalw2 < pedestalwHEMax_ ||
10780           pedestalw3 < pedestalwHEMax_) {
10781         if (mdepth == 1)
10782           h_mapDepth1pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
10783         if (mdepth == 2)
10784           h_mapDepth2pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
10785         if (mdepth == 3)
10786           h_mapDepth3pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
10787         if (mdepth == 4)
10788           h_mapDepth4pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
10789         if (mdepth == 5)
10790           h_mapDepth5pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
10791         if (mdepth == 6)
10792           h_mapDepth6pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
10793         if (mdepth == 7)
10794           h_mapDepth7pedestalw_HE->Fill(double(ieta), double(iphi), 1.);
10795       }
10796       if (pedestal0 < pedestalHEMax_ || pedestal1 < pedestalHEMax_ || pedestal2 < pedestalHEMax_ ||
10797           pedestal3 < pedestalHEMax_) {
10798         if (mdepth == 1)
10799           h_mapDepth1pedestal_HE->Fill(double(ieta), double(iphi), 1.);
10800         if (mdepth == 2)
10801           h_mapDepth2pedestal_HE->Fill(double(ieta), double(iphi), 1.);
10802         if (mdepth == 3)
10803           h_mapDepth3pedestal_HE->Fill(double(ieta), double(iphi), 1.);
10804         if (mdepth == 4)
10805           h_mapDepth4pedestal_HE->Fill(double(ieta), double(iphi), 1.);
10806         if (mdepth == 5)
10807           h_mapDepth5pedestal_HE->Fill(double(ieta), double(iphi), 1.);
10808         if (mdepth == 6)
10809           h_mapDepth6pedestal_HE->Fill(double(ieta), double(iphi), 1.);
10810         if (mdepth == 7)
10811           h_mapDepth7pedestal_HE->Fill(double(ieta), double(iphi), 1.);
10812       }
10813       for (int ii = 0; ii < TSsize; ii++) {
10814         h_pedestal00_HE->Fill(pedestal00->getValue(ii), 1.);
10815         h_gain_HE->Fill(gain->getValue(ii), 1.);
10816       }
10817       h_respcorr_HE->Fill(respcorr->getValue(), 1.);
10818       h_timecorr_HE->Fill(timecorr->getValue(), 1.);
10819       h_lutcorr_HE->Fill(lutcorr->getValue(), 1.);
10820     }  //
10821     //   //   //   //   //   //   //   //   //  HE  QIE11     ADCAmpl:
10822     if (studyADCAmplHist_) {
10823       h_ADCAmpl345_HE->Fill(amplitude345, 1.);
10824       h_ADCAmpl_HE->Fill(amplitude, 1.);
10825       //    if( ieta <0) h_ADCAmpl_HEM->Fill(amplitude,1.);
10826       //    if( ieta >0) h_ADCAmpl_HEP->Fill(amplitude,1.);
10827       h_ADCAmplrest_HE->Fill(amplitude, 1.);
10828       h_ADCAmplrest1_HE->Fill(amplitude, 1.);
10829       h_ADCAmplrest6_HE->Fill(amplitude, 1.);
10830 
10831       if (amplitude < ADCAmplHEMin_ || amplitude > ADCAmplHEMax_) {
10832         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 5)
10833           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
10834         if (mdepth == 1)
10835           h_mapDepth1ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
10836         if (mdepth == 2)
10837           h_mapDepth2ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
10838         if (mdepth == 3)
10839           h_mapDepth3ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
10840         if (mdepth == 4)
10841           h_mapDepth4ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
10842         if (mdepth == 5)
10843           h_mapDepth5ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
10844         if (mdepth == 6)
10845           h_mapDepth6ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
10846         if (mdepth == 7)
10847           h_mapDepth7ADCAmpl225_HE->Fill(double(ieta), double(iphi), 1.);
10848       }  // if
10849       //    if(amplitude > 700.) averSIGNALoccupancy_HE += 1.;
10850       if (amplitude < 500.) {
10851         if (mdepth == 1)
10852           h_mapDepth1ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
10853         if (mdepth == 2)
10854           h_mapDepth2ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
10855         if (mdepth == 3)
10856           h_mapDepth3ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
10857         if (mdepth == 4)
10858           h_mapDepth4ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
10859         if (mdepth == 5)
10860           h_mapDepth5ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
10861         if (mdepth == 6)
10862           h_mapDepth6ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
10863         if (mdepth == 7)
10864           h_mapDepth7ADCAmpl225Copy_HE->Fill(double(ieta), double(iphi), 1.);
10865       }  // if
10866 
10867       h_ADCAmplZoom1_HE->Fill(amplitude, 1.);   // for amplitude allTS
10868       h_ADCAmpl345Zoom1_HE->Fill(ampl3ts, 1.);  // for ampl3ts 3TSs
10869       h_ADCAmpl345Zoom_HE->Fill(ampl, 1.);      // for ampl 4TSs
10870 
10871       if (amplitude > 110 && amplitude < 150) {
10872         h_mapADCAmplfirstpeak_HE->Fill(double(ieta), double(iphi), amplitude);
10873         h_mapADCAmplfirstpeak0_HE->Fill(double(ieta), double(iphi), 1.);
10874       } else if (amplitude > 150 && amplitude < 190) {
10875         h_mapADCAmplsecondpeak_HE->Fill(double(ieta), double(iphi), amplitude);
10876         h_mapADCAmplsecondpeak0_HE->Fill(double(ieta), double(iphi), 1.);
10877       }
10878 
10879       if (ampl3ts > 70 && ampl3ts < 110) {
10880         h_mapADCAmpl11firstpeak_HE->Fill(double(ieta), double(iphi), ampl3ts);
10881         h_mapADCAmpl11firstpeak0_HE->Fill(double(ieta), double(iphi), 1.);
10882       } else if (ampl3ts > 110 && ampl3ts < 150) {
10883         h_mapADCAmpl11secondpeak_HE->Fill(double(ieta), double(iphi), ampl3ts);
10884         h_mapADCAmpl11secondpeak0_HE->Fill(double(ieta), double(iphi), 1.);
10885       }
10886       if (ampl > 87 && ampl < 127) {
10887         h_mapADCAmpl12firstpeak_HE->Fill(double(ieta), double(iphi), ampl);
10888         h_mapADCAmpl12firstpeak0_HE->Fill(double(ieta), double(iphi), 1.);
10889       } else if (ampl > 127 && ampl < 167) {
10890         h_mapADCAmpl12secondpeak_HE->Fill(double(ieta), double(iphi), ampl);
10891         h_mapADCAmpl12secondpeak0_HE->Fill(double(ieta), double(iphi), 1.);
10892       }
10893       // for averaged values of every channel:
10894       if (mdepth == 1)
10895         h_mapDepth1ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
10896       if (mdepth == 2)
10897         h_mapDepth2ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
10898       if (mdepth == 3)
10899         h_mapDepth3ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
10900       if (mdepth == 4)
10901         h_mapDepth4ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
10902       if (mdepth == 5)
10903         h_mapDepth5ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
10904       if (mdepth == 6)
10905         h_mapDepth6ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
10906       if (mdepth == 7)
10907         h_mapDepth7ADCAmpl_HE->Fill(double(ieta), double(iphi), amplitude);
10908       if (mdepth == 1)
10909         h_mapDepth1ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
10910       if (mdepth == 2)
10911         h_mapDepth2ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
10912       if (mdepth == 3)
10913         h_mapDepth3ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
10914       if (mdepth == 4)
10915         h_mapDepth4ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
10916       if (mdepth == 5)
10917         h_mapDepth5ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
10918       if (mdepth == 6)
10919         h_mapDepth6ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
10920       if (mdepth == 7)
10921         h_mapDepth7ADCAmpl12_HE->Fill(double(ieta), double(iphi), ampl);
10922       // for averaged values of SiPM channels only:
10923       if (mdepth == 1)
10924         h_mapDepth1ADCAmplSiPM_HE->Fill(double(ieta), double(iphi), amplitude);
10925       if (mdepth == 2)
10926         h_mapDepth2ADCAmplSiPM_HE->Fill(double(ieta), double(iphi), amplitude);
10927       if (mdepth == 3)
10928         h_mapDepth3ADCAmplSiPM_HE->Fill(double(ieta), double(iphi), amplitude);
10929       if (mdepth == 1)
10930         h_mapDepth1ADCAmpl12SiPM_HE->Fill(double(ieta), double(iphi), ampl);
10931       if (mdepth == 2)
10932         h_mapDepth2ADCAmpl12SiPM_HE->Fill(double(ieta), double(iphi), ampl);
10933       if (mdepth == 3)
10934         h_mapDepth3ADCAmpl12SiPM_HE->Fill(double(ieta), double(iphi), ampl);
10935       //
10936       ///////////////////////////////////////////////////////////////////////////////   //AZ: 21.09.2018 for Pavel Bunin:
10937       ///////////////////////////////////////////////////////////////////////////////   //AZ: 25.10.2018 for Pavel Bunin: gain stability vs LSs using LED from abort gap
10938       h_bcnvsamplitude_HE->Fill(float(bcn), amplitude);
10939       h_bcnvsamplitude0_HE->Fill(float(bcn), 1.);
10940       h_orbitNumvsamplitude_HE->Fill(float(orbitNum), amplitude);
10941       h_orbitNumvsamplitude0_HE->Fill(float(orbitNum), 1.);
10942       if (amplitude > forallestimators_amplitude_bigger_)
10943         sumEstimator1[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;
10944     }  //if(studyADCAmplHist_
10945     //   //   //   //   //   //   //   //   //  HE  QIE11     TSmean:
10946     if (studyTSmeanShapeHist_) {
10947       h_TSmeanA_HE->Fill(aveamplitude1, 1.);
10948       //    h2_TSnVsAyear2023_HE->Fill(25.*aveamplitude1, amplitude);
10949       h2_TSnVsAyear2023_HE->Fill(amplitude, 25. * aveamplitude1);
10950       h1_TSnVsAyear2023_HE->Fill(amplitude, 25. * aveamplitude1);
10951       h1_TSnVsAyear20230_HE->Fill(amplitude, 1.);
10952       if (aveamplitude1 < TSmeanHEMin_ || aveamplitude1 > TSmeanHEMax_) {
10953         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 4)
10954           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
10955         if (mdepth == 1)
10956           h_mapDepth1TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
10957         if (mdepth == 2)
10958           h_mapDepth2TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
10959         if (mdepth == 3)
10960           h_mapDepth3TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
10961         if (mdepth == 4)
10962           h_mapDepth4TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
10963         if (mdepth == 5)
10964           h_mapDepth5TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
10965         if (mdepth == 6)
10966           h_mapDepth6TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
10967         if (mdepth == 7)
10968           h_mapDepth7TSmeanA225_HE->Fill(double(ieta), double(iphi), 1.);
10969       }  // if
10970       // for averaged values:
10971       if (mdepth == 1)
10972         h_mapDepth1TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
10973       if (mdepth == 2)
10974         h_mapDepth2TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
10975       if (mdepth == 3)
10976         h_mapDepth3TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
10977       if (mdepth == 4)
10978         h_mapDepth4TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
10979       if (mdepth == 5)
10980         h_mapDepth5TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
10981       if (mdepth == 6)
10982         h_mapDepth6TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
10983       if (mdepth == 7)
10984         h_mapDepth7TSmeanA_HE->Fill(double(ieta), double(iphi), aveamplitude1);
10985       if (amplitude > forallestimators_amplitude_bigger_)
10986         sumEstimator2[sub - 1][mdepth - 1][ieta + 41][iphi] += aveamplitude1;
10987     }  //if(studyTSmeanShapeHist_) {
10988     ///////////////////////////////
10989     //   //   //   //   //   //   //   //   //  HE  QIE11     TSmax:
10990     if (studyTSmaxShapeHist_) {
10991       h_TSmaxA_HE->Fill(float(ts_with_max_signal), 1.);
10992       if (ts_with_max_signal < TSpeakHEMin_ || ts_with_max_signal > TSpeakHEMax_) {
10993         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 3)
10994           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
10995         if (mdepth == 1)
10996           h_mapDepth1TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
10997         if (mdepth == 2)
10998           h_mapDepth2TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
10999         if (mdepth == 3)
11000           h_mapDepth3TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
11001         if (mdepth == 4)
11002           h_mapDepth4TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
11003         if (mdepth == 5)
11004           h_mapDepth5TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
11005         if (mdepth == 6)
11006           h_mapDepth6TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
11007         if (mdepth == 7)
11008           h_mapDepth7TSmaxA225_HE->Fill(double(ieta), double(iphi), 1.);
11009       }  // if
11010       // for averaged values:
11011       if (mdepth == 1)
11012         h_mapDepth1TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11013       if (mdepth == 2)
11014         h_mapDepth2TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11015       if (mdepth == 3)
11016         h_mapDepth3TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11017       if (mdepth == 4)
11018         h_mapDepth4TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11019       if (mdepth == 5)
11020         h_mapDepth5TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11021       if (mdepth == 6)
11022         h_mapDepth6TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11023       if (mdepth == 7)
11024         h_mapDepth7TSmaxA_HE->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11025       if (amplitude > forallestimators_amplitude_bigger_)
11026         sumEstimator3[sub - 1][mdepth - 1][ieta + 41][iphi] += float(ts_with_max_signal);
11027     }  //if(studyTSmaxShapeHist_) {
11028     ///////////////////////////////
11029     //   //   //   //   //   //   //   //   //  HE   QIE11    RMS:
11030     if (studyRMSshapeHist_) {
11031       h_Amplitude_HE->Fill(rmsamplitude, 1.);
11032       if (rmsamplitude < rmsHEMin_ || rmsamplitude > rmsHEMax_) {
11033         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 2)
11034           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
11035         if (mdepth == 1)
11036           h_mapDepth1Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
11037         if (mdepth == 2)
11038           h_mapDepth2Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
11039         if (mdepth == 3)
11040           h_mapDepth3Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
11041         if (mdepth == 4)
11042           h_mapDepth4Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
11043         if (mdepth == 5)
11044           h_mapDepth5Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
11045         if (mdepth == 6)
11046           h_mapDepth6Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
11047         if (mdepth == 7)
11048           h_mapDepth7Amplitude225_HE->Fill(double(ieta), double(iphi), 1.);
11049       }
11050       // for averaged values:
11051       if (mdepth == 1)
11052         h_mapDepth1Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
11053       if (mdepth == 2)
11054         h_mapDepth2Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
11055       if (mdepth == 3)
11056         h_mapDepth3Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
11057       if (mdepth == 4)
11058         h_mapDepth4Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
11059       if (mdepth == 5)
11060         h_mapDepth5Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
11061       if (mdepth == 6)
11062         h_mapDepth6Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
11063       if (mdepth == 7)
11064         h_mapDepth7Amplitude_HE->Fill(double(ieta), double(iphi), rmsamplitude);
11065       if (amplitude > forallestimators_amplitude_bigger_)
11066         sumEstimator4[sub - 1][mdepth - 1][ieta + 41][iphi] += rmsamplitude;
11067     }  //if(studyRMSshapeHist_)
11068     ///////////////////////////////
11069 
11070     //   //   //   //   //   //   //   //   //  HE  QIE11     Ratio:
11071     if (studyRatioShapeHist_) {
11072       h_Ampl_HE->Fill(ratio, 1.);
11073       if (ratio < ratioHEMin_ || ratio > ratioHEMax_) {
11074         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 1)
11075           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
11076         if (mdepth == 1)
11077           h_mapDepth1Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
11078         if (mdepth == 2)
11079           h_mapDepth2Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
11080         if (mdepth == 3)
11081           h_mapDepth3Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
11082         if (mdepth == 4)
11083           h_mapDepth4Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
11084         if (mdepth == 5)
11085           h_mapDepth5Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
11086         if (mdepth == 6)
11087           h_mapDepth6Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
11088         if (mdepth == 7)
11089           h_mapDepth7Ampl047_HE->Fill(double(ieta), double(iphi), 1.);
11090       }
11091       // for averaged values:
11092       if (mdepth == 1)
11093         h_mapDepth1Ampl_HE->Fill(double(ieta), double(iphi), ratio);
11094       if (mdepth == 2)
11095         h_mapDepth2Ampl_HE->Fill(double(ieta), double(iphi), ratio);
11096       if (mdepth == 3)
11097         h_mapDepth3Ampl_HE->Fill(double(ieta), double(iphi), ratio);
11098       if (mdepth == 4)
11099         h_mapDepth4Ampl_HE->Fill(double(ieta), double(iphi), ratio);
11100       if (mdepth == 5)
11101         h_mapDepth5Ampl_HE->Fill(double(ieta), double(iphi), ratio);
11102       if (mdepth == 6)
11103         h_mapDepth6Ampl_HE->Fill(double(ieta), double(iphi), ratio);
11104       if (mdepth == 7)
11105         h_mapDepth7Ampl_HE->Fill(double(ieta), double(iphi), ratio);
11106       if (amplitude > forallestimators_amplitude_bigger_)
11107         sumEstimator5[sub - 1][mdepth - 1][ieta + 41][iphi] += ratio;
11108     }  //if(studyRatioShapeHist_)
11109     ///////////////////////////////
11110     //   //   //   //   //   //   //   //   //  HE   QIE11    DiffAmplitude:
11111     if (studyDiffAmplHist_) {
11112       if (mdepth == 1)
11113         h_mapDepth1AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
11114       if (mdepth == 2)
11115         h_mapDepth2AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
11116       if (mdepth == 3)
11117         h_mapDepth3AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
11118       if (mdepth == 4)
11119         h_mapDepth4AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
11120       if (mdepth == 5)
11121         h_mapDepth5AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
11122       if (mdepth == 6)
11123         h_mapDepth6AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
11124       if (mdepth == 7)
11125         h_mapDepth7AmplE34_HE->Fill(double(ieta), double(iphi), amplitude);
11126     }  // if(studyDiffAmplHist_)
11127     ///////////////////////////////    for HE All QIE11
11128     if (mdepth == 1)
11129       h_mapDepth1_HE->Fill(double(ieta), double(iphi), 1.);
11130     if (mdepth == 2)
11131       h_mapDepth2_HE->Fill(double(ieta), double(iphi), 1.);
11132     if (mdepth == 3)
11133       h_mapDepth3_HE->Fill(double(ieta), double(iphi), 1.);
11134     if (mdepth == 4)
11135       h_mapDepth4_HE->Fill(double(ieta), double(iphi), 1.);
11136     if (mdepth == 5)
11137       h_mapDepth5_HE->Fill(double(ieta), double(iphi), 1.);
11138     if (mdepth == 6)
11139       h_mapDepth6_HE->Fill(double(ieta), double(iphi), 1.);
11140     if (mdepth == 7)
11141       h_mapDepth7_HE->Fill(double(ieta), double(iphi), 1.);
11142 
11143     if (flagTS2 == 1) {
11144       if (mdepth == 1)
11145         h_mapDepth1TS2_HE->Fill(double(ieta), double(iphi), 1.);
11146       if (mdepth == 2)
11147         h_mapDepth2TS2_HE->Fill(double(ieta), double(iphi), 1.);
11148       if (mdepth == 3)
11149         h_mapDepth3TS2_HE->Fill(double(ieta), double(iphi), 1.);
11150       if (mdepth == 4)
11151         h_mapDepth4TS2_HE->Fill(double(ieta), double(iphi), 1.);
11152       if (mdepth == 5)
11153         h_mapDepth5TS2_HE->Fill(double(ieta), double(iphi), 1.);
11154       if (mdepth == 6)
11155         h_mapDepth6TS2_HE->Fill(double(ieta), double(iphi), 1.);
11156       if (mdepth == 7)
11157         h_mapDepth7TS2_HE->Fill(double(ieta), double(iphi), 1.);
11158     }  // select entries only in TS=2
11159 
11160   }  //if ( sub == 2 )
11161   //
11162 }
11163 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
11164 void CMTRawAnalyzer::fillDigiAmplitudeHF(HFDigiCollection::const_iterator& digiItr) {
11165   CaloSamples toolOriginal;  // TS
11166   double tool[100];
11167   HcalDetId cell(digiItr->id());
11168   int mdepth = cell.depth();
11169   int iphi = cell.iphi() - 1;  // 0-71
11170   int ieta = cell.ieta();
11171   if (ieta > 0)
11172     ieta -= 1;              //-41 +41
11173   int sub = cell.subdet();  // (HFDigiCollection: 4-HF)
11174   const HcalPedestal* pedestal00 = conditions->getPedestal(cell);
11175   const HcalGain* gain = conditions->getGain(cell);
11176   const HcalRespCorr* respcorr = conditions->getHcalRespCorr(cell);
11177   const HcalTimeCorr* timecorr = conditions->getHcalTimeCorr(cell);
11178   const HcalLUTCorr* lutcorr = conditions->getHcalLUTCorr(cell);
11179   const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
11180   const HcalPedestalWidth* pedw = conditions->getPedestalWidth(cell);
11181   HcalCoderDb coder(*channelCoder, *shape);
11182   if (useADCfC_)
11183     coder.adc2fC(*digiItr, toolOriginal);
11184   double pedestalaver9 = 0.;
11185   double pedestalaver4 = 0.;
11186   double pedestal0 = 0.;
11187   double pedestal1 = 0.;
11188   double pedestal2 = 0.;
11189   double pedestal3 = 0.;
11190   double pedestalwaver9 = 0.;
11191   double pedestalwaver4 = 0.;
11192   double pedestalw0 = 0.;
11193   double pedestalw1 = 0.;
11194   double pedestalw2 = 0.;
11195   double pedestalw3 = 0.;
11196   double amplitude = 0.;
11197   double absamplitude = 0.;
11198   double ampl = 0.;
11199   double timew = 0.;
11200   double timeww = 0.;
11201   double max_signal = -100.;
11202   int ts_with_max_signal = -100;
11203   int c0 = 0;
11204   int c1 = 0;
11205   int c2 = 0;
11206   int c3 = 0;
11207   int c4 = 0;
11208   double errorBtype = 0.;
11209   int TSsize = 4;  // HF for Run2
11210   if ((*digiItr).size() != TSsize)
11211     errorBtype = 1.;
11212   TSsize = digiItr->size();
11213   for (int ii = 0; ii < TSsize; ii++) {
11214     //  for (int ii=0; ii<digiItr->size(); ii++) {
11215     double ampldefault = 0.;
11216     double ampldefault0 = 0.;
11217     double ampldefault1 = 0.;
11218     double ampldefault2 = 0.;
11219     ampldefault0 = adc2fC[digiItr->sample(ii).adc()];  // massive
11220     if (useADCfC_)
11221       ampldefault1 = toolOriginal[ii];    //adcfC
11222     ampldefault2 = (*digiItr)[ii].adc();  //ADCcounts
11223     if (useADCmassive_) {
11224       ampldefault = ampldefault0;
11225     }
11226     if (useADCfC_) {
11227       ampldefault = ampldefault1;
11228     }
11229     if (useADCcounts_) {
11230       ampldefault = ampldefault2;
11231     }
11232 
11233     int capid = ((*digiItr)[ii]).capid();
11234     //      double pedestal = calib.pedestal(capid);
11235     double pedestal = pedestal00->getValue(capid);
11236     double pedestalw = pedw->getSigma(capid, capid);
11237     if (usePedestalSubtraction_)
11238       ampldefault -= pedestal;  // pedestal subtraction
11239 
11240     tool[ii] = ampldefault;
11241 
11242     pedestalaver9 += pedestal;
11243     pedestalwaver9 += pedestalw * pedestalw;
11244 
11245     if (capid == 0 && c0 == 0) {
11246       c0++;
11247       c4++;
11248       pedestalaver4 += pedestal;
11249       pedestal0 = pedestal;
11250       pedestalw0 = pedestalw;
11251       pedestalwaver4 += pedestalw * pedestalw;
11252     }
11253 
11254     if (capid == 1 && c1 == 0) {
11255       c1++;
11256       c4++;
11257       pedestalaver4 += pedestal;
11258       pedestal1 = pedestal;
11259       pedestalw1 = pedestalw;
11260       pedestalwaver4 += pedestalw * pedestalw;
11261     }
11262     if (capid == 2 && c2 == 0) {
11263       c2++;
11264       c4++;
11265       pedestalaver4 += pedestal;
11266       pedestal2 = pedestal;
11267       pedestalw2 = pedestalw;
11268       pedestalwaver4 += pedestalw * pedestalw;
11269     }
11270     if (capid == 3 && c3 == 0) {
11271       c3++;
11272       c4++;
11273       pedestalaver4 += pedestal;
11274       pedestal3 = pedestal;
11275       pedestalw3 = pedestalw;
11276       pedestalwaver4 += pedestalw * pedestalw;
11277     }
11278 
11279     if (max_signal < ampldefault) {
11280       max_signal = ampldefault;
11281       ts_with_max_signal = ii;
11282     }
11283     amplitude += ampldefault;          //
11284     absamplitude += abs(ampldefault);  //
11285     ///////////////////////////////////
11286 
11287     if (flagcpuoptimization_ == 0) {
11288     }  //  if(flagcpuoptimization_== 0
11289     timew += (ii + 1) * abs(ampldefault);
11290     timeww += (ii + 1) * ampldefault;
11291   }  //for 1
11292   /////////////////////////////////////////////////////////////////////////////////////////////////////fillDigiAmplitudeHF
11293   // sub=4 HF
11294   if (sub == 4) {
11295     amplitudechannel0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;                 // 0-neta ; 0-71 HF
11296     amplitudechannel[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;           // 0-neta ; 0-71 HF
11297     amplitudechannel2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(amplitude, 2);  // 0-neta ; 0-71 HF
11298   }
11299 
11300   pedestalaver9 /= TSsize;
11301   pedestalaver4 /= c4;
11302   pedestalwaver9 = sqrt(pedestalwaver9 / TSsize);
11303   pedestalwaver4 = sqrt(pedestalwaver4 / c4);
11304 
11305   // ------------ to get signal in TS: -2 max +1  ------------
11306   if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
11307     ampl = tool[ts_with_max_signal];
11308   if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
11309     ampl += tool[ts_with_max_signal + 2];
11310   if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
11311     ampl += tool[ts_with_max_signal + 1];
11312   if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
11313     ampl += tool[ts_with_max_signal - 1];
11314 
11315   double ratio = 0.;
11316   //    if(amplallTS != 0.) ratio = ampl/amplallTS;
11317   if (amplitude != 0.)
11318     ratio = ampl / amplitude;
11319 
11320   if (ratio < 0. || ratio > 1.02)
11321     ratio = 0.;
11322 
11323   double aveamplitude = 0.;
11324   double aveamplitudew = 0.;
11325   if (absamplitude > 0 && timew > 0)
11326     aveamplitude = timew / absamplitude;  // average_TS +1
11327   if (amplitude > 0 && timeww > 0)
11328     aveamplitudew = timeww / amplitude;  // average_TS +1
11329 
11330   double rmsamp = 0.;
11331   // and CapIdErrors:
11332   int error = 0;
11333   bool anycapid = true;
11334   bool anyer = false;
11335   bool anydv = true;
11336   int lastcapid = 0;
11337   int capid = 0;
11338   for (int ii = 0; ii < TSsize; ii++) {
11339     double aaaaaa = (ii + 1) - aveamplitudew;
11340     double aaaaaa2 = aaaaaa * aaaaaa;
11341     double ampldefault = tool[ii];
11342     rmsamp += (aaaaaa2 * ampldefault);  // fC
11343     capid = ((*digiItr)[ii]).capid();
11344     bool er = (*digiItr)[ii].er();  // error
11345     bool dv = (*digiItr)[ii].dv();  // valid data
11346     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
11347       anycapid = false;
11348     }
11349     //    std::cout << " ii = " << ii  << " capid = " << capid  << " ((lastcapid+1)%4) = " << ((lastcapid+1)%4)  << std::endl;
11350     lastcapid = capid;
11351     if (er) {
11352       anyer = true;
11353     }
11354     if (!dv) {
11355       anydv = false;
11356     }
11357   }  //for 2
11358 
11359   if (!anycapid || anyer || !anydv)
11360     error = 1;
11361   double rmsamplitude = 0.;
11362   if ((amplitude > 0 && rmsamp > 0) || (amplitude < 0 && rmsamp < 0))
11363     rmsamplitude = sqrt(rmsamp / amplitude);
11364   double aveamplitude1 = aveamplitude - 1;  // means iTS=0-9, so bad is iTS=0 and 9
11365   if (error == 1) {
11366     if (sub == 4 && mdepth == 1)
11367       h_Amplitude_forCapIdErrors_HF1->Fill(amplitude, 1.);
11368     if (sub == 4 && mdepth == 2)
11369       h_Amplitude_forCapIdErrors_HF2->Fill(amplitude, 1.);
11370   }
11371   if (error != 1) {
11372     if (sub == 4 && mdepth == 1)
11373       h_Amplitude_notCapIdErrors_HF1->Fill(amplitude, 1.);
11374     if (sub == 4 && mdepth == 2)
11375       h_Amplitude_notCapIdErrors_HF2->Fill(amplitude, 1.);
11376   }
11377 
11378   if (sub == 4) {
11379     // bad_channels with C,A,W,P,pW,
11380     if (error == 1 || amplitude < ADCAmplHFMin_ || amplitude > ADCAmplHFMax_ || rmsamplitude < rmsHFMin_ ||
11381         rmsamplitude > rmsHFMax_ || pedestal0 < pedestalHFMax_ || pedestal1 < pedestalHFMax_ ||
11382         pedestal2 < pedestalHFMax_ || pedestal3 < pedestalHFMax_ || pedestalw0 < pedestalwHFMax_ ||
11383         pedestalw1 < pedestalwHFMax_ || pedestalw2 < pedestalwHFMax_ || pedestalw3 < pedestalwHFMax_
11384 
11385     ) {
11386       for (int ii = 0; ii < TSsize; ii++) {
11387         double ampldefault = tool[ii];
11388         h_shape_bad_channels_HF->Fill(float(ii), ampldefault);
11389         h_shape0_bad_channels_HF->Fill(float(ii), 1.);
11390       }
11391     }
11392     // good_channels with C,A,W,P,pW,
11393     else {
11394       for (int ii = 0; ii < TSsize; ii++) {
11395         double ampldefault = tool[ii];
11396         h_shape_good_channels_HF->Fill(float(ii), ampldefault);
11397         h_shape0_good_channels_HF->Fill(float(ii), 1.);
11398       }
11399     }
11400   }  // sub   HF
11401   ///////////////////////////////////////Digis : over all digiHits
11402   sum0Estimator[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
11403   sumEstimator6[sub - 1][mdepth - 1][ieta + 41][iphi] += errorBtype;
11404   sumEstimator0[sub - 1][mdepth - 1][ieta + 41][iphi] += pedestal0;  //    Pedestals
11405   // HF
11406   if (sub == 4) {
11407     //   //   //   //   //   //   //   //   //  HF      PedestalCorrelations :
11408     if (studyPedestalCorrelations_) {
11409       double mypedestal = pedestal0;
11410       double mypedestalw = pedestalw0;
11411       h2_pedvsampl_HF->Fill(mypedestal, amplitude);
11412       h2_pedwvsampl_HF->Fill(mypedestalw, amplitude);
11413       h_pedvsampl_HF->Fill(mypedestal, amplitude);
11414       h_pedwvsampl_HF->Fill(mypedestalw, amplitude);
11415       h_pedvsampl0_HF->Fill(mypedestal, 1.);
11416       h_pedwvsampl0_HF->Fill(mypedestalw, 1.);
11417     }  //
11418     //   //   //   //   //   //   //   //   //  HF       Pedestals:
11419     if (studyPedestalsHist_) {
11420       h_pedestal0_HF->Fill(pedestal0, 1.);
11421       h_pedestal1_HF->Fill(pedestal1, 1.);
11422       h_pedestal2_HF->Fill(pedestal2, 1.);
11423       h_pedestal3_HF->Fill(pedestal3, 1.);
11424       h_pedestalaver4_HF->Fill(pedestalaver4, 1.);
11425       h_pedestalaver9_HF->Fill(pedestalaver9, 1.);
11426       h_pedestalw0_HF->Fill(pedestalw0, 1.);
11427       h_pedestalw1_HF->Fill(pedestalw1, 1.);
11428       h_pedestalw2_HF->Fill(pedestalw2, 1.);
11429       h_pedestalw3_HF->Fill(pedestalw3, 1.);
11430       h_pedestalwaver4_HF->Fill(pedestalwaver4, 1.);
11431       h_pedestalwaver9_HF->Fill(pedestalwaver9, 1.);
11432       // for averaged values:
11433       if (mdepth == 1) {
11434         h_mapDepth1Ped0_HF->Fill(double(ieta), double(iphi), pedestal0);
11435         h_mapDepth1Ped1_HF->Fill(double(ieta), double(iphi), pedestal1);
11436         h_mapDepth1Ped2_HF->Fill(double(ieta), double(iphi), pedestal2);
11437         h_mapDepth1Ped3_HF->Fill(double(ieta), double(iphi), pedestal3);
11438         h_mapDepth1Pedw0_HF->Fill(double(ieta), double(iphi), pedestalw0);
11439         h_mapDepth1Pedw1_HF->Fill(double(ieta), double(iphi), pedestalw1);
11440         h_mapDepth1Pedw2_HF->Fill(double(ieta), double(iphi), pedestalw2);
11441         h_mapDepth1Pedw3_HF->Fill(double(ieta), double(iphi), pedestalw3);
11442       }
11443       if (mdepth == 2) {
11444         h_mapDepth2Ped0_HF->Fill(double(ieta), double(iphi), pedestal0);
11445         h_mapDepth2Ped1_HF->Fill(double(ieta), double(iphi), pedestal1);
11446         h_mapDepth2Ped2_HF->Fill(double(ieta), double(iphi), pedestal2);
11447         h_mapDepth2Ped3_HF->Fill(double(ieta), double(iphi), pedestal3);
11448         h_mapDepth2Pedw0_HF->Fill(double(ieta), double(iphi), pedestalw0);
11449         h_mapDepth2Pedw1_HF->Fill(double(ieta), double(iphi), pedestalw1);
11450         h_mapDepth2Pedw2_HF->Fill(double(ieta), double(iphi), pedestalw2);
11451         h_mapDepth2Pedw3_HF->Fill(double(ieta), double(iphi), pedestalw3);
11452       }
11453 
11454       if (pedestalw0 < pedestalwHFMax_ || pedestalw1 < pedestalwHFMax_ || pedestalw2 < pedestalwHFMax_ ||
11455           pedestalw3 < pedestalwHFMax_) {
11456         if (mdepth == 1)
11457           h_mapDepth1pedestalw_HF->Fill(double(ieta), double(iphi), 1.);
11458         if (mdepth == 2)
11459           h_mapDepth2pedestalw_HF->Fill(double(ieta), double(iphi), 1.);
11460       }
11461 
11462       if (pedestal0 < pedestalHFMax_ || pedestal1 < pedestalHFMax_ || pedestal2 < pedestalHFMax_ ||
11463           pedestal3 < pedestalHFMax_) {
11464         if (mdepth == 1)
11465           h_mapDepth1pedestal_HF->Fill(double(ieta), double(iphi), 1.);
11466         if (mdepth == 2)
11467           h_mapDepth2pedestal_HF->Fill(double(ieta), double(iphi), 1.);
11468       }
11469 
11470       for (int ii = 0; ii < TSsize; ii++) {
11471         h_pedestal00_HF->Fill(pedestal00->getValue(ii), 1.);
11472         h_gain_HF->Fill(gain->getValue(ii), 1.);
11473       }
11474       h_respcorr_HF->Fill(respcorr->getValue(), 1.);
11475       h_timecorr_HF->Fill(timecorr->getValue(), 1.);
11476       h_lutcorr_HF->Fill(lutcorr->getValue(), 1.);
11477 
11478     }  //
11479 
11480     //   //   //   //   //   //   //   //   //  HF       ADCAmpl:
11481     if (studyADCAmplHist_) {
11482       h_ADCAmpl_HF->Fill(amplitude, 1.);
11483       h_ADCAmplrest1_HF->Fill(amplitude, 1.);
11484       h_ADCAmplrest6_HF->Fill(amplitude, 1.);
11485 
11486       h_ADCAmplZoom1_HF->Fill(amplitude, 1.);
11487       if (amplitude < ADCAmplHFMin_ || amplitude > ADCAmplHFMax_) {
11488         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 5)
11489           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
11490         if (mdepth == 1)
11491           h_mapDepth1ADCAmpl225_HF->Fill(double(ieta), double(iphi), 1.);
11492         if (mdepth == 2)
11493           h_mapDepth2ADCAmpl225_HF->Fill(double(ieta), double(iphi), 1.);
11494       }  // if
11495       //    if(amplitude >1500.) averSIGNALoccupancy_HF += 1.;
11496       if (amplitude < 20.) {
11497         if (mdepth == 1)
11498           h_mapDepth1ADCAmpl225Copy_HF->Fill(double(ieta), double(iphi), 1.);
11499         if (mdepth == 2)
11500           h_mapDepth2ADCAmpl225Copy_HF->Fill(double(ieta), double(iphi), 1.);
11501       }  // if
11502 
11503       // for averaged values:
11504       if (mdepth == 1)
11505         h_mapDepth1ADCAmpl_HF->Fill(double(ieta), double(iphi), amplitude);
11506       if (mdepth == 2)
11507         h_mapDepth2ADCAmpl_HF->Fill(double(ieta), double(iphi), amplitude);
11508       if (mdepth == 1)
11509         h_mapDepth1ADCAmpl12_HF->Fill(double(ieta), double(iphi), ampl);
11510       if (mdepth == 2)
11511         h_mapDepth2ADCAmpl12_HF->Fill(double(ieta), double(iphi), ampl);
11512 
11513       h_bcnvsamplitude_HF->Fill(float(bcn), amplitude);
11514       h_bcnvsamplitude0_HF->Fill(float(bcn), 1.);
11515       h_orbitNumvsamplitude_HF->Fill(float(orbitNum), amplitude);
11516       h_orbitNumvsamplitude0_HF->Fill(float(orbitNum), 1.);
11517       if (amplitude > forallestimators_amplitude_bigger_)
11518         sumEstimator1[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;
11519     }  //if(studyADCAmplHist_
11520     ///////////////////////////////
11521 
11522     //   //   //   //   //   //   //   //   //  HF       TSmean:
11523     if (studyTSmeanShapeHist_) {
11524       h_TSmeanA_HF->Fill(aveamplitude1, 1.);
11525       //    h2_TSnVsAyear2023_HF->Fill(25.*aveamplitude1, amplitude);
11526       h2_TSnVsAyear2023_HF->Fill(amplitude, 25. * aveamplitude1);
11527       h1_TSnVsAyear2023_HF->Fill(amplitude, 25. * aveamplitude1);
11528       h1_TSnVsAyear20230_HF->Fill(amplitude, 1.);
11529       if (aveamplitude1 < TSmeanHFMin_ || aveamplitude1 > TSmeanHFMax_) {
11530         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 4)
11531           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
11532         if (mdepth == 1)
11533           h_mapDepth1TSmeanA225_HF->Fill(double(ieta), double(iphi), 1.);
11534         if (mdepth == 2)
11535           h_mapDepth2TSmeanA225_HF->Fill(double(ieta), double(iphi), 1.);
11536       }  // if
11537       // for averaged values:
11538       if (mdepth == 1)
11539         h_mapDepth1TSmeanA_HF->Fill(double(ieta), double(iphi), aveamplitude1);
11540       if (mdepth == 2)
11541         h_mapDepth2TSmeanA_HF->Fill(double(ieta), double(iphi), aveamplitude1);
11542 
11543       if (amplitude > forallestimators_amplitude_bigger_)
11544         sumEstimator2[sub - 1][mdepth - 1][ieta + 41][iphi] += aveamplitude1;
11545     }  //if(studyTSmeanShapeHist_
11546     ///////////////////////////////
11547     //   //   //   //   //   //   //   //   //  HF       TSmax:
11548     if (studyTSmaxShapeHist_) {
11549       h_TSmaxA_HF->Fill(float(ts_with_max_signal), 1.);
11550       if (ts_with_max_signal < TSpeakHFMin_ || ts_with_max_signal > TSpeakHFMax_) {
11551         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 3)
11552           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
11553         if (mdepth == 1)
11554           h_mapDepth1TSmaxA225_HF->Fill(double(ieta), double(iphi), 1.);
11555         if (mdepth == 2)
11556           h_mapDepth2TSmaxA225_HF->Fill(double(ieta), double(iphi), 1.);
11557       }  // if
11558       // for averaged values:
11559       if (mdepth == 1)
11560         h_mapDepth1TSmaxA_HF->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11561       if (mdepth == 2)
11562         h_mapDepth2TSmaxA_HF->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
11563       if (amplitude > forallestimators_amplitude_bigger_)
11564         sumEstimator3[sub - 1][mdepth - 1][ieta + 41][iphi] += float(ts_with_max_signal);
11565     }  //if(studyTSmaxShapeHist_
11566     ///////////////////////////////
11567     //   //   //   //   //   //   //   //   //  HF       RMS:
11568     if (studyRMSshapeHist_) {
11569       h_Amplitude_HF->Fill(rmsamplitude, 1.);
11570       if (rmsamplitude < rmsHFMin_ || rmsamplitude > rmsHFMax_) {
11571         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 2)
11572           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
11573         if (mdepth == 1)
11574           h_mapDepth1Amplitude225_HF->Fill(double(ieta), double(iphi), 1.);
11575         if (mdepth == 2)
11576           h_mapDepth2Amplitude225_HF->Fill(double(ieta), double(iphi), 1.);
11577       }  // if
11578       // for averaged values:
11579       if (mdepth == 1)
11580         h_mapDepth1Amplitude_HF->Fill(double(ieta), double(iphi), rmsamplitude);
11581       if (mdepth == 2)
11582         h_mapDepth2Amplitude_HF->Fill(double(ieta), double(iphi), rmsamplitude);
11583       if (amplitude > forallestimators_amplitude_bigger_)
11584         sumEstimator4[sub - 1][mdepth - 1][ieta + 41][iphi] += rmsamplitude;
11585     }  //if(studyRMSshapeHist_)
11586     ///////////////////////////////
11587     //   //   //   //   //   //   //   //   //  HF       Ratio:
11588     if (studyRatioShapeHist_) {
11589       h_Ampl_HF->Fill(ratio, 1.);
11590       if (ratio < ratioHFMin_ || ratio > ratioHFMax_) {
11591         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 1)
11592           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
11593         if (mdepth == 1)
11594           h_mapDepth1Ampl047_HF->Fill(double(ieta), double(iphi), 1.);
11595         if (mdepth == 2)
11596           h_mapDepth2Ampl047_HF->Fill(double(ieta), double(iphi), 1.);
11597       }  //if(ratio
11598       // for averaged values:
11599       if (mdepth == 1)
11600         h_mapDepth1Ampl_HF->Fill(double(ieta), double(iphi), ratio);
11601       if (mdepth == 2)
11602         h_mapDepth2Ampl_HF->Fill(double(ieta), double(iphi), ratio);
11603 
11604       if (amplitude > forallestimators_amplitude_bigger_)
11605         sumEstimator5[sub - 1][mdepth - 1][ieta + 41][iphi] += ratio;
11606     }  //if(studyRatioShapeHist_)
11607 
11608     ///////////////////////////////
11609     //   //   //   //   //   //   //   //   //  HF      DiffAmplitude:
11610     if (studyDiffAmplHist_) {
11611       if (mdepth == 1)
11612         h_mapDepth1AmplE34_HF->Fill(double(ieta), double(iphi), amplitude);
11613       if (mdepth == 2)
11614         h_mapDepth2AmplE34_HF->Fill(double(ieta), double(iphi), amplitude);
11615     }  // if(studyDiffAmplHist_)
11616 
11617     ///////////////////////////////    for HF All
11618     if (mdepth == 1)
11619       h_mapDepth1_HF->Fill(double(ieta), double(iphi), 1.);
11620     if (mdepth == 2)
11621       h_mapDepth2_HF->Fill(double(ieta), double(iphi), 1.);
11622 
11623   }  //if ( sub == 4 )
11624 
11625   //
11626 }
11627 
11628 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
11629 void CMTRawAnalyzer::fillDigiAmplitudeHFQIE10(QIE10DataFrame qie10df) {
11630   CaloSamples toolOriginal;  // TS
11631   double tool[100];
11632   DetId detid = qie10df.detid();
11633   HcalDetId hcaldetid = HcalDetId(detid);
11634   int ieta = hcaldetid.ieta();
11635   if (ieta > 0)
11636     ieta -= 1;
11637   int iphi = hcaldetid.iphi() - 1;
11638   int mdepth = hcaldetid.depth();
11639   int sub = hcaldetid.subdet();  // 1-HB, 2-HE (HFQIE10DigiCollection: 4-HF)
11640   nTS = qie10df.samples();       //  ----------------------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11641   /*
11642                                   # flag   HBHE8    HBHE11   HF8   HF10  comments:
11643                                   #  0       +        +       +     +     all
11644                                   #  1       +        -       +     -     old
11645                                   #  2       -        +       -     +     new (2018)
11646                                   #  3       -        +       -     +     new w/o high depthes
11647                                   #  4       +        -       +     +     2016fall
11648                                   #  5       +        -       +     +     2016fall w/o high depthes
11649                                   #  6       +        +       -     +     2017begin
11650                                   #  7       +        +       -     +     2017begin w/o high depthes in HEonly
11651                                   #  8       +        +       -     +     2017begin w/o high depthes
11652                                   #  9       +        +       +     +     all  w/o high depthes
11653 */
11654   if (mdepth == 0 || sub != 4)
11655     return;
11656   if (mdepth > 2 && flagupgradeqie1011_ == 3)
11657     return;
11658   if (mdepth > 2 && flagupgradeqie1011_ == 5)
11659     return;
11660   if (mdepth > 2 && flagupgradeqie1011_ == 8)
11661     return;
11662   if (mdepth > 2 && flagupgradeqie1011_ == 9)
11663     return;
11664   /////////////////////////////////////////////////////////////////
11665   const HcalPedestal* pedestal00 = conditions->getPedestal(hcaldetid);
11666   const HcalGain* gain = conditions->getGain(hcaldetid);
11667   const HcalRespCorr* respcorr = conditions->getHcalRespCorr(hcaldetid);
11668   const HcalTimeCorr* timecorr = conditions->getHcalTimeCorr(hcaldetid);
11669   const HcalLUTCorr* lutcorr = conditions->getHcalLUTCorr(hcaldetid);
11670   const HcalQIECoder* channelCoder = conditions->getHcalCoder(hcaldetid);
11671   const HcalPedestalWidth* pedw = conditions->getPedestalWidth(hcaldetid);
11672   HcalCoderDb coder(*channelCoder, *shape);
11673   if (useADCfC_)
11674     coder.adc2fC(qie10df, toolOriginal);
11675   //    double noiseADC = qie10df[0].adc();
11676   /////////////////////////////////////////////////////////////////
11677   double pedestalaver9 = 0.;
11678   double pedestalaver4 = 0.;
11679   double pedestal0 = 0.;
11680   double pedestal1 = 0.;
11681   double pedestal2 = 0.;
11682   double pedestal3 = 0.;
11683   double pedestalwaver9 = 0.;
11684   double pedestalwaver4 = 0.;
11685   double pedestalw0 = 0.;
11686   double pedestalw1 = 0.;
11687   double pedestalw2 = 0.;
11688   double pedestalw3 = 0.;
11689   double amplitude = 0.;
11690   double absamplitude = 0.;
11691   double ampl = 0.;
11692   double timew = 0.;
11693   double timeww = 0.;
11694   double max_signal = -100.;
11695   int ts_with_max_signal = -100;
11696   int c0 = 0;
11697   int c1 = 0;
11698   int c2 = 0;
11699   int c3 = 0;
11700   int c4 = 0;
11701   double errorBtype = 0.;
11702 
11703   int TSsize = 3;  // HF for Run3
11704   if (nTS != TSsize)
11705     errorBtype = 1.;
11706   TSsize = nTS;  // ------------------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11707   int flagTS1 = 0;
11708   for (int ii = 0; ii < TSsize; ii++) {
11709     double ampldefault = 0.;
11710     double ampldefault0 = 0.;
11711     double ampldefault1 = 0.;
11712     double ampldefault2 = 0.;
11713     ampldefault0 = adc2fC_QIE10[qie10df[ii].adc()];  // massive
11714     if (useADCfC_)
11715       ampldefault1 = toolOriginal[ii];  //adcfC
11716     ampldefault2 = qie10df[ii].adc();   //ADCcounts
11717     if (useADCmassive_) {
11718       ampldefault = ampldefault0;
11719     }
11720     if (useADCfC_) {
11721       ampldefault = ampldefault1;
11722     }
11723     if (useADCcounts_) {
11724       ampldefault = ampldefault2;
11725     }
11726 
11727     int capid = (qie10df[ii]).capid();
11728     double pedestal = pedestal00->getValue(capid);
11729     double pedestalw = pedw->getSigma(capid, capid);
11730 
11731     if (usePedestalSubtraction_)
11732       ampldefault -= pedestal;  // pedestal subtraction
11733 
11734     tool[ii] = ampldefault;
11735 
11736     pedestalaver9 += pedestal;
11737     pedestalwaver9 += pedestalw * pedestalw;
11738 
11739     if (capid == 0 && c0 == 0) {
11740       c0++;
11741       c4++;
11742       pedestalaver4 += pedestal;
11743       pedestal0 = pedestal;
11744       pedestalw0 = pedestalw;
11745       pedestalwaver4 += pedestalw * pedestalw;
11746     }
11747 
11748     if (capid == 1 && c1 == 0) {
11749       c1++;
11750       c4++;
11751       pedestalaver4 += pedestal;
11752       pedestal1 = pedestal;
11753       pedestalw1 = pedestalw;
11754       pedestalwaver4 += pedestalw * pedestalw;
11755     }
11756     if (capid == 2 && c2 == 0) {
11757       c2++;
11758       c4++;
11759       pedestalaver4 += pedestal;
11760       pedestal2 = pedestal;
11761       pedestalw2 = pedestalw;
11762       pedestalwaver4 += pedestalw * pedestalw;
11763     }
11764     if (capid == 3 && c3 == 0) {
11765       c3++;
11766       c4++;
11767       pedestalaver4 += pedestal;
11768       pedestal3 = pedestal;
11769       pedestalw3 = pedestalw;
11770       pedestalwaver4 += pedestalw * pedestalw;
11771     }
11772 
11773     if (max_signal < ampldefault) {
11774       max_signal = ampldefault;
11775       ts_with_max_signal = ii;
11776     }
11777     amplitude += ampldefault;          //
11778     absamplitude += abs(ampldefault);  //
11779     ///////////////////////////////////
11780     timew += (ii + 1) * abs(ampldefault);
11781     timeww += (ii + 1) * ampldefault;
11782     if (ii == 1 && ampldefault > 0.)
11783       flagTS1 = 1;
11784   }  //for 1
11785   /////////////////////////////////////////////////////////////////////////////////////////////////////fillDigiAmplitudeHFQIE10
11786   // sub=4 HF
11787   if (sub == 4) {
11788     amplitudechannel0[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;                 // 0-neta ; 0-71 HF
11789     amplitudechannel[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;           // 0-neta ; 0-71 HF
11790     amplitudechannel2[sub - 1][mdepth - 1][ieta + 41][iphi] += pow(amplitude, 2);  // 0-neta ; 0-71 HF
11791   }  // just in case against any violations
11792 
11793   pedestalaver9 /= TSsize;
11794   pedestalaver4 /= c4;
11795   pedestalwaver9 = sqrt(pedestalwaver9 / TSsize);
11796   pedestalwaver4 = sqrt(pedestalwaver4 / c4);
11797 
11798   // ------------ to get signal in TS: -2 max +1  ------------
11799   if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
11800     ampl = tool[ts_with_max_signal];
11801   if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
11802     ampl += tool[ts_with_max_signal + 2];
11803   if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
11804     ampl += tool[ts_with_max_signal + 1];
11805   if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
11806     ampl += tool[ts_with_max_signal - 1];
11807 
11808   double ratio = 0.;
11809   //    if(amplallTS != 0.) ratio = ampl/amplallTS;
11810   if (amplitude != 0.)
11811     ratio = ampl / amplitude;
11812   if (ratio < 0. || ratio > 1.02)
11813     ratio = 0.;
11814   double aveamplitude = 0.;
11815   double aveamplitudew = 0.;
11816   if (absamplitude > 0 && timew > 0)
11817     aveamplitude = timew / absamplitude;  // average_TS +1
11818   if (amplitude > 0 && timeww > 0)
11819     aveamplitudew = timeww / amplitude;  // average_TS +1
11820 
11821   double rmsamp = 0.;
11822   int error = 0;
11823   bool anycapid = true;
11824   int lastcapid = 0;
11825   int capid = 0;
11826   for (int ii = 0; ii < TSsize; ii++) {
11827     double aaaaaa = (ii + 1) - aveamplitudew;
11828     double aaaaaa2 = aaaaaa * aaaaaa;
11829     double ampldefault = tool[ii];
11830     rmsamp += (aaaaaa2 * ampldefault);  // fC
11831     capid = (qie10df[ii]).capid();
11832     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
11833       anycapid = false;
11834     }
11835     lastcapid = capid;
11836   }  //for 2
11837 
11838   if (!anycapid)
11839     error = 1;
11840   double rmsamplitude = 0.;
11841   if ((amplitude > 0 && rmsamp > 0) || (amplitude < 0 && rmsamp < 0))
11842     rmsamplitude = sqrt(rmsamp / amplitude);
11843   double aveamplitude1 = aveamplitude - 1;  // means iTS=0-9, so bad is iTS=0 and 9
11844 
11845   // CapIdErrors end  /////////////////////////////////////////////////////////
11846   // AZ 1.10.2015:
11847   if (error == 1) {
11848     if (sub == 4 && mdepth == 1)
11849       h_Amplitude_forCapIdErrors_HF1->Fill(amplitude, 1.);
11850     if (sub == 4 && mdepth == 2)
11851       h_Amplitude_forCapIdErrors_HF2->Fill(amplitude, 1.);
11852   }
11853   if (error != 1) {
11854     if (sub == 4 && mdepth == 1)
11855       h_Amplitude_notCapIdErrors_HF1->Fill(amplitude, 1.);
11856     if (sub == 4 && mdepth == 2)
11857       h_Amplitude_notCapIdErrors_HF2->Fill(amplitude, 1.);
11858   }
11859 
11860   if (sub == 4) {
11861     // bad_channels with C,A,W,P,pW,
11862     if (error == 1 || amplitude < ADCAmplHFMin_ || amplitude > ADCAmplHFMax_ || rmsamplitude < rmsHFMin_ ||
11863         rmsamplitude > rmsHFMax_ || pedestal0 < pedestalHFMax_ || pedestal1 < pedestalHFMax_ ||
11864         pedestal2 < pedestalHFMax_ || pedestal3 < pedestalHFMax_ || pedestalw0 < pedestalwHFMax_ ||
11865         pedestalw1 < pedestalwHFMax_ || pedestalw2 < pedestalwHFMax_ || pedestalw3 < pedestalwHFMax_
11866 
11867     ) {
11868       for (int ii = 0; ii < TSsize; ii++) {
11869         double ampldefault = tool[ii];
11870         h_shape_bad_channels_HF->Fill(float(ii), ampldefault);
11871         h_shape0_bad_channels_HF->Fill(float(ii), 1.);
11872       }
11873     }
11874     // good_channels with C,A,W,P,pW,
11875     else {
11876       for (int ii = 0; ii < TSsize; ii++) {
11877         double ampldefault = tool[ii];
11878         h_shape_good_channels_HF->Fill(float(ii), ampldefault);
11879         h_shape0_good_channels_HF->Fill(float(ii), 1.);
11880       }
11881     }
11882   }  // sub   HFQIE10
11883   ///////////////////////////////////////Digis : over all digiHits
11884   sum0Estimator[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
11885   //      for Error B-type
11886   sumEstimator6[sub - 1][mdepth - 1][ieta + 41][iphi] += errorBtype;
11887   sumEstimator0[sub - 1][mdepth - 1][ieta + 41][iphi] += pedestal0;  //    Pedestals
11888   // HFQIE10
11889   if (sub == 4) {
11890     //   //   //   //   //   //   //   //   //  HFQIE10      PedestalCorrelations :
11891     if (studyPedestalCorrelations_) {
11892       double mypedestal = pedestal0;
11893       double mypedestalw = pedestalw0;
11894       h2_pedvsampl_HF->Fill(mypedestal, amplitude);
11895       h2_pedwvsampl_HF->Fill(mypedestalw, amplitude);
11896       h_pedvsampl_HF->Fill(mypedestal, amplitude);
11897       h_pedwvsampl_HF->Fill(mypedestalw, amplitude);
11898       h_pedvsampl0_HF->Fill(mypedestal, 1.);
11899       h_pedwvsampl0_HF->Fill(mypedestalw, 1.);
11900     }  //
11901     //   //   //   //   //   //   //   //   //  HFQIE10       Pedestals:
11902     if (studyPedestalsHist_) {
11903       h_pedestal0_HF->Fill(pedestal0, 1.);
11904       h_pedestal1_HF->Fill(pedestal1, 1.);
11905       h_pedestal2_HF->Fill(pedestal2, 1.);
11906       h_pedestal3_HF->Fill(pedestal3, 1.);
11907       h_pedestalaver4_HF->Fill(pedestalaver4, 1.);
11908       h_pedestalaver9_HF->Fill(pedestalaver9, 1.);
11909       h_pedestalw0_HF->Fill(pedestalw0, 1.);
11910       h_pedestalw1_HF->Fill(pedestalw1, 1.);
11911       h_pedestalw2_HF->Fill(pedestalw2, 1.);
11912       h_pedestalw3_HF->Fill(pedestalw3, 1.);
11913       h_pedestalwaver4_HF->Fill(pedestalwaver4, 1.);
11914       h_pedestalwaver9_HF->Fill(pedestalwaver9, 1.);
11915       // for averaged values:
11916       if (mdepth == 1) {
11917         h_mapDepth1Ped0_HF->Fill(double(ieta), double(iphi), pedestal0);
11918         h_mapDepth1Ped1_HF->Fill(double(ieta), double(iphi), pedestal1);
11919         h_mapDepth1Ped2_HF->Fill(double(ieta), double(iphi), pedestal2);
11920         h_mapDepth1Ped3_HF->Fill(double(ieta), double(iphi), pedestal3);
11921         h_mapDepth1Pedw0_HF->Fill(double(ieta), double(iphi), pedestalw0);
11922         h_mapDepth1Pedw1_HF->Fill(double(ieta), double(iphi), pedestalw1);
11923         h_mapDepth1Pedw2_HF->Fill(double(ieta), double(iphi), pedestalw2);
11924         h_mapDepth1Pedw3_HF->Fill(double(ieta), double(iphi), pedestalw3);
11925       }
11926       if (mdepth == 2) {
11927         h_mapDepth2Ped0_HF->Fill(double(ieta), double(iphi), pedestal0);
11928         h_mapDepth2Ped1_HF->Fill(double(ieta), double(iphi), pedestal1);
11929         h_mapDepth2Ped2_HF->Fill(double(ieta), double(iphi), pedestal2);
11930         h_mapDepth2Ped3_HF->Fill(double(ieta), double(iphi), pedestal3);
11931         h_mapDepth2Pedw0_HF->Fill(double(ieta), double(iphi), pedestalw0);
11932         h_mapDepth2Pedw1_HF->Fill(double(ieta), double(iphi), pedestalw1);
11933         h_mapDepth2Pedw2_HF->Fill(double(ieta), double(iphi), pedestalw2);
11934         h_mapDepth2Pedw3_HF->Fill(double(ieta), double(iphi), pedestalw3);
11935       }
11936 
11937       if (pedestalw0 < pedestalwHFMax_ || pedestalw1 < pedestalwHFMax_ || pedestalw2 < pedestalwHFMax_ ||
11938           pedestalw3 < pedestalwHFMax_) {
11939         if (mdepth == 1)
11940           h_mapDepth1pedestalw_HF->Fill(double(ieta), double(iphi), 1.);
11941         if (mdepth == 2)
11942           h_mapDepth2pedestalw_HF->Fill(double(ieta), double(iphi), 1.);
11943         if (mdepth == 3)
11944           h_mapDepth3pedestalw_HF->Fill(double(ieta), double(iphi), 1.);
11945         if (mdepth == 4)
11946           h_mapDepth4pedestalw_HF->Fill(double(ieta), double(iphi), 1.);
11947       }
11948 
11949       if (pedestal0 < pedestalHFMax_ || pedestal1 < pedestalHFMax_ || pedestal2 < pedestalHFMax_ ||
11950           pedestal3 < pedestalHFMax_) {
11951         if (mdepth == 1)
11952           h_mapDepth1pedestal_HF->Fill(double(ieta), double(iphi), 1.);
11953         if (mdepth == 2)
11954           h_mapDepth2pedestal_HF->Fill(double(ieta), double(iphi), 1.);
11955         if (mdepth == 3)
11956           h_mapDepth3pedestal_HF->Fill(double(ieta), double(iphi), 1.);
11957         if (mdepth == 4)
11958           h_mapDepth4pedestal_HF->Fill(double(ieta), double(iphi), 1.);
11959       }
11960 
11961       for (int ii = 0; ii < TSsize; ii++) {
11962         h_pedestal00_HF->Fill(pedestal00->getValue(ii), 1.);
11963         h_gain_HF->Fill(gain->getValue(ii), 1.);
11964       }
11965       h_respcorr_HF->Fill(respcorr->getValue(), 1.);
11966       h_timecorr_HF->Fill(timecorr->getValue(), 1.);
11967       h_lutcorr_HF->Fill(lutcorr->getValue(), 1.);
11968 
11969     }  //
11970 
11971     //   //   //   //   //   //   //   //   //  HFQIE10       ADCAmpl:
11972     if (studyADCAmplHist_) {
11973       h_ADCAmpl_HF->Fill(amplitude, 1.);
11974       h_ADCAmplrest1_HF->Fill(amplitude, 1.);
11975       h_ADCAmplrest6_HF->Fill(amplitude, 1.);
11976 
11977       h_ADCAmplZoom1_HF->Fill(amplitude, 1.);
11978       if (amplitude < ADCAmplHFMin_ || amplitude > ADCAmplHFMax_) {
11979         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 5)
11980           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
11981         if (mdepth == 1)
11982           h_mapDepth1ADCAmpl225_HF->Fill(double(ieta), double(iphi), 1.);
11983         if (mdepth == 2)
11984           h_mapDepth2ADCAmpl225_HF->Fill(double(ieta), double(iphi), 1.);
11985         if (mdepth == 3)
11986           h_mapDepth3ADCAmpl225_HF->Fill(double(ieta), double(iphi), 1.);
11987         if (mdepth == 4)
11988           h_mapDepth4ADCAmpl225_HF->Fill(double(ieta), double(iphi), 1.);
11989       }  // if
11990       //    if(amplitude >1500.) averSIGNALoccupancy_HF += 1.;
11991       if (amplitude < 20.) {
11992         if (mdepth == 1)
11993           h_mapDepth1ADCAmpl225Copy_HF->Fill(double(ieta), double(iphi), 1.);
11994         if (mdepth == 2)
11995           h_mapDepth2ADCAmpl225Copy_HF->Fill(double(ieta), double(iphi), 1.);
11996         if (mdepth == 3)
11997           h_mapDepth3ADCAmpl225Copy_HF->Fill(double(ieta), double(iphi), 1.);
11998         if (mdepth == 4)
11999           h_mapDepth4ADCAmpl225Copy_HF->Fill(double(ieta), double(iphi), 1.);
12000       }  // if
12001 
12002       // for averaged values:
12003       if (mdepth == 1)
12004         h_mapDepth1ADCAmpl_HF->Fill(double(ieta), double(iphi), amplitude);
12005       if (mdepth == 2)
12006         h_mapDepth2ADCAmpl_HF->Fill(double(ieta), double(iphi), amplitude);
12007       if (mdepth == 3)
12008         h_mapDepth3ADCAmpl_HF->Fill(double(ieta), double(iphi), amplitude);
12009       if (mdepth == 4)
12010         h_mapDepth4ADCAmpl_HF->Fill(double(ieta), double(iphi), amplitude);
12011       if (mdepth == 1)
12012         h_mapDepth1ADCAmpl12_HF->Fill(double(ieta), double(iphi), ampl);
12013       if (mdepth == 2)
12014         h_mapDepth2ADCAmpl12_HF->Fill(double(ieta), double(iphi), ampl);
12015       if (mdepth == 3)
12016         h_mapDepth3ADCAmpl12_HF->Fill(double(ieta), double(iphi), ampl);
12017       if (mdepth == 4)
12018         h_mapDepth4ADCAmpl12_HF->Fill(double(ieta), double(iphi), ampl);
12019 
12020       h_bcnvsamplitude_HF->Fill(float(bcn), amplitude);
12021       h_bcnvsamplitude0_HF->Fill(float(bcn), 1.);
12022       h_orbitNumvsamplitude_HF->Fill(float(orbitNum), amplitude);
12023       h_orbitNumvsamplitude0_HF->Fill(float(orbitNum), 1.);
12024       if (amplitude > forallestimators_amplitude_bigger_)
12025         sumEstimator1[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;
12026     }  //if(studyADCAmplHist_
12027     //   //   //   //   //   //   //   //   //  HFQIE10       TSmean:
12028     if (studyTSmeanShapeHist_) {
12029       h_TSmeanA_HF->Fill(aveamplitude1, 1.);
12030       //    h2_TSnVsAyear2023_HF->Fill(25.*aveamplitude1, amplitude);
12031       h2_TSnVsAyear2023_HF->Fill(amplitude, 25. * aveamplitude1);
12032       h1_TSnVsAyear2023_HF->Fill(amplitude, 25. * aveamplitude1);
12033       h1_TSnVsAyear20230_HF->Fill(amplitude, 1.);
12034       if (aveamplitude1 < TSmeanHFMin_ || aveamplitude1 > TSmeanHFMax_) {
12035         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 4)
12036           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12037         if (mdepth == 1)
12038           h_mapDepth1TSmeanA225_HF->Fill(double(ieta), double(iphi), 1.);
12039         if (mdepth == 2)
12040           h_mapDepth2TSmeanA225_HF->Fill(double(ieta), double(iphi), 1.);
12041         if (mdepth == 3)
12042           h_mapDepth3TSmeanA225_HF->Fill(double(ieta), double(iphi), 1.);
12043         if (mdepth == 4)
12044           h_mapDepth4TSmeanA225_HF->Fill(double(ieta), double(iphi), 1.);
12045       }  // if
12046       // for averaged values:
12047       if (mdepth == 1)
12048         h_mapDepth1TSmeanA_HF->Fill(double(ieta), double(iphi), aveamplitude1);
12049       if (mdepth == 2)
12050         h_mapDepth2TSmeanA_HF->Fill(double(ieta), double(iphi), aveamplitude1);
12051       if (mdepth == 3)
12052         h_mapDepth3TSmeanA_HF->Fill(double(ieta), double(iphi), aveamplitude1);
12053       if (mdepth == 4)
12054         h_mapDepth4TSmeanA_HF->Fill(double(ieta), double(iphi), aveamplitude1);
12055 
12056       if (amplitude > forallestimators_amplitude_bigger_)
12057         sumEstimator2[sub - 1][mdepth - 1][ieta + 41][iphi] += aveamplitude1;
12058     }  //if(studyTSmeanShapeHist_
12059     ///////////////////////////////
12060     //   //   //   //   //   //   //   //   //  HFQIE10       TSmax:
12061     if (studyTSmaxShapeHist_) {
12062       h_TSmaxA_HF->Fill(float(ts_with_max_signal), 1.);
12063       if (ts_with_max_signal < TSpeakHFMin_ || ts_with_max_signal > TSpeakHFMax_) {
12064         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 3)
12065           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12066         if (mdepth == 1)
12067           h_mapDepth1TSmaxA225_HF->Fill(double(ieta), double(iphi), 1.);
12068         if (mdepth == 2)
12069           h_mapDepth2TSmaxA225_HF->Fill(double(ieta), double(iphi), 1.);
12070         if (mdepth == 3)
12071           h_mapDepth3TSmaxA225_HF->Fill(double(ieta), double(iphi), 1.);
12072         if (mdepth == 4)
12073           h_mapDepth4TSmaxA225_HF->Fill(double(ieta), double(iphi), 1.);
12074       }  // if
12075       // for averaged values:
12076       if (mdepth == 1)
12077         h_mapDepth1TSmaxA_HF->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
12078       if (mdepth == 2)
12079         h_mapDepth2TSmaxA_HF->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
12080       if (mdepth == 3)
12081         h_mapDepth3TSmaxA_HF->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
12082       if (mdepth == 4)
12083         h_mapDepth4TSmaxA_HF->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
12084 
12085       if (amplitude > forallestimators_amplitude_bigger_)
12086         sumEstimator3[sub - 1][mdepth - 1][ieta + 41][iphi] += float(ts_with_max_signal);
12087     }  //if(studyTSmaxShapeHist_
12088     ///////////////////////////////
12089     //   //   //   //   //   //   //   //   //  HFQIE10       RMS:
12090     if (studyRMSshapeHist_) {
12091       h_Amplitude_HF->Fill(rmsamplitude, 1.);
12092       if (rmsamplitude < rmsHFMin_ || rmsamplitude > rmsHFMax_) {
12093         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 2)
12094           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12095         if (mdepth == 1)
12096           h_mapDepth1Amplitude225_HF->Fill(double(ieta), double(iphi), 1.);
12097         if (mdepth == 2)
12098           h_mapDepth2Amplitude225_HF->Fill(double(ieta), double(iphi), 1.);
12099         if (mdepth == 3)
12100           h_mapDepth3Amplitude225_HF->Fill(double(ieta), double(iphi), 1.);
12101         if (mdepth == 4)
12102           h_mapDepth4Amplitude225_HF->Fill(double(ieta), double(iphi), 1.);
12103       }  // if
12104       // for averaged values:
12105 
12106       if (mdepth == 1)
12107         h_mapDepth1Amplitude_HF->Fill(double(ieta), double(iphi), rmsamplitude);
12108       if (mdepth == 2)
12109         h_mapDepth2Amplitude_HF->Fill(double(ieta), double(iphi), rmsamplitude);
12110       if (mdepth == 3)
12111         h_mapDepth3Amplitude_HF->Fill(double(ieta), double(iphi), rmsamplitude);
12112       if (mdepth == 4)
12113         h_mapDepth4Amplitude_HF->Fill(double(ieta), double(iphi), rmsamplitude);
12114       if (amplitude > forallestimators_amplitude_bigger_)
12115         sumEstimator4[sub - 1][mdepth - 1][ieta + 41][iphi] += rmsamplitude;
12116     }  //if(studyRMSshapeHist_)
12117     ///////////////////////////////
12118     //   //   //   //   //   //   //   //   //  HFQIE10       Ratio:
12119     if (studyRatioShapeHist_) {
12120       h_Ampl_HF->Fill(ratio, 1.);
12121       if (ratio < ratioHFMin_ || ratio > ratioHFMax_) {
12122         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 1)
12123           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12124         if (mdepth == 1)
12125           h_mapDepth1Ampl047_HF->Fill(double(ieta), double(iphi), 1.);
12126         if (mdepth == 2)
12127           h_mapDepth2Ampl047_HF->Fill(double(ieta), double(iphi), 1.);
12128         if (mdepth == 3)
12129           h_mapDepth3Ampl047_HF->Fill(double(ieta), double(iphi), 1.);
12130         if (mdepth == 4)
12131           h_mapDepth4Ampl047_HF->Fill(double(ieta), double(iphi), 1.);
12132       }  //if(ratio
12133       // for averaged values:
12134       if (mdepth == 1)
12135         h_mapDepth1Ampl_HF->Fill(double(ieta), double(iphi), ratio);
12136       if (mdepth == 2)
12137         h_mapDepth2Ampl_HF->Fill(double(ieta), double(iphi), ratio);
12138       if (mdepth == 3)
12139         h_mapDepth3Ampl_HF->Fill(double(ieta), double(iphi), ratio);
12140       if (mdepth == 4)
12141         h_mapDepth4Ampl_HF->Fill(double(ieta), double(iphi), ratio);
12142 
12143       if (amplitude > forallestimators_amplitude_bigger_)
12144         sumEstimator5[sub - 1][mdepth - 1][ieta + 41][iphi] += ratio;
12145     }  //if(studyRatioShapeHist_)
12146 
12147     ///////////////////////////////
12148     //   //   //   //   //   //   //   //   //  HFQIE10      DiffAmplitude:
12149     if (studyDiffAmplHist_) {
12150       if (mdepth == 1)
12151         h_mapDepth1AmplE34_HF->Fill(double(ieta), double(iphi), amplitude);
12152       if (mdepth == 2)
12153         h_mapDepth2AmplE34_HF->Fill(double(ieta), double(iphi), amplitude);
12154       if (mdepth == 3)
12155         h_mapDepth3AmplE34_HF->Fill(double(ieta), double(iphi), amplitude);
12156       if (mdepth == 4)
12157         h_mapDepth4AmplE34_HF->Fill(double(ieta), double(iphi), amplitude);
12158     }  // if(studyDiffAmplHist_)
12159 
12160     ///////////////////////////////    for HFQIE10 All
12161     if (mdepth == 1)
12162       h_mapDepth1_HF->Fill(double(ieta), double(iphi), 1.);
12163     if (mdepth == 2)
12164       h_mapDepth2_HF->Fill(double(ieta), double(iphi), 1.);
12165     if (mdepth == 3)
12166       h_mapDepth3_HF->Fill(double(ieta), double(iphi), 1.);
12167     if (mdepth == 4)
12168       h_mapDepth4_HF->Fill(double(ieta), double(iphi), 1.);
12169 
12170     if (flagTS1 == 1) {
12171       if (mdepth == 1)
12172         h_mapDepth1TS1_HF->Fill(double(ieta), double(iphi), 1.);
12173       if (mdepth == 2)
12174         h_mapDepth2TS1_HF->Fill(double(ieta), double(iphi), 1.);
12175       if (mdepth == 3)
12176         h_mapDepth3TS1_HF->Fill(double(ieta), double(iphi), 1.);
12177       if (mdepth == 4)
12178         h_mapDepth4TS1_HF->Fill(double(ieta), double(iphi), 1.);
12179     }  // for TS = 1
12180 
12181   }  //if ( sub == 4 )
12182 
12183   //
12184 }
12185 
12186 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
12187 void CMTRawAnalyzer::fillDigiAmplitudeHO(HODigiCollection::const_iterator& digiItr) {
12188   CaloSamples toolOriginal;  // TS
12189   double tool[100];
12190   HcalDetId cell(digiItr->id());
12191   int mdepth = cell.depth();
12192   int iphi = cell.iphi() - 1;  // 0-71
12193   int ieta = cell.ieta();
12194   if (ieta > 0)
12195     ieta -= 1;              //-41 +41
12196   int sub = cell.subdet();  // (HODigiCollection: 3-HO)
12197   const HcalPedestal* pedestal00 = conditions->getPedestal(cell);
12198   const HcalGain* gain = conditions->getGain(cell);
12199   const HcalRespCorr* respcorr = conditions->getHcalRespCorr(cell);
12200   const HcalTimeCorr* timecorr = conditions->getHcalTimeCorr(cell);
12201   const HcalLUTCorr* lutcorr = conditions->getHcalLUTCorr(cell);
12202   const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
12203   const HcalPedestalWidth* pedw = conditions->getPedestalWidth(cell);
12204   HcalCoderDb coder(*channelCoder, *shape);
12205   if (useADCfC_)
12206     coder.adc2fC(*digiItr, toolOriginal);
12207   double pedestalaver9 = 0.;
12208   double pedestalaver4 = 0.;
12209   double pedestal0 = 0.;
12210   double pedestal1 = 0.;
12211   double pedestal2 = 0.;
12212   double pedestal3 = 0.;
12213   double pedestalwaver9 = 0.;
12214   double pedestalwaver4 = 0.;
12215   double pedestalw0 = 0.;
12216   double pedestalw1 = 0.;
12217   double pedestalw2 = 0.;
12218   double pedestalw3 = 0.;
12219   double amplitude = 0.;
12220   double absamplitude = 0.;
12221   double ampl = 0.;
12222   double timew = 0.;
12223   double timeww = 0.;
12224   double max_signal = -100.;
12225   int ts_with_max_signal = -100;
12226   int c0 = 0;
12227   int c1 = 0;
12228   int c2 = 0;
12229   int c3 = 0;
12230   int c4 = 0;
12231   double errorBtype = 0.;
12232   int TSsize = 10;  //HO
12233   if ((*digiItr).size() != TSsize)
12234     errorBtype = 1.;
12235   TSsize = digiItr->size();
12236   int flagTS012 = 0;
12237   for (int ii = 0; ii < TSsize; ii++) {
12238     double ampldefault = 0.;
12239     double ampldefault0 = 0.;
12240     double ampldefault1 = 0.;
12241     double ampldefault2 = 0.;
12242     ampldefault0 = adc2fC[digiItr->sample(ii).adc()];  // massive
12243     if (useADCfC_)
12244       ampldefault1 = toolOriginal[ii];    //adcfC
12245     ampldefault2 = (*digiItr)[ii].adc();  //ADCcounts
12246     if (useADCmassive_) {
12247       ampldefault = ampldefault0;
12248     }
12249     if (useADCfC_) {
12250       ampldefault = ampldefault1;
12251     }
12252     if (useADCcounts_) {
12253       ampldefault = ampldefault2;
12254     }
12255     int capid = ((*digiItr)[ii]).capid();
12256     double pedestal = pedestal00->getValue(capid);
12257     double pedestalw = pedw->getSigma(capid, capid);
12258     if (usePedestalSubtraction_)
12259       ampldefault -= pedestal;  // pedestal subtraction
12260     tool[ii] = ampldefault;
12261     pedestalaver9 += pedestal;
12262     pedestalwaver9 += pedestalw * pedestalw;
12263     if (capid == 0 && c0 == 0) {
12264       c0++;
12265       c4++;
12266       pedestalaver4 += pedestal;
12267       pedestal0 = pedestal;
12268       pedestalw0 = pedestalw;
12269       pedestalwaver4 += pedestalw * pedestalw;
12270     }
12271     if (capid == 1 && c1 == 0) {
12272       c1++;
12273       c4++;
12274       pedestalaver4 += pedestal;
12275       pedestal1 = pedestal;
12276       pedestalw1 = pedestalw;
12277       pedestalwaver4 += pedestalw * pedestalw;
12278     }
12279     if (capid == 2 && c2 == 0) {
12280       c2++;
12281       c4++;
12282       pedestalaver4 += pedestal;
12283       pedestal2 = pedestal;
12284       pedestalw2 = pedestalw;
12285       pedestalwaver4 += pedestalw * pedestalw;
12286     }
12287     if (capid == 3 && c3 == 0) {
12288       c3++;
12289       c4++;
12290       pedestalaver4 += pedestal;
12291       pedestal3 = pedestal;
12292       pedestalw3 = pedestalw;
12293       pedestalwaver4 += pedestalw * pedestalw;
12294     }
12295 
12296     if (max_signal < ampldefault) {
12297       max_signal = ampldefault;
12298       ts_with_max_signal = ii;
12299     }
12300     amplitude += ampldefault;
12301     absamplitude += abs(ampldefault);
12302     ///////////////////////////////////////////
12303     if (flagcpuoptimization_ == 0) {
12304     }
12305     timew += (ii + 1) * abs(ampldefault);
12306     timeww += (ii + 1) * ampldefault;
12307     if (ii < 3 && ampldefault > 0.)
12308       flagTS012 = 1;
12309   }  //for 1
12310   amplitudechannel[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;  // 0-neta ; 0-71  HO
12311 
12312   pedestalaver9 /= TSsize;
12313   pedestalaver4 /= c4;
12314   pedestalwaver9 = sqrt(pedestalwaver9 / TSsize);
12315   pedestalwaver4 = sqrt(pedestalwaver4 / c4);
12316   if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
12317     ampl = tool[ts_with_max_signal];
12318   if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
12319     ampl += tool[ts_with_max_signal + 2];
12320   if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
12321     ampl += tool[ts_with_max_signal + 1];
12322   if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
12323     ampl += tool[ts_with_max_signal - 1];
12324   double ratio = 0.;
12325   if (amplitude != 0.)
12326     ratio = ampl / amplitude;
12327   if (ratio < 0. || ratio > 1.04)
12328     ratio = 0.;
12329   double aveamplitude = 0.;
12330   double aveamplitudew = 0.;
12331   if (absamplitude > 0 && timew > 0)
12332     aveamplitude = timew / absamplitude;  // average_TS +1
12333   if (amplitude > 0 && timeww > 0)
12334     aveamplitudew = timeww / amplitude;  // average_TS +1
12335   double rmsamp = 0.;
12336   int error = 0;
12337   bool anycapid = true;
12338   bool anyer = false;
12339   bool anydv = true;
12340   int lastcapid = 0;
12341   int capid = 0;
12342   for (int ii = 0; ii < TSsize; ii++) {
12343     double aaaaaa = (ii + 1) - aveamplitudew;
12344     double aaaaaa2 = aaaaaa * aaaaaa;
12345     double ampldefault = tool[ii];
12346     rmsamp += (aaaaaa2 * ampldefault);  // fC
12347     capid = ((*digiItr)[ii]).capid();
12348     bool er = (*digiItr)[ii].er();  // error
12349     bool dv = (*digiItr)[ii].dv();  // valid data
12350     if (ii != 0 && ((lastcapid + 1) % 4) != capid) {
12351       anycapid = false;
12352     }
12353     lastcapid = capid;
12354     if (er) {
12355       anyer = true;
12356     }
12357     if (!dv) {
12358       anydv = false;
12359     }
12360   }  //for 2
12361 
12362   if (!anycapid || anyer || !anydv)
12363     error = 1;
12364   double rmsamplitude = 0.;
12365   if ((amplitude > 0 && rmsamp > 0) || (amplitude < 0 && rmsamp < 0))
12366     rmsamplitude = sqrt(rmsamp / amplitude);
12367   double aveamplitude1 = aveamplitude - 1;  // means iTS=0-9, so bad is iTS=0 and 9
12368   if (error == 1) {
12369     if (sub == 3 && mdepth == 4)
12370       h_Amplitude_forCapIdErrors_HO4->Fill(amplitude, 1.);
12371   }
12372   if (error != 1) {
12373     if (sub == 3 && mdepth == 4)
12374       h_Amplitude_notCapIdErrors_HO4->Fill(amplitude, 1.);
12375   }
12376 
12377   if (sub == 3) {
12378     if (error == 1 || amplitude < ADCAmplHOMin_ || amplitude > ADCAmplHOMax_ || rmsamplitude < rmsHOMin_ ||
12379         rmsamplitude > rmsHOMax_ || pedestal0 < pedestalHOMax_ || pedestal1 < pedestalHOMax_ ||
12380         pedestal2 < pedestalHOMax_ || pedestal3 < pedestalHOMax_ || pedestalw0 < pedestalwHOMax_ ||
12381         pedestalw1 < pedestalwHOMax_ || pedestalw2 < pedestalwHOMax_ || pedestalw3 < pedestalwHOMax_
12382 
12383     ) {
12384       for (int ii = 0; ii < TSsize; ii++) {
12385         double ampldefault = tool[ii];
12386         h_shape_bad_channels_HO->Fill(float(ii), ampldefault);
12387         h_shape0_bad_channels_HO->Fill(float(ii), 1.);
12388       }
12389     } else {
12390       for (int ii = 0; ii < TSsize; ii++) {
12391         double ampldefault = tool[ii];
12392         h_shape_good_channels_HO->Fill(float(ii), ampldefault);
12393         h_shape0_good_channels_HO->Fill(float(ii), 1.);
12394       }
12395     }
12396   }  // sub   HO
12397   ///////////////////////////////////////Digis : over all digiHits
12398   sum0Estimator[sub - 1][mdepth - 1][ieta + 41][iphi] += 1.;
12399   //      for Error B-type
12400   sumEstimator6[sub - 1][mdepth - 1][ieta + 41][iphi] += errorBtype;
12401   sumEstimator0[sub - 1][mdepth - 1][ieta + 41][iphi] += pedestal0;  //Pedestals
12402   // HO
12403   if (sub == 3) {
12404     if (studyPedestalCorrelations_) {
12405       double mypedestal = pedestal0;
12406       double mypedestalw = pedestalw0;
12407       h2_pedvsampl_HO->Fill(mypedestal, amplitude);
12408       h2_pedwvsampl_HO->Fill(mypedestalw, amplitude);
12409       h_pedvsampl_HO->Fill(mypedestal, amplitude);
12410       h_pedwvsampl_HO->Fill(mypedestalw, amplitude);
12411       h_pedvsampl0_HO->Fill(mypedestal, 1.);
12412       h_pedwvsampl0_HO->Fill(mypedestalw, 1.);
12413     }  //
12414     //   //   //   //   //   //   //   //   //  HO       Pedestals:
12415     if (studyPedestalsHist_) {
12416       h_pedestal0_HO->Fill(pedestal0, 1.);
12417       h_pedestal1_HO->Fill(pedestal1, 1.);
12418       h_pedestal2_HO->Fill(pedestal2, 1.);
12419       h_pedestal3_HO->Fill(pedestal3, 1.);
12420       h_pedestalaver4_HO->Fill(pedestalaver4, 1.);
12421       h_pedestalaver9_HO->Fill(pedestalaver9, 1.);
12422       h_pedestalw0_HO->Fill(pedestalw0, 1.);
12423       h_pedestalw1_HO->Fill(pedestalw1, 1.);
12424       h_pedestalw2_HO->Fill(pedestalw2, 1.);
12425       h_pedestalw3_HO->Fill(pedestalw3, 1.);
12426       h_pedestalwaver4_HO->Fill(pedestalwaver4, 1.);
12427       h_pedestalwaver9_HO->Fill(pedestalwaver9, 1.);
12428       // for averaged values:
12429       if (mdepth == 4) {
12430         h_mapDepth4Ped0_HO->Fill(double(ieta), double(iphi), pedestal0);
12431         h_mapDepth4Ped1_HO->Fill(double(ieta), double(iphi), pedestal1);
12432         h_mapDepth4Ped2_HO->Fill(double(ieta), double(iphi), pedestal2);
12433         h_mapDepth4Ped3_HO->Fill(double(ieta), double(iphi), pedestal3);
12434         h_mapDepth4Pedw0_HO->Fill(double(ieta), double(iphi), pedestalw0);
12435         h_mapDepth4Pedw1_HO->Fill(double(ieta), double(iphi), pedestalw1);
12436         h_mapDepth4Pedw2_HO->Fill(double(ieta), double(iphi), pedestalw2);
12437         h_mapDepth4Pedw3_HO->Fill(double(ieta), double(iphi), pedestalw3);
12438       }
12439       if (pedestalw0 < pedestalwHOMax_ || pedestalw1 < pedestalwHOMax_ || pedestalw2 < pedestalwHOMax_ ||
12440           pedestalw3 < pedestalwHOMax_) {
12441         if (mdepth == 4)
12442           h_mapDepth4pedestalw_HO->Fill(double(ieta), double(iphi), 1.);
12443       }
12444       if (pedestal0 < pedestalHOMax_ || pedestal1 < pedestalHOMax_ || pedestal2 < pedestalHOMax_ ||
12445           pedestal3 < pedestalHOMax_) {
12446         if (mdepth == 4)
12447           h_mapDepth4pedestal_HO->Fill(double(ieta), double(iphi), 1.);
12448       }
12449       for (int ii = 0; ii < TSsize; ii++) {
12450         h_pedestal00_HO->Fill(pedestal00->getValue(ii), 1.);
12451         h_gain_HO->Fill(gain->getValue(ii), 1.);
12452       }
12453       h_respcorr_HO->Fill(respcorr->getValue(), 1.);
12454       h_timecorr_HO->Fill(timecorr->getValue(), 1.);
12455       h_lutcorr_HO->Fill(lutcorr->getValue(), 1.);
12456     }  //
12457     //   //   //   //   //   //   //   //   //  HO       ADCAmpl:
12458     if (studyADCAmplHist_) {
12459       h_ADCAmpl_HO->Fill(amplitude, 1.);
12460       h_ADCAmplrest1_HO->Fill(amplitude, 1.);
12461       h_ADCAmplrest6_HO->Fill(amplitude, 1.);
12462 
12463       h_ADCAmplZoom1_HO->Fill(amplitude, 1.);
12464       h_ADCAmpl_HO_copy->Fill(amplitude, 1.);
12465       if (amplitude < ADCAmplHOMin_ || amplitude > ADCAmplHOMax_) {
12466         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 5)
12467           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12468         if (mdepth == 4)
12469           h_mapDepth4ADCAmpl225_HO->Fill(double(ieta), double(iphi), 1.);
12470       }  // if
12471       //    if(amplitude >2000.) averSIGNALoccupancy_HO += 1.;
12472 
12473       if (amplitude < 100.) {
12474         if (mdepth == 4)
12475           h_mapDepth4ADCAmpl225Copy_HO->Fill(double(ieta), double(iphi), 1.);
12476       }  // if
12477       // for averaged values:
12478       if (mdepth == 4)
12479         h_mapDepth4ADCAmpl_HO->Fill(double(ieta), double(iphi), amplitude);
12480       if (mdepth == 4)
12481         h_mapDepth4ADCAmpl12_HO->Fill(double(ieta), double(iphi), ampl);
12482 
12483       h_bcnvsamplitude_HO->Fill(float(bcn), amplitude);
12484       h_bcnvsamplitude0_HO->Fill(float(bcn), 1.);
12485 
12486       h_orbitNumvsamplitude_HO->Fill(float(orbitNum), amplitude);
12487       h_orbitNumvsamplitude0_HO->Fill(float(orbitNum), 1.);
12488       if (amplitude > forallestimators_amplitude_bigger_)
12489         sumEstimator1[sub - 1][mdepth - 1][ieta + 41][iphi] += amplitude;
12490     }  //if(studyADCAmplHist_
12491     if (studyTSmeanShapeHist_) {
12492       h_TSmeanA_HO->Fill(aveamplitude1, 1.);
12493       //    h2_TSnVsAyear2023_HO->Fill(25.*aveamplitude1, amplitude);
12494       h2_TSnVsAyear2023_HO->Fill(amplitude, 25. * aveamplitude1);
12495       h1_TSnVsAyear2023_HO->Fill(amplitude, 25. * aveamplitude1);
12496       h1_TSnVsAyear20230_HO->Fill(amplitude, 1.);
12497       if (aveamplitude1 < TSmeanHOMin_ || aveamplitude1 > TSmeanHOMax_) {
12498         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 4)
12499           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12500         if (mdepth == 4)
12501           h_mapDepth4TSmeanA225_HO->Fill(double(ieta), double(iphi), 1.);
12502       }  // if
12503       if (mdepth == 4)
12504         h_mapDepth4TSmeanA_HO->Fill(double(ieta), double(iphi), aveamplitude1);
12505       if (amplitude > forallestimators_amplitude_bigger_)
12506         sumEstimator2[sub - 1][mdepth - 1][ieta + 41][iphi] += aveamplitude1;
12507     }  //if(studyTSmeanShapeHist_
12508     if (studyTSmaxShapeHist_) {
12509       h_TSmaxA_HO->Fill(float(ts_with_max_signal), 1.);
12510       if (ts_with_max_signal < TSpeakHOMin_ || ts_with_max_signal > TSpeakHOMax_) {
12511         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 3)
12512           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12513         if (mdepth == 4)
12514           h_mapDepth4TSmaxA225_HO->Fill(double(ieta), double(iphi), 1.);
12515       }  // if
12516       // for averaged values:
12517       if (mdepth == 4)
12518         h_mapDepth4TSmaxA_HO->Fill(double(ieta), double(iphi), float(ts_with_max_signal));
12519       if (amplitude > forallestimators_amplitude_bigger_)
12520         sumEstimator3[sub - 1][mdepth - 1][ieta + 41][iphi] += float(ts_with_max_signal);
12521     }  //if(studyTSmaxShapeHist_
12522     if (studyRMSshapeHist_) {
12523       h_Amplitude_HO->Fill(rmsamplitude, 1.);
12524       if (rmsamplitude < rmsHOMin_ || rmsamplitude > rmsHOMax_) {
12525         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 2)
12526           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12527         if (mdepth == 4)
12528           h_mapDepth4Amplitude225_HO->Fill(double(ieta), double(iphi), 1.);
12529       }  // if
12530       if (mdepth == 4)
12531         h_mapDepth4Amplitude_HO->Fill(double(ieta), double(iphi), rmsamplitude);
12532       if (amplitude > forallestimators_amplitude_bigger_)
12533         sumEstimator4[sub - 1][mdepth - 1][ieta + 41][iphi] += rmsamplitude;
12534     }  //if(studyRMSshapeHist_)
12535     if (studyRatioShapeHist_) {
12536       h_Ampl_HO->Fill(ratio, 1.);
12537       if (ratio < ratioHOMin_ || ratio > ratioHOMax_) {
12538         if (studyRunDependenceHist_ && flagtodefinebadchannel_ == 1)
12539           ++badchannels[sub - 1][mdepth - 1][ieta + 41][iphi];  // 0-neta ; 0-71
12540         if (mdepth == 4)
12541           h_mapDepth4Ampl047_HO->Fill(double(ieta), double(iphi), 1.);
12542       }  //if(ratio
12543       if (mdepth == 4)
12544         h_mapDepth4Ampl_HO->Fill(double(ieta), double(iphi), ratio);
12545       if (amplitude > forallestimators_amplitude_bigger_)
12546         sumEstimator5[sub - 1][mdepth - 1][ieta + 41][iphi] += ratio;
12547     }  //if(studyRatioShapeHist_)
12548     if (studyDiffAmplHist_) {
12549       if (mdepth == 4)
12550         h_mapDepth4AmplE34_HO->Fill(double(ieta), double(iphi), amplitude);
12551     }  // if(studyDiffAmplHist_)
12552     if (mdepth == 4) {
12553       h_mapDepth4_HO->Fill(double(ieta), double(iphi), 1.);
12554       if (flagTS012 == 1)
12555         h_mapDepth4TS012_HO->Fill(double(ieta), double(iphi), 1.);
12556     }
12557   }  //if ( sub == 3 )
12558 }
12559 int CMTRawAnalyzer::getRBX(int& kdet, int& keta, int& kphi) {
12560   int cal_RBX = 0;
12561   if (kdet == 1 || kdet == 2) {
12562     if (kphi == 71)
12563       cal_RBX = 0;
12564     else
12565       cal_RBX = (kphi + 1) / 4;
12566     cal_RBX = cal_RBX + 18 * (keta + 1) / 2;
12567   }
12568   if (kdet == 4) {
12569     cal_RBX = (int)(kphi / 18) + 1;
12570   }
12571   if (kdet == 3) {
12572     if (keta == -2) {
12573       if (kphi == 71)
12574         cal_RBX = 0;
12575       else
12576         cal_RBX = kphi / 12 + 1;
12577     }
12578     if (keta == -1) {
12579       if (kphi == 71)
12580         cal_RBX = 6;
12581       else
12582         cal_RBX = kphi / 12 + 1 + 6;
12583     }
12584     if (keta == 0) {
12585       if (kphi == 71)
12586         cal_RBX = 12;
12587       else
12588         cal_RBX = kphi / 6 + 1 + 12;
12589     }
12590     if (keta == 1) {
12591       if (kphi == 71)
12592         cal_RBX = 24;
12593       else
12594         cal_RBX = kphi / 12 + 1 + 24;
12595     }
12596     if (keta == 2) {
12597       if (kphi == 71)
12598         cal_RBX = 30;
12599       else
12600         cal_RBX = kphi / 12 + 1 + 30;
12601     }
12602   }
12603   return cal_RBX;
12604 }
12605 void CMTRawAnalyzer::beginRun(const edm::Run& r, const edm::EventSetup& iSetup) {}
12606 void CMTRawAnalyzer::endRun(const edm::Run& r, const edm::EventSetup& iSetup) {
12607   if (flagfitshunt1pedorledlowintensity_ != 0) {
12608   }  // if flag...
12609   if (usecontinuousnumbering_) {
12610     lscounterM1 = lscounter - 1;
12611   } else {
12612     lscounterM1 = ls0;
12613   }
12614   if (ls0 != -1)
12615     h_nevents_per_eachRealLS->Fill(float(lscounterM1), float(nevcounter));  //
12616   h_nevents_per_LS->Fill(float(nevcounter));
12617   h_nevents_per_LSzoom->Fill(float(nevcounter));
12618   nevcounter0 = nevcounter;
12619   if (nevcounter0 != 0) {
12620     for (int k0 = 0; k0 < nsub; k0++) {
12621       for (int k1 = 0; k1 < ndepth; k1++) {
12622         for (int k2 = 0; k2 < neta; k2++) {
12623           for (int k3 = 0; k3 < nphi; k3++) {
12624             int ieta = k2 - 41;
12625             if (sumEstimator0[k0][k1][k2][k3] != 0.) {
12626               double bbbc = 0.;
12627               if (flagestimatornormalization_ == 0)
12628                 bbbc = sumEstimator0[k0][k1][k2][k3] / nevcounter0;
12629               if (flagestimatornormalization_ == 1)
12630                 bbbc = sumEstimator0[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
12631               double bbb1 = 1.;
12632               if (flagestimatornormalization_ == 2) {
12633                 bbbc = sumEstimator0[k0][k1][k2][k3];
12634                 bbb1 = sum0Estimator[k0][k1][k2][k3];
12635               }
12636               if (k0 == 0) {
12637                 if (k1 + 1 == 1) {
12638                   h_sumPedestalLS1->Fill(bbbc / bbb1);
12639                   h_2DsumPedestalLS1->Fill(double(ieta), double(k3), bbbc);
12640                   h_2D0sumPedestalLS1->Fill(double(ieta), double(k3), bbb1);
12641                   h_sumPedestalperLS1->Fill(float(lscounterM1), bbbc);
12642                   h_sum0PedestalperLS1->Fill(float(lscounterM1), bbb1);
12643                 }
12644                 if (k1 + 1 == 2) {
12645                   h_sumPedestalLS2->Fill(bbbc / bbb1);
12646                   h_2DsumPedestalLS2->Fill(double(ieta), double(k3), bbbc);
12647                   h_2D0sumPedestalLS2->Fill(double(ieta), double(k3), bbb1);
12648                   h_sumPedestalperLS2->Fill(float(lscounterM1), bbbc);
12649                   h_sum0PedestalperLS2->Fill(float(lscounterM1), bbb1);
12650                 }
12651               }
12652               // HE:
12653               if (k0 == 1) {
12654                 // HEdepth1
12655                 if (k1 + 1 == 1) {
12656                   h_sumPedestalLS3->Fill(bbbc / bbb1);
12657                   h_2DsumPedestalLS3->Fill(double(ieta), double(k3), bbbc);
12658                   h_2D0sumPedestalLS3->Fill(double(ieta), double(k3), bbb1);
12659                   h_sumPedestalperLS3->Fill(float(lscounterM1), bbbc);
12660                   h_sum0PedestalperLS3->Fill(float(lscounterM1), bbb1);
12661                 }
12662                 if (k1 + 1 == 2) {
12663                   h_sumPedestalLS4->Fill(bbbc / bbb1);
12664                   h_2DsumPedestalLS4->Fill(double(ieta), double(k3), bbbc);
12665                   h_2D0sumPedestalLS4->Fill(double(ieta), double(k3), bbb1);
12666                   h_sumPedestalperLS4->Fill(float(lscounterM1), bbbc);
12667                   h_sum0PedestalperLS4->Fill(float(lscounterM1), bbb1);
12668                 }
12669                 if (k1 + 1 == 3) {
12670                   h_sumPedestalLS5->Fill(bbbc / bbb1);
12671                   h_2DsumPedestalLS5->Fill(double(ieta), double(k3), bbbc);
12672                   h_2D0sumPedestalLS5->Fill(double(ieta), double(k3), bbb1);
12673                   h_sumPedestalperLS5->Fill(float(lscounterM1), bbbc);
12674                   h_sum0PedestalperLS5->Fill(float(lscounterM1), bbb1);
12675                 }
12676               }
12677               // HF:
12678               if (k0 == 3) {
12679                 // HFdepth1
12680                 if (k1 + 1 == 1) {
12681                   h_sumPedestalLS6->Fill(bbbc / bbb1);
12682                   h_2DsumPedestalLS6->Fill(double(ieta), double(k3), bbbc);
12683                   h_2D0sumPedestalLS6->Fill(double(ieta), double(k3), bbb1);
12684                   h_sumPedestalperLS6->Fill(float(lscounterM1), bbbc);
12685                   h_sum0PedestalperLS6->Fill(float(lscounterM1), bbb1);
12686                 }
12687                 if (k1 + 1 == 2) {
12688                   h_sumPedestalLS7->Fill(bbbc / bbb1);
12689                   h_2DsumPedestalLS7->Fill(double(ieta), double(k3), bbbc);
12690                   h_2D0sumPedestalLS7->Fill(double(ieta), double(k3), bbb1);
12691                   h_sumPedestalperLS7->Fill(float(lscounterM1), bbbc);
12692                   h_sum0PedestalperLS7->Fill(float(lscounterM1), bbb1);
12693                 }
12694               }
12695               // HO:
12696               if (k0 == 2) {
12697                 // HOdepth1
12698                 if (k1 + 1 == 4) {
12699                   h_sumPedestalLS8->Fill(bbbc / bbb1);
12700                   h_2DsumPedestalLS8->Fill(double(ieta), double(k3), bbbc);
12701                   h_2D0sumPedestalLS8->Fill(double(ieta), double(k3), bbb1);
12702                   h_sumPedestalperLS8->Fill(float(lscounterM1), bbbc);
12703                   h_sum0PedestalperLS8->Fill(float(lscounterM1), bbb1);
12704                 }
12705               }
12706             }  //if(sumEstimator0[k0][k1][k2][k3] != 0.
12707             if (sumEstimator1[k0][k1][k2][k3] != 0.) {
12708               double bbbc = 0.;
12709               if (flagestimatornormalization_ == 0)
12710                 bbbc = sumEstimator1[k0][k1][k2][k3] / nevcounter0;
12711               if (flagestimatornormalization_ == 1)
12712                 bbbc = sumEstimator1[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
12713               double bbb1 = 1.;
12714               if (flagestimatornormalization_ == 2) {
12715                 bbbc = sumEstimator1[k0][k1][k2][k3];
12716                 bbb1 = sum0Estimator[k0][k1][k2][k3];
12717               }
12718               if (lscounterM1 >= lsmin_ && lscounterM1 < lsmax_) {
12719                 int kkkk2 = (k2 - 1) / 4;
12720                 if (k2 == 0)
12721                   kkkk2 = 1.;
12722                 else
12723                   kkkk2 += 2;              //kkkk2= 1-22
12724                 int kkkk3 = (k3) / 4 + 1;  //kkkk3= 1-18
12725                 int ietaphi = 0;
12726                 ietaphi = ((kkkk2)-1) * znphi + (kkkk3);
12727                 double bbb3 = 0.;
12728                 if (bbb1 != 0.)
12729                   bbb3 = bbbc / bbb1;
12730                 if (k0 == 0) {
12731                   h_2DsumADCAmplEtaPhiLs0->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HB
12732                   h_2DsumADCAmplEtaPhiLs00->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HB
12733                 }
12734                 if (k0 == 1) {
12735                   h_2DsumADCAmplEtaPhiLs1->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HE
12736                   h_2DsumADCAmplEtaPhiLs10->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HE
12737                 }
12738                 if (k0 == 2) {
12739                   h_2DsumADCAmplEtaPhiLs2->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HO
12740                   h_2DsumADCAmplEtaPhiLs20->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HO
12741                 }
12742                 if (k0 == 3) {
12743                   h_2DsumADCAmplEtaPhiLs3->Fill(float(lscounterM1), float(ietaphi), bbbc);   //HF
12744                   h_2DsumADCAmplEtaPhiLs30->Fill(float(lscounterM1), float(ietaphi), bbb1);  //HF
12745                 }
12746 
12747                 h_sumADCAmplEtaPhiLs->Fill(bbb3);
12748                 h_sumADCAmplEtaPhiLs_bbbc->Fill(bbbc);
12749                 h_sumADCAmplEtaPhiLs_bbb1->Fill(bbb1);
12750                 h_sumADCAmplEtaPhiLs_lscounterM1orbitNum->Fill(float(lscounterM1), float(orbitNum));
12751                 h_sumADCAmplEtaPhiLs_orbitNum->Fill(float(orbitNum), 1.);
12752                 h_sumADCAmplEtaPhiLs_lscounterM1->Fill(float(lscounterM1), 1.);
12753                 h_sumADCAmplEtaPhiLs_ietaphi->Fill(float(ietaphi));
12754               }  // lscounterM1 >= lsmin_ && lscounterM1 < lsmax_
12755               if (k0 == 0) {
12756                 if (k1 + 1 == 1) {
12757                   h_sumADCAmplLS1copy1->Fill(bbbc / bbb1);
12758                   h_sumADCAmplLS1copy2->Fill(bbbc / bbb1);
12759                   h_sumADCAmplLS1copy3->Fill(bbbc / bbb1);
12760                   h_sumADCAmplLS1copy4->Fill(bbbc / bbb1);
12761                   h_sumADCAmplLS1copy5->Fill(bbbc / bbb1);
12762                   h_sumADCAmplLS1->Fill(bbbc / bbb1);
12763                   if (bbbc / bbb1 > lsdep_estimator1_HBdepth1_)
12764                     h_2DsumADCAmplLS1->Fill(double(ieta), double(k3), bbbc);
12765                   if (bbbc / bbb1 > 2. * lsdep_estimator1_HBdepth1_)
12766                     h_2DsumADCAmplLS1_LSselected->Fill(double(ieta), double(k3), bbbc);
12767                   h_2D0sumADCAmplLS1->Fill(double(ieta), double(k3), bbb1);
12768                   h_sumADCAmplperLS1->Fill(float(lscounterM1), bbbc);
12769                   if (bbbc / bbb1 > lsdep_estimator1_HBdepth1_)
12770                     h_sumCutADCAmplperLS1->Fill(float(lscounterM1), bbbc);
12771                   h_sum0ADCAmplperLS1->Fill(float(lscounterM1), bbb1);
12772                 }
12773                 if (k1 + 1 == 2) {
12774                   h_sumADCAmplLS2->Fill(bbbc / bbb1);
12775                   if (bbbc / bbb1 > lsdep_estimator1_HBdepth2_)
12776                     h_2DsumADCAmplLS2->Fill(double(ieta), double(k3), bbbc);
12777                   if (bbbc / bbb1 > 2. * lsdep_estimator1_HBdepth2_)
12778                     h_2DsumADCAmplLS2_LSselected->Fill(double(ieta), double(k3), bbbc);
12779                   h_2D0sumADCAmplLS2->Fill(double(ieta), double(k3), bbb1);
12780                   h_sumADCAmplperLS2->Fill(float(lscounterM1), bbbc);
12781                   if (bbbc / bbb1 > lsdep_estimator1_HBdepth2_)
12782                     h_sumCutADCAmplperLS2->Fill(float(lscounterM1), bbbc);
12783                   h_sum0ADCAmplperLS2->Fill(float(lscounterM1), bbb1);
12784                 }
12785                 if (k1 + 1 == 3) {
12786                   h_sumADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbbc);
12787                   if (bbbc / bbb1 > lsdep_estimator1_HBdepth3_)
12788                     h_sumCutADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbbc);
12789                   h_sum0ADCAmplperLSdepth3HBu->Fill(float(lscounterM1), bbb1);
12790 
12791                   if (bbbc / bbb1 > lsdep_estimator1_HBdepth3_)
12792                     h_2DsumADCAmplLSdepth3HBu->Fill(double(ieta), double(k3), bbbc);
12793                   h_2D0sumADCAmplLSdepth3HBu->Fill(double(ieta), double(k3), bbb1);
12794                 }  //if(k1+1  ==3)
12795                 if (k1 + 1 == 4) {
12796                   h_sumADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbbc);
12797                   if (bbbc / bbb1 > lsdep_estimator1_HBdepth4_)
12798                     h_sumCutADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbbc);
12799                   h_sum0ADCAmplperLSdepth4HBu->Fill(float(lscounterM1), bbb1);
12800 
12801                   if (bbbc / bbb1 > lsdep_estimator1_HBdepth4_)
12802                     h_2DsumADCAmplLSdepth4HBu->Fill(double(ieta), double(k3), bbbc);
12803                   h_2D0sumADCAmplLSdepth4HBu->Fill(double(ieta), double(k3), bbb1);
12804                 }  //if(k1+1  ==4)
12805               }
12806               if (k0 == 1) {
12807                 if (k1 + 1 == 1) {
12808                   h_sumADCAmplLS3->Fill(bbbc / bbb1);
12809                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth1_)
12810                     h_2DsumADCAmplLS3->Fill(double(ieta), double(k3), bbbc);
12811                   if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth1_)
12812                     h_2DsumADCAmplLS3_LSselected->Fill(double(ieta), double(k3), bbbc);
12813                   h_2D0sumADCAmplLS3->Fill(double(ieta), double(k3), bbb1);
12814                   h_sumADCAmplperLS3->Fill(float(lscounterM1), bbbc);
12815                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth1_)
12816                     h_sumCutADCAmplperLS3->Fill(float(lscounterM1), bbbc);
12817                   h_sum0ADCAmplperLS3->Fill(float(lscounterM1), bbb1);
12818                 }
12819                 if (k1 + 1 == 2) {
12820                   h_sumADCAmplLS4->Fill(bbbc / bbb1);
12821                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth2_)
12822                     h_2DsumADCAmplLS4->Fill(double(ieta), double(k3), bbbc);
12823                   if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth2_)
12824                     h_2DsumADCAmplLS4_LSselected->Fill(double(ieta), double(k3), bbbc);
12825                   h_2D0sumADCAmplLS4->Fill(double(ieta), double(k3), bbb1);
12826                   h_sumADCAmplperLS4->Fill(float(lscounterM1), bbbc);
12827                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth2_)
12828                     h_sumCutADCAmplperLS4->Fill(float(lscounterM1), bbbc);
12829                   h_sum0ADCAmplperLS4->Fill(float(lscounterM1), bbb1);
12830                 }
12831                 if (k1 + 1 == 3) {
12832                   h_sumADCAmplLS5->Fill(bbbc / bbb1);
12833                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth3_)
12834                     h_2DsumADCAmplLS5->Fill(double(ieta), double(k3), bbbc);
12835                   if (bbbc / bbb1 > 2. * lsdep_estimator1_HEdepth3_)
12836                     h_2DsumADCAmplLS5_LSselected->Fill(double(ieta), double(k3), bbbc);
12837                   h_2D0sumADCAmplLS5->Fill(double(ieta), double(k3), bbb1);
12838                   h_sumADCAmplperLS5->Fill(float(lscounterM1), bbbc);
12839                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth3_)
12840                     h_sumCutADCAmplperLS5->Fill(float(lscounterM1), bbbc);
12841                   h_sum0ADCAmplperLS5->Fill(float(lscounterM1), bbb1);
12842                 }
12843                 if (k1 + 1 == 4) {
12844                   h_sumADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbbc);
12845                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth4_)
12846                     h_sumCutADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbbc);
12847                   h_sum0ADCAmplperLSdepth4HEu->Fill(float(lscounterM1), bbb1);
12848                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth4_)
12849                     h_2DsumADCAmplLSdepth4HEu->Fill(double(ieta), double(k3), bbbc);
12850                   h_2D0sumADCAmplLSdepth4HEu->Fill(double(ieta), double(k3), bbb1);
12851                 }  //if(k1+1  ==4)
12852                 if (k1 + 1 == 5) {
12853                   h_sumADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbbc);
12854                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth5_)
12855                     h_sumCutADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbbc);
12856                   h_sum0ADCAmplperLSdepth5HEu->Fill(float(lscounterM1), bbb1);
12857                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth5_)
12858                     h_2DsumADCAmplLSdepth5HEu->Fill(double(ieta), double(k3), bbbc);
12859                   h_2D0sumADCAmplLSdepth5HEu->Fill(double(ieta), double(k3), bbb1);
12860                 }  //if(k1+1  ==5)
12861 
12862                 if (k1 + 1 == 6) {
12863                   h_sumADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbbc);
12864                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth6_)
12865                     h_sumCutADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbbc);
12866                   h_sum0ADCAmplperLSdepth6HEu->Fill(float(lscounterM1), bbb1);
12867                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth6_)
12868                     h_2DsumADCAmplLSdepth6HEu->Fill(double(ieta), double(k3), bbbc);
12869                   h_2D0sumADCAmplLSdepth6HEu->Fill(double(ieta), double(k3), bbb1);
12870                 }  //if(k1+1  ==6)
12871                 if (k1 + 1 == 7) {
12872                   h_sumADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbbc);
12873                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth7_)
12874                     h_sumCutADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbbc);
12875                   h_sum0ADCAmplperLSdepth7HEu->Fill(float(lscounterM1), bbb1);
12876                   if (bbbc / bbb1 > lsdep_estimator1_HEdepth7_)
12877                     h_2DsumADCAmplLSdepth7HEu->Fill(double(ieta), double(k3), bbbc);
12878                   h_2D0sumADCAmplLSdepth7HEu->Fill(double(ieta), double(k3), bbb1);
12879                 }  //if(k1+1  ==7)
12880 
12881               }  // end HE
12882 
12883               if (k0 == 3) {
12884                 if (k1 + 1 == 1) {
12885                   h_sumADCAmplLS6->Fill(bbbc / bbb1);
12886                   if (bbbc / bbb1 > lsdep_estimator1_HFdepth1_)
12887                     h_2DsumADCAmplLS6->Fill(double(ieta), double(k3), bbbc);
12888                   if (bbbc / bbb1 > 2. * lsdep_estimator1_HFdepth1_)
12889                     h_2DsumADCAmplLS6_LSselected->Fill(double(ieta), double(k3), bbbc);
12890                   h_2D0sumADCAmplLS6->Fill(double(ieta), double(k3), bbb1);
12891                   h_sumADCAmplperLS6->Fill(float(lscounterM1), bbbc);
12892                   if (bbbc / bbb1 > lsdep_estimator1_HFdepth1_)
12893                     h_sumCutADCAmplperLS6->Fill(float(lscounterM1), bbbc);
12894                   h_sum0ADCAmplperLS6->Fill(float(lscounterM1), bbb1);
12895                 }
12896                 if (k1 + 1 == 2) {
12897                   h_sumADCAmplLS7->Fill(bbbc / bbb1);
12898                   if (bbbc / bbb1 > lsdep_estimator1_HFdepth2_)
12899                     h_2DsumADCAmplLS7->Fill(double(ieta), double(k3), bbbc);
12900                   if (bbbc / bbb1 > 2. * lsdep_estimator1_HFdepth2_)
12901                     h_2DsumADCAmplLS7_LSselected->Fill(double(ieta), double(k3), bbbc);
12902                   h_2D0sumADCAmplLS7->Fill(double(ieta), double(k3), bbb1);
12903                   h_sumADCAmplperLS7->Fill(float(lscounterM1), bbbc);
12904                   if (bbbc / bbb1 > lsdep_estimator1_HFdepth2_)
12905                     h_sumCutADCAmplperLS7->Fill(float(lscounterM1), bbbc);
12906                   h_sum0ADCAmplperLS7->Fill(float(lscounterM1), bbb1);
12907                 }
12908 
12909                 if (k1 + 1 == 3) {
12910                   h_sumADCAmplperLS6u->Fill(float(lscounterM1), bbbc);
12911                   if (bbbc / bbb1 > lsdep_estimator1_HFdepth3_)
12912                     h_sumCutADCAmplperLS6u->Fill(float(lscounterM1), bbbc);
12913                   h_sum0ADCAmplperLS6u->Fill(float(lscounterM1), bbb1);
12914                   if (bbbc / bbb1 > lsdep_estimator1_HFdepth3_)
12915                     h_2DsumADCAmplLSdepth3HFu->Fill(double(ieta), double(k3), bbbc);
12916                   h_2D0sumADCAmplLSdepth3HFu->Fill(double(ieta), double(k3), bbb1);
12917                 }  //if(k1+1  ==3)
12918                 if (k1 + 1 == 4) {
12919                   h_sumADCAmplperLS7u->Fill(float(lscounterM1), bbbc);
12920                   if (bbbc / bbb1 > lsdep_estimator1_HFdepth4_)
12921                     h_sumCutADCAmplperLS7u->Fill(float(lscounterM1), bbbc);
12922                   h_sum0ADCAmplperLS7u->Fill(float(lscounterM1), bbb1);
12923                   if (bbbc / bbb1 > lsdep_estimator1_HFdepth4_)
12924                     h_2DsumADCAmplLSdepth4HFu->Fill(double(ieta), double(k3), bbbc);
12925                   h_2D0sumADCAmplLSdepth4HFu->Fill(double(ieta), double(k3), bbb1);
12926                 }  //if(k1+1  ==4)
12927               }
12928               // HO:
12929               if (k0 == 2) {
12930                 // HOdepth1
12931                 if (k1 + 1 == 4) {
12932                   h_sumADCAmplLS8->Fill(bbbc / bbb1);
12933                   if (bbbc / bbb1 > lsdep_estimator1_HOdepth4_)
12934                     h_2DsumADCAmplLS8->Fill(double(ieta), double(k3), bbbc);
12935                   if (bbbc / bbb1 > 2. * lsdep_estimator1_HOdepth4_)
12936                     h_2DsumADCAmplLS8_LSselected->Fill(double(ieta), double(k3), bbbc);
12937                   h_2D0sumADCAmplLS8->Fill(double(ieta), double(k3), bbb1);
12938                   h_sumADCAmplperLS8->Fill(float(lscounterM1), bbbc);
12939                   if (bbbc / bbb1 > lsdep_estimator1_HOdepth4_)
12940                     h_sumCutADCAmplperLS8->Fill(float(lscounterM1), bbbc);
12941                   h_sum0ADCAmplperLS8->Fill(float(lscounterM1), bbb1);
12942                 }
12943               }
12944             }  //if(sumEstimator1[k0][k1][k2][k3] != 0.
12945             if (sumEstimator2[k0][k1][k2][k3] != 0.) {
12946               double bbbc = 0.;
12947               if (flagestimatornormalization_ == 0)
12948                 bbbc = sumEstimator2[k0][k1][k2][k3] / nevcounter0;
12949               if (flagestimatornormalization_ == 1)
12950                 bbbc = sumEstimator2[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
12951               double bbb1 = 1.;
12952               if (flagestimatornormalization_ == 2) {
12953                 bbbc = sumEstimator2[k0][k1][k2][k3];
12954                 bbb1 = sum0Estimator[k0][k1][k2][k3];
12955               }
12956 
12957               // HB:
12958               if (k0 == 0) {
12959                 // HBdepth1
12960                 if (k1 + 1 == 1) {
12961                   h_sumTSmeanALS1->Fill(bbbc / bbb1);
12962                   if (bbbc / bbb1 > lsdep_estimator2_HBdepth1_)
12963                     h_2DsumTSmeanALS1->Fill(double(ieta), double(k3), bbbc);
12964                   h_2D0sumTSmeanALS1->Fill(double(ieta), double(k3), bbb1);
12965                   h_sumTSmeanAperLS1->Fill(float(lscounterM1), bbbc);
12966                   if (bbbc / bbb1 > lsdep_estimator2_HBdepth1_)
12967                     h_sumCutTSmeanAperLS1->Fill(float(lscounterM1), bbbc);
12968                   h_sum0TSmeanAperLS1->Fill(float(lscounterM1), bbb1);
12969                   if (bbbc / bbb1 > 2. * lsdep_estimator2_HBdepth1_)
12970                     h_sumTSmeanAperLS1_LSselected->Fill(float(lscounterM1), bbbc);
12971                 }
12972                 if (k1 + 1 == 2) {
12973                   h_sumTSmeanALS2->Fill(bbbc / bbb1);
12974                   if (bbbc / bbb1 > lsdep_estimator2_HBdepth2_)
12975                     h_2DsumTSmeanALS2->Fill(double(ieta), double(k3), bbbc);
12976                   h_2D0sumTSmeanALS2->Fill(double(ieta), double(k3), bbb1);
12977                   h_sumTSmeanAperLS2->Fill(float(lscounterM1), bbbc);
12978                   if (bbbc / bbb1 > lsdep_estimator2_HBdepth2_)
12979                     h_sumCutTSmeanAperLS2->Fill(float(lscounterM1), bbbc);
12980                   h_sum0TSmeanAperLS2->Fill(float(lscounterM1), bbb1);
12981                 }
12982               }
12983               if (k0 == 1) {
12984                 if (k1 + 1 == 1) {
12985                   h_sumTSmeanALS3->Fill(bbbc / bbb1);
12986                   if (bbbc / bbb1 > lsdep_estimator2_HEdepth1_)
12987                     h_2DsumTSmeanALS3->Fill(double(ieta), double(k3), bbbc);
12988                   h_2D0sumTSmeanALS3->Fill(double(ieta), double(k3), bbb1);
12989                   h_sumTSmeanAperLS3->Fill(float(lscounterM1), bbbc);
12990                   if (bbbc / bbb1 > lsdep_estimator2_HEdepth1_)
12991                     h_sumCutTSmeanAperLS3->Fill(float(lscounterM1), bbbc);
12992                   h_sum0TSmeanAperLS3->Fill(float(lscounterM1), bbb1);
12993                 }
12994                 if (k1 + 1 == 2) {
12995                   h_sumTSmeanALS4->Fill(bbbc / bbb1);
12996                   if (bbbc / bbb1 > lsdep_estimator2_HEdepth2_)
12997                     h_2DsumTSmeanALS4->Fill(double(ieta), double(k3), bbbc);
12998                   h_2D0sumTSmeanALS4->Fill(double(ieta), double(k3), bbb1);
12999                   h_sumTSmeanAperLS4->Fill(float(lscounterM1), bbbc);
13000                   if (bbbc / bbb1 > lsdep_estimator2_HEdepth2_)
13001                     h_sumCutTSmeanAperLS4->Fill(float(lscounterM1), bbbc);
13002                   h_sum0TSmeanAperLS4->Fill(float(lscounterM1), bbb1);
13003                 }
13004                 if (k1 + 1 == 3) {
13005                   h_sumTSmeanALS5->Fill(bbbc / bbb1);
13006                   if (bbbc / bbb1 > lsdep_estimator2_HEdepth3_)
13007                     h_2DsumTSmeanALS5->Fill(double(ieta), double(k3), bbbc);
13008                   h_2D0sumTSmeanALS5->Fill(double(ieta), double(k3), bbb1);
13009                   h_sumTSmeanAperLS5->Fill(float(lscounterM1), bbbc);
13010                   if (bbbc / bbb1 > lsdep_estimator2_HEdepth3_)
13011                     h_sumCutTSmeanAperLS5->Fill(float(lscounterM1), bbbc);
13012                   h_sum0TSmeanAperLS5->Fill(float(lscounterM1), bbb1);
13013                 }
13014               }
13015               // HF:
13016               if (k0 == 3) {
13017                 // HFdepth1
13018                 if (k1 + 1 == 1) {
13019                   h_sumTSmeanALS6->Fill(bbbc / bbb1);
13020                   if (bbbc / bbb1 > lsdep_estimator2_HFdepth1_)
13021                     h_2DsumTSmeanALS6->Fill(double(ieta), double(k3), bbbc);
13022                   h_2D0sumTSmeanALS6->Fill(double(ieta), double(k3), bbb1);
13023                   h_sumTSmeanAperLS6->Fill(float(lscounterM1), bbbc);
13024                   if (bbbc / bbb1 > lsdep_estimator2_HFdepth1_)
13025                     h_sumCutTSmeanAperLS6->Fill(float(lscounterM1), bbbc);
13026                   h_sum0TSmeanAperLS6->Fill(float(lscounterM1), bbb1);
13027                 }
13028                 if (k1 + 1 == 2) {
13029                   h_sumTSmeanALS7->Fill(bbbc / bbb1);
13030                   if (bbbc / bbb1 > lsdep_estimator2_HFdepth2_)
13031                     h_2DsumTSmeanALS7->Fill(double(ieta), double(k3), bbbc);
13032                   h_2D0sumTSmeanALS7->Fill(double(ieta), double(k3), bbb1);
13033                   h_sumTSmeanAperLS7->Fill(float(lscounterM1), bbbc);
13034                   if (bbbc / bbb1 > lsdep_estimator2_HFdepth2_)
13035                     h_sumCutTSmeanAperLS7->Fill(float(lscounterM1), bbbc);
13036                   h_sum0TSmeanAperLS7->Fill(float(lscounterM1), bbb1);
13037                 }
13038               }
13039               // HO:
13040               if (k0 == 2) {
13041                 // HOdepth1
13042                 if (k1 + 1 == 4) {
13043                   h_sumTSmeanALS8->Fill(bbbc / bbb1);
13044                   if (bbbc / bbb1 > lsdep_estimator2_HOdepth4_)
13045                     h_2DsumTSmeanALS8->Fill(double(ieta), double(k3), bbbc);
13046                   h_2D0sumTSmeanALS8->Fill(double(ieta), double(k3), bbb1);
13047                   h_sumTSmeanAperLS8->Fill(float(lscounterM1), bbbc);
13048                   if (bbbc / bbb1 > lsdep_estimator2_HOdepth4_)
13049                     h_sumCutTSmeanAperLS8->Fill(float(lscounterM1), bbbc);
13050                   h_sum0TSmeanAperLS8->Fill(float(lscounterM1), bbb1);
13051                 }
13052               }
13053             }  //if(sumEstimator2[k0][k1][k2][k3] != 0.
13054 
13055             // ------------------------------------------------------------------------------------------------------------------------sumEstimator3 Tx
13056             if (sumEstimator3[k0][k1][k2][k3] != 0.) {
13057               // fill histoes:
13058               double bbbc = 0.;
13059               if (flagestimatornormalization_ == 0)
13060                 bbbc = sumEstimator3[k0][k1][k2][k3] / nevcounter0;
13061               if (flagestimatornormalization_ == 1)
13062                 bbbc = sumEstimator3[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
13063               double bbb1 = 1.;
13064               if (flagestimatornormalization_ == 2) {
13065                 bbbc = sumEstimator3[k0][k1][k2][k3];
13066                 bbb1 = sum0Estimator[k0][k1][k2][k3];
13067               }
13068 
13069               // HB:
13070               if (k0 == 0) {
13071                 // HBdepth1
13072                 if (k1 + 1 == 1) {
13073                   h_sumTSmaxALS1->Fill(bbbc / bbb1);
13074                   if (bbbc / bbb1 > lsdep_estimator3_HBdepth1_)
13075                     h_2DsumTSmaxALS1->Fill(double(ieta), double(k3), bbbc);
13076                   h_2D0sumTSmaxALS1->Fill(double(ieta), double(k3), bbb1);
13077                   h_sumTSmaxAperLS1->Fill(float(lscounterM1), bbbc);
13078                   if (bbbc / bbb1 > lsdep_estimator3_HBdepth1_)
13079                     h_sumCutTSmaxAperLS1->Fill(float(lscounterM1), bbbc);
13080                   h_sum0TSmaxAperLS1->Fill(float(lscounterM1), bbb1);
13081                   if (bbbc / bbb1 > 2. * lsdep_estimator3_HBdepth1_)
13082                     h_sumTSmaxAperLS1_LSselected->Fill(float(lscounterM1), bbbc);
13083                 }
13084                 if (k1 + 1 == 2) {
13085                   h_sumTSmaxALS2->Fill(bbbc / bbb1);
13086                   if (bbbc / bbb1 > lsdep_estimator3_HBdepth2_)
13087                     h_2DsumTSmaxALS2->Fill(double(ieta), double(k3), bbbc);
13088                   h_2D0sumTSmaxALS2->Fill(double(ieta), double(k3), bbb1);
13089                   h_sumTSmaxAperLS2->Fill(float(lscounterM1), bbbc);
13090                   if (bbbc / bbb1 > lsdep_estimator3_HBdepth2_)
13091                     h_sumCutTSmaxAperLS2->Fill(float(lscounterM1), bbbc);
13092                   h_sum0TSmaxAperLS2->Fill(float(lscounterM1), bbb1);
13093                 }
13094               }
13095               // HE:
13096               if (k0 == 1) {
13097                 // HEdepth1
13098                 if (k1 + 1 == 1) {
13099                   h_sumTSmaxALS3->Fill(bbbc / bbb1);
13100                   if (bbbc / bbb1 > lsdep_estimator3_HEdepth1_)
13101                     h_2DsumTSmaxALS3->Fill(double(ieta), double(k3), bbbc);
13102                   h_2D0sumTSmaxALS3->Fill(double(ieta), double(k3), bbb1);
13103                   h_sumTSmaxAperLS3->Fill(float(lscounterM1), bbbc);
13104                   if (bbbc / bbb1 > lsdep_estimator3_HEdepth1_)
13105                     h_sumCutTSmaxAperLS3->Fill(float(lscounterM1), bbbc);
13106                   h_sum0TSmaxAperLS3->Fill(float(lscounterM1), bbb1);
13107                 }
13108                 if (k1 + 1 == 2) {
13109                   h_sumTSmaxALS4->Fill(bbbc / bbb1);
13110                   if (bbbc / bbb1 > lsdep_estimator3_HEdepth2_)
13111                     h_2DsumTSmaxALS4->Fill(double(ieta), double(k3), bbbc);
13112                   h_2D0sumTSmaxALS4->Fill(double(ieta), double(k3), bbb1);
13113                   h_sumTSmaxAperLS4->Fill(float(lscounterM1), bbbc);
13114                   if (bbbc / bbb1 > lsdep_estimator3_HEdepth2_)
13115                     h_sumCutTSmaxAperLS4->Fill(float(lscounterM1), bbbc);
13116                   h_sum0TSmaxAperLS4->Fill(float(lscounterM1), bbb1);
13117                 }
13118                 if (k1 + 1 == 3) {
13119                   h_sumTSmaxALS5->Fill(bbbc / bbb1);
13120                   if (bbbc / bbb1 > lsdep_estimator3_HEdepth3_)
13121                     h_2DsumTSmaxALS5->Fill(double(ieta), double(k3), bbbc);
13122                   h_2D0sumTSmaxALS5->Fill(double(ieta), double(k3), bbb1);
13123                   h_sumTSmaxAperLS5->Fill(float(lscounterM1), bbbc);
13124                   if (bbbc / bbb1 > lsdep_estimator3_HEdepth3_)
13125                     h_sumCutTSmaxAperLS5->Fill(float(lscounterM1), bbbc);
13126                   h_sum0TSmaxAperLS5->Fill(float(lscounterM1), bbb1);
13127                 }
13128               }
13129               // HF:
13130               if (k0 == 3) {
13131                 // HFdepth1
13132                 if (k1 + 1 == 1) {
13133                   h_sumTSmaxALS6->Fill(bbbc / bbb1);
13134                   if (bbbc / bbb1 > lsdep_estimator3_HFdepth1_)
13135                     h_2DsumTSmaxALS6->Fill(double(ieta), double(k3), bbbc);
13136                   h_2D0sumTSmaxALS6->Fill(double(ieta), double(k3), bbb1);
13137                   h_sumTSmaxAperLS6->Fill(float(lscounterM1), bbbc);
13138                   if (bbbc / bbb1 > lsdep_estimator3_HFdepth1_)
13139                     h_sumCutTSmaxAperLS6->Fill(float(lscounterM1), bbbc);
13140                   h_sum0TSmaxAperLS6->Fill(float(lscounterM1), bbb1);
13141                 }
13142                 if (k1 + 1 == 2) {
13143                   h_sumTSmaxALS7->Fill(bbbc / bbb1);
13144                   if (bbbc / bbb1 > lsdep_estimator3_HFdepth2_)
13145                     h_2DsumTSmaxALS7->Fill(double(ieta), double(k3), bbbc);
13146                   h_2D0sumTSmaxALS7->Fill(double(ieta), double(k3), bbb1);
13147                   h_sumTSmaxAperLS7->Fill(float(lscounterM1), bbbc);
13148                   if (bbbc / bbb1 > lsdep_estimator3_HFdepth2_)
13149                     h_sumCutTSmaxAperLS7->Fill(float(lscounterM1), bbbc);
13150                   h_sum0TSmaxAperLS7->Fill(float(lscounterM1), bbb1);
13151                 }
13152               }
13153               // HO:
13154               if (k0 == 2) {
13155                 // HOdepth1
13156                 if (k1 + 1 == 4) {
13157                   h_sumTSmaxALS8->Fill(bbbc / bbb1);
13158                   if (bbbc / bbb1 > lsdep_estimator3_HOdepth4_)
13159                     h_2DsumTSmaxALS8->Fill(double(ieta), double(k3), bbbc);
13160                   h_2D0sumTSmaxALS8->Fill(double(ieta), double(k3), bbb1);
13161                   h_sumTSmaxAperLS8->Fill(float(lscounterM1), bbbc);
13162                   if (bbbc / bbb1 > lsdep_estimator3_HOdepth4_)
13163                     h_sumCutTSmaxAperLS8->Fill(float(lscounterM1), bbbc);
13164                   h_sum0TSmaxAperLS8->Fill(float(lscounterM1), bbb1);
13165                 }
13166               }
13167             }  //if(sumEstimator3[k0][k1][k2][k3] != 0.
13168 
13169             // ------------------------------------------------------------------------------------------------------------------------sumEstimator4 W
13170             if (sumEstimator4[k0][k1][k2][k3] != 0.) {
13171               // fill histoes:
13172               double bbbc = 0.;
13173               if (flagestimatornormalization_ == 0)
13174                 bbbc = sumEstimator4[k0][k1][k2][k3] / nevcounter0;
13175               if (flagestimatornormalization_ == 1)
13176                 bbbc = sumEstimator4[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
13177               double bbb1 = 1.;
13178               if (flagestimatornormalization_ == 2) {
13179                 bbbc = sumEstimator4[k0][k1][k2][k3];
13180                 bbb1 = sum0Estimator[k0][k1][k2][k3];
13181               }
13182 
13183               // HB:
13184               if (k0 == 0) {
13185                 // HBdepth1
13186                 if (k1 + 1 == 1) {
13187                   h_sumAmplitudeLS1->Fill(bbbc / bbb1);
13188                   if (bbbc / bbb1 > lsdep_estimator4_HBdepth1_)
13189                     h_2DsumAmplitudeLS1->Fill(double(ieta), double(k3), bbbc);
13190                   h_2D0sumAmplitudeLS1->Fill(double(ieta), double(k3), bbb1);
13191                   h_sumAmplitudeperLS1->Fill(float(lscounterM1), bbbc);
13192                   if (bbbc / bbb1 > lsdep_estimator4_HBdepth1_)
13193                     h_sumCutAmplitudeperLS1->Fill(float(lscounterM1), bbbc);
13194                   h_sum0AmplitudeperLS1->Fill(float(lscounterM1), bbb1);
13195                   if (bbbc / bbb1 > 2. * lsdep_estimator4_HBdepth1_)
13196                     h_sumAmplitudeperLS1_LSselected->Fill(float(lscounterM1), bbbc);
13197                 }
13198                 if (k1 + 1 == 2) {
13199                   h_sumAmplitudeLS2->Fill(bbbc / bbb1);
13200                   if (bbbc / bbb1 > lsdep_estimator4_HBdepth2_)
13201                     h_2DsumAmplitudeLS2->Fill(double(ieta), double(k3), bbbc);
13202                   h_2D0sumAmplitudeLS2->Fill(double(ieta), double(k3), bbb1);
13203                   h_sumAmplitudeperLS2->Fill(float(lscounterM1), bbbc);
13204                   if (bbbc / bbb1 > lsdep_estimator4_HBdepth2_)
13205                     h_sumCutAmplitudeperLS2->Fill(float(lscounterM1), bbbc);
13206                   h_sum0AmplitudeperLS2->Fill(float(lscounterM1), bbb1);
13207                 }
13208               }
13209               // HE:
13210               if (k0 == 1) {
13211                 // HEdepth1
13212                 if (k1 + 1 == 1) {
13213                   h_sumAmplitudeLS3->Fill(bbbc / bbb1);
13214                   if (bbbc / bbb1 > lsdep_estimator4_HEdepth1_)
13215                     h_2DsumAmplitudeLS3->Fill(double(ieta), double(k3), bbbc);
13216                   h_2D0sumAmplitudeLS3->Fill(double(ieta), double(k3), bbb1);
13217                   h_sumAmplitudeperLS3->Fill(float(lscounterM1), bbbc);
13218                   if (bbbc / bbb1 > lsdep_estimator4_HEdepth1_)
13219                     h_sumCutAmplitudeperLS3->Fill(float(lscounterM1), bbbc);
13220                   h_sum0AmplitudeperLS3->Fill(float(lscounterM1), bbb1);
13221                 }
13222                 if (k1 + 1 == 2) {
13223                   h_sumAmplitudeLS4->Fill(bbbc / bbb1);
13224                   if (bbbc / bbb1 > lsdep_estimator4_HEdepth2_)
13225                     h_2DsumAmplitudeLS4->Fill(double(ieta), double(k3), bbbc);
13226                   h_2D0sumAmplitudeLS4->Fill(double(ieta), double(k3), bbb1);
13227                   h_sumAmplitudeperLS4->Fill(float(lscounterM1), bbbc);
13228                   if (bbbc / bbb1 > lsdep_estimator4_HEdepth2_)
13229                     h_sumCutAmplitudeperLS4->Fill(float(lscounterM1), bbbc);
13230                   h_sum0AmplitudeperLS4->Fill(float(lscounterM1), bbb1);
13231                 }
13232                 if (k1 + 1 == 3) {
13233                   h_sumAmplitudeLS5->Fill(bbbc / bbb1);
13234                   if (bbbc / bbb1 > lsdep_estimator4_HEdepth3_)
13235                     h_2DsumAmplitudeLS5->Fill(double(ieta), double(k3), bbbc);
13236                   h_2D0sumAmplitudeLS5->Fill(double(ieta), double(k3), bbb1);
13237                   h_sumAmplitudeperLS5->Fill(float(lscounterM1), bbbc);
13238                   if (bbbc / bbb1 > lsdep_estimator4_HEdepth3_)
13239                     h_sumCutAmplitudeperLS5->Fill(float(lscounterM1), bbbc);
13240                   h_sum0AmplitudeperLS5->Fill(float(lscounterM1), bbb1);
13241                 }
13242               }
13243               // HF:
13244               if (k0 == 3) {
13245                 // HFdepth1
13246                 if (k1 + 1 == 1) {
13247                   h_sumAmplitudeLS6->Fill(bbbc / bbb1);
13248                   if (bbbc / bbb1 > lsdep_estimator4_HFdepth1_)
13249                     h_2DsumAmplitudeLS6->Fill(double(ieta), double(k3), bbbc);
13250                   h_2D0sumAmplitudeLS6->Fill(double(ieta), double(k3), bbb1);
13251                   h_sumAmplitudeperLS6->Fill(float(lscounterM1), bbbc);
13252                   if (bbbc / bbb1 > lsdep_estimator4_HFdepth1_)
13253                     h_sumCutAmplitudeperLS6->Fill(float(lscounterM1), bbbc);
13254                   h_sum0AmplitudeperLS6->Fill(float(lscounterM1), bbb1);
13255                 }
13256                 if (k1 + 1 == 2) {
13257                   h_sumAmplitudeLS7->Fill(bbbc / bbb1);
13258                   if (bbbc / bbb1 > lsdep_estimator4_HFdepth2_)
13259                     h_2DsumAmplitudeLS7->Fill(double(ieta), double(k3), bbbc);
13260                   h_2D0sumAmplitudeLS7->Fill(double(ieta), double(k3), bbb1);
13261                   h_sumAmplitudeperLS7->Fill(float(lscounterM1), bbbc);
13262                   if (bbbc / bbb1 > lsdep_estimator4_HFdepth2_)
13263                     h_sumCutAmplitudeperLS7->Fill(float(lscounterM1), bbbc);
13264                   h_sum0AmplitudeperLS7->Fill(float(lscounterM1), bbb1);
13265                 }
13266               }
13267               // HO:
13268               if (k0 == 2) {
13269                 // HOdepth1
13270                 if (k1 + 1 == 4) {
13271                   h_sumAmplitudeLS8->Fill(bbbc / bbb1);
13272                   if (bbbc / bbb1 > lsdep_estimator4_HOdepth4_)
13273                     h_2DsumAmplitudeLS8->Fill(double(ieta), double(k3), bbbc);
13274                   h_2D0sumAmplitudeLS8->Fill(double(ieta), double(k3), bbb1);
13275                   h_sumAmplitudeperLS8->Fill(float(lscounterM1), bbbc);
13276                   if (bbbc / bbb1 > lsdep_estimator4_HOdepth4_)
13277                     h_sumCutAmplitudeperLS8->Fill(float(lscounterM1), bbbc);
13278                   h_sum0AmplitudeperLS8->Fill(float(lscounterM1), bbb1);
13279                 }
13280               }
13281             }  //if(sumEstimator4[k0][k1][k2][k3] != 0.
13282 
13283             // ------------------------------------------------------------------------------------------------------------------------sumEstimator5 R
13284             if (sumEstimator5[k0][k1][k2][k3] != 0.) {
13285               // fill histoes:
13286               double bbbc = 0.;
13287               if (flagestimatornormalization_ == 0)
13288                 bbbc = sumEstimator5[k0][k1][k2][k3] / nevcounter0;
13289               if (flagestimatornormalization_ == 1)
13290                 bbbc = sumEstimator5[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
13291               double bbb1 = 1.;
13292               if (flagestimatornormalization_ == 2) {
13293                 bbbc = sumEstimator5[k0][k1][k2][k3];
13294                 bbb1 = sum0Estimator[k0][k1][k2][k3];
13295               }
13296 
13297               // HB:
13298               if (k0 == 0) {
13299                 // HBdepth1
13300                 if (k1 + 1 == 1) {
13301                   h_sumAmplLS1->Fill(bbbc / bbb1);
13302                   if (bbbc / bbb1 > lsdep_estimator5_HBdepth1_)
13303                     h_2DsumAmplLS1->Fill(double(ieta), double(k3), bbbc);
13304                   h_2D0sumAmplLS1->Fill(double(ieta), double(k3), bbb1);
13305                   h_sumAmplperLS1->Fill(float(lscounterM1), bbbc);
13306                   if (bbbc / bbb1 > lsdep_estimator5_HBdepth1_)
13307                     h_sumCutAmplperLS1->Fill(float(lscounterM1), bbbc);
13308                   h_sum0AmplperLS1->Fill(float(lscounterM1), bbb1);
13309                   if (bbbc / bbb1 > 2. * lsdep_estimator5_HBdepth1_)
13310                     h_sumAmplperLS1_LSselected->Fill(float(lscounterM1), bbbc);
13311                 }
13312                 if (k1 + 1 == 2) {
13313                   h_sumAmplLS2->Fill(bbbc / bbb1);
13314                   if (bbbc / bbb1 > lsdep_estimator5_HBdepth2_)
13315                     h_2DsumAmplLS2->Fill(double(ieta), double(k3), bbbc);
13316                   h_2D0sumAmplLS2->Fill(double(ieta), double(k3), bbb1);
13317                   h_sumAmplperLS2->Fill(float(lscounterM1), bbbc);
13318                   if (bbbc / bbb1 > lsdep_estimator5_HBdepth2_)
13319                     h_sumCutAmplperLS2->Fill(float(lscounterM1), bbbc);
13320                   h_sum0AmplperLS2->Fill(float(lscounterM1), bbb1);
13321                 }
13322               }
13323               // HE:
13324               if (k0 == 1) {
13325                 // HEdepth1
13326                 if (k1 + 1 == 1) {
13327                   h_sumAmplLS3->Fill(bbbc / bbb1);
13328                   if (bbbc / bbb1 > lsdep_estimator5_HEdepth1_)
13329                     h_2DsumAmplLS3->Fill(double(ieta), double(k3), bbbc);
13330                   h_2D0sumAmplLS3->Fill(double(ieta), double(k3), bbb1);
13331                   h_sumAmplperLS3->Fill(float(lscounterM1), bbbc);
13332                   if (bbbc / bbb1 > lsdep_estimator5_HEdepth1_)
13333                     h_sumCutAmplperLS3->Fill(float(lscounterM1), bbbc);
13334                   h_sum0AmplperLS3->Fill(float(lscounterM1), bbb1);
13335                 }
13336                 if (k1 + 1 == 2) {
13337                   h_sumAmplLS4->Fill(bbbc / bbb1);
13338                   if (bbbc / bbb1 > lsdep_estimator5_HEdepth2_)
13339                     h_2DsumAmplLS4->Fill(double(ieta), double(k3), bbbc);
13340                   h_2D0sumAmplLS4->Fill(double(ieta), double(k3), bbb1);
13341                   h_sumAmplperLS4->Fill(float(lscounterM1), bbbc);
13342                   if (bbbc / bbb1 > lsdep_estimator5_HEdepth2_)
13343                     h_sumCutAmplperLS4->Fill(float(lscounterM1), bbbc);
13344                   h_sum0AmplperLS4->Fill(float(lscounterM1), bbb1);
13345                 }
13346                 if (k1 + 1 == 3) {
13347                   h_sumAmplLS5->Fill(bbbc / bbb1);
13348                   if (bbbc / bbb1 > lsdep_estimator5_HEdepth3_)
13349                     h_2DsumAmplLS5->Fill(double(ieta), double(k3), bbbc);
13350                   h_2D0sumAmplLS5->Fill(double(ieta), double(k3), bbb1);
13351                   h_sumAmplperLS5->Fill(float(lscounterM1), bbbc);
13352                   if (bbbc / bbb1 > lsdep_estimator5_HEdepth3_)
13353                     h_sumCutAmplperLS5->Fill(float(lscounterM1), bbbc);
13354                   h_sum0AmplperLS5->Fill(float(lscounterM1), bbb1);
13355                 }
13356               }
13357               // HF:
13358               if (k0 == 3) {
13359                 // HFdepth1
13360                 if (k1 + 1 == 1) {
13361                   h_sumAmplLS6->Fill(bbbc / bbb1);
13362                   if (bbbc / bbb1 > lsdep_estimator5_HFdepth1_)
13363                     h_2DsumAmplLS6->Fill(double(ieta), double(k3), bbbc);
13364                   h_2D0sumAmplLS6->Fill(double(ieta), double(k3), bbb1);
13365                   h_sumAmplperLS6->Fill(float(lscounterM1), bbbc);
13366                   if (bbbc / bbb1 > lsdep_estimator5_HFdepth1_)
13367                     h_sumCutAmplperLS6->Fill(float(lscounterM1), bbbc);
13368                   h_sum0AmplperLS6->Fill(float(lscounterM1), bbb1);
13369                 }
13370                 if (k1 + 1 == 2) {
13371                   h_sumAmplLS7->Fill(bbbc / bbb1);
13372                   if (bbbc / bbb1 > lsdep_estimator5_HFdepth2_)
13373                     h_2DsumAmplLS7->Fill(double(ieta), double(k3), bbbc);
13374                   h_2D0sumAmplLS7->Fill(double(ieta), double(k3), bbb1);
13375                   h_sumAmplperLS7->Fill(float(lscounterM1), bbbc);
13376                   if (bbbc / bbb1 > lsdep_estimator5_HFdepth2_)
13377                     h_sumCutAmplperLS7->Fill(float(lscounterM1), bbbc);
13378                   h_sum0AmplperLS7->Fill(float(lscounterM1), bbb1);
13379                 }
13380               }
13381               // HO:
13382               if (k0 == 2) {
13383                 // HOdepth1
13384                 if (k1 + 1 == 4) {
13385                   h_sumAmplLS8->Fill(bbbc / bbb1);
13386                   if (bbbc / bbb1 > lsdep_estimator5_HOdepth4_)
13387                     h_2DsumAmplLS8->Fill(double(ieta), double(k3), bbbc);
13388                   h_2D0sumAmplLS8->Fill(double(ieta), double(k3), bbb1);
13389                   h_sumAmplperLS8->Fill(float(lscounterM1), bbbc);
13390                   if (bbbc / bbb1 > lsdep_estimator5_HOdepth4_)
13391                     h_sumCutAmplperLS8->Fill(float(lscounterM1), bbbc);
13392                   h_sum0AmplperLS8->Fill(float(lscounterM1), bbb1);
13393                 }
13394               }
13395             }  //if(sumEstimator5[k0][k1][k2][k3] != 0.
13396             // ------------------------------------------------------------------------------------------------------------------------sumEstimator6 (Error-B)
13397             if (sumEstimator6[k0][k1][k2][k3] != 0.) {
13398               // fill histoes:
13399               double bbbc = 0.;
13400               if (flagestimatornormalization_ == 0)
13401                 bbbc = sumEstimator6[k0][k1][k2][k3] / nevcounter0;
13402               if (flagestimatornormalization_ == 1)
13403                 bbbc = sumEstimator6[k0][k1][k2][k3] / sum0Estimator[k0][k1][k2][k3];
13404               double bbb1 = 1.;
13405               if (flagestimatornormalization_ == 2) {
13406                 bbbc = sumEstimator6[k0][k1][k2][k3];
13407                 bbb1 = sum0Estimator[k0][k1][k2][k3];
13408               }
13409 
13410               // HB:
13411               if (k0 == 0) {
13412                 // HBdepth1
13413                 if (k1 + 1 == 1) {
13414                   h_sumErrorBLS1->Fill(bbbc / bbb1);
13415                   h_2DsumErrorBLS1->Fill(double(ieta), double(k3), bbbc);
13416                   h_2D0sumErrorBLS1->Fill(double(ieta), double(k3), bbb1);
13417                   h_sumErrorBperLS1->Fill(float(lscounterM1), bbbc);
13418                   h_sum0ErrorBperLS1->Fill(float(lscounterM1), bbb1);
13419                 }
13420                 if (k1 + 1 == 2) {
13421                   h_sumErrorBLS2->Fill(bbbc / bbb1);
13422                   h_2DsumErrorBLS2->Fill(double(ieta), double(k3), bbbc);
13423                   h_2D0sumErrorBLS2->Fill(double(ieta), double(k3), bbb1);
13424                   h_sumErrorBperLS2->Fill(float(lscounterM1), bbbc);
13425                   h_sum0ErrorBperLS2->Fill(float(lscounterM1), bbb1);
13426                 }
13427               }
13428               // HE:
13429               if (k0 == 1) {
13430                 // HEdepth1
13431                 if (k1 + 1 == 1) {
13432                   h_sumErrorBLS3->Fill(bbbc / bbb1);
13433                   h_2DsumErrorBLS3->Fill(double(ieta), double(k3), bbbc);
13434                   h_2D0sumErrorBLS3->Fill(double(ieta), double(k3), bbb1);
13435                   h_sumErrorBperLS3->Fill(float(lscounterM1), bbbc);
13436                   h_sum0ErrorBperLS3->Fill(float(lscounterM1), bbb1);
13437                 }
13438                 if (k1 + 1 == 2) {
13439                   h_sumErrorBLS4->Fill(bbbc / bbb1);
13440                   h_2DsumErrorBLS4->Fill(double(ieta), double(k3), bbbc);
13441                   h_2D0sumErrorBLS4->Fill(double(ieta), double(k3), bbb1);
13442                   h_sumErrorBperLS4->Fill(float(lscounterM1), bbbc);
13443                   h_sum0ErrorBperLS4->Fill(float(lscounterM1), bbb1);
13444                 }
13445                 if (k1 + 1 == 3) {
13446                   h_sumErrorBLS5->Fill(bbbc / bbb1);
13447                   h_2DsumErrorBLS5->Fill(double(ieta), double(k3), bbbc);
13448                   h_2D0sumErrorBLS5->Fill(double(ieta), double(k3), bbb1);
13449                   h_sumErrorBperLS5->Fill(float(lscounterM1), bbbc);
13450                   h_sum0ErrorBperLS5->Fill(float(lscounterM1), bbb1);
13451                 }
13452               }
13453               // HF:
13454               if (k0 == 3) {
13455                 // HFdepth1
13456                 if (k1 + 1 == 1) {
13457                   h_sumErrorBLS6->Fill(bbbc / bbb1);
13458                   h_2DsumErrorBLS6->Fill(double(ieta), double(k3), bbbc);
13459                   h_2D0sumErrorBLS6->Fill(double(ieta), double(k3), bbb1);
13460                   h_sumErrorBperLS6->Fill(float(lscounterM1), bbbc);
13461                   h_sum0ErrorBperLS6->Fill(float(lscounterM1), bbb1);
13462                 }
13463                 if (k1 + 1 == 2) {
13464                   h_sumErrorBLS7->Fill(bbbc / bbb1);
13465                   h_2DsumErrorBLS7->Fill(double(ieta), double(k3), bbbc);
13466                   h_2D0sumErrorBLS7->Fill(double(ieta), double(k3), bbb1);
13467                   h_sumErrorBperLS7->Fill(float(lscounterM1), bbbc);
13468                   h_sum0ErrorBperLS7->Fill(float(lscounterM1), bbb1);
13469                 }
13470               }
13471               // HO:
13472               if (k0 == 2) {
13473                 // HOdepth4
13474                 if (k1 + 1 == 4) {
13475                   h_sumErrorBLS8->Fill(bbbc / bbb1);
13476                   h_2DsumErrorBLS8->Fill(double(ieta), double(k3), bbbc);
13477                   h_2D0sumErrorBLS8->Fill(double(ieta), double(k3), bbb1);
13478                   h_sumErrorBperLS8->Fill(float(lscounterM1), bbbc);
13479                   h_sum0ErrorBperLS8->Fill(float(lscounterM1), bbb1);
13480                 }
13481               }
13482               ///
13483             }  //if(sumEstimator6[k0][k1][k2][k3] != 0.
13484 
13485             ///
13486             ///
13487           }  //for
13488         }  //for
13489       }  //for
13490     }  //for
13491 
13492     //------------------------------------------------------   averSIGNAL
13493     averSIGNALoccupancy_HB /= float(nevcounter0);
13494     h_averSIGNALoccupancy_HB->Fill(float(lscounterM1), averSIGNALoccupancy_HB);
13495     averSIGNALoccupancy_HE /= float(nevcounter0);
13496     h_averSIGNALoccupancy_HE->Fill(float(lscounterM1), averSIGNALoccupancy_HE);
13497     averSIGNALoccupancy_HF /= float(nevcounter0);
13498     h_averSIGNALoccupancy_HF->Fill(float(lscounterM1), averSIGNALoccupancy_HF);
13499     averSIGNALoccupancy_HO /= float(nevcounter0);
13500     h_averSIGNALoccupancy_HO->Fill(float(lscounterM1), averSIGNALoccupancy_HO);
13501 
13502     averSIGNALoccupancy_HB = 0.;
13503     averSIGNALoccupancy_HE = 0.;
13504     averSIGNALoccupancy_HF = 0.;
13505     averSIGNALoccupancy_HO = 0.;
13506 
13507     //------------------------------------------------------
13508     averSIGNALsumamplitude_HB /= float(nevcounter0);
13509     h_averSIGNALsumamplitude_HB->Fill(float(lscounterM1), averSIGNALsumamplitude_HB);
13510     averSIGNALsumamplitude_HE /= float(nevcounter0);
13511     h_averSIGNALsumamplitude_HE->Fill(float(lscounterM1), averSIGNALsumamplitude_HE);
13512     averSIGNALsumamplitude_HF /= float(nevcounter0);
13513     h_averSIGNALsumamplitude_HF->Fill(float(lscounterM1), averSIGNALsumamplitude_HF);
13514     averSIGNALsumamplitude_HO /= float(nevcounter0);
13515     h_averSIGNALsumamplitude_HO->Fill(float(lscounterM1), averSIGNALsumamplitude_HO);
13516 
13517     averSIGNALsumamplitude_HB = 0.;
13518     averSIGNALsumamplitude_HE = 0.;
13519     averSIGNALsumamplitude_HF = 0.;
13520     averSIGNALsumamplitude_HO = 0.;
13521 
13522     //------------------------------------------------------   averNOSIGNAL
13523     averNOSIGNALoccupancy_HB /= float(nevcounter0);
13524     h_averNOSIGNALoccupancy_HB->Fill(float(lscounterM1), averNOSIGNALoccupancy_HB);
13525     averNOSIGNALoccupancy_HE /= float(nevcounter0);
13526     h_averNOSIGNALoccupancy_HE->Fill(float(lscounterM1), averNOSIGNALoccupancy_HE);
13527     averNOSIGNALoccupancy_HF /= float(nevcounter0);
13528     h_averNOSIGNALoccupancy_HF->Fill(float(lscounterM1), averNOSIGNALoccupancy_HF);
13529     averNOSIGNALoccupancy_HO /= float(nevcounter0);
13530     h_averNOSIGNALoccupancy_HO->Fill(float(lscounterM1), averNOSIGNALoccupancy_HO);
13531 
13532     averNOSIGNALoccupancy_HB = 0.;
13533     averNOSIGNALoccupancy_HE = 0.;
13534     averNOSIGNALoccupancy_HF = 0.;
13535     averNOSIGNALoccupancy_HO = 0.;
13536 
13537     //------------------------------------------------------
13538     averNOSIGNALsumamplitude_HB /= float(nevcounter0);
13539     h_averNOSIGNALsumamplitude_HB->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HB);
13540     averNOSIGNALsumamplitude_HE /= float(nevcounter0);
13541     h_averNOSIGNALsumamplitude_HE->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HE);
13542     averNOSIGNALsumamplitude_HF /= float(nevcounter0);
13543     h_averNOSIGNALsumamplitude_HF->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HF);
13544     averNOSIGNALsumamplitude_HO /= float(nevcounter0);
13545     h_averNOSIGNALsumamplitude_HO->Fill(float(lscounterM1), averNOSIGNALsumamplitude_HO);
13546 
13547     averNOSIGNALsumamplitude_HB = 0.;
13548     averNOSIGNALsumamplitude_HE = 0.;
13549     averNOSIGNALsumamplitude_HF = 0.;
13550     averNOSIGNALsumamplitude_HO = 0.;
13551 
13552     h_maxxSUMAmpl_HB->Fill(float(lscounterM1), maxxSUM1);
13553     h_maxxSUMAmpl_HE->Fill(float(lscounterM1), maxxSUM2);
13554     h_maxxSUMAmpl_HO->Fill(float(lscounterM1), maxxSUM3);
13555     h_maxxSUMAmpl_HF->Fill(float(lscounterM1), maxxSUM4);
13556     maxxSUM1 = 0.;
13557     maxxSUM2 = 0.;
13558     maxxSUM3 = 0.;
13559     maxxSUM4 = 0.;
13560     //------------------------------------------------------
13561     h_maxxOCCUP_HB->Fill(float(lscounterM1), maxxOCCUP1);
13562     h_maxxOCCUP_HE->Fill(float(lscounterM1), maxxOCCUP2);
13563     h_maxxOCCUP_HO->Fill(float(lscounterM1), maxxOCCUP3);
13564     h_maxxOCCUP_HF->Fill(float(lscounterM1), maxxOCCUP4);
13565     maxxOCCUP1 = 0.;
13566     maxxOCCUP2 = 0.;
13567     maxxOCCUP3 = 0.;
13568     maxxOCCUP4 = 0.;
13569 
13570   }  //if( nevcounter0 != 0 )
13571   /////////////////////////////// -------------------------------------------------------------------
13572 
13573   std::cout << " ==== Edn of run " << std::endl;
13574 }
13575 /////////////////////////////// -------------------------------------------------------------------
13576 //
13577 /////////////////////////////// -------------------------------------------------------------------
13578 //
13579 void CMTRawAnalyzer::fillMAP() {
13580   HcalLogicalMapGenerator gen;
13581   HcalLogicalMap lmap = gen.createMap(topo);
13582 
13583   //    HcalElectronicsMap emap=lmap.generateHcalElectronicsMap();
13584 
13585   //    const HcalElectronicsMap* emap=conditions->getHcalMapping();
13586   const HcalElectronicsMap* emap;
13587   emap = conditions->getHcalMapping();
13588 
13589   std::string subdet = "";
13590 
13591   MAPfile << "#define LogEleMapdb_h" << std::endl;
13592   MAPfile << "#include <algorithm>" << std::endl;
13593   MAPfile << "#include <iostream>" << std::endl;
13594   MAPfile << "#include <vector>" << std::endl;
13595   MAPfile << "#include <string>" << std::endl;
13596   MAPfile << "#include <sstream>" << std::endl;
13597   MAPfile << std::endl;
13598 
13599   MAPfile << "struct Cell {" << std::endl;
13600   MAPfile << " std::string subdet;" << std::endl;
13601   MAPfile << " int Eta;" << std::endl;
13602   MAPfile << " int Phi;" << std::endl;
13603   MAPfile << " int Depth;" << std::endl;
13604   MAPfile << " std::string RBX;" << std::endl;
13605   MAPfile << " int RM;" << std::endl;
13606   MAPfile << " int Pixel;" << std::endl;
13607   MAPfile << " int RMfiber;" << std::endl;
13608   MAPfile << " int FiberCh;" << std::endl;
13609   MAPfile << " int QIE;" << std::endl;
13610   MAPfile << " int ADC;" << std::endl;
13611   MAPfile << " int VMECardID;" << std::endl;
13612   MAPfile << " int dccID;" << std::endl;
13613   MAPfile << " int Spigot;" << std::endl;
13614   MAPfile << " int FiberIndex;" << std::endl;
13615   MAPfile << " int HtrSlot;" << std::endl;
13616   MAPfile << " int HtrTB;" << std::endl;
13617   MAPfile << std::endl;
13618 
13619   MAPfile << "// the function check, if \"par\" == \"val\" for this cell" << std::endl;
13620   MAPfile << " bool check(const std::string par, const int val) const " << std::endl;
13621   MAPfile << " {" << std::endl;
13622   MAPfile << "       if (par == \"Eta\")    return (val == Eta);" << std::endl;
13623   MAPfile << "  else if (par == \"Phi\")     return (val == Phi);" << std::endl;
13624   MAPfile << "  else if (par == \"Depth\")      return (val == Depth);" << std::endl;
13625   MAPfile << "  else if (par == \"RM\")     return (val == RM);" << std::endl;
13626   MAPfile << "  else if (par == \"Pixel\") return (val == Pixel);" << std::endl;
13627   MAPfile << "  else if (par == \"RMfiber\")    return (val == RMfiber);" << std::endl;
13628   MAPfile << "  else if (par == \"FiberCh\")    return (val == FiberCh);" << std::endl;
13629   MAPfile << "  else if (par == \"QIE\")     return (val == QIE);" << std::endl;
13630   MAPfile << "  else if (par == \"ADC\")     return (val == ADC);" << std::endl;
13631   MAPfile << "  else if (par == \"VMECardID\")     return (val == VMECardID);" << std::endl;
13632   MAPfile << "  else if (par == \"dccID\")     return (val == dccID);" << std::endl;
13633   MAPfile << "  else if (par == \"Spigot\")     return (val == Spigot);" << std::endl;
13634   MAPfile << "  else if (par == \"FiberIndex\")     return (val == FiberIndex);" << std::endl;
13635   MAPfile << "  else if (par == \"HtrSlot\")     return (val == HtrSlot);" << std::endl;
13636   MAPfile << "  else if (par == \"HtrTB\")     return (val == HtrTB);" << std::endl;
13637   MAPfile << "  else return false;" << std::endl;
13638   MAPfile << " }" << std::endl;
13639   MAPfile << std::endl;
13640 
13641   MAPfile << " bool check(const std::string par, const std::string val) const" << std::endl;
13642   MAPfile << " {" << std::endl;
13643   MAPfile << "       if (par == \"subdet\")    return (val == subdet);" << std::endl;
13644   MAPfile << "  else if (par == \"RBX\")    return (val == RBX);" << std::endl;
13645   MAPfile << "  else return false;" << std::endl;
13646   MAPfile << " }" << std::endl;
13647 
13648   MAPfile << "};" << std::endl;
13649   MAPfile << std::endl;
13650 
13651   MAPfile << "const Cell AllCells[] = {" << std::endl;
13652   MAPfile << "//{ SD, Eta, Phi, Depth,     RBX, RM, PIXEL, RMfiber, Fiber Ch., QIE, ADC, VMECrateId, dccid, spigot, "
13653              "fiberIndex, htrSlot, htrTopBottom }"
13654           << std::endl;
13655 
13656   // HB
13657 
13658   for (int eta = -16; eta < 0; eta++) {
13659     for (int phi = 1; phi <= nphi; phi++) {
13660       for (int depth = 1; depth <= 2; depth++) {
13661         HcalDetId* detid = nullptr;
13662         detid = new HcalDetId(HcalBarrel, eta, phi, depth);
13663         subdet = "HB";
13664         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13665         HcalElectronicsId emap_entry = emap->lookup(*detid);
13666         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() << " , " << detid->iphi() - 1 << " ,    "
13667                 << detid->depth() << " ,";
13668         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13669                 << lmap_entry.rmFiber() << " ,        ";
13670         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13671                 << " ,        ";
13672         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13673                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13674         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13675         MAPfile << "}," << std::endl;
13676         delete detid;
13677       }  //Depth
13678     }  //Phi
13679   }  //Eta
13680   for (int eta = 1; eta <= 16; eta++) {
13681     for (int phi = 1; phi <= nphi; phi++) {
13682       for (int depth = 1; depth <= 2; depth++) {
13683         HcalDetId* detid = nullptr;
13684         detid = new HcalDetId(HcalBarrel, eta, phi, depth);
13685         subdet = "HB";
13686         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13687         HcalElectronicsId emap_entry = emap->lookup(*detid);
13688         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() - 1 << " , " << detid->iphi() - 1 << " ,    "
13689                 << detid->depth() << " ,";
13690         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13691                 << lmap_entry.rmFiber() << " ,        ";
13692         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13693                 << " ,        ";
13694         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13695                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13696         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13697         MAPfile << "}," << std::endl;
13698         delete detid;
13699       }  //Depth
13700     }  //Phi
13701   }  //Eta
13702 
13703   // HE
13704   for (int eta = -20; eta <= -20; eta++) {
13705     for (int phi = nphi; phi <= nphi; phi++) {
13706       for (int depth = 1; depth <= 2; depth++) {
13707         HcalDetId* detid = nullptr;
13708         detid = new HcalDetId(HcalEndcap, eta, phi, depth);
13709         subdet = "HE";
13710         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13711         HcalElectronicsId emap_entry = emap->lookup(*detid);
13712         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() << " , " << detid->iphi() - 1 << " ,    "
13713                 << detid->depth() << " ,";
13714         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13715                 << lmap_entry.rmFiber() << " ,        ";
13716         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13717                 << " ,        ";
13718         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13719                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13720         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13721         MAPfile << "}," << std::endl;
13722         delete detid;
13723       }  //Depth
13724     }  //Phi
13725   }  //Eta
13726 
13727   for (int eta = -19; eta <= -16; eta++) {
13728     for (int phi = nphi; phi <= nphi; phi++) {
13729       for (int depth = 1; depth <= 3; depth++) {
13730         HcalDetId* detid = nullptr;
13731         detid = new HcalDetId(HcalEndcap, eta, phi, depth);
13732         subdet = "HE";
13733         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13734         HcalElectronicsId emap_entry = emap->lookup(*detid);
13735         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() << " , " << detid->iphi() - 1 << " ,    "
13736                 << detid->depth() << " ,";
13737         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13738                 << lmap_entry.rmFiber() << " ,        ";
13739         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13740                 << " ,        ";
13741         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13742                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13743         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13744         MAPfile << "}," << std::endl;
13745         delete detid;
13746       }  //Depth
13747     }  //Phi
13748   }  //Eta
13749   for (int eta = -29; eta <= -16; eta++) {
13750     for (int phi = 1; phi <= 71; phi++) {
13751       for (int depth = 1; depth <= 3; depth++) {
13752         HcalDetId* detid = nullptr;
13753         detid = new HcalDetId(HcalEndcap, eta, phi, depth);
13754         subdet = "HE";
13755         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13756         HcalElectronicsId emap_entry = emap->lookup(*detid);
13757         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() << " , " << detid->iphi() - 1 << " ,    "
13758                 << detid->depth() << " ,";
13759         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13760                 << lmap_entry.rmFiber() << " ,        ";
13761         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13762                 << " ,        ";
13763         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13764                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13765         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13766         MAPfile << "}," << std::endl;
13767         delete detid;
13768       }  //Depth
13769     }  //Phi
13770   }  //Eta
13771   for (int eta = 16; eta <= 29; eta++) {
13772     for (int phi = 1; phi <= nphi; phi++) {
13773       for (int depth = 1; depth <= 3; depth++) {
13774         HcalDetId* detid = nullptr;
13775         detid = new HcalDetId(HcalEndcap, eta, phi, depth);
13776         subdet = "HE";
13777         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13778         HcalElectronicsId emap_entry = emap->lookup(*detid);
13779         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() << " , " << detid->iphi() - 1 << " ,    "
13780                 << detid->depth() << " ,";
13781         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13782                 << lmap_entry.rmFiber() << " ,        ";
13783         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13784                 << " ,        ";
13785         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13786                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13787         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13788         MAPfile << "}," << std::endl;
13789         delete detid;
13790       }  //Depth
13791     }  //Phi
13792   }  //Eta
13793 
13794   // HF
13795 
13796   for (int eta = -41; eta <= -29; eta++) {
13797     for (int phi = 1; phi <= nphi; phi += 2) {
13798       for (int depth = 1; depth <= 2; depth++) {
13799         HcalDetId* detid = nullptr;
13800         detid = new HcalDetId(HcalForward, eta, phi, depth);
13801         subdet = "HF";
13802         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13803         HcalElectronicsId emap_entry = emap->lookup(*detid);
13804         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() << " , " << detid->iphi() - 1 << " ,    "
13805                 << detid->depth() << " ,";
13806         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13807                 << lmap_entry.rmFiber() << " ,        ";
13808         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13809                 << " ,        ";
13810         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13811                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13812         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13813         MAPfile << "}," << std::endl;
13814         delete detid;
13815       }  //Depth
13816     }  //Phi
13817   }  //Eta
13818 
13819   for (int eta = 29; eta <= 41; eta++) {
13820     for (int phi = 1; phi <= nphi; phi += 2) {
13821       for (int depth = 1; depth <= 2; depth++) {
13822         HcalDetId* detid = nullptr;
13823         detid = new HcalDetId(HcalForward, eta, phi, depth);
13824         subdet = "HF";
13825         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13826         HcalElectronicsId emap_entry = emap->lookup(*detid);
13827         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() << " , " << detid->iphi() - 1 << " ,    "
13828                 << detid->depth() << " ,";
13829         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13830                 << lmap_entry.rmFiber() << " ,        ";
13831         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13832                 << " ,        ";
13833         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13834                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13835         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13836         MAPfile << "}," << std::endl;
13837         delete detid;
13838       }  //Depth
13839     }  //Phi
13840   }  //Eta
13841 
13842   // HO
13843 
13844   for (int eta = -15; eta < 0; eta++) {
13845     for (int phi = 1; phi <= nphi; phi++) {
13846       for (int depth = 4; depth <= 4; depth++) {
13847         HcalDetId* detid = nullptr;
13848         detid = new HcalDetId(HcalOuter, eta, phi, depth);
13849         subdet = "HO";
13850         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13851         HcalElectronicsId emap_entry = emap->lookup(*detid);
13852         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() << " , " << detid->iphi() - 1 << " ,    "
13853                 << detid->depth() << " ,";
13854         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13855                 << lmap_entry.rmFiber() << " ,        ";
13856         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13857                 << " ,        ";
13858         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13859                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13860         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13861         MAPfile << "}," << std::endl;
13862         delete detid;
13863       }  //Depth
13864     }  //Phi
13865   }  //Eta
13866 
13867   for (int eta = 1; eta <= 15; eta++) {
13868     for (int phi = 1; phi <= nphi; phi++) {
13869       for (int depth = 4; depth <= 4; depth++) {
13870         HcalDetId* detid = nullptr;
13871         detid = new HcalDetId(HcalOuter, eta, phi, depth);
13872         subdet = "HO";
13873         HcalFrontEndId lmap_entry = lmap.getHcalFrontEndId(*detid);
13874         HcalElectronicsId emap_entry = emap->lookup(*detid);
13875         MAPfile << "  {\"" << subdet << "\" , " << detid->ieta() - 1 << " , " << detid->iphi() - 1 << " ,    "
13876                 << detid->depth() << " ,";
13877         MAPfile << "\"" << lmap_entry.rbx() << "\" , " << lmap_entry.rm() << " ,   " << lmap_entry.pixel() << " ,      "
13878                 << lmap_entry.rmFiber() << " ,        ";
13879         MAPfile << lmap_entry.fiberChannel() << " ,  " << lmap_entry.qieCard() << " ,  " << lmap_entry.adc()
13880                 << " ,        ";
13881         MAPfile << emap_entry.readoutVMECrateId() << " ,    " << emap_entry.dccid() << " ,     " << emap_entry.spigot()
13882                 << " ,         " << emap_entry.fiberIndex() << " ,      ";
13883         MAPfile << emap_entry.htrSlot() << " ,      " << emap_entry.htrTopBottom();
13884         MAPfile << "}," << std::endl;
13885         delete detid;
13886       }  //Depth
13887     }  //Phi
13888   }  //Eta
13889   MAPfile << "};" << std::endl;
13890   MAPfile << std::endl;
13891 
13892   MAPfile << "// macro for array length calculation" << std::endl;
13893   MAPfile << "#define DIM(a) (sizeof(a)/sizeof(a[0]))" << std::endl;
13894   MAPfile << std::endl;
13895 
13896   MAPfile << "// class for cells array managing" << std::endl;
13897   MAPfile << "class CellDB {" << std::endl;
13898   MAPfile << "public:" << std::endl;
13899   MAPfile << "  CellDB()" << std::endl;
13900   MAPfile << "  : cells(AllCells,  AllCells + DIM(AllCells))" << std::endl;
13901   MAPfile << "{}" << std::endl;
13902   MAPfile << std::endl;
13903 
13904   MAPfile << "// return i-th cell" << std::endl;
13905   MAPfile << "Cell operator [] (int i) const {return cells[i];}" << std::endl;
13906 
13907   MAPfile << "// number of cells in database" << std::endl;
13908   MAPfile << "int size() const {return cells.size();}" << std::endl;
13909   MAPfile << std::endl;
13910 
13911   MAPfile << "// select cells for which \"par\" == \"val\"" << std::endl;
13912   MAPfile << "template<typename T>" << std::endl;
13913   MAPfile << "CellDB find(const std::string par, const T val) const" << std::endl;
13914   MAPfile << "{" << std::endl;
13915   MAPfile << "  std::vector<Cell> s;" << std::endl;
13916   MAPfile << "  for (size_t i = 0; i < cells.size(); ++i)" << std::endl;
13917   MAPfile << "    if (cells[i].check(par, val))" << std::endl;
13918   MAPfile << "    s.push_back(cells[i]);" << std::endl;
13919   MAPfile << "  return CellDB(s);" << std::endl;
13920   MAPfile << "} " << std::endl;
13921   MAPfile << std::endl;
13922   MAPfile << "private:" << std::endl;
13923   MAPfile << " CellDB( const std::vector<Cell> s)" << std::endl;
13924   MAPfile << " : cells(s)" << std::endl;
13925   MAPfile << "{}" << std::endl;
13926   MAPfile << "std::vector<Cell> cells;" << std::endl;
13927   MAPfile << "};" << std::endl;
13928   MAPfile.close();
13929   std::cout << "===== Finish writing Channel MAP =====" << std::endl;
13930 }
13931 
13932 double CMTRawAnalyzer::dR(double eta1, double phi1, double eta2, double phi2) {
13933   double deltaphi = phi1 - phi2;
13934   if (phi2 > phi1) {
13935     deltaphi = phi2 - phi1;
13936   }
13937   if (deltaphi > M_PI) {
13938     deltaphi = 2. * M_PI - deltaphi;
13939   }
13940   double deltaeta = eta2 - eta1;
13941   double tmp = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
13942   return tmp;
13943 }
13944 
13945 double CMTRawAnalyzer::phi12(double phi1, double en1, double phi2, double en2) {
13946   // weighted mean value of phi1 and phi2
13947 
13948   double a1 = phi1;
13949   double a2 = phi2;
13950 
13951   if (a1 > 0.5 * M_PI && a2 < 0.)
13952     a2 += 2 * M_PI;
13953   if (a2 > 0.5 * M_PI && a1 < 0.)
13954     a1 += 2 * M_PI;
13955   double tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
13956   if (tmp > M_PI)
13957     tmp -= 2. * M_PI;
13958 
13959   return tmp;
13960 }
13961 
13962 double CMTRawAnalyzer::dPhiWsign(double phi1, double phi2) {
13963   // clockwise      phi2 w.r.t phi1 means "+" phi distance
13964   // anti-clockwise phi2 w.r.t phi1 means "-" phi distance
13965 
13966   double a1 = phi1;
13967   double a2 = phi2;
13968   double tmp = a2 - a1;
13969   if (a1 * a2 < 0.) {
13970     if (a1 > 0.5 * M_PI)
13971       tmp += 2. * M_PI;
13972     if (a2 > 0.5 * M_PI)
13973       tmp -= 2. * M_PI;
13974   }
13975   return tmp;
13976 }
13977 
13978 /////////////////////////////// -------------------------------------------------------------------
13979 /////////////////////////////// -------------------------------------------------------------------
13980 //define this as a plug-in
13981 DEFINE_FWK_MODULE(CMTRawAnalyzer);