CMS 3D CMS Logo

zamt5GSMHO.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include "TH1.h"
4 #include "TH2.h"
5 #include "TH1F.h"
6 #include "TH2F.h"
7 #include "TCanvas.h"
8 #include "TROOT.h"
9 #include <TMath.h>
10 #include "TStyle.h"
11 #include "TSystem.h"
12 #include "TLegend.h"
13 #include "TText.h"
14 #include "TAxis.h"
15 #include "TFile.h"
16 #include "TLine.h"
17 #include "TGraph.h"
18 #include <TPaveText.h>
19 #include <TPostScript.h>
20 #include <TClass.h>
21 #include <TLatex.h>
22 #include <TFrame.h>
23 #include <TPad.h>
24 #include <TGaxis.h>
25 
26 #include "TGraphErrors.h"
27 #include "TF1.h"
28 #include "TArrow.h"
29 
30 //
31 using namespace std;
32 //
33 //
34 int main(int argc, char* argv[]) {
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 HOP17
114  Int_t verbosity = 0; //
115  // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
116 
117  // const Int_t flagHOP17selection = 2;// -> ALL channels w/o bad
118  // const Int_t flagHOP17selection = 1;// ==1 HOP17;
119  const Int_t flagHOP17selection = 0; // -> ALL channels
120 
121  cout << "************************************** flagHOP17selection = " << flagHOP17selection << 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 HO 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 = 5;
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 HO 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_HO");
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 = "testamt5gsmHO2018/";
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 = "testamt5gsmHO2018/";
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_HO");
460  TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12_HO");
461  TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12_HO");
462 */
463  // HOP17 of 2017:
464  // TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl12SiPM_HO");
465  // TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12SiPM_HO");
466  // TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12SiPM_HO");
467  // all:
468 
469  // TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl12_HO");
470  // TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl12_HO");
471  // TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl12_HO");
472 
473  TH2F* twod4 = (TH2F*)hfile->Get("h_mapDepth4ADCAmpl12_HO");
474 
475  // all TS bins:
476  // TH2F *twod1= (TH2F*)hfile->Get("h_mapDepth1ADCAmpl_HO");
477  // TH2F *twod2= (TH2F*)hfile->Get("h_mapDepth2ADCAmpl_HO");
478  // TH2F *twod3= (TH2F*)hfile->Get("h_mapDepth3ADCAmpl_HO");
479 
480  // TH2F *twod4= (TH2F*)hfile->Get("h_mapDepth4ADCAmpl_HO");
481 
482  int nx = twod4->GetXaxis()->GetNbins();
483  int ny = twod4->GetYaxis()->GetNbins();
484  // cout <<"BEGINNING k1= " << k1 <<" nx= " << nx <<" ny= " << ny <<endl;
485 
486  // TH2F *t0010= (TH2F*)hfile->Get("h_mapDepth1_HO");
487  // TH2F *t0020= (TH2F*)hfile->Get("h_mapDepth2_HO");
488  // TH2F *t0030= (TH2F*)hfile->Get("h_mapDepth3_HO");
489  TH2F* t0040 = (TH2F*)hfile->Get("h_mapDepth4_HO");
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  // HOP17 selection:
506  if (flagHOP17selection == 0 ||
507  (flagHOP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
508  ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
509  (flagHOP17selection == 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. ) mapchannelsdepth1->Fill( double(jjj)-41., double(kkk), Ceff1->GetBinContent(jjj,kkk) );
513  // if(Ceff2->GetBinContent(jjj,kkk) >0. ) mapchannelsdepth2->Fill( double(jjj)-41., double(kkk), Ceff2->GetBinContent(jjj,kkk) );
514  // if(Ceff3->GetBinContent(jjj,kkk) >0. ) mapchannelsdepth3->Fill( double(jjj)-41., double(kkk), Ceff3->GetBinContent(jjj,kkk) );
515  if (Ceff4->GetBinContent(jjj, kkk) > 0.)
516  mapchannelsdepth4->Fill(double(jjj) - 41., double(kkk), Ceff4->GetBinContent(jjj, kkk));
517  } // if HOP17 selection
518  } // for
519  } // for
521  // }
522 
523  //
524  //
525  // fill:
526  // fill massive <Aijk>_runevents , where iii=depth, jjj=eta, kkk=phi
527  for (int jjj = 0; jjj < nx; jjj++) {
528  for (int kkk = 0; kkk < ny; kkk++) {
529  //
530  // HOP17 selection:
531  if (flagHOP17selection == 0 ||
532  (flagHOP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
533  ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
534  (flagHOP17selection == 2 && !(((jjj > 14 && jjj < 25) && (kkk > 55 && kkk < 64))))) {
535  // FILL NEW PLOTS:
536  // Aijk: Ceff1D & Seff1D plots
537  // if(Ceff1->GetBinContent(jjj,kkk)!= 0.) {Ceff1D->Fill(Ceff1->GetBinContent(jjj,kkk));Seff1D->Fill(Ceff1->GetBinContent(jjj,kkk));}
538  // if(Ceff2->GetBinContent(jjj,kkk)!= 0.) {Ceff1D->Fill(Ceff2->GetBinContent(jjj,kkk));Seff1D->Fill(Ceff2->GetBinContent(jjj,kkk));}
539  // if(Ceff3->GetBinContent(jjj,kkk)!= 0.) {Ceff1D->Fill(Ceff3->GetBinContent(jjj,kkk));Seff1D->Fill(Ceff3->GetBinContent(jjj,kkk));}
540  if (Ceff4->GetBinContent(jjj, kkk) != 0.) {
541  Ceff1D->Fill(Ceff4->GetBinContent(jjj, kkk));
542  Seff1D->Fill(Ceff4->GetBinContent(jjj, kkk));
543  }
544  } //if
545  }
546  }
547 
548  //--------------------------------------
549  // take into account for future treatment only HOP17 channels and cuts on <Aijk>_runevents within cutMinA to cutMaxA:
550  // apply cut on <Aijk>_runevents
551  // -41 +41
552  // 82 bins
553  for (int jjj = 0; jjj < nx; jjj++) {
554  for (int kkk = 0; kkk < ny; kkk++) {
555  // HOP17 selection:
556  if (flagHOP17selection == 0 ||
557  (flagHOP17selection == 1 && (((jjj > 56 && jjj < 62) && (kkk > 63 && kkk < 68)) ||
558  ((jjj > 61 && jjj < 71) && (kkk == 64 || kkk == 66)))) ||
559  (flagHOP17selection == 2 && !(((jjj > 14 && jjj < 25) && (kkk > 55 && kkk < 64))))) {
560  // if(Ceff1->GetBinContent(jjj,kkk)> cutMinA && Ceff1->GetBinContent(jjj,kkk)< cutMaxA) mapRATIO[1][jjj][kkk] = Ceff1->GetBinContent(jjj,kkk);
561  // if(Ceff2->GetBinContent(jjj,kkk)> cutMinA && Ceff2->GetBinContent(jjj,kkk)< cutMaxA) mapRATIO[2][jjj][kkk] = Ceff2->GetBinContent(jjj,kkk);
562  // if(Ceff3->GetBinContent(jjj,kkk)> cutMinA && Ceff3->GetBinContent(jjj,kkk)< cutMaxA) mapRATIO[3][jjj][kkk] = Ceff3->GetBinContent(jjj,kkk);
563  if (Ceff4->GetBinContent(jjj, kkk) > cutMinA && Ceff4->GetBinContent(jjj, kkk) < cutMaxA)
564  mapRATIO[4][jjj][kkk] = Ceff4->GetBinContent(jjj, kkk);
565  } //if
566  } // for
567  } // for
569  /*
570  // define A for refRun : k1=[0]
572  if(k1==firstrun && kmm==0 ) {
573  kmm=1; //Int_t mcount=0;
574  cout<<"* to be printed once only CHOCK IT please ************ kmm = " << kmm <<endl;
575  for(int iii = 1; iii<4; iii++) {
576 // for (int jjj=1;jjj<=82;jjj++) {
577 // for (int kkk=1;kkk<=72;kkk++) {
578  for (int jjj=0;jjj<nx;jjj++) {
579  for (int kkk=0;kkk<ny;kkk++) {
580  normalization[iii][jjj][kkk] = mapRATIO[iii][jjj][kkk];
581  }//for
582  }//for
583  }//for
584  }// if(k1=firstrun
585 */
586  //--------------------------------------
587  // then, averaging over depthes, but first sum over depthes before!!! any dividing. Use mapRATIOD2[jjj][kkk] and mapRATIOD20[jjj][kkk]
589  int totalhep17count = 0;
590  int totalhep17count1 = 0;
591  int totalhep17count2 = 0;
592  int totalhep17count3 = 0;
593  int totalhep17count4 = 0;
594  int totalhep17count5 = 0;
595  int totalhep17count6 = 0;
596  int totalhep17count7 = 0;
597  for (int iii = 1; iii < NDEP; iii++) {
598  for (int jjj = 0; jjj < nx; jjj++) {
599  for (int kkk = 0; kkk < ny; kkk++) {
600  // for (int jjj=1;jjj<=82;jjj++) {
601  // for (int kkk=1;kkk<=72;kkk++) {
602  if (mapRATIO[iii][jjj][kkk] > 0) {
603  // calculate # channels in HOP17 for each depth:
604  totalhep17count++;
605  if (verbosity == 4 && k1 == 0) {
606  cout << " k1= " << k1 << " depth= " << iii << " eta= " << jjj << " phi= " << kkk
607  << " mapRATIO= " << mapRATIO[iii][jjj][kkk] << endl;
608  }
609  if (iii == 1)
610  totalhep17count1++;
611  if (iii == 2)
612  totalhep17count2++;
613  if (iii == 3)
614  totalhep17count3++;
615  if (iii == 4)
616  totalhep17count4++;
617  if (iii == 5)
618  totalhep17count5++;
619  if (iii == 6)
620  totalhep17count6++;
621  if (iii == 7)
622  totalhep17count7++;
623  // ---------------------------------------- sum over depthes before!!! any dividing:
624  mapRATIOD2[jjj][kkk] += mapRATIO[iii][jjj][kkk];
625  // count entries with digis only:
626  mapRATIOD20[jjj][kkk]++;
627  if (verbosity == 3 && iii == 3)
628  cout << " depth = " << iii << " k1 = " << k1 << " eta = " << jjj
629  << " mapRATIOD2[jjj][kkk] = " << mapRATIOD2[jjj][kkk] << " #entries = " << mapRATIOD20[jjj][kkk]
630  << " mapRATIO[iii][jjj][kkk] = " << mapRATIO[iii][jjj][kkk] << endl;
631  } // if mapRATIO[iii][jjj][kkk] != 0
632  } //for
633  } //for
634  } //for
635 
636  // ERROR printout !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
637  // if(totalhep17count != 184 ) {cout <<"!!!!!! ERROR:NOT ALL CHANNELS HOP17 INVOLEVED FOR RUN WITH k1= " << k1 <<" totalhep17count= " << totalhep17count <<endl;}
638 
639  if (verbosity == 4 && k1 == 0) {
640  cout << " k1= " << k1 << " totalhep17count= " << totalhep17count << endl;
641  cout << " k1= " << k1 << " totalhep17count1= " << totalhep17count1 << endl;
642  cout << " k1= " << k1 << " totalhep17count2= " << totalhep17count2 << endl;
643  cout << " k1= " << k1 << " totalhep17count3= " << totalhep17count3 << endl;
644  cout << " k1= " << k1 << " totalhep17count4= " << totalhep17count4 << endl;
645  cout << " k1= " << k1 << " totalhep17count5= " << totalhep17count5 << endl;
646  cout << " k1= " << k1 << " totalhep17count6= " << totalhep17count6 << endl;
647  cout << " k1= " << k1 << " totalhep17count7= " << totalhep17count7 << endl;
648  }
649 
652  Int_t depthAVERAGEcount = 0;
653  for (int jjj = 0; jjj < nx; jjj++) {
654  for (int kkk = 0; kkk < ny; kkk++) {
655  // for (int jjj=1;jjj<=82;jjj++) {
656  //for(int kkk=1;kkk<=72;kkk++) {
657  depthAVERAGEcount = 4 * (jjj - 57) + (kkk - 64);
658  if (mapRATIOD20[jjj][kkk] != 0) {
659  NotEmptyDepthes->Fill(float(depthAVERAGEcount));
660  if (verbosity == 1)
661  cout << "****aver per depthes********* phi = " << kkk << " RunIndex = " << k1 << " eta = " << jjj
662  << " #entries = " << mapRATIOD20[jjj][kkk] << endl;
663  mapRATIOD2[jjj][kkk] /= mapRATIOD20[jjj][kkk];
664  if (verbosity == 3 && kkk == 3)
665  cout << "****aver per depthes********* phi = " << jjj << " RunIndex = " << k1 << " eta = " << jjj
666  << " Nphi = " << mapRATIOD20[jjj][kkk] << endl;
667  } // if(mapRATIOD20 != 0
668  } //for kkk
669  } //for jjj
671  // define A for refRun : k1=[0]
673  if (k1 == firstrun && kmm == 0) {
674  kmm = 1; //Int_t mcount=0;
675  cout << "* to be printed once only CHOCK IT please ************ kmm = " << kmm << endl;
676  // for (int jjj=1;jjj<=82;jjj++) {
677  // for (int kkk=1;kkk<=72;kkk++) {
678  for (int jjj = 0; jjj < nx; jjj++) {
679  for (int kkk = 0; kkk < ny; kkk++) {
680  normalization[jjj][kkk] = mapRATIOD2[jjj][kkk];
681  } //for
682  } //for
683  } // if(k1=firstrun
684  //--------------------------------------
685  // cout << "!!!! 111111 " <<endl;
688  // int etaphicount = 0;
689  // for (int jjj=1;jjj<=82;jjj++) {
690  // for (int kkk=1;kkk<=72;kkk++) {
691  for (int jjj = 0; jjj < nx; jjj++) {
692  for (int kkk = 0; kkk < ny; kkk++) {
693  if (normalization[jjj][kkk] != 0) {
694  GSMRATIOD2[k1][jjj][kkk] = mapRATIOD2[jjj][kkk] / normalization[jjj][kkk];
695  // plotting:
696  if (GSMRATIOD2[k1][jjj][kkk] < RrangeMAX && GSMRATIOD2[k1][jjj][kkk] > RrangeMIN) {
697  gainkoeff->Fill(GSMRATIOD2[k1][jjj][kkk]);
698  gainkoeff0->Fill(GSMRATIOD2[k1][jjj][kkk]);
699  gainkoeff9->Fill(GSMRATIOD2[k1][jjj][kkk]);
700  // printout
701  // etaphicount++;
702  // if(etaphicount > 30 ) cout <<"etaphicount = " << etaphicount << "for k1= " << k1 <<endl;
703  // if(etaphicount == 30 ) cout <<"etaphicount == 30 for k1= " << k1 <<endl;
704  // cout <<" k1= " << k1 <<" eta= " << jjj <<" phi= " << kkk <<endl;
705  GOODruns->Fill(float(k1)); // fill #channels w/ R inside unit
706  } else {
707  if (GSMRATIOD2[k1][jjj][kkk] > 0.)
708  BADruns->Fill(float(k1));
709  } // fill #channels outside R unit
710  // else{if(GSMRATIOD2[k1][jjj][kkk]>0.) BADruns->Fill(float(k1));}
711 
712  } // if(normalization[jjj][kkk] != 0
713  } //for kkk
714  } //for jjj
715  // cout << "!!!! 222222 " <<endl;
716 
717  //
723  for (int jjj = 0; jjj <= 82; jjj++) {
724  for (int kkk = 0; kkk <= 72; kkk++) {
725  mapRATIOD2[jjj][kkk] = 0.;
726  mapRATIOD20[jjj][kkk] = 0.;
727  for (int iii = 0; iii < NDEP; iii++) {
728  mapRATIO[iii][jjj][kkk] = 0.;
729  }
730  } // for
731  } // for
732  // cout << "!!!! 333333 " <<endl;
733 
735  hfile->Close();
737 
738  // cout << "!!!! 444444 " <<endl;
739 
740  // }//if(k1==0 || (k1>37
742  } //for k1 loop over time points(LED runs)
743  cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DONE: last LED run READ " << endl;
744 
745  // c1->Clear();
746 
747  // ////////////////////////////////////////////////////////////////////////////////////////////////// END OF LOOP OVER LED RUNS
751 
757  cout << "**** **** **** **** **** Draw Dependencies: *** " << endl;
758 
760  Int_t Method = NMethodsStart;
761  while (Method < NMethodsToUse + 1) {
762  if (Method != 9999992) {
763  cout << " **** START Method " << Method << endl;
764  //======================================================================================================= PLOT0: <Aijk> for each event and all LED runs
765  if (Method == 0) {
766  cout << "****Draw 0 Dependencies: <Aijk> for each event and all LED runs *** " << endl;
767  gPad->SetGridy();
768  gPad->SetGridx();
769  gPad->SetLogy();
770  gStyle->SetOptStat(101110);
771  Ceff1D->SetMarkerStyle(20);
772  Ceff1D->SetMarkerSize(0.4);
773  Ceff1D->GetYaxis()->SetLabelSize(0.04);
774  Ceff1D->SetTitle("all runs & channels");
775  Ceff1D->SetXTitle("<Aijk>");
776  Ceff1D->SetYTitle("N");
777  Ceff1D->SetMarkerColor(4);
778  Ceff1D->SetLineColor(4);
779  // Ceff1D->Draw("Error");
780  Ceff1D->Draw("PL");
781  } //Method = 0
782  //======================================================================================================= PLOT1: <Aijk> for each event and all LED runs ZOOM
783  if (Method == 1) {
784  cout << "****Draw 1 Dependencies: <Aijk> for each event and all LED runs ZOOM *** " << endl;
785  gPad->SetGridy();
786  gPad->SetGridx();
787  gPad->SetLogy();
788  gStyle->SetOptStat(101110);
789  // Seff1D->SetTitle("any Error, HO Depth1 \n");
790  Seff1D->SetMarkerStyle(20);
791  Seff1D->SetMarkerSize(0.4);
792  Seff1D->GetYaxis()->SetLabelSize(0.04);
793  Seff1D->SetTitle("ZOOM all runs & channels");
794  Seff1D->SetXTitle("<Aijk> ZOOM ");
795  Seff1D->SetYTitle("N");
796  Seff1D->SetMarkerColor(4);
797  Seff1D->SetLineColor(4);
798  // Seff1D->Draw("Error");
799  Seff1D->Draw("PL");
800  } //Method = 1
801  // //////////////////////////////////////////////////////////////////////////
802  //======================================================================================================= PLOT2 GSM ratio vs days
803  if (Method == 2) {
804  cout << "****Draw 2 Dependencies: GSM ratio vs days *** " << endl;
805  for (int k1 = 0; k1 < NP; k1++) {
806  YY[k1] = 0.;
807  }
808  // c1->Range(0,0,25,18);
809  // c1->SetFillColor(0);
810  // c1->Clear();
811  TPad* pad1 = new TPad("pad1", "This is pad1", 0.02, 0.02, 0.99, 0.99, 0);
812  pad1->Draw();
813  pad1->cd();
814  pad1->Range(-0.255174, -19.25, 2.29657, -6.75);
815  // x1 y1 x2 y2
816  pad1->DrawFrame(x1, y1, x2, y2); // 1-A,
817  // pad1->DrawFrame(1, 0., 370, 2.0); // 1-A,
818  pad1->GetFrame()->SetFillColor(0);
819  pad1->Draw();
820  gPad->SetGridy();
821  gPad->SetGridx();
822  // - - - - - - - - - - - -
823  Int_t colorlines = 0;
824  Int_t generalcount = 0;
825  // for (int jjj=1;jjj<=82;jjj++) {
826  // for (int kkk=1;kkk<=72;kkk++) {
827  for (int jjj = 0; jjj < 82; jjj++) {
828  for (int kkk = 0; kkk < 72; kkk++) {
829  Int_t sscount = -1;
830  for (int k1 = 0; k1 < NP; k1++) {
831  if (GSMRATIOD2[k1][jjj][kkk] != 0) {
832  // if(GSMRATIOD2[k1][jjj][kkk]< 1.033 && GSMRATIOD2[k1][jjj][kkk] > 0.91 ) {
833  // if(GSMRATIOD2[k1][jjj][kkk]< 9. && GSMRATIOD2[k1][jjj][kkk] > 0. ) {
834  if (GSMRATIOD2[k1][jjj][kkk] < RrangeMAX && GSMRATIOD2[k1][jjj][kkk] > RrangeMIN) {
835  // if(GSMRATIOD2[k1][jjj][kkk]< 1.05 && GSMRATIOD2[k1][jjj][kkk] > 0.91 ) {
836  // if(GSMRATIOD2[k1][jjj][kkk]< 1.15 && GSMRATIOD2[k1][jjj][kkk] > 0.85 ) {
837  sscount++;
838  YY[sscount] = GSMRATIOD2[k1][jjj][kkk]; //
839  XXX[sscount] = XX[k1];
840  indWAS[sscount] = k1;
841  mapBADchannels->Fill(double(jjj) - 42., double(kkk) - 1., GSMRATIOD2[k1][jjj][kkk]);
842  mapBADchannels0->Fill(double(jjj) - 42., double(kkk) - 1., 1.);
843  } // GSMRATIOD2[k1][jjj][kkk] < 1.05
844  else {
845  // mapBADchannels->Fill(double(jjj)-42., double(kkk)-1., GSMRATIOD2[k1][jjj][kkk]);
846  }
847  } // GSMRATIOD2[k1][jjj][kkk] != 0
848  } //for k1
849  Int_t MMcount = sscount + 1;
850  if (MMcount > 0) {
851  generalcount++;
852  if (generalcount == 1 && verbosity == 2)
853  for (int k1 = 0; k1 < MMcount; k1++) {
854  cout << "**** All GOOD runs: indWAS[k1](1,..) = " << indWAS[k1] + 1 << " XXX[k1]+1 = " << XXX[k1] + 1
855  << endl;
856  }
857  gr1 = new TGraph(MMcount, XXX, YY);
858  colorlines = generalcount / 5. + 2;
859  gr1->SetLineColor(colorlines);
860  gr1->SetMarkerColor(colorlines);
861  gr1->SetMarkerStyle(20);
862  gr1->SetMarkerSize(1.2);
863  gr1->SetFillStyle(0);
864  gr1->GetXaxis()->SetTitle("days");
865  gr1->GetYaxis()->SetTitle("R");
866  gr1->Draw("PL");
867  } // if
868  // else {cout<<"****ERROR for PLOT2: MMcount is lower 1, MMcount = *** " << MMcount << endl;}
869  } //for kkk
870  } //for jjj
871 
872  // TLegend leg(.6,.67,.78,.88, " HOP Depth1");
873  // TLegend leg(xx1,yy1,xx2,yy2, "HOP17: R vs t");
874  TLegend leg(xx1, yy1, xx2, yy2, "HO: R vs t(days)");
875  // leg.AddEntry(gr1);
876  leg.SetMargin(0.3);
877  leg.SetBorderSize(1);
878  leg.DrawClone("Same");
879  /*
880  // Draw labels on the y axis
881  TText *t7 = new TText();
882  t7->SetTextAlign(32);
883  t7->SetTextSize(0.035);
884  t7->SetTextFont(72);
885  char *labels[NP+1] = {"31","1","7","7","8","9","12","13","19","22","22","24","24","24","24","24","24","Feb."};
886  float X7[NP];
887  for(int k1 = 0; k1<NP; k1++) {
888  // cout<<"**** XXX[k1] = " << XXX[k1] <<" YY[k1] = " << YY[k1] << endl;
889  t7->DrawText(0.2+XXX[k1],0.890,labels[k1]);
890  }
891  t7->DrawText(0.2+XXX[NP-1]+75.,0.890,labels[NP]);
892 */
893 
894  }
895  //
896 
897  //======================================================================================================= PLOT3: 2D channels
898  if (Method == 3) {
899  cout << "****Draw 3 Dependencies: 2D channels *** " << endl;
900  TH2F* Cdepth2hbff = (TH2F*)mapBADchannels->Clone("Cdepth2hbff");
901  Cdepth2hbff->Divide(mapBADchannels, mapBADchannels0, 1, 1, "B");
902  Cdepth2hbff->Sumw2();
903  gPad->SetGridy();
904  gPad->SetGridx();
905  gStyle->SetOptStat(0000000);
906  Cdepth2hbff->SetMarkerStyle(20);
907  Cdepth2hbff->SetMarkerSize(0.4);
908  Cdepth2hbff->GetYaxis()->SetLabelSize(0.04);
909  Cdepth2hbff->SetTitle("within R & Weighted by R");
910  Cdepth2hbff->SetXTitle("#eta \b");
911  Cdepth2hbff->SetYTitle("#phi \b");
912  Cdepth2hbff->SetMarkerColor(4);
913  Cdepth2hbff->SetLineColor(4);
914  Cdepth2hbff->Draw("COLZ");
915  } //Method = 3
916  //======================================================================================================= PLOT4:gains LED runs
917  if (Method == 4) {
918  cout << "****Draw 4 Dependencies: gains LED runs *** " << endl;
919  gPad->SetGridy();
920  gPad->SetGridx();
921  // gPad->SetLogy();
922  //gStyle->SetOptStat(1110000);
923  gStyle->SetOptStat(1100); // only mean & rms
924  //gStyle->SetOptStat(1111111);// only mean & rms
925  gainkoeff->SetMarkerStyle(20);
926  gainkoeff->SetMarkerSize(0.4);
927  gainkoeff->GetYaxis()->SetLabelSize(0.04);
928  gainkoeff->SetXTitle("gains");
929  gainkoeff->SetYTitle("N");
930  gainkoeff->SetMarkerColor(4);
931  gainkoeff->SetLineColor(4);
932  // gainkoeff->Draw("Error");
933  gainkoeff->Draw("PL");
934  } //Method = 4
935  //======================================================================================================= PLOT5:gains LED runs
936  if (Method == 5) {
937  cout << "****Draw 5 Dependencies: gains LED runs *** " << endl;
938  gPad->SetGridy();
939  gPad->SetGridx();
940  gPad->SetLogy();
941  //gStyle->SetOptStat(1110000);
942  gStyle->SetOptStat(1100); // only mean & rms
943  //gStyle->SetOptStat(1111111);// only mean & rms
944  gainkoeff9->SetMarkerStyle(20);
945  gainkoeff9->SetMarkerSize(0.4);
946  gainkoeff9->GetYaxis()->SetLabelSize(0.04);
947  gainkoeff9->SetXTitle("gains");
948  gainkoeff9->SetYTitle("N");
949  gainkoeff9->SetMarkerColor(4);
950  gainkoeff9->SetLineColor(4);
951  // gainkoeff9->Draw("Error");
952  gainkoeff9->Draw("PL");
953  } //Method = 5
954  //======================================================================================================= PLOT6:gains LED runs
955  if (Method == 6) {
956  cout << "****Draw 6 Dependencies: gains LED runs *** " << endl;
957  gPad->SetGridy();
958  gPad->SetGridx();
959  gPad->SetLogy();
960  //gStyle->SetOptStat(1110000);
961  gStyle->SetOptStat(1100); // only mean & rms
962  //gStyle->SetOptStat(1111111);// only mean & rms
963  gainkoeff0->SetMarkerStyle(20);
964  gainkoeff0->SetMarkerSize(0.4);
965  gainkoeff0->GetYaxis()->SetLabelSize(0.04);
966  gainkoeff0->SetXTitle("gains");
967  gainkoeff0->SetYTitle("N");
968  gainkoeff0->SetMarkerColor(4);
969  gainkoeff0->SetLineColor(4);
970  // gainkoeff0->Draw("Error");
971  gainkoeff0->Draw("PL");
972  } //Method = 6
973  //======================================================================================================= PLOT7: BADruns
974  if (Method == 7) {
975  cout << "****Draw 7 Dependencies: BADruns *** " << endl;
976  gPad->Update();
977  gPad->SetGridy();
978  gPad->SetGridx();
979  gPad->SetLogy(kFALSE);
980  gStyle->SetOptStat(101110);
981  BADruns->SetMarkerStyle(20);
982  BADruns->SetMarkerSize(0.4);
983  BADruns->GetYaxis()->SetLabelSize(0.04);
984  BADruns->SetTitle("#channels outside Rrange VS iRun");
985  BADruns->SetXTitle("iRun");
986  BADruns->SetYTitle("#channels");
987  BADruns->SetMarkerColor(4);
988  BADruns->SetLineColor(4);
989  // BADruns->Draw("Error");
990  BADruns->Draw("PL");
991  // PRINTOUT ONLY:
992  // if(verbosity == 4 ){
993  int cx = BADruns->GetXaxis()->GetNbins();
994  cout << "***** ************* Number of runs w/ R outside unit-range = " << cx << endl;
995  int nbadruns = 0;
996  for (int jjj = 1; jjj <= cx; jjj++) {
997  if (BADruns->GetBinContent(jjj) > 200.) {
998  cout << "BADruns w/ content>60: jjj= " << jjj << " run= " << LEDruns[jjj - 1]
999  << " R ouside unit-range for # channels= " << BADruns->GetBinContent(jjj) << endl;
1000  ++nbadruns;
1001  }
1002  // 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;}
1003  } //jjj
1004  cout << "BADruns w/ content>60 nbadruns= " << nbadruns << endl;
1005  // }// if(verbosity == 2 )
1006  } //Method = 7
1007 
1008  //======================================================================================================= PLOT8: Goodruns
1009  if (Method == 8) {
1010  cout << "****Draw 8 Dependencies: Goodruns *** " << endl;
1011  gPad->SetGridy();
1012  gPad->SetGridx();
1013  // gPad->SetLogy();
1014  gStyle->SetOptStat(101110);
1015  GOODruns->SetMarkerStyle(20);
1016  GOODruns->SetMarkerSize(0.4);
1017  GOODruns->GetYaxis()->SetLabelSize(0.04);
1018  GOODruns->SetTitle("#channels inside Rrange VS iRun");
1019  GOODruns->SetXTitle("iRun");
1020  GOODruns->SetYTitle("#channels");
1021  GOODruns->SetMarkerColor(4);
1022  GOODruns->SetLineColor(4);
1023  // GOODruns->Draw("Error");
1024  GOODruns->Draw("PL");
1025  // PRINTOUT ONLY:
1026  // if(verbosity == 4 ){
1027  int cx = GOODruns->GetXaxis()->GetNbins();
1028  cout << "************* cx = " << cx << endl;
1029  for (int jjj = 0; jjj <= cx; jjj++) {
1030  // if( GOODruns->GetBinContent(jjj) >100.) cout<<"GOODruns: k1= " << jjj <<endl;
1031  // if( GOODruns->GetBinContent(jjj) >5.) cout<<"GOODruns: k1= " << jjj <<endl;
1032  if (GOODruns->GetBinContent(jjj) > 1400.)
1033  cout << "GOODruns: k1(0,...)= " << jjj
1034  << " GOODruns->GetBinContent(jjj)= " << GOODruns->GetBinContent(jjj) << endl;
1035  } //jjj
1036  // }// if(verbosity == 2 )
1037  } //Method = 8
1038 
1039  //======================================================================================================= PLOT9:depthes with zero A
1040  if (Method == 9) {
1041  cout << "****Draw 9 Dependencies: depthes with zero A *** " << endl;
1042  gPad->SetGridy();
1043  gPad->SetGridx();
1044  gPad->SetLogy(kFALSE);
1045  gStyle->SetOptStat(1110000);
1046  NotEmptyDepthes->SetMarkerStyle(20);
1047  NotEmptyDepthes->SetMarkerSize(0.4);
1048  NotEmptyDepthes->GetYaxis()->SetLabelSize(0.04);
1049  NotEmptyDepthes->SetTitle("# Not Empty Channels in etq-phi projection");
1050  NotEmptyDepthes->SetXTitle("4*(eta-57)+(phi-64)");
1051  NotEmptyDepthes->SetYTitle("N");
1052  NotEmptyDepthes->SetMarkerColor(4);
1053  NotEmptyDepthes->SetLineColor(4);
1054  // NotEmptyDepthes->Draw("Error");
1055  NotEmptyDepthes->Draw("PL");
1056  } //Method = 9
1057  //======================================================================================================= PLOT10: Aijk for each event and all LED runs
1058  if (Method == 10) {
1059  cout << "****Draw 10 Dependencies: Aijk for each event and all LED runs *** " << endl;
1060 
1061  c1->Clear();
1062  c1->Divide(1, 1);
1063 
1064  c1->cd(1);
1065  // TString epsName = fname + LEDruns[0] +".root";
1066  // TFile *hfile= new TFile(epsName, "READ");
1067  // TH1F * Aeff1D= (TH1F*)hfile->Get("h_ADCAmpl_HO");
1068 
1069  gPad->SetGridy();
1070  gPad->SetGridx();
1071  gPad->SetLogy();
1072  gStyle->SetOptStat(101110);
1073  // Aeff1D->SetStats(0);
1074  Aeff1D->SetMarkerStyle(20);
1075  Aeff1D->SetMarkerSize(0.4);
1076  Aeff1D->GetYaxis()->SetLabelSize(0.04);
1077  Aeff1D->SetTitle("all runs & events& channels");
1078  Aeff1D->SetXTitle("Aijk");
1079  Aeff1D->SetYTitle("N");
1080  Aeff1D->SetMarkerColor(4);
1081  Aeff1D->SetLineColor(4);
1082  // Aeff1D->Draw("Error");
1083  // Aeff1D->Draw("PL");
1084  Aeff1D->SetMinimum(0.8);
1085  Aeff1D->Draw("");
1086 
1087  c1->Update();
1088 
1089  } //Method = 10
1090  //======================================================================================================= PLOT11: 2D SiPM channels Depthes1,2,(3.4 for 20202)
1091  if (Method == 11) {
1092  cout << "****Draw 11 <A>: 2D Depthes1,2,3,4 *** " << endl;
1093  // gPad->SetGridy();
1094  // gPad->SetGridx();
1095  // gStyle->SetOptStat(0000000);
1096  c1->Clear();
1097  c1->Divide(1, 1);
1098 
1099  c1->cd(1);
1100  /*
1101  mapchannelsdepth1->SetStats(0);
1102  mapchannelsdepth1->SetTitle("<A> Depth1");
1103  mapchannelsdepth1->SetXTitle("#eta \b");
1104  mapchannelsdepth1->SetYTitle("#phi \b");
1105  mapchannelsdepth1->Draw("COLZ");
1106  c1->cd(2);
1107  mapchannelsdepth2->SetStats(0);
1108  mapchannelsdepth2->SetTitle("<A> Depth2");
1109  mapchannelsdepth2->SetXTitle("#eta \b");
1110  mapchannelsdepth2->SetYTitle("#phi \b");
1111  mapchannelsdepth2->Draw("COLZ");
1112  c1->cd(3);
1113  mapchannelsdepth3->SetStats(0);
1114  mapchannelsdepth3->SetTitle("<A> Depth3");
1115  mapchannelsdepth3->SetXTitle("#eta \b");
1116  mapchannelsdepth3->SetYTitle("#phi \b");
1117  mapchannelsdepth3->Draw("COLZ");
1118  c1->cd(4);
1119 */
1120  mapchannelsdepth4->SetStats(0);
1121  mapchannelsdepth4->SetTitle("<A> Depth4");
1122  mapchannelsdepth4->SetXTitle("#eta \b");
1123  mapchannelsdepth4->SetYTitle("#phi \b");
1124  mapchannelsdepth4->Draw("COLZ");
1125  c1->Update();
1126 
1127  } //Method = 11
1128  //======================================================================================================= PLOT12:
1129  if (Method == 12) {
1130  cout << "****Draw 12 not used yet *** " << endl;
1131  // gPad->SetGridy();
1132  // gPad->SetGridx();
1133  // gStyle->SetOptStat(0000000);
1134  c1->Clear();
1135  c1->Divide(2, 2);
1136 
1137  c1->cd(1);
1138  c1->cd(2);
1139  c1->cd(3);
1140 
1141  c1->Update();
1142 
1143  } //Method = 12
1144 
1145  //======================================================================================================= PLOT13: 2D
1146  if (Method == 13) {
1147  cout << "****Draw 13 function, fC *** " << endl;
1148  c1->Clear();
1149  c1->Divide(1, 1);
1150 
1151  c1->cd(1);
1152  {
1153  double c0 = 1.000000;
1154  double b1 = 2.71238e-05;
1155  double a2 = 1.32877e-10;
1156  Int_t n = 50;
1157  Double_t x[n], y[n];
1158  for (Int_t i = 0; i < n; i++) {
1159  x[i] = (i + 1) * 20000.;
1160  y[i] = a2 * x[i] * x[i] / 40. / 40. + b1 * x[i] / 40. + c0;
1161  }
1162 
1163  // create graph
1164  TGraph* gr = new TGraph(n, x, y);
1165 
1166  // draw the graph with axis, continuous line, and put
1167  // a * at each point
1168  gPad->SetGridy();
1169  gPad->SetGridx();
1170  // gPad->SetLogy();
1171  gr->Draw("AC*");
1172  /*
1173  gr1 = new TGraph(MMcount,XXX,YY);
1174  colorlines = generalcount/5.+2;
1175  gr1->SetLineColor(colorlines); gr1->SetMarkerColor(colorlines);
1176  gr1->SetMarkerStyle(20); gr1->SetMarkerSize(1.2); gr1->SetFillStyle(0); gr1->Draw("PL");
1177  */
1178  }
1179 
1180  c1->Update();
1181 
1182  } //Method = 13
1183 
1184  // //////////////////////////////////////////////////////////////////////////
1185 
1186  //=======================================================================================================
1187  //======================================================================================================= finish loop over Methods
1188  //=======================================================================================================
1189  TString fdir = "testamt5gsmHO2018/";
1190  //
1191  TString plotName = fdir + MethodName[Method] + ".png";
1192  c1->SaveAs(plotName);
1193  cout << "****PLOT " << Method << " drawn **** " << endl;
1194 
1195  } //if( Method != 9
1196  ++Method;
1197  } //while loop over Methods
1198  //=======================================================================================================
1199  //=======================================================================================================
1200  //=======================================================================================================
1201  //=======================================================================================================
1202  //=======================================================================================================
1203  //=======================================================================================================
1204  //=======================================================================================================
1205  //=======================================================================================================
1206  //=======================================================================================================
1207  //______________________________________________________________________________
1208  //______________________________________________________________________________
1209  //
1210  //______________________________________________________________________________
1211  //______________________________________________________________________________
1212  //
1213  gSystem->Exit(0);
1214  //______________________________________________________________________________
1215 }
1216 //______________________________________________________________________________
weight_default_t b1[25]
Definition: b1.h:9
int main(int argc, char *argv[])
Definition: zamt5GSMHO.cc:34
const int verbosity
string fname
main script
float x