Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <iostream>
0002 #include <fstream>
0003 #include "TH1.h"
0004 #include "TH2.h"
0005 #include "TH1F.h"
0006 #include "TH2F.h"
0007 #include "TCanvas.h"
0008 #include "TROOT.h"
0009 #include <TMath.h>
0010 #include "TStyle.h"
0011 #include "TSystem.h"
0012 #include "TLegend.h"
0013 #include "TText.h"
0014 #include "TAxis.h"
0015 #include "TFile.h"
0016 #include "TLine.h"
0017 #include "TGraph.h"
0018 #include <TPaveText.h>
0019 #include <TPostScript.h>
0020 #include <TClass.h>
0021 #include <TLatex.h>
0022 #include <TFrame.h>
0023 #include <TPad.h>
0024 #include <TGaxis.h>
0025 
0026 #include "TGraphErrors.h"
0027 #include "TF1.h"
0028 #include "TArrow.h"
0029 
0030 //
0031 using namespace std;
0032 //
0033 //
0034 int main(int argc, char* argv[]) {
0035   cout << "********************************************************************* START job " << endl;
0036   //______________________________________________________________________________________________________________________________
0037   //TCanvas *c1;
0038   TGraph* gr1;
0039   TGraph* gr2;
0040   TGraph* gr3;
0041   TGraph* gr4;
0042   TGraph* gr5;
0043   TGraph* gr6;
0044   TGraph* gr7;
0045   TGraph* gr8;
0046   TGraph* gr9;
0047   TGraphErrors* ge1;
0048   TGraphErrors* ge2;
0049   TGraphErrors* ge3;
0050   TGraphErrors* ge4;
0051   TGraphErrors* ge5;
0052   TGraphErrors* ge6;
0053   TGraphErrors* ge7;
0054   TGraphErrors* ge8;
0055   TGraphErrors* ge9;
0056 
0057   //
0058   const Int_t NMethods = 14;       // total number of Methods (all-together 37 methods)
0059   const Int_t NMethodsStart = 0;   // since which method to start ( min=  0)
0060   const Int_t NMethodsToUse = 13;  // choose Number of methods to use ( max= 36)
0061                                    //
0062   TString MethodName[NMethods] = {"PLOT0",
0063                                   "PLOT1",
0064                                   "PLOT2",
0065                                   "PLOT3",
0066                                   "PLOT4",
0067                                   "PLOT5",
0068                                   "PLOT6",
0069                                   "PLOT7",
0070                                   "PLOT8",
0071                                   "PLOT9",
0072                                   "PLOT10",
0073                                   "PLOT11",
0074                                   "PLOT12",
0075                                   "PLOT13"};
0076   //______________________________________________________________________________________________________________________________
0077   //______________________________________________________________________________________________________________________________
0078   //______________________________________________________________________________________________________________________________
0079   //______________________________________________________________________________________________________________________________
0080   //______________________________________________________________________________________________________________________________
0081   //______________________________________________________________________________________________________________________________
0082   //______________________________________________________________________________________________________________________________   WORKABLE:
0083 
0084   //______________________________________________________________________________________________________________________________ 22+161=183
0085   // (306249 -> 07.11.2017)   164   +   DEL=23+31+11= 65    (307782 -> 11.01.2018)     = 229
0086   // const Int_t NMAXM =22;//
0087   // const Int_t NMAXM =17;//
0088 
0089   // const Int_t NMAXM =14;//
0090   // const Int_t NMAXM =553;//
0091   // const Int_t NMAXM =202;//
0092   // const Int_t NMAXM =115;//
0093   // const Int_t NMAXM =97;//
0094   const Int_t NMAXM = 73;  //
0095 
0096   cout << "********************************************************************* NMAXM =  " << NMAXM << endl;
0097 
0098   // const Int_t NMAXM =2;//
0099   // const Int_t NMAXM =4;//
0100   // const Int_t NMAXM =1;//
0101   TString LEDrunsM[NMAXM] = {
0102 
0103       /*
0104    // 2017 HEP17 shunt6 
0105    "295401","295675","296185","296808","297082","297522","297571","297630","297687","298863",
0106    "299468","302183","302246","302585","304276","304432","304526","305142","305485","305711",
0107    "305886","306249" 
0108 */
0109 
0110       // 2018  shunt6
0111       //   "308784","308882","309238","309318","309321",
0112       //   "309370","309573","309704","310262","310456",
0113       //   "310847","310973","311457","311566"
0114       //                         12.03.2018
0115 
0116       /*
0117    // 2018 all 553 runs LED
0118 "308784","308786","308788","308792","308821","308839","308851","308870","308881","308882","308937","308959","308960","308995","309008","309009","309010","309024","309036","309037","309059","309064","309069","309122","309123",
0119 "309133","309134","309141","309144","309145","309152","309154","309156","309161","309162","309175","309237","309238","309318","309321","309322","309342","309370","309372","309373","309411","309444","309445","309538","309539",
0120 "309545","309546","309565","309573","309592","309596","309646","309669","309670","309671","309672","309674","309678","309704","309714","309723","309727","309752","309819","309820","309821","309823","309824","309825","309833",
0121 "309850","309869","309870","309873","309875","309877","309878","309880","309923","309924","309939","309940","309945","310008","310043","310052","310106","310108","310179","310181","310182","310183","310185","310188","310192",
0122 "310197","310201","310202","310204","310222","310223","310226","310229","310244","310256","310262","310268","310285","310334","310340","310341","310348","310349","310363","310382","310387","310403","310410","310427","310452",
0123 "310454","310456","310604","310806","310807","310847","310947","310948","310949","310952","310968","310973","311327","311334","311335","311338","311344","311347","311349","311353","311355","311358","311360","311361","311362",
0124 "311363","311364","311366","311367","311369","311413","311454","311456","311457","311551","311566","311573","311753","311754","311759","311767","311783","311858","311901","312004","312009","312011","312013","312029","312031",
0125 "312040","312051","312052","312054","312057","312058","312153","312155","312156","312157","312160","312185","312189","312200","312204","312211","312253","312281","312314","312316","312320","312333","312341","312372","312374",
0126 "312375","312379","312384","312386","312392","312458","312461","312462","312466","312467","312469","312470","312471","312472","312482","312483","312484","312486","312487","312489","312524","312571","312575","312579","312618",
0127 "312622","312626","312717","312756","312757","312775","312778","312870","312872","312874","312879","312880","312884","312886","312889","312953","313009","313049","313051","313064","313067","313072","313090","313149","313158",
0128 "313174","313194","313232","313259","313260","313263","313264","313307","313335","313338","313340","313344","313371","313373","313375","313430","313479","313493","313495","313498","313625","313632","313890","313891","313897",
0129 "313904","313915","313918","313919","314046","314097","314100","314103","314106","314111","314298","314308","314313","314419","314420","314422","314423","314424","314425","314426","314430","314431","314432","314542","314595",
0130 "314597","314608","314695","314696","314769","314770","314776","314777","314779","314780","314782","314786","314795","314800","314826","314827","314895","314896","314897","314898","314899","314943","314944","314948","314949",
0131 "315012","315016","315021","315023","315024","315040","315073","315129","315130","315132","315213","315285","315437","315579","315594","315657","315660","315735","315746","315748","315749","315754","315757","315812","315816",
0132 "315984","316129","316316","316410","316489","316530","316584","316632","316677","316815","316826","317116","317119","317191","317193","317229","317268","317271","317273","317326","317363","317367","317398","317401","317444",
0133 "317448","317601","317606","317607","317609","317610","317611","317612","317613","317617","317718","317719","317722","317728","317785","317790","317977","317981","317984","318207","318208","318211","318217","318222","318235",
0134 "318758","318840","319198","319213","319401","319517","319519","319520","319564","319610","319612","319734","319771","319774","319857","319964","319969","320108","320117","320125","320158","320203","320205","320220","320348",
0135 "320358","320371","320374","320577","320579","320871","320873","320892","320944","320947","320949","320950","320952","321019","321033","321036","321187","321197","321329","321339","321359","321371","321445","321447","321514",
0136 "321534","321549","321552","321807","321853","321874","321927","322166","322255","322261","322338","322415","322419","322718","322719","322720","322721","322725","322781","322782","322801","322843","322853","322876","322931",
0137 "322995","323016","323038","323308","323314","323502","323530","323531","323567","323579","323613","323737","323742","324030","324032","324111","324138","324219","324225","324296","324303","324591","324705","324919","324934",
0138 "325141","325267","325433","325446","325453","325456","325457","325488","325498","325551","325640","325641","325748","325757","325787","325790","326234","326324","326780","326871","326875","327091","327283","327284","327288",
0139 "327438","327441","327443","327547","327548","327552","327576","327577","327579","327580","327581","327591","327595","327616","327620","327656","327660","327670","327686","327687","327688","327689","327690","327691","327709",
0140 "327711","327762","327785"
0141 */
0142       /*
0143    // 2018 all 205 runs LED
0144 "315812","315816","315984","316129","316316","316410","316489","316530","316584","316632","316677","316815","316826","317116","317119","317191","317193","317229","317268","317271","317273","317326","317363","317367","317398",
0145 "317401","317444","317448","317601","317606","317607","317609","317610","317611","317612","317613","317617","317718","317719","317722","317785","317790","317977","317981","317984","318207","318208","318211","318217","318222",
0146 "318235","318758","318840","319198","319213","319401","319517","319519","319520","319564","319610","319612","319734","319771","319774","319857","319964","319969","320108","320117","320125","320158","320203","320205","320220",
0147 "320348","320358","320371","320374","320577","320579","320871","320873","320892","320944","320947","320949","320950","320952","321019","321033","321036","321187","321197","321329","321339","321359","321371","321445","321447",
0148 "321514","321534","321807","321853","321874","321927","322166","322255","322261","322338","322415","322419","322718","322719","322720","322721","322725","322781","322782","322801","322843","322853","322876","322931","322995",
0149 "323016","323038","323308","323314","323502","323530","323531","323567","323579","323613","323737","323742","324030","324032","324111","324138","324219","324225","324296","324303","324591","324705","324919","324934","325141",
0150 "325267","325433","325446","325453","325456","325457","325488","325498","325551","325640","325641","325748","325757","325787","325790","326234","326324","326780","326871","326875","327091","327283","327284","327288","327438",
0151 "327441","327443","327547","327548","327552","327576","327577","327579","327580","327581","327591","327595","327616","327620","327656","327660","327670","327686","327687","327688","327689","327690","327691","327709","327711",
0152 "327762","327785"
0153 */
0154 
0155       /*
0156 // 2018 117 led runs
0157 "315812","315984","316826","317116","317193","317268","317271","317273","317363","317398","317401","317444","317606","317607","317609","317610","317611","317612","317613","317617","317785","317981","317984","318207","318208",
0158 "318235","318758","318840","319198","319401","319517","319519","319520","319564","319612","319734","319771","319774","319857","319969","320117","320158","320203","320205","320348","320579","320873","320892","320944","320952",
0159 "321019","321036","321187","321339","321359","321371","321447","321514","321807","321853","321874","321927","322166","322261","322338","322419","322718","322719","322720","322721","322725","322781","322782","322801","322853",
0160 "322876","322931","322995","323308","323314","323502","323530","323531","323579","323613","323742","324030","324032","324138","324225","324296","324919","325141","325433","325446","325456","325488","325498","325551",         
0161 "325757","325787","326234","326780","326875","327288","327438","327552","327579",         "327591","327595","327616","327620","327656","327660","327670"
0162 */
0163       /*
0164 "315812","315984","316826","317116","317193","317268","317271","317273","317363","317398","317401","317444","317606","317607","317609","317610","317611","317612","317613","317617","317785","318235","318758","318840","319198",
0165 "319401","319517","319519","319520","319564","319612","319734","319771","319774","319857","319969","320117","320158","320203","320205","320348","320579","320873","320892","320944","320952","321019","321036","321187","321339",
0166 "321359","321371","321447","321514","321807","321853","321874","321927","322166","322261","322338","322419","322718","322719","322720","322721","322725","322781","322782","322801","323308","323314","323502","323530","323531",
0167 "323579","323613","323742","324030","324032","324138","324225","324296","324919","325141","325787","326234","326780","326875","327288","327438","327552","327579","327591","327595","327616","327620"                                
0168 */
0169       "315812", "315984", "316826", "317116", "317193", "317268", "317271", "317273", "317363", "317444", "317606",
0170       "317607", "317609", "317610", "317611", "317612", "317613", "317617", "317785", "318758", "319198", "319401",
0171       "319517", "319519", "319520", "319564", "319612", "319734", "319771", "319774", "319857", "319969", "320117",
0172       "320158", "320203", "320205", "320348", "320579", "320873", "320892", "320952", "321019", "321036", "321187",
0173       "321339", "321359", "321371", "321447", "321514", "321853", "321874", "322781", "322782", "323314", "323502",
0174       "323579", "323613", "323742", "324030", "324032", "324138", "324225", "324296", "324919", "325141", "325787",
0175       "326234", "326780", "326875", "327288", "327438", "327552", "327579"
0176 
0177       ////////////////////////////    shunt1
0178 
0179       // 2018 shunt1:
0180       //   "310244","310387","310587","310650"
0181       //
0182       // "309880"
0183 
0184   };
0185   cout << "********************************************************************* first massives defined " << endl;
0186   ///////////////////////////////
0187   /*
0188    // 2017 HEP17 shunt6
0189      1.,      4.,      10.,     18.,      21.,   30.,     31.,      32.,    33.,     46.,     
0190     54.,     97.,      98.,    106.,     128.,  130.,    132.,     142.,   149.,    152.,  
0191    156.,    164. 
0192 */
0193   Float_t X0M[NMAXM] = {
0194       // 2018   shunt6 led runs delta
0195       /*
0196    0.,      2.,     17.,     22.,      23.,    24.,      24.,     24.,    27.,     28.,     28.,     28.,     32.,      32.,     32.,     32.,     32.,     32.,     32.,     32.,     38.,     42.,     42.,     45.,     45.,
0197   45.,     51.,     52.,     58.,      63.,    65.,      65.,     65.,    66.,     68.,     70.,     71.,     71.,      72.,     74.,     77.,     78.,     79.,     79.,     80.,     85.,     90.,     91.,     92.,     92.,
0198   93.,     93.,     98.,    101.,     101.,   101.,     104.,    106.,   111.,    112.,    112.,    114.,    119.,     121.,    122.,    123.,    128.,    128.,    128.,    128.,    128.,    129.,    129.,    130.,    133.,
0199  133.,    134.,    134.,    138.,     138.,   141.,     142.,    142.,   142.,    143.,    146.,    150.,    150.,     151.,    153.,    155.,    165.,    169.,    175.,    175.,    175.,    176.,    176.,    177.,         
0200  179.,    179.,    183.,    193.,     195.,   203.,     205.,    208.,   209.,             210.,    210.,    210.,     210.,    212.,    212.,    212.
0201 */
0202       /*
0203    0.,      2.,     17.,     22.,      23.,    24.,      24.,     24.,    27.,     28.,     28.,     28.,     32.,      32.,     32.,     32.,     32.,     32.,     32.,     32.,     38.,    45.,     51.,     52.,     58.,      
0204   63.,     65.,     65.,     65.,      66.,    68.,      70.,     71.,    71.,     72.,     74.,     77.,     78.,      79.,     79.,     80.,     85.,     90.,     91.,     92.,     92.,    93.,     93.,     98.,    101.,     
0205  101.,    101.,    104.,    106.,     111.,   112.,     112.,    114.,   119.,    121.,    122.,    123.,    128.,     128.,    128.,    128.,    128.,    129.,    129.,    130.,    138.,   138.,    141.,    142.,    142.,   
0206  142.,    143.,    146.,    150.,     150.,   151.,     153.,    155.,   165.,    169.,    179.,    183.,    193.,     195.,    203.,    205.,    208.,    209.,    210.,    210.,    210.,   210.,                            
0207 */
0208 
0209       0.,   2.,   17.,  22.,  23.,  24.,  24.,  24.,  27.,  29.,  32.,  32.,  32.,  32.,  32.,  32.,  32.,  32.,  38.,
0210       51.,  58.,  63.,  65.,  65.,  65.,  66.,  68.,  70.,  71.,  71.,  72.,  74.,  77.,  78.,  79.,  79.,  80.,  85.,
0211       90.,  91.,  92.,  93.,  93.,  98.,  101., 101., 101., 104., 106., 112., 112., 129., 129., 138., 141., 142., 143.,
0212       146., 150., 150., 151., 153., 155., 165., 169., 179., 183., 193., 195., 203., 205., 208., 209.
0213 
0214       /*
0215    // 2018   shunt6
0216 //   1.,        2.,      8.,     9.,      10.,   
0217 //   13.,      14.,     20.,    23.,      25., 
0218 //   31.,      34.,     39.,    41.
0219 
0220 
0221    // 2018 all 553
0222    1.,       2.,      3.,      4.,       5.,     6.,      7.,      8.,      9.,     10.,     11.,      12.,      13.,    14.,      15.,     16.,     17.,     18.,    19.,     20.,     21.,      22.,      23.,     24.,    25., 
0223   26.,      27.,     28.,     29.,      30.,    31.,     32.,     33.,     34.,     35.,     36.,      37.,      38.,    39.,      40.,     41.,     42.,     43.,    44.,     45.,     46.,      47.,      48.,     49.,    50., 
0224   51.,      52.,     53.,     54.,      55.,    56.,     57.,     58.,     59.,     60.,     61.,      62.,      63.,    64.,      65.,     66.,     67.,     68.,    69.,     70.,     71.,      72.,      73.,     74.,    75., 
0225   76.,      77.,     78.,     79.,      80.,    81.,     82.,     83.,     84.,     85.,     86.,      87.,      88.,    89.,      90.,     91.,     92.,     93.,    94.,     95.,     96.,      97.,      98.,     99.,   100., 
0226  101.,     102.,    103.,    104.,     105.,   106.,    107.,    108.,    109.,    110.,    111.,     112.,     113.,   114.,     115.,    116.,    117.,    118.,   119.,    120.,    121.,     122.,     123.,    124.,   125., 
0227  126.,     127.,    128.,    129.,     130.,   131.,    132.,    133.,    134.,    135.,    136.,     137.,     138.,   139.,     140.,    141.,    142.,    143.,   144.,    145.,    146.,     147.,     148.,    149.,   150., 
0228  151.,     152.,    153.,    154.,     155.,   156.,    157.,    158.,    159.,    160.,    161.,     162.,     163.,   164.,     165.,    166.,    167.,    168.,   169.,    170.,    171.,     172.,     173.,    174.,   175., 
0229  176.,     177.,    178.,    179.,     180.,   181.,    182.,    183.,    184.,    185.,    186.,     187.,     188.,   189.,     190.,    191.,    192.,    193.,   194.,    195.,    196.,     197.,     198.,    199.,   200., 
0230  201.,     202.,    203.,    204.,     205.,   206.,    207.,    208.,    209.,    210.,    211.,     212.,     213.,   214.,     215.,    216.,    217.,    218.,   219.,    220.,    221.,     222.,     223.,    224.,   225., 
0231  226.,     227.,    228.,    229.,     230.,   231.,    232.,    233.,    234.,    235.,    236.,     237.,     238.,   239.,     240.,    241.,    242.,    243.,   244.,    245.,    246.,     247.,     248.,    249.,   250., 
0232  251.,     252.,    253.,    254.,     255.,   256.,    257.,    258.,    259.,    260.,    261.,     262.,     263.,   264.,     265.,    266.,    267.,    268.,   269.,    270.,    271.,     272.,     273.,    274.,   275., 
0233  276.,     277.,    278.,    279.,     280.,   281.,    282.,    283.,    284.,    285.,    286.,     287.,     288.,   289.,     290.,    291.,    292.,    293.,   294.,    295.,    296.,     297.,     298.,    299.,   300., 
0234  301.,     302.,    303.,    304.,     305.,   306.,    307.,    308.,    309.,    310.,    311.,     312.,     313.,   314.,     315.,    316.,    317.,    318.,   319.,    320.,    321.,     322.,     323.,    324.,   325., 
0235  326.,     327.,    328.,    329.,     330.,   331.,    332.,    333.,    334.,    335.,    336.,     337.,     338.,   339.,     340.,    341.,    342.,    343.,   344.,    345.,    346.,     347.,     348.,    349.,   350., 
0236  351.,     352.,    353.,    354.,     355.,   356.,    357.,    358.,    359.,    360.,    361.,     362.,     363.,   364.,     365.,    366.,    367.,    368.,   369.,    370.,    371.,     372.,     373.,    374.,   375., 
0237  376.,     377.,    378.,    379.,     380.,   381.,    382.,    383.,    384.,    385.,    386.,     387.,     388.,   389.,     390.,    391.,    392.,    393.,   394.,    395.,    396.,     397.,     398.,    399.,   400., 
0238  401.,     402.,    403.,    404.,     405.,   406.,    407.,    408.,    409.,    410.,    411.,     412.,     413.,   414.,     415.,    416.,    417.,    418.,   419.,    420.,    421.,     422.,     423.,    424.,   425., 
0239  426.,     427.,    428.,    429.,     430.,   431.,    432.,    433.,    434.,    435.,    436.,     437.,     438.,   439.,     440.,    441.,    442.,    443.,   444.,    445.,    446.,     447.,     448.,    449.,   450., 
0240  451.,     452.,    453.,    454.,     455.,   456.,    457.,    458.,    449.,    460.,    461.,     462.,     463.,   464.,     465.,    466.,    467.,    468.,   469.,    470.,    471.,     472.,     473.,    474.,   475., 
0241  476.,     477.,    478.,    479.,     480.,   481.,    482.,    483.,    484.,    485.,    486.,     487.,     488.,   489.,     490.,    491.,    492.,    493.,   494.,    495.,    496.,     497.,     498.,    499.,   500., 
0242  501.,     502.,    503.,    504.,     505.,   506.,    507.,    508.,    509.,    510.,    511.,     512.,     513.,   514.,     515.,    516.,    517.,    518.,   519.,    520.,    521.,     522.,     523.,    524.,   525., 
0243  526.,     527.,    528.,    529.,     530.,   531.,    532.,    533.,    534.,    535.,    536.,     537.,     538.,   539.,     540.,    541.,    542.,    543.,   544.,    545.,    546.,     547.,     548.,    549.,   550., 
0244  551.,     552.,    553.
0245 
0246 
0247 
0248    ////////////////////////////    shunt1
0249 
0250    // 2018 shunt1:
0251    //   1.,     7.,     11.,     31.
0252 
0253      //850.,900.,950.,1000.,1050.,1100.,1150.,1200.
0254 */
0255   };  // days of year    time points (abscissa) !!!
0256       /*
0257    // Float_t X0M[NMAXM];
0258  for(int kk1 = 0; kk1<NMAXM; kk1++){ 
0259    //   X0M[kk1] = kk1+1.;
0260    ++X0M[kk1];// delta+1
0261  }//
0262 */
0263   cout << "********************************************************************* both massives are defined " << endl;
0264   //______________________________________________________________________________________________________________________________   TEST
0265   //______________________________________________________________________________________________________________________________   TEST
0266   //______________________________________________________________________________________________________________________________   TEST
0267   //______________________________________________________________________________________________________________________________   TEST
0268   /*
0269  const Int_t NMAXM =1;// 
0270  TString LEDrunsM[NMAXM] = {
0271    // "309445"
0272    "309714"
0273  };
0274  ///////////////////////////////
0275  Float_t X0M[NMAXM] = {
0276      1.
0277  };// days of year    time points (abscissa) !!!
0278 */
0279   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0280   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0281   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0282   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0283   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0284   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0285   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0286   //______________________________________________________________________________
0287   //______________________________________________________________________________
0288   //______________________________________________________________________________
0289   //______________________________________________________________________________
0290   // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0291   //                                           2018 only:                   yearcase=0 for test
0292 
0293   //                                           2016 only:                   yearcase=1
0294   //                                           2017 only:                   yearcase=2
0295   //                                           20167    :                   yearcase=3
0296   //                                           2018 only:                   yearcase=4
0297   //                                           201678   :                   yearcase=5
0298 
0299   //define yearcase:
0300   //         ____________________________________________________________________________                    THIS line below is MAIN to make a yearcase selection !!!!!!!!!!!!!!!!!!!!!!!!!!
0301   const Int_t yearcase = 0;
0302   //
0303   cout << "************************************** yearcase = " << yearcase << endl;
0304   // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0305   // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0306   // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0307   // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0308   //    Int_t verbosity = 2;//
0309   //    Int_t verbosity = 3;//
0310   //    Int_t verbosity = 4;//   to clarify # channels in HEP17
0311   Int_t verbosity = 0;  //
0312   // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0313 
0314   const Int_t flagHEP17selection = 2;  // -> ALL channels w/o bad ones (was used for final !!! result)
0315                                        //  const Int_t flagHEP17selection = 1;// ==1 HEP17;
0316   //     const Int_t flagHEP17selection = 0;//  -> ALL channels (used to see 2D plots of bad channels)
0317 
0318   cout << "************************************** flagHEP17selection = " << flagHEP17selection << endl;
0319   // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0320   //______________________________________________________________________________
0321 
0322   //______________________________________________________________________________
0323   //______________________________________________________________________________
0324   //
0325   //---=[ SetCanvasDef           ]=----------------
0326   // Create a new canvas.
0327   //TCanvas  *c1 = new TCanvas("c1","GSM",10,10,900,700);
0328 
0329   //TCanvas  *c1 = new TCanvas("c1","GSM",20,50,920,850);
0330   TCanvas* c1 = new TCanvas("c1", "GSM", 10, 10, 1010, 1010);
0331 
0332   //TCanvas  *c1 = new TCanvas("c1","GSM",200,10,700,900);
0333   //TCanvas  *c1 = new TCanvas("c1","Hcal4test",200,10,700,900);
0334 
0335   c1->Range(0, 0, 25, 18);
0336   //c1->SetFillColor(40);
0337   c1->SetFillColor(0);
0338   c1->Clear();
0339 
0340   TLatex* t = new TLatex();
0341   t->SetTextFont(32);
0342   //t->SetTextColor(4);
0343   t->SetTextSize(0.03);
0344   t->SetTextAlign(12);
0345   //______________________________________________________________________________
0346   t->DrawLatex(
0347       0.9, 15.5, "Time dependence of full Amplitude averaged over events of each LED run for some random HE channels");
0348 
0349   //-----------------------------------------------------------------------------------------------------
0350   //
0351   //              x1   y1     x2     y2
0352   //    pad1->DrawFrame(1,   0.8,  370,   1.2);// all
0353 
0354   //
0355   //      Float_t x1=0.00; Float_t x2=170.00;
0356   //       Float_t x1=0.00; Float_t x2=850.00;
0357 
0358   //          Float_t x1=0.00; Float_t x2=45.00;
0359   Float_t x1 = 0.00;
0360   Float_t x2 = 215.0;
0361 
0362   // y(ordinate) for All Days
0363   //  Float_t y1=0.985; Float_t y2=  1.015;
0364   Float_t y1 = 0.9;
0365   Float_t y2 = 1.1;
0366 
0367   //
0368   // x(abscissa) for Days
0369   Float_t RrangeMIN = y1;
0370   Float_t RrangeMAX = y2;
0371 
0372   //
0373   Float_t xx1 = 0.35;
0374   Float_t xx2 = 0.55;
0375   Float_t yy1 = 0.76;
0376   Float_t yy2 = 0.88;
0377   //
0378   cout << "************************************** RrangeMIN = " << RrangeMIN << "  RrangeMAX = " << RrangeMAX << endl;
0379 
0380   //-----------------------------------------------------------------------------------------------------
0381   //-----------------------------------------------------------------------------------------------------
0382   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0383   const Int_t NDEP = 8;
0384   const Int_t NETA0 = 83;
0385   const Int_t NPHI0 = 73;
0386   //
0387   Double_t mapRATIO[NDEP][NETA0][NPHI0];
0388   Double_t mapRATIOD2[NETA0][NPHI0];
0389   Int_t mapRATIOD20[NETA0][NPHI0];
0390 
0391   //Double_t normalization[NDEP][NETA0][NPHI0];
0392   Double_t normalization[NETA0][NPHI0];
0393   cout << "************************************** NDEP = " << NDEP << "  NETA0 = " << NETA0 << "  NPHI0 = " << NPHI0
0394        << endl;
0395 
0396   // define max size of massives (to be just NMAXSIZE ):
0397   Int_t NMAXSIZE = NMAXM;
0398   Float_t X0[NMAXSIZE];
0399   TString LEDruns[NMAXSIZE];
0400   Double_t XX[NMAXSIZE];
0401   Double_t XXE[NMAXSIZE];
0402   Double_t XXX[NMAXSIZE];
0403   Double_t XXXE[NMAXSIZE];
0404   Int_t indWAS[NMAXSIZE];
0405 
0406   Double_t YY[NMAXSIZE];
0407   Double_t YYE[NMAXSIZE];
0408   cout << "************************************** NMAXSIZE = " << NMAXSIZE << " NMAXM  = " << NMAXM << endl;
0409   //----------------------------------------------------------------------
0410 
0411   Double_t GSMRATIOD2[NMAXSIZE][NETA0][NPHI0];
0412 
0413   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0414   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0415   //////////////////////////////////////////////////////
0416   // define where to run inside massives above:
0417   //                                                                            yearcase=0
0418   Int_t NMINmM = 0;
0419   Int_t NMAXmM = NMAXSIZE - 1;
0420   Int_t NMAXaM = NMAXSIZE;
0421   if (yearcase == 1) {
0422     //                                           2016 only:                     yearcase=1
0423     NMINmM = 0;
0424     NMAXmM = 46;
0425     NMAXaM = 47;  // M
0426   } else if (yearcase == 2) {
0427     //                                           2017 only::                    yearcase=2
0428     NMINmM = 53;
0429     NMAXmM = 93;
0430     NMAXaM = 41;  // M
0431   } else if (yearcase == 3) {
0432     //                                           20167 only::                   yearcase=3
0433     NMINmM = 0;
0434     NMAXmM = 93;
0435     NMAXaM = 94;  // M
0436   } else if (yearcase == 4) {
0437     //                                           2018 only::                    yearcase=4
0438     NMINmM = 94;
0439     NMAXmM = -1;
0440     NMAXaM = -1;  // M
0441   } else if (yearcase == 5) {
0442     //                                           20168 only::                   yearcase=5
0443     NMINmM = 0;
0444     NMAXmM = -1;
0445     NMAXaM = -1;  // M
0446   }
0447 
0448   cout << "************************************** NMINmM = " << NMINmM << " NMAXmM  = " << NMAXmM
0449        << " NMAXaM  = " << NMAXaM << endl;
0450   if (NMINmM == -1 || NMAXmM == -1 || NMAXaM == -1)
0451     cout << " STOP  !!!!!!     NMINmM == -1 || NMAXmM == -1 || NMAXaM == -1 " << endl;
0452   ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0453   Int_t NMAX = 0;
0454   NMAX = NMAXaM;
0455   //      cout << "NMAX= " << NMAX << "NMINmM= " << NMINmM << "NMAXmM= " << NMAXmM <<endl;
0456   for (int jjj = NMINmM; jjj <= NMAXmM; jjj++) {
0457     LEDruns[jjj - NMINmM] = LEDrunsM[jjj];
0458     X0[jjj - NMINmM] = X0M[jjj];
0459     //  cout << "jjj= " << jjj << "     jjj-NMINmM= " << jjj-NMINmM << "     LEDrunsM[jjj]= " << LEDrunsM[jjj] << "     X0M[jjj]= " << X0M[jjj] <<endl;
0460   }
0461   //////////////////////////////////////////////////////
0462   //========================================================================================================================
0463   //---------------------------------------------------------------------------------------------------------------------
0464   //---------------------------------------------------------------------------------------------------------------------
0465   //      Int_t NP = 22; // for loop over time points(LED runs) NMAX is number of LED runs(time abscissa)
0466   Int_t NP = NMAX;  // for loop over time points(LED runs) NMAX is number of LED runs(time abscissa)
0467   cout << "******************* NP = " << NP << endl;
0468   //
0469   //---------------------------------------------------------------------------------------------------------------------  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0470   // take into account for future treatment only channels with <Aijk>_runevents within cutMinA to cutMaxA:
0471   //    Double_t cutMinA =400.; Double_t cutMaxA = 1200.;  // HPD HE only
0472 
0473   //        Double_t cutMinA =0.; Double_t cutMaxA = 999999999999.;
0474   Double_t cutMinA = 50000.;
0475   Double_t cutMaxA = 150000.;
0476   //    Double_t cutMinA =50000.; Double_t cutMaxA = 350000.;
0477 
0478   //    Double_t cutMinA =9000.; Double_t cutMaxA = 40000.;
0479   //
0480   // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0481   //---------------------------------------------------------------------------------------------------------------------
0482   //------------------------------------ define DELTA (days) of current point wrt first point
0483   for (int kk1 = 0; kk1 < NP; kk1++) {
0484     XX[kk1] = X0[kk1];
0485     int k10 = 0;
0486     int z1 = X0[k10];
0487     XX[kk1] -= z1;
0488     if (verbosity == 2) {
0489       cout << "ORDINATE points:    kk1 =  " << kk1 << "  XX[kk1]= " << XX[kk1] << endl;
0490     }
0491 
0492     XXE[kk1] = 0.001 * XX[kk1];
0493   }  //XXE - errors at fit
0494   //-----------------------------------------------------------------------------------------------------
0495 
0496   //----------------------------------------------------------------------------------------------------
0497   //----------------------------------------------------------------------------------------------------
0498   ///////////////////////////////////////////////////////////////////////// initial nulling:
0499   for (int jjj = 0; jjj <= 82; jjj++) {
0500     for (int kkk = 0; kkk <= 72; kkk++) {
0501       mapRATIOD2[jjj][kkk] = 0.;
0502       mapRATIOD20[jjj][kkk] = 0.;
0503       normalization[jjj][kkk] = 0.;
0504 
0505       for (int k1 = 0; k1 < NP; k1++) {
0506         GSMRATIOD2[k1][jjj][kkk] = mapRATIOD2[jjj][kkk];
0507       }
0508 
0509       for (int iii = 0; iii < NDEP; iii++) {
0510         mapRATIO[iii][jjj][kkk] = 0.;
0511         //  normalization[iii][jjj][kkk] = 0.;
0512       }
0513 
0514     }  // for
0515   }    // for
0516 
0517   /////////////////////////////////////////////////////////////////////////
0518 
0519   //______________________________________________________________________________
0520   //     ls -latr /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LED_* | less
0521 
0522   TString fname = "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LED_";
0523   //  TString fname = "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LASER_";
0524 
0525   // booking:
0526   TH1F* Seff1D = new TH1F("Seff1D", "", 1000, 10., 100010.);
0527   TH1F* Ceff1D = new TH1F("Ceff1D", "", 1500, 10., 500010.);
0528   //    TH1F* Seff1D = new TH1F("Seff1D","", 1000, 0.,100000.);
0529   //    TH1F* Ceff1D = new TH1F("Ceff1D","", 1500, 0.,1500000.);
0530   // led shunt1 low-intensity Gsel0:
0531   //    TH1F* Seff1D = new TH1F("Seff1D","", 1000, 0.,1000.);
0532   //    TH1F* Ceff1D = new TH1F("Ceff1D","", 350, 0.,350.);
0533 
0534   TH2F* mapBADchannels = new TH2F("mapBADchannels", " ", 82, -41., 41., 72, 0., 72.);
0535   TH2F* mapBADchannels0 = new TH2F("mapBADchannels0", " ", 82, -41., 41., 72, 0., 72.);
0536 
0537   TH2F* mapchannelsdepth1 = new TH2F("mapchannelsdepth1", " ", 82, -41., 41., 72, 0., 72.);
0538   TH2F* mapchannelsdepth2 = new TH2F("mapchannelsdepth2", " ", 82, -41., 41., 72, 0., 72.);
0539   TH2F* mapchannelsdepth3 = new TH2F("mapchannelsdepth3", " ", 82, -41., 41., 72, 0., 72.);
0540   TH2F* mapchannelsdepth4 = new TH2F("mapchannelsdepth4", " ", 82, -41., 41., 72, 0., 72.);
0541   TH2F* mapchannelsdepth5 = new TH2F("mapchannelsdepth5", " ", 82, -41., 41., 72, 0., 72.);
0542   TH2F* mapchannelsdepth6 = new TH2F("mapchannelsdepth6", " ", 82, -41., 41., 72, 0., 72.);
0543   TH2F* mapchannelsdepth7 = new TH2F("mapchannelsdepth7", " ", 82, -41., 41., 72, 0., 72.);
0544 
0545   TH1F* gainkoeff = new TH1F("gainkoeff", "", 100, y1, y2);
0546   TH1F* gainkoeff0 = new TH1F("gainkoeff0", "", 100, 0.9, 1.1);
0547   TH1F* gainkoeff9 = new TH1F("gainkoeff9", "", 100, 0.1, 1.9);
0548   TH1F* GOODruns = new TH1F("GOODruns", "", NP, 0., float(NP));
0549   TH1F* BADruns = new TH1F("BADruns", "", NP, 0., float(NP));
0550   TH1F* NotEmptyDepthes = new TH1F("NotEmptyDepthes", "", 56, 0., 56.);
0551 
0552   //////////////////////////////////////////////////////////////////////  initial variables
0553   Int_t kmm = 0;
0554   Int_t firstrun = 0;
0555   //  Int_t firstrun=1;
0556   //  Int_t firstrun=2; //
0557   //  Int_t firstrun=3;
0558   //    Int_t firstrun=4;
0559   //  Int_t firstrun=5;
0560 
0561   //  Int_t firstrun=6;
0562   //  Int_t firstrun=54;
0563   //  Int_t firstrun=347;
0564 
0565   //    Int_t firstrun=7;
0566   //    Int_t firstrun=8;
0567   //    Int_t firstrun=9;
0568   //
0569   cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! firstrun =  " << firstrun << " run = " << LEDruns[firstrun] << endl;
0570 
0571   //////////////////////////////////////////////////////////////////////////////////////////////  LOOP    ratio current
0572   //////////////////////////////////////////////////////////////////////////  LOOP    ratio current
0573   //////////////////////////////////////////////////////////////////////////  LOOP    ratio current
0574 
0575   /////////////////////////////////////////////////////////////////////////////////////////
0576   //    cout << "!!!!!!!!!!!!!!!!!!!!!! use root files from official RMT dir. " <<endl;
0577   cout << "!!!!!!!!!!!!!!!!!!!!!! use root files from my shunt6 dir. " << endl;
0578   //cout << "!!!!!!!!!!!!!!!!!!!!!! use root files from my shunt1 dir. " <<endl;
0579   /////////////////////////////////////////////////////////////////////////////////////////      START LOOP       START LOOP     START LOOP   START LOOP
0580 
0581   //  TH1F* Aeff1D = new TH1F("Aeff1D","", 300, 0.,300.);
0582   TH1F* Aeff1D = new TH1F("Aeff1D", "", 200, 0., 2000000.);
0583   int ck1count = 0;
0584   for (int k1 = firstrun; k1 < NP; k1++) {
0585     //  for(int k1 = 0; k1<NP; k1++) {
0586     ck1count++;
0587     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0588     // my dir.
0589     //    TString epsName = "rootshunt6/LEDtest" + LEDruns[k1] + ".root";
0590     //           TString epsName = "rootshunt1/LEDtest" + LEDruns[k1] + ".root";
0591 
0592     //      if(k1 > 21) {epsName = fname + LEDruns[k1] + ".root";}// 2018 shunt1
0593     //        TString epsName = "rootshunt1/LEDtest" + LEDruns[k1] + ".root";
0594 
0595     /*
0596       TString epsName;
0597       if(k1 < 0) {epsName = "rootshunt6/LEDtest" + LEDruns[k1] + ".root";}// was used: shunt6 for HEP17 2017 channels !!!
0598       if(k1 == 0) {epsName = "rootshunt1/LEDtest" + LEDruns[k1] + ".root";}
0599       if(k1 == 1) {epsName = "rootshunt6/LEDtest" + LEDruns[k1] + ".root";}
0600 */
0601     //        TString epsName = "LEDtest" + LEDruns[k1] + ".root";
0602 
0603     //    TString epsName = "LEDtest309714.root";
0604     //    TString epsName = "LEDtest307971NEW.root";
0605 
0606     // RMT:
0607     TString epsName = fname + LEDruns[k1] + ".root";
0608 
0609     /////////////////////////////////////////////////////////////////////////////////////////
0610 
0611     TFile* hfile = new TFile(epsName, "READ");
0612     //            cout << "!!!! read LED run with k1= " << k1   <<"  run:  " << LEDruns[k1] <<endl;
0613 
0614     // display existing histoes: preparation for plotting all runs into Aeff1D
0615     //      TH1F * Aeff1= (TH1F*)hfile->Get("h_ADCAmpl_HE");
0616     //    h_ADCAmpl345Zoom_HE = new TH1F("h_ADCAmpl345Zoom_HE"," ", 300, 0.,300.);
0617     //    h_ADCAmpl345Zoom1_HE = new TH1F("h_ADCAmpl345Zoom1_HE"," ", 200, 0.,1200.);
0618     //    h_ADCAmplZoom1_HE = new TH1F("h_ADCAmplZoom1_HE"," ", 500, 0.,500.);
0619 
0620     //      TH1F * Aeff1= (TH1F*)hfile->Get("h_ADCAmpl345Zoom_HE");
0621     //      TH1F * Aeff1= (TH1F*)hfile->Get("h_ADCAmpl345Zoom1_HE");
0622     //      TH1F * Aeff1= (TH1F*)hfile->Get("h_ADCAmplZoom1_HE");
0623     TH1F* Aeff1 = (TH1F*)hfile->Get("h_ADCAmpl_HE");
0624 
0625     int kx = Aeff1->GetXaxis()->GetNbins();
0626     //      cout  <<"BEGINNING k1= " << k1 <<" kx= " << kx <<endl;
0627     int maxvalueA = -1;
0628     for (int jjj = 0; jjj < kx; jjj++) {
0629       if (double(Aeff1->GetBinContent(jjj)) > 0. && maxvalueA < jjj)
0630         maxvalueA = jjj;
0631       //    cout  <<" k1= " << k1 <<" jjj= " << jjj <<" content= " << Aeff1->GetBinContent(jjj) <<endl;
0632       Aeff1D->Fill(float(jjj), double(Aeff1->GetBinContent(jjj)));
0633     }  // for
0634     cout << " run = " << LEDruns[k1] << " k1= " << k1 << " max bin value= " << maxvalueA << " ck1count= " << ck1count
0635          << endl;
0636 
0637     //
0638     //
0639     // display last-run existing histoes:
0640     if (k1 == NP - 1) {
0641       c1->Clear();
0642       c1->Divide(1, 1);
0643       c1->cd(1);
0644       gPad->SetGridy();
0645       gPad->SetGridx();
0646       gPad->SetLogy();
0647       gStyle->SetOptStat(101110);
0648       Aeff1->SetMarkerStyle(20);
0649       Aeff1->SetMarkerSize(0.4);
0650       Aeff1->GetYaxis()->SetLabelSize(0.04);
0651       //    Aeff1->SetTitle("Last run & events & channels");
0652       Aeff1->SetXTitle("Aijk");
0653       Aeff1->SetYTitle("N");
0654       Aeff1->SetMarkerColor(4);
0655       Aeff1->SetLineColor(4);
0656       Aeff1->SetMinimum(0.8);
0657       Aeff1->Draw("PL");
0658       c1->Update();
0659       TString fdir = "testamt0shunt6gsm2018/";
0660       //    TString plotName = fdir + "Aijk.png";
0661       TString plotName = fdir + "Aijk-Run" + LEDruns[k1] + ".png";
0662       c1->SaveAs(plotName);
0663       cout << "****PLOT  AijkLastRun.png is drawn **** " << endl;
0664     }
0665     // display first runt existing histoes:
0666     //      if(k1== 0 ) {
0667     if (k1 == firstrun) {
0668       c1->Clear();
0669       c1->Divide(1, 1);
0670       c1->cd(1);
0671       gPad->SetGridy();
0672       gPad->SetGridx();
0673       //    gPad->SetLogy();
0674       gStyle->SetOptStat(101110);
0675       Aeff1->SetMarkerStyle(20);
0676       Aeff1->SetMarkerSize(0.4);
0677       Aeff1->GetYaxis()->SetLabelSize(0.04);
0678       Aeff1->SetTitle("First run & events & channels");
0679       Aeff1->SetXTitle("Aijk");
0680       Aeff1->SetYTitle("N");
0681       Aeff1->SetMarkerColor(4);
0682       Aeff1->SetLineColor(4);
0683       Aeff1->SetMinimum(0.8);
0684       Aeff1->Draw("PL");
0685       c1->Update();
0686       TString fdir = "testamt0shunt6gsm2018/";
0687       TString plotName = fdir + "AijkFirstRun.png";
0688       c1->SaveAs(plotName);
0689       cout << "****PLOT  AijkLAST.png is drawn **** " << endl;
0690     }
0691     // 000000000000000000000000000000000000000000000000000000000000000000000000
0692     //      TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl");
0693     //      TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl");
0694     //      TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl");
0695     // 111111111111111111111111111111111111111111111111111111111111111111111111
0696     // h_mapDepth1ADCAmpl12 means ADCcounts(massive) within -1 max +1 +2
0697 
0698     /*
0699     TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl12_HE");
0700     TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12_HE");
0701     TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12_HE");
0702 */
0703     // HEP17 of 2017:
0704     //      TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl12SiPM_HE");
0705     //      TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12SiPM_HE");
0706     //      TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12SiPM_HE");
0707     // all:
0708 
0709     TH2F* twod1 = (TH2F*)hfile->Get("h_mapDepth1ADCAmpl12_HE");
0710     TH2F* twod2 = (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12_HE");
0711     TH2F* twod3 = (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12_HE");
0712 
0713     TH2F* twod4 = (TH2F*)hfile->Get("h_mapDepth4ADCAmpl12_HE");
0714     TH2F* twod5 = (TH2F*)hfile->Get("h_mapDepth5ADCAmpl12_HE");
0715     TH2F* twod6 = (TH2F*)hfile->Get("h_mapDepth6ADCAmpl12_HE");
0716     TH2F* twod7 = (TH2F*)hfile->Get("h_mapDepth7ADCAmpl12_HE");
0717 
0718     // all TS bins:
0719     //      TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl_HE");
0720     //      TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl_HE");
0721     //      TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl_HE");
0722 
0723     //      TH2F *twod4= (TH2F*)hfile->Get("h_mapDepth4ADCAmpl_HE");
0724     //      TH2F *twod5= (TH2F*)hfile->Get("h_mapDepth5ADCAmpl_HE");
0725     //      TH2F *twod6= (TH2F*)hfile->Get("h_mapDepth6ADCAmpl_HE");
0726     //      TH2F *twod7= (TH2F*)hfile->Get("h_mapDepth7ADCAmpl_HE");
0727 
0728     int nx = twod1->GetXaxis()->GetNbins();
0729     int ny = twod1->GetYaxis()->GetNbins();
0730     //      cout  <<"BEGINNING k1= " << k1 <<" nx= " << nx <<" ny= " << ny   <<endl;
0731 
0732     TH2F* t0010 = (TH2F*)hfile->Get("h_mapDepth1_HE");
0733     TH2F* t0020 = (TH2F*)hfile->Get("h_mapDepth2_HE");
0734     TH2F* t0030 = (TH2F*)hfile->Get("h_mapDepth3_HE");
0735     TH2F* t0040 = (TH2F*)hfile->Get("h_mapDepth4_HE");
0736     TH2F* t0050 = (TH2F*)hfile->Get("h_mapDepth5_HE");
0737     TH2F* t0060 = (TH2F*)hfile->Get("h_mapDepth6_HE");
0738     TH2F* t0070 = (TH2F*)hfile->Get("h_mapDepth7_HE");
0739 
0740     TH2F* Ceff1 = (TH2F*)twod1->Clone("Ceff1");
0741     TH2F* Ceff2 = (TH2F*)twod2->Clone("Ceff2");
0742     TH2F* Ceff3 = (TH2F*)twod3->Clone("Ceff3");
0743     TH2F* Ceff4 = (TH2F*)twod4->Clone("Ceff4");
0744     TH2F* Ceff5 = (TH2F*)twod5->Clone("Ceff5");
0745     TH2F* Ceff6 = (TH2F*)twod6->Clone("Ceff6");
0746     TH2F* Ceff7 = (TH2F*)twod7->Clone("Ceff7");
0747 
0748     // <Aijk>_runevents:
0749     Ceff1->Divide(twod1, t0010, 1, 1, "B");
0750     Ceff2->Divide(twod2, t0020, 1, 1, "B");
0751     Ceff3->Divide(twod3, t0030, 1, 1, "B");
0752     Ceff4->Divide(twod4, t0040, 1, 1, "B");
0753     Ceff5->Divide(twod5, t0050, 1, 1, "B");
0754     Ceff6->Divide(twod6, t0060, 1, 1, "B");
0755     Ceff7->Divide(twod7, t0070, 1, 1, "B");
0756     //      Ceff1->Sumw2();Ceff2->Sumw2();Ceff3->Sumw2();
0757     ///////////////////////////////////////////////////////////////////////////////////////////
0758     for (int jjj = 0; jjj < nx; jjj++) {
0759       for (int kkk = 0; kkk < ny; kkk++) {
0760         // HEP17 selection:
0761         if (flagHEP17selection == 0 ||
0762             (flagHEP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
0763                                          ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
0764             (flagHEP17selection == 2 && !(((jjj > 14 && jjj < 25) && (kkk > 55 && kkk < 64))))) {
0765           //      if(Ceff1->GetBinContent(jjj,kkk) !=0.)  cout  <<" k1=111111 " << k1 <<" eta= " << jjj <<" phi= " << kkk   <<" Ceff1= " << Ceff1->GetBinContent(jjj,kkk)   <<endl;
0766           //      if(Ceff7->GetBinContent(jjj,kkk) !=0.)  cout  <<" k1=77777777777 " << k1 <<" eta= " << jjj <<" phi= " << kkk   <<" Ceff7= " << Ceff7->GetBinContent(jjj,kkk)   <<endl;
0767           if (Ceff1->GetBinContent(jjj, kkk) > 0.)
0768             mapchannelsdepth1->Fill(double(jjj) - 41., double(kkk), Ceff1->GetBinContent(jjj, kkk));
0769           if (Ceff2->GetBinContent(jjj, kkk) > 0.)
0770             mapchannelsdepth2->Fill(double(jjj) - 41., double(kkk), Ceff2->GetBinContent(jjj, kkk));
0771           if (Ceff3->GetBinContent(jjj, kkk) > 0.)
0772             mapchannelsdepth3->Fill(double(jjj) - 41., double(kkk), Ceff3->GetBinContent(jjj, kkk));
0773           if (Ceff4->GetBinContent(jjj, kkk) > 0.)
0774             mapchannelsdepth4->Fill(double(jjj) - 41., double(kkk), Ceff4->GetBinContent(jjj, kkk));
0775           if (Ceff5->GetBinContent(jjj, kkk) > 0.)
0776             mapchannelsdepth5->Fill(double(jjj) - 41., double(kkk), Ceff5->GetBinContent(jjj, kkk));
0777           if (Ceff6->GetBinContent(jjj, kkk) > 0.)
0778             mapchannelsdepth6->Fill(double(jjj) - 41., double(kkk), Ceff6->GetBinContent(jjj, kkk));
0779           if (Ceff7->GetBinContent(jjj, kkk) > 0.)
0780             mapchannelsdepth7->Fill(double(jjj) - 41., double(kkk), Ceff7->GetBinContent(jjj, kkk));
0781         }  // if HEP17 selection
0782       }    // for
0783     }      // for
0784     ///////////////////////////////////////////////////////////////////////////////////////////
0785     //  }
0786 
0787     //
0788     //
0789     // fill:
0790     // fill massive <Aijk>_runevents ,  where iii=depth, jjj=eta, kkk=phi
0791     for (int jjj = 0; jjj < nx; jjj++) {
0792       for (int kkk = 0; kkk < ny; kkk++) {
0793         //
0794         // HEP17 selection:
0795         if (flagHEP17selection == 0 ||
0796             (flagHEP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
0797                                          ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
0798             (flagHEP17selection == 2 && !(((jjj > 14 && jjj < 25) && (kkk > 55 && kkk < 64))))) {
0799           // FILL NEW PLOTS:
0800           // Aijk: Ceff1D & Seff1D plots
0801           if (Ceff1->GetBinContent(jjj, kkk) != 0.) {
0802             Ceff1D->Fill(Ceff1->GetBinContent(jjj, kkk));
0803             Seff1D->Fill(Ceff1->GetBinContent(jjj, kkk));
0804           }
0805           if (Ceff2->GetBinContent(jjj, kkk) != 0.) {
0806             Ceff1D->Fill(Ceff2->GetBinContent(jjj, kkk));
0807             Seff1D->Fill(Ceff2->GetBinContent(jjj, kkk));
0808           }
0809           if (Ceff3->GetBinContent(jjj, kkk) != 0.) {
0810             Ceff1D->Fill(Ceff3->GetBinContent(jjj, kkk));
0811             Seff1D->Fill(Ceff3->GetBinContent(jjj, kkk));
0812           }
0813           if (Ceff4->GetBinContent(jjj, kkk) != 0.) {
0814             Ceff1D->Fill(Ceff4->GetBinContent(jjj, kkk));
0815             Seff1D->Fill(Ceff4->GetBinContent(jjj, kkk));
0816           }
0817           if (Ceff5->GetBinContent(jjj, kkk) != 0.) {
0818             Ceff1D->Fill(Ceff5->GetBinContent(jjj, kkk));
0819             Seff1D->Fill(Ceff5->GetBinContent(jjj, kkk));
0820           }
0821           if (Ceff6->GetBinContent(jjj, kkk) != 0.) {
0822             Ceff1D->Fill(Ceff6->GetBinContent(jjj, kkk));
0823             Seff1D->Fill(Ceff6->GetBinContent(jjj, kkk));
0824           }
0825           if (Ceff7->GetBinContent(jjj, kkk) != 0.) {
0826             Ceff1D->Fill(Ceff7->GetBinContent(jjj, kkk));
0827             Seff1D->Fill(Ceff7->GetBinContent(jjj, kkk));
0828           }
0829         }  //if
0830       }
0831     }
0832 
0833     //--------------------------------------
0834     // take into account for future treatment only HEP17 channels and cuts on <Aijk>_runevents within cutMinA to cutMaxA:
0835     // apply cut on <Aijk>_runevents
0836     //             -41                                +41
0837     //                            82 bins
0838     for (int jjj = 0; jjj < nx; jjj++) {
0839       for (int kkk = 0; kkk < ny; kkk++) {
0840         // HEP17 selection:
0841         if (flagHEP17selection == 0 ||
0842             (flagHEP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
0843                                          ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
0844             (flagHEP17selection == 2 && !(((jjj > 14 && jjj < 25) && (kkk > 55 && kkk < 64))))) {
0845           if (Ceff1->GetBinContent(jjj, kkk) > cutMinA && Ceff1->GetBinContent(jjj, kkk) < cutMaxA)
0846             mapRATIO[1][jjj][kkk] = Ceff1->GetBinContent(jjj, kkk);
0847           if (Ceff2->GetBinContent(jjj, kkk) > cutMinA && Ceff2->GetBinContent(jjj, kkk) < cutMaxA)
0848             mapRATIO[2][jjj][kkk] = Ceff2->GetBinContent(jjj, kkk);
0849           if (Ceff3->GetBinContent(jjj, kkk) > cutMinA && Ceff3->GetBinContent(jjj, kkk) < cutMaxA)
0850             mapRATIO[3][jjj][kkk] = Ceff3->GetBinContent(jjj, kkk);
0851           if (Ceff4->GetBinContent(jjj, kkk) > cutMinA && Ceff4->GetBinContent(jjj, kkk) < cutMaxA)
0852             mapRATIO[4][jjj][kkk] = Ceff4->GetBinContent(jjj, kkk);
0853           if (Ceff5->GetBinContent(jjj, kkk) > cutMinA && Ceff5->GetBinContent(jjj, kkk) < cutMaxA)
0854             mapRATIO[5][jjj][kkk] = Ceff5->GetBinContent(jjj, kkk);
0855           if (Ceff6->GetBinContent(jjj, kkk) > cutMinA && Ceff6->GetBinContent(jjj, kkk) < cutMaxA)
0856             mapRATIO[6][jjj][kkk] = Ceff6->GetBinContent(jjj, kkk);
0857           if (Ceff7->GetBinContent(jjj, kkk) > cutMinA && Ceff7->GetBinContent(jjj, kkk) < cutMaxA)
0858             mapRATIO[7][jjj][kkk] = Ceff7->GetBinContent(jjj, kkk);
0859         }  //if
0860       }    // for
0861     }      // for
0862     //////////////////---------------------------------------
0863     /*
0864     //         define A for refRun :  k1=[0]
0865     //////////////////---------------------------------------
0866     if(k1==firstrun && kmm==0 ) {
0867       kmm=1; //Int_t mcount=0;
0868       cout<<"* to be printed once only  CHECK IT please  ************ kmm = " << kmm <<endl;
0869       for(int iii = 1; iii<4; iii++) {
0870 //  for (int jjj=1;jjj<=82;jjj++) {
0871 //    for (int kkk=1;kkk<=72;kkk++) {
0872       for (int jjj=0;jjj<nx;jjj++) {
0873     for (int kkk=0;kkk<ny;kkk++) {
0874         normalization[iii][jjj][kkk] = mapRATIO[iii][jjj][kkk];
0875       }//for 
0876     }//for 
0877       }//for 
0878     }// if(k1=firstrun
0879 */
0880     //--------------------------------------
0881     //                                               then, averaging over depthes, but first sum over depthes before!!! any dividing.  Use mapRATIOD2[jjj][kkk] and mapRATIOD20[jjj][kkk]
0882     //////////////////---------------------------------------
0883     int totalhep17count = 0;
0884     int totalhep17count1 = 0;
0885     int totalhep17count2 = 0;
0886     int totalhep17count3 = 0;
0887     int totalhep17count4 = 0;
0888     int totalhep17count5 = 0;
0889     int totalhep17count6 = 0;
0890     int totalhep17count7 = 0;
0891     for (int iii = 1; iii < NDEP; iii++) {
0892       for (int jjj = 0; jjj < nx; jjj++) {
0893         for (int kkk = 0; kkk < ny; kkk++) {
0894           //    for (int jjj=1;jjj<=82;jjj++) {
0895           //    for (int kkk=1;kkk<=72;kkk++) {
0896           if (mapRATIO[iii][jjj][kkk] > 0) {
0897             // calculate # channels in HEP17 for each depth:
0898             totalhep17count++;
0899             if (verbosity == 4 && k1 == 0) {
0900               cout << " k1= " << k1 << " depth= " << iii << " eta= " << jjj << " phi= " << kkk
0901                    << " mapRATIO= " << mapRATIO[iii][jjj][kkk] << endl;
0902             }
0903             if (iii == 1)
0904               totalhep17count1++;
0905             if (iii == 2)
0906               totalhep17count2++;
0907             if (iii == 3)
0908               totalhep17count3++;
0909             if (iii == 4)
0910               totalhep17count4++;
0911             if (iii == 5)
0912               totalhep17count5++;
0913             if (iii == 6)
0914               totalhep17count6++;
0915             if (iii == 7)
0916               totalhep17count7++;
0917             // ----------------------------------------   sum over depthes before!!! any dividing:
0918             mapRATIOD2[jjj][kkk] += mapRATIO[iii][jjj][kkk];
0919             // count entries with digis only:
0920             mapRATIOD20[jjj][kkk]++;
0921             if (verbosity == 3 && iii == 3)
0922               cout << "   depth = " << iii << " k1 = " << k1 << " eta = " << jjj
0923                    << " mapRATIOD2[jjj][kkk] = " << mapRATIOD2[jjj][kkk] << " #entries = " << mapRATIOD20[jjj][kkk]
0924                    << " mapRATIO[iii][jjj][kkk] = " << mapRATIO[iii][jjj][kkk] << endl;
0925           }  // if mapRATIO[iii][jjj][kkk] != 0
0926         }    //for
0927       }      //for
0928     }        //for
0929 
0930     // ERROR printout !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0931     //    if(totalhep17count != 184 ) {cout  <<"!!!!!! ERROR:NOT ALL CHANNELS HEP17 INVOLEVED FOR RUN WITH  k1= " << k1 <<" totalhep17count= " << totalhep17count <<endl;}
0932 
0933     if (verbosity == 4 && k1 == 0) {
0934       cout << " k1= " << k1 << " totalhep17count= " << totalhep17count << endl;
0935       cout << " k1= " << k1 << " totalhep17count1= " << totalhep17count1 << endl;
0936       cout << " k1= " << k1 << " totalhep17count2= " << totalhep17count2 << endl;
0937       cout << " k1= " << k1 << " totalhep17count3= " << totalhep17count3 << endl;
0938       cout << " k1= " << k1 << " totalhep17count4= " << totalhep17count4 << endl;
0939       cout << " k1= " << k1 << " totalhep17count5= " << totalhep17count5 << endl;
0940       cout << " k1= " << k1 << " totalhep17count6= " << totalhep17count6 << endl;
0941       cout << " k1= " << k1 << " totalhep17count7= " << totalhep17count7 << endl;
0942     }
0943 
0944     //////////////------------------------------          and now averaging over depthes     and   get final mapRATIOD2[jjj][kkk]
0945     //////////////////---------------------------------------
0946     Int_t depthAVERAGEcount = 0;
0947     for (int jjj = 0; jjj < nx; jjj++) {
0948       for (int kkk = 0; kkk < ny; kkk++) {
0949         //  for (int jjj=1;jjj<=82;jjj++) {
0950         //for(int kkk=1;kkk<=72;kkk++) {
0951         depthAVERAGEcount = 4 * (jjj - 57) + (kkk - 64);
0952         if (mapRATIOD20[jjj][kkk] != 0) {
0953           NotEmptyDepthes->Fill(float(depthAVERAGEcount));
0954           if (verbosity == 1)
0955             cout << "****aver per depthes********* phi = " << kkk << " RunIndex = " << k1 << " eta = " << jjj
0956                  << " #entries  = " << mapRATIOD20[jjj][kkk] << endl;
0957           mapRATIOD2[jjj][kkk] /= mapRATIOD20[jjj][kkk];
0958           if (verbosity == 3 && kkk == 3)
0959             cout << "****aver per depthes********* phi = " << jjj << " RunIndex = " << k1 << " eta = " << jjj
0960                  << " Nphi = " << mapRATIOD20[jjj][kkk] << endl;
0961         }  // if(mapRATIOD20 != 0
0962       }    //for kkk
0963     }      //for jjj
0964     //////////////////---------------------------------------
0965     //                                                 define A for refRun :  k1=[0]
0966     //////////////////---------------------------------------
0967     if (k1 == firstrun && kmm == 0) {
0968       kmm = 1;  //Int_t mcount=0;
0969       cout << "* to be printed once only  CHECK IT please  ************ kmm = " << kmm << endl;
0970       //      for (int jjj=1;jjj<=82;jjj++) {
0971       //    for (int kkk=1;kkk<=72;kkk++) {
0972       for (int jjj = 0; jjj < nx; jjj++) {
0973         for (int kkk = 0; kkk < ny; kkk++) {
0974           normalization[jjj][kkk] = mapRATIOD2[jjj][kkk];
0975         }  //for
0976       }    //for
0977     }      // if(k1=firstrun
0978     //--------------------------------------
0979     //////////////------------------------------          get normalized ratio   GSMRATIOD2[k1][jjj][kkk]
0980     //////////////////---------------------------------------
0981     //   int etaphicount = 0;
0982     //    for (int jjj=1;jjj<=82;jjj++) {
0983     //      for (int kkk=1;kkk<=72;kkk++) {
0984     for (int jjj = 0; jjj < nx; jjj++) {
0985       for (int kkk = 0; kkk < ny; kkk++) {
0986         if (normalization[jjj][kkk] != 0) {
0987           GSMRATIOD2[k1][jjj][kkk] = mapRATIOD2[jjj][kkk] / normalization[jjj][kkk];
0988           // plotting:
0989           if (GSMRATIOD2[k1][jjj][kkk] < RrangeMAX && GSMRATIOD2[k1][jjj][kkk] > RrangeMIN) {
0990             gainkoeff->Fill(GSMRATIOD2[k1][jjj][kkk]);
0991             gainkoeff0->Fill(GSMRATIOD2[k1][jjj][kkk]);
0992             gainkoeff9->Fill(GSMRATIOD2[k1][jjj][kkk]);
0993             // printout
0994             //    etaphicount++;
0995             //  if(etaphicount > 30 ) cout  <<"etaphicount =   " << etaphicount   << "for  k1= " << k1 <<endl;
0996             //          if(etaphicount == 30 ) cout  <<"etaphicount == 30 for  k1= " << k1 <<endl;
0997             //      cout  <<" k1= " << k1 <<" eta= " << jjj <<" phi= " << kkk   <<endl;
0998             GOODruns->Fill(float(k1));  // fill #channels w/ R inside unit
0999           } else {
1000             if (GSMRATIOD2[k1][jjj][kkk] > 0.)
1001               BADruns->Fill(float(k1));
1002           }  // fill #channels outside  R  unit
1003           //      else{if(GSMRATIOD2[k1][jjj][kkk]>0.) BADruns->Fill(float(k1));}
1004 
1005         }  // if(normalization[jjj][kkk] != 0
1006       }    //for kkk
1007     }      //for jjj
1008 
1009     //
1010     //////////////////---------------------------------------
1011     //////////////////---------------------------------------
1012     //////////////////---------------------------------------
1013     /////////////////////////////////////////////////////////////////////////////////////////////// nulling :
1014     ///////////////////////////////////////////////////////////////// nulling :
1015     for (int jjj = 0; jjj <= 82; jjj++) {
1016       for (int kkk = 0; kkk <= 72; kkk++) {
1017         mapRATIOD2[jjj][kkk] = 0.;
1018         mapRATIOD20[jjj][kkk] = 0.;
1019         for (int iii = 0; iii < NDEP; iii++) {
1020           mapRATIO[iii][jjj][kkk] = 0.;
1021         }
1022       }  // for
1023     }    // for
1024 
1025     ///////////////////// hfile->Close();
1026     hfile->Close();
1027     /////////////////////
1028 
1029     //  }//if(k1==0 || (k1>37
1030     //////////////////////////////////////////////////////////////////////////////////////////////////  END OF LOOP OVER LED RUNS
1031   }  //for k1 loop over time points(LED runs)
1032   cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                   DONE: last LED run READ " << endl;
1033 
1034   //    c1->Clear();
1035 
1036   // ////////////////////////////////////////////////////////////////////////////////////////////////// END OF LOOP OVER LED RUNS
1037   ////////////////////////////////////////////////////////////////////////////////////////////////////  END OF LOOP OVER LED RUNS
1038   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1039   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1040 
1041   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////   DRAWING   DRAWING   DRAWING   DRAWING   DRAWING
1042   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////   DRAWING   DRAWING   DRAWING   DRAWING   DRAWING
1043   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////   DRAWING   DRAWING   DRAWING   DRAWING   DRAWING
1044   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////   DRAWING   DRAWING   DRAWING   DRAWING   DRAWING
1045   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////   DRAWING   DRAWING   DRAWING   DRAWING   DRAWING
1046   cout << "****  ****  ****  ****  ****     Draw Dependencies: *** " << endl;
1047 
1048   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1049   Int_t Method = NMethodsStart;
1050   while (Method < NMethodsToUse + 1) {
1051     if (Method != 9999992) {
1052       cout << " ****  START   Method " << Method << endl;
1053       //======================================================================================================= PLOT0:  <Aijk>  for each event and all LED runs
1054       if (Method == 0) {
1055         cout << "****Draw 0 Dependencies: <Aijk>  for each event and all LED runs  *** " << endl;
1056         gPad->SetGridy();
1057         gPad->SetGridx();
1058         gPad->SetLogy();
1059         gStyle->SetOptStat(101110);
1060         Ceff1D->SetMarkerStyle(20);
1061         Ceff1D->SetMarkerSize(0.4);
1062         Ceff1D->GetYaxis()->SetLabelSize(0.04);
1063         Ceff1D->SetTitle("all runs & channels");
1064         Ceff1D->SetXTitle("<Aijk>");
1065         Ceff1D->SetYTitle("N");
1066         Ceff1D->SetMarkerColor(4);
1067         Ceff1D->SetLineColor(4);
1068         //    Ceff1D->Draw("Error");
1069         Ceff1D->Draw("PL");
1070       }  //Method = 0
1071       //======================================================================================================= PLOT1: <Aijk>  for each event and all LED runs ZOOM
1072       if (Method == 1) {
1073         cout << "****Draw 1 Dependencies: <Aijk>  for each event and all LED runs ZOOM  *** " << endl;
1074         gPad->SetGridy();
1075         gPad->SetGridx();
1076         gPad->SetLogy();
1077         gStyle->SetOptStat(101110);
1078         //    Seff1D->SetTitle("any Error, HE Depth1 \n");
1079         Seff1D->SetMarkerStyle(20);
1080         Seff1D->SetMarkerSize(0.4);
1081         Seff1D->GetYaxis()->SetLabelSize(0.04);
1082         Seff1D->SetTitle("ZOOM all runs & channels");
1083         Seff1D->SetXTitle("<Aijk> ZOOM  ");
1084         Seff1D->SetYTitle("N");
1085         Seff1D->SetMarkerColor(4);
1086         Seff1D->SetLineColor(4);
1087         //    Seff1D->Draw("Error");
1088         Seff1D->Draw("PL");
1089       }  //Method = 1
1090       //  //////////////////////////////////////////////////////////////////////////
1091       //======================================================================================================= PLOT2  GSM ratio vs days
1092       if (Method == 2) {
1093         cout << "****Draw 2 Dependencies: GSM ratio vs days  *** " << endl;
1094         for (int k1 = 0; k1 < NP; k1++) {
1095           YY[k1] = 0.;
1096         }
1097         //      c1->Range(0,0,25,18);
1098         //      c1->SetFillColor(0);
1099         //      c1->Clear();
1100         TPad* pad1 = new TPad("pad1", "This is pad1", 0.02, 0.02, 0.99, 0.99, 0);
1101         pad1->Draw();
1102         pad1->cd();
1103         pad1->Range(-0.255174, -19.25, 2.29657, -6.75);
1104         //              x1   y1     x2     y2
1105         pad1->DrawFrame(x1, y1, x2, y2);  // 1-A,
1106         //  pad1->DrawFrame(1,   0.,  370,   2.0);  // 1-A,
1107         pad1->GetFrame()->SetFillColor(0);
1108         pad1->Draw();
1109         gPad->SetGridy();
1110         gPad->SetGridx();
1111         //                -   -       -        -   -  -                                                            -   -   -       -           -    -
1112         Int_t colorlines = 0;
1113         Int_t generalcount = 0;
1114         //      for (int jjj=1;jjj<=82;jjj++) {
1115         //  for (int kkk=1;kkk<=72;kkk++) {
1116         for (int jjj = 0; jjj < 82; jjj++) {
1117           for (int kkk = 0; kkk < 72; kkk++) {
1118             Int_t sscount = -1;
1119             for (int k1 = 0; k1 < NP; k1++) {
1120               if (GSMRATIOD2[k1][jjj][kkk] != 0) {
1121                 //        if(GSMRATIOD2[k1][jjj][kkk]< 1.033 && GSMRATIOD2[k1][jjj][kkk] > 0.91  ) {
1122                 //   if(GSMRATIOD2[k1][jjj][kkk]< 9. && GSMRATIOD2[k1][jjj][kkk] > 0.  ) {
1123                 if (GSMRATIOD2[k1][jjj][kkk] < RrangeMAX && GSMRATIOD2[k1][jjj][kkk] > RrangeMIN) {
1124                   //              if(GSMRATIOD2[k1][jjj][kkk]< 1.05 && GSMRATIOD2[k1][jjj][kkk] > 0.91  ) {
1125                   //   if(GSMRATIOD2[k1][jjj][kkk]< 1.15 && GSMRATIOD2[k1][jjj][kkk] > 0.85  ) {
1126                   sscount++;
1127                   YY[sscount] = GSMRATIOD2[k1][jjj][kkk];  //
1128                   XXX[sscount] = XX[k1];
1129                   indWAS[sscount] = k1;
1130                   mapBADchannels->Fill(double(jjj) - 42., double(kkk) - 1., GSMRATIOD2[k1][jjj][kkk]);
1131                   mapBADchannels0->Fill(double(jjj) - 42., double(kkk) - 1., 1.);
1132                 }  // GSMRATIOD2[k1][jjj][kkk] < 1.05
1133                 else {
1134                   //        mapBADchannels->Fill(double(jjj)-42., double(kkk)-1., GSMRATIOD2[k1][jjj][kkk]);
1135                 }
1136               }  // GSMRATIOD2[k1][jjj][kkk] != 0
1137             }    //for k1
1138             Int_t MMcount = sscount + 1;
1139             if (MMcount > 0) {
1140               generalcount++;
1141               if (generalcount == 1 && verbosity == 2)
1142                 for (int k1 = 0; k1 < MMcount; k1++) {
1143                   cout << "**** All GOOD runs: indWAS[k1](1,..) =  " << indWAS[k1] + 1 << " XXX[k1]+1 = " << XXX[k1] + 1
1144                        << endl;
1145                 }
1146               gr1 = new TGraph(MMcount, XXX, YY);
1147               colorlines = generalcount / 5. + 2;
1148               gr1->SetLineColor(colorlines);
1149               gr1->SetMarkerColor(colorlines);
1150               gr1->SetMarkerStyle(20);
1151               gr1->SetMarkerSize(1.2);
1152               gr1->SetFillStyle(0);
1153               gr1->GetXaxis()->SetTitle("days");
1154               gr1->GetYaxis()->SetTitle("R");
1155               gr1->Draw("PL");
1156             }  // if
1157             //    else {cout<<"****ERROR for  PLOT2:  MMcount is lower 1,  MMcount =   *** " << MMcount  <<   endl;}
1158           }  //for kkk
1159         }    //for jjj
1160 
1161         //      TLegend leg(.6,.67,.78,.88, " HEP Depth1");
1162         //   TLegend leg(xx1,yy1,xx2,yy2, "HEP17: R vs t");
1163         TLegend leg(xx1, yy1, xx2, yy2, "HE SiPM: R vs t(days)");
1164         //      leg.AddEntry(gr1);
1165         leg.SetMargin(0.3);
1166         leg.SetBorderSize(1);
1167         leg.DrawClone("Same");
1168         /*      
1169       // Draw labels on the y axis
1170       TText *t7 = new TText();
1171       t7->SetTextAlign(32);
1172       t7->SetTextSize(0.035);
1173       t7->SetTextFont(72);
1174       char *labels[NP+1] = {"31","1","7","7","8","9","12","13","19","22","22","24","24","24","24","24","24","Feb."};
1175       float X7[NP];
1176       for(int k1 = 0; k1<NP; k1++) {
1177     //  cout<<"**** XXX[k1] =  " << XXX[k1] <<"     YY[k1] =  " << YY[k1] <<   endl;
1178         t7->DrawText(0.2+XXX[k1],0.890,labels[k1]);
1179       }
1180             t7->DrawText(0.2+XXX[NP-1]+75.,0.890,labels[NP]);
1181 */
1182 
1183       }  ////Method = 2
1184       //
1185 
1186       //======================================================================================================= PLOT3: 2D SiPM channels
1187       if (Method == 3) {
1188         cout << "****Draw 3 Dependencies: 2D SiPM channels  *** " << endl;
1189         TH2F* Cdepth2hbff = (TH2F*)mapBADchannels->Clone("Cdepth2hbff");
1190         Cdepth2hbff->Divide(mapBADchannels, mapBADchannels0, 1, 1, "B");
1191         Cdepth2hbff->Sumw2();
1192         gPad->SetGridy();
1193         gPad->SetGridx();
1194         gStyle->SetOptStat(0000000);
1195         Cdepth2hbff->SetMarkerStyle(20);
1196         Cdepth2hbff->SetMarkerSize(0.4);
1197         Cdepth2hbff->GetYaxis()->SetLabelSize(0.04);
1198         Cdepth2hbff->SetTitle("within R & Weighted by R");
1199         Cdepth2hbff->SetXTitle("#eta \b");
1200         Cdepth2hbff->SetYTitle("#phi \b");
1201         Cdepth2hbff->SetMarkerColor(4);
1202         Cdepth2hbff->SetLineColor(4);
1203         Cdepth2hbff->Draw("COLZ");
1204       }  //Method = 3
1205       //======================================================================================================= PLOT4:gains LED runs
1206       if (Method == 4) {
1207         cout << "****Draw 4 Dependencies: gains LED runs   *** " << endl;
1208         gPad->SetGridy();
1209         gPad->SetGridx();
1210         //    gPad->SetLogy();
1211         //gStyle->SetOptStat(1110000);
1212         gStyle->SetOptStat(1100);  // only mean & rms
1213         //gStyle->SetOptStat(1111111);// only mean & rms
1214         gainkoeff->SetMarkerStyle(20);
1215         gainkoeff->SetMarkerSize(0.4);
1216         gainkoeff->GetYaxis()->SetLabelSize(0.04);
1217         gainkoeff->SetXTitle("gains");
1218         gainkoeff->SetYTitle("N");
1219         gainkoeff->SetMarkerColor(4);
1220         gainkoeff->SetLineColor(4);
1221         //    gainkoeff->Draw("Error");
1222         gainkoeff->Draw("PL");
1223       }  //Method = 4
1224       //======================================================================================================= PLOT5:gains LED runs
1225       if (Method == 5) {
1226         cout << "****Draw 5 Dependencies: gains LED runs   *** " << endl;
1227         gPad->SetGridy();
1228         gPad->SetGridx();
1229         gPad->SetLogy();
1230         //gStyle->SetOptStat(1110000);
1231         gStyle->SetOptStat(1100);  // only mean & rms
1232         //gStyle->SetOptStat(1111111);// only mean & rms
1233         gainkoeff9->SetMarkerStyle(20);
1234         gainkoeff9->SetMarkerSize(0.4);
1235         gainkoeff9->GetYaxis()->SetLabelSize(0.04);
1236         gainkoeff9->SetXTitle("gains");
1237         gainkoeff9->SetYTitle("N");
1238         gainkoeff9->SetMarkerColor(4);
1239         gainkoeff9->SetLineColor(4);
1240         //    gainkoeff9->Draw("Error");
1241         gainkoeff9->Draw("PL");
1242       }  //Method = 5
1243       //======================================================================================================= PLOT6:gains LED runs
1244       if (Method == 6) {
1245         cout << "****Draw 6 Dependencies: gains LED runs   *** " << endl;
1246         gPad->SetGridy();
1247         gPad->SetGridx();
1248         gPad->SetLogy();
1249         //gStyle->SetOptStat(1110000);
1250         gStyle->SetOptStat(1100);  // only mean & rms
1251         //gStyle->SetOptStat(1111111);// only mean & rms
1252         gainkoeff0->SetMarkerStyle(20);
1253         gainkoeff0->SetMarkerSize(0.4);
1254         gainkoeff0->GetYaxis()->SetLabelSize(0.04);
1255         gainkoeff0->SetXTitle("gains");
1256         gainkoeff0->SetYTitle("N");
1257         gainkoeff0->SetMarkerColor(4);
1258         gainkoeff0->SetLineColor(4);
1259         //    gainkoeff0->Draw("Error");
1260         gainkoeff0->Draw("PL");
1261       }  //Method = 6
1262       //======================================================================================================= PLOT7: BADruns
1263       if (Method == 7) {
1264         cout << "****Draw 7 Dependencies: BADruns  *** " << endl;
1265         gPad->Update();
1266         gPad->SetGridy();
1267         gPad->SetGridx();
1268         gPad->SetLogy(kFALSE);
1269         gStyle->SetOptStat(101110);
1270         BADruns->SetMarkerStyle(20);
1271         BADruns->SetMarkerSize(0.4);
1272         BADruns->GetYaxis()->SetLabelSize(0.04);
1273         BADruns->SetTitle("#channels outside Rrange VS iRun");
1274         BADruns->SetXTitle("iRun");
1275         BADruns->SetYTitle("#channels");
1276         BADruns->SetMarkerColor(4);
1277         BADruns->SetLineColor(4);
1278         //    BADruns->Draw("Error");
1279         BADruns->Draw("PL");
1280         //  PRINTOUT ONLY:
1281         //      if(verbosity == 4 ){
1282         int cx = BADruns->GetXaxis()->GetNbins();
1283         cout << "*****    *************     Number of runs w/ R outside unit-range = " << cx << endl;
1284         int nbadruns = 0;
1285         for (int jjj = 1; jjj <= cx; jjj++) {
1286           if (BADruns->GetBinContent(jjj) > 200.) {
1287             cout << "BADruns w/ content>60:   jjj= " << jjj << " run= " << LEDruns[jjj - 1]
1288                  << "  R ouside unit-range for # channels= " << BADruns->GetBinContent(jjj) << endl;
1289             ++nbadruns;
1290           }
1291           //    if( BADruns->GetBinContent(jjj) >8.) {cout<<"BADruns w/ content>60:   jjj= " << jjj  <<" run= " <<   LEDruns[jjj-1]    <<"  R ouside unit-range for # channels= " << BADruns->GetBinContent(jjj) <<endl;++nbadruns;}
1292         }  //jjj
1293         cout << "BADruns w/ content>60   nbadruns= " << nbadruns << endl;
1294         //      }// if(verbosity == 2 )
1295       }  //Method = 7
1296 
1297       //======================================================================================================= PLOT8: Goodruns
1298       if (Method == 8) {
1299         cout << "****Draw 8 Dependencies: Goodruns  *** " << endl;
1300         gPad->SetGridy();
1301         gPad->SetGridx();
1302         //      gPad->SetLogy();
1303         gStyle->SetOptStat(101110);
1304         GOODruns->SetMarkerStyle(20);
1305         GOODruns->SetMarkerSize(0.4);
1306         GOODruns->GetYaxis()->SetLabelSize(0.04);
1307         GOODruns->SetTitle("#channels inside Rrange VS iRun");
1308         GOODruns->SetXTitle("iRun");
1309         GOODruns->SetYTitle("#channels");
1310         GOODruns->SetMarkerColor(4);
1311         GOODruns->SetLineColor(4);
1312         //    GOODruns->Draw("Error");
1313         GOODruns->Draw("PL");
1314         //  PRINTOUT ONLY:
1315         //      if(verbosity == 4 ){
1316         int cx = GOODruns->GetXaxis()->GetNbins();
1317         cout << "************* cx = " << cx << endl;
1318         for (int jjj = 0; jjj <= cx; jjj++) {
1319           //      if( GOODruns->GetBinContent(jjj) >100.) cout<<"GOODruns:   k1= " <<      jjj      <<endl;
1320           //      if( GOODruns->GetBinContent(jjj) >5.) cout<<"GOODruns:   k1= " <<      jjj      <<endl;
1321           if (GOODruns->GetBinContent(jjj) > 1400.)
1322             cout << "GOODruns:   k1(0,...)= " << jjj
1323                  << "  GOODruns->GetBinContent(jjj)= " << GOODruns->GetBinContent(jjj) << endl;
1324         }  //jjj
1325            //      }// if(verbosity == 2 )
1326       }    //Method = 8
1327 
1328       //======================================================================================================= PLOT9:depthes with zero A
1329       if (Method == 9) {
1330         cout << "****Draw 9 Dependencies: depthes with zero A   *** " << endl;
1331         gPad->SetGridy();
1332         gPad->SetGridx();
1333         gPad->SetLogy(kFALSE);
1334         gStyle->SetOptStat(1110000);
1335         NotEmptyDepthes->SetMarkerStyle(20);
1336         NotEmptyDepthes->SetMarkerSize(0.4);
1337         NotEmptyDepthes->GetYaxis()->SetLabelSize(0.04);
1338         NotEmptyDepthes->SetTitle("# Not Empty Channels in etq-phi projection");
1339         NotEmptyDepthes->SetXTitle("4*(eta-57)+(phi-64)");
1340         NotEmptyDepthes->SetYTitle("N");
1341         NotEmptyDepthes->SetMarkerColor(4);
1342         NotEmptyDepthes->SetLineColor(4);
1343         //    NotEmptyDepthes->Draw("Error");
1344         NotEmptyDepthes->Draw("PL");
1345       }  //Method = 9
1346       //======================================================================================================= PLOT10:  Aijk  for each event and all LED runs
1347       if (Method == 10) {
1348         cout << "****Draw 10 Dependencies: Aijk  for each event and all LED runs  *** " << endl;
1349 
1350         c1->Clear();
1351         c1->Divide(1, 1);
1352 
1353         c1->cd(1);
1354         //        TString epsName = fname + LEDruns[0] +".root";
1355         //        TFile *hfile= new TFile(epsName, "READ");
1356         //        TH1F * Aeff1D= (TH1F*)hfile->Get("h_ADCAmpl_HE");
1357 
1358         gPad->SetGridy();
1359         gPad->SetGridx();
1360         gPad->SetLogy();
1361         gStyle->SetOptStat(101110);
1362         //      Aeff1D->SetStats(0);
1363         Aeff1D->SetMarkerStyle(20);
1364         Aeff1D->SetMarkerSize(0.4);
1365         Aeff1D->GetYaxis()->SetLabelSize(0.04);
1366         Aeff1D->SetTitle("all runs & events& channels");
1367         Aeff1D->SetXTitle("Aijk");
1368         Aeff1D->SetYTitle("N");
1369         Aeff1D->SetMarkerColor(4);
1370         Aeff1D->SetLineColor(4);
1371         //    Aeff1D->Draw("Error");
1372         //    Aeff1D->Draw("PL");
1373         Aeff1D->SetMinimum(0.8);
1374         Aeff1D->Draw("");
1375 
1376         c1->Update();
1377 
1378       }  //Method = 10
1379       //======================================================================================================= PLOT11: 2D SiPM channels Depthes1,2,3,4
1380       if (Method == 11) {
1381         cout << "****Draw 11 <A>: 2D Depthes1,2,3,4  *** " << endl;
1382         //      gPad->SetGridy();
1383         //      gPad->SetGridx();
1384         //      gStyle->SetOptStat(0000000);
1385         c1->Clear();
1386         c1->Divide(2, 2);
1387 
1388         c1->cd(1);
1389         mapchannelsdepth1->SetStats(0);
1390         mapchannelsdepth1->SetTitle("<A> Depth1");
1391         mapchannelsdepth1->SetXTitle("#eta \b");
1392         mapchannelsdepth1->SetYTitle("#phi \b");
1393         mapchannelsdepth1->Draw("COLZ");
1394         c1->cd(2);
1395         mapchannelsdepth2->SetStats(0);
1396         mapchannelsdepth2->SetTitle("<A> Depth2");
1397         mapchannelsdepth2->SetXTitle("#eta \b");
1398         mapchannelsdepth2->SetYTitle("#phi \b");
1399         mapchannelsdepth2->Draw("COLZ");
1400         c1->cd(3);
1401         mapchannelsdepth3->SetStats(0);
1402         mapchannelsdepth3->SetTitle("<A> Depth3");
1403         mapchannelsdepth3->SetXTitle("#eta \b");
1404         mapchannelsdepth3->SetYTitle("#phi \b");
1405         mapchannelsdepth3->Draw("COLZ");
1406         c1->cd(4);
1407         mapchannelsdepth4->SetStats(0);
1408         mapchannelsdepth4->SetTitle("<A> Depth4");
1409         mapchannelsdepth4->SetXTitle("#eta \b");
1410         mapchannelsdepth4->SetYTitle("#phi \b");
1411         mapchannelsdepth4->Draw("COLZ");
1412 
1413         c1->Update();
1414 
1415       }  //Method = 11
1416       //======================================================================================================= PLOT12: 2D SiPM channels Depthes5,6,7
1417       if (Method == 12) {
1418         cout << "****Draw 12 <A>: 2D Depthes5,6,7  *** " << endl;
1419         //      gPad->SetGridy();
1420         //      gPad->SetGridx();
1421         //      gStyle->SetOptStat(0000000);
1422         c1->Clear();
1423         c1->Divide(2, 2);
1424 
1425         c1->cd(1);
1426         mapchannelsdepth5->SetStats(0);
1427         mapchannelsdepth5->SetTitle("<A> Depth5");
1428         mapchannelsdepth5->SetXTitle("#eta \b");
1429         mapchannelsdepth5->SetYTitle("#phi \b");
1430         mapchannelsdepth5->Draw("COLZ");
1431         c1->cd(2);
1432         mapchannelsdepth6->SetStats(0);
1433         mapchannelsdepth6->SetTitle("<A> Depth6");
1434         mapchannelsdepth6->SetXTitle("#eta \b");
1435         mapchannelsdepth6->SetYTitle("#phi \b");
1436         mapchannelsdepth6->Draw("COLZ");
1437         c1->cd(3);
1438         mapchannelsdepth7->SetStats(0);
1439         mapchannelsdepth7->SetTitle("<A> Depth7");
1440         mapchannelsdepth7->SetXTitle("#eta \b");
1441         mapchannelsdepth7->SetYTitle("#phi \b");
1442         mapchannelsdepth7->Draw("COLZ");
1443 
1444         c1->Update();
1445 
1446       }  //Method = 12
1447 
1448       //======================================================================================================= PLOT13: 2D SiPM channels Depthes5,6,7
1449       if (Method == 13) {
1450         cout << "****Draw 13 function, fC *** " << endl;
1451         c1->Clear();
1452         c1->Divide(1, 1);
1453 
1454         c1->cd(1);
1455         {
1456           double c0 = 1.000000;
1457           double b1 = 2.71238e-05;
1458           double a2 = 1.32877e-10;
1459           Int_t n = 50;
1460           Double_t x[n], y[n];
1461           for (Int_t i = 0; i < n; i++) {
1462             x[i] = (i + 1) * 20000.;
1463             y[i] = a2 * x[i] * x[i] / 40. / 40. + b1 * x[i] / 40. + c0;
1464           }
1465 
1466           // create graph
1467           TGraph* gr = new TGraph(n, x, y);
1468 
1469           // draw the graph with axis, continuous line, and put
1470           // a * at each point
1471           gPad->SetGridy();
1472           gPad->SetGridx();
1473           //    gPad->SetLogy();
1474           gr->Draw("AC*");
1475           /*
1476       gr1 = new TGraph(MMcount,XXX,YY); 
1477       colorlines = generalcount/5.+2;
1478       gr1->SetLineColor(colorlines);  gr1->SetMarkerColor(colorlines); 
1479       gr1->SetMarkerStyle(20); gr1->SetMarkerSize(1.2); gr1->SetFillStyle(0); gr1->Draw("PL");
1480     */
1481         }
1482 
1483         c1->Update();
1484 
1485       }  //Method = 13
1486 
1487       //  //////////////////////////////////////////////////////////////////////////
1488 
1489       //=======================================================================================================
1490       //======================================================================================================= finish loop over Methods
1491       //=======================================================================================================
1492       TString fdir = "testamt0shunt6gsm2018/";
1493       //
1494       TString plotName = fdir + MethodName[Method] + ".png";
1495       c1->SaveAs(plotName);
1496       cout << "****PLOT " << Method << " drawn **** " << endl;
1497 
1498     }  //if( Method != 9
1499     ++Method;
1500   }  //while loop over Methods
1501   //=======================================================================================================
1502   //=======================================================================================================
1503   //=======================================================================================================
1504   //=======================================================================================================
1505   //=======================================================================================================
1506   //=======================================================================================================
1507   //=======================================================================================================
1508   //=======================================================================================================
1509   //=======================================================================================================
1510   //______________________________________________________________________________
1511   //______________________________________________________________________________
1512   //
1513   //______________________________________________________________________________
1514   //______________________________________________________________________________
1515   //
1516   gSystem->Exit(0);
1517   //______________________________________________________________________________
1518 }
1519 //______________________________________________________________________________