CMS 3D CMS Logo

Functions
zamt5GSMHB.cc File Reference
#include <iostream>
#include <fstream>
#include "TH1.h"
#include "TH2.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TCanvas.h"
#include "TROOT.h"
#include <TMath.h>
#include "TStyle.h"
#include "TSystem.h"
#include "TLegend.h"
#include "TText.h"
#include "TAxis.h"
#include "TFile.h"
#include "TLine.h"
#include "TGraph.h"
#include <TPaveText.h>
#include <TPostScript.h>
#include <TClass.h>
#include <TLatex.h>
#include <TFrame.h>
#include <TPad.h>
#include <TGaxis.h>
#include "TGraphErrors.h"
#include "TF1.h"
#include "TArrow.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

===============================================================================================================================================================================================


variant2: for each run define phi-averaged A for normalization channel (Dref,16) and then, divide Rijk on it, i.e. get RRijk




















































































eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=29 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=28

Definition at line 34 of file zamt5GSMHB.cc.

References isotrackTrainRegressor::a2, b1, fftjetpileupestimator_calo_uncalib_cfi::c0, alignmentValidation::c1, gather_cfg::cout, writedatasetfile::firstrun, alignmentValidation::fname, mps_fire::i, l1tHGCalConcentratorProducer_cfi::Method, create_idmaps::n, PostProcessor_cff::normalization, compareTotals::pad1, L1TEGammaDiff_cfi::plotName, submitPVValidationJobs::t, verbosity, x, ecalPiZeroTask_cfi::X0, AlignmentPI::XX, testProducerWithPsetDescEmpty_cfi::y1, testProducerWithPsetDescEmpty_cfi::y2, AlignmentPI::YY, and ppsModifySingularModes_cfi::z1.

34  {
35  cout << "********************************************************************* START job " << endl;
36  //______________________________________________________________________________________________________________________________
37  //TCanvas *c1;
38  TGraph* gr1;
39  TGraph* gr2;
40  TGraph* gr3;
41  TGraph* gr4;
42  TGraph* gr5;
43  TGraph* gr6;
44  TGraph* gr7;
45  TGraph* gr8;
46  TGraph* gr9;
47  TGraphErrors* ge1;
48  TGraphErrors* ge2;
49  TGraphErrors* ge3;
50  TGraphErrors* ge4;
51  TGraphErrors* ge5;
52  TGraphErrors* ge6;
53  TGraphErrors* ge7;
54  TGraphErrors* ge8;
55  TGraphErrors* ge9;
56 
57  //
58  const Int_t NMethods = 14; // total number of Methods (all-together 37 methods)
59  const Int_t NMethodsStart = 0; // since which method to start ( min= 0)
60  const Int_t NMethodsToUse = 13; // choose Number of methods to use ( max= 36)
61  //
62  TString MethodName[NMethods] = {"PLOT0",
63  "PLOT1",
64  "PLOT2",
65  "PLOT3",
66  "PLOT4",
67  "PLOT5",
68  "PLOT6",
69  "PLOT7",
70  "PLOT8",
71  "PLOT9",
72  "PLOT10",
73  "PLOT11",
74  "PLOT12",
75  "PLOT13"};
76  //______________________________________________________________________________________________________________________________
77  const Int_t NMAXM = 70; //
78 
79  cout << "********************************************************************* NMAXM = " << NMAXM << endl;
80 
81  TString LEDrunsM[NMAXM] = {// reference first run 315812 has Local run key: LED - 2000 events, masks: HCAL_Laser
82  "315812", "315984", "316826", "317116", "317193", "317268", "317271", "317273", "317363",
83  "317444", "317606", "317607", "317609", "317610", "317611", "317612", "317613", "317617",
84  "317785", "318758", "319198", "319401", "319517", "319519", "319520", "319564", "319612",
85  "319734", "319771", "319774", "319857", "319969", "320117", "320158", "320203", "320205",
86  "320348", "320579", "320873", "320892", "320952", "321019", "321036", "321187", "321339",
87  "321359", "321371", "321447", "321514", "322781", "322782", "323314", "323502", "323579",
88  "323613", "323742", "324030", "324032", "324138", "324225", "324296", "324919", "325141",
89  "325787", "326234", "326875", "327288", "327438", "327552", "327579"
90 
91  };
92  cout << "********************************************************************* first massives defined " << endl;
93  Float_t X0M[NMAXM] = {
94 
95  0., 2., 17., 22., 23., 24., 24., 24., 27., 29., 32., 32., 32., 32., 32., 32., 32., 32.,
96  38., 51., 58., 63., 65., 65., 65., 66., 68., 70., 71., 71., 72., 74., 77., 78., 79., 79.,
97  80., 85., 90., 91., 92., 93., 93., 98., 101., 101., 101., 104., 106., 129., 129., 138., 141., 142.,
98  143., 146., 150., 150., 151., 153., 155., 165., 169., 179., 183., 195., 203., 205., 208., 209.,
99  }; // days of year time points (abscissa) !!!
100  cout << "********************************************************************* both massives are defined " << endl;
102  //define yearcase:
103  // ____________________________________________________________________________ THIS line below is MAIN to make a yearcase selection !!!!!!!!!!!!!!!!!!!!!!!!!!
104  const Int_t yearcase = 0;
105  //
106  cout << "************************************** yearcase = " << yearcase << endl;
107  // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
108  // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
109  // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
110  // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
111  // Int_t verbosity = 2;//
112  // Int_t verbosity = 3;//
113  // Int_t verbosity = 4;// to clarify # channels in HBP17
114  Int_t verbosity = 0; //
115  // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
116 
117  // const Int_t flagHBP17selection = 2;// -> ALL channels w/o bad
118  // const Int_t flagHBP17selection = 1;// ==1 HBP17;
119  const Int_t flagHBP17selection = 0; // -> ALL channels
120 
121  cout << "************************************** flagHBP17selection = " << flagHBP17selection << endl;
122  // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
123  //______________________________________________________________________________
124 
125  //______________________________________________________________________________
126  //______________________________________________________________________________
127  //
128  //---=[ SetCanvasDef ]=----------------
129  // Create a new canvas.
130  //TCanvas *c1 = new TCanvas("c1","GSM",10,10,900,700);
131 
132  //TCanvas *c1 = new TCanvas("c1","GSM",20,50,920,850);
133  TCanvas* c1 = new TCanvas("c1", "GSM", 10, 10, 1010, 1010);
134 
135  //TCanvas *c1 = new TCanvas("c1","GSM",200,10,700,900);
136  //TCanvas *c1 = new TCanvas("c1","Hcal4test",200,10,700,900);
137 
138  c1->Range(0, 0, 25, 18);
139  //c1->SetFillColor(40);
140  c1->SetFillColor(0);
141  c1->Clear();
142 
143  TLatex* t = new TLatex();
144  t->SetTextFont(32);
145  //t->SetTextColor(4);
146  t->SetTextSize(0.03);
147  t->SetTextAlign(12);
148  //______________________________________________________________________________
149  t->DrawLatex(
150  0.9, 15.5, "Time dependence of full Amplitude averaged over events of each LED run for some random HB channels");
151 
152  //-----------------------------------------------------------------------------------------------------
153  //
154  // x1 y1 x2 y2
155  // pad1->DrawFrame(1, 0.8, 370, 1.2);// all
156 
157  //
158  // Float_t x1=0.00; Float_t x2=170.00;
159  // Float_t x1=0.00; Float_t x2=850.00;
160 
161  // Float_t x1=0.00; Float_t x2=45.00;
162  Float_t x1 = 0.00;
163  Float_t x2 = 215.0;
164 
165  // y(ordinate) for All Days
166  // Float_t y1=0.985; Float_t y2= 1.015;
167  Float_t y1 = 0.9;
168  Float_t y2 = 1.1;
169 
170  //
171  // x(abscissa) for Days
172  Float_t RrangeMIN = y1;
173  Float_t RrangeMAX = y2;
174 
175  //
176  Float_t xx1 = 0.35;
177  Float_t xx2 = 0.55;
178  Float_t yy1 = 0.76;
179  Float_t yy2 = 0.88;
180  //
181  cout << "************************************** RrangeMIN = " << RrangeMIN << " RrangeMAX = " << RrangeMAX << endl;
182 
183  //-----------------------------------------------------------------------------------------------------
184  //-----------------------------------------------------------------------------------------------------
186  const Int_t NDEP = 3;
187  const Int_t NETA0 = 83;
188  const Int_t NPHI0 = 73;
189  // const Int_t NDEP =5;const Int_t NETA0=83;const Int_t NPHI0=73;
190  //
191  Double_t mapRATIO[NDEP][NETA0][NPHI0];
192  Double_t mapRATIOD2[NETA0][NPHI0];
193  Int_t mapRATIOD20[NETA0][NPHI0];
194 
195  //Double_t normalization[NDEP][NETA0][NPHI0];
196  Double_t normalization[NETA0][NPHI0];
197  cout << "************************************** NDEP = " << NDEP << " NETA0 = " << NETA0 << " NPHI0 = " << NPHI0
198  << endl;
199 
200  // define max size of massives (to be just NMAXSIZE ):
201  Int_t NMAXSIZE = NMAXM;
202  Float_t X0[NMAXSIZE];
203  TString LEDruns[NMAXSIZE];
204  Double_t XX[NMAXSIZE];
205  Double_t XXE[NMAXSIZE];
206  Double_t XXX[NMAXSIZE];
207  Double_t XXXE[NMAXSIZE];
208  Int_t indWAS[NMAXSIZE];
209 
210  Double_t YY[NMAXSIZE];
211  Double_t YYE[NMAXSIZE];
212  cout << "************************************** NMAXSIZE = " << NMAXSIZE << " NMAXM = " << NMAXM << endl;
213  //----------------------------------------------------------------------
214 
215  Double_t GSMRATIOD2[NMAXSIZE][NETA0][NPHI0];
216 
220  // define where to run inside massives above:
221  // yearcase=0
222  Int_t NMINmM = 0;
223  Int_t NMAXmM = NMAXSIZE - 1;
224  Int_t NMAXaM = NMAXSIZE;
225  if (yearcase == 1) {
226  // 2016 only: yearcase=1
227  NMINmM = 0;
228  NMAXmM = 46;
229  NMAXaM = 47; // M
230  } else if (yearcase == 2) {
231  // 2017 only:: yearcase=2
232  NMINmM = 53;
233  NMAXmM = 93;
234  NMAXaM = 41; // M
235  } else if (yearcase == 3) {
236  // 20167 only:: yearcase=3
237  NMINmM = 0;
238  NMAXmM = 93;
239  NMAXaM = 94; // M
240  } else if (yearcase == 4) {
241  // 2018 only:: yearcase=4
242  NMINmM = 94;
243  NMAXmM = -1;
244  NMAXaM = -1; // M
245  } else if (yearcase == 5) {
246  // 20168 only:: yearcase=5
247  NMINmM = 0;
248  NMAXmM = -1;
249  NMAXaM = -1; // M
250  }
251 
252  cout << "************************************** NMINmM = " << NMINmM << " NMAXmM = " << NMAXmM
253  << " NMAXaM = " << NMAXaM << endl;
254  if (NMINmM == -1 || NMAXmM == -1 || NMAXaM == -1)
255  cout << " STOP !!!!!! NMINmM == -1 || NMAXmM == -1 || NMAXaM == -1 " << endl;
257  Int_t NMAX = 0;
258  NMAX = NMAXaM;
259  // cout << "NMAX= " << NMAX << "NMINmM= " << NMINmM << "NMAXmM= " << NMAXmM <<endl;
260  for (int jjj = NMINmM; jjj <= NMAXmM; jjj++) {
261  LEDruns[jjj - NMINmM] = LEDrunsM[jjj];
262  X0[jjj - NMINmM] = X0M[jjj];
263  // cout << "jjj= " << jjj << " jjj-NMINmM= " << jjj-NMINmM << " LEDrunsM[jjj]= " << LEDrunsM[jjj] << " X0M[jjj]= " << X0M[jjj] <<endl;
264  }
266  //========================================================================================================================
267  //---------------------------------------------------------------------------------------------------------------------
268  //---------------------------------------------------------------------------------------------------------------------
269  // Int_t NP = 22; // for loop over time points(LED runs) NMAX is number of LED runs(time abscissa)
270  Int_t NP = NMAX; // for loop over time points(LED runs) NMAX is number of LED runs(time abscissa)
271  cout << "******************* NP = " << NP << endl;
272  //
273  //--------------------------------------------------------------------------------------------------------------------- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
274  // take into account for future treatment only channels with <Aijk>_runevents within cutMinA to cutMaxA:
275  // Double_t cutMinA =400.; Double_t cutMaxA = 1200.; // HPD HB only
276 
277  // Double_t cutMinA =0.; Double_t cutMaxA = 999999999999.;
278  // Double_t cutMinA =50000.; Double_t cutMaxA = 150000.;
279  Double_t cutMinA = 100.;
280  Double_t cutMaxA = 5000.;
281 
282  // Double_t cutMinA =9000.; Double_t cutMaxA = 40000.;
283  //
284  // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
285  //---------------------------------------------------------------------------------------------------------------------
286  //------------------------------------ define DELTA (days) of current point wrt first point
287  for (int kk1 = 0; kk1 < NP; kk1++) {
288  XX[kk1] = X0[kk1];
289  int k10 = 0;
290  int z1 = X0[k10];
291  XX[kk1] -= z1;
292  if (verbosity == 2) {
293  cout << "ORDINATE points: kk1 = " << kk1 << " XX[kk1]= " << XX[kk1] << endl;
294  }
295 
296  XXE[kk1] = 0.001 * XX[kk1];
297  } //XXE - errors at fit
298  //-----------------------------------------------------------------------------------------------------
299 
300  //----------------------------------------------------------------------------------------------------
301  //----------------------------------------------------------------------------------------------------
303  for (int jjj = 0; jjj <= 82; jjj++) {
304  for (int kkk = 0; kkk <= 72; kkk++) {
305  mapRATIOD2[jjj][kkk] = 0.;
306  mapRATIOD20[jjj][kkk] = 0.;
307  normalization[jjj][kkk] = 0.;
308 
309  for (int k1 = 0; k1 < NP; k1++) {
310  GSMRATIOD2[k1][jjj][kkk] = mapRATIOD2[jjj][kkk];
311  }
312 
313  for (int iii = 0; iii < NDEP; iii++) {
314  mapRATIO[iii][jjj][kkk] = 0.;
315  // normalization[iii][jjj][kkk] = 0.;
316  }
317 
318  } // for
319  } // for
320 
322 
323  //______________________________________________________________________________
324  // ls -latr /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LED_* | less
325 
326  TString fname = "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LED_";
327  // TString fname = "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos/LASER_";
328 
329  // booking:
330  TH1F* Seff1D = new TH1F("Seff1D", "", 1000, 10., 1010.);
331  TH1F* Ceff1D = new TH1F("Ceff1D", "", 1500, 10., 8010.);
332 
333  TH2F* mapBADchannels = new TH2F("mapBADchannels", " ", 82, -41., 41., 72, 0., 72.);
334  TH2F* mapBADchannels0 = new TH2F("mapBADchannels0", " ", 82, -41., 41., 72, 0., 72.);
335 
336  TH2F* mapchannelsdepth1 = new TH2F("mapchannelsdepth1", " ", 82, -41., 41., 72, 0., 72.);
337  TH2F* mapchannelsdepth2 = new TH2F("mapchannelsdepth2", " ", 82, -41., 41., 72, 0., 72.);
338  // TH2F* mapchannelsdepth3= new TH2F("mapchannelsdepth3"," ", 82, -41., 41., 72, 0., 72.);
339  // TH2F* mapchannelsdepth4= new TH2F("mapchannelsdepth4"," ", 82, -41., 41., 72, 0., 72.);
340 
341  TH1F* gainkoeff = new TH1F("gainkoeff", "", 100, y1, y2);
342  TH1F* gainkoeff0 = new TH1F("gainkoeff0", "", 100, 0.9, 1.1);
343  TH1F* gainkoeff9 = new TH1F("gainkoeff9", "", 100, 0.1, 1.9);
344  TH1F* GOODruns = new TH1F("GOODruns", "", NP, 0., float(NP));
345  TH1F* BADruns = new TH1F("BADruns", "", NP, 0., float(NP));
346  TH1F* NotEmptyDepthes = new TH1F("NotEmptyDepthes", "", 56, 0., 56.);
347 
349  Int_t kmm = 0;
350  Int_t firstrun = 0;
351  //
352  cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! firstrun = " << firstrun << " run = " << LEDruns[firstrun] << endl;
353 
357 
359  cout << "!!!!!!!!!!!!!!!!!!!!!! use root files from official RMT dir. " << endl;
360  // cout << "!!!!!!!!!!!!!!!!!!!!!! use root files from my dir. " <<endl;
362 
363  TH1F* Aeff1D = new TH1F("Aeff1D", "", 250, 0., 500000.);
364  // TH1F* Aeff1D = new TH1F("Aeff1D","", 200, 0.,2000000.);
365  int ck1count = 0;
366  for (int k1 = firstrun; k1 < NP; k1++) {
367  // for(int k1 = 0; k1<NP; k1++) {
368  ck1count++;
370  // my dir.
371  // TString epsName = "root/LEDtest" + LEDruns[k1] + ".root";
372  // TString epsName = "rootshunt1/LEDtest" + LEDruns[k1] + ".root";
373 
374  // RMT:
375  TString epsName = fname + LEDruns[k1] + ".root";
376 
378  // cout << "!!!! read LED run with k1= " << k1 <<" run: " << LEDruns[k1] <<endl;
379 
380  TFile* hfile = new TFile(epsName, "READ");
381  // cout << "!!!! read LED run with k1= " << k1 <<" run: " << LEDruns[k1] <<endl;
382  TH1F* Aeff1 = (TH1F*)hfile->Get("h_ADCAmpl_HB");
383 
384  int kx = Aeff1->GetXaxis()->GetNbins();
385  // cout <<" run = " << LEDruns[k1] <<" Nbins=kx= " << kx <<" k1= " << k1 <<endl;
386  // cout <<"BEGINNING k1= " << k1 <<" kx= " << kx <<endl;
387  int maxvalueA = -1;
388  for (int jjj = 0; jjj < kx; jjj++) {
389  if (double(Aeff1->GetBinContent(jjj)) > 0. && maxvalueA < jjj)
390  maxvalueA = jjj;
391  // cout <<" k1= " << k1 <<" jjj= " << jjj <<" content= " << Aeff1->GetBinContent(jjj) <<endl;
392  Aeff1D->Fill(float(jjj), double(Aeff1->GetBinContent(jjj)));
393  } // for
394  cout << " run = " << LEDruns[k1] << " k1= " << k1 << " max bin value= " << maxvalueA << " ck1count= " << ck1count
395  << endl;
396 
397  //
398  //
399  // display last-run existing histoes:
400  if (k1 == NP - 1) {
401  c1->Clear();
402  c1->Divide(1, 1);
403  c1->cd(1);
404  gPad->SetGridy();
405  gPad->SetGridx();
406  gPad->SetLogy();
407  gStyle->SetOptStat(101110);
408  Aeff1->SetMarkerStyle(20);
409  Aeff1->SetMarkerSize(0.4);
410  Aeff1->GetYaxis()->SetLabelSize(0.04);
411  Aeff1->SetTitle("Last run & events & channels");
412  Aeff1->SetXTitle("Aijk");
413  Aeff1->SetYTitle("N");
414  Aeff1->SetMarkerColor(4);
415  Aeff1->SetLineColor(4);
416  Aeff1->SetMinimum(0.8);
417  Aeff1->Draw("PL");
418  c1->Update();
419  TString fdir = "testamt5gsmHB2018/";
420  // TString plotName = fdir + "Aijk.png";
421  TString plotName = fdir + "Aijk-Run" + LEDruns[k1] + ".png";
422  c1->SaveAs(plotName);
423  cout << "****PLOT AijkLastRun.png is drawn **** " << endl;
424  }
425  // display first runt existing histoes:
426  // if(k1== 0 ) {
427  if (k1 == firstrun) {
428  c1->Clear();
429  c1->Divide(1, 1);
430  c1->cd(1);
431  gPad->SetGridy();
432  gPad->SetGridx();
433  // gPad->SetLogy();
434  gStyle->SetOptStat(101110);
435  Aeff1->SetMarkerStyle(20);
436  Aeff1->SetMarkerSize(0.4);
437  Aeff1->GetYaxis()->SetLabelSize(0.04);
438  Aeff1->SetTitle("First run & events & channels");
439  Aeff1->SetXTitle("Aijk");
440  Aeff1->SetYTitle("N");
441  Aeff1->SetMarkerColor(4);
442  Aeff1->SetLineColor(4);
443  Aeff1->SetMinimum(0.8);
444  Aeff1->Draw("PL");
445  c1->Update();
446  TString fdir = "testamt5gsmHB2018/";
447  TString plotName = fdir + "AijkFirstRun.png";
448  c1->SaveAs(plotName);
449  cout << "****PLOT AijkFirstRun.png is drawn **** " << endl;
450  }
451  // 000000000000000000000000000000000000000000000000000000000000000000000000
452  // TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl");
453  // TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl");
454  // TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl");
455  // 111111111111111111111111111111111111111111111111111111111111111111111111
456  // h_mapDepth1ADCAmpl12 means ADCcounts(massive) within -1 max +1 +2
457 
458  /*
459  TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl12_HB");
460  TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12_HB");
461  TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12_HB");
462 */
463  // HBP17 of 2017:
464  // TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl12SiPM_HB");
465  // TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12SiPM_HB");
466  // TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12SiPM_HB");
467  // all:
468 
469  TH2F* twod1 = (TH2F*)hfile->Get("h_mapDepth1ADCAmpl12_HB");
470  TH2F* twod2 = (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12_HB");
471  // TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12_HB");
472 
473  // TH2F *twod4= (TH2F*)hfile->Get("h_mapDepth4ADCAmpl12_HB");
474 
475  // all TS bins:
476  // TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl_HB");
477  // TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl_HB");
478  // TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl_HB");
479 
480  // TH2F *twod4= (TH2F*)hfile->Get("h_mapDepth4ADCAmpl_HB");
481 
482  int nx = twod1->GetXaxis()->GetNbins();
483  int ny = twod1->GetYaxis()->GetNbins();
484  // cout <<"BEGINNING k1= " << k1 <<" nx= " << nx <<" ny= " << ny <<endl;
485 
486  TH2F* t0010 = (TH2F*)hfile->Get("h_mapDepth1_HB");
487  TH2F* t0020 = (TH2F*)hfile->Get("h_mapDepth2_HB");
488  // TH2F *t0030= (TH2F*)hfile->Get("h_mapDepth3_HB");
489  // TH2F *t0040= (TH2F*)hfile->Get("h_mapDepth4_HB");
490 
491  TH2F* Ceff1 = (TH2F*)twod1->Clone("Ceff1");
492  TH2F* Ceff2 = (TH2F*)twod2->Clone("Ceff2");
493  // TH2F* Ceff3= (TH2F*)twod3->Clone("Ceff3");
494  // TH2F* Ceff4= (TH2F*)twod4->Clone("Ceff4");
495 
496  // <Aijk>_runevents:
497  Ceff1->Divide(twod1, t0010, 1, 1, "B");
498  Ceff2->Divide(twod2, t0020, 1, 1, "B");
499  // Ceff3->Divide(twod3,t0030, 1, 1, "B");
500  // Ceff4->Divide(twod4,t0040, 1, 1, "B");
501  // Ceff1->Sumw2();Ceff2->Sumw2();Ceff3->Sumw2();
503  for (int jjj = 0; jjj < nx; jjj++) {
504  for (int kkk = 0; kkk < ny; kkk++) {
505  // HBP17 selection:
506  if (flagHBP17selection == 0 ||
507  (flagHBP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
508  ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
509  (flagHBP17selection == 2 && !(((jjj > 14 && jjj < 25) && (kkk > 55 && kkk < 64))))) {
510  // if(Ceff1->GetBinContent(jjj,kkk) !=0.) cout <<" k1=111111 " << k1 <<" eta= " << jjj <<" phi= " << kkk <<" Ceff1= " << Ceff1->GetBinContent(jjj,kkk) <<endl;
511  // if(Ceff7->GetBinContent(jjj,kkk) !=0.) cout <<" k1=77777777777 " << k1 <<" eta= " << jjj <<" phi= " << kkk <<" Ceff7= " << Ceff7->GetBinContent(jjj,kkk) <<endl;
512  if (Ceff1->GetBinContent(jjj, kkk) > 0.)
513  mapchannelsdepth1->Fill(double(jjj) - 41., double(kkk), Ceff1->GetBinContent(jjj, kkk));
514  if (Ceff2->GetBinContent(jjj, kkk) > 0.)
515  mapchannelsdepth2->Fill(double(jjj) - 41., double(kkk), Ceff2->GetBinContent(jjj, kkk));
516  // if(Ceff3->GetBinContent(jjj,kkk) >0. ) mapchannelsdepth3->Fill( double(jjj)-41., double(kkk), Ceff3->GetBinContent(jjj,kkk) );
517  // if(Ceff4->GetBinContent(jjj,kkk) >0. ) mapchannelsdepth4->Fill( double(jjj)-41., double(kkk), Ceff4->GetBinContent(jjj,kkk) );
518  } // if HBP17 selection
519  } // for
520  } // for
522  // }
523 
524  //
525  //
526  // fill:
527  // fill massive <Aijk>_runevents , where iii=depth, jjj=eta, kkk=phi
528  for (int jjj = 0; jjj < nx; jjj++) {
529  for (int kkk = 0; kkk < ny; kkk++) {
530  //
531  // HBP17 selection:
532  if (flagHBP17selection == 0 ||
533  (flagHBP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
534  ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
535  (flagHBP17selection == 2 && !(((jjj > 14 && jjj < 25) && (kkk > 55 && kkk < 64))))) {
536  // FILL NEW PLOTS:
537  // Aijk: Ceff1D & Seff1D plots
538  if (Ceff1->GetBinContent(jjj, kkk) != 0.) {
539  Ceff1D->Fill(Ceff1->GetBinContent(jjj, kkk));
540  Seff1D->Fill(Ceff1->GetBinContent(jjj, kkk));
541  }
542  if (Ceff2->GetBinContent(jjj, kkk) != 0.) {
543  Ceff1D->Fill(Ceff2->GetBinContent(jjj, kkk));
544  Seff1D->Fill(Ceff2->GetBinContent(jjj, kkk));
545  }
546  // if(Ceff3->GetBinContent(jjj,kkk)!= 0.) {Ceff1D->Fill(Ceff3->GetBinContent(jjj,kkk));Seff1D->Fill(Ceff3->GetBinContent(jjj,kkk));}
547  // if(Ceff4->GetBinContent(jjj,kkk)!= 0.) {Ceff1D->Fill(Ceff4->GetBinContent(jjj,kkk));Seff1D->Fill(Ceff4->GetBinContent(jjj,kkk));}
548  } //if
549  }
550  }
551 
552  //--------------------------------------
553  // take into account for future treatment only HBP17 channels and cuts on <Aijk>_runevents within cutMinA to cutMaxA:
554  // apply cut on <Aijk>_runevents
555  // -41 +41
556  // 82 bins
557  for (int jjj = 0; jjj < nx; jjj++) {
558  for (int kkk = 0; kkk < ny; kkk++) {
559  // HBP17 selection:
560  if (flagHBP17selection == 0 ||
561  (flagHBP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
562  ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
563  (flagHBP17selection == 2 && !(((jjj > 14 && jjj < 25) && (kkk > 55 && kkk < 64))))) {
564  if (Ceff1->GetBinContent(jjj, kkk) > cutMinA && Ceff1->GetBinContent(jjj, kkk) < cutMaxA)
565  mapRATIO[1][jjj][kkk] = Ceff1->GetBinContent(jjj, kkk);
566  if (Ceff2->GetBinContent(jjj, kkk) > cutMinA && Ceff2->GetBinContent(jjj, kkk) < cutMaxA)
567  mapRATIO[2][jjj][kkk] = Ceff2->GetBinContent(jjj, kkk);
568  // if(Ceff3->GetBinContent(jjj,kkk)> cutMinA && Ceff3->GetBinContent(jjj,kkk)< cutMaxA) mapRATIO[3][jjj][kkk] = Ceff3->GetBinContent(jjj,kkk);
569  // if(Ceff4->GetBinContent(jjj,kkk)> cutMinA && Ceff4->GetBinContent(jjj,kkk)< cutMaxA) mapRATIO[4][jjj][kkk] = Ceff4->GetBinContent(jjj,kkk);
570  } //if
571  } // for
572  } // for
574  /*
575  // define A for refRun : k1=[0]
577  if(k1==firstrun && kmm==0 ) {
578  kmm=1; //Int_t mcount=0;
579  cout<<"* to be printed once only CHBCK IT please ************ kmm = " << kmm <<endl;
580  for(int iii = 1; iii<4; iii++) {
581 // for (int jjj=1;jjj<=82;jjj++) {
582 // for (int kkk=1;kkk<=72;kkk++) {
583  for (int jjj=0;jjj<nx;jjj++) {
584  for (int kkk=0;kkk<ny;kkk++) {
585  normalization[iii][jjj][kkk] = mapRATIO[iii][jjj][kkk];
586  }//for
587  }//for
588  }//for
589  }// if(k1=firstrun
590 */
591  //--------------------------------------
592  // then, averaging over depthes, but first sum over depthes before!!! any dividing. Use mapRATIOD2[jjj][kkk] and mapRATIOD20[jjj][kkk]
594  int totalhep17count = 0;
595  int totalhep17count1 = 0;
596  int totalhep17count2 = 0;
597  int totalhep17count3 = 0;
598  int totalhep17count4 = 0;
599  int totalhep17count5 = 0;
600  int totalhep17count6 = 0;
601  int totalhep17count7 = 0;
602  for (int iii = 1; iii < NDEP; iii++) {
603  for (int jjj = 0; jjj < nx; jjj++) {
604  for (int kkk = 0; kkk < ny; kkk++) {
605  // for (int jjj=1;jjj<=82;jjj++) {
606  // for (int kkk=1;kkk<=72;kkk++) {
607  if (mapRATIO[iii][jjj][kkk] > 0) {
608  // calculate # channels in HBP17 for each depth:
609  totalhep17count++;
610  if (verbosity == 4 && k1 == 0) {
611  cout << " k1= " << k1 << " depth= " << iii << " eta= " << jjj << " phi= " << kkk
612  << " mapRATIO= " << mapRATIO[iii][jjj][kkk] << endl;
613  }
614  if (iii == 1)
615  totalhep17count1++;
616  if (iii == 2)
617  totalhep17count2++;
618  if (iii == 3)
619  totalhep17count3++;
620  if (iii == 4)
621  totalhep17count4++;
622  if (iii == 5)
623  totalhep17count5++;
624  if (iii == 6)
625  totalhep17count6++;
626  if (iii == 7)
627  totalhep17count7++;
628  // ---------------------------------------- sum over depthes before!!! any dividing:
629  mapRATIOD2[jjj][kkk] += mapRATIO[iii][jjj][kkk];
630  // count entries with digis only:
631  mapRATIOD20[jjj][kkk]++;
632  if (verbosity == 3 && iii == 3)
633  cout << " depth = " << iii << " k1 = " << k1 << " eta = " << jjj
634  << " mapRATIOD2[jjj][kkk] = " << mapRATIOD2[jjj][kkk] << " #entries = " << mapRATIOD20[jjj][kkk]
635  << " mapRATIO[iii][jjj][kkk] = " << mapRATIO[iii][jjj][kkk] << endl;
636  } // if mapRATIO[iii][jjj][kkk] != 0
637  } //for
638  } //for
639  } //for
640 
641  // ERROR printout !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
642  // if(totalhep17count != 184 ) {cout <<"!!!!!! ERROR:NOT ALL CHANNELS HBP17 INVOLEVED FOR RUN WITH k1= " << k1 <<" totalhep17count= " << totalhep17count <<endl;}
643 
644  if (verbosity == 4 && k1 == 0) {
645  cout << " k1= " << k1 << " totalhep17count= " << totalhep17count << endl;
646  cout << " k1= " << k1 << " totalhep17count1= " << totalhep17count1 << endl;
647  cout << " k1= " << k1 << " totalhep17count2= " << totalhep17count2 << endl;
648  cout << " k1= " << k1 << " totalhep17count3= " << totalhep17count3 << endl;
649  cout << " k1= " << k1 << " totalhep17count4= " << totalhep17count4 << endl;
650  cout << " k1= " << k1 << " totalhep17count5= " << totalhep17count5 << endl;
651  cout << " k1= " << k1 << " totalhep17count6= " << totalhep17count6 << endl;
652  cout << " k1= " << k1 << " totalhep17count7= " << totalhep17count7 << endl;
653  }
654 
657  Int_t depthAVERAGEcount = 0;
658  for (int jjj = 0; jjj < nx; jjj++) {
659  for (int kkk = 0; kkk < ny; kkk++) {
660  // for (int jjj=1;jjj<=82;jjj++) {
661  //for(int kkk=1;kkk<=72;kkk++) {
662  depthAVERAGEcount = 4 * (jjj - 57) + (kkk - 64);
663  if (mapRATIOD20[jjj][kkk] != 0) {
664  NotEmptyDepthes->Fill(float(depthAVERAGEcount));
665  if (verbosity == 1)
666  cout << "****aver per depthes********* phi = " << kkk << " RunIndex = " << k1 << " eta = " << jjj
667  << " #entries = " << mapRATIOD20[jjj][kkk] << endl;
668  mapRATIOD2[jjj][kkk] /= mapRATIOD20[jjj][kkk];
669  if (verbosity == 3 && kkk == 3)
670  cout << "****aver per depthes********* phi = " << jjj << " RunIndex = " << k1 << " eta = " << jjj
671  << " Nphi = " << mapRATIOD20[jjj][kkk] << endl;
672  } // if(mapRATIOD20 != 0
673  } //for kkk
674  } //for jjj
676  // define A for refRun : k1=[0]
678  if (k1 == firstrun && kmm == 0) {
679  kmm = 1; //Int_t mcount=0;
680  cout << "* to be printed once only CHBCK IT please ************ kmm = " << kmm << endl;
681  // for (int jjj=1;jjj<=82;jjj++) {
682  // for (int kkk=1;kkk<=72;kkk++) {
683  for (int jjj = 0; jjj < nx; jjj++) {
684  for (int kkk = 0; kkk < ny; kkk++) {
685  normalization[jjj][kkk] = mapRATIOD2[jjj][kkk];
686  } //for
687  } //for
688  } // if(k1=firstrun
689  //--------------------------------------
690  // cout << "!!!! 111111 " <<endl;
693  // int etaphicount = 0;
694  // for (int jjj=1;jjj<=82;jjj++) {
695  // for (int kkk=1;kkk<=72;kkk++) {
696  for (int jjj = 0; jjj < nx; jjj++) {
697  for (int kkk = 0; kkk < ny; kkk++) {
698  if (normalization[jjj][kkk] != 0) {
699  GSMRATIOD2[k1][jjj][kkk] = mapRATIOD2[jjj][kkk] / normalization[jjj][kkk];
700  // plotting:
701  if (GSMRATIOD2[k1][jjj][kkk] < RrangeMAX && GSMRATIOD2[k1][jjj][kkk] > RrangeMIN) {
702  gainkoeff->Fill(GSMRATIOD2[k1][jjj][kkk]);
703  gainkoeff0->Fill(GSMRATIOD2[k1][jjj][kkk]);
704  gainkoeff9->Fill(GSMRATIOD2[k1][jjj][kkk]);
705  // printout
706  // etaphicount++;
707  // if(etaphicount > 30 ) cout <<"etaphicount = " << etaphicount << "for k1= " << k1 <<endl;
708  // if(etaphicount == 30 ) cout <<"etaphicount == 30 for k1= " << k1 <<endl;
709  // cout <<" k1= " << k1 <<" eta= " << jjj <<" phi= " << kkk <<endl;
710  GOODruns->Fill(float(k1)); // fill #channels w/ R inside unit
711  } else {
712  if (GSMRATIOD2[k1][jjj][kkk] > 0.)
713  BADruns->Fill(float(k1));
714  } // fill #channels outside R unit
715  // else{if(GSMRATIOD2[k1][jjj][kkk]>0.) BADruns->Fill(float(k1));}
716 
717  } // if(normalization[jjj][kkk] != 0
718  } //for kkk
719  } //for jjj
720  // cout << "!!!! 222222 " <<endl;
721 
722  //
728  for (int jjj = 0; jjj <= 82; jjj++) {
729  for (int kkk = 0; kkk <= 72; kkk++) {
730  mapRATIOD2[jjj][kkk] = 0.;
731  mapRATIOD20[jjj][kkk] = 0.;
732  for (int iii = 0; iii < NDEP; iii++) {
733  mapRATIO[iii][jjj][kkk] = 0.;
734  }
735  } // for
736  } // for
737  // cout << "!!!! 333333 " <<endl;
738 
740  hfile->Close();
742 
743  // cout << "!!!! 444444 " <<endl;
744 
745  // }//if(k1==0 || (k1>37
747  } //for k1 loop over time points(LED runs)
748  cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DONE: last LED run READ " << endl;
749 
750  // c1->Clear();
751 
752  // ////////////////////////////////////////////////////////////////////////////////////////////////// END OF LOOP OVER LED RUNS
756 
762  cout << "**** **** **** **** **** Draw Dependencies: *** " << endl;
763 
765  Int_t Method = NMethodsStart;
766  while (Method < NMethodsToUse + 1) {
767  if (Method != 9999992) {
768  cout << " **** START Method " << Method << endl;
769  //======================================================================================================= PLOT0: <Aijk> for each event and all LED runs
770  if (Method == 0) {
771  cout << "****Draw 0 Dependencies: <Aijk> for each event and all LED runs *** " << endl;
772  gPad->SetGridy();
773  gPad->SetGridx();
774  gPad->SetLogy();
775  gStyle->SetOptStat(101110);
776  Ceff1D->SetMarkerStyle(20);
777  Ceff1D->SetMarkerSize(0.4);
778  Ceff1D->GetYaxis()->SetLabelSize(0.04);
779  Ceff1D->SetTitle("all runs & channels");
780  Ceff1D->SetXTitle("<Aijk>");
781  Ceff1D->SetYTitle("N");
782  Ceff1D->SetMarkerColor(4);
783  Ceff1D->SetLineColor(4);
784  // Ceff1D->Draw("Error");
785  Ceff1D->Draw("PL");
786  } //Method = 0
787  //======================================================================================================= PLOT1: <Aijk> for each event and all LED runs ZOOM
788  if (Method == 1) {
789  cout << "****Draw 1 Dependencies: <Aijk> for each event and all LED runs ZOOM *** " << endl;
790  gPad->SetGridy();
791  gPad->SetGridx();
792  gPad->SetLogy();
793  gStyle->SetOptStat(101110);
794  // Seff1D->SetTitle("any Error, HB Depth1 \n");
795  Seff1D->SetMarkerStyle(20);
796  Seff1D->SetMarkerSize(0.4);
797  Seff1D->GetYaxis()->SetLabelSize(0.04);
798  Seff1D->SetTitle("ZOOM all runs & channels");
799  Seff1D->SetXTitle("<Aijk> ZOOM ");
800  Seff1D->SetYTitle("N");
801  Seff1D->SetMarkerColor(4);
802  Seff1D->SetLineColor(4);
803  // Seff1D->Draw("Error");
804  Seff1D->Draw("PL");
805  } //Method = 1
806  // //////////////////////////////////////////////////////////////////////////
807  //======================================================================================================= PLOT2 GSM ratio vs days
808  if (Method == 2) {
809  cout << "****Draw 2 Dependencies: GSM ratio vs days *** " << endl;
810  for (int k1 = 0; k1 < NP; k1++) {
811  YY[k1] = 0.;
812  }
813  // c1->Range(0,0,25,18);
814  // c1->SetFillColor(0);
815  // c1->Clear();
816  TPad* pad1 = new TPad("pad1", "This is pad1", 0.02, 0.02, 0.99, 0.99, 0);
817  pad1->Draw();
818  pad1->cd();
819  pad1->Range(-0.255174, -19.25, 2.29657, -6.75);
820  // x1 y1 x2 y2
821  pad1->DrawFrame(x1, y1, x2, y2); // 1-A,
822  // pad1->DrawFrame(1, 0., 370, 2.0); // 1-A,
823  pad1->GetFrame()->SetFillColor(0);
824  pad1->Draw();
825  gPad->SetGridy();
826  gPad->SetGridx();
827  // - - - - - - - - - - - -
828  Int_t colorlines = 0;
829  Int_t generalcount = 0;
830  // for (int jjj=1;jjj<=82;jjj++) {
831  // for (int kkk=1;kkk<=72;kkk++) {
832  for (int jjj = 0; jjj < 82; jjj++) {
833  for (int kkk = 0; kkk < 72; kkk++) {
834  Int_t sscount = -1;
835  for (int k1 = 0; k1 < NP; k1++) {
836  if (GSMRATIOD2[k1][jjj][kkk] != 0) {
837  // if(GSMRATIOD2[k1][jjj][kkk]< 1.033 && GSMRATIOD2[k1][jjj][kkk] > 0.91 ) {
838  // if(GSMRATIOD2[k1][jjj][kkk]< 9. && GSMRATIOD2[k1][jjj][kkk] > 0. ) {
839  if (GSMRATIOD2[k1][jjj][kkk] < RrangeMAX && GSMRATIOD2[k1][jjj][kkk] > RrangeMIN) {
840  // if(GSMRATIOD2[k1][jjj][kkk]< 1.05 && GSMRATIOD2[k1][jjj][kkk] > 0.91 ) {
841  // if(GSMRATIOD2[k1][jjj][kkk]< 1.15 && GSMRATIOD2[k1][jjj][kkk] > 0.85 ) {
842  sscount++;
843  YY[sscount] = GSMRATIOD2[k1][jjj][kkk]; //
844  XXX[sscount] = XX[k1];
845  indWAS[sscount] = k1;
846  mapBADchannels->Fill(double(jjj) - 42., double(kkk) - 1., GSMRATIOD2[k1][jjj][kkk]);
847  mapBADchannels0->Fill(double(jjj) - 42., double(kkk) - 1., 1.);
848  } // GSMRATIOD2[k1][jjj][kkk] < 1.05
849  else {
850  // mapBADchannels->Fill(double(jjj)-42., double(kkk)-1., GSMRATIOD2[k1][jjj][kkk]);
851  }
852  } // GSMRATIOD2[k1][jjj][kkk] != 0
853  } //for k1
854  Int_t MMcount = sscount + 1;
855  if (MMcount > 0) {
856  generalcount++;
857  if (generalcount == 1 && verbosity == 2)
858  for (int k1 = 0; k1 < MMcount; k1++) {
859  cout << "**** All GOOD runs: indWAS[k1](1,..) = " << indWAS[k1] + 1 << " XXX[k1]+1 = " << XXX[k1] + 1
860  << endl;
861  }
862  gr1 = new TGraph(MMcount, XXX, YY);
863  colorlines = generalcount / 5. + 2;
864  gr1->SetLineColor(colorlines);
865  gr1->SetMarkerColor(colorlines);
866  gr1->SetMarkerStyle(20);
867  gr1->SetMarkerSize(1.2);
868  gr1->SetFillStyle(0);
869  gr1->GetXaxis()->SetTitle("days");
870  gr1->GetYaxis()->SetTitle("R");
871  gr1->Draw("PL");
872  } // if
873  // else {cout<<"****ERROR for PLOT2: MMcount is lower 1, MMcount = *** " << MMcount << endl;}
874  } //for kkk
875  } //for jjj
876 
877  // TLegend leg(.6,.67,.78,.88, " HBP Depth1");
878  // TLegend leg(xx1,yy1,xx2,yy2, "HBP17: R vs t");
879  TLegend leg(xx1, yy1, xx2, yy2, "HB: R vs t(days)");
880  // leg.AddEntry(gr1);
881  leg.SetMargin(0.3);
882  leg.SetBorderSize(1);
883  leg.DrawClone("Same");
884  /*
885  // Draw labels on the y axis
886  TText *t7 = new TText();
887  t7->SetTextAlign(32);
888  t7->SetTextSize(0.035);
889  t7->SetTextFont(72);
890  char *labels[NP+1] = {"31","1","7","7","8","9","12","13","19","22","22","24","24","24","24","24","24","Feb."};
891  float X7[NP];
892  for(int k1 = 0; k1<NP; k1++) {
893  // cout<<"**** XXX[k1] = " << XXX[k1] <<" YY[k1] = " << YY[k1] << endl;
894  t7->DrawText(0.2+XXX[k1],0.890,labels[k1]);
895  }
896  t7->DrawText(0.2+XXX[NP-1]+75.,0.890,labels[NP]);
897 */
898 
899  }
900  //
901 
902  //======================================================================================================= PLOT3: 2D channels
903  if (Method == 3) {
904  cout << "****Draw 3 Dependencies: 2D channels *** " << endl;
905  TH2F* Cdepth2hbff = (TH2F*)mapBADchannels->Clone("Cdepth2hbff");
906  Cdepth2hbff->Divide(mapBADchannels, mapBADchannels0, 1, 1, "B");
907  Cdepth2hbff->Sumw2();
908  gPad->SetGridy();
909  gPad->SetGridx();
910  gStyle->SetOptStat(0000000);
911  Cdepth2hbff->SetMarkerStyle(20);
912  Cdepth2hbff->SetMarkerSize(0.4);
913  Cdepth2hbff->GetYaxis()->SetLabelSize(0.04);
914  Cdepth2hbff->SetTitle("within R & Weighted by R");
915  Cdepth2hbff->SetXTitle("#eta \b");
916  Cdepth2hbff->SetYTitle("#phi \b");
917  Cdepth2hbff->SetMarkerColor(4);
918  Cdepth2hbff->SetLineColor(4);
919  Cdepth2hbff->Draw("COLZ");
920  } //Method = 3
921  //======================================================================================================= PLOT4:gains LED runs
922  if (Method == 4) {
923  cout << "****Draw 4 Dependencies: gains LED runs *** " << endl;
924  gPad->SetGridy();
925  gPad->SetGridx();
926  // gPad->SetLogy();
927  //gStyle->SetOptStat(1110000);
928  gStyle->SetOptStat(1100); // only mean & rms
929  //gStyle->SetOptStat(1111111);// only mean & rms
930  gainkoeff->SetMarkerStyle(20);
931  gainkoeff->SetMarkerSize(0.4);
932  gainkoeff->GetYaxis()->SetLabelSize(0.04);
933  gainkoeff->SetXTitle("gains");
934  gainkoeff->SetYTitle("N");
935  gainkoeff->SetMarkerColor(4);
936  gainkoeff->SetLineColor(4);
937  // gainkoeff->Draw("Error");
938  gainkoeff->Draw("PL");
939  } //Method = 4
940  //======================================================================================================= PLOT5:gains LED runs
941  if (Method == 5) {
942  cout << "****Draw 5 Dependencies: gains LED runs *** " << endl;
943  gPad->SetGridy();
944  gPad->SetGridx();
945  gPad->SetLogy();
946  //gStyle->SetOptStat(1110000);
947  gStyle->SetOptStat(1100); // only mean & rms
948  //gStyle->SetOptStat(1111111);// only mean & rms
949  gainkoeff9->SetMarkerStyle(20);
950  gainkoeff9->SetMarkerSize(0.4);
951  gainkoeff9->GetYaxis()->SetLabelSize(0.04);
952  gainkoeff9->SetXTitle("gains");
953  gainkoeff9->SetYTitle("N");
954  gainkoeff9->SetMarkerColor(4);
955  gainkoeff9->SetLineColor(4);
956  // gainkoeff9->Draw("Error");
957  gainkoeff9->Draw("PL");
958  } //Method = 5
959  //======================================================================================================= PLOT6:gains LED runs
960  if (Method == 6) {
961  cout << "****Draw 6 Dependencies: gains LED runs *** " << endl;
962  gPad->SetGridy();
963  gPad->SetGridx();
964  gPad->SetLogy();
965  //gStyle->SetOptStat(1110000);
966  gStyle->SetOptStat(1100); // only mean & rms
967  //gStyle->SetOptStat(1111111);// only mean & rms
968  gainkoeff0->SetMarkerStyle(20);
969  gainkoeff0->SetMarkerSize(0.4);
970  gainkoeff0->GetYaxis()->SetLabelSize(0.04);
971  gainkoeff0->SetXTitle("gains");
972  gainkoeff0->SetYTitle("N");
973  gainkoeff0->SetMarkerColor(4);
974  gainkoeff0->SetLineColor(4);
975  // gainkoeff0->Draw("Error");
976  gainkoeff0->Draw("PL");
977  } //Method = 6
978  //======================================================================================================= PLOT7: BADruns
979  if (Method == 7) {
980  cout << "****Draw 7 Dependencies: BADruns *** " << endl;
981  gPad->Update();
982  gPad->SetGridy();
983  gPad->SetGridx();
984  gPad->SetLogy(kFALSE);
985  gStyle->SetOptStat(101110);
986  BADruns->SetMarkerStyle(20);
987  BADruns->SetMarkerSize(0.4);
988  BADruns->GetYaxis()->SetLabelSize(0.04);
989  BADruns->SetTitle("#channels outside Rrange VS iRun");
990  BADruns->SetXTitle("iRun");
991  BADruns->SetYTitle("#channels");
992  BADruns->SetMarkerColor(4);
993  BADruns->SetLineColor(4);
994  // BADruns->Draw("Error");
995  BADruns->Draw("PL");
996  // PRINTOUT ONLY:
997  // if(verbosity == 4 ){
998  int cx = BADruns->GetXaxis()->GetNbins();
999  cout << "***** ************* Number of runs w/ R outside unit-range = " << cx << endl;
1000  int nbadruns = 0;
1001  for (int jjj = 1; jjj <= cx; jjj++) {
1002  if (BADruns->GetBinContent(jjj) > 200.) {
1003  cout << "BADruns w/ content>60: jjj= " << jjj << " run= " << LEDruns[jjj - 1]
1004  << " R ouside unit-range for # channels= " << BADruns->GetBinContent(jjj) << endl;
1005  ++nbadruns;
1006  }
1007  // 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;}
1008  } //jjj
1009  cout << "BADruns w/ content>60 nbadruns= " << nbadruns << endl;
1010  // }// if(verbosity == 2 )
1011  } //Method = 7
1012 
1013  //======================================================================================================= PLOT8: Goodruns
1014  if (Method == 8) {
1015  cout << "****Draw 8 Dependencies: Goodruns *** " << endl;
1016  gPad->SetGridy();
1017  gPad->SetGridx();
1018  // gPad->SetLogy();
1019  gStyle->SetOptStat(101110);
1020  GOODruns->SetMarkerStyle(20);
1021  GOODruns->SetMarkerSize(0.4);
1022  GOODruns->GetYaxis()->SetLabelSize(0.04);
1023  GOODruns->SetTitle("#channels inside Rrange VS iRun");
1024  GOODruns->SetXTitle("iRun");
1025  GOODruns->SetYTitle("#channels");
1026  GOODruns->SetMarkerColor(4);
1027  GOODruns->SetLineColor(4);
1028  // GOODruns->Draw("Error");
1029  GOODruns->Draw("PL");
1030  // PRINTOUT ONLY:
1031  // if(verbosity == 4 ){
1032  int cx = GOODruns->GetXaxis()->GetNbins();
1033  cout << "************* cx = " << cx << endl;
1034  for (int jjj = 0; jjj <= cx; jjj++) {
1035  // if( GOODruns->GetBinContent(jjj) >100.) cout<<"GOODruns: k1= " << jjj <<endl;
1036  // if( GOODruns->GetBinContent(jjj) >5.) cout<<"GOODruns: k1= " << jjj <<endl;
1037  if (GOODruns->GetBinContent(jjj) > 1400.)
1038  cout << "GOODruns: k1(0,...)= " << jjj
1039  << " GOODruns->GetBinContent(jjj)= " << GOODruns->GetBinContent(jjj) << endl;
1040  } //jjj
1041  // }// if(verbosity == 2 )
1042  } //Method = 8
1043 
1044  //======================================================================================================= PLOT9:depthes with zero A
1045  if (Method == 9) {
1046  cout << "****Draw 9 Dependencies: depthes with zero A *** " << endl;
1047  gPad->SetGridy();
1048  gPad->SetGridx();
1049  gPad->SetLogy(kFALSE);
1050  gStyle->SetOptStat(1110000);
1051  NotEmptyDepthes->SetMarkerStyle(20);
1052  NotEmptyDepthes->SetMarkerSize(0.4);
1053  NotEmptyDepthes->GetYaxis()->SetLabelSize(0.04);
1054  NotEmptyDepthes->SetTitle("# Not Empty Channels in etq-phi projection");
1055  NotEmptyDepthes->SetXTitle("4*(eta-57)+(phi-64)");
1056  NotEmptyDepthes->SetYTitle("N");
1057  NotEmptyDepthes->SetMarkerColor(4);
1058  NotEmptyDepthes->SetLineColor(4);
1059  // NotEmptyDepthes->Draw("Error");
1060  NotEmptyDepthes->Draw("PL");
1061  } //Method = 9
1062  //======================================================================================================= PLOT10: Aijk for each event and all LED runs
1063  if (Method == 10) {
1064  cout << "****Draw 10 Dependencies: Aijk for each event and all LED runs *** " << endl;
1065 
1066  c1->Clear();
1067  c1->Divide(1, 1);
1068 
1069  c1->cd(1);
1070  // TString epsName = fname + LEDruns[0] +".root";
1071  // TFile *hfile= new TFile(epsName, "READ");
1072  // TH1F * Aeff1D= (TH1F*)hfile->Get("h_ADCAmpl_HB");
1073 
1074  gPad->SetGridy();
1075  gPad->SetGridx();
1076  gPad->SetLogy();
1077  gStyle->SetOptStat(101110);
1078  // Aeff1D->SetStats(0);
1079  Aeff1D->SetMarkerStyle(20);
1080  Aeff1D->SetMarkerSize(0.4);
1081  Aeff1D->GetYaxis()->SetLabelSize(0.04);
1082  Aeff1D->SetTitle("all runs & events& channels");
1083  Aeff1D->SetXTitle("Aijk");
1084  Aeff1D->SetYTitle("N");
1085  Aeff1D->SetMarkerColor(4);
1086  Aeff1D->SetLineColor(4);
1087  // Aeff1D->Draw("Error");
1088  // Aeff1D->Draw("PL");
1089  Aeff1D->SetMinimum(0.8);
1090  Aeff1D->Draw("");
1091 
1092  c1->Update();
1093 
1094  } //Method = 10
1095  //======================================================================================================= PLOT11: 2D SiPM channels Depthes1,2,(3.4 for 20202)
1096  if (Method == 11) {
1097  cout << "****Draw 11 <A>: 2D Depthes1,2,3,4 *** " << endl;
1098  // gPad->SetGridy();
1099  // gPad->SetGridx();
1100  // gStyle->SetOptStat(0000000);
1101  c1->Clear();
1102  c1->Divide(1, 2);
1103 
1104  c1->cd(1);
1105  mapchannelsdepth1->SetStats(0);
1106  mapchannelsdepth1->SetTitle("<A> Depth1");
1107  mapchannelsdepth1->SetXTitle("#eta \b");
1108  mapchannelsdepth1->SetYTitle("#phi \b");
1109  mapchannelsdepth1->Draw("COLZ");
1110  c1->cd(2);
1111  mapchannelsdepth2->SetStats(0);
1112  mapchannelsdepth2->SetTitle("<A> Depth2");
1113  mapchannelsdepth2->SetXTitle("#eta \b");
1114  mapchannelsdepth2->SetYTitle("#phi \b");
1115  mapchannelsdepth2->Draw("COLZ");
1116  /*
1117  c1->cd(3);
1118  mapchannelsdepth3->SetStats(0);
1119  mapchannelsdepth3->SetTitle("<A> Depth3");
1120  mapchannelsdepth3->SetXTitle("#eta \b");
1121  mapchannelsdepth3->SetYTitle("#phi \b");
1122  mapchannelsdepth3->Draw("COLZ");
1123  c1->cd(4);
1124  mapchannelsdepth4->SetStats(0);
1125  mapchannelsdepth4->SetTitle("<A> Depth4");
1126  mapchannelsdepth4->SetXTitle("#eta \b");
1127  mapchannelsdepth4->SetYTitle("#phi \b");
1128  mapchannelsdepth4->Draw("COLZ");
1129 */
1130  c1->Update();
1131 
1132  } //Method = 11
1133  //======================================================================================================= PLOT12:
1134  if (Method == 12) {
1135  cout << "****Draw 12 not used yet *** " << endl;
1136  // gPad->SetGridy();
1137  // gPad->SetGridx();
1138  // gStyle->SetOptStat(0000000);
1139  c1->Clear();
1140  c1->Divide(2, 2);
1141 
1142  c1->cd(1);
1143  c1->cd(2);
1144  c1->cd(3);
1145 
1146  c1->Update();
1147 
1148  } //Method = 12
1149 
1150  //======================================================================================================= PLOT13: 2D
1151  if (Method == 13) {
1152  cout << "****Draw 13 function, fC *** " << endl;
1153  c1->Clear();
1154  c1->Divide(1, 1);
1155 
1156  c1->cd(1);
1157  {
1158  double c0 = 1.000000;
1159  double b1 = 2.71238e-05;
1160  double a2 = 1.32877e-10;
1161  Int_t n = 50;
1162  Double_t x[n], y[n];
1163  for (Int_t i = 0; i < n; i++) {
1164  x[i] = (i + 1) * 20000.;
1165  y[i] = a2 * x[i] * x[i] / 40. / 40. + b1 * x[i] / 40. + c0;
1166  }
1167 
1168  // create graph
1169  TGraph* gr = new TGraph(n, x, y);
1170 
1171  // draw the graph with axis, continuous line, and put
1172  // a * at each point
1173  gPad->SetGridy();
1174  gPad->SetGridx();
1175  // gPad->SetLogy();
1176  gr->Draw("AC*");
1177  /*
1178  gr1 = new TGraph(MMcount,XXX,YY);
1179  colorlines = generalcount/5.+2;
1180  gr1->SetLineColor(colorlines); gr1->SetMarkerColor(colorlines);
1181  gr1->SetMarkerStyle(20); gr1->SetMarkerSize(1.2); gr1->SetFillStyle(0); gr1->Draw("PL");
1182  */
1183  }
1184 
1185  c1->Update();
1186 
1187  } //Method = 13
1188 
1189  // //////////////////////////////////////////////////////////////////////////
1190 
1191  //=======================================================================================================
1192  //======================================================================================================= finish loop over Methods
1193  //=======================================================================================================
1194  TString fdir = "testamt5gsmHB2018/";
1195  //
1196  TString plotName = fdir + MethodName[Method] + ".png";
1197  c1->SaveAs(plotName);
1198  cout << "****PLOT " << Method << " drawn **** " << endl;
1199 
1200  } //if( Method != 9
1201  ++Method;
1202  } //while loop over Methods
1203  //=======================================================================================================
1204  //=======================================================================================================
1205  //=======================================================================================================
1206  //=======================================================================================================
1207  //=======================================================================================================
1208  //=======================================================================================================
1209  //=======================================================================================================
1210  //=======================================================================================================
1211  //=======================================================================================================
1212  //______________________________________________________________________________
1213  //______________________________________________________________________________
1214  //
1215  //______________________________________________________________________________
1216  //______________________________________________________________________________
1217  //
1218  gSystem->Exit(0);
1219  //______________________________________________________________________________
1220 }
const int verbosity
string fname
main script
float x
static constexpr float b1