CMS 3D CMS Logo

RemoteMonitoringGLOBAL.cc
Go to the documentation of this file.
1 // How to run:
2 //root -b -q -l RemoteMonitoringGLOBAL.C+
3 //root -b -q -l 'RemoteMonitoringGLOBAL.C+("/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/CMTweb/histos/Global_190707.root")'
4 //
5 //
6 //
7 #include "LogEleMapdb.h"
8 
9 #include <iostream>
10 #include <fstream>
11 
12 #include "TH1.h"
13 #include "TH2.h"
14 #include "TCanvas.h"
15 #include "TROOT.h"
16 #include <TMath.h>
17 #include "TStyle.h"
18 #include "TSystem.h"
19 #include "TLegend.h"
20 #include "TText.h"
21 #include "TAxis.h"
22 #include "TFile.h"
23 #include "TLine.h"
24 #include "TGraph.h"
25 #include <THStack.h>
26 #include <TPaveText.h>
27 
28 // https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT
29 // https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/HcalRemoteMonitoring/CMT
30 
31 using namespace std;
32 //inline void HERE(const char *msg) { std::cout << msg << std::endl; } kfitq
33 int copyContents(TH1F **hDest, TString hname, TString htitle, const TH1F *hSrc, int lastBin);
34 
35 // -----------------------------------------------------
36 
37 int main(int argc, char *argv[]) {
38  std::string dirnm = "Analyzer";
39  gROOT->Reset();
40  gROOT->SetStyle("Plain");
41  gStyle->SetOptStat(0);
42  gStyle->SetOptTitle(1);
43 
44  if (argc < 1)
45  return 1;
46  char fname[300];
47  sprintf(fname, "%s", argv[1]);
48  std::cout << fname << std::endl;
49 
50  //======================================================================
51  // Connect the input files, parameters and get the 2-d histogram in memory
52  // TFile *hfile= new TFile("GlobalHist.root", "READ");
53  string promt = (string)fname;
54  string runnumber = "";
55  for (unsigned int i = promt.size() - 11; i < promt.size() - 5; i++)
56  runnumber += fname[i];
57 
58  TFile *hfile = new TFile(fname, "READ");
59  hfile->ls();
60  TDirectory *dir = (TDirectory *)hfile->FindObjectAny(dirnm.c_str());
61  // Cut [test][sub][depth]
62  // Empty HB HE HO HF
63  double Cut0[7][5][8] = {
64  {{0., 0., 0., 0., 0., 0., 0., 0.},
65  {0., 1.0, 1.0, 0., 0., 0., 0., 0.},
66  {0., 1., 1., 1., 0., 0., 0., 0.},
67  {0., 0., 0., 0., 1., 0., 0., 0.},
68  {0., 1., 1., 0., 0., 0., 0., 0.}}, //CapID 0,HB,HE,HO,HF
69  // {{0.,0.,0.,0.,0.,0.,0.,0.}, {0.,35.,35.,0.,0.,0.,0.,0.}, {0.,100.,140.,150.,0.,0.,0.,0.}, {0.,0.,0.,0.,100.,0.,0.,0.}, {0.,170.,110.,170.,110.,0.,0.,0.} }, //Amplitude 0,HB,HE,HO,HF
70  //
71  // {{0., 0., 0., 0., 0., 0., 0., 0.},
72  // {0., 10., 10., 10., 10., 0., 0., 0.},
73  // {0., 10., 10., 10., 10., 10., 10., 10.},
74  // {0., 0., 0., 0., 10., 0., 0., 0.},
75  // {0., 10., 10., 10., 10., 0., 0., 0.}}, //Amplitude 0,HB,HE,HO,HF
76  {{0., 0., 0., 0., 0., 0., 0., 0.},
77  {0., 3500., 3500., 3500., 3500., 0., 0., 0.},
78  {0., 12000., 4500., 3500., 3500., 4000., 4500., 5500.},
79  {0., 0., 0., 0., 200., 0., 0., 0.},
80  {0., 4500., 4500., 4500., 4500., 0., 0., 0.}}, //Amplitude 0,HB,HE,HO,HF
81  {{0., 0., 0., 0., 0., 0., 0., 0.},
82  {0., 3., 3., 0., 0., 0., 0., 0.},
83  {0., 3., 3., 3., 0., 0., 0., 0.},
84  {0., 0., 0., 0., 3., 0., 0., 0.},
85  {0., 2., 2., 0., 0., 0., 0., 0.}}, //Width 0,HB,HE,HO,HF
86  {{0., 0., 0., 0., 0., 0., 0., 0.},
87  {0., 0.4, 0.4, 0., 0., 0., 0., 0.},
88  {0., 0.4, 0.4, 0.4, 0., 0., 0., 0.},
89  {0., 0., 0., 0., 0.4, 0., 0., 0.},
90  {0., 0.8, 0.8, 0., 0., 0., 0., 0.}}, //Ratio 0,HB,HE,HO,HF
91  {{0., 0., 0., 0., 0., 0., 0., 0.},
92  {0., 4.7, 4.7, 0., 0., 0., 0., 0.},
93  {0., 4.8, 4.8, 5.0, 0., 0., 0., 0.},
94  {0., 0., 0., 0., 4.8, 0., 0., 0.},
95  {0., 4.0, 4.0, 0., 0., 0., 0., 0.}}, //TSn 0,HB,HE,HO,HF
96  {{0., 0., 0., 0., 0., 0., 0., 0.},
97  {0., 3.5, 3.5, 0., 0., 0., 0., 0.},
98  {0., 4.0, 4.0, 4.0, 0., 0., 0., 0.},
99  {0., 0., 0., 0., 3., 0., 0., 0.},
100  {0., 3.5, 3.5, 0., 0., 0., 0., 0.}}, //TSx 0,HB,HE,HO,HF
101  {{0., 0., 0., 0., 0., 0., 0., 0.},
102  {0., 0., 0., 0., 0., 0., 0., 0.},
103  {0., 0., 0., 0., 0., 0., 0., 0.},
104  {0., 0., 0., 0., 0., 0., 0., 0.},
105  {0., 0., 0., 0., 0., 0., 0., 0.}}}; //Empty
106 
107  double CutAb[5][8] = {{0., 0., 0., 0., 0., 0., 0., 0.},
108  {0., 20., 7., 0., 0., 0., 0., 0.},
109  {0., 16., 13., 4., 0., 0., 0., 0.},
110  {0., 0., 0., 0., 45., 0., 0., 0.},
111  {0., 10., 5., 0., 0., 0., 0., 0.}}; // cut 1 for CapIdErrors 0,HB,HE,HO,HF
112 
113  double CutPo[5][8] = {{0., 0., 0., 0., 0., 0., 0., 0.},
114  {0., 9., 3., 0., 0., 0., 0., 0.},
115  {0., 8., 6., 2., 0., 0., 0., 0.},
116  {0., 0., 0., 0., 20., 0., 0., 0.},
117  {0., 5., 3., 0., 0., 0., 0., 0.}}; //cut 3 for CapIdErrors (portions) 0,HB,HE,HO,HF
118 
119  //======================================================================
120 
121  // CUTs FOR IPHI RBX:
122  int cutA_HB = 100;
123  int cutA_HE = 6000;
124  int cutA_HO = 150;
125  int cutA_HF = 500;
126  // CUTs FOR IETA RBX:
127  int cutB_HB = 100;
128  int cutB_HE = 10000;
129  int cutB_HO = 150;
130  int cutB_HF = 500;
131 
132  //======================================================================
133  // Prepare histograms and plot them to .png files
134  // TCanvas *cHB = new TCanvas("cHB", "cHB", 200, 10, 700, 900);
135  TCanvas *cHB = new TCanvas("cHB", "cHB", 1000, 500);
136  TCanvas *cHE = new TCanvas("cHE", "cHE", 1500, 500);
137  TCanvas *cONE = new TCanvas("cONE", "cONE", 500, 500);
138  TCanvas *cFour = new TCanvas("cFour", "cFour", 1500, 1000);
139  TCanvas *cFour1 = new TCanvas("cFour1", "cFour1", 1200, 800);
140  TCanvas *cNine = new TCanvas("cNine", "cNine", 1500, 1500);
141 
142  // RBX:
143  // TCanvas *c4x6 = new TCanvas("c4x6","c4x6",1500,3000);
144  TCanvas *c4x6 = new TCanvas("c4x6", "c4x6", 1200, 2400);
145  //TCanvas *c5x6 = new TCanvas("c5x6","c5x6",2000,3000);
146  TCanvas *c5x6 = new TCanvas("c5x6", "c5x6", 1500, 2400);
147  // TCanvas *cRBX1 = new TCanvas("cRBX1","cRBX1",200,10,1300,1110);
148  TCanvas *cRBX1 = new TCanvas("cRBX1", "cRBX1", 1200, 1000);
149  //
150  // TCanvas *cRBX31 = new TCanvas("cRBX31","cRBX31",1800,600);
151  TCanvas *cRBX31 = new TCanvas("cRBX31", "cRBX31", 1860, 600);
152  // TCanvas *cRBX31 = new TCanvas("cRBX31","cRBX31",200,10,,1800,600);
153 
154  // char *str = (char*)alloca(10000);
155 
156  int k_min[5] = {0, 1, 1, 4, 1}; // minimum depth for each subdet HB HE HO HF
157 
158  int k_max[5] = {0, 2, 3, 4, 2}; // maximum depth for each subdet HB HE HO HF
159  // int k_maxupgrade[5]={0,2,3,4,4}; // maximum depth for each subdet HB HE HO HF
160  int k_maxupgrade[5] = {0, 4, 7, 4, 4}; // maximum depth for each subdet HB HE HO HF
161 
162  //+++++++++++++++++++++++++++++
163  // Lumi iLumi and number of events
164  //+++++++++++++++++++++++++++++
165  // with TfileService implementation, change everywhere below: hfile->Get to dir->FindObjectAny
166  cHB->Divide(2, 1);
167  cHB->cd(1);
168  TH1F *LumLum = (TH1F *)dir->FindObjectAny("h_lsnumber_per_eachLS");
169  int MaxLumDanila = LumLum->GetBinContent(LumLum->GetMaximumBin()); // old variant of Danila
170  cout << " MaxLumDanila= " << MaxLumDanila << endl;
171  gStyle->SetOptStat(110000);
172  gPad->SetGridy();
173  gPad->SetGridx();
174  LumLum->SetMarkerStyle(21);
175  LumLum->SetMarkerSize(0.8);
176  LumLum->GetYaxis()->SetLabelSize(0.04);
177  LumLum->SetTitle("Cont. number per LS \b");
178  LumLum->SetXTitle("Cont.number \b");
179  LumLum->SetYTitle("Ls \b");
180  LumLum->SetMarkerColor(4);
181  LumLum->SetLineColor(0);
182  LumLum->SetMinimum(0.8);
183  LumLum->GetXaxis()->SetRangeUser(0, MaxLumDanila + 5.);
184  LumLum->Draw("Error");
185 
186  cHB->cd(2);
187  TH1F *LumiEv = (TH1F *)dir->FindObjectAny("h_nevents_per_eachRealLS");
188  int MaxLum0 = LumiEv->GetBinContent(LumiEv->GetMaximumBin());
189  int MaxLum = 0;
190  for (int i = 1; i <= LumiEv->GetXaxis()->GetNbins(); i++) {
191  if (LumiEv->GetBinContent(i)) {
192  MaxLum = i;
193  }
194  }
195  cout << " Nev in bin of MaxLum = " << MaxLum0 << " MaxLum= " << MaxLum << endl;
196 
197  gStyle->SetOptStat(110000);
198  gPad->SetGridy();
199  gPad->SetGridx();
200  gPad->SetLogy();
201  // gPad->SetLogx();
202  LumiEv->GetYaxis()->SetLabelSize(0.04);
203  LumiEv->SetTitle("Number of events per LS");
204  LumiEv->SetXTitle("LS");
205  LumiEv->SetYTitle("Number of events ");
206  LumiEv->SetMarkerStyle(21);
207  LumiEv->SetMarkerSize(0.8);
208  LumiEv->SetMarkerColor(4);
209  LumiEv->SetLineColor(0);
210  // LumiEv->SetMinimum(0.8);
211  LumiEv->GetXaxis()->SetRangeUser(0, MaxLum + 5.);
212  LumiEv->Draw("Error");
213 
214  cHB->Print("LumiEvent.png");
215  cHB->Clear();
216 
217  //=======================================================================================================
218  // Shape criteria: 1d histogram first definition
219  //=======================================================================================================
220  TH1F *H_NumBadChanDepth[7][5][5]; // 1d histogramm for test,subdet, depth
221 
222  //+++++++++++++++++++++++++++++
223  // ADC Amplitude
224  //+++++++++++++++++++++++++++++
225 
226  H_NumBadChanDepth[1][1][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS1");
227  H_NumBadChanDepth[1][1][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS2");
228 
229  H_NumBadChanDepth[1][2][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS3");
230  H_NumBadChanDepth[1][2][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS4");
231  H_NumBadChanDepth[1][2][3] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS5");
232 
233  H_NumBadChanDepth[1][3][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS8");
234 
235  H_NumBadChanDepth[1][4][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS6");
236  H_NumBadChanDepth[1][4][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS7");
237 
238  //+++++++++++++++++++++++++++++
239  // Width
240  //+++++++++++++++++++++++++++++
241 
242  H_NumBadChanDepth[2][1][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS1");
243  H_NumBadChanDepth[2][1][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS2");
244 
245  H_NumBadChanDepth[2][2][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS3");
246  H_NumBadChanDepth[2][2][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS4");
247  H_NumBadChanDepth[2][2][3] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS5");
248 
249  H_NumBadChanDepth[2][3][4] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS8");
250 
251  H_NumBadChanDepth[2][4][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS6");
252  H_NumBadChanDepth[2][4][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS7");
253 
254  //+++++++++++++++++++++++++++++
255  // Ratio
256  //+++++++++++++++++++++++++++++
257 
258  H_NumBadChanDepth[3][1][1] = (TH1F *)dir->FindObjectAny("h_sumAmplLS1");
259  H_NumBadChanDepth[3][1][2] = (TH1F *)dir->FindObjectAny("h_sumAmplLS2");
260 
261  H_NumBadChanDepth[3][2][1] = (TH1F *)dir->FindObjectAny("h_sumAmplLS3");
262  H_NumBadChanDepth[3][2][2] = (TH1F *)dir->FindObjectAny("h_sumAmplLS4");
263  H_NumBadChanDepth[3][2][3] = (TH1F *)dir->FindObjectAny("h_sumAmplLS5");
264 
265  H_NumBadChanDepth[3][3][4] = (TH1F *)dir->FindObjectAny("h_sumAmplLS8");
266 
267  H_NumBadChanDepth[3][4][1] = (TH1F *)dir->FindObjectAny("h_sumAmplLS6");
268  H_NumBadChanDepth[3][4][2] = (TH1F *)dir->FindObjectAny("h_sumAmplLS7");
269 
270  //+++++++++++++++++++++++++++++
271  // Tmean
272  //+++++++++++++++++++++++++++++
273 
274  H_NumBadChanDepth[4][1][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS1");
275  H_NumBadChanDepth[4][1][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS2");
276 
277  H_NumBadChanDepth[4][2][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS3");
278  H_NumBadChanDepth[4][2][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS4");
279  H_NumBadChanDepth[4][2][3] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS5");
280 
281  H_NumBadChanDepth[4][3][4] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS8");
282 
283  H_NumBadChanDepth[4][4][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS6");
284  H_NumBadChanDepth[4][4][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS7");
285 
286  //+++++++++++++++++++++++++++++
287  // Tmax
288  //+++++++++++++++++++++++++++++
289 
290  H_NumBadChanDepth[5][1][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS1");
291  H_NumBadChanDepth[5][1][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS2");
292 
293  H_NumBadChanDepth[5][2][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS3");
294  H_NumBadChanDepth[5][2][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS4");
295  H_NumBadChanDepth[5][2][3] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS5");
296 
297  H_NumBadChanDepth[5][3][4] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS8");
298 
299  H_NumBadChanDepth[5][4][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS6");
300  H_NumBadChanDepth[5][4][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS7");
301 
302  gStyle->SetOptStat(110000);
303 
304  for (int test = 1; test <= 5; test++) { //Test: 0,
305  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
306  if (sub == 1)
307  cHB->Divide(2, 1);
308  if (sub == 2)
309  cHE->Divide(3, 1);
310  if (sub == 3)
311  cONE->Divide(1, 1);
312  if (sub == 4)
313  cHB->Divide(2, 1);
314  for (int k = k_min[sub]; k <= k_max[sub]; k++) { //Depth
315  if (sub == 1)
316  cHB->cd(k);
317  if (sub == 2)
318  cHE->cd(k);
319  if (sub == 3)
320  cONE->cd(k - 3);
321  if (sub == 4)
322  cHB->cd(k);
323  gPad->SetGridy();
324  gPad->SetGridx();
325  gPad->SetLogy();
326  H_NumBadChanDepth[test][sub][k]->SetMarkerStyle(20);
327  H_NumBadChanDepth[test][sub][k]->SetMarkerSize(0.8);
328  if (k == 1)
329  H_NumBadChanDepth[test][sub][k]->SetTitle("Depth 1\b");
330  if (k == 2)
331  H_NumBadChanDepth[test][sub][k]->SetTitle("Depth 2\b");
332  if (k == 3)
333  H_NumBadChanDepth[test][sub][k]->SetTitle("Depth 3\b");
334  if (k == 4)
335  H_NumBadChanDepth[test][sub][k]->SetTitle("Depth 4\b");
336  if (test == 1)
337  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <Amplitude> \b");
338  if (test == 2)
339  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <Width> \b");
340  if (test == 3)
341  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <Ratio> \b");
342  if (test == 4)
343  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <TS mean> \b");
344  if (test == 5)
345  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <TS max> \b");
346  H_NumBadChanDepth[test][sub][k]->SetYTitle("Number of channel-LSs\b");
347  H_NumBadChanDepth[test][sub][k]->SetMarkerColor(4);
348  H_NumBadChanDepth[test][sub][k]->SetLineColor(0);
349  // H_NumBadChanDepth[test][sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
350  H_NumBadChanDepth[test][sub][k]->SetMinimum(0.8);
351  H_NumBadChanDepth[test][sub][k]->Draw("Error");
352  }
353  if (test == 0) {
354  if (sub == 1) {
355  cHB->Print("H_NBCMNHB.png");
356  cHB->Clear();
357  }
358  if (sub == 2) {
359  cHE->Print("H_NBCMNHE.png");
360  cHE->Clear();
361  }
362  if (sub == 3) {
363  cONE->Print("H_NBCMNHO.png");
364  cONE->Clear();
365  }
366  if (sub == 4) {
367  cHB->Print("H_NBCMNHF.png");
368  cHB->Clear();
369  }
370  }
371 
372  if (test == 1) {
373  if (sub == 1) {
374  cHB->Print("H_ADCamplHB.png");
375  cHB->Clear();
376  }
377  if (sub == 2) {
378  cHE->Print("H_ADCamplHE.png");
379  cHE->Clear();
380  }
381  if (sub == 3) {
382  cONE->Print("H_ADCamplHO.png");
383  cONE->Clear();
384  }
385  if (sub == 4) {
386  cHB->Print("H_ADCamplHF.png");
387  cHB->Clear();
388  }
389  }
390  if (test == 2) {
391  if (sub == 1) {
392  cHB->Print("H_WidthHB.png");
393  cHB->Clear();
394  }
395  if (sub == 2) {
396  cHE->Print("H_WidthHE.png");
397  cHE->Clear();
398  }
399  if (sub == 3) {
400  cONE->Print("H_WidthHO.png");
401  cONE->Clear();
402  }
403  if (sub == 4) {
404  cHB->Print("H_WidthHF.png");
405  cHB->Clear();
406  }
407  }
408  if (test == 3) {
409  if (sub == 1) {
410  cHB->Print("H_RatioHB.png");
411  cHB->Clear();
412  }
413  if (sub == 2) {
414  cHE->Print("H_RatioHE.png");
415  cHE->Clear();
416  }
417  if (sub == 3) {
418  cONE->Print("H_RatioHO.png");
419  cONE->Clear();
420  }
421  if (sub == 4) {
422  cHB->Print("H_RatioHF.png");
423  cHB->Clear();
424  }
425  }
426  if (test == 4) {
427  if (sub == 1) {
428  cHB->Print("H_TmeanHB.png");
429  cHB->Clear();
430  }
431  if (sub == 2) {
432  cHE->Print("H_TmeanHE.png");
433  cHE->Clear();
434  }
435  if (sub == 3) {
436  cONE->Print("H_TmeanHO.png");
437  cONE->Clear();
438  }
439  if (sub == 4) {
440  cHB->Print("H_TmeanHF.png");
441  cHB->Clear();
442  }
443  }
444  if (test == 5) {
445  if (sub == 1) {
446  cHB->Print("H_TmaxHB.png");
447  cHB->Clear();
448  }
449  if (sub == 2) {
450  cHE->Print("H_TmaxHE.png");
451  cHE->Clear();
452  }
453  if (sub == 3) {
454  cONE->Print("H_TmaxHO.png");
455  cONE->Clear();
456  }
457  if (sub == 4) {
458  cHB->Print("H_TmaxHF.png");
459  cHB->Clear();
460  }
461  }
462  } // end sub
463  } //end test
464 
465  gStyle->SetOptStat(0);
466  //================================================================================================================================
467 
468  //=======================================================================================================
469  // 2-d histograms second definition
470  //=========================================================
471  TH2F *MapNumBadChanDepth[7][5][5]; // 1d Mapogramm for test,subdet, depth
472  TH2F *MapNumChanDepth[7][5][5]; // 1d Mapogramm for test,subdet, depth
473  TH2F *MapNumBadChanFull[7]; // 1d Mapogramm for test
474  TH2F *MapNumChanFull[7]; // 1d Mapogramm for test
475 
476  //+++++++++++++++++++++++++++++
477  // CapID
478  //+++++++++++++++++++++++++++++
479 
480  MapNumBadChanDepth[0][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HB");
481  MapNumBadChanDepth[0][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HB");
482 
483  MapNumBadChanDepth[0][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HE");
484  MapNumBadChanDepth[0][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HE");
485  MapNumBadChanDepth[0][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Error_HE");
486 
487  MapNumBadChanDepth[0][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HO");
488 
489  MapNumBadChanDepth[0][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HF");
490  MapNumBadChanDepth[0][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HF");
491 
492  MapNumBadChanFull[0] = (TH2F *)MapNumBadChanDepth[0][1][1]->Clone();
493 
494  MapNumChanDepth[0][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HB");
495  MapNumChanDepth[0][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HB");
496 
497  MapNumChanDepth[0][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HE");
498  MapNumChanDepth[0][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HE");
499  MapNumChanDepth[0][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HE");
500 
501  MapNumChanDepth[0][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HO");
502 
503  MapNumChanDepth[0][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HF");
504  MapNumChanDepth[0][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HF");
505 
506  MapNumChanFull[0] = (TH2F *)MapNumChanDepth[0][1][1]->Clone();
507 
508  //+++++++++++++++++++++++++++++
509  // ADC Amplitude
510  //+++++++++++++++++++++++++++++
511 
512  MapNumBadChanDepth[1][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS1");
513  MapNumBadChanDepth[1][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS2");
514 
515  MapNumBadChanDepth[1][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS3");
516  MapNumBadChanDepth[1][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS4");
517  MapNumBadChanDepth[1][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS5");
518 
519  MapNumBadChanDepth[1][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS8");
520 
521  MapNumBadChanDepth[1][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS6");
522  MapNumBadChanDepth[1][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS7");
523 
524  MapNumBadChanFull[1] = (TH2F *)MapNumBadChanDepth[1][1][1]->Clone();
525 
526  MapNumChanDepth[1][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS1");
527  MapNumChanDepth[1][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS2");
528 
529  MapNumChanDepth[1][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS3");
530  MapNumChanDepth[1][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS4");
531  MapNumChanDepth[1][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS5");
532 
533  MapNumChanDepth[1][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS8");
534 
535  MapNumChanDepth[1][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS6");
536  MapNumChanDepth[1][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS7");
537 
538  MapNumChanFull[1] = (TH2F *)MapNumChanDepth[1][1][1]->Clone();
539 
540  //+++++++++++++++++++++++++++++
541  // Width
542  //+++++++++++++++++++++++++++++
543 
544  MapNumBadChanDepth[2][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS1");
545  MapNumBadChanDepth[2][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS2");
546 
547  MapNumBadChanDepth[2][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS3");
548  MapNumBadChanDepth[2][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS4");
549  MapNumBadChanDepth[2][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS5");
550 
551  MapNumBadChanDepth[2][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS8");
552 
553  MapNumBadChanDepth[2][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS6");
554  MapNumBadChanDepth[2][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS7");
555 
556  MapNumBadChanFull[2] = (TH2F *)MapNumBadChanDepth[2][1][1]->Clone();
557 
558  MapNumChanDepth[2][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS1");
559  MapNumChanDepth[2][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS2");
560 
561  MapNumChanDepth[2][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS3");
562  MapNumChanDepth[2][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS4");
563  MapNumChanDepth[2][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS5");
564 
565  MapNumChanDepth[2][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS8");
566 
567  MapNumChanDepth[2][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS6");
568  MapNumChanDepth[2][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS7");
569 
570  MapNumChanFull[2] = (TH2F *)MapNumChanDepth[2][1][1]->Clone();
571 
572  //+++++++++++++++++++++++++++++
573  // Ratio
574  //+++++++++++++++++++++++++++++
575 
576  MapNumBadChanDepth[3][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS1");
577  MapNumBadChanDepth[3][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS2");
578 
579  MapNumBadChanDepth[3][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS3");
580  MapNumBadChanDepth[3][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS4");
581  MapNumBadChanDepth[3][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS5");
582 
583  MapNumBadChanDepth[3][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS8");
584 
585  MapNumBadChanDepth[3][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS6");
586  MapNumBadChanDepth[3][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS7");
587 
588  MapNumBadChanFull[3] = (TH2F *)MapNumBadChanDepth[3][1][1]->Clone();
589 
590  MapNumChanDepth[3][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS1");
591  MapNumChanDepth[3][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS2");
592 
593  MapNumChanDepth[3][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS3");
594  MapNumChanDepth[3][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS4");
595  MapNumChanDepth[3][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS5");
596 
597  MapNumChanDepth[3][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS8");
598 
599  MapNumChanDepth[3][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS6");
600  MapNumChanDepth[3][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS7");
601 
602  MapNumChanFull[3] = (TH2F *)MapNumChanDepth[3][1][1]->Clone();
603 
604  //+++++++++++++++++++++++++++++
605  // Tmean
606  //+++++++++++++++++++++++++++++
607 
608  MapNumBadChanDepth[4][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS1");
609  MapNumBadChanDepth[4][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS2");
610 
611  MapNumBadChanDepth[4][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS3");
612  MapNumBadChanDepth[4][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS4");
613  MapNumBadChanDepth[4][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS5");
614 
615  MapNumBadChanDepth[4][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS8");
616 
617  MapNumBadChanDepth[4][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS6");
618  MapNumBadChanDepth[4][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS7");
619 
620  MapNumBadChanFull[4] = (TH2F *)MapNumBadChanDepth[4][1][1]->Clone();
621 
622  MapNumChanDepth[4][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS1");
623  MapNumChanDepth[4][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS2");
624 
625  MapNumChanDepth[4][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS3");
626  MapNumChanDepth[4][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS4");
627  MapNumChanDepth[4][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS5");
628 
629  MapNumChanDepth[4][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS8");
630 
631  MapNumChanDepth[4][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS6");
632  MapNumChanDepth[4][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS7");
633 
634  MapNumChanFull[4] = (TH2F *)MapNumChanDepth[4][1][1]->Clone();
635 
636  //+++++++++++++++++++++++++++++
637  // Tmax
638  //+++++++++++++++++++++++++++++
639 
640  MapNumBadChanDepth[5][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS1");
641  MapNumBadChanDepth[5][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS2");
642 
643  MapNumBadChanDepth[5][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS3");
644  MapNumBadChanDepth[5][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS4");
645  MapNumBadChanDepth[5][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS5");
646 
647  MapNumBadChanDepth[5][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS8");
648 
649  MapNumBadChanDepth[5][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS6");
650  MapNumBadChanDepth[5][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS7");
651 
652  MapNumBadChanFull[5] = (TH2F *)MapNumBadChanDepth[5][1][1]->Clone();
653 
654  MapNumChanDepth[5][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS1");
655  MapNumChanDepth[5][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS2");
656 
657  MapNumChanDepth[5][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS3");
658  MapNumChanDepth[5][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS4");
659  MapNumChanDepth[5][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS5");
660 
661  MapNumChanDepth[5][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS8");
662 
663  MapNumChanDepth[5][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS6");
664  MapNumChanDepth[5][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS7");
665 
666  MapNumChanFull[5] = (TH2F *)MapNumChanDepth[5][1][1]->Clone();
667 
668  for (int test = 0; test <= 5; test++) { //Test: 0,
669  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
670  if (sub == 1)
671  cHB->Divide(2, 1);
672  if (sub == 2)
673  cHE->Divide(3, 1);
674  if (sub == 3)
675  cONE->Divide(1, 1);
676  if (sub == 4)
677  cHB->Divide(2, 1);
678  for (int k = k_min[sub]; k <= k_max[sub]; k++) { //Depth
679  if (sub == 1)
680  cHB->cd(k);
681  if (sub == 2)
682  cHE->cd(k);
683  if (sub == 3)
684  cONE->cd(k - 3);
685  if (sub == 4)
686  cHB->cd(k);
687  MapNumBadChanDepth[test][sub][k]->Divide(
688  MapNumBadChanDepth[test][sub][k], MapNumChanDepth[test][sub][k], 1, 1, "B");
689 
690  for (int x = 1; x <= MapNumBadChanFull[test]->GetXaxis()->GetNbins(); x++) {
691  for (int y = 1; y <= MapNumBadChanFull[test]->GetYaxis()->GetNbins(); y++) {
692  double ccc1 = MapNumBadChanDepth[test][sub][k]->GetBinContent(x, y);
693  MapNumBadChanFull[test]->SetBinContent(x, y, MapNumBadChanFull[test]->GetBinContent(x, y) + ccc1);
694  } //end y
695  } //end x
696 
697  if (k == 1)
698  MapNumBadChanDepth[test][sub][k]->SetTitle("Depth 1\b");
699  if (k == 2)
700  MapNumBadChanDepth[test][sub][k]->SetTitle("Depth 2\b");
701  if (k == 3)
702  MapNumBadChanDepth[test][sub][k]->SetTitle("Depth 3\b");
703  if (k == 4)
704  MapNumBadChanDepth[test][sub][k]->SetTitle("Depth 4\b");
705  gPad->SetGridy();
706  gPad->SetGridx();
707  gPad->SetLogz();
708  //
709  // gPad->DrawFrame(0.0, 0.0001, 1.0, 1000);
710  // gPad->DrawFrame(0.2, 0.0002, 0.8, 10000);
711  MapNumBadChanDepth[test][sub][k]->SetXTitle("#eta \b");
712  MapNumBadChanDepth[test][sub][k]->SetYTitle("#phi \b");
713  MapNumBadChanDepth[test][sub][k]->SetZTitle("Average estimator \b");
715  // MapNumBadChanDepth[test][sub][k]->SetTitleOffset(0.75, "Z");
716  MapNumBadChanDepth[test][sub][k]->Draw("COLZ");
717  // MapNumBadChanDepth[test][sub][k]->Draw("same");
718  MapNumBadChanDepth[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
719  MapNumBadChanDepth[test][sub][k]->GetZaxis()->SetRangeUser(0.0001, 1.);
720  }
721  if (test == 0) {
722  if (sub == 1) {
723  cHB->Print("MapCapIdErrorHB.png");
724  cHB->Clear();
725  }
726  if (sub == 2) {
727  cHE->Print("MapCapIdErrorHE.png");
728  cHE->Clear();
729  }
730  if (sub == 3) {
731  cONE->Print("MapCapIdErrorHO.png");
732  cONE->Clear();
733  }
734  if (sub == 4) {
735  cHB->Print("MapCapIdErrorHF.png");
736  cHB->Clear();
737  }
738  }
739  if (test == 1) {
740  if (sub == 1) {
741  cHB->Print("MapADCamplHB.png");
742  cHB->Clear();
743  }
744  if (sub == 2) {
745  cHE->Print("MapADCamplHE.png");
746  cHE->Clear();
747  }
748  if (sub == 3) {
749  cONE->Print("MapADCamplHO.png");
750  cONE->Clear();
751  }
752  if (sub == 4) {
753  cHB->Print("MapADCamplHF.png");
754  cHB->Clear();
755  }
756  }
757  if (test == 2) {
758  if (sub == 1) {
759  cHB->Print("MapWidthHB.png");
760  cHB->Clear();
761  }
762  if (sub == 2) {
763  cHE->Print("MapWidthHE.png");
764  cHE->Clear();
765  }
766  if (sub == 3) {
767  cONE->Print("MapWidthHO.png");
768  cONE->Clear();
769  }
770  if (sub == 4) {
771  cHB->Print("MapWidthHF.png");
772  cHB->Clear();
773  }
774  }
775  if (test == 3) {
776  if (sub == 1) {
777  cHB->Print("MapRatioHB.png");
778  cHB->Clear();
779  }
780  if (sub == 2) {
781  cHE->Print("MapRatioHE.png");
782  cHE->Clear();
783  }
784  if (sub == 3) {
785  cONE->Print("MapRatioHO.png");
786  cONE->Clear();
787  }
788  if (sub == 4) {
789  cHB->Print("MapRatioHF.png");
790  cHB->Clear();
791  }
792  }
793  if (test == 4) {
794  if (sub == 1) {
795  cHB->Print("MapTmeanHB.png");
796  cHB->Clear();
797  }
798  if (sub == 2) {
799  cHE->Print("MapTmeanHE.png");
800  cHE->Clear();
801  }
802  if (sub == 3) {
803  cONE->Print("MapTmeanHO.png");
804  cONE->Clear();
805  }
806  if (sub == 4) {
807  cHB->Print("MapTmeanHF.png");
808  cHB->Clear();
809  }
810  }
811  if (test == 5) {
812  if (sub == 1) {
813  cHB->Print("MapTmaxHB.png");
814  cHB->Clear();
815  }
816  if (sub == 2) {
817  cHE->Print("MapTmaxHE.png");
818  cHE->Clear();
819  }
820  if (sub == 3) {
821  cONE->Print("MapTmaxHO.png");
822  cONE->Clear();
823  }
824  if (sub == 4) {
825  cHB->Print("MapTmaxHF.png");
826  cHB->Clear();
827  }
828  }
829  } // end sub
830  cONE->Divide(1, 1);
831  cONE->cd(1);
832  gPad->SetGridy();
833  gPad->SetGridx();
834  gPad->SetLogz();
835  MapNumBadChanFull[test]->SetTitle("All subdetectors\b");
836  MapNumBadChanFull[test]->SetXTitle("#eta \b");
837  MapNumBadChanFull[test]->SetYTitle("#phi \b");
838  if (test == 0)
839  MapNumBadChanFull[test]->SetZTitle("Average Nbcs \b");
840  if (test != 0)
841  MapNumBadChanFull[test]->SetZTitle("Average estimator \b");
842  // MapNumBadChanFull[test]->GetZaxis()->SetLabelSize(0.008);
843  MapNumBadChanFull[test]->SetTitleOffset(0.75, "Z");
844  MapNumBadChanFull[test]->Draw("COLZ");
845  MapNumBadChanFull[test]->GetYaxis()->SetRangeUser(0, 72.);
846  // MapNumBadChanFull[test]->GetZaxis()->SetRangeUser(0.0001, 1.);
847  if (test == 0) {
848  cONE->Print("MapCapIdError.png");
849  cONE->Clear();
850  }
851  if (test == 1) {
852  cONE->Print("MapADCAmpl.png");
853  cONE->Clear();
854  }
855  if (test == 2) {
856  cONE->Print("MapWidth.png");
857  cONE->Clear();
858  }
859  if (test == 3) {
860  cONE->Print("MapRatio.png");
861  cONE->Clear();
862  }
863  if (test == 4) {
864  cONE->Print("MapTmean.png");
865  cONE->Clear();
866  }
867  if (test == 5) {
868  cONE->Print("MapTmax.png");
869  cONE->Clear();
870  }
871  } //end test
872 
873  //================================================================================================================================
874 
875  //=======================================================================================================
876  // 1-d histograms third definition
877 
878  TH1F *HistNumBadChanDepth[7][5][8]; // 1d histogramm for test,subdet, depth
879  TH1F *HistCutNumBadChanDepth[7][5][8]; // 1d histogramm for test,subdet, depth
880  TH1F *HistNumChanDepth[7][5][8]; // 1d histogramm for test,subdet, depth
881 
882  // TH1F *HistNumBadChanDepth[7][5][5]; // 1d histogramm for test,subdet, depth
883  // TH1F *HistCutNumBadChanDepth[7][5][5]; // 1d histogramm for test,subdet, depth
884  // TH1F *HistNumChanDepth[7][5][5]; // 1d histogramm for test,subdet, depth
885 
886  TH1F *HistNumBadChanFull[7]; // 1d histogramm for test
887  TH1F *HistNumChanFull[7]; // 1d histogramm for test
888 
889  //+++++++++++++++++++++++++++++
890  // Rate of Cap ID errors
891  //+++++++++++++++++++++++++++++
892 
893  HistNumBadChanDepth[0][1][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HB");
894  HistNumBadChanDepth[0][1][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HB");
895 
896  HistNumBadChanDepth[0][2][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HE");
897  HistNumBadChanDepth[0][2][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HE");
898  HistNumBadChanDepth[0][2][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth3_HE");
899 
900  HistNumBadChanDepth[0][3][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HO");
901 
902  HistNumBadChanDepth[0][4][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HF");
903  HistNumBadChanDepth[0][4][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HF");
904 
905  HistNumBadChanFull[0] = (TH1F *)HistNumBadChanDepth[0][1][1]->Clone();
906 
907  HistCutNumBadChanDepth[0][1][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HB");
908  HistCutNumBadChanDepth[0][1][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HB");
909 
910  HistCutNumBadChanDepth[0][2][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HE");
911  HistCutNumBadChanDepth[0][2][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HE");
912  HistCutNumBadChanDepth[0][2][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth3_HE");
913 
914  HistCutNumBadChanDepth[0][3][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HO");
915 
916  HistCutNumBadChanDepth[0][4][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HF");
917  HistCutNumBadChanDepth[0][4][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HF");
918 
919  HistNumChanDepth[0][1][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HB");
920  HistNumChanDepth[0][1][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HB");
921 
922  HistNumChanDepth[0][2][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HE");
923  HistNumChanDepth[0][2][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HE");
924  HistNumChanDepth[0][2][3] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth3_HE");
925 
926  HistNumChanDepth[0][3][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HO");
927 
928  HistNumChanDepth[0][4][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HF");
929  HistNumChanDepth[0][4][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HF");
930 
931  HistNumChanFull[0] = (TH1F *)HistNumChanDepth[0][1][1]->Clone();
932 
933  //+++++++++++++++++++++++++++++
934  // ADC Amplitude
935  //+++++++++++++++++++++++++++++
936 
938  // HB:
939  HistNumBadChanDepth[1][1][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS1");
940  HistNumBadChanDepth[1][1][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS2");
941  // HB upgrade:
942  HistNumBadChanDepth[1][1][3] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth3HBu");
943  HistNumBadChanDepth[1][1][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth4HBu");
944 
945  // HE:
946  HistNumBadChanDepth[1][2][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS3");
947  HistNumBadChanDepth[1][2][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS4");
948  HistNumBadChanDepth[1][2][3] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS5");
949  // HE upgrade:
950  HistNumBadChanDepth[1][2][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth4HEu");
951  HistNumBadChanDepth[1][2][5] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth5HEu");
952  HistNumBadChanDepth[1][2][6] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth6HEu");
953  HistNumBadChanDepth[1][2][7] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth7HEu");
954 
955  // HO:
956  HistNumBadChanDepth[1][3][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS8");
957 
958  // HF:
959  HistNumBadChanDepth[1][4][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS6");
960  HistNumBadChanDepth[1][4][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS7");
961  // HF upgrade:
962  HistNumBadChanDepth[1][4][3] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS6u");
963  HistNumBadChanDepth[1][4][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS7u");
964 
965  // other cases:
966  HistNumBadChanFull[1] = (TH1F *)HistNumBadChanDepth[1][1][1]->Clone();
967 
969  // HB:
970  HistCutNumBadChanDepth[1][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS1");
971  HistCutNumBadChanDepth[1][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS2");
972  // HB upgrade:
973  HistCutNumBadChanDepth[1][1][3] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth3HBu");
974  HistCutNumBadChanDepth[1][1][4] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth4HBu");
975 
976  // HE:
977  HistCutNumBadChanDepth[1][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS3");
978  HistCutNumBadChanDepth[1][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS4");
979  HistCutNumBadChanDepth[1][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS5");
980  // HE upgrade:
981  HistCutNumBadChanDepth[1][2][4] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth4HEu");
982  HistCutNumBadChanDepth[1][2][5] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth5HEu");
983  HistCutNumBadChanDepth[1][2][6] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth6HEu");
984  HistCutNumBadChanDepth[1][2][7] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth7HEu");
985 
986  // HO:
987  HistCutNumBadChanDepth[1][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS8");
988 
989  // HF:
990  HistCutNumBadChanDepth[1][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS6");
991  HistCutNumBadChanDepth[1][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS7");
992  // HF upgrade:
993  HistCutNumBadChanDepth[1][4][3] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS6u");
994  HistCutNumBadChanDepth[1][4][4] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS7u");
995 
997  // HB:
998  HistNumChanDepth[1][1][1] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS1");
999  HistNumChanDepth[1][1][2] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS2");
1000  // HB upgrade:
1001  HistNumChanDepth[1][1][3] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth3HBu");
1002  HistNumChanDepth[1][1][4] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth4HBu");
1003 
1004  // HE:
1005  HistNumChanDepth[1][2][1] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS3");
1006  HistNumChanDepth[1][2][2] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS4");
1007  HistNumChanDepth[1][2][3] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS5");
1008  // HE upgrade:
1009  HistNumChanDepth[1][2][4] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth4HEu");
1010  HistNumChanDepth[1][2][5] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth5HEu");
1011  HistNumChanDepth[1][2][6] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth6HEu");
1012  HistNumChanDepth[1][2][7] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth7HEu");
1013 
1014  // HO:
1015  HistNumChanDepth[1][3][4] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS8");
1016 
1017  // HF:
1018  HistNumChanDepth[1][4][1] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS6");
1019  HistNumChanDepth[1][4][2] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS7");
1020  // HF upgrade:
1021  HistNumChanDepth[1][4][3] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS6u");
1022  HistNumChanDepth[1][4][4] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS7u");
1023 
1024  // other cases:
1025  HistNumChanFull[1] = (TH1F *)HistNumChanDepth[1][1][1]->Clone();
1026  // just initialization of [6] massive for alternative <A> calculation
1027  HistNumChanFull[6] = (TH1F *)HistNumChanDepth[1][1][1]->Clone();
1028 
1029  //+++++++++++++++++++++++++++++
1030  // Width
1031  //+++++++++++++++++++++++++++++
1032 
1033  HistNumBadChanDepth[2][1][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS1");
1034  HistNumBadChanDepth[2][1][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS2");
1035 
1036  HistNumBadChanDepth[2][2][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS3");
1037  HistNumBadChanDepth[2][2][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS4");
1038  HistNumBadChanDepth[2][2][3] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS5");
1039 
1040  HistNumBadChanDepth[2][3][4] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS8");
1041 
1042  HistNumBadChanDepth[2][4][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS6");
1043  HistNumBadChanDepth[2][4][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS7");
1044 
1045  HistNumBadChanFull[2] = (TH1F *)HistNumBadChanDepth[2][1][1]->Clone();
1046 
1047  HistCutNumBadChanDepth[2][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS1");
1048  HistCutNumBadChanDepth[2][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS2");
1049 
1050  HistCutNumBadChanDepth[2][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS3");
1051  HistCutNumBadChanDepth[2][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS4");
1052  HistCutNumBadChanDepth[2][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS5");
1053 
1054  HistCutNumBadChanDepth[2][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS8");
1055 
1056  HistCutNumBadChanDepth[2][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS6");
1057  HistCutNumBadChanDepth[2][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS7");
1058 
1059  HistNumChanDepth[2][1][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS1");
1060  HistNumChanDepth[2][1][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS2");
1061 
1062  HistNumChanDepth[2][2][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS3");
1063  HistNumChanDepth[2][2][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS4");
1064  HistNumChanDepth[2][2][3] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS5");
1065 
1066  HistNumChanDepth[2][3][4] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS8");
1067 
1068  HistNumChanDepth[2][4][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS6");
1069  HistNumChanDepth[2][4][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS7");
1070 
1071  HistNumChanFull[2] = (TH1F *)HistNumChanDepth[2][1][1]->Clone();
1072  //+++++++++++++++++++++++++++++
1073  // Ratio
1074  //+++++++++++++++++++++++++++++
1075 
1076  HistNumBadChanDepth[3][1][1] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS1");
1077  HistNumBadChanDepth[3][1][2] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS2");
1078 
1079  HistNumBadChanDepth[3][2][1] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS3");
1080  HistNumBadChanDepth[3][2][2] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS4");
1081  HistNumBadChanDepth[3][2][3] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS5");
1082 
1083  HistNumBadChanDepth[3][3][4] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS8");
1084 
1085  HistNumBadChanDepth[3][4][1] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS6");
1086  HistNumBadChanDepth[3][4][2] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS7");
1087 
1088  HistNumBadChanFull[3] = (TH1F *)HistNumBadChanDepth[3][1][1]->Clone();
1089 
1090  HistCutNumBadChanDepth[3][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS1");
1091  HistCutNumBadChanDepth[3][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS2");
1092 
1093  HistCutNumBadChanDepth[3][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS3");
1094  HistCutNumBadChanDepth[3][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS4");
1095  HistCutNumBadChanDepth[3][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS5");
1096 
1097  HistCutNumBadChanDepth[3][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS8");
1098 
1099  HistCutNumBadChanDepth[3][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS6");
1100  HistCutNumBadChanDepth[3][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS7");
1101 
1102  HistNumChanDepth[3][1][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS1");
1103  HistNumChanDepth[3][1][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS2");
1104 
1105  HistNumChanDepth[3][2][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS3");
1106  HistNumChanDepth[3][2][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS4");
1107  HistNumChanDepth[3][2][3] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS5");
1108 
1109  HistNumChanDepth[3][3][4] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS8");
1110 
1111  HistNumChanDepth[3][4][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS6");
1112  HistNumChanDepth[3][4][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS7");
1113 
1114  HistNumChanFull[3] = (TH1F *)HistNumChanDepth[3][1][1]->Clone();
1115  //+++++++++++++++++++++++++++++
1116  // Tmean
1117  //+++++++++++++++++++++++++++++
1118 
1119  HistNumBadChanDepth[4][1][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS1");
1120  HistNumBadChanDepth[4][1][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS2");
1121 
1122  HistNumBadChanDepth[4][2][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS3");
1123  HistNumBadChanDepth[4][2][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS4");
1124  HistNumBadChanDepth[4][2][3] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS5");
1125 
1126  HistNumBadChanDepth[4][3][4] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS8");
1127 
1128  HistNumBadChanDepth[4][4][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS6");
1129  HistNumBadChanDepth[4][4][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS7");
1130 
1131  HistNumBadChanFull[4] = (TH1F *)HistNumBadChanDepth[4][1][1]->Clone();
1132 
1133  HistCutNumBadChanDepth[4][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS1");
1134  HistCutNumBadChanDepth[4][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS2");
1135 
1136  HistCutNumBadChanDepth[4][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS3");
1137  HistCutNumBadChanDepth[4][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS4");
1138  HistCutNumBadChanDepth[4][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS5");
1139 
1140  HistCutNumBadChanDepth[4][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS8");
1141 
1142  HistCutNumBadChanDepth[4][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS6");
1143  HistCutNumBadChanDepth[4][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS7");
1144 
1145  HistNumChanDepth[4][1][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS1");
1146  HistNumChanDepth[4][1][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS2");
1147 
1148  HistNumChanDepth[4][2][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS3");
1149  HistNumChanDepth[4][2][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS4");
1150  HistNumChanDepth[4][2][3] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS5");
1151 
1152  HistNumChanDepth[4][3][4] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS8");
1153 
1154  HistNumChanDepth[4][4][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS6");
1155  HistNumChanDepth[4][4][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS7");
1156 
1157  HistNumChanFull[4] = (TH1F *)HistNumChanDepth[4][1][1]->Clone();
1158  //+++++++++++++++++++++++++++++
1159  // Tmax
1160  //+++++++++++++++++++++++++++++
1161 
1162  HistNumBadChanDepth[5][1][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS1");
1163  HistNumBadChanDepth[5][1][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS2");
1164 
1165  HistNumBadChanDepth[5][2][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS3");
1166  HistNumBadChanDepth[5][2][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS4");
1167  HistNumBadChanDepth[5][2][3] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS5");
1168 
1169  HistNumBadChanDepth[5][3][4] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS8");
1170 
1171  HistNumBadChanDepth[5][4][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS6");
1172  HistNumBadChanDepth[5][4][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS7");
1173 
1174  HistNumBadChanFull[5] = (TH1F *)HistNumBadChanDepth[5][1][1]->Clone();
1175 
1176  HistCutNumBadChanDepth[5][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS1");
1177  HistCutNumBadChanDepth[5][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS2");
1178 
1179  HistCutNumBadChanDepth[5][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS3");
1180  HistCutNumBadChanDepth[5][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS4");
1181  HistCutNumBadChanDepth[5][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS5");
1182 
1183  HistCutNumBadChanDepth[5][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS8");
1184 
1185  HistCutNumBadChanDepth[5][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS6");
1186  HistCutNumBadChanDepth[5][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS7");
1187 
1188  HistNumChanDepth[5][1][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS1");
1189  HistNumChanDepth[5][1][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS2");
1190 
1191  HistNumChanDepth[5][2][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS3");
1192  HistNumChanDepth[5][2][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS4");
1193  HistNumChanDepth[5][2][3] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS5");
1194 
1195  HistNumChanDepth[5][3][4] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS8");
1196 
1197  HistNumChanDepth[5][4][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS6");
1198  HistNumChanDepth[5][4][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS7");
1199 
1200  HistNumChanFull[5] = (TH1F *)HistNumChanDepth[5][1][1]->Clone();
1201 
1202  for (int test = 0; test <= 5; test++) { //Test: =0(CapIdErrors), =1(Amplitude), =2...
1203  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1204  if (sub == 1 && test != 1)
1205  cHE->Divide(2, 1); //HB
1206  if (sub == 1 && test == 1) {
1207  cFour1->Clear();
1208  cFour1->Divide(2, 2);
1209  } //HB upgrade with new depthes 3,4 for Amplitude test only
1210  if (sub == 2 && test != 1)
1211  cHE->Divide(3, 1); //HE
1212  if (sub == 2 && test == 1) {
1213  cNine->Clear();
1214  cNine->Divide(3, 3);
1215  } //HE upgrade with new depthes 4,5,6,7 for Amplitude test only
1216  if (sub == 3)
1217  cHB->Divide(1, 1); //HO
1218  if (sub == 4 && test != 1)
1219  cHE->Divide(2, 1); //HF
1220  if (sub == 4 && test == 1) {
1221  cFour1->Clear();
1222  cFour1->Divide(2, 2);
1223  } // HF upgrade with new depthes 3 and 4 for Amplitude test only
1224 
1225  int kkkkkkmax = k_max[sub];
1226  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
1227  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
1228  kkkkkkmax = k_maxupgrade[sub];
1229  for (int k = k_min[sub]; k <= kkkkkkmax; k++) { //Depth
1230  if (sub == 1 && test != 1)
1231  cHE->cd(k); //HB
1232  if (sub == 1 && test == 1)
1233  cFour1->cd(k); //HB
1234  if (sub == 2 && test != 1)
1235  cHE->cd(k); //HE
1236  if (sub == 2 && test == 1)
1237  cNine->cd(k); //HE upgrade with new depthes 4,5,6,7 for Amplitude test only
1238  if (sub == 3)
1239  cHB->cd(k - 3); //HO
1240  if (sub == 4 && test != 1)
1241  cHE->cd(k); //HF
1242  if (sub == 4 && test == 1)
1243  cFour1->cd(k); // HF upgrade with new depthes 3 and 4 for Amplitude test only
1244  gPad->SetGridy();
1245  gPad->SetGridx();
1246  // gPad->SetLogy();
1247 
1248  if (sub == 1 && k == 1) {
1249  } else {
1250  // use "else" because ...Full[test] are filled by estimastor for sub==1 && k== 1 at initialization of ...Full[test] variables
1251  for (int x = 1; x <= HistNumBadChanFull[test]->GetXaxis()->GetNbins(); x++) {
1252  double ccc1 = HistNumBadChanDepth[test][sub][k]->GetBinContent(x);
1253  HistNumBadChanFull[test]->SetBinContent(x, HistNumBadChanFull[test]->GetBinContent(x) + ccc1);
1254  double ccc2 = HistNumChanDepth[test][sub][k]->GetBinContent(x);
1255  HistNumChanFull[test]->SetBinContent(x, HistNumChanFull[test]->GetBinContent(x) + ccc2);
1256  }
1257  } //end x
1258 
1259  // !!!!!! change the sense of HistNumBadChanDepth: now it's averaged values(estimators)
1260  HistNumBadChanDepth[test][sub][k]->Divide(
1261  HistNumBadChanDepth[test][sub][k], HistNumChanDepth[test][sub][k], 1, 1, "B");
1262  // errors abnulling:
1263  for (int x = 1; x <= HistNumBadChanDepth[test][sub][k]->GetXaxis()->GetNbins(); x++) {
1264  HistNumBadChanDepth[test][sub][k]->SetBinError(float(x), 0.01);
1265  }
1266 
1267  // int myMaxLum= HistNumBadChanDepth[test][sub][k]->GetBinContent(HistNumBadChanDepth[test][sub][k]->GetMaximumBin());
1268  // cout<<"********************>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> myMaxLum = "<<myMaxLum<<" MaxLum = "<<MaxLum<<endl;
1269  HistNumBadChanDepth[test][sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1270 
1271  // // // // // // // // // // // // // // // // // //
1272  HistNumBadChanDepth[test][sub][k]->SetMarkerStyle(20);
1273  HistNumBadChanDepth[test][sub][k]->SetMarkerSize(0.4);
1274  HistNumBadChanDepth[test][sub][k]->GetYaxis()->SetLabelSize(0.04);
1275  if (k == 1)
1276  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 1\b");
1277  if (k == 2)
1278  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 2\b");
1279  if (k == 3)
1280  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 3\b");
1281  if (k == 4)
1282  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 4\b");
1283  if (k == 5)
1284  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 5\b");
1285  if (k == 6)
1286  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 6\b");
1287  if (k == 7)
1288  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 7\b");
1289  HistNumBadChanDepth[test][sub][k]->SetXTitle("LS \b");
1290  if (test == 0)
1291  HistNumBadChanDepth[test][sub][k]->SetYTitle("<Number of bad channels> \b");
1292  if (test != 0)
1293  HistNumBadChanDepth[test][sub][k]->SetYTitle("Averaged estimator \b");
1294  HistNumBadChanDepth[test][sub][k]->SetMarkerColor(2);
1295  HistNumBadChanDepth[test][sub][k]->SetLineColor(0);
1296  // gPad->SetGridx();
1297  gPad->SetLogy();
1298  gPad->SetGridy();
1299  gPad->SetGridx();
1300  // if (test == 1) HistNumBadChanDepth[test][sub][k]->SetMinimum(0.1);
1301  HistNumBadChanDepth[test][sub][k]->Draw("Error");
1302  /*
1303  if (k == 1) HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 1\b");
1304  if (k == 2) HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 2\b");
1305  if (k == 3) HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 3\b");
1306  if (k == 4) HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 4\b");
1307  HistNumBadChanDepth[test][sub][k]->SetXTitle("LS \b");
1308  if (test == 0) HistNumBadChanDepth[test][sub][k]->SetYTitle("<Number of bad channels> \b");
1309  if (test != 0) HistNumBadChanDepth[test][sub][k]->SetYTitle("Averaged estimator \b");
1310 
1311  if (MaxLum<=1000){
1312  HistNumBadChanDepth[test][sub][k]->SetMarkerStyle(20);
1313  HistNumBadChanDepth[test][sub][k]->SetMarkerSize(0.5);
1314  HistNumBadChanDepth[test][sub][k]->SetMarkerColor(2);
1315  HistNumBadChanDepth[test][sub][k]->SetLineColor(0);
1316  HistNumBadChanDepth[test][sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1317  HistNumBadChanDepth[test][sub][k]->Draw("P");
1318  }
1319  else{
1320  HistNumBadChanDepth[test][sub][k]->SetLineColor(2);
1321  HistNumBadChanDepth[test][sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1322  HistNumBadChanDepth[test][sub][k]->Draw("L");
1323  }
1324  */
1325  /*
1326  float min_x[] = {0,10000};
1327  float min_y[] = {(float)(Cut0[test][sub][k]),(float)(Cut0[test][sub][k])};
1328  TGraph* MIN = new TGraph(2, min_x, min_y);
1329  MIN->SetLineStyle(2);
1330  MIN->SetLineColor(5);
1331  MIN->SetLineWidth(2 + 100*100);
1332  MIN->SetFillStyle(3005);
1333  MIN->SetFillColor(5);
1334  gPad->SetGridy();
1335  gPad->SetGridx();
1336  MIN->Draw("L");
1337 */
1338 
1339  if (sub == 1 && test != 1) {
1340  cHE->Modified();
1341  }
1342  if (sub == 1 && test == 1) {
1343  cFour1->Modified();
1344  } // HB upgrade
1345  if (sub == 2 && test != 1) {
1346  cHE->Modified();
1347  }
1348  if (sub == 2 && test == 1) {
1349  cNine->Modified();
1350  } // HE upgrade
1351  if (sub == 3) {
1352  cHB->Modified();
1353  }
1354  if (sub == 4 && test != 1) {
1355  cHE->Modified();
1356  }
1357  if (sub == 4 && test == 1) {
1358  cFour1->Modified();
1359  } // HF upgrade
1360 
1361  } // k loop
1362 
1363  if (test == 0) {
1364  if (sub == 1) {
1365  cHE->Print("HistNBCMNHB.png");
1366  cHE->Clear();
1367  }
1368  if (sub == 2) {
1369  cHE->Print("HistNBCMNHE.png");
1370  cHE->Clear();
1371  }
1372  if (sub == 3) {
1373  cHB->Print("HistNBCMNHO.png");
1374  cHB->Clear();
1375  }
1376  if (sub == 4) {
1377  cHE->Print("HistNBCMNHF.png");
1378  cHE->Clear();
1379  }
1380  }
1381  // Amplitude:
1382  if (test == 1) {
1383  if (sub == 1) {
1384  cFour1->Print("HistADCamplHB.png");
1385  cFour1->Clear();
1386  } // HB upgrade
1387  if (sub == 2) {
1388  cNine->Print("HistADCamplHE.png");
1389  cNine->Clear();
1390  } // HE upgrade
1391  if (sub == 3) {
1392  cHB->Print("HistADCamplHO.png");
1393  cHB->Clear();
1394  }
1395  if (sub == 4) {
1396  cFour1->Print("HistADCamplHF.png");
1397  cFour1->Clear();
1398  } // HF upgrade
1399  }
1400  if (test == 2) {
1401  if (sub == 1) {
1402  cHE->Print("HistWidthHB.png");
1403  cHE->Clear();
1404  }
1405  if (sub == 2) {
1406  cHE->Print("HistWidthHE.png");
1407  cHE->Clear();
1408  }
1409  if (sub == 3) {
1410  cHB->Print("HistWidthHO.png");
1411  cHB->Clear();
1412  }
1413  if (sub == 4) {
1414  cHE->Print("HistWidthHF.png");
1415  cHE->Clear();
1416  }
1417  }
1418  if (test == 3) {
1419  if (sub == 1) {
1420  cHE->Print("HistRatioHB.png");
1421  cHE->Clear();
1422  }
1423  if (sub == 2) {
1424  cHE->Print("HistRatioHE.png");
1425  cHE->Clear();
1426  }
1427  if (sub == 3) {
1428  cHB->Print("HistRatioHO.png");
1429  cHB->Clear();
1430  }
1431  if (sub == 4) {
1432  cHE->Print("HistRatioHF.png");
1433  cHE->Clear();
1434  }
1435  }
1436  if (test == 4) {
1437  if (sub == 1) {
1438  cHE->Print("HistTmeanHB.png");
1439  cHE->Clear();
1440  }
1441  if (sub == 2) {
1442  cHE->Print("HistTmeanHE.png");
1443  cHE->Clear();
1444  }
1445  if (sub == 3) {
1446  cHB->Print("HistTmeanHO.png");
1447  cHB->Clear();
1448  }
1449  if (sub == 4) {
1450  cHE->Print("HistTmeanHF.png");
1451  cHE->Clear();
1452  }
1453  }
1454  if (test == 5) {
1455  if (sub == 1) {
1456  cHE->Print("HistTmaxHB.png");
1457  cHE->Clear();
1458  }
1459  if (sub == 2) {
1460  cHE->Print("HistTmaxHE.png");
1461  cHE->Clear();
1462  }
1463  if (sub == 3) {
1464  cHB->Print("HistTmaxHO.png");
1465  cHB->Clear();
1466  }
1467  if (sub == 4) {
1468  cHE->Print("HistTmaxHF.png");
1469  cHE->Clear();
1470  }
1471  }
1472  } // end sub
1474  if (test == 1) {
1475  for (int x = 1; x <= HistNumChanFull[6]->GetXaxis()->GetNbins(); x++) {
1476  HistNumChanFull[6]->SetBinContent(x, 0.0);
1477  int depthsubcount = 0.;
1478  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1479  int kkkkkkmax = k_max[sub];
1480  if (sub == 4 || sub == 2 || sub == 1)
1481  kkkkkkmax = k_maxupgrade[sub];
1482  // if ( sub==4 || sub==2) kkkkkkmax = k_maxupgrade[sub];
1483  for (int k = k_min[sub]; k <= kkkkkkmax; k++) { //Depth
1484  // line below is temporary, just to avoid contribution of HEP(M)17 in depthes 4,5,6,7 but keep in depthes 1,2,3
1485  // if(sub==2 && k>3 ) break;
1486  depthsubcount++;
1487  double ccc1 = HistNumBadChanDepth[test][sub][k]->GetBinContent(x);
1488  HistNumChanFull[6]->SetBinContent(x, HistNumChanFull[6]->GetBinContent(x) + ccc1);
1489  } //depth
1490  } //sub
1491  if (depthsubcount > 0.) {
1492  HistNumChanFull[6]->SetBinContent(x, (HistNumChanFull[6]->GetBinContent(x)) / depthsubcount);
1493  } else {
1494  HistNumChanFull[6]->SetBinContent(x, (HistNumChanFull[6]->GetBinContent(x)) / 8.);
1495  }
1496  } //x
1497  } //test=1
1499  if (test != 1) {
1500  cHB->Divide(1, 1);
1501  cHB->cd(1);
1502  } else {
1503  cHE->Divide(2, 1);
1504  cHE->cd(1);
1505  }
1506  HistNumBadChanFull[test]->Divide(HistNumBadChanFull[test], HistNumChanFull[test], 1, 1, "B");
1507  TH1F *kfitq = new TH1F("kfitq", "", MaxLum, 1., MaxLum + 1.);
1508  int nx = kfitq->GetXaxis()->GetNbins();
1509  for (int i = 1; i <= nx; i++) {
1510  double ccc1 = HistNumBadChanFull[test]->GetBinContent(i);
1511  if (ccc1 > 0.) {
1512  kfitq->Fill(float(i), ccc1);
1513  kfitq->SetBinError(float(i), 0.01);
1514  }
1515  }
1516  kfitq->SetMarkerStyle(20);
1517  kfitq->SetMarkerSize(0.4);
1518  kfitq->GetYaxis()->SetLabelSize(0.04);
1519  if (test == 0)
1520  kfitq->SetTitle("Average Nbch for whole Hcal \b");
1521  if (test != 0)
1522  kfitq->SetTitle("Averaged estimator for whole Hcal \b");
1523  kfitq->SetXTitle("LS \b");
1524  if (test == 0)
1525  kfitq->SetYTitle("<Number of bad channels> \b");
1526  if (test != 0)
1527  kfitq->SetYTitle("Averaged estimator \b");
1528  kfitq->SetMarkerColor(2);
1529  kfitq->SetLineColor(0);
1530  gPad->SetGridx();
1531  kfitq->Draw("Error");
1532  /*
1533  HistNumBadChanFull[test]->SetMarkerStyle(20);
1534  HistNumBadChanFull[test]->SetMarkerSize(0.8);
1535  HistNumBadChanFull[test]->SetTitle("Averaged estimator for whole Hcal \b");
1536  HistNumBadChanFull[test]->SetXTitle("LS \b");
1537  if (test == 0) HistNumBadChanFull[test]->SetYTitle("<Number of bad channels> \b");
1538  if (test != 0) HistNumBadChanFull[test]->SetYTitle("Averaged estimator \b");
1539  if (MaxLum<=1000){
1540  HistNumBadChanFull[test]->SetMarkerColor(1);
1541  HistNumBadChanFull[test]->SetLineColor(0);
1542  HistNumBadChanFull[test]->Draw("P");
1543  }
1544  else {
1545  HistNumBadChanFull[test]->SetLineColor(1);
1546  HistNumBadChanFull[test]->Draw("L");
1547  }
1548  */
1549  if (test == 1) {
1550  cHE->cd(2);
1551  TH1F *lpuio = new TH1F("lpuio", "", MaxLum, 1., MaxLum + 1.);
1552  int nx = lpuio->GetXaxis()->GetNbins();
1553  for (int i = 1; i <= nx; i++) {
1554  double ccc1 = HistNumChanFull[6]->GetBinContent(i);
1555  if (ccc1 > 0.) {
1556  lpuio->Fill(float(i), ccc1);
1557  lpuio->SetBinError(float(i), 0.01);
1558  }
1559  }
1560  lpuio->SetMarkerStyle(20);
1561  lpuio->SetMarkerSize(0.4);
1562  lpuio->GetYaxis()->SetLabelSize(0.04);
1563  lpuio->SetTitle("Mean of Averaged Amplitudes over all Hcal sub-detectors \b");
1564  lpuio->SetXTitle("LS \b");
1565  lpuio->SetYTitle("Mean of Averaged estimator \b");
1566  lpuio->SetMarkerColor(2);
1567  lpuio->SetLineColor(0);
1568  gPad->SetGridx();
1569  lpuio->Draw("Error");
1570  }
1571  if (test == 0) {
1572  cHB->Print("HistCapID.png");
1573  cHB->Clear();
1574  }
1575  if (test == 1) {
1576  cHE->Print("HistADCAmpl.png");
1577  cHE->Clear();
1578  }
1579  if (test == 2) {
1580  cHB->Print("HistWidth.png");
1581  cHB->Clear();
1582  }
1583  if (test == 3) {
1584  cHB->Print("HistRatio.png");
1585  cHB->Clear();
1586  }
1587  if (test == 4) {
1588  cHB->Print("HistTmean.png");
1589  cHB->Clear();
1590  }
1591  if (test == 5) {
1592  cHB->Print("HistTmax.png");
1593  cHB->Clear();
1594  }
1595 
1596  // clean-up
1597  if (kfitq)
1598  delete kfitq;
1599  } //end test
1600 
1601  //================================================================================================================================
1602 
1603  //=======================================================================================================333
1604  //CapID 1-d histograms
1605 
1606  TH1F *HistAbnormNumBadChanDepth[5][5]; // 1d histogramm for subdet, depth
1607 
1608  //+++++++++++++++++++++++++++++
1609  // Abnormal Bad Channels Rate of Cap ID errors first set of histograms
1610  //+++++++++++++++++++++++++++++
1611 
1612  HistAbnormNumBadChanDepth[1][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth1_HB");
1613  HistAbnormNumBadChanDepth[1][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth2_HB");
1614  HistAbnormNumBadChanDepth[2][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth1_HE");
1615  HistAbnormNumBadChanDepth[2][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth2_HE");
1616  HistAbnormNumBadChanDepth[2][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth3_HE");
1617  HistAbnormNumBadChanDepth[3][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth4_HO");
1618  HistAbnormNumBadChanDepth[4][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth1_HF");
1619  HistAbnormNumBadChanDepth[4][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth2_HF");
1620 
1621  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1622  if (sub == 1)
1623  cHB->Divide(2, 1);
1624  if (sub == 2)
1625  cHE->Divide(3, 1);
1626  if (sub == 3)
1627  cONE->Divide(1, 1);
1628  if (sub == 4)
1629  cHB->Divide(2, 1);
1630  for (int k = k_min[sub]; k <= k_max[sub]; k++) { //Depth
1631  if (sub == 1)
1632  cHB->cd(k);
1633  if (sub == 2)
1634  cHE->cd(k);
1635  if (sub == 3)
1636  cONE->cd(k - 3);
1637  if (sub == 4)
1638  cHB->cd(k);
1639  gPad->SetGridy();
1640  gPad->SetGridx();
1641  // gPad->SetLogy();
1642  HistAbnormNumBadChanDepth[sub][k]->Divide(
1643  HistAbnormNumBadChanDepth[sub][k], HistNumChanDepth[0][sub][k], 1, 1, "B");
1644  if (k == 1)
1645  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 1\b");
1646  if (k == 2)
1647  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 2\b");
1648  if (k == 3)
1649  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 3\b");
1650  if (k == 4)
1651  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 4\b");
1652  HistAbnormNumBadChanDepth[sub][k]->SetXTitle("LS \b");
1653  HistAbnormNumBadChanDepth[sub][k]->SetYTitle("< Number of bad channels > \b");
1654  if (MaxLum <= 1000) {
1655  HistAbnormNumBadChanDepth[sub][k]->SetMarkerStyle(20);
1656  HistAbnormNumBadChanDepth[sub][k]->SetMarkerSize(0.5);
1657  HistAbnormNumBadChanDepth[sub][k]->SetMarkerColor(1);
1658  HistAbnormNumBadChanDepth[sub][k]->SetLineColor(0);
1659  HistAbnormNumBadChanDepth[sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1660  HistAbnormNumBadChanDepth[sub][k]->Draw("P");
1661  } else {
1662  HistAbnormNumBadChanDepth[sub][k]->SetLineColor(1);
1663  HistAbnormNumBadChanDepth[sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1664  HistAbnormNumBadChanDepth[sub][k]->Draw("L");
1665  }
1666  }
1667  if (sub == 1) {
1668  cHB->Print("Hist_CAPID_Abnorm_HB.png");
1669  cHB->Clear();
1670  }
1671  if (sub == 2) {
1672  cHE->Print("Hist_CAPID_Abnorm_HE.png");
1673  cHE->Clear();
1674  }
1675  if (sub == 3) {
1676  cONE->Print("Hist_CAPID_Abnorm_HO.png");
1677  cONE->Clear();
1678  }
1679  if (sub == 4) {
1680  cHB->Print("Hist_CAPID_Abnorm_HF.png");
1681  cHB->Clear();
1682  }
1683  } // end sub
1684 
1685  //+++++++++++++++++++++++++++++
1686  // Portions of bad channels events identified by Cap ID errors third set of histograms
1687  //+++++++++++++++++++++++++++++
1688 
1689  TH1F *HistPortBadEventsDepth[5][5]; // 1d histogramm for subdet, depth
1690 
1691  HistPortBadEventsDepth[1][1] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth1_HB");
1692  HistPortBadEventsDepth[1][2] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth2_HB");
1693  HistPortBadEventsDepth[2][1] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth1_HE");
1694  HistPortBadEventsDepth[2][2] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth2_HE");
1695  HistPortBadEventsDepth[2][3] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth3_HE");
1696  HistPortBadEventsDepth[3][4] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth4_HO");
1697  HistPortBadEventsDepth[4][1] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth1_HF");
1698  HistPortBadEventsDepth[4][2] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth2_HF");
1699 
1700  TH1F *HistNumRateDepth[5][5];
1701  HistNumRateDepth[1][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HB");
1702  HistNumRateDepth[1][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HB");
1703  HistNumRateDepth[2][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HE");
1704  HistNumRateDepth[2][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HE");
1705  HistNumRateDepth[2][3] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth3_HE");
1706  HistNumRateDepth[3][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HO");
1707  HistNumRateDepth[4][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HF");
1708  HistNumRateDepth[4][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HF");
1709 
1710  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1711  if (sub == 1)
1712  cHB->Divide(2, 1);
1713  if (sub == 2)
1714  cHE->Divide(3, 1);
1715  if (sub == 3)
1716  cONE->Divide(1, 1);
1717  if (sub == 4)
1718  cHB->Divide(2, 1);
1719  for (int k = k_min[sub]; k <= k_max[sub]; k++) { //Depth
1720  if (sub == 1)
1721  cHB->cd(k);
1722  if (sub == 2)
1723  cHE->cd(k);
1724  if (sub == 3)
1725  cONE->cd(k - 3);
1726  if (sub == 4)
1727  cHB->cd(k);
1728  gPad->SetGridy();
1729  gPad->SetGridx();
1730  // gPad->SetLogy();
1731  HistPortBadEventsDepth[sub][k]->Divide(HistPortBadEventsDepth[sub][k], HistNumRateDepth[sub][k], 1, 1, "B");
1732 
1733  if (k == 1)
1734  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 1\b");
1735  if (k == 2)
1736  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 2\b");
1737  if (k == 3)
1738  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 3\b");
1739  if (k == 4)
1740  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 4\b");
1741  HistPortBadEventsDepth[sub][k]->SetXTitle("LS \b");
1742  HistPortBadEventsDepth[sub][k]->SetYTitle("< Number of bad channels > \b");
1743  if (MaxLum <= 1000) {
1744  HistPortBadEventsDepth[sub][k]->SetMarkerStyle(20);
1745  HistPortBadEventsDepth[sub][k]->SetMarkerSize(0.5);
1746  HistPortBadEventsDepth[sub][k]->SetMarkerColor(1);
1747  HistPortBadEventsDepth[sub][k]->SetLineColor(0);
1748  HistPortBadEventsDepth[sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1749  HistPortBadEventsDepth[sub][k]->Draw("P");
1750  } else {
1751  HistPortBadEventsDepth[sub][k]->SetLineColor(1);
1752  HistPortBadEventsDepth[sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1753  HistPortBadEventsDepth[sub][k]->Draw("L");
1754  }
1755  }
1756  if (sub == 1) {
1757  cHB->Print("HistPortHB.png");
1758  cHB->Clear();
1759  }
1760  if (sub == 2) {
1761  cHE->Print("HistPortHE.png");
1762  cHE->Clear();
1763  }
1764  if (sub == 3) {
1765  cONE->Print("HistPortHO.png");
1766  cONE->Clear();
1767  }
1768  if (sub == 4) {
1769  cHB->Print("HistPortHF.png");
1770  cHB->Clear();
1771  }
1772  } // end sub
1773 
1774  //================================================================================================================================
1775 
1776  //+++++++++++++++++++++++++++++
1777  // Number of bad channels events identified by Cap ID errors third set of histograms
1778  //+++++++++++++++++++++++++++++
1779 
1780  TH1F *HistNBadChsDepth[5][5]; // 1d histogramm for subdet, depth
1781 
1782  HistNBadChsDepth[1][1] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth1_HB");
1783  HistNBadChsDepth[1][2] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth2_HB");
1784  HistNBadChsDepth[2][1] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth1_HE");
1785  HistNBadChsDepth[2][2] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth2_HE");
1786  HistNBadChsDepth[2][3] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth3_HE");
1787  HistNBadChsDepth[3][4] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth4_HO");
1788  HistNBadChsDepth[4][1] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth1_HF");
1789  HistNBadChsDepth[4][2] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth2_HF");
1790 
1791  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
1792  if (sub == 1)
1793  cHB->Divide(2, 1);
1794  if (sub == 2)
1795  cHE->Divide(3, 1);
1796  if (sub == 3)
1797  cONE->Divide(1, 1);
1798  if (sub == 4)
1799  cHB->Divide(2, 1);
1800  for (int k = k_min[sub]; k <= k_max[sub]; k++) { //Depth
1801  if (sub == 1)
1802  cHB->cd(k);
1803  if (sub == 2)
1804  cHE->cd(k);
1805  if (sub == 3)
1806  cONE->cd(k - 3);
1807  if (sub == 4)
1808  cHB->cd(k);
1809  gPad->SetGridy();
1810  gPad->SetGridx();
1811  gPad->SetLogy();
1812 
1813  if (k == 1)
1814  HistNBadChsDepth[sub][k]->SetTitle("Depth 1\b");
1815  if (k == 2)
1816  HistNBadChsDepth[sub][k]->SetTitle("Depth 2\b");
1817  if (k == 3)
1818  HistNBadChsDepth[sub][k]->SetTitle("Depth 3\b");
1819  if (k == 4)
1820  HistNBadChsDepth[sub][k]->SetTitle("Depth 4\b");
1821  HistNBadChsDepth[sub][k]->SetXTitle("Number of bad channels\b");
1822  HistNBadChsDepth[sub][k]->SetYTitle("Number of events\b");
1823  // HistNBadChsDepth[sub][k]->SetMarkerStyle(20);
1824  // HistNBadChsDepth[sub][k]->SetMarkerSize(0.5);
1825  // HistNBadChsDepth[sub][k]->SetMarkerColor(1);
1826  // HistNBadChsDepth[sub][k]->SetLineColor(0);
1827  HistNBadChsDepth[sub][k]->Draw("");
1828  }
1829  if (sub == 1) {
1830  cHB->Print("HistNBadChsHB.png");
1831  cHB->Clear();
1832  }
1833  if (sub == 2) {
1834  cHE->Print("HistNBadChsHE.png");
1835  cHE->Clear();
1836  }
1837  if (sub == 3) {
1838  cONE->Print("HistNBadChsHO.png");
1839  cONE->Clear();
1840  }
1841  if (sub == 4) {
1842  cHB->Print("HistNBadChsHF.png");
1843  cHB->Clear();
1844  }
1845  } // end sub
1846 
1847  //====================================================================== HB :
1848  //====================================================================== HB :
1849  //====================================================================== HB :
1850  // Special test of errors type A and B in HB
1851  // AZ 08.02.2016
1852 
1853  int flagErrAB_HB[2];
1854  flagErrAB_HB[0] = -1;
1855  flagErrAB_HB[1] = -1;
1856  double avedelta_HB = 0.;
1857  int lastLumiBin_HB = -1;
1858  int LSofFirstErrB_HB = -1;
1859  {
1860  const int specCountA = 4;
1861  const int specColors[specCountA] = {1, 2, 3, 4};
1862  const TString hnames[specCountA][2] = {{"h_sumADCAmplperLS1_P1", "h_sum0ADCAmplperLS1_P1"},
1863  {"h_sumADCAmplperLS1_P2", "h_sum0ADCAmplperLS1_P2"},
1864  {"h_sumADCAmplperLS1_M1", "h_sum0ADCAmplperLS1_M1"},
1865  {"h_sumADCAmplperLS1_M2", "h_sum0ADCAmplperLS1_M2"}};
1866 
1867  std::vector<TH1F *> hV;
1868  THStack *hs = new THStack("hs", "ADCAmplerLS1");
1869  cHB->Clear();
1870  // cHB->cd();
1871  cHB->Divide(2, 1);
1872  cHB->cd(1);
1873 
1875  for (int i = 0; i < specCountA; i++) {
1876  if (1)
1877  std::cout << "debugger: errA_HB : get histos for i=" << i << " " << hnames[i][0] << " and " << hnames[i][1]
1878  << "\n";
1879  TH1F *h1 = (TH1F *)dir->FindObjectAny(hnames[i][0]);
1880  TH1F *h0 = (TH1F *)dir->FindObjectAny(hnames[i][1]);
1881  if (!h1 || !h0) {
1882  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
1883  ptext->AddText("Missing histo");
1884  if (!h1) {
1885  std::cout << "\tfailed to get " << hnames[i][0] << "\n";
1886  ptext->AddText(hnames[i][0]);
1887  }
1888  if (!h0) {
1889  std::cout << "\tfailed to get " << hnames[i][1] << "\n";
1890  ptext->AddText(hnames[i][1]);
1891  }
1892  ptext->Draw();
1893  continue;
1894  }
1895  TH1F *hERT1orig = (TH1F *)h1->Clone(Form("ERT1orig_%d", i));
1896  hERT1orig->Divide(h1, h0, 1, 1, "B");
1897 
1898  if ((lastLumiBin_HB < 0) && (i == 0)) {
1899  for (int ibin = hERT1orig->GetNbinsX(); ibin >= 1; ibin--) {
1900  if (hERT1orig->GetBinContent(ibin) == 0)
1901  lastLumiBin_HB = ibin;
1902  else
1903  break;
1904  }
1905  lastLumiBin_HB += 3; // show more bins
1906  if (lastLumiBin_HB >= hERT1orig->GetNbinsX())
1907  lastLumiBin_HB = -1;
1908  }
1909  TH1F *hERT1 = NULL;
1910  if (lastLumiBin_HB > 1) {
1911  if (!copyContents(&hERT1, Form("ERT1_%d", i), "", hERT1orig, lastLumiBin_HB)) {
1912  std::cout << "code failed" << std::endl;
1913  gSystem->Exit(1);
1914  }
1915  } else
1916  hERT1 = hERT1orig;
1917 
1918  hERT1->GetXaxis()->SetTitle("<ADCAmpl> per LS HB: black-P1, red-P2,green-M1,blue-M2");
1919  hV.push_back(hERT1);
1920  hERT1->SetMarkerStyle(20);
1921  hERT1->SetMarkerSize(0.4);
1922  hERT1->SetXTitle("<A>(ev.in LS & ch.) - HB P1 - iLS \b");
1923  hERT1->SetMarkerColor(specColors[i]);
1924  hERT1->SetLineColor(0);
1925  hs->Add(hERT1);
1926  delete h1;
1927  delete h0;
1928  if (hERT1 != hERT1orig)
1929  delete hERT1orig;
1930  }
1931  hs->Draw("LPE1 nostack");
1932  cHB->Update(); // activate the axes
1933  hs->GetXaxis()->SetTitle("<A> per LS: black-P1, red-P2,green-M1,blue-M2");
1934  hs->Draw("LPE1 nostack");
1935  gPad->SetGridy();
1937 
1938  // AZ corrections 08.02.2016
1939  cHB->cd(2);
1940  TH1F *diff = new TH1F("diff", "", 100, 0., 4.);
1941 
1942  if (int(hV.size()) == specCountA) {
1943  flagErrAB_HB[0] = 0; // If we have the expected number of histograms, set the flag
1944  double sumdelta = 0.;
1945  int nnndelta = 0;
1946  for (int ibin = 1; ibin <= hV[0]->GetNbinsX(); ibin++) {
1947  double delta = 0.;
1948  double maxdelta = 0.;
1949  for (unsigned int i = 0; i < hV.size(); i++) {
1950  const TH1F *hi = hV[i];
1951  for (unsigned int j = 1; j < hV.size(); j++) {
1952  const TH1F *hj = hV[j];
1953  delta = fabs(hi->GetBinContent(ibin) - hj->GetBinContent(ibin));
1954  if (delta > maxdelta)
1955  maxdelta = delta;
1956  } //for
1957  } //for
1958  if (maxdelta > 0.) {
1959  diff->Fill(maxdelta);
1960  sumdelta += maxdelta;
1961  nnndelta++;
1962  }
1963  } //for ibin
1964  // avedelta_HB = sumdelta/hV[0]->GetNbinsX();
1965  avedelta_HB = sumdelta / nnndelta;
1966  std::cout << "******************>>>>>> ErrA_HB: avedelta_HB = " << avedelta_HB << std::endl;
1967  if (avedelta_HB > 0.24 || (avedelta_HB < 0.14 && avedelta_HB > 0.)) {
1968  flagErrAB_HB[0] = 1;
1969  } //if
1970  } //hV.size
1971  diff->SetMarkerStyle(20);
1972  diff->SetMarkerSize(0.8);
1973  diff->SetXTitle("max difference \b");
1974  diff->SetMarkerColor(2);
1975  diff->SetLineColor(0);
1976  gPad->SetGridx();
1977  gPad->SetLogy();
1978  diff->Draw("Error");
1980  cHB->Update();
1981  cHB->Print("HistErrA_HB.png");
1982  cHB->Clear();
1984 
1985  // clean-up
1986  if (diff)
1987  delete diff;
1988  for (unsigned int i = 0; i < hV.size(); i++)
1989  delete hV[i];
1990  } // ErrorA in HB
1991 
1993 
1994  { // errors type B
1995  const int specCountB = 4;
1996  const TString hnames[specCountB][2] = {{"h_2DsumErrorBLS1", "h_2D0sumErrorBLS1"},
1997  {"h_sumErrorBperLS1", "h_sum0ErrorBperLS1"},
1998  {"h_2DsumErrorBLS2", "h_2D0sumErrorBLS2"},
1999  {"h_sumErrorBperLS2", "h_sum0ErrorBperLS2"}};
2000 
2001  for (int depth = 1; depth <= 2; depth++) {
2002  cHB->Clear();
2003  cHB->Divide(2, 1);
2004  cHB->cd(1);
2005 
2006  TH1F *hRate2orig = NULL;
2007  TH2F *h2Cefz6 = NULL;
2008  TString hname1 = hnames[2 * depth - 2][0];
2009  TString hname0 = hnames[2 * depth - 2][1];
2010  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
2011  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
2012  if (1)
2013  std::cout << "debugger: errB_HB depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2014  if (!twod1 || !twod0) {
2015  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2016  ptext->AddText("Missing histos");
2017  if (!twod1) {
2018  std::cout << "\tfailed to get " << hname1 << "\n";
2019  ptext->AddText(hname1);
2020  }
2021  if (!twod0) {
2022  std::cout << "\tfailed to get " << hname0 << "\n";
2023  ptext->AddText(hname0);
2024  }
2025  ptext->Draw();
2026  } else {
2027  h2Cefz6 = (TH2F *)twod1->Clone(Form("Cefz6_%d", depth));
2028  h2Cefz6->SetTitle(Form("HB Depth %d \b", depth));
2029  h2Cefz6->Divide(twod1, twod0, 1, 1, "B");
2030 
2031  gPad->SetGridy();
2032  gPad->SetGridx();
2033  gPad->SetLogz();
2034  h2Cefz6->SetTitle(Form("Depth %d \b", depth));
2035  h2Cefz6->SetMarkerStyle(20);
2036  h2Cefz6->SetMarkerSize(0.4);
2037  // h2Cefz6->GetZaxis()->SetLabelSize(0.04);
2038  h2Cefz6->SetXTitle("#eta \b");
2039  h2Cefz6->SetYTitle("#phi \b");
2040  h2Cefz6->SetZTitle(Form("<ErrorB> - HB Depth%d \b", depth));
2041  h2Cefz6->SetMarkerColor(2);
2042  h2Cefz6->SetLineColor(2);
2043  h2Cefz6->Draw("COLZ");
2044 
2045  delete twod1;
2046  delete twod0;
2047  } // histos ok
2048 
2049  cHB->cd(2);
2050  hname1 = hnames[2 * depth - 1][0];
2051  hname0 = hnames[2 * depth - 1][1];
2052  TH1F *h1 = (TH1F *)dir->FindObjectAny(hname1);
2053  TH1F *h0 = (TH1F *)dir->FindObjectAny(hname0);
2054  if (1)
2055  std::cout << "errB_HB depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2056  if (!h1 || !h0) {
2057  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2058  ptext->AddText("Missing histo");
2059  if (!h1) {
2060  std::cout << "\tfailed to get " << hname1 << "\n";
2061  ptext->AddText(hname1);
2062  }
2063  if (!h0) {
2064  std::cout << "\tfailed to get " << hname0 << "\n";
2065  ptext->AddText(hname0);
2066  }
2067  ptext->Draw();
2068  } else {
2069  gPad->SetGridx();
2070  gPad->SetGridy();
2071  // gPad->SetLogy();
2072  hRate2orig = (TH1F *)h1->Clone(Form("Rate2orig_%d", depth));
2073  hRate2orig->Divide(h1, h0, 1, 1, "B");
2074 
2075  TH1F *hRate2 = NULL;
2076  if (lastLumiBin_HB > 1) {
2077  if (!copyContents(&hRate2, Form("Rate2_%d", depth), "", hRate2orig, lastLumiBin_HB)) {
2078  std::cout << "code failed" << std::endl;
2079  gSystem->Exit(1);
2080  }
2081  } else
2082  hRate2 = hRate2orig;
2083 
2084  hRate2->SetTitle(Form("Depth %d \b", depth));
2085  hRate2->SetMarkerStyle(20);
2086  hRate2->SetMarkerSize(0.8);
2087  // hRate2->GetZaxis()->SetLabelSize(0.04);
2088  hRate2->SetXTitle(Form("<ErrorB>(ev.in LS & ch.) - HB depth%d - iLS \b", depth));
2089  hRate2->SetMarkerColor(2);
2090  hRate2->SetLineColor(0);
2091  hRate2->Draw("Error");
2092 
2093  if (LSofFirstErrB_HB == -1) {
2094  int nx = hRate2->GetXaxis()->GetNbins();
2095  for (int i = 1; i <= nx; i++) {
2096  double ccc1 = hRate2->GetBinContent(i);
2097  if (ccc1 > 0.) {
2098  cout << "****************>>>>>>>>>>> ErrB_HB bad LS start at iLS = " << i << " with rate = " << ccc1
2099  << endl;
2100  LSofFirstErrB_HB = i;
2101  break;
2102  }
2103  }
2104  }
2105 
2106  delete h1;
2107  delete h0;
2108  if (hRate2 != hRate2orig) {
2109  delete hRate2orig;
2110  hRate2orig = hRate2;
2111  }
2112  }
2113 
2114  cHB->Update();
2115  cHB->Print(Form("HistErrB_HB_%d.png", depth));
2116  cHB->Clear();
2117  if (h2Cefz6)
2118  delete h2Cefz6;
2119  if (hRate2orig)
2120  delete hRate2orig;
2121  }
2122  } // ErrorsB in HB
2123 
2124  //====================================================================== HE :
2125  //====================================================================== HE :
2126  //====================================================================== HE :
2127  // Special test of errors type A and B in HE
2128  // AZ 08.02.2016
2129 
2130  int flagErrAB_HE[2];
2131  flagErrAB_HE[0] = -1;
2132  flagErrAB_HE[1] = -1;
2133  double avedelta_HE = 0.;
2134  int lastLumiBin_HE = -1;
2135  int LSofFirstErrB_HE = -1;
2136  {
2137  const int specCountA = 4;
2138  const int specColors[specCountA] = {1, 2, 3, 4};
2139  const TString hnames[specCountA][2] = {{"h_sumADCAmplperLS3_P1", "h_sum0ADCAmplperLS3_P1"},
2140  {"h_sumADCAmplperLS3_P2", "h_sum0ADCAmplperLS3_P2"},
2141  {"h_sumADCAmplperLS3_M1", "h_sum0ADCAmplperLS3_M1"},
2142  {"h_sumADCAmplperLS3_M2", "h_sum0ADCAmplperLS3_M2"}};
2143 
2144  std::vector<TH1F *> hV;
2145  THStack *hs = new THStack("hs", "ADCAmplerLS1");
2146  cHB->Clear();
2147  // cHB->cd();
2148  cHB->Divide(2, 1);
2149  cHB->cd(1);
2150 
2152  for (int i = 0; i < specCountA; i++) {
2153  if (1)
2154  std::cout << "debugger: errA_HE : get histos for i=" << i << " " << hnames[i][0] << " and " << hnames[i][1]
2155  << "\n";
2156  TH1F *h1 = (TH1F *)dir->FindObjectAny(hnames[i][0]);
2157  TH1F *h0 = (TH1F *)dir->FindObjectAny(hnames[i][1]);
2158  if (!h1 || !h0) {
2159  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2160  ptext->AddText("Missing histo");
2161  if (!h1) {
2162  std::cout << "\tfailed to get " << hnames[i][0] << "\n";
2163  ptext->AddText(hnames[i][0]);
2164  }
2165  if (!h0) {
2166  std::cout << "\tfailed to get " << hnames[i][1] << "\n";
2167  ptext->AddText(hnames[i][1]);
2168  }
2169  ptext->Draw();
2170  continue;
2171  }
2172  TH1F *hERT1orig = (TH1F *)h1->Clone(Form("ERT1orig_%d", i));
2173  hERT1orig->Divide(h1, h0, 1, 1, "B");
2174 
2175  if ((lastLumiBin_HE < 0) && (i == 0)) {
2176  for (int ibin = hERT1orig->GetNbinsX(); ibin >= 1; ibin--) {
2177  if (hERT1orig->GetBinContent(ibin) == 0)
2178  lastLumiBin_HE = ibin;
2179  else
2180  break;
2181  }
2182  lastLumiBin_HE += 3; // show more bins
2183  if (lastLumiBin_HE >= hERT1orig->GetNbinsX())
2184  lastLumiBin_HE = -1;
2185  }
2186  TH1F *hERT1 = NULL;
2187  if (lastLumiBin_HE > 1) {
2188  if (!copyContents(&hERT1, Form("ERT1_%d", i), "", hERT1orig, lastLumiBin_HE)) {
2189  std::cout << "code failed" << std::endl;
2190  gSystem->Exit(1);
2191  }
2192  } else
2193  hERT1 = hERT1orig;
2194 
2195  hERT1->GetXaxis()->SetTitle("<ADCAmpl> per LS HE: black-P1, red-P2,green-M1,blue-M2");
2196  hV.push_back(hERT1);
2197  hERT1->SetMarkerStyle(20);
2198  hERT1->SetMarkerSize(0.4);
2199  hERT1->SetXTitle("<A>(ev.in LS & ch.) - HE P1 - iLS \b");
2200  hERT1->SetMarkerColor(specColors[i]);
2201  hERT1->SetLineColor(0);
2202  hs->Add(hERT1);
2203  delete h1;
2204  delete h0;
2205  if (hERT1 != hERT1orig)
2206  delete hERT1orig;
2207  }
2208  hs->Draw("LPE1 nostack");
2209  cHB->Update(); // activate the axes
2210  hs->GetXaxis()->SetTitle("<A> per LS: black-P1, red-P2,green-M1,blue-M2");
2211  hs->Draw("LPE1 nostack");
2212  gPad->SetGridy();
2214 
2215  // AZ corrections 08.02.2016
2216  cHB->cd(2);
2217  TH1F *diff = new TH1F("diff", "", 100, 0., 4.);
2218 
2219  if (int(hV.size()) == specCountA) {
2220  flagErrAB_HE[0] = 0; // If we have the expected number of histograms, set the flag
2221  double sumdelta = 0.;
2222  int nnndelta = 0;
2223  for (int ibin = 1; ibin <= hV[0]->GetNbinsX(); ibin++) {
2224  double delta = 0.;
2225  double maxdelta = 0.;
2226  for (unsigned int i = 0; i < hV.size(); i++) {
2227  const TH1F *hi = hV[i];
2228  for (unsigned int j = 1; j < hV.size(); j++) {
2229  const TH1F *hj = hV[j];
2230  delta = fabs(hi->GetBinContent(ibin) - hj->GetBinContent(ibin));
2231  if (delta > maxdelta)
2232  maxdelta = delta;
2233  } //for
2234  } //for
2235  if (maxdelta > 0.) {
2236  diff->Fill(maxdelta);
2237  sumdelta += maxdelta;
2238  nnndelta++;
2239  }
2240  } //for ibin
2241  // avedelta_HE = sumdelta/hV[0]->GetNbinsX();
2242  avedelta_HE = sumdelta / nnndelta;
2243  std::cout << "******************>>>>>> ErrA_HE: avedelta_HE = " << avedelta_HE << std::endl;
2244  if (avedelta_HE > 1.1 || (avedelta_HE < 0.5 && avedelta_HE > 0.)) {
2245  flagErrAB_HE[0] = 1;
2246  } //if
2247  } //hV.size
2248  diff->SetMarkerStyle(20);
2249  diff->SetMarkerSize(0.8);
2250  diff->SetXTitle("max difference \b");
2251  diff->SetMarkerColor(2);
2252  diff->SetLineColor(0);
2253  gPad->SetGridx();
2254  gPad->SetLogy();
2255  diff->Draw("Error");
2257  cHB->Update();
2258  cHB->Print("HistErrA_HE.png");
2259  cHB->Clear();
2261 
2262  // clean-up
2263  if (diff)
2264  delete diff;
2265  for (unsigned int i = 0; i < hV.size(); i++)
2266  delete hV[i];
2267  } // ErrorA in HE
2268 
2270 
2271  { // errors type B
2272  const int specCountB = 6;
2273  const TString hnames[specCountB][2] = {{"h_2DsumErrorBLS3", "h_2D0sumErrorBLS3"},
2274  {"h_sumErrorBperLS3", "h_sum0ErrorBperLS3"},
2275  {"h_2DsumErrorBLS4", "h_2D0sumErrorBLS4"},
2276  {"h_sumErrorBperLS4", "h_sum0ErrorBperLS4"},
2277  {"h_2DsumErrorBLS5", "h_2D0sumErrorBLS5"},
2278  {"h_sumErrorBperLS5", "h_sum0ErrorBperLS5"}};
2279 
2280  for (int depth = 1; depth <= 3; depth++) {
2281  cHB->Clear();
2282  cHB->Divide(2, 1);
2283  cHB->cd(1);
2284 
2285  TH1F *hRate2orig = NULL;
2286  TH2F *h2Cefz6 = NULL;
2287  TString hname1 = hnames[2 * depth - 2][0];
2288  TString hname0 = hnames[2 * depth - 2][1];
2289  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
2290  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
2291  if (1)
2292  std::cout << "debugger: errB_HE depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2293  if (!twod1 || !twod0) {
2294  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2295  ptext->AddText("Missing histos");
2296  if (!twod1) {
2297  std::cout << "\tfailed to get " << hname1 << "\n";
2298  ptext->AddText(hname1);
2299  }
2300  if (!twod0) {
2301  std::cout << "\tfailed to get " << hname0 << "\n";
2302  ptext->AddText(hname0);
2303  }
2304  ptext->Draw();
2305  } else {
2306  h2Cefz6 = (TH2F *)twod1->Clone(Form("Cefz6_%d", depth));
2307  h2Cefz6->SetTitle(Form("HE Depth %d \b", depth));
2308  h2Cefz6->Divide(twod1, twod0, 1, 1, "B");
2309 
2310  gPad->SetGridy();
2311  gPad->SetGridx();
2312  gPad->SetLogz();
2313  h2Cefz6->SetTitle(Form("Depth %d \b", depth));
2314  h2Cefz6->SetMarkerStyle(20);
2315  h2Cefz6->SetMarkerSize(0.4);
2316  // h2Cefz6->GetZaxis()->SetLabelSize(0.04);
2317  h2Cefz6->SetXTitle("#eta \b");
2318  h2Cefz6->SetYTitle("#phi \b");
2319  h2Cefz6->SetZTitle(Form("<ErrorB> - HE Depth%d \b", depth));
2320  h2Cefz6->SetMarkerColor(2);
2321  h2Cefz6->SetLineColor(2);
2322  h2Cefz6->Draw("COLZ");
2323 
2324  delete twod1;
2325  delete twod0;
2326  } // histos ok
2327 
2328  cHB->cd(2);
2329  hname1 = hnames[2 * depth - 1][0];
2330  hname0 = hnames[2 * depth - 1][1];
2331  TH1F *h1 = (TH1F *)dir->FindObjectAny(hname1);
2332  TH1F *h0 = (TH1F *)dir->FindObjectAny(hname0);
2333  if (1)
2334  std::cout << "errB_HE depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2335  if (!h1 || !h0) {
2336  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2337  ptext->AddText("Missing histo");
2338  if (!h1) {
2339  std::cout << "\tfailed to get " << hname1 << "\n";
2340  ptext->AddText(hname1);
2341  }
2342  if (!h0) {
2343  std::cout << "\tfailed to get " << hname0 << "\n";
2344  ptext->AddText(hname0);
2345  }
2346  ptext->Draw();
2347  } else {
2348  gPad->SetGridx();
2349  gPad->SetGridy();
2350  // gPad->SetLogy();
2351  hRate2orig = (TH1F *)h1->Clone(Form("Rate2orig_%d", depth));
2352  hRate2orig->Divide(h1, h0, 1, 1, "B");
2353 
2354  TH1F *hRate2 = NULL;
2355  if (lastLumiBin_HE > 1) {
2356  if (!copyContents(&hRate2, Form("Rate2_%d", depth), "", hRate2orig, lastLumiBin_HE)) {
2357  std::cout << "code failed" << std::endl;
2358  gSystem->Exit(1);
2359  }
2360  } else
2361  hRate2 = hRate2orig;
2362 
2363  hRate2->SetTitle(Form("Depth %d \b", depth));
2364  hRate2->SetMarkerStyle(20);
2365  hRate2->SetMarkerSize(0.8);
2366  // hRate2->GetZaxis()->SetLabelSize(0.04);
2367  hRate2->SetXTitle(Form("<ErrorB>(ev.in LS & ch.) - HE depth%d - iLS \b", depth));
2368  hRate2->SetMarkerColor(2);
2369  hRate2->SetLineColor(0);
2370  hRate2->Draw("Error");
2371 
2372  if (LSofFirstErrB_HE == -1) {
2373  int nx = hRate2->GetXaxis()->GetNbins();
2374  for (int i = 1; i <= nx; i++) {
2375  double ccc1 = hRate2->GetBinContent(i);
2376  if (ccc1 > 0.) {
2377  cout << "****************>>>>>>>>>>> ErrB_HE bad LS start at iLS = " << i << " with rate = " << ccc1
2378  << endl;
2379  LSofFirstErrB_HE = i;
2380  break;
2381  }
2382  }
2383  }
2384 
2385  delete h1;
2386  delete h0;
2387  if (hRate2 != hRate2orig) {
2388  delete hRate2orig;
2389  hRate2orig = hRate2;
2390  }
2391  }
2392 
2393  cHB->Update();
2394  cHB->Print(Form("HistErrB_HE_%d.png", depth));
2395  cHB->Clear();
2396  if (h2Cefz6)
2397  delete h2Cefz6;
2398  if (hRate2orig)
2399  delete hRate2orig;
2400  }
2401  } // ErrorsB in HE
2402 
2403  //====================================================================== HO :
2404  //====================================================================== HO :
2405  //====================================================================== HO :
2406  // Special test of errors type A and B in HO
2407  // AZ 08.02.2016
2408 
2409  int flagErrAB_HO[2];
2410  flagErrAB_HO[0] = -1;
2411  flagErrAB_HO[1] = -1;
2412  double avedelta_HO = 0.;
2413  int lastLumiBin_HO = -1;
2414  int LSofFirstErrB_HO = -1;
2415  {
2416  const int specCountA = 4;
2417  const int specColors[specCountA] = {1, 2, 3, 4};
2418  const TString hnames[specCountA][2] = {{"h_sumADCAmplperLS8_P1", "h_sum0ADCAmplperLS8_P1"},
2419  {"h_sumADCAmplperLS8_P2", "h_sum0ADCAmplperLS8_P2"},
2420  {"h_sumADCAmplperLS8_M1", "h_sum0ADCAmplperLS8_M1"},
2421  {"h_sumADCAmplperLS8_M2", "h_sum0ADCAmplperLS8_M2"}};
2422 
2423  std::vector<TH1F *> hV;
2424  THStack *hs = new THStack("hs", "ADCAmplerLS1");
2425  cHB->Clear();
2426  // cHB->cd();
2427  cHB->Divide(2, 1);
2428  cHB->cd(1);
2429 
2431  for (int i = 0; i < specCountA; i++) {
2432  if (1)
2433  std::cout << "debugger: errA_HO : get histos for i=" << i << " " << hnames[i][0] << " and " << hnames[i][1]
2434  << "\n";
2435  TH1F *h1 = (TH1F *)dir->FindObjectAny(hnames[i][0]);
2436  TH1F *h0 = (TH1F *)dir->FindObjectAny(hnames[i][1]);
2437  if (!h1 || !h0) {
2438  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2439  ptext->AddText("Missing histo");
2440  if (!h1) {
2441  std::cout << "\tfailed to get " << hnames[i][0] << "\n";
2442  ptext->AddText(hnames[i][0]);
2443  }
2444  if (!h0) {
2445  std::cout << "\tfailed to get " << hnames[i][1] << "\n";
2446  ptext->AddText(hnames[i][1]);
2447  }
2448  ptext->Draw();
2449  continue;
2450  }
2451  TH1F *hoRT1orig = (TH1F *)h1->Clone(Form("ERT1orig_%d", i));
2452  hoRT1orig->Divide(h1, h0, 1, 1, "B");
2453 
2454  if ((lastLumiBin_HO < 0) && (i == 0)) {
2455  for (int ibin = hoRT1orig->GetNbinsX(); ibin >= 1; ibin--) {
2456  if (hoRT1orig->GetBinContent(ibin) == 0)
2457  lastLumiBin_HO = ibin;
2458  else
2459  break;
2460  }
2461  lastLumiBin_HO += 3; // show more bins
2462  if (lastLumiBin_HO >= hoRT1orig->GetNbinsX())
2463  lastLumiBin_HO = -1;
2464  }
2465  TH1F *hoRT1 = NULL;
2466  if (lastLumiBin_HO > 1) {
2467  if (!copyContents(&hoRT1, Form("ERT1_%d", i), "", hoRT1orig, lastLumiBin_HO)) {
2468  std::cout << "code failed" << std::endl;
2469  gSystem->Exit(1);
2470  }
2471  } else
2472  hoRT1 = hoRT1orig;
2473 
2474  hoRT1->GetXaxis()->SetTitle("<ADCAmpl> per LS HO: black-P1, red-P2,green-M1,blue-M2");
2475  hV.push_back(hoRT1);
2476  hoRT1->SetMarkerStyle(20);
2477  hoRT1->SetMarkerSize(0.4);
2478  hoRT1->SetXTitle("<A>(ev.in LS & ch.) - HO P1 - iLS \b");
2479  hoRT1->SetMarkerColor(specColors[i]);
2480  hoRT1->SetLineColor(0);
2481  hs->Add(hoRT1);
2482  delete h1;
2483  delete h0;
2484  if (hoRT1 != hoRT1orig)
2485  delete hoRT1orig;
2486  }
2487  hs->Draw("LPE1 nostack");
2488  cHB->Update(); // activate tho axes
2489  hs->GetXaxis()->SetTitle("<A> per LS: black-P1, red-P2,green-M1,blue-M2");
2490  hs->Draw("LPE1 nostack");
2491  gPad->SetGridy();
2493 
2494  // AZ corrections 08.02.2016
2495  cHB->cd(2);
2496  TH1F *diff = new TH1F("diff", "", 100, 0., 4.);
2497 
2498  if (int(hV.size()) == specCountA) {
2499  flagErrAB_HO[0] = 0; // If we have tho expected number of histograms, set tho flag
2500  double sumdelta = 0.;
2501  int nnndelta = 0;
2502  for (int ibin = 1; ibin <= hV[0]->GetNbinsX(); ibin++) {
2503  double delta = 0.;
2504  double maxdelta = 0.;
2505  for (unsigned int i = 0; i < hV.size(); i++) {
2506  const TH1F *hi = hV[i];
2507  for (unsigned int j = 1; j < hV.size(); j++) {
2508  const TH1F *hj = hV[j];
2509  delta = fabs(hi->GetBinContent(ibin) - hj->GetBinContent(ibin));
2510  if (delta > maxdelta)
2511  maxdelta = delta;
2512  } //for
2513  } //for
2514  if (maxdelta > 0.) {
2515  diff->Fill(maxdelta);
2516  sumdelta += maxdelta;
2517  nnndelta++;
2518  }
2519  } //for ibin
2520  // avedelta_HO = sumdelta/hV[0]->GetNbinsX();
2521  avedelta_HO = sumdelta / nnndelta;
2522  std::cout << "******************>>>>>> ErrA_HO: avedelta_HO = " << avedelta_HO << std::endl;
2523  if (avedelta_HO > 0.8 || (avedelta_HO < 0.2 && avedelta_HO > 0.)) {
2524  flagErrAB_HO[0] = 1;
2525  } //if
2526  } //hV.size
2527  diff->SetMarkerStyle(20);
2528  diff->SetMarkerSize(0.8);
2529  diff->SetXTitle("max difference \b");
2530  diff->SetMarkerColor(2);
2531  diff->SetLineColor(0);
2532  gPad->SetGridx();
2533  gPad->SetLogy();
2534  diff->Draw("Error");
2536  cHB->Update();
2537  cHB->Print("HistErrA_HO.png");
2538  cHB->Clear();
2540 
2541  // clean-up
2542  if (diff)
2543  delete diff;
2544  for (unsigned int i = 0; i < hV.size(); i++)
2545  delete hV[i];
2546  } // ErrorA in HO
2547 
2549 
2550  { // errors type B
2551  const int specCountB = 2;
2552  const TString hnames[specCountB][2] = {{"h_2DsumErrorBLS8", "h_2D0sumErrorBLS8"},
2553  {"h_sumErrorBperLS8", "h_sum0ErrorBperLS8"}};
2554 
2555  for (int depth = 4; depth <= 4; depth++) {
2556  cHB->Clear();
2557  cHB->Divide(2, 1);
2558  cHB->cd(1);
2559 
2560  TH1F *hRate2orig = NULL;
2561  TH2F *h2Cefz6 = NULL;
2562  TString hname1 = hnames[2 * depth - 8][0];
2563  TString hname0 = hnames[2 * depth - 8][1];
2564  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
2565  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
2566  if (1)
2567  std::cout << "debugger: errB_HO depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2568  if (!twod1 || !twod0) {
2569  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2570  ptext->AddText("Missing histos");
2571  if (!twod1) {
2572  std::cout << "\tfailed to get " << hname1 << "\n";
2573  ptext->AddText(hname1);
2574  }
2575  if (!twod0) {
2576  std::cout << "\tfailed to get " << hname0 << "\n";
2577  ptext->AddText(hname0);
2578  }
2579  ptext->Draw();
2580  } else {
2581  h2Cefz6 = (TH2F *)twod1->Clone(Form("Cefz6_%d", depth));
2582  h2Cefz6->SetTitle(Form("HO Depth %d \b", depth));
2583  h2Cefz6->Divide(twod1, twod0, 1, 1, "B");
2584 
2585  gPad->SetGridy();
2586  gPad->SetGridx();
2587  gPad->SetLogz();
2588  h2Cefz6->SetTitle(Form("Depth %d \b", depth));
2589  h2Cefz6->SetMarkerStyle(20);
2590  h2Cefz6->SetMarkerSize(0.4);
2591  // h2Cefz6->GetZaxis()->SetLabelSize(0.04);
2592  h2Cefz6->SetXTitle("#eta \b");
2593  h2Cefz6->SetYTitle("#phi \b");
2594  h2Cefz6->SetZTitle(Form("<ErrorB> - HO Depth%d \b", depth));
2595  h2Cefz6->SetMarkerColor(2);
2596  h2Cefz6->SetLineColor(2);
2597  h2Cefz6->Draw("COLZ");
2598 
2599  delete twod1;
2600  delete twod0;
2601  } // histos ok
2602 
2603  cHB->cd(2);
2604  hname1 = hnames[2 * depth - 7][0];
2605  hname0 = hnames[2 * depth - 7][1];
2606  TH1F *h1 = (TH1F *)dir->FindObjectAny(hname1);
2607  TH1F *h0 = (TH1F *)dir->FindObjectAny(hname0);
2608  if (1)
2609  std::cout << "errB_HO depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2610  if (!h1 || !h0) {
2611  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2612  ptext->AddText("Missing histo");
2613  if (!h1) {
2614  std::cout << "\tfailed to get " << hname1 << "\n";
2615  ptext->AddText(hname1);
2616  }
2617  if (!h0) {
2618  std::cout << "\tfailed to get " << hname0 << "\n";
2619  ptext->AddText(hname0);
2620  }
2621  ptext->Draw();
2622  } else {
2623  gPad->SetGridx();
2624  gPad->SetGridy();
2625  // gPad->SetLogy();
2626  hRate2orig = (TH1F *)h1->Clone(Form("Rate2orig_%d", depth));
2627  hRate2orig->Divide(h1, h0, 1, 1, "B");
2628 
2629  TH1F *hRate2 = NULL;
2630  if (lastLumiBin_HO > 1) {
2631  if (!copyContents(&hRate2, Form("Rate2_%d", depth), "", hRate2orig, lastLumiBin_HO)) {
2632  std::cout << "code failed" << std::endl;
2633  gSystem->Exit(1);
2634  }
2635  } else
2636  hRate2 = hRate2orig;
2637 
2638  hRate2->SetTitle(Form("Depth %d \b", depth));
2639  hRate2->SetMarkerStyle(20);
2640  hRate2->SetMarkerSize(0.8);
2641  // hRate2->GetZaxis()->SetLabelSize(0.04);
2642  hRate2->SetXTitle(Form("<ErrorB>(ev.in LS & ch.) - HO depth%d - iLS \b", depth));
2643  hRate2->SetMarkerColor(2);
2644  hRate2->SetLineColor(0);
2645  hRate2->Draw("Error");
2646 
2647  if (LSofFirstErrB_HO == -1) {
2648  int nx = hRate2->GetXaxis()->GetNbins();
2649  for (int i = 1; i <= nx; i++) {
2650  double ccc1 = hRate2->GetBinContent(i);
2651  if (ccc1 > 0.) {
2652  cout << "****************>>>>>>>>>>> ErrB_HO bad LS start at iLS = " << i << " with rate = " << ccc1
2653  << endl;
2654  LSofFirstErrB_HO = i;
2655  break;
2656  }
2657  }
2658  }
2659 
2660  delete h1;
2661  delete h0;
2662  if (hRate2 != hRate2orig) {
2663  delete hRate2orig;
2664  hRate2orig = hRate2;
2665  }
2666  }
2667 
2668  cHB->Update();
2669  cHB->Print(Form("HistErrB_HO_%d.png", depth));
2670  cHB->Clear();
2671  if (h2Cefz6)
2672  delete h2Cefz6;
2673  if (hRate2orig)
2674  delete hRate2orig;
2675  }
2676  } // ErrorsB in HO
2677 
2678  //====================================================================== done by Andrius for HF:
2679  //====================================================================== done by Andrius for HF:
2680  //====================================================================== done by Andrius for HF:
2681  // Special test of errors type A and B in HF
2682 
2683  int flagErrAB_HF[2];
2684  flagErrAB_HF[0] = -1;
2685  flagErrAB_HF[1] = -1;
2686  double avedelta_HF = 0.;
2687  int lastLumiBin_HF = -1;
2688  int LSofFirstErrB_HF = -1;
2689  {
2690  const int specCountA = 4;
2691  const int specColors[specCountA] = {1, 2, 3, 4};
2692  const TString hnames[specCountA][2] = {{"h_sumADCAmplperLS6_P1", "h_sum0ADCAmplperLS6_P1"},
2693  {"h_sumADCAmplperLS6_P2", "h_sum0ADCAmplperLS6_P2"},
2694  {"h_sumADCAmplperLS6_M1", "h_sum0ADCAmplperLS6_M1"},
2695  {"h_sumADCAmplperLS6_M2", "h_sum0ADCAmplperLS6_M2"}};
2696 
2697  std::vector<TH1F *> hV;
2698  THStack *hs = new THStack("hs", "ADCAmplerLS6");
2699  cHB->Clear();
2700  // cHB->cd();
2701  cHB->Divide(2, 1);
2702  cHB->cd(1);
2703 
2705  for (int i = 0; i < specCountA; i++) {
2706  if (1)
2707  std::cout << "debugger: errA_HF : get histos for i=" << i << " " << hnames[i][0] << " and " << hnames[i][1]
2708  << "\n";
2709  TH1F *h1 = (TH1F *)dir->FindObjectAny(hnames[i][0]);
2710  TH1F *h0 = (TH1F *)dir->FindObjectAny(hnames[i][1]);
2711  if (!h1 || !h0) {
2712  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2713  ptext->AddText("Missing histo");
2714  if (!h1) {
2715  std::cout << "\tfailed to get " << hnames[i][0] << "\n";
2716  ptext->AddText(hnames[i][0]);
2717  }
2718  if (!h0) {
2719  std::cout << "\tfailed to get " << hnames[i][1] << "\n";
2720  ptext->AddText(hnames[i][1]);
2721  }
2722  ptext->Draw();
2723  continue;
2724  }
2725  TH1F *hERT1orig = (TH1F *)h1->Clone(Form("ERT1orig_%d", i));
2726  hERT1orig->Divide(h1, h0, 1, 1, "B");
2727 
2728  if ((lastLumiBin_HF < 0) && (i == 0)) {
2729  for (int ibin = hERT1orig->GetNbinsX(); ibin >= 1; ibin--) {
2730  if (hERT1orig->GetBinContent(ibin) == 0)
2731  lastLumiBin_HF = ibin;
2732  else
2733  break;
2734  }
2735  lastLumiBin_HF += 3; // show more bins
2736  if (lastLumiBin_HF >= hERT1orig->GetNbinsX())
2737  lastLumiBin_HF = -1;
2738  }
2739  TH1F *hERT1 = NULL;
2740  if (lastLumiBin_HF > 1) {
2741  if (!copyContents(&hERT1, Form("ERT1_%d", i), "", hERT1orig, lastLumiBin_HF)) {
2742  std::cout << "code failed" << std::endl;
2743  gSystem->Exit(1);
2744  }
2745  } else
2746  hERT1 = hERT1orig;
2747 
2748  hERT1->GetXaxis()->SetTitle("<ADCAmpl> per LS HF: black-P1, red-P2,green-M1,blue-M2");
2749  hV.push_back(hERT1);
2750  hERT1->SetMarkerStyle(20);
2751  hERT1->SetMarkerSize(0.4);
2752  hERT1->SetXTitle("<A>(ev.in LS & ch.) - HF P1 - iLS \b");
2753  hERT1->SetMarkerColor(specColors[i]);
2754  hERT1->SetLineColor(0);
2755  hs->Add(hERT1);
2756  delete h1;
2757  delete h0;
2758  if (hERT1 != hERT1orig)
2759  delete hERT1orig;
2760  }
2761  hs->Draw("LPE1 nostack");
2762  cHB->Update(); // activate the axes
2763  hs->GetXaxis()->SetTitle("<A> per LS: black-P1, red-P2,green-M1,blue-M2");
2764  hs->Draw("LPE1 nostack");
2765  gPad->SetGridy();
2767 
2768  // AZ corrections 04.02.2016
2769  cHB->cd(2);
2770  TH1F *diff = new TH1F("diff", "", 100, 0., 4.);
2771 
2772  if (int(hV.size()) == specCountA) {
2773  flagErrAB_HF[0] = 0; // If we have the expected number of histograms, set the flag
2774  double sumdelta = 0.;
2775  int nnndelta = 0;
2776  std::cout << "******** GetNbinsX = " << hV[0]->GetNbinsX() << std::endl;
2777  for (int ibin = 1; ibin <= hV[0]->GetNbinsX(); ibin++) {
2778  double delta = 0.;
2779  double maxdelta = 0.;
2780  for (unsigned int i = 0; i < hV.size(); i++) {
2781  const TH1F *hi = hV[i];
2782  for (unsigned int j = 1; j < hV.size(); j++) {
2783  const TH1F *hj = hV[j];
2784  delta = fabs(hi->GetBinContent(ibin) - hj->GetBinContent(ibin));
2785  if (delta > maxdelta)
2786  maxdelta = delta;
2787  } //for
2788  } //for
2789  // std::cout << "***** ibin = " << ibin << " nnndelta= " << nnndelta << " maxdelta= " << maxdelta <<std::endl;
2790  if (maxdelta > 0.) {
2791  diff->Fill(maxdelta);
2792  sumdelta += maxdelta;
2793  nnndelta++;
2794  }
2795  } //for ibin
2796  // avedelta_HF = sumdelta/hV[0]->GetNbinsX();
2797  avedelta_HF = sumdelta / nnndelta;
2798  // std::cout << "******************>>>>>> ErrA_HF: avedelta_HF = " << avedelta_HF << " Npoints for comparison= " << nnndelta <<std::endl;
2799  if (avedelta_HF > 2.4 || (avedelta_HF < 0.8 && avedelta_HF > 0.)) {
2800  flagErrAB_HF[0] = 1;
2801  } //if
2802  } //hV.size
2803  diff->SetMarkerStyle(20);
2804  diff->SetMarkerSize(0.8);
2805  diff->SetXTitle("max difference \b");
2806  diff->SetMarkerColor(2);
2807  diff->SetLineColor(0);
2808  gPad->SetGridx();
2809  gPad->SetLogy();
2810  diff->Draw("Error");
2812  cHB->Update();
2813  cHB->Print("HistErrA_HF.png");
2814  cHB->Clear();
2816  // clean-up
2817  if (diff)
2818  delete diff;
2819  for (unsigned int i = 0; i < hV.size(); i++)
2820  delete hV[i];
2821  } // ErrorA in HF
2824  { // errors type B
2825  const int specCountB = 4;
2826  const TString hnames[specCountB][2] = {{"h_2DsumErrorBLS6", "h_2D0sumErrorBLS6"},
2827  {"h_sumErrorBperLS6", "h_sum0ErrorBperLS6"},
2828  {"h_2DsumErrorBLS7", "h_2D0sumErrorBLS7"},
2829  {"h_sumErrorBperLS7", "h_sum0ErrorBperLS7"}};
2830 
2831  for (int depth = 1; depth <= 2; depth++) {
2832  cHB->Clear();
2833  cHB->Divide(2, 1);
2834  cHB->cd(1);
2835  TH1F *hRate2orig = NULL;
2836  TH2F *h2Cefz6 = NULL;
2837  TString hname1 = hnames[2 * depth - 2][0];
2838  TString hname0 = hnames[2 * depth - 2][1];
2839  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
2840  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
2841  if (1)
2842  std::cout << "debugger: errB_HF depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2843  if (!twod1 || !twod0) {
2844  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2845  ptext->AddText("Missing histos");
2846  if (!twod1) {
2847  std::cout << "\tfailed to get " << hname1 << "\n";
2848  ptext->AddText(hname1);
2849  }
2850  if (!twod0) {
2851  std::cout << "\tfailed to get " << hname0 << "\n";
2852  ptext->AddText(hname0);
2853  }
2854  ptext->Draw();
2855  } else {
2856  h2Cefz6 = (TH2F *)twod1->Clone(Form("Cefz6_%d", depth));
2857  h2Cefz6->SetTitle(Form("HF Depth %d \b", depth));
2858  h2Cefz6->Divide(twod1, twod0, 1, 1, "B");
2859 
2860  gPad->SetGridy();
2861  gPad->SetGridx();
2862  gPad->SetLogz();
2863  h2Cefz6->SetTitle(Form("Depth %d \b", depth));
2864  h2Cefz6->SetMarkerStyle(20);
2865  h2Cefz6->SetMarkerSize(0.4);
2866  // h2Cefz6->GetZaxis()->SetLabelSize(0.04);
2867  h2Cefz6->SetXTitle("#eta \b");
2868  h2Cefz6->SetYTitle("#phi \b");
2869  h2Cefz6->SetZTitle(Form("<ErrorB> - HF Depth%d \b", depth));
2870  h2Cefz6->SetMarkerColor(2);
2871  h2Cefz6->SetLineColor(2);
2872  h2Cefz6->Draw("COLZ");
2873  delete twod1;
2874  delete twod0;
2875  } // histos ok
2876  cHB->cd(2);
2877  hname1 = hnames[2 * depth - 1][0];
2878  hname0 = hnames[2 * depth - 1][1];
2879  TH1F *h1 = (TH1F *)dir->FindObjectAny(hname1);
2880  TH1F *h0 = (TH1F *)dir->FindObjectAny(hname0);
2881  if (1)
2882  std::cout << "errB_HF depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2883  if (!h1 || !h0) {
2884  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2885  ptext->AddText("Missing histo");
2886  if (!h1) {
2887  std::cout << "\tfailed to get " << hname1 << "\n";
2888  ptext->AddText(hname1);
2889  }
2890  if (!h0) {
2891  std::cout << "\tfailed to get " << hname0 << "\n";
2892  ptext->AddText(hname0);
2893  }
2894  ptext->Draw();
2895  } else {
2896  gPad->SetGridx();
2897  gPad->SetGridy();
2898  // gPad->SetLogy();
2899  hRate2orig = (TH1F *)h1->Clone(Form("Rate2orig_%d", depth));
2900  hRate2orig->Divide(h1, h0, 1, 1, "B");
2901 
2902  TH1F *hRate2 = NULL;
2903  if (lastLumiBin_HF > 1) {
2904  if (!copyContents(&hRate2, Form("Rate2_%d", depth), "", hRate2orig, lastLumiBin_HF)) {
2905  std::cout << "code failed" << std::endl;
2906  gSystem->Exit(1);
2907  }
2908  } else
2909  hRate2 = hRate2orig;
2910  hRate2->SetTitle(Form("Depth %d \b", depth));
2911  hRate2->SetMarkerStyle(20);
2912  hRate2->SetMarkerSize(0.8);
2913  // hRate2->GetZaxis()->SetLabelSize(0.04);
2914  hRate2->SetXTitle(Form("<ErrorB>(ev.in LS & ch.) - HF depth%d - iLS \b", depth));
2915  hRate2->SetMarkerColor(2);
2916  hRate2->SetLineColor(0);
2917  hRate2->Draw("Error");
2918  if (LSofFirstErrB_HF == -1) {
2919  int nx = hRate2->GetXaxis()->GetNbins();
2920  for (int i = 1; i <= nx; i++) {
2921  double ccc1 = hRate2->GetBinContent(i);
2922  if (ccc1 > 0.) {
2923  cout << "****************>>>>>>>>>>> ErrB_HF bad LS start at iLS = " << i << " with rate = " << ccc1
2924  << endl;
2925  LSofFirstErrB_HF = i;
2926  break;
2927  }
2928  }
2929  }
2930  delete h1;
2931  delete h0;
2932  if (hRate2 != hRate2orig) {
2933  delete hRate2orig;
2934  hRate2orig = hRate2;
2935  }
2936  }
2937  cHB->Update();
2938  cHB->Print(Form("HistErrB_HF_%d.png", depth));
2939  cHB->Clear();
2940  if (h2Cefz6)
2941  delete h2Cefz6;
2942  if (hRate2orig)
2943  delete hRate2orig;
2944  }
2945  } // ErrorsB in HF
2946 
2948 
2949  //=============================================================================== err A HB
2951  // For 2D and 1D plots with Amplitude. Produces ChkErrA_HBx.png
2952 
2953  for (int depth = 1; depth <= 2; depth++) {
2954  TH2F *h2Ceff = NULL;
2955  TH2F *h2Diffe = NULL;
2956  // TH1F* h1diffADCAmpl= NULL;
2957  TH2F *h3Ceff = NULL;
2958 
2959  cHE->Clear();
2960  cHE->Divide(3, 1);
2961 
2962  cHE->cd(1);
2963  // h_mapDepth1ADCAmpl_HB div h_mapDepth1_HB
2964  TString hname1 = Form("h_mapDepth%dADCAmpl_HB", depth);
2965  TString hname0 = Form("h_mapDepth%d_HB", depth);
2966  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
2967  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
2968  if (!twod1 || !twod0) {
2969  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2970  ptext->AddText("Missing histo");
2971  std::cout << "specHB test: failed to load " << hname1 << " and/or " << hname0 << "\n";
2972  if (!twod1)
2973  ptext->AddText(hname1);
2974  if (!twod0)
2975  ptext->AddText(hname0);
2976  ptext->Draw();
2977  continue;
2978  } else {
2979  // To IDENTIFY: see color different bins in eta-phi space
2980  h2Ceff = (TH2F *)twod1->Clone(Form("Ceff_HB%d", depth));
2981  h2Ceff->SetTitle(Form("HB Depth %d. (No cut) \b", depth));
2982  h2Ceff->Divide(twod1, twod0, 1, 1, "B");
2983 
2984  gPad->SetGridy();
2985  gPad->SetGridx();
2986  gPad->SetLogz();
2987  h2Ceff->SetMarkerStyle(20);
2988  h2Ceff->SetMarkerSize(0.4);
2989  //h2Ceff->GetZaxis()->SetLabelSize(0.08);
2990  h2Ceff->SetXTitle("#eta \b");
2991  h2Ceff->SetYTitle("#phi \b");
2992  h2Ceff->SetZTitle("h_mapDepth1ADCAmpl_HB \b");
2993  h2Ceff->SetMarkerColor(2);
2994  h2Ceff->SetLineColor(2);
2995  h2Ceff->Draw("COLZ");
2996  }
2997 
2998  cHE->cd(2);
3000  if (h2Ceff) {
3001  // TO IDENTIFY: see red bins in eta-phi space
3002  h2Diffe = (TH2F *)h2Ceff->Clone(Form("Diffe_Depth%d_HB", depth));
3003  h2Diffe->SetTitle(Form("HB Depth %d. Cut avg(ADCAmpl) > 25 \b", depth));
3004  int nx = h2Ceff->GetXaxis()->GetNbins();
3005  int ny = h2Ceff->GetYaxis()->GetNbins();
3006  for (int i = 1; i <= nx; i++) {
3007  for (int j = 1; j <= ny; j++) {
3008  double ccc1 = h2Ceff->GetBinContent(i, j);
3009  h2Diffe->SetBinContent(i, j, 0.);
3010  if (ccc1 > 25.)
3011  h2Diffe->SetBinContent(i, j, ccc1);
3012  }
3013  }
3014  gPad->SetGridy();
3015  gPad->SetGridx();
3016  gPad->SetLogz();
3017  h2Diffe->SetMarkerStyle(20);
3018  h2Diffe->SetMarkerSize(0.4);
3019  //h2Diffe->GetZaxis()->SetLabelSize(0.08);
3020  h2Diffe->SetXTitle("#eta \b");
3021  h2Diffe->SetYTitle("#phi \b");
3022  h2Diffe->SetZTitle("<ADCAmpl> bigger 25.- HB Depth1 \b");
3023  h2Diffe->SetMarkerColor(2);
3024  h2Diffe->SetLineColor(2);
3025  h2Diffe->Draw("COLZ");
3026  }
3027 
3028  cHE->cd(3);
3029  TString hname3 = Form("h_mapDepth%dADCAmpl225Copy_HB", depth);
3030  TH2F *twod3 = (TH2F *)dir->FindObjectAny(hname3);
3031  if (!twod3 || !twod0) {
3032  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3033  ptext->AddText("Missing histo");
3034  std::cout << "specHB test: failed to load " << hname3 << " and/or " << hname0 << "\n";
3035  if (!twod3)
3036  ptext->AddText(hname3);
3037  if (!twod0)
3038  ptext->AddText(hname0);
3039  ptext->Draw();
3040  continue;
3041  } else {
3042  // To IDENTIFY: see color different bins in eta-phi space
3043  h3Ceff = (TH2F *)twod3->Clone(Form("CeffA_HB%d", depth));
3044  h3Ceff->SetTitle(Form("HB Depth %d. \b", depth));
3045  h3Ceff->Divide(twod3, twod0, 1, 1, "B");
3046  gPad->SetGridy();
3047  gPad->SetGridx();
3048  gPad->SetLogz();
3049  h3Ceff->SetMarkerStyle(20);
3050  h3Ceff->SetMarkerSize(0.4);
3051  // h3Ceff->GetZaxis()->SetLabelSize(0.08);
3052  h3Ceff->SetXTitle("#eta \b");
3053  h3Ceff->SetYTitle("#phi \b");
3054  h3Ceff->SetZTitle("rate for channels of HB \b");
3055  h3Ceff->SetMarkerColor(2);
3056  h3Ceff->SetLineColor(2);
3057  h3Ceff->Draw("COLZ");
3058  }
3059 
3060  cHE->Update();
3061  cHE->Print(Form("ChkErrA_HB%d.png", depth));
3062  cHE->Clear();
3063 
3064  if (h2Ceff)
3065  delete h2Ceff;
3066  if (h2Diffe)
3067  delete h2Diffe;
3068  // if (h1diffADCAmpl) delete h1diffADCAmpl;
3069  // if (twod0) delete twod0;// do not delete - sometimes causes trouble later
3070  if (twod1)
3071  delete twod1;
3072  if (twod3)
3073  delete twod3;
3074  if (h3Ceff)
3075  delete h3Ceff;
3076  } // depth
3077 
3078  //=============================================================================== err A HE
3080  // For 2D and 1D plots with Amplitude. Produces ChkErrA_HEx.png
3081 
3082  for (int depth = 1; depth <= 3; depth++) {
3083  TH2F *h2Ceff = NULL;
3084  TH2F *h2Diffe = NULL;
3085  // TH1F* h1diffADCAmpl= NULL;
3086  TH2F *h3Ceff = NULL;
3087 
3088  cHE->Clear();
3089  cHE->Divide(3, 1);
3090 
3091  cHE->cd(1);
3092  // h_mapDepth1ADCAmpl_HE div h_mapDepth1_HE
3093  TString hname1 = Form("h_mapDepth%dADCAmpl_HE", depth);
3094  TString hname0 = Form("h_mapDepth%d_HE", depth);
3095  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
3096  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
3097  if (!twod1 || !twod0) {
3098  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3099  ptext->AddText("Missing histo");
3100  std::cout << "specHE test: failed to load " << hname1 << " and/or " << hname0 << "\n";
3101  if (!twod1)
3102  ptext->AddText(hname1);
3103  if (!twod0)
3104  ptext->AddText(hname0);
3105  ptext->Draw();
3106  continue;
3107  } else {
3108  // To IDENTIFY: see color different bins in eta-phi space
3109  h2Ceff = (TH2F *)twod1->Clone(Form("Ceff_HE%d", depth));
3110  h2Ceff->SetTitle(Form("HE Depth %d. (No cut) \b", depth));
3111  h2Ceff->Divide(twod1, twod0, 1, 1, "B");
3112 
3113  gPad->SetGridy();
3114  gPad->SetGridx();
3115  gPad->SetLogz();
3116  h2Ceff->SetTitleOffset(0.75, "Z");
3117  h2Ceff->SetMarkerStyle(20);
3118  h2Ceff->SetMarkerSize(0.4);
3119  //h2Ceff->GetZaxis()->SetLabelSize(0.08);
3120  h2Ceff->SetXTitle("#eta \b");
3121  h2Ceff->SetYTitle("#phi \b");
3122  h2Ceff->SetZTitle("h_mapDepth1ADCAmpl_HE \b");
3123  h2Ceff->SetMarkerColor(2);
3124  h2Ceff->SetLineColor(2);
3125  h2Ceff->Draw("COLZ");
3126  }
3127 
3128  cHE->cd(2);
3130  if (h2Ceff) {
3131  // TO IDENTIFY: see red bins in eta-phi space
3132  h2Diffe = (TH2F *)h2Ceff->Clone(Form("Diffe_Depth%d_HE", depth));
3133  h2Diffe->SetTitle(Form("HE Depth %d. Cut avg(ADCAmpl) > 1000 fC \b", depth));
3134  int nx = h2Ceff->GetXaxis()->GetNbins();
3135  int ny = h2Ceff->GetYaxis()->GetNbins();
3136  for (int i = 1; i <= nx; i++) {
3137  for (int j = 1; j <= ny; j++) {
3138  double ccc1 = h2Ceff->GetBinContent(i, j);
3139  h2Diffe->SetBinContent(i, j, 0.);
3140  if (ccc1 > 1000.)
3141  h2Diffe->SetBinContent(i, j, ccc1);
3142  }
3143  }
3144  gPad->SetGridy();
3145  gPad->SetGridx();
3146  gPad->SetLogz();
3147  h2Diffe->SetMarkerStyle(20);
3148  h2Diffe->SetMarkerSize(0.4);
3149  //h2Diffe->GetZaxis()->SetLabelSize(0.08);
3150  h2Diffe->SetXTitle("#eta \b");
3151  h2Diffe->SetYTitle("#phi \b");
3152  h2Diffe->SetZTitle("<ADCAmpl> bigger 1000.fC - HE Depth1 \b");
3153  h2Diffe->SetMarkerColor(2);
3154  h2Diffe->SetLineColor(2);
3155  h2Diffe->Draw("COLZ");
3156  }
3157 
3158  cHE->cd(3);
3159  TString hname3 = Form("h_mapDepth%dADCAmpl225Copy_HE", depth);
3160  TH2F *twod3 = (TH2F *)dir->FindObjectAny(hname3);
3161  if (!twod3 || !twod0) {
3162  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3163  ptext->AddText("Missing histo");
3164  std::cout << "specHE test: failed to load " << hname3 << " and/or " << hname0 << "\n";
3165  if (!twod3)
3166  ptext->AddText(hname3);
3167  if (!twod0)
3168  ptext->AddText(hname0);
3169  ptext->Draw();
3170  continue;
3171  } else {
3172  // To IDENTIFY: see color different bins in eta-phi space
3173  h3Ceff = (TH2F *)twod3->Clone(Form("CeffA_HE%d", depth));
3174  h3Ceff->SetTitle(Form("HE Depth %d. \b", depth));
3175  h3Ceff->Divide(twod3, twod0, 1, 1, "B");
3176  gPad->SetGridy();
3177  gPad->SetGridx();
3178  gPad->SetLogz();
3179  h3Ceff->SetMarkerStyle(20);
3180  h3Ceff->SetMarkerSize(0.4);
3181  // h3Ceff->GetZaxis()->SetLabelSize(0.08);
3182  h3Ceff->SetXTitle("#eta \b");
3183  h3Ceff->SetYTitle("#phi \b");
3184  h3Ceff->SetZTitle("rate for channels of HE \b");
3185  h3Ceff->SetMarkerColor(2);
3186  h3Ceff->SetLineColor(2);
3187  h3Ceff->Draw("COLZ");
3188  }
3189 
3190  cHE->Update();
3191  cHE->Print(Form("ChkErrA_HE%d.png", depth));
3192  cHE->Clear();
3193 
3194  if (h2Ceff)
3195  delete h2Ceff;
3196  if (h2Diffe)
3197  delete h2Diffe;
3198  // if (h1diffADCAmpl) delete h1diffADCAmpl;
3199  // if (twod0) delete twod0;// do not delete - sometimes causes trouble later
3200  if (twod1)
3201  delete twod1;
3202  if (twod3)
3203  delete twod3;
3204  if (h3Ceff)
3205  delete h3Ceff;
3206  } // depth
3207 
3208  //=============================================================================== err A HO
3210  // For 2D and 1D plots with Amplitude. Produces ChkErrA_HOx.png
3211 
3212  for (int depth = 4; depth <= 4; depth++) {
3213  TH2F *h2Ceff = NULL;
3214  TH2F *h2Diffe = NULL;
3215  // TH1F* h1diffADCAmpl= NULL;
3216  TH2F *h3Ceff = NULL;
3217 
3218  cHE->Clear();
3219  cHE->Divide(3, 1);
3220 
3221  cHE->cd(1);
3222  // h_mapDepth1ADCAmpl_HO div h_mapDepth1_HO
3223  TString hname1 = Form("h_mapDepth%dADCAmpl_HO", depth);
3224  TString hname0 = Form("h_mapDepth%d_HO", depth);
3225  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
3226  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
3227  if (!twod1 || !twod0) {
3228  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3229  ptext->AddText("Missing histo");
3230  std::cout << "specHO test: failed to load " << hname1 << " and/or " << hname0 << "\n";
3231  if (!twod1)
3232  ptext->AddText(hname1);
3233  if (!twod0)
3234  ptext->AddText(hname0);
3235  ptext->Draw();
3236  continue;
3237  } else {
3238  // To IDENTIFY: see color different bins in eta-phi space
3239  h2Ceff = (TH2F *)twod1->Clone(Form("Ceff_HO%d", depth));
3240  h2Ceff->SetTitle(Form("HO Depth %d. (No cut) \b", depth));
3241  h2Ceff->Divide(twod1, twod0, 1, 1, "B");
3242 
3243  gPad->SetGridy();
3244  gPad->SetGridx();
3245  gPad->SetLogz();
3246  h2Ceff->SetMarkerStyle(20);
3247  h2Ceff->SetMarkerSize(0.4);
3248  //h2Ceff->GetZaxis()->SetLabelSize(0.08);
3249  h2Ceff->SetXTitle("#eta \b");
3250  h2Ceff->SetYTitle("#phi \b");
3251  h2Ceff->SetZTitle("h_mapDepth1ADCAmpl_HO \b");
3252  h2Ceff->SetMarkerColor(2);
3253  h2Ceff->SetLineColor(2);
3254  h2Ceff->Draw("COLZ");
3255  }
3256 
3257  cHE->cd(2);
3259  if (h2Ceff) {
3260  // TO IDENTIFY: see red bins in eta-phi space (applied cut on Aij: <20 || >3000
3261  h2Diffe = (TH2F *)h2Ceff->Clone(Form("Diffe_Depth%d_HO", depth));
3262  h2Diffe->SetTitle(Form("HO Depth %d. Cut avg(ADCAmpl) > 80 \b", depth));
3263  int nx = h2Ceff->GetXaxis()->GetNbins();
3264  int ny = h2Ceff->GetYaxis()->GetNbins();
3265  for (int i = 1; i <= nx; i++) {
3266  for (int j = 1; j <= ny; j++) {
3267  double ccc1 = h2Ceff->GetBinContent(i, j);
3268  h2Diffe->SetBinContent(i, j, 0.);
3269  if (ccc1 > 20.)
3270  h2Diffe->SetBinContent(i, j, ccc1);
3271  }
3272  }
3273  gPad->SetGridy();
3274  gPad->SetGridx();
3275  gPad->SetLogz();
3276  h2Diffe->SetMarkerStyle(20);
3277  h2Diffe->SetMarkerSize(0.4);
3278  //h2Diffe->GetZaxis()->SetLabelSize(0.08);
3279  h2Diffe->SetXTitle("#eta \b");
3280  h2Diffe->SetYTitle("#phi \b");
3281  h2Diffe->SetZTitle("<ADCAmpl> bigger 80.- HO Depth1 \b");
3282  h2Diffe->SetMarkerColor(2);
3283  h2Diffe->SetLineColor(2);
3284  h2Diffe->Draw("COLZ");
3285  }
3286 
3287  cHE->cd(3);
3288  TString hname3 = Form("h_mapDepth%dADCAmpl225Copy_HO", depth);
3289  TH2F *twod3 = (TH2F *)dir->FindObjectAny(hname3);
3290  if (!twod3 || !twod0) {
3291  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3292  ptext->AddText("Missing histo");
3293  std::cout << "specHO test: failed to load " << hname3 << " and/or " << hname0 << "\n";
3294  if (!twod3)
3295  ptext->AddText(hname3);
3296  if (!twod0)
3297  ptext->AddText(hname0);
3298  ptext->Draw();
3299  continue;
3300  } else {
3301  // To IDENTIFY: see color different bins in eta-phi space
3302  h3Ceff = (TH2F *)twod3->Clone(Form("CeffA_HO%d", depth));
3303  h3Ceff->SetTitle(Form("HO Depth %d. \b", depth));
3304  h3Ceff->Divide(twod3, twod0, 1, 1, "B");
3305  gPad->SetGridy();
3306  gPad->SetGridx();
3307  gPad->SetLogz();
3308  h3Ceff->SetMarkerStyle(20);
3309  h3Ceff->SetMarkerSize(0.4);
3310  // h3Ceff->GetZaxis()->SetLabelSize(0.08);
3311  h3Ceff->SetXTitle("#eta \b");
3312  h3Ceff->SetYTitle("#phi \b");
3313  h3Ceff->SetZTitle("rate for channels of HO \b");
3314  h3Ceff->SetMarkerColor(2);
3315  h3Ceff->SetLineColor(2);
3316  h3Ceff->Draw("COLZ");
3317  }
3318 
3319  cHE->Update();
3320  cHE->Print(Form("ChkErrA_HO%d.png", depth));
3321  cHE->Clear();
3322 
3323  if (h2Ceff)
3324  delete h2Ceff;
3325  if (h2Diffe)
3326  delete h2Diffe;
3327  // if (h1diffADCAmpl) delete h1diffADCAmpl;
3328  // if (twod0) delete twod0;// do not delete - sometimes causes trouble later
3329  if (twod1)
3330  delete twod1;
3331  if (twod3)
3332  delete twod3;
3333  if (h3Ceff)
3334  delete h3Ceff;
3335  } // depth
3336 
3337  //=============================================================================== err A HF
3339  // For 2D and 1D plots with Amplitude. Produces ChkErrA_HFx.png
3340 
3341  for (int depth = 1; depth <= 2; depth++) {
3342  TH2F *h2Ceff = NULL;
3343  TH2F *h2Diffe = NULL;
3344  // TH1F* h1diffADCAmpl= NULL;
3345  TH2F *h3Ceff = NULL;
3346 
3347  cHE->Clear();
3348  cHE->Divide(3, 1);
3349 
3350  cHE->cd(1);
3351  // h_mapDepth1ADCAmpl_HF div h_mapDepth1_HF
3352  TString hname1 = Form("h_mapDepth%dADCAmpl_HF", depth);
3353  TString hname0 = Form("h_mapDepth%d_HF", depth);
3354  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
3355  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
3356  if (!twod1 || !twod0) {
3357  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3358  ptext->AddText("Missing histo");
3359  std::cout << "specHF test: failed to load " << hname1 << " and/or " << hname0 << "\n";
3360  if (!twod1)
3361  ptext->AddText(hname1);
3362  if (!twod0)
3363  ptext->AddText(hname0);
3364  ptext->Draw();
3365  continue;
3366  } else {
3367  // To IDENTIFY: see color different bins in eta-phi space
3368  h2Ceff = (TH2F *)twod1->Clone(Form("Ceff_HF%d", depth));
3369  h2Ceff->SetTitle(Form("HF Depth %d. (No cut) \b", depth));
3370  h2Ceff->Divide(twod1, twod0, 1, 1, "B");
3371 
3372  gPad->SetGridy();
3373  gPad->SetGridx();
3374  gPad->SetLogz();
3375  h2Ceff->SetMarkerStyle(20);
3376  h2Ceff->SetMarkerSize(0.4);
3377  //h2Ceff->GetZaxis()->SetLabelSize(0.08);
3378  h2Ceff->SetXTitle("#eta \b");
3379  h2Ceff->SetYTitle("#phi \b");
3380  h2Ceff->SetZTitle("h_mapDepth1ADCAmpl_HF \b");
3381  h2Ceff->SetMarkerColor(2);
3382  h2Ceff->SetLineColor(2);
3383  h2Ceff->Draw("COLZ");
3384  }
3385 
3386  cHE->cd(2);
3388  if (h2Ceff) {
3389  // TO IDENTIFY: see red bins in eta-phi space (applied cut on Aij: <20 || >3000
3390  h2Diffe = (TH2F *)h2Ceff->Clone(Form("Diffe_Depth%d_HF", depth));
3391  h2Diffe->SetTitle(Form("HF Depth %d. Cut avg(ADCAmpl) > 20 \b", depth));
3392  int nx = h2Ceff->GetXaxis()->GetNbins();
3393  int ny = h2Ceff->GetYaxis()->GetNbins();
3394  for (int i = 1; i <= nx; i++) {
3395  for (int j = 1; j <= ny; j++) {
3396  double ccc1 = h2Ceff->GetBinContent(i, j);
3397  h2Diffe->SetBinContent(i, j, 0.);
3398  if (ccc1 > 20.)
3399  h2Diffe->SetBinContent(i, j, ccc1);
3400  }
3401  }
3402  gPad->SetGridy();
3403  gPad->SetGridx();
3404  gPad->SetLogz();
3405  h2Diffe->SetMarkerStyle(20);
3406  h2Diffe->SetMarkerSize(0.4);
3407  //h2Diffe->GetZaxis()->SetLabelSize(0.08);
3408  h2Diffe->SetXTitle("#eta \b");
3409  h2Diffe->SetYTitle("#phi \b");
3410  h2Diffe->SetZTitle("<ADCAmpl> bigger 20.- HF Depth1 \b");
3411  h2Diffe->SetMarkerColor(2);
3412  h2Diffe->SetLineColor(2);
3413  h2Diffe->Draw("COLZ");
3414  }
3415 
3416  cHE->cd(3);
3417  /*
3418  if (h2Ceff) {
3419  h1diffADCAmpl = new TH1F(Form("diffADCAmpl_Depth%d_HF",depth),"",
3420  100, -20.,200.);
3421  h1diffADCAmpl->SetTitle(Form("HF Depth %d \b",depth));
3422  int nx = h2Ceff->GetXaxis()->GetNbins();
3423  int ny = h2Ceff->GetYaxis()->GetNbins();
3424  for (int i=1;i<=nx;i++) {
3425  for (int j=1;j<=ny;j++) {
3426  if(h2Ceff->GetBinContent(i,j) !=0 ) {
3427  double ccc1 = h2Ceff->GetBinContent(i,j) ;
3428  h1diffADCAmpl->Fill(ccc1);
3429  }
3430  }
3431  }
3432  gPad->SetLogy();
3433  h1diffADCAmpl->SetMarkerStyle(20);
3434  h1diffADCAmpl->SetMarkerSize(0.4);
3435  h1diffADCAmpl->GetYaxis()->SetLabelSize(0.04);
3436  h1diffADCAmpl->SetXTitle("<ADCAmpl> in each cell \b");
3437  h1diffADCAmpl->SetMarkerColor(2);
3438  h1diffADCAmpl->SetLineColor(2);
3439  h1diffADCAmpl->Draw("");
3440  }
3441  */
3442  TString hname3 = Form("h_mapDepth%dADCAmpl225Copy_HF", depth);
3443  TH2F *twod3 = (TH2F *)dir->FindObjectAny(hname3);
3444  if (!twod3 || !twod0) {
3445  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3446  ptext->AddText("Missing histo");
3447  std::cout << "specHF test: failed to load " << hname3 << " and/or " << hname0 << "\n";
3448  if (!twod3)
3449  ptext->AddText(hname3);
3450  if (!twod0)
3451  ptext->AddText(hname0);
3452  ptext->Draw();
3453  continue;
3454  } else {
3455  // To IDENTIFY: see color different bins in eta-phi space
3456  h3Ceff = (TH2F *)twod3->Clone(Form("CeffA_HF%d", depth));
3457  h3Ceff->SetTitle(Form("HF Depth %d. \b", depth));
3458  h3Ceff->Divide(twod3, twod0, 1, 1, "B");
3459  gPad->SetGridy();
3460  gPad->SetGridx();
3461  gPad->SetLogz();
3462  h3Ceff->SetMarkerStyle(20);
3463  h3Ceff->SetMarkerSize(0.4);
3464  // h3Ceff->GetZaxis()->SetLabelSize(0.08);
3465  h3Ceff->SetXTitle("#eta \b");
3466  h3Ceff->SetYTitle("#phi \b");
3467  h3Ceff->SetZTitle("rate for channels of HF \b");
3468  h3Ceff->SetMarkerColor(2);
3469  h3Ceff->SetLineColor(2);
3470  h3Ceff->Draw("COLZ");
3471  }
3472 
3473  cHE->Update();
3474  cHE->Print(Form("ChkErrA_HF%d.png", depth));
3475  cHE->Clear();
3476 
3477  if (h2Ceff)
3478  delete h2Ceff;
3479  if (h2Diffe)
3480  delete h2Diffe;
3481  // if (h1diffADCAmpl) delete h1diffADCAmpl;
3482  // if (twod0) delete twod0;// do not delete - sometimes causes trouble later
3483  if (twod1)
3484  delete twod1;
3485  if (twod3)
3486  delete twod3;
3487  if (h3Ceff)
3488  delete h3Ceff;
3489  } // depth
3490 
3491  std::cout << "************>>> average Amplitudes done" << std::endl;
3492 
3493  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3494  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3495  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3496  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3497  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3498 
3503  int MaxLum000000 = 0;
3504  MaxLum000000 = MaxLum;
3505 
3506  cout << " RBX analysis START for **************************" << endl;
3507  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3508  // int njeta = 22; int njphi = 18; int lsmax=2600;
3509  int njeta = 22;
3510  int njphi = 18;
3511  int lsmax0 = 1850;
3512  cout << ">>>>>>>>>>>>>>>>>>>>>>>> int njeta = 22; int njphi = 18; int lsmax0=1850; MaxLum = " << MaxLum << endl;
3513  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3514 
3515  if (MaxLum > lsmax0) {
3516  MaxLum = lsmax0;
3517  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3518  cout << "*********************************** EXCEEDED limit for MaxLum, it's bigger lsmax0. So we do limit "
3519  "MaxLum = lsmax0 "
3520  << endl;
3521  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3522  }
3523 
3524  int lsmax = MaxLum;
3525  //if (lsmax > 1800) lsmax = 1800;
3526  double alexall[njeta][njphi][lsmax];
3527 
3528  // for phi tables(!):
3529  double alexhb[njphi][lsmax];
3530  double alexhe[njphi][lsmax];
3531  double alexho[njphi][lsmax];
3532  double alexhf[njphi][lsmax];
3533 
3534  // for eta tables(!):
3535  double blexhb[njeta][lsmax];
3536  double blexhe[njeta][lsmax];
3537  double blexho[njeta][lsmax];
3538  double blexhf[njeta][lsmax];
3539 
3540  cout << ">>>>>>>>>>>>>>>>>>>>>>>> For massive:alexall AND for eta and phi tables:::: " << endl;
3541  cout << ">>>>>>>>>>>>>>>>>>>>>>>> alex... [njeta][njphi][lsmax]; lsmax = MaxLum; " << endl;
3542  cout << ">>>>>>>>>>>>>>>>>>>>>>>> alex... BUT, Max of lsmax = 1800 " << endl;
3543  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3544  int maxbinsRBX = MaxLum;
3545  int nx = maxbinsRBX; // # LS
3546  cout << ">>>>>>>>>>>>>>>>>>>>>>>> maxbinsRBX = MaxLum; " << endl;
3547  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3548 
3549  for (int i = 0; i < nx; i++) {
3550  for (int jphi = 0; jphi < njphi; jphi++) {
3551  alexhb[jphi][i] = 0.;
3552  alexhe[jphi][i] = 0.;
3553  alexho[jphi][i] = 0.;
3554  alexhf[jphi][i] = 0.;
3555 
3556  for (int jeta = 0; jeta < njeta; jeta++) {
3557  if (jphi == 0) {
3558  blexhb[jeta][i] = 0.;
3559  blexhe[jeta][i] = 0.;
3560  blexho[jeta][i] = 0.;
3561  blexhf[jeta][i] = 0.;
3562  }
3563 
3564  alexall[jeta][jphi][i] = 0.;
3565  }
3566  }
3567  }
3568 
3570  /*
3571  // j = ietaphi = 1- 396
3572  int ietaphimax = 396;
3573  int ny = ietaphimax + 1 ;
3574  for (int j=1;j<ny;j++) {
3575  int jeta = (j-1)/znphi;
3576  int jphi = (j-1)-znphi*jeta+1;// jphi=1-18
3577  jeta += 1;// jeta = 1-22 }
3578 // Outout is jeta = 1-22 jphi=1-18
3579 HB: j = 7,8,9,10 11,12,13,14
3580 HE: j = 3,4,5, 6, 7 14,15,16,17,18
3581 HO: j = 7,8,9,10 11,12,13,14
3582 HF: j = 0,1,2, 3 18,19,20,21
3583 */
3584 
3586  //======================================================================
3587  //======================================================================
3588  //======================================================================
3589  cout << " RBX general for HB **************************" << endl;
3590  TH2F *Ghb1KKK = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs0");
3591  TH2F *Ghb1LLL = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs00");
3592  TH2F *Ghb1 = (TH2F *)Ghb1LLL->Clone("Ghb1");
3593  Ghb1->Divide(Ghb1KKK, Ghb1LLL, 1, 1, "B"); // average A
3594  // Ghb1->Sumw2();
3595  // int nx = Ghb1->GetXaxis()->GetNbins(); // # LS
3596  int ny = Ghb1->GetYaxis()->GetNbins(); // # jetaphi indexes = 396 = 18*22
3597  // cout<<"***************************************** HB 54 ny= "<< ny <<endl;
3598  for (int j = 1; j <= ny; j++) {
3599  int jeta = (j - 1) / njphi; // jeta = 0-21
3600  if (jeta > 6 && jeta < 15) {
3601  int jphi = (j - 1) - njphi * jeta; // jphi=0-17
3602  // cout<<"HB 54 jeta= "<< jeta <<" jphi = "<<jphi <<endl;
3603  // over LS:
3604  for (int i = 1; i <= nx; i++) {
3605  double ccc1 = Ghb1->GetBinContent(i, j);
3606  alexall[jeta][jphi][i - 1] = ccc1;
3607  // if( i == 1 ) cout<<"HB 54 for LS=1 ccc1= "<< ccc1 <<endl;
3608  // if( ccc1 <= 0 ) cout<<"HB 54 ccc1= "<< ccc1 <<" iLS= "<< i <<" eta= "<< jeta <<" phi= "<< jphi <<endl;
3609  // cout<<"HB 54 ccc1= "<< ccc1 <<" j= "<< j <<" iLS= "<< i <<" eta= "<< jeta <<" phi= "<< jphi <<endl;
3610  } //i
3611  } //if
3612  } //j
3613  // clean-up
3614  if (Ghb1KKK)
3615  delete Ghb1KKK;
3616  if (Ghb1LLL)
3617  delete Ghb1LLL;
3618  // if (Ghb1) delete Ghb1;
3619 
3620  //====================================================================== alexhb[k][i]
3621  for (int jphi = 0; jphi < njphi; jphi++) {
3622  for (int i = 0; i < nx; i++) {
3623  double sumccc1 = 0.;
3624  int isum = 0;
3625  for (int jeta = 0; jeta < njeta; jeta++) {
3626  double ccc1 = alexall[jeta][jphi][i];
3627  if (ccc1 > 0.) {
3628  sumccc1 += ccc1;
3629  isum++;
3630  }
3631  } // for jeta
3632  if (isum > 0.)
3633  sumccc1 /= isum;
3634  alexhb[jphi][i] = sumccc1;
3635  }
3636  } //for for
3637 
3638  //====================================================================== blexhb[k][i]
3639  for (int keta = 0; keta < njeta; keta++) {
3640  for (int i = 0; i < nx; i++) {
3641  double sumccc1 = 0.;
3642  int isum = 0;
3643  for (int kphi = 0; kphi < njphi; kphi++) {
3644  double ccc1 = alexall[keta][kphi][i];
3645  if (ccc1 > 0.) {
3646  sumccc1 += ccc1;
3647  isum++;
3648  }
3649  } // for kphi
3650  if (isum > 0.)
3651  sumccc1 /= isum;
3652  blexhb[keta][i] = sumccc1;
3653  }
3654  } //for for
3655 
3657  //========================================================================================== 11 HB:: 2D jeta = 0 - 21 jphi =0 - 17
3658  //======================================================================
3659  //======================================================================
3660  //======================================================================
3661  //======================================================================
3662  cout << " RBX HB 2D plot *****" << endl;
3663  cRBX1->Clear();
3665  cRBX1->Divide(1, 1);
3666  cRBX1->cd(1);
3667  // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ; k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
3668  // TH2F* Ghb42D = new TH2F("Ghb42D","", 22, -11., 11., 18, 0., 18. );
3669  // TH2F* Ghb42D0 = new TH2F("Ghb42D0","", 22, -11., 11., 18, 0., 18. );
3670  TH2F *Ghb42D = new TH2F("Ghb42D", "", 23, -11.5, 11.5, 18, 0., 18.);
3671  TH2F *Ghb42D0 = new TH2F("Ghb42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
3672  TH2F *Ghb42DF = (TH2F *)Ghb42D0->Clone("Ghb42DF");
3673  for (int jphi = 0; jphi < njphi; jphi++) {
3674  for (int jeta = 0; jeta < njeta; jeta++) {
3675  for (int i = 0; i < nx; i++) {
3676  double ccc1 = alexall[jeta][jphi][i];
3677  int neweta = jeta - 11 - 0.5;
3678  if (jeta >= 11)
3679  neweta = jeta - 11 + 1.5;
3680  if (ccc1 > 0.) {
3681  Ghb42D->Fill(neweta, jphi, ccc1);
3682  Ghb42D0->Fill(neweta, jphi, 1.);
3683  }
3684  // if(ccc1>0.) {Ghb42D ->Fill(jeta-11,jphi,ccc1); Ghb42D0 ->Fill(jeta-11,jphi,1.); }
3685  }
3686  }
3687  }
3688  Ghb42DF->Divide(Ghb42D, Ghb42D0, 1, 1, "B"); // average A
3689  // Ghb1->Sumw2();
3690  gPad->SetGridy();
3691  gPad->SetGridx(); // gPad->SetLogz();
3692  Ghb42DF->SetMarkerStyle(20);
3693  Ghb42DF->SetMarkerSize(0.4);
3694  Ghb42DF->GetZaxis()->SetLabelSize(0.04);
3695  Ghb42DF->SetXTitle("<A>_RBX #eta \b");
3696  Ghb42DF->SetYTitle(" #phi \b");
3697  Ghb42DF->SetZTitle("<A>_RBX - All \b");
3698  Ghb42DF->SetMarkerColor(2);
3699  Ghb42DF->SetLineColor(2); // Ghb42DF->SetMaximum(1.000); // Ghb42DF->SetMinimum(1.0);
3700  Ghb42DF->Draw("COLZ");
3701 
3703  cRBX1->Update();
3704  cRBX1->Print("RBX-HB-2Dplot.png");
3705  cRBX1->Clear();
3706  // clean-up
3707  if (Ghb42D)
3708  delete Ghb42D;
3709  if (Ghb42D0)
3710  delete Ghb42D0;
3711  if (Ghb42DF)
3712  delete Ghb42DF;
3713 
3714  //========================================================================================== 61 HB:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
3715  //======================================================================
3716  //======================================================================
3717  //======================================================================
3718  //======================================================================
3719  cout << " RBX HB 1D plot *****" << endl;
3720  cRBX1->Clear();
3722  cRBX1->Divide(1, 1);
3723  cRBX1->cd(1);
3724  TH1F *GphiHB1D = new TH1F("GphiHB1D", "", 18, 0., 18.);
3725  TH1F *GphiHB1D0 = new TH1F("GphiHB1D0", "", 18, 0., 18.);
3726  TH1F *GphiHB1DF = (TH1F *)GphiHB1D0->Clone("GphiHB1DF");
3727  for (int jphi = 0; jphi < 18; jphi++) {
3728  for (int jeta = 0; jeta < 22; jeta++) {
3729  for (int i = 0; i < nx; i++) {
3730  double ccc1 = alexall[jeta][jphi][i];
3731  if (ccc1 > 0.) {
3732  GphiHB1D->Fill(jphi, ccc1);
3733  GphiHB1D0->Fill(jphi, 1.);
3734  }
3735  }
3736  }
3737  }
3738  // GphiHB1D->Sumw2();GphiHB1D0->Sumw2();
3739  GphiHB1DF->Divide(GphiHB1D, GphiHB1D0, 1, 1, "B"); // average A
3740  // GphiHB1DF->Sumw2();
3741  for (int jphi = 1; jphi < 19; jphi++) {
3742  GphiHB1DF->SetBinError(jphi, 0.01);
3743  }
3744  gPad->SetGridy();
3745  gPad->SetGridx(); // gPad->SetLogz();
3746  GphiHB1DF->SetMarkerStyle(20);
3747  GphiHB1DF->SetMarkerSize(1.4);
3748  GphiHB1DF->GetZaxis()->SetLabelSize(0.08);
3749  GphiHB1DF->SetXTitle("PHI of RBX\b");
3750  GphiHB1DF->SetYTitle(" <Amplitude> \b");
3751  GphiHB1DF->SetZTitle("<A>_PHI - All \b");
3752  GphiHB1DF->SetMarkerColor(4);
3753  GphiHB1DF->SetLineColor(4);
3754  GphiHB1DF->SetMinimum(0.8); // GphiHB1DF->SetMaximum(1.000);
3755  GphiHB1DF->Draw("Error");
3757  cRBX1->Update();
3758  cRBX1->Print("RBX-HB-1Dplot.png");
3759  cRBX1->Clear();
3760  // clean-up
3761  if (GphiHB1D)
3762  delete GphiHB1D;
3763  if (GphiHB1D0)
3764  delete GphiHB1D0;
3765  if (GphiHB1DF)
3766  delete GphiHB1DF;
3767 
3768  //========================================================================================== 62 HB:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
3769  //======================================================================
3770  //======================================================================
3771  //======================================================================
3772  //======================================================================
3773  cout << " RBX HB 11D plot *eta*" << endl;
3774  cRBX1->Clear();
3776  cRBX1->Divide(1, 1);
3777  cRBX1->cd(1);
3778  TH1F *GetaHB11D = new TH1F("GetaHB11D", "", 23, -11.5, 11.5);
3779  TH1F *GetaHB11D0 = new TH1F("GetaHB11D0", "", 23, -11.5, 11.5);
3780  TH1F *GetaHB11DF = (TH1F *)GetaHB11D0->Clone("GetaHB11DF");
3781 
3782  for (int jeta = 0; jeta < 22; jeta++) {
3783  for (int jphi = 0; jphi < 18; jphi++) {
3784  for (int i = 0; i < nx; i++) {
3785  double ccc1 = alexall[jeta][jphi][i];
3786  int neweta = jeta - 11 - 0.5;
3787  if (jeta >= 11)
3788  neweta = jeta - 11 + 1.5;
3789  if (ccc1 > 0.) {
3790  GetaHB11D->Fill(neweta, ccc1);
3791  GetaHB11D0->Fill(neweta, 1.);
3792  // if( i == 0 ) cout<<"62 HB: ibin= "<< i <<" jphi= "<< jphi <<" jeta= "<< jeta <<" A= "<< ccc1 <<endl;
3793  }
3794  }
3795  }
3796  }
3797  // GetaHB11D->Sumw2();GetaHB11D0->Sumw2();
3798  GetaHB11DF->Divide(GetaHB11D, GetaHB11D0, 1, 1, "B"); // average A
3799  // GetaHB11DF->Sumw2();
3800  for (int jeta = 1; jeta < 24; jeta++) {
3801  GetaHB11DF->SetBinError(jeta, 0.01);
3802  }
3803  gPad->SetGridy();
3804  gPad->SetGridx(); // gPad->SetLogz();
3805  GetaHB11DF->SetMarkerStyle(20);
3806  GetaHB11DF->SetMarkerSize(1.4);
3807  GetaHB11DF->GetZaxis()->SetLabelSize(0.08);
3808  GetaHB11DF->SetXTitle("#eta \b");
3809  GetaHB11DF->SetYTitle(" <A> \b");
3810  GetaHB11DF->SetZTitle("<A>_ETA - All \b");
3811  GetaHB11DF->SetMarkerColor(4);
3812  GetaHB11DF->SetLineColor(4);
3813  GetaHB11DF->SetMinimum(0.8); // GetaHB11DF->SetMaximum(1.000);
3814  GetaHB11DF->Draw("Error");
3815 
3817  cRBX1->Update();
3818  cRBX1->Print("RBX-HB-11Dplot.png");
3819  cRBX1->Clear();
3820  // clean-up
3821  if (GetaHB11D)
3822  delete GetaHB11D;
3823  if (GetaHB11D0)
3824  delete GetaHB11D0;
3825  if (GetaHB11DF)
3826  delete GetaHB11DF;
3827 
3828  //========================================================================================== 22 HB:: Ratio plots jeta = 0 - 21 jphi =0 - 17
3829  //======================================================================
3830  //======================================================================22.11.2018
3831  //======================================================================
3832  //======================================================================
3833 
3834  gStyle->SetOptStat(1110000);
3835  cout << " RBX HB Ratio plots *****" << endl;
3836  cRBX31->Clear();
3838  // gain stabilitY:
3839  // Rij = Aij / A1j , where i-over LSs, j-channels
3840  //
3841  // nx = maxbinsRBX; // # LS
3842  //
3843  double ccc0HB = 0.;
3844  cRBX31->Divide(3, 1);
3845  //================
3846  cRBX31->cd(1);
3847  // TH1F* Ghb5 = new TH1F("Ghb5","", nx, 1., nx+1.);
3848  TH1F *Ghb51 = new TH1F("Ghb51", "", nx, 1., nx + 1.);
3849  TH1F *Ghb50 = new TH1F("Ghb50", "", nx, 1., nx + 1.);
3850  TH1F *Ghb5 = (TH1F *)Ghb50->Clone("Ghb5");
3851  // j - etaphi index:
3852  for (int j = 1; j <= ny; j++) {
3853  ccc0HB = Ghb1->GetBinContent(1, j);
3854  // if(ccc0HB <=0.) for (int i=1;i<=nx;i++) {double ccc2 = Ghb1->GetBinContent(i,j);if(ccc2>0.){ccc0HB=ccc2;cout<<"!!! ccc0HB= "<<ccc0HB<<endl;break;} }
3855  if (ccc0HB <= 0.)
3856  for (int i = 1; i <= nx; i++) {
3857  double ccc2 = Ghb1->GetBinContent(i, j);
3858  if (ccc2 > 0.) {
3859  ccc0HB = ccc2;
3860  break;
3861  }
3862  }
3863  if (ccc0HB > 0.) {
3864  // i - # LSs:
3865  for (int i = 1; i <= nx; i++) {
3866  double ccc1 = Ghb1->GetBinContent(i, j);
3867  if (ccc1 > 0.) {
3868  double Rij = ccc1 / ccc0HB;
3869  // Ghb5 ->Fill( float(i), Rij);
3870  Ghb51->Fill(float(i), Rij);
3871  Ghb50->Fill(float(i), 1.);
3872  }
3873  }
3874  }
3875  }
3876  Ghb5->Divide(Ghb51, Ghb50, 1, 1, "B"); // average A
3877  for (int i = 1; i <= nx; i++) {
3878  Ghb5->SetBinError(i, 0.0001);
3879  }
3880  Ghb5->SetMarkerStyle(20);
3881  Ghb5->SetMarkerSize(0.4);
3882  Ghb5->GetYaxis()->SetLabelSize(0.04);
3883  Ghb5->SetMarkerColor(2);
3884  Ghb5->SetLineColor(0);
3885  Ghb5->SetXTitle(" iLS \b");
3886  Ghb5->SetYTitle(" <R> \b");
3887  Ghb5->SetTitle("<Ri> vs iLS \b");
3888  Ghb5->SetMinimum(0.); //Ghb5->SetMaximum(2.5);
3889  // gPad->SetLogy();
3890  gPad->SetGridy();
3891  gPad->SetGridx();
3892  Ghb5->SetStats(0);
3893  Ghb5->GetYaxis()->SetLabelSize(0.025);
3894  Ghb5->Draw("Error");
3895  //================
3896  cRBX31->cd(2);
3897  TH2F *Ghb60 = new TH2F("Ghb60", "", 22, -11., 11., 18, 0., 18.);
3898  TH2F *Ghb61 = new TH2F("Ghb61", "", 22, -11., 11., 18, 0., 18.);
3899  TH2F *Ghb6 = new TH2F("Ghb6", "", 22, -11., 11., 18, 0., 18.);
3900 
3901  TH2F *G20hb60 = new TH2F("G20hb60", "", 22, -11., 11., 18, 0., 18.);
3902  TH2F *G20hb61 = new TH2F("G20hb61", "", 22, -11., 11., 18, 0., 18.);
3903  TH2F *G20hb6 = new TH2F("G20hb6", "", 22, -11., 11., 18, 0., 18.);
3904  TH2F *G30hb60 = new TH2F("G30hb60", "", 22, -11., 11., 18, 0., 18.);
3905  TH2F *G30hb61 = new TH2F("G30hb61", "", 22, -11., 11., 18, 0., 18.);
3906  TH2F *G30hb6 = new TH2F("G30hb6", "", 22, -11., 11., 18, 0., 18.);
3907  TH2F *G40hb60 = new TH2F("G40hb60", "", 22, -11., 11., 18, 0., 18.);
3908  TH2F *G40hb61 = new TH2F("G40hb61", "", 22, -11., 11., 18, 0., 18.);
3909  TH2F *G40hb6 = new TH2F("G40hb6", "", 22, -11., 11., 18, 0., 18.);
3910  // j - etaphi index; i - # LSs;
3911  //
3912  // define mean and RMS:
3913  double sumjHB = 0.;
3914  int njHB = 0;
3915  double meanjHB = 0.;
3916  for (int j = 1; j <= ny; j++) {
3917  ccc0HB = Ghb1->GetBinContent(1, j);
3918  if (ccc0HB <= 0.)
3919  for (int i = 1; i <= nx; i++) {
3920  double ccc2 = Ghb1->GetBinContent(i, j);
3921  if (ccc2 > 0.) {
3922  ccc0HB = ccc2;
3923  break;
3924  }
3925  }
3926  if (ccc0HB > 0.) {
3927  for (int i = 1; i <= nx; i++) {
3928  double ccc1 = Ghb1->GetBinContent(i, j) / ccc0HB;
3929  if (ccc1 > 0.) {
3930  sumjHB += ccc1;
3931  njHB++;
3932  }
3933  }
3934  meanjHB = sumjHB / njHB;
3935  }
3936  } // j
3937 
3938  double ssumjHB = 0.;
3939  njHB = 0;
3940  double sigmajHB = 0.;
3941  for (int j = 1; j <= ny; j++) {
3942  ccc0HB = Ghb1->GetBinContent(1, j);
3943  if (ccc0HB <= 0.)
3944  for (int i = 1; i <= nx; i++) {
3945  double ccc2 = Ghb1->GetBinContent(i, j);
3946  if (ccc2 > 0.) {
3947  ccc0HB = ccc2;
3948  break;
3949  }
3950  }
3951  if (ccc0HB > 0.) {
3952  for (int i = 1; i <= nx; i++) {
3953  double ccc1 = Ghb1->GetBinContent(i, j) / ccc0HB;
3954  if (ccc1 > 0.) {
3955  ssumjHB += (ccc1 - meanjHB) * (ccc1 - meanjHB);
3956  njHB++;
3957  }
3958  }
3959  sigmajHB = sqrt(ssumjHB / njHB);
3960  }
3961  } // j
3962 
3963  double dif3rmsHBMIN = meanjHB - 3 * sigmajHB;
3964  if (dif3rmsHBMIN < 0.)
3965  dif3rmsHBMIN = 0.;
3966  double dif3rmsHBMAX = meanjHB + 3 * sigmajHB;
3967  cout << "22HB-2 meanjHB= " << meanjHB << " sigmajHB= " << sigmajHB << " dif3rmsHBMIN= " << dif3rmsHBMIN
3968  << " dif3rmsHBMAX= " << dif3rmsHBMAX << endl;
3969 
3970  double MAXdif3rmsHBMIN = dif3rmsHBMIN;
3971  double MINdif3rmsHBMAX = dif3rmsHBMAX;
3972  if (MAXdif3rmsHBMIN < 0.95)
3973  MAXdif3rmsHBMIN = 0.95;
3974  if (MINdif3rmsHBMAX > 1.05)
3975  MINdif3rmsHBMAX = 1.05;
3976  cout << "22HB-2 MAXdif3rmsHBMIN= " << MAXdif3rmsHBMIN << " MINdif3rmsHBMAX= " << MINdif3rmsHBMAX << endl;
3977  //
3978  for (int j = 1; j <= ny; j++) {
3979  ccc0HB = Ghb1->GetBinContent(1, j);
3980  if (ccc0HB <= 0.)
3981  for (int i = 1; i <= nx; i++) {
3982  double ccc2 = Ghb1->GetBinContent(i, j);
3983  if (ccc2 > 0.) {
3984  ccc0HB = ccc2;
3985  break;
3986  }
3987  }
3988  if (ccc0HB > 0.) {
3989  int jeta = (j - 1) / 18; // jeta = 0-21
3990  int jphi = (j - 1) - 18 * jeta; // jphi=0-17
3991  // i - # LSs:
3992  for (int i = 1; i <= nx; i++) {
3993  double ccc1 = Ghb1->GetBinContent(i, j);
3994  if (ccc1 > 0.) {
3995  double Rij = ccc1 / ccc0HB;
3996  if (Rij < MAXdif3rmsHBMIN || Rij > MINdif3rmsHBMAX) {
3997  Ghb61->Fill(jeta - 11, jphi, Rij);
3998  Ghb60->Fill(jeta - 11, jphi, 1.);
3999  }
4000  if (Rij < 0.8 || Rij > 1.2) {
4001  G20hb61->Fill(jeta - 11, jphi, Rij);
4002  G20hb60->Fill(jeta - 11, jphi, 1.);
4003  }
4004  if (Rij < 0.7 || Rij > 1.3) {
4005  G30hb61->Fill(jeta - 11, jphi, Rij);
4006  G30hb60->Fill(jeta - 11, jphi, 1.);
4007  }
4008  if (Rij < 0.6 || Rij > 1.4) {
4009  G40hb61->Fill(jeta - 11, jphi, Rij);
4010  G40hb60->Fill(jeta - 11, jphi, 1.);
4011  }
4012  } //if(ccc1>0.
4013  } // i
4014  } //if(ccc0HB>0
4015  } // j
4016  Ghb6->Divide(Ghb61, Ghb60, 1, 1, "B"); // average R
4017  G20hb6->Divide(G20hb61, G20hb60, 1, 1, "B"); // average R
4018  G30hb6->Divide(G30hb61, G30hb60, 1, 1, "B"); // average R
4019  G40hb6->Divide(G40hb61, G40hb60, 1, 1, "B"); // average R
4020 
4021  Ghb6->GetZaxis()->SetLabelSize(0.025);
4022  Ghb6->SetXTitle(" #eta \b");
4023  Ghb6->SetYTitle(" #phi \b");
4024  Ghb6->SetTitle("<Rj> for |1-<R>| > 0.05 \b");
4025  Ghb6->SetStats(0);
4026  Ghb6->Draw("COLZ");
4027  //================
4028  cRBX31->cd(3);
4029  TH1F *Ghb7 = new TH1F("Ghb7", "", 120, 0.4, 1.6);
4030  // j - etaphi index:
4031  for (int j = 1; j <= ny; j++) {
4032  ccc0HB = Ghb1->GetBinContent(1, j);
4033  if (ccc0HB <= 0.)
4034  for (int i = 1; i <= nx; i++) {
4035  double ccc2 = Ghb1->GetBinContent(i, j);
4036  if (ccc2 > 0.) {
4037  ccc0HB = ccc2;
4038  break;
4039  }
4040  }
4041  if (ccc0HB > 0.) {
4042  // i - # LSs:
4043  for (int i = 1; i <= nx; i++) {
4044  double ccc1 = Ghb1->GetBinContent(i, j);
4045  if (ccc1 > 0.) {
4046  double Rij = ccc1 / ccc0HB;
4047  Ghb7->Fill(Rij);
4048  }
4049  }
4050  }
4051  }
4052  Ghb7->SetMarkerStyle(20);
4053  Ghb7->SetMarkerSize(0.4);
4054  Ghb7->GetYaxis()->SetLabelSize(0.04);
4055  Ghb7->SetMarkerColor(2);
4056  Ghb7->SetLineColor(0);
4057  Ghb7->SetYTitle(" N \b");
4058  Ghb7->SetXTitle(" Rij \b");
4059  Ghb7->SetTitle(" Rij \b");
4060  //Ghb7->SetMinimum(0.8);Ghb7->SetMaximum(500.);
4061  gPad->SetGridy();
4062  gPad->SetGridx(); // gPad->SetLogy();
4063  // Ghb7->SetStats(1110000);
4064  Ghb7->GetYaxis()->SetLabelSize(0.025);
4065  Ghb7->Draw("Error");
4066  Float_t ymaxHB = Ghb7->GetMaximum();
4067  cout << "22HB-3 ymaxHB= " << ymaxHB << " MAXdif3rmsHBMIN= " << MAXdif3rmsHBMIN
4068  << " MINdif3rmsHBMAX= " << MINdif3rmsHBMAX << endl;
4069  TLine *lineHB = new TLine(MAXdif3rmsHBMIN, 0., MAXdif3rmsHBMIN, ymaxHB);
4070  lineHB->SetLineColor(kBlue);
4071  lineHB->Draw();
4072  TLine *line1HB = new TLine(MINdif3rmsHBMAX, 0., MINdif3rmsHBMAX, ymaxHB);
4073  line1HB->SetLineColor(kBlue);
4074  line1HB->Draw();
4075  //================
4077  cRBX31->Update();
4078  cRBX31->Print("RBX-HB-3plots.png");
4079  cRBX31->Clear();
4080  // clean-up
4081  if (Ghb5)
4082  delete Ghb5;
4083  if (Ghb60)
4084  delete Ghb60;
4085  if (Ghb61)
4086  delete Ghb61;
4087  if (Ghb6)
4088  delete Ghb6;
4089  if (Ghb7)
4090  delete Ghb7;
4091 
4092  if (G20hb60)
4093  delete G20hb60;
4094  if (G20hb61)
4095  delete G20hb61;
4096  if (G30hb60)
4097  delete G30hb60;
4098  if (G30hb61)
4099  delete G30hb61;
4100  if (G40hb60)
4101  delete G40hb60;
4102  if (G40hb61)
4103  delete G40hb61;
4104 
4105  if (Ghb1)
4106  delete Ghb1;
4107  //========================================================================================== 22-1 HB:: Ratio plots jeta = 0 - 21 jphi =0 - 17
4108  //======================================================================
4109  //======================================================================28.11.2018
4110  //======================================================================
4111  //======================================================================
4112 
4113  gStyle->SetOptStat(1110000);
4114  cout << " RBX HB Ratio plotsmore *****" << endl;
4115  cRBX31->Clear();
4117  cRBX31->Divide(3, 1);
4118  //================
4119  cRBX31->cd(1);
4120  G20hb6->GetZaxis()->SetLabelSize(0.025);
4121  G20hb6->SetXTitle(" #eta \b");
4122  G20hb6->SetYTitle(" #phi \b");
4123  G20hb6->SetTitle("<Rj> for |1-<R>| > 0.20 \b");
4124  G20hb6->SetStats(0);
4125  G20hb6->Draw("COLZ");
4126  //================
4127  cRBX31->cd(2);
4128  G30hb6->GetZaxis()->SetLabelSize(0.025);
4129  G30hb6->SetXTitle(" #eta \b");
4130  G30hb6->SetYTitle(" #phi \b");
4131  G30hb6->SetTitle("<Rj> for |1-<R>| > 0.30 \b");
4132  G30hb6->SetStats(0);
4133  G30hb6->Draw("COLZ");
4134  //================
4135  cRBX31->cd(3);
4136  G40hb6->GetZaxis()->SetLabelSize(0.025);
4137  G40hb6->SetXTitle(" #eta \b");
4138  G40hb6->SetYTitle(" #phi \b");
4139  G40hb6->SetTitle("<Rj> for |1-<R>| > 0.40 \b");
4140  G40hb6->SetStats(0);
4141  G40hb6->Draw("COLZ");
4142  //================
4143 
4145  cRBX31->Update();
4146  cRBX31->Print("RBX-HB-3plotsmore.png");
4147  cRBX31->Clear();
4148 
4149  // clean-up
4150  if (G20hb6)
4151  delete G20hb6;
4152  if (G30hb6)
4153  delete G30hb6;
4154  if (G40hb6)
4155  delete G40hb6;
4156  gStyle->SetOptStat(0);
4157 
4159 
4160  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4161  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4162  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4163  for (int jphi = 0; jphi < njphi; jphi++) {
4164  for (int jeta = 0; jeta < njeta; jeta++) {
4165  for (int i = 0; i < nx; i++) {
4166  alexall[jeta][jphi][i] = 0.;
4167  }
4168  }
4169  } // nulling
4170 
4172 
4174  //======================================================================
4175  //======================================================================
4176  //======================================================================
4177  cout << " RBX general for HE **************************" << endl;
4178  TH2F *Ghe1KKK = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs1");
4179  TH2F *Ghe1LLL = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs10");
4180  TH2F *Ghe1 = (TH2F *)Ghe1LLL->Clone("Ghe1");
4181  Ghe1->Divide(Ghe1KKK, Ghe1LLL, 1, 1, "B"); // average A
4182  // Ghe1->Sumw2();
4183  // int nx = Ghe1->GetXaxis()->GetNbins(); // # LS
4184  // nx = maxbinsRBX; // # LS
4185  ny = Ghe1->GetYaxis()->GetNbins(); // # jetaphi indexes
4186  for (int j = 1; j <= ny; j++) {
4187  int jeta = (j - 1) / njphi; // jeta = 0-21
4188  if ((jeta < 8 && jeta > 2) || (jeta < 19 && jeta > 13)) {
4189  int jphi = (j - 1) - njphi * jeta; // jphi=0-17
4190  // cout<<"HE 54 jeta= "<< jeta <<" jphi = "<<jphi <<endl;
4191  // over LS:
4192  for (int i = 1; i <= nx; i++) {
4193  double ccc1 = Ghe1->GetBinContent(i, j);
4194  alexall[jeta][jphi][i - 1] = ccc1;
4195  // if( i == 1 ) cout<<"HE 54 for LS=1 ccc1= "<< ccc1 <<endl;
4196  } //i
4197  } //if
4198  } //j
4199  // clean-up
4200  if (Ghe1KKK)
4201  delete Ghe1KKK;
4202  if (Ghe1LLL)
4203  delete Ghe1LLL;
4204  // if (Ghe1) delete Ghe1;
4205 
4206  //====================================================================== alexhe[k][i]
4207  for (int jphi = 0; jphi < njphi; jphi++) {
4208  for (int i = 0; i < nx; i++) {
4209  double sumccc1 = 0.;
4210  int isum = 0;
4211  for (int jeta = 0; jeta < njeta; jeta++) {
4212  double ccc1 = alexall[jeta][jphi][i];
4213  if (ccc1 > 0.) {
4214  sumccc1 += ccc1;
4215  isum++;
4216  }
4217  } // for jeta
4218  if (isum > 0.)
4219  sumccc1 /= isum;
4220  alexhe[jphi][i] = sumccc1;
4221  }
4222  } //for for
4223  //====================================================================== blexhe[k][i]
4224  for (int keta = 0; keta < njeta; keta++) {
4225  for (int i = 0; i < nx; i++) {
4226  double sumccc1 = 0.;
4227  int isum = 0;
4228  for (int kphi = 0; kphi < njphi; kphi++) {
4229  double ccc1 = alexall[keta][kphi][i];
4230  if (ccc1 > 0.) {
4231  sumccc1 += ccc1;
4232  isum++;
4233  }
4234  } // for kphi
4235  if (isum > 0.)
4236  sumccc1 /= isum;
4237  blexhe[keta][i] = sumccc1;
4238  }
4239  } //for for
4241  //========================================================================================== 21 HE:: 2D jeta = 0 - 21 jphi =0 - 17
4242  //======================================================================
4243  //======================================================================
4244  //======================================================================
4245  //======================================================================
4246  cout << " RBX HE 2D plot *****" << endl;
4247  cRBX1->Clear();
4249  cRBX1->Divide(1, 1);
4250  cRBX1->cd(1);
4251  // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ; k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
4252  TH2F *Ghe42D = new TH2F("Ghe42D", "", 23, -11.5, 11.5, 18, 0., 18.);
4253  TH2F *Ghe42D0 = new TH2F("Ghe42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
4254  // TH2F* Ghe42D = new TH2F("Ghe42D","", 22, -11., 11., 18, 0., 18. );
4255  // TH2F* Ghe42D0 = new TH2F("Ghe42D0","", 22, -11., 11., 18, 0., 18. );
4256  TH2F *Ghe42DF = (TH2F *)Ghe42D0->Clone("Ghe42DF");
4257  for (int jphi = 0; jphi < njphi; jphi++) {
4258  for (int jeta = 0; jeta < njeta; jeta++) {
4259  for (int i = 0; i < nx; i++) {
4260  double ccc1 = alexall[jeta][jphi][i];
4261  int neweta = jeta - 11 - 0.5;
4262  if (jeta >= 11)
4263  neweta = jeta - 11 + 1.5;
4264  if (ccc1 > 0.) {
4265  Ghe42D->Fill(neweta, jphi, ccc1);
4266  Ghe42D0->Fill(neweta, jphi, 1.);
4267  }
4268  // if(ccc1>0.) {Ghe42D ->Fill(jeta-11,jphi,ccc1); Ghe42D0 ->Fill(jeta-11,jphi,1.); }
4269  }
4270  }
4271  }
4272  Ghe42DF->Divide(Ghe42D, Ghe42D0, 1, 1, "B"); // average A
4273  // Ghe1->Sumw2();
4274  gPad->SetGridy();
4275  gPad->SetGridx(); // gPad->SetLogz();
4276  Ghe42DF->SetMarkerStyle(20);
4277  Ghe42DF->SetMarkerSize(0.4);
4278  Ghe42DF->GetZaxis()->SetLabelSize(0.04);
4279  Ghe42DF->SetXTitle("<A>_RBX #eta \b");
4280  Ghe42DF->SetYTitle(" #phi \b");
4281  Ghe42DF->SetZTitle("<A>_RBX - All \b");
4282  Ghe42DF->SetMarkerColor(2);
4283  Ghe42DF->SetLineColor(2); // Ghe42DF->SetMaximum(1.000); // Ghe42DF->SetMinimum(1.0);
4284  Ghe42DF->Draw("COLZ");
4285 
4287  cRBX1->Update();
4288  cRBX1->Print("RBX-HE-2Dplot.png");
4289  cRBX1->Clear();
4290  // clean-up
4291  if (Ghe42D)
4292  delete Ghe42D;
4293  if (Ghe42D0)
4294  delete Ghe42D0;
4295  if (Ghe42DF)
4296  delete Ghe42DF;
4297 
4298  //========================================================================================== 61 HE:: 1D j = 3,4,5, 6, 7 14,15,16,17,18 jphi =0 - 17
4299  //======================================================================
4300  //======================================================================
4301  //======================================================================
4302  //======================================================================
4303  cout << " RBX HE 1D plot *****" << endl;
4304  cRBX1->Clear();
4306  cRBX1->Divide(1, 1);
4307  cRBX1->cd(1);
4308  TH1F *GphiHE1D = new TH1F("GphiHE1D", "", 18, 0., 18.);
4309  TH1F *GphiHE1D0 = new TH1F("GphiHE1D0", "", 18, 0., 18.);
4310  TH1F *GphiHE1DF = (TH1F *)GphiHE1D0->Clone("GphiHE1DF");
4311  for (int jphi = 0; jphi < 18; jphi++) {
4312  for (int jeta = 0; jeta < 22; jeta++) {
4313  for (int i = 0; i < nx; i++) {
4314  double ccc1 = alexall[jeta][jphi][i];
4315  if (ccc1 > 0.) {
4316  GphiHE1D->Fill(jphi, ccc1);
4317  GphiHE1D0->Fill(jphi, 1.);
4318  }
4319  }
4320  }
4321  }
4322  // GphiHE1D->Sumw2();GphiHE1D0->Sumw2();
4323  GphiHE1DF->Divide(GphiHE1D, GphiHE1D0, 1, 1, "B"); // average A
4324  // GphiHE1DF->Sumw2();
4325  for (int jphi = 1; jphi < 19; jphi++) {
4326  GphiHE1DF->SetBinError(jphi, 0.01);
4327  }
4328  gPad->SetGridy();
4329  gPad->SetGridx(); // gPad->SetLogz();
4330  GphiHE1DF->SetMarkerStyle(20);
4331  GphiHE1DF->SetMarkerSize(1.4);
4332  GphiHE1DF->GetZaxis()->SetLabelSize(0.08);
4333  GphiHE1DF->SetXTitle("PHI of RBX\b");
4334  GphiHE1DF->SetYTitle(" <Amplitude> \b");
4335  GphiHE1DF->SetZTitle("<A>_PHI - All \b");
4336  GphiHE1DF->SetMarkerColor(4);
4337  GphiHE1DF->SetLineColor(4);
4338  GphiHE1DF->SetMinimum(0.8); // GphiHE1DF->SetMaximum(1.000);
4339  GphiHE1DF->Draw("Error");
4341  cRBX1->Update();
4342  cRBX1->Print("RBX-HE-1Dplot.png");
4343  cRBX1->Clear();
4344  // clean-up
4345  if (GphiHE1D)
4346  delete GphiHE1D;
4347  if (GphiHE1D0)
4348  delete GphiHE1D0;
4349  if (GphiHE1DF)
4350  delete GphiHE1DF;
4351 
4352  //========================================================================================== 62 HE:: 1D j = 3,4,5, 6, 7 14,15,16,17,18 jphi =0 - 17
4353  //======================================================================
4354  //======================================================================
4355  //======================================================================
4356  //======================================================================
4357  cout << " RBX HE 11D plot *eta*" << endl;
4358  cRBX1->Clear();
4360  cRBX1->Divide(1, 1);
4361  cRBX1->cd(1);
4362  TH1F *GetaHE11D = new TH1F("GetaHE11D", "", 23, -11.5, 11.5);
4363  TH1F *GetaHE11D0 = new TH1F("GetaHE11D0", "", 23, -11.5, 11.5);
4364  TH1F *GetaHE11DF = (TH1F *)GetaHE11D0->Clone("GetaHE11DF");
4365 
4366  for (int jeta = 0; jeta < 22; jeta++) {
4367  for (int jphi = 0; jphi < 18; jphi++) {
4368  for (int i = 0; i < nx; i++) {
4369  double ccc1 = alexall[jeta][jphi][i];
4370  int neweta = jeta - 11 - 0.5;
4371  if (jeta >= 11)
4372  neweta = jeta - 11 + 1.5;
4373  if (ccc1 > 0.) {
4374  GetaHE11D->Fill(neweta, ccc1);
4375  GetaHE11D0->Fill(neweta, 1.);
4376  // if( i == 0 ) cout<<"62 HE: ibin= "<< i <<" jphi= "<< jphi <<" jeta= "<< jeta <<" A= "<< ccc1 <<endl;
4377  }
4378  }
4379  }
4380  }
4381  // GetaHE11D->Sumw2();GetaHE11D0->Sumw2();
4382  GetaHE11DF->Divide(GetaHE11D, GetaHE11D0, 1, 1, "B"); // average A
4383  // GetaHE11DF->Sumw2();
4384  for (int jeta = 1; jeta < 24; jeta++) {
4385  GetaHE11DF->SetBinError(jeta, 0.01);
4386  }
4387  gPad->SetGridy();
4388  gPad->SetGridx(); // gPad->SetLogz();
4389  GetaHE11DF->SetMarkerStyle(20);
4390  GetaHE11DF->SetMarkerSize(1.4);
4391  GetaHE11DF->GetZaxis()->SetLabelSize(0.08);
4392  GetaHE11DF->SetXTitle("#eta \b");
4393  GetaHE11DF->SetYTitle(" <A> \b");
4394  GetaHE11DF->SetZTitle("<A>_ETA - All \b");
4395  GetaHE11DF->SetMarkerColor(4);
4396  GetaHE11DF->SetLineColor(4);
4397  GetaHE11DF->SetMinimum(0.8); // GetaHE11DF->SetMaximum(1.000);
4398  GetaHE11DF->Draw("Error");
4399 
4401  cRBX1->Update();
4402  cRBX1->Print("RBX-HE-11Dplot.png");
4403  cRBX1->Clear();
4404  // clean-up
4405  if (GetaHE11D)
4406  delete GetaHE11D;
4407  if (GetaHE11D0)
4408  delete GetaHE11D0;
4409  if (GetaHE11DF)
4410  delete GetaHE11DF;
4411 
4412  //========================================================================================== 22 HE:: Ratio plots jeta = 0 - 21 jphi =0 - 17
4413  //======================================================================
4414  //======================================================================22.11.2018
4415  //======================================================================
4416  //======================================================================
4417 
4418  gStyle->SetOptStat(1110000);
4419  cout << " RBX HE Ratio plots *****" << endl;
4420  cRBX31->Clear();
4422  // gain stabilitY:
4423  // Rij = Aij / A1j , where i-over LSs, j-channels
4424  //
4425  // nx = maxbinsRBX; // # LS
4426  //
4427  double ccc0HE = 0.;
4428  cRBX31->Divide(3, 1);
4429  //================
4430  cRBX31->cd(1);
4431  // TH1F* Ghe5 = new TH1F("Ghe5","", nx, 1., nx+1.);
4432  TH1F *Ghe51 = new TH1F("Ghe51", "", nx, 1., nx + 1.);
4433  TH1F *Ghe50 = new TH1F("Ghe50", "", nx, 1., nx + 1.);
4434  TH1F *Ghe5 = (TH1F *)Ghe50->Clone("Ghe5");
4435  // j - etaphi index:
4436  for (int j = 1; j <= ny; j++) {
4437  ccc0HE = Ghe1->GetBinContent(1, j);
4438  // if(ccc0HE <=0.) for (int i=1;i<=nx;i++) {double ccc2 = Ghe1->GetBinContent(i,j);if(ccc2>0.){ccc0HE=ccc2;cout<<"!!! ccc0HE= "<<ccc0HE<<endl;break;} }
4439  if (ccc0HE <= 0.)
4440  for (int i = 1; i <= nx; i++) {
4441  double ccc2 = Ghe1->GetBinContent(i, j);
4442  if (ccc2 > 0.) {
4443  ccc0HE = ccc2;
4444  break;
4445  }
4446  }
4447  if (ccc0HE > 0.) {
4448  // i - # LSs:
4449  for (int i = 1; i <= nx; i++) {
4450  double ccc1 = Ghe1->GetBinContent(i, j);
4451  if (ccc1 > 0.) {
4452  double Rij = ccc1 / ccc0HE;
4453  // Ghe5 ->Fill( float(i), Rij);
4454  Ghe51->Fill(float(i), Rij);
4455  Ghe50->Fill(float(i), 1.);
4456  }
4457  }
4458  }
4459  }
4460  Ghe5->Divide(Ghe51, Ghe50, 1, 1, "B"); // average A
4461  for (int i = 1; i <= nx; i++) {
4462  Ghe5->SetBinError(i, 0.0001);
4463  }
4464  Ghe5->SetMarkerStyle(20);
4465  Ghe5->SetMarkerSize(0.4);
4466  Ghe5->GetYaxis()->SetLabelSize(0.04);
4467  Ghe5->SetMarkerColor(2);
4468  Ghe5->SetLineColor(0);
4469  Ghe5->SetXTitle(" iLS \b");
4470  Ghe5->SetYTitle(" <R> \b");
4471  Ghe5->SetTitle("<Ri> vs iLS \b");
4472  Ghe5->SetMinimum(0.); //Ghe5->SetMaximum(2.5);
4473  // gPad->SetLogy();
4474  gPad->SetGridy();
4475  gPad->SetGridx();
4476  Ghe5->SetStats(0);
4477  Ghe5->GetYaxis()->SetLabelSize(0.025);
4478  Ghe5->Draw("Error");
4479  //================
4480  cRBX31->cd(2);
4481  TH2F *Ghe60 = new TH2F("Ghe60", "", 22, -11., 11., 18, 0., 18.);
4482  TH2F *Ghe61 = new TH2F("Ghe61", "", 22, -11., 11., 18, 0., 18.);
4483  TH2F *Ghe6 = new TH2F("Ghe6", "", 22, -11., 11., 18, 0., 18.);
4484 
4485  TH2F *G20he60 = new TH2F("G20he60", "", 22, -11., 11., 18, 0., 18.);
4486  TH2F *G20he61 = new TH2F("G20he61", "", 22, -11., 11., 18, 0., 18.);
4487  TH2F *G20he6 = new TH2F("G20he6", "", 22, -11., 11., 18, 0., 18.);
4488  TH2F *G30he60 = new TH2F("G30he60", "", 22, -11., 11., 18, 0., 18.);
4489  TH2F *G30he61 = new TH2F("G30he61", "", 22, -11., 11., 18, 0., 18.);
4490  TH2F *G30he6 = new TH2F("G30he6", "", 22, -11., 11., 18, 0., 18.);
4491  TH2F *G40he60 = new TH2F("G40he60", "", 22, -11., 11., 18, 0., 18.);
4492  TH2F *G40he61 = new TH2F("G40he61", "", 22, -11., 11., 18, 0., 18.);
4493  TH2F *G40he6 = new TH2F("G40he6", "", 22, -11., 11., 18, 0., 18.);
4494  // j - etaphi index; i - # LSs;
4495  //
4496  // define mean and RMS:
4497  double sumjHE = 0.;
4498  int njHE = 0;
4499  double meanjHE = 0.;
4500  for (int j = 1; j <= ny; j++) {
4501  ccc0HE = Ghe1->GetBinContent(1, j);
4502  if (ccc0HE <= 0.)
4503  for (int i = 1; i <= nx; i++) {
4504  double ccc2 = Ghe1->GetBinContent(i, j);
4505  if (ccc2 > 0.) {
4506  ccc0HE = ccc2;
4507  break;
4508  }
4509  }
4510  if (ccc0HE > 0.) {
4511  for (int i = 1; i <= nx; i++) {
4512  double ccc1 = Ghe1->GetBinContent(i, j) / ccc0HE;
4513  if (ccc1 > 0.) {
4514  sumjHE += ccc1;
4515  njHE++;
4516  }
4517  }
4518  meanjHE = sumjHE / njHE;
4519  }
4520  } // j
4521 
4522  double ssumjHE = 0.;
4523  njHE = 0;
4524  double sigmajHE = 0.;
4525  for (int j = 1; j <= ny; j++) {
4526  ccc0HE = Ghe1->GetBinContent(1, j);
4527  if (ccc0HE <= 0.)
4528  for (int i = 1; i <= nx; i++) {
4529  double ccc2 = Ghe1->GetBinContent(i, j);
4530  if (ccc2 > 0.) {
4531  ccc0HE = ccc2;
4532  break;
4533  }
4534  }
4535  if (ccc0HE > 0.) {
4536  for (int i = 1; i <= nx; i++) {
4537  double ccc1 = Ghe1->GetBinContent(i, j) / ccc0HE;
4538  if (ccc1 > 0.) {
4539  ssumjHE += (ccc1 - meanjHE) * (ccc1 - meanjHE);
4540  njHE++;
4541  }
4542  }
4543  sigmajHE = sqrt(ssumjHE / njHE);
4544  }
4545  } // j
4546 
4547  double dif3rmsHEMIN = meanjHE - 3 * sigmajHE;
4548  if (dif3rmsHEMIN < 0.)
4549  dif3rmsHEMIN = 0.;
4550  double dif3rmsHEMAX = meanjHE + 3 * sigmajHE;
4551  cout << "22HE-2 meanjHE= " << meanjHE << " sigmajHE= " << sigmajHE << " dif3rmsHEMIN= " << dif3rmsHEMIN
4552  << " dif3rmsHEMAX= " << dif3rmsHEMAX << endl;
4553 
4554  double MAXdif3rmsHEMIN = dif3rmsHEMIN;
4555  double MINdif3rmsHEMAX = dif3rmsHEMAX;
4556  if (MAXdif3rmsHEMIN < 0.95)
4557  MAXdif3rmsHEMIN = 0.95;
4558  if (MINdif3rmsHEMAX > 1.05)
4559  MINdif3rmsHEMAX = 1.05;
4560  cout << "22HE-2 MAXdif3rmsHEMIN= " << MAXdif3rmsHEMIN << " MINdif3rmsHEMAX= " << MINdif3rmsHEMAX << endl;
4561  //
4562  for (int j = 1; j <= ny; j++) {
4563  ccc0HE = Ghe1->GetBinContent(1, j);
4564  if (ccc0HE <= 0.)
4565  for (int i = 1; i <= nx; i++) {
4566  double ccc2 = Ghe1->GetBinContent(i, j);
4567  if (ccc2 > 0.) {
4568  ccc0HE = ccc2;
4569  break;
4570  }
4571  }
4572  if (ccc0HE > 0.) {
4573  int jeta = (j - 1) / 18; // jeta = 0-21
4574  int jphi = (j - 1) - 18 * jeta; // jphi=0-17
4575  // i - # LSs:
4576  for (int i = 1; i <= nx; i++) {
4577  double ccc1 = Ghe1->GetBinContent(i, j);
4578  if (ccc1 > 0.) {
4579  double Rij = ccc1 / ccc0HE;
4580  if (Rij < MAXdif3rmsHEMIN || Rij > MINdif3rmsHEMAX) {
4581  Ghe61->Fill(jeta - 11, jphi, Rij);
4582  Ghe60->Fill(jeta - 11, jphi, 1.);
4583  }
4584  if (Rij < 0.8 || Rij > 1.2) {
4585  G20he61->Fill(jeta - 11, jphi, Rij);
4586  G20he60->Fill(jeta - 11, jphi, 1.);
4587  }
4588  if (Rij < 0.7 || Rij > 1.3) {
4589  G30he61->Fill(jeta - 11, jphi, Rij);
4590  G30he60->Fill(jeta - 11, jphi, 1.);
4591  }
4592  if (Rij < 0.6 || Rij > 1.4) {
4593  G40he61->Fill(jeta - 11, jphi, Rij);
4594  G40he60->Fill(jeta - 11, jphi, 1.);
4595  }
4596  } //if(ccc1>0.
4597  } // i
4598  } //if(ccc0HE>0
4599  } // j
4600  Ghe6->Divide(Ghe61, Ghe60, 1, 1, "B"); // average R
4601  G20he6->Divide(G20he61, G20he60, 1, 1, "B"); // average R
4602  G30he6->Divide(G30he61, G30he60, 1, 1, "B"); // average R
4603  G40he6->Divide(G40he61, G40he60, 1, 1, "B"); // average R
4604 
4605  // Ghe6->SetLabelOffset (Float_t offset=0.005, Option_t *axis="X")//Set offset between axis and axis' labels
4606  // Ghe6->GetZaxis()->SetLabelOffset(-0.05);
4607  Ghe6->GetZaxis()->SetLabelSize(0.025);
4608 
4609  Ghe6->SetXTitle(" #eta \b");
4610  Ghe6->SetYTitle(" #phi \b");
4611  Ghe6->SetTitle(
4612  "<Rj> for |1-<R>| > 0.05 \b"); // Ghe6->SetMaximum(1.000); // Ghe6->SetMinimum(1.0); //Ghe6->SetZTitle("Rij averaged over LSs \b"); //Ghe6->GetZaxis()->SetLabelSize(0.04); //Ghe6->SetMarkerStyle(20);// Ghe6->SetMarkerSize(0.4);//Ghe6->SetMarkerColor(2); //Ghe6->SetLineColor(2);
4613  //gStyle->SetOptStat(kFALSE);
4614  Ghe6->SetStats(0);
4615  Ghe6->Draw("COLZ");
4616  //================
4617  cRBX31->cd(3);
4618  TH1F *Ghe7 = new TH1F("Ghe7", "", 120, 0.4, 1.6);
4619  // j - etaphi index:
4620  for (int j = 1; j <= ny; j++) {
4621  ccc0HE = Ghe1->GetBinContent(1, j);
4622  if (ccc0HE <= 0.)
4623  for (int i = 1; i <= nx; i++) {
4624  double ccc2 = Ghe1->GetBinContent(i, j);
4625  if (ccc2 > 0.) {
4626  ccc0HE = ccc2;
4627  break;
4628  }
4629  }
4630  if (ccc0HE > 0.) {
4631  // i - # LSs:
4632  for (int i = 1; i <= nx; i++) {
4633  double ccc1 = Ghe1->GetBinContent(i, j);
4634  if (ccc1 > 0.) {
4635  double Rij = ccc1 / ccc0HE;
4636  Ghe7->Fill(Rij);
4637  }
4638  }
4639  }
4640  }
4641  Ghe7->SetMarkerStyle(20);
4642  Ghe7->SetMarkerSize(0.4);
4643  Ghe7->GetYaxis()->SetLabelSize(0.04);
4644  Ghe7->SetMarkerColor(2);
4645  Ghe7->SetLineColor(0);
4646  Ghe7->SetYTitle(" N \b");
4647  Ghe7->SetXTitle(" Rij \b");
4648  Ghe7->SetTitle(" Rij \b");
4649  //Ghe7->SetMinimum(0.8);Ghe7->SetMaximum(500.);
4650  gPad->SetGridy();
4651  gPad->SetGridx(); // gPad->SetLogy();
4652  // Ghe7->SetStats(1110000);
4653  Ghe7->GetYaxis()->SetLabelSize(0.025);
4654  Ghe7->Draw("Error");
4655  Float_t ymaxHE = Ghe7->GetMaximum();
4656  cout << "22HE-3 ymaxHE= " << ymaxHE << " MAXdif3rmsHEMIN= " << MAXdif3rmsHEMIN
4657  << " MINdif3rmsHEMAX= " << MINdif3rmsHEMAX << endl;
4658  TLine *lineHE = new TLine(MAXdif3rmsHEMIN, 0., MAXdif3rmsHEMIN, ymaxHE);
4659  lineHE->SetLineColor(kBlue);
4660  lineHE->Draw();
4661  TLine *line1HE = new TLine(MINdif3rmsHEMAX, 0., MINdif3rmsHEMAX, ymaxHE);
4662  line1HE->SetLineColor(kBlue);
4663  line1HE->Draw();
4664  //================
4666  cRBX31->Update();
4667  cRBX31->Print("RBX-HE-3plots.png");
4668  cRBX31->Clear();
4669  // clean-up
4670  if (Ghe5)
4671  delete Ghe5;
4672  if (Ghe60)
4673  delete Ghe60;
4674  if (Ghe61)
4675  delete Ghe61;
4676  if (Ghe6)
4677  delete Ghe6;
4678  if (Ghe7)
4679  delete Ghe7;
4680 
4681  if (G20he60)
4682  delete G20he60;
4683  if (G20he61)
4684  delete G20he61;
4685  if (G30he60)
4686  delete G30he60;
4687  if (G30he61)
4688  delete G30he61;
4689  if (G40he60)
4690  delete G40he60;
4691  if (G40he61)
4692  delete G40he61;
4693 
4694  if (Ghe1)
4695  delete Ghe1;
4696  //========================================================================================== 22-1 HE:: Ratio plots jeta = 0 - 21 jphi =0 - 17
4697  //======================================================================
4698  //======================================================================28.11.2018
4699  //======================================================================
4700  //======================================================================
4701 
4702  gStyle->SetOptStat(1110000);
4703  cout << " RBX HE Ratio plotsmore *****" << endl;
4704  cRBX31->Clear();
4706  cRBX31->Divide(3, 1);
4707  //================
4708  cRBX31->cd(1);
4709  G20he6->GetZaxis()->SetLabelSize(0.025);
4710  G20he6->SetXTitle(" #eta \b");
4711  G20he6->SetYTitle(" #phi \b");
4712  G20he6->SetTitle("<Rj> for |1-<R>| > 0.20 \b");
4713  G20he6->SetStats(0);
4714  G20he6->Draw("COLZ");
4715  //================
4716  cRBX31->cd(2);
4717  G30he6->GetZaxis()->SetLabelSize(0.025);
4718  G30he6->SetXTitle(" #eta \b");
4719  G30he6->SetYTitle(" #phi \b");
4720  G30he6->SetTitle("<Rj> for |1-<R>| > 0.30 \b");
4721  G30he6->SetStats(0);
4722  G30he6->Draw("COLZ");
4723  //================
4724  cRBX31->cd(3);
4725  G40he6->GetZaxis()->SetLabelSize(0.025);
4726  G40he6->SetXTitle(" #eta \b");
4727  G40he6->SetYTitle(" #phi \b");
4728  G40he6->SetTitle("<Rj> for |1-<R>| > 0.40 \b");
4729  G40he6->SetStats(0);
4730  G40he6->Draw("COLZ");
4731  //================
4732 
4734  cRBX31->Update();
4735  cRBX31->Print("RBX-HE-3plotsmore.png");
4736  cRBX31->Clear();
4737 
4738  // clean-up
4739  if (G20he6)
4740  delete G20he6;
4741  if (G30he6)
4742  delete G30he6;
4743  if (G40he6)
4744  delete G40he6;
4745  gStyle->SetOptStat(0);
4747 
4748  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4749  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4750  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4751  for (int jphi = 0; jphi < njphi; jphi++) {
4752  for (int jeta = 0; jeta < njeta; jeta++) {
4753  for (int i = 0; i < nx; i++) {
4754  alexall[jeta][jphi][i] = 0.;
4755  }
4756  }
4757  } // nulling
4758 
4760 
4762  //======================================================================
4763  //======================================================================
4764  //======================================================================
4765  cout << " RBX general for HO **************************" << endl;
4766  TH2F *Gho1KKK = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs2");
4767  TH2F *Gho1LLL = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs20");
4768  TH2F *Gho1 = (TH2F *)Gho1LLL->Clone("Gho1");
4769  Gho1->Divide(Gho1KKK, Gho1LLL, 1, 1, "B"); // average A
4770  // Gho1->Sumw2();
4771  // int nx = Gho1->GetXaxis()->GetNbins(); // # LS
4772  // nx = maxbinsRBX; // # LS
4773  ny = Gho1->GetYaxis()->GetNbins(); // # jetaphi indexes
4774  for (int j = 1; j <= ny; j++) {
4775  int jeta = (j - 1) / njphi; // jeta = 0-21
4776  if (jeta < 15 && jeta > 6) {
4777  int jphi = (j - 1) - njphi * jeta; // jphi=0-17
4778  // cout<<"HO 54 jeta= "<< jeta <<" jphi = "<<jphi <<endl;
4779  // over LS:
4780  for (int i = 1; i <= nx; i++) {
4781  double ccc1 = Gho1->GetBinContent(i, j);
4782  alexall[jeta][jphi][i - 1] = ccc1;
4783  // if( i == 1 ) cout<<"HO 54 for LS=1 ccc1= "<< ccc1 <<endl;
4784  } //i
4785  } //if
4786  } //j
4787  // clean-up
4788  if (Gho1KKK)
4789  delete Gho1KKK;
4790  if (Gho1LLL)
4791  delete Gho1LLL;
4792  // if (Gho1) delete Gho1;
4793 
4794  //====================================================================== alexho[k][i]
4795  for (int jphi = 0; jphi < njphi; jphi++) {
4796  for (int i = 0; i < nx; i++) {
4797  double sumccc1 = 0.;
4798  int isum = 0;
4799  for (int jeta = 0; jeta < njeta; jeta++) {
4800  double ccc1 = alexall[jeta][jphi][i];
4801  if (ccc1 > 0.) {
4802  sumccc1 += ccc1;
4803  isum++;
4804  }
4805  } // for jeta
4806  if (isum > 0.)
4807  sumccc1 /= isum;
4808  alexho[jphi][i] = sumccc1;
4809  }
4810  } //for for
4811  //====================================================================== blexho[k][i]
4812  for (int keta = 0; keta < njeta; keta++) {
4813  for (int i = 0; i < nx; i++) {
4814  double sumccc1 = 0.;
4815  int isum = 0;
4816  for (int kphi = 0; kphi < njphi; kphi++) {
4817  double ccc1 = alexall[keta][kphi][i];
4818  if (ccc1 > 0.) {
4819  sumccc1 += ccc1;
4820  isum++;
4821  }
4822  } // for kphi
4823  if (isum > 0.)
4824  sumccc1 /= isum;
4825  blexho[keta][i] = sumccc1;
4826  }
4827  } //for for
4828 
4830  //========================================================================================== 33 HO:: 2D jeta = 0 - 21 jphi =0 - 17
4831  //======================================================================
4832  //======================================================================
4833  //======================================================================
4834  //======================================================================
4835  cout << " RBX HO 2D plot *****" << endl;
4836  cRBX1->Clear();
4838  cRBX1->Divide(1, 1);
4839  cRBX1->cd(1);
4840  // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ; k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
4841  TH2F *Gho42D = new TH2F("Gho42D", "", 23, -11.5, 11.5, 18, 0., 18.);
4842  TH2F *Gho42D0 = new TH2F("Gho42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
4843  // TH2F* Gho42D = new TH2F("Gho42D","", 22, -11., 11., 18, 0., 18. );
4844  // TH2F* Gho42D0 = new TH2F("Gho42D0","", 22, -11., 11., 18, 0., 18. );
4845  TH2F *Gho42DF = (TH2F *)Gho42D0->Clone("Gho42DF");
4846  for (int jphi = 0; jphi < njphi; jphi++) {
4847  for (int jeta = 0; jeta < njeta; jeta++) {
4848  for (int i = 0; i < nx; i++) {
4849  double ccc1 = alexall[jeta][jphi][i];
4850  int neweta = jeta - 11 - 0.5;
4851  if (jeta >= 11)
4852  neweta = jeta - 11 + 1.5;
4853  if (ccc1 > 0.) {
4854  Gho42D->Fill(neweta, jphi, ccc1);
4855  Gho42D0->Fill(neweta, jphi, 1.);
4856  }
4857  // if(ccc1>0.) {Gho42D ->Fill(jeta-11,jphi,ccc1); Gho42D0 ->Fill(jeta-11,jphi,1.); }
4858  }
4859  }
4860  }
4861  Gho42DF->Divide(Gho42D, Gho42D0, 1, 1, "B"); // average A
4862  // Gho1->Sumw2();
4863  gPad->SetGridy();
4864  gPad->SetGridx(); // gPad->SetLogz();
4865  Gho42DF->SetMarkerStyle(20);
4866  Gho42DF->SetMarkerSize(0.4);
4867  Gho42DF->GetZaxis()->SetLabelSize(0.04);
4868  Gho42DF->SetXTitle("<A>_RBX #eta \b");
4869  Gho42DF->SetYTitle(" #phi \b");
4870  Gho42DF->SetZTitle("<A>_RBX - All \b");
4871  Gho42DF->SetMarkerColor(2);
4872  Gho42DF->SetLineColor(2); // Gho42DF->SetMaximum(1.000); // Gho42DF->SetMinimum(1.0);
4873  Gho42DF->Draw("COLZ");
4874 
4876  cRBX1->Update();
4877  cRBX1->Print("RBX-HO-2Dplot.png");
4878  cRBX1->Clear();
4879  // clean-up
4880  if (Gho42D)
4881  delete Gho42D;
4882  if (Gho42D0)
4883  delete Gho42D0;
4884  if (Gho42DF)
4885  delete Gho42DF;
4886 
4887  //========================================================================================== 61 HO:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
4888  //======================================================================
4889  //======================================================================
4890  //======================================================================
4891  //======================================================================
4892  cout << " RBX HO 1D plot *****" << endl;
4893  cRBX1->Clear();
4895  cRBX1->Divide(1, 1);
4896  cRBX1->cd(1);
4897  TH1F *GphiHO1D = new TH1F("GphiHO1D", "", 18, 0., 18.);
4898  TH1F *GphiHO1D0 = new TH1F("GphiHO1D0", "", 18, 0., 18.);
4899  TH1F *GphiHO1DF = (TH1F *)GphiHO1D0->Clone("GphiHO1DF");
4900  for (int jphi = 0; jphi < 18; jphi++) {
4901  for (int jeta = 0; jeta < 22; jeta++) {
4902  for (int i = 0; i < nx; i++) {
4903  double ccc1 = alexall[jeta][jphi][i];
4904  if (ccc1 > 0.) {
4905  GphiHO1D->Fill(jphi, ccc1);
4906  GphiHO1D0->Fill(jphi, 1.);
4907  }
4908  }
4909  }
4910  }
4911  // GphiHO1D->Sumw2();GphiHO1D0->Sumw2();
4912  GphiHO1DF->Divide(GphiHO1D, GphiHO1D0, 1, 1, "B"); // average A
4913  // GphiHO1DF->Sumw2();
4914  for (int jphi = 1; jphi < 19; jphi++) {
4915  GphiHO1DF->SetBinError(jphi, 0.01);
4916  }
4917  gPad->SetGridy();
4918  gPad->SetGridx(); // gPad->SetLogz();
4919  GphiHO1DF->SetMarkerStyle(20);
4920  GphiHO1DF->SetMarkerSize(1.4);
4921  GphiHO1DF->GetZaxis()->SetLabelSize(0.08);
4922  GphiHO1DF->SetXTitle("PHI of RBX\b");
4923  GphiHO1DF->SetYTitle(" <Amplitude> \b");
4924  GphiHO1DF->SetZTitle("<A>_PHI - All \b");
4925  GphiHO1DF->SetMarkerColor(4);
4926  GphiHO1DF->SetLineColor(4);
4927  GphiHO1DF->SetMinimum(0.8); // GphiHO1DF->SetMaximum(1.000);
4928  GphiHO1DF->Draw("Error");
4930  cRBX1->Update();
4931  cRBX1->Print("RBX-HO-1Dplot.png");
4932  cRBX1->Clear();
4933  // clean-up
4934  if (GphiHO1D)
4935  delete GphiHO1D;
4936  if (GphiHO1D0)
4937  delete GphiHO1D0;
4938  if (GphiHO1DF)
4939  delete GphiHO1DF;
4940 
4941  //========================================================================================== 62 HO:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
4942  //======================================================================
4943  //======================================================================
4944  //======================================================================
4945  //======================================================================
4946  cout << " RBX HO 11D plot *eta*" << endl;
4947  cRBX1->Clear();
4949  cRBX1->Divide(1, 1);
4950  cRBX1->cd(1);
4951  TH1F *GetaHO11D = new TH1F("GetaHO11D", "", 23, -11.5, 11.5);
4952  TH1F *GetaHO11D0 = new TH1F("GetaHO11D0", "", 23, -11.5, 11.5);
4953  TH1F *GetaHO11DF = (TH1F *)GetaHO11D0->Clone("GetaHO11DF");
4954 
4955  for (int jeta = 0; jeta < 22; jeta++) {
4956  for (int jphi = 0; jphi < 18; jphi++) {
4957  for (int i = 0; i < nx; i++) {
4958  double ccc1 = alexall[jeta][jphi][i];
4959  int neweta = jeta - 11 - 0.5;
4960  if (jeta >= 11)
4961  neweta = jeta - 11 + 1.5;
4962  if (ccc1 > 0.) {
4963  GetaHO11D->Fill(neweta, ccc1);
4964  GetaHO11D0->Fill(neweta, 1.);
4965  // if( i == 0 ) cout<<"62 HO: ibin= "<< i <<" jphi= "<< jphi <<" jeta= "<< jeta <<" A= "<< ccc1 <<endl;
4966  }
4967  }
4968  }
4969  }
4970  // GetaHO11D->Sumw2();GetaHO11D0->Sumw2();
4971  GetaHO11DF->Divide(GetaHO11D, GetaHO11D0, 1, 1, "B"); // average A
4972  // GetaHO11DF->Sumw2();
4973  for (int jeta = 1; jeta < 24; jeta++) {
4974  GetaHO11DF->SetBinError(jeta, 0.01);
4975  }
4976  gPad->SetGridy();
4977  gPad->SetGridx(); // gPad->SetLogz();
4978  GetaHO11DF->SetMarkerStyle(20);
4979  GetaHO11DF->SetMarkerSize(1.4);
4980  GetaHO11DF->GetZaxis()->SetLabelSize(0.08);
4981  GetaHO11DF->SetXTitle("#eta \b");
4982  GetaHO11DF->SetYTitle(" <A> \b");
4983  GetaHO11DF->SetZTitle("<A>_ETA - All \b");
4984  GetaHO11DF->SetMarkerColor(4);
4985  GetaHO11DF->SetLineColor(4);
4986  GetaHO11DF->SetMinimum(0.8); // GetaHO11DF->SetMaximum(1.000);
4987  GetaHO11DF->Draw("Error");
4988 
4990  cRBX1->Update();
4991  cRBX1->Print("RBX-HO-11Dplot.png");
4992  cRBX1->Clear();
4993  // clean-up
4994  if (GetaHO11D)
4995  delete GetaHO11D;
4996  if (GetaHO11D0)
4997  delete GetaHO11D0;
4998  if (GetaHO11DF)
4999  delete GetaHO11DF;
5000 
5001  //========================================================================================== 22 HO:: Ratio plots jeta = 0 - 21 jphi =0 - 17
5002  //======================================================================
5003  //======================================================================22.11.2018
5004  //======================================================================
5005  //======================================================================
5006 
5007  gStyle->SetOptStat(1110000);
5008  cout << " RBX HO Ratio plots *****" << endl;
5009  cRBX31->Clear();
5011  // gain stabilitY:
5012  // Rij = Aij / A1j , where i-over LSs, j-channels
5013  //
5014  // nx = maxbinsRBX; // # LS
5015  //
5016  double ccc0HO = 0.;
5017  cRBX31->Divide(3, 1);
5018  //================
5019  cRBX31->cd(1);
5020  // TH1F* Gho5 = new TH1F("Gho5","", nx, 1., nx+1.);
5021  TH1F *Gho51 = new TH1F("Gho51", "", nx, 1., nx + 1.);
5022  TH1F *Gho50 = new TH1F("Gho50", "", nx, 1., nx + 1.);
5023  TH1F *Gho5 = (TH1F *)Gho50->Clone("Gho5");
5024  // j - etaphi index:
5025  for (int j = 1; j <= ny; j++) {
5026  ccc0HO = Gho1->GetBinContent(1, j);
5027  // if(ccc0HO <=0.) for (int i=1;i<=nx;i++) {double ccc2 = Gho1->GetBinContent(i,j);if(ccc2>0.){ccc0HO=ccc2;cout<<"!!! ccc0HO= "<<ccc0HO<<endl;break;} }
5028  if (ccc0HO <= 0.)
5029  for (int i = 1; i <= nx; i++) {
5030  double ccc2 = Gho1->GetBinContent(i, j);
5031  if (ccc2 > 0.) {
5032  ccc0HO = ccc2;
5033  break;
5034  }
5035  }
5036  if (ccc0HO > 0.) {
5037  // i - # LSs:
5038  for (int i = 1; i <= nx; i++) {
5039  double ccc1 = Gho1->GetBinContent(i, j);
5040  if (ccc1 > 0.) {
5041  double Rij = ccc1 / ccc0HO;
5042  // Gho5 ->Fill( float(i), Rij);
5043  Gho51->Fill(float(i), Rij);
5044  Gho50->Fill(float(i), 1.);
5045  }
5046  }
5047  }
5048  }
5049  Gho5->Divide(Gho51, Gho50, 1, 1, "B"); // average A
5050  for (int i = 1; i <= nx; i++) {
5051  Gho5->SetBinError(i, 0.0001);
5052  }
5053  Gho5->SetMarkerStyle(20);
5054  Gho5->SetMarkerSize(0.4);
5055  Gho5->GetYaxis()->SetLabelSize(0.04);
5056  Gho5->SetMarkerColor(2);
5057  Gho5->SetLineColor(0);
5058  Gho5->SetXTitle(" iLS \b");
5059  Gho5->SetYTitle(" <R> \b");
5060  Gho5->SetTitle("<Ri> vs iLS \b");
5061  Gho5->SetMinimum(0.); //Gho5->SetMaximum(2.5);
5062  // gPad->SetLogy();
5063  gPad->SetGridy();
5064  gPad->SetGridx();
5065  Gho5->SetStats(0);
5066  Gho5->GetYaxis()->SetLabelSize(0.025);
5067  Gho5->Draw("Error");
5068  //================
5069  cRBX31->cd(2);
5070  TH2F *Gho60 = new TH2F("Gho60", "", 22, -11., 11., 18, 0., 18.);
5071  TH2F *Gho61 = new TH2F("Gho61", "", 22, -11., 11., 18, 0., 18.);
5072  TH2F *Gho6 = new TH2F("Gho6", "", 22, -11., 11., 18, 0., 18.);
5073 
5074  TH2F *G20ho60 = new TH2F("G20ho60", "", 22, -11., 11., 18, 0., 18.);
5075  TH2F *G20ho61 = new TH2F("G20ho61", "", 22, -11., 11., 18, 0., 18.);
5076  TH2F *G20ho6 = new TH2F("G20ho6", "", 22, -11., 11., 18, 0., 18.);
5077  TH2F *G30ho60 = new TH2F("G30ho60", "", 22, -11., 11., 18, 0., 18.);
5078  TH2F *G30ho61 = new TH2F("G30ho61", "", 22, -11., 11., 18, 0., 18.);
5079  TH2F *G30ho6 = new TH2F("G30ho6", "", 22, -11., 11., 18, 0., 18.);
5080  TH2F *G40ho60 = new TH2F("G40ho60", "", 22, -11., 11., 18, 0., 18.);
5081  TH2F *G40ho61 = new TH2F("G40ho61", "", 22, -11., 11., 18, 0., 18.);
5082  TH2F *G40ho6 = new TH2F("G40ho6", "", 22, -11., 11., 18, 0., 18.);
5083 
5084  // j - etaphi index; i - # LSs;
5085  //
5086  // define mean and RMS:
5087  double sumjHO = 0.;
5088  int njHO = 0;
5089  double meanjHO = 0.;
5090  for (int j = 1; j <= ny; j++) {
5091  ccc0HO = Gho1->GetBinContent(1, j);
5092  if (ccc0HO <= 0.)
5093  for (int i = 1; i <= nx; i++) {
5094  double ccc2 = Gho1->GetBinContent(i, j);
5095  if (ccc2 > 0.) {
5096  ccc0HO = ccc2;
5097  break;
5098  }
5099  }
5100  if (ccc0HO > 0.) {
5101  for (int i = 1; i <= nx; i++) {
5102  double ccc1 = Gho1->GetBinContent(i, j) / ccc0HO;
5103  if (ccc1 > 0.) {
5104  sumjHO += ccc1;
5105  njHO++;
5106  }
5107  }
5108  meanjHO = sumjHO / njHO;
5109  }
5110  } // j
5111 
5112  double ssumjHO = 0.;
5113  njHO = 0;
5114  double sigmajHO = 0.;
5115  for (int j = 1; j <= ny; j++) {
5116  ccc0HO = Gho1->GetBinContent(1, j);
5117  if (ccc0HO <= 0.)
5118  for (int i = 1; i <= nx; i++) {
5119  double ccc2 = Gho1->GetBinContent(i, j);
5120  if (ccc2 > 0.) {
5121  ccc0HO = ccc2;
5122  break;
5123  }
5124  }
5125  if (ccc0HO > 0.) {
5126  for (int i = 1; i <= nx; i++) {
5127  double ccc1 = Gho1->GetBinContent(i, j) / ccc0HO;
5128  if (ccc1 > 0.) {
5129  ssumjHO += (ccc1 - meanjHO) * (ccc1 - meanjHO);
5130  njHO++;
5131  }
5132  }
5133  sigmajHO = sqrt(ssumjHO / njHO);
5134  }
5135  } // j
5136 
5137  double dif3rmsHOMIN = meanjHO - 3 * sigmajHO;
5138  if (dif3rmsHOMIN < 0.)
5139  dif3rmsHOMIN = 0.;
5140  double dif3rmsHOMAX = meanjHO + 3 * sigmajHO;
5141  cout << "22HO-2 meanjHO= " << meanjHO << " sigmajHO= " << sigmajHO << " dif3rmsHOMIN= " << dif3rmsHOMIN
5142  << " dif3rmsHOMAX= " << dif3rmsHOMAX << endl;
5143 
5144  double MAXdif3rmsHOMIN = dif3rmsHOMIN;
5145  double MINdif3rmsHOMAX = dif3rmsHOMAX;
5146  if (MAXdif3rmsHOMIN < 0.95)
5147  MAXdif3rmsHOMIN = 0.95;
5148  if (MINdif3rmsHOMAX > 1.05)
5149  MINdif3rmsHOMAX = 1.05;
5150  cout << "22HO-2 MAXdif3rmsHOMIN= " << MAXdif3rmsHOMIN << " MINdif3rmsHOMAX= " << MINdif3rmsHOMAX << endl;
5151  //
5152  for (int j = 1; j <= ny; j++) {
5153  ccc0HO = Gho1->GetBinContent(1, j);
5154  if (ccc0HO <= 0.)
5155  for (int i = 1; i <= nx; i++) {
5156  double ccc2 = Gho1->GetBinContent(i, j);
5157  if (ccc2 > 0.) {
5158  ccc0HO = ccc2;
5159  break;
5160  }
5161  }
5162  if (ccc0HO > 0.) {
5163  int jeta = (j - 1) / 18; // jeta = 0-21
5164  int jphi = (j - 1) - 18 * jeta; // jphi=0-17
5165  // i - # LSs:
5166  for (int i = 1; i <= nx; i++) {
5167  double ccc1 = Gho1->GetBinContent(i, j);
5168  if (ccc1 > 0.) {
5169  double Rij = ccc1 / ccc0HO;
5170  if (Rij < MAXdif3rmsHOMIN || Rij > MINdif3rmsHOMAX) {
5171  Gho61->Fill(jeta - 11, jphi, Rij);
5172  Gho60->Fill(jeta - 11, jphi, 1.);
5173  }
5174  if (Rij < 0.8 || Rij > 1.2) {
5175  G20ho61->Fill(jeta - 11, jphi, Rij);
5176  G20ho60->Fill(jeta - 11, jphi, 1.);
5177  }
5178  if (Rij < 0.7 || Rij > 1.3) {
5179  G30ho61->Fill(jeta - 11, jphi, Rij);
5180  G30ho60->Fill(jeta - 11, jphi, 1.);
5181  }
5182  if (Rij < 0.6 || Rij > 1.4) {
5183  G40ho61->Fill(jeta - 11, jphi, Rij);
5184  G40ho60->Fill(jeta - 11, jphi, 1.);
5185  }
5186  } //if(ccc1>0.
5187  } // i
5188  } //if(ccc0HO>0
5189  } // j
5190  Gho6->Divide(Gho61, Gho60, 1, 1, "B"); // average R
5191  G20ho6->Divide(G20ho61, G20ho60, 1, 1, "B"); // average R
5192  G30ho6->Divide(G30ho61, G30ho60, 1, 1, "B"); // average R
5193  G40ho6->Divide(G40ho61, G40ho60, 1, 1, "B"); // average R
5194  // Gho6->SetLabelOffset (Float_t offset=0.005, Option_t *axis="X")//Set offset between axis and axis' labels
5195  // Gho6->GetZaxis()->SetLabelOffset(-0.05);
5196  Gho6->GetZaxis()->SetLabelSize(0.025);
5197 
5198  Gho6->SetXTitle(" #eta \b");
5199  Gho6->SetYTitle(" #phi \b");
5200  Gho6->SetTitle(
5201  "<Rj> for |1-<R>| > 0.05 \b"); // Gho6->SetMaximum(1.000); // Gho6->SetMinimum(1.0); //Gho6->SetZTitle("Rij averaged over LSs \b"); //Gho6->GetZaxis()->SetLabelSize(0.04); //Gho6->SetMarkerStyle(20);// Gho6->SetMarkerSize(0.4);//Gho6->SetMarkerColor(2); //Gho6->SetLineColor(2);
5202  //gStyle->SetOptStat(kFALSE);
5203  Gho6->SetStats(0);
5204  Gho6->Draw("COLZ");
5205  //================
5206  cRBX31->cd(3);
5207  TH1F *Gho7 = new TH1F("Gho7", "", 120, 0.4, 1.6);
5208  // j - etaphi index:
5209  for (int j = 1; j <= ny; j++) {
5210  ccc0HO = Gho1->GetBinContent(1, j);
5211  if (ccc0HO <= 0.)
5212  for (int i = 1; i <= nx; i++) {
5213  double ccc2 = Gho1->GetBinContent(i, j);
5214  if (ccc2 > 0.) {
5215  ccc0HO = ccc2;
5216  break;
5217  }
5218  }
5219  if (ccc0HO > 0.) {
5220  // i - # LSs:
5221  for (int i = 1; i <= nx; i++) {
5222  double ccc1 = Gho1->GetBinContent(i, j);
5223  if (ccc1 > 0.) {
5224  double Rij = ccc1 / ccc0HO;
5225  Gho7->Fill(Rij);
5226  }
5227  }
5228  }
5229  }
5230  Gho7->SetMarkerStyle(20);
5231  Gho7->SetMarkerSize(0.4);
5232  Gho7->GetYaxis()->SetLabelSize(0.04);
5233  Gho7->SetMarkerColor(2);
5234  Gho7->SetLineColor(0);
5235  Gho7->SetYTitle(" N \b");
5236  Gho7->SetXTitle(" Rij \b");
5237  Gho7->SetTitle(" Rij \b");
5238  //Gho7->SetMinimum(0.8);Gho7->SetMaximum(500.);
5239  gPad->SetGridy();
5240  gPad->SetGridx(); // gPad->SetLogy();
5241  // Gho7->SetStats(1110000);
5242  Gho7->GetYaxis()->SetLabelSize(0.025);
5243  Gho7->Draw("Error");
5244  Float_t ymaxHO = Gho7->GetMaximum();
5245  cout << "22HO-3 ymaxHO= " << ymaxHO << " MAXdif3rmsHOMIN= " << MAXdif3rmsHOMIN
5246  << " MINdif3rmsHOMAX= " << MINdif3rmsHOMAX << endl;
5247  TLine *lineHO = new TLine(MAXdif3rmsHOMIN, 0., MAXdif3rmsHOMIN, ymaxHO);
5248  lineHO->SetLineColor(kBlue);
5249  lineHO->Draw();
5250  TLine *line1HO = new TLine(MINdif3rmsHOMAX, 0., MINdif3rmsHOMAX, ymaxHO);
5251  line1HO->SetLineColor(kBlue);
5252  line1HO->Draw();
5253  //================
5255  cRBX31->Update();
5256  cRBX31->Print("RBX-HO-3plots.png");
5257  cRBX31->Clear();
5258  // clean-up
5259  if (Gho5)
5260  delete Gho5;
5261  if (Gho60)
5262  delete Gho60;
5263  if (Gho61)
5264  delete Gho61;
5265  if (Gho6)
5266  delete Gho6;
5267  if (Gho7)
5268  delete Gho7;
5269 
5270  if (G20ho60)
5271  delete G20ho60;
5272  if (G20ho61)
5273  delete G20ho61;
5274  if (G30ho60)
5275  delete G30ho60;
5276  if (G30ho61)
5277  delete G30ho61;
5278  if (G40ho60)
5279  delete G40ho60;
5280  if (G40ho61)
5281  delete G40ho61;
5282 
5283  if (Gho1)
5284  delete Gho1;
5285  //========================================================================================== 22-1 HO:: Ratio plots jeta = 0 - 21 jphi =0 - 17
5286  //======================================================================
5287  //======================================================================28.11.2018
5288  //======================================================================
5289  //======================================================================
5290 
5291  gStyle->SetOptStat(1110000);
5292  cout << " RBX HO Ratio plotsmore *****" << endl;
5293  cRBX31->Clear();
5295  cRBX31->Divide(3, 1);
5296  //================
5297  cRBX31->cd(1);
5298  G20ho6->GetZaxis()->SetLabelSize(0.025);
5299  G20ho6->SetXTitle(" #eta \b");
5300  G20ho6->SetYTitle(" #phi \b");
5301  G20ho6->SetTitle("<Rj> for |1-<R>| > 0.20 \b");
5302  G20ho6->SetStats(0);
5303  G20ho6->Draw("COLZ");
5304  //================
5305  cRBX31->cd(2);
5306  G30ho6->GetZaxis()->SetLabelSize(0.025);
5307  G30ho6->SetXTitle(" #eta \b");
5308  G30ho6->SetYTitle(" #phi \b");
5309  G30ho6->SetTitle("<Rj> for |1-<R>| > 0.30 \b");
5310  G30ho6->SetStats(0);
5311  G30ho6->Draw("COLZ");
5312  //================
5313  cRBX31->cd(3);
5314  G40ho6->GetZaxis()->SetLabelSize(0.025);
5315  G40ho6->SetXTitle(" #eta \b");
5316  G40ho6->SetYTitle(" #phi \b");
5317  G40ho6->SetTitle("<Rj> for |1-<R>| > 0.40 \b");
5318  G40ho6->SetStats(0);
5319  G40ho6->Draw("COLZ");
5320  //================
5321 
5323  cRBX31->Update();
5324  cRBX31->Print("RBX-HO-3plotsmore.png");
5325  cRBX31->Clear();
5326 
5327  // clean-up
5328  if (G20ho6)
5329  delete G20ho6;
5330  if (G30ho6)
5331  delete G30ho6;
5332  if (G40ho6)
5333  delete G40ho6;
5334  gStyle->SetOptStat(0);
5336 
5337  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5338  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5339  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5340  for (int jphi = 0; jphi < njphi; jphi++) {
5341  for (int jeta = 0; jeta < njeta; jeta++) {
5342  for (int i = 0; i < nx; i++) {
5343  alexall[jeta][jphi][i] = 0.;
5344  }
5345  }
5346  } // nulling
5347 
5349 
5351  //======================================================================
5352  //======================================================================
5353  //======================================================================
5354  cout << " RBX general for HF **************************" << endl;
5355  TH2F *Ghf1KKK = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs3");
5356  TH2F *Ghf1LLL = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs30");
5357  TH2F *Ghf1 = (TH2F *)Ghf1LLL->Clone("Ghf1");
5358  Ghf1->Divide(Ghf1KKK, Ghf1LLL, 1, 1, "B"); // average A
5359  // Ghf1->Sumw2();
5360  // int nx = Ghf1->GetXaxis()->GetNbins(); // # LS
5361  // nx = maxbinsRBX; // # LS
5362  ny = Ghf1->GetYaxis()->GetNbins(); // # jetaphi indexes
5363  for (int j = 1; j <= ny; j++) {
5364  int jeta = (j - 1) / njphi; // jeta = 0-21
5365  if (jeta < 4 || jeta > 17) {
5366  int jphi = (j - 1) - njphi * jeta; // jphi=0-17
5367  // cout<<"HF 54 jeta= "<< jeta <<" jphi = "<<jphi <<endl;
5368  // over LS:
5369  for (int i = 1; i <= nx; i++) {
5370  double ccc1 = Ghf1->GetBinContent(i, j);
5371  alexall[jeta][jphi][i - 1] = ccc1;
5372  // if( i == 1 ) cout<<"HF 54 for LS=1 ccc1= "<< ccc1 <<endl;
5373  } //i
5374  } //if
5375  } //j
5376  // clean-up
5377  if (Ghf1KKK)
5378  delete Ghf1KKK;
5379  if (Ghf1LLL)
5380  delete Ghf1LLL;
5381  // if (Ghf1) delete Ghf1;
5382 
5383  //====================================================================== alexhf[k][i]
5384  for (int jphi = 0; jphi < njphi; jphi++) {
5385  for (int i = 0; i < nx; i++) {
5386  double sumccc1 = 0.;
5387  int isum = 0;
5388  for (int jeta = 0; jeta < njeta; jeta++) {
5389  double ccc1 = alexall[jeta][jphi][i];
5390  if (ccc1 > 0.) {
5391  sumccc1 += ccc1;
5392  isum++;
5393  }
5394  } // for jeta
5395  if (isum > 0.)
5396  sumccc1 /= isum;
5397  alexhf[jphi][i] = sumccc1;
5398  }
5399  } //for for
5400  //====================================================================== blexhf[k][i]
5401  for (int keta = 0; keta < njeta; keta++) {
5402  for (int i = 0; i < nx; i++) {
5403  double sumccc1 = 0.;
5404  int isum = 0;
5405  for (int kphi = 0; kphi < njphi; kphi++) {
5406  double ccc1 = alexall[keta][kphi][i];
5407  if (ccc1 > 0.) {
5408  sumccc1 += ccc1;
5409  isum++;
5410  }
5411  } // for kphi
5412  if (isum > 0.)
5413  sumccc1 /= isum;
5414  blexhf[keta][i] = sumccc1;
5415  }
5416  } //for for
5418  //========================================================================================== 60 HF:: 2D jeta = 0 - 21 jphi =0 - 17
5419  //======================================================================
5420  //======================================================================
5421  //======================================================================
5422  //======================================================================
5423  cout << " RBX HF 2D plot *****" << endl;
5424  cRBX1->Clear();
5426  cRBX1->Divide(1, 1);
5427  cRBX1->cd(1);
5428  // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ; k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
5429  TH2F *Ghf42D = new TH2F("Ghf42D", "", 23, -11.5, 11.5, 18, 0., 18.);
5430  TH2F *Ghf42D0 = new TH2F("Ghf42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
5431  // TH2F* Ghf42D = new TH2F("Ghf42D","", 22, -11., 11., 18, 0., 18. );
5432  // TH2F* Ghf42D0 = new TH2F("Ghf42D0","", 22, -11., 11., 18, 0., 18. );
5433  TH2F *Ghf42DF = (TH2F *)Ghf42D0->Clone("Ghf42DF");
5434  for (int jphi = 0; jphi < njphi; jphi++) {
5435  for (int jeta = 0; jeta < njeta; jeta++) {
5436  for (int i = 0; i < nx; i++) {
5437  double ccc1 = alexall[jeta][jphi][i];
5438  int neweta = jeta - 11 - 0.5;
5439  if (jeta >= 11)
5440  neweta = jeta - 11 + 1.5;
5441  if (ccc1 > 0.) {
5442  Ghf42D->Fill(neweta, jphi, ccc1);
5443  Ghf42D0->Fill(neweta, jphi, 1.);
5444  }
5445  // if(ccc1>0.) {Ghf42D ->Fill(jeta-11,jphi,ccc1); Ghf42D0 ->Fill(jeta-11,jphi,1.); }
5446  }
5447  }
5448  }
5449  Ghf42DF->Divide(Ghf42D, Ghf42D0, 1, 1, "B"); // average A
5450  // Ghf1->Sumw2();
5451  gPad->SetGridy();
5452  gPad->SetGridx(); // gPad->SetLogz();
5453  Ghf42DF->SetMarkerStyle(20);
5454  Ghf42DF->SetMarkerSize(0.4);
5455  Ghf42DF->GetZaxis()->SetLabelSize(0.04);
5456  Ghf42DF->SetXTitle("<A>_RBX #eta \b");
5457  Ghf42DF->SetYTitle(" #phi \b");
5458  Ghf42DF->SetZTitle("<A>_RBX - All \b");
5459  Ghf42DF->SetMarkerColor(2);
5460  Ghf42DF->SetLineColor(2); // Ghf42DF->SetMaximum(1.000); // Ghf42DF->SetMinimum(1.0);
5461  Ghf42DF->Draw("COLZ");
5462 
5464  cRBX1->Update();
5465  cRBX1->Print("RBX-HF-2Dplot.png");
5466  cRBX1->Clear();
5467  // clean-up
5468  if (Ghf42D)
5469  delete Ghf42D;
5470  if (Ghf42D0)
5471  delete Ghf42D0;
5472  if (Ghf42DF)
5473  delete Ghf42DF;
5474 
5475  //========================================================================================== 61 HF:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
5476  //======================================================================
5477  //======================================================================
5478  //======================================================================
5479  //======================================================================
5480  cout << " RBX HF 1D plot *****" << endl;
5481  cRBX1->Clear();
5483  cRBX1->Divide(1, 1);
5484  cRBX1->cd(1);
5485  TH1F *GphiHF1D = new TH1F("GphiHF1D", "", 18, 0., 18.);
5486  TH1F *GphiHF1D0 = new TH1F("GphiHF1D0", "", 18, 0., 18.);
5487  TH1F *GphiHF1DF = (TH1F *)GphiHF1D0->Clone("GphiHF1DF");
5488  for (int jphi = 0; jphi < 18; jphi++) {
5489  for (int jeta = 0; jeta < 22; jeta++) {
5490  for (int i = 0; i < nx; i++) {
5491  double ccc1 = alexall[jeta][jphi][i];
5492  if (ccc1 > 0.) {
5493  GphiHF1D->Fill(jphi, ccc1);
5494  GphiHF1D0->Fill(jphi, 1.);
5495  }
5496  }
5497  }
5498  }
5499  // GphiHF1D->Sumw2();GphiHF1D0->Sumw2();
5500  GphiHF1DF->Divide(GphiHF1D, GphiHF1D0, 1, 1, "B"); // average A
5501  // GphiHF1DF->Sumw2();
5502  for (int jphi = 1; jphi < 19; jphi++) {
5503  GphiHF1DF->SetBinError(jphi, 0.01);
5504  }
5505  gPad->SetGridy();
5506  gPad->SetGridx(); // gPad->SetLogz();
5507  GphiHF1DF->SetMarkerStyle(20);
5508  GphiHF1DF->SetMarkerSize(1.4);
5509  GphiHF1DF->GetZaxis()->SetLabelSize(0.08);
5510  GphiHF1DF->SetXTitle("PHI of RBX\b");
5511  GphiHF1DF->SetYTitle(" <Amplitude> \b");
5512  GphiHF1DF->SetZTitle("<A>_PHI - All \b");
5513  GphiHF1DF->SetMarkerColor(4);
5514  GphiHF1DF->SetLineColor(4);
5515  GphiHF1DF->SetMinimum(0.8); // GphiHF1DF->SetMaximum(1.000);
5516  GphiHF1DF->Draw("Error");
5518  cRBX1->Update();
5519  cRBX1->Print("RBX-HF-1Dplot.png");
5520  cRBX1->Clear();
5521  // clean-up
5522  if (GphiHF1D)
5523  delete GphiHF1D;
5524  if (GphiHF1D0)
5525  delete GphiHF1D0;
5526  if (GphiHF1DF)
5527  delete GphiHF1DF;
5528 
5529  //========================================================================================== 62 HF:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
5530  //======================================================================
5531  //======================================================================
5532  //======================================================================
5533  //======================================================================
5534  cout << " RBX HF 11D plot *eta*" << endl;
5535  cRBX1->Clear();
5537  cRBX1->Divide(1, 1);
5538  cRBX1->cd(1);
5539  TH1F *GetaHF11D = new TH1F("GetaHF11D", "", 23, -11.5, 11.5);
5540  TH1F *GetaHF11D0 = new TH1F("GetaHF11D0", "", 23, -11.5, 11.5);
5541  TH1F *GetaHF11DF = (TH1F *)GetaHF11D0->Clone("GetaHF11DF");
5542 
5543  for (int jeta = 0; jeta < 22; jeta++) {
5544  for (int jphi = 0; jphi < 18; jphi++) {
5545  for (int i = 0; i < nx; i++) {
5546  double ccc1 = alexall[jeta][jphi][i];
5547  int neweta = jeta - 11 - 0.5;
5548  if (jeta >= 11)
5549  neweta = jeta - 11 + 1.5;
5550  if (ccc1 > 0.) {
5551  GetaHF11D->Fill(neweta, ccc1);
5552  GetaHF11D0->Fill(neweta, 1.);
5553  // if( i == 0 ) cout<<"62 HF: ibin= "<< i <<" jphi= "<< jphi <<" jeta= "<< jeta <<" A= "<< ccc1 <<endl;
5554  }
5555  }
5556  }
5557  }
5558  // GetaHF11D->Sumw2();GetaHF11D0->Sumw2();
5559  GetaHF11DF->Divide(GetaHF11D, GetaHF11D0, 1, 1, "B"); // average A
5560  // GetaHF11DF->Sumw2();
5561  for (int jeta = 1; jeta < 24; jeta++) {
5562  GetaHF11DF->SetBinError(jeta, 0.01);
5563  }
5564  gPad->SetGridy();
5565  gPad->SetGridx(); // gPad->SetLogz();
5566  GetaHF11DF->SetMarkerStyle(20);
5567  GetaHF11DF->SetMarkerSize(1.4);
5568  GetaHF11DF->GetZaxis()->SetLabelSize(0.08);
5569  GetaHF11DF->SetXTitle("#eta \b");
5570  GetaHF11DF->SetYTitle(" <A> \b");
5571  GetaHF11DF->SetZTitle("<A>_ETA - All \b");
5572  GetaHF11DF->SetMarkerColor(4);
5573  GetaHF11DF->SetLineColor(4);
5574  GetaHF11DF->SetMinimum(0.8); // GetaHF11DF->SetMaximum(1.000);
5575  GetaHF11DF->Draw("Error");
5576 
5578  cRBX1->Update();
5579  cRBX1->Print("RBX-HF-11Dplot.png");
5580  cRBX1->Clear();
5581  // clean-up
5582  if (GetaHF11D)
5583  delete GetaHF11D;
5584  if (GetaHF11D0)
5585  delete GetaHF11D0;
5586  if (GetaHF11DF)
5587  delete GetaHF11DF;
5588 
5589  //========================================================================================== 22 HF:: Ratio plots jeta = 0 - 21 jphi =0 - 17
5590  //======================================================================
5591  //======================================================================22.11.2018
5592  //======================================================================
5593  //======================================================================
5594 
5595  gStyle->SetOptStat(1110000);
5596  cout << " RBX HF Ratio plots *****" << endl;
5597  cRBX31->Clear();
5599  // gain stabilitY:
5600  // Rij = Aij / A1j , where i-over LSs, j-channels
5601  //
5602  // nx = maxbinsRBX; // # LS
5603  //
5604  double ccc0HF = 0.;
5605  cRBX31->Divide(3, 1);
5606  //================
5607  cRBX31->cd(1);
5608  // TH1F* Ghf5 = new TH1F("Ghf5","", nx, 1., nx+1.);
5609  TH1F *Ghf51 = new TH1F("Ghf51", "", nx, 1., nx + 1.);
5610  TH1F *Ghf50 = new TH1F("Ghf50", "", nx, 1., nx + 1.);
5611  TH1F *Ghf5 = (TH1F *)Ghf50->Clone("Ghf5");
5612  // j - etaphi index:
5613  for (int j = 1; j <= ny; j++) {
5614  ccc0HF = Ghf1->GetBinContent(1, j);
5615  // if(ccc0HF <=0.) for (int i=1;i<=nx;i++) {double ccc2 = Ghf1->GetBinContent(i,j);if(ccc2>0.){ccc0HF=ccc2;cout<<"!!! ccc0HF= "<<ccc0HF<<endl;break;} }
5616  if (ccc0HF <= 0.)
5617  for (int i = 1; i <= nx; i++) {
5618  double ccc2 = Ghf1->GetBinContent(i, j);
5619  if (ccc2 > 0.) {
5620  ccc0HF = ccc2;
5621  break;
5622  }
5623  }
5624  if (ccc0HF > 0.) {
5625  // i - # LSs:
5626  for (int i = 1; i <= nx; i++) {
5627  double ccc1 = Ghf1->GetBinContent(i, j);
5628  if (ccc1 > 0.) {
5629  double Rij = ccc1 / ccc0HF;
5630  // Ghf5 ->Fill( float(i), Rij);
5631  Ghf51->Fill(float(i), Rij);
5632  Ghf50->Fill(float(i), 1.);
5633  }
5634  }
5635  }
5636  }
5637  Ghf5->Divide(Ghf51, Ghf50, 1, 1, "B"); // average A
5638  for (int i = 1; i <= nx; i++) {
5639  Ghf5->SetBinError(i, 0.0001);
5640  }
5641  Ghf5->SetMarkerStyle(20);
5642  Ghf5->SetMarkerSize(0.4);
5643  Ghf5->GetYaxis()->SetLabelSize(0.04);
5644  Ghf5->SetMarkerColor(2);
5645  Ghf5->SetLineColor(0);
5646  Ghf5->SetXTitle(" iLS \b");
5647  Ghf5->SetYTitle(" <R> \b");
5648  Ghf5->SetTitle("<Ri> vs iLS \b");
5649  Ghf5->SetMinimum(0.); //Ghf5->SetMaximum(2.5);
5650  // gPad->SetLogy();
5651  gPad->SetGridy();
5652  gPad->SetGridx();
5653  Ghf5->SetStats(0);
5654  Ghf5->GetYaxis()->SetLabelSize(0.025);
5655  Ghf5->Draw("Error");
5656  //================
5657  cRBX31->cd(2);
5658  TH2F *Ghf60 = new TH2F("Ghf60", "", 22, -11., 11., 18, 0., 18.);
5659  TH2F *Ghf61 = new TH2F("Ghf61", "", 22, -11., 11., 18, 0., 18.);
5660  TH2F *Ghf6 = new TH2F("Ghf6", "", 22, -11., 11., 18, 0., 18.);
5661 
5662  TH2F *G20hf60 = new TH2F("G20hf60", "", 22, -11., 11., 18, 0., 18.);
5663  TH2F *G20hf61 = new TH2F("G20hf61", "", 22, -11., 11., 18, 0., 18.);
5664  TH2F *G20hf6 = new TH2F("G20hf6", "", 22, -11., 11., 18, 0., 18.);
5665  TH2F *G30hf60 = new TH2F("G30hf60", "", 22, -11., 11., 18, 0., 18.);
5666  TH2F *G30hf61 = new TH2F("G30hf61", "", 22, -11., 11., 18, 0., 18.);
5667  TH2F *G30hf6 = new TH2F("G30hf6", "", 22, -11., 11., 18, 0., 18.);
5668  TH2F *G40hf60 = new TH2F("G40hf60", "", 22, -11., 11., 18, 0., 18.);
5669  TH2F *G40hf61 = new TH2F("G40hf61", "", 22, -11., 11., 18, 0., 18.);
5670  TH2F *G40hf6 = new TH2F("G40hf6", "", 22, -11., 11., 18, 0., 18.);
5671  // j - etaphi index; i - # LSs;
5672  //
5673  // define mean and RMS:
5674  double sumjHF = 0.;
5675  int njHF = 0;
5676  double meanjHF = 0.;
5677  for (int j = 1; j <= ny; j++) {
5678  ccc0HF = Ghf1->GetBinContent(1, j);
5679  if (ccc0HF <= 0.)
5680  for (int i = 1; i <= nx; i++) {
5681  double ccc2 = Ghf1->GetBinContent(i, j);
5682  if (ccc2 > 0.) {
5683  ccc0HF = ccc2;
5684  break;
5685  }
5686  }
5687  if (ccc0HF > 0.) {
5688  for (int i = 1; i <= nx; i++) {
5689  double ccc1 = Ghf1->GetBinContent(i, j) / ccc0HF;
5690  if (ccc1 > 0.) {
5691  sumjHF += ccc1;
5692  njHF++;
5693  }
5694  }
5695  meanjHF = sumjHF / njHF;
5696  }
5697  } // j
5698 
5699  double ssumjHF = 0.;
5700  njHF = 0;
5701  double sigmajHF = 0.;
5702  for (int j = 1; j <= ny; j++) {
5703  ccc0HF = Ghf1->GetBinContent(1, j);
5704  if (ccc0HF <= 0.)
5705  for (int i = 1; i <= nx; i++) {
5706  double ccc2 = Ghf1->GetBinContent(i, j);
5707  if (ccc2 > 0.) {
5708  ccc0HF = ccc2;
5709  break;
5710  }
5711  }
5712  if (ccc0HF > 0.) {
5713  for (int i = 1; i <= nx; i++) {
5714  double ccc1 = Ghf1->GetBinContent(i, j) / ccc0HF;
5715  if (ccc1 > 0.) {
5716  ssumjHF += (ccc1 - meanjHF) * (ccc1 - meanjHF);
5717  njHF++;
5718  }
5719  }
5720  sigmajHF = sqrt(ssumjHF / njHF);
5721  }
5722  } // j
5723 
5724  double dif3rmsHFMIN = meanjHF - 3 * sigmajHF;
5725  if (dif3rmsHFMIN < 0.)
5726  dif3rmsHFMIN = 0.;
5727  double dif3rmsHFMAX = meanjHF + 3 * sigmajHF;
5728  cout << "22HF-2 meanjHF= " << meanjHF << " sigmajHF= " << sigmajHF << " dif3rmsHFMIN= " << dif3rmsHFMIN
5729  << " dif3rmsHFMAX= " << dif3rmsHFMAX << endl;
5730 
5731  double MAXdif3rmsHFMIN = dif3rmsHFMIN;
5732  double MINdif3rmsHFMAX = dif3rmsHFMAX;
5733  if (MAXdif3rmsHFMIN < 0.95)
5734  MAXdif3rmsHFMIN = 0.95;
5735  if (MINdif3rmsHFMAX > 1.05)
5736  MINdif3rmsHFMAX = 1.05;
5737  cout << "22HF-2 MAXdif3rmsHFMIN= " << MAXdif3rmsHFMIN << " MINdif3rmsHFMAX= " << MINdif3rmsHFMAX << endl;
5738  //
5739  for (int j = 1; j <= ny; j++) {
5740  ccc0HF = Ghf1->GetBinContent(1, j);
5741  if (ccc0HF <= 0.)
5742  for (int i = 1; i <= nx; i++) {
5743  double ccc2 = Ghf1->GetBinContent(i, j);
5744  if (ccc2 > 0.) {
5745  ccc0HF = ccc2;
5746  break;
5747  }
5748  }
5749  if (ccc0HF > 0.) {
5750  int jeta = (j - 1) / 18; // jeta = 0-21
5751  int jphi = (j - 1) - 18 * jeta; // jphi=0-17
5752  // i - # LSs:
5753  for (int i = 1; i <= nx; i++) {
5754  double ccc1 = Ghf1->GetBinContent(i, j);
5755  if (ccc1 > 0.) {
5756  double Rij = ccc1 / ccc0HF;
5757  if (Rij < MAXdif3rmsHFMIN || Rij > MINdif3rmsHFMAX) {
5758  Ghf61->Fill(jeta - 11, jphi, Rij);
5759  Ghf60->Fill(jeta - 11, jphi, 1.);
5760  }
5761  if (Rij < 0.8 || Rij > 1.2) {
5762  G20hf61->Fill(jeta - 11, jphi, Rij);
5763  G20hf60->Fill(jeta - 11, jphi, 1.);
5764  }
5765  if (Rij < 0.7 || Rij > 1.3) {
5766  G30hf61->Fill(jeta - 11, jphi, Rij);
5767  G30hf60->Fill(jeta - 11, jphi, 1.);
5768  }
5769  if (Rij < 0.6 || Rij > 1.4) {
5770  G40hf61->Fill(jeta - 11, jphi, Rij);
5771  G40hf60->Fill(jeta - 11, jphi, 1.);
5772  }
5773  } //if(ccc1>0.
5774  } // i
5775  } //if(ccc0HF>0
5776  } // j
5777  Ghf6->Divide(Ghf61, Ghf60, 1, 1, "B"); // average R
5778  G20hf6->Divide(G20hf61, G20hf60, 1, 1, "B"); // average R
5779  G30hf6->Divide(G30hf61, G30hf60, 1, 1, "B"); // average R
5780  G40hf6->Divide(G40hf61, G40hf60, 1, 1, "B"); // average R
5781  // Ghf6->SetLabelOffset (Float_t offset=0.005, Option_t *axis="X")//Set offset between axis and axis' labels
5782  // Ghf6->GetZaxis()->SetLabelOffset(-0.05);
5783  Ghf6->GetZaxis()->SetLabelSize(0.025);
5784 
5785  Ghf6->SetXTitle(" #eta \b");
5786  Ghf6->SetYTitle(" #phi \b");
5787  Ghf6->SetTitle(
5788  "<Rj> for |1-<R>| > 0.05 \b"); // Ghf6->SetMaximum(1.000); // Ghf6->SetMinimum(1.0); //Ghf6->SetZTitle("Rij averaged over LSs \b"); //Ghf6->GetZaxis()->SetLabelSize(0.04); //Ghf6->SetMarkerStyle(20);// Ghf6->SetMarkerSize(0.4);//Ghf6->SetMarkerColor(2); //Ghf6->SetLineColor(2);
5789  //gStyle->SetOptStat(kFALSE);
5790  Ghf6->SetStats(0);
5791  Ghf6->Draw("COLZ");
5792  //================
5793  cRBX31->cd(3);
5794  TH1F *Ghf7 = new TH1F("Ghf7", "", 120, 0.4, 1.6);
5795  // j - etaphi index:
5796  for (int j = 1; j <= ny; j++) {
5797  ccc0HF = Ghf1->GetBinContent(1, j);
5798  if (ccc0HF <= 0.)
5799  for (int i = 1; i <= nx; i++) {
5800  double ccc2 = Ghf1->GetBinContent(i, j);
5801  if (ccc2 > 0.) {
5802  ccc0HF = ccc2;
5803  break;
5804  }
5805  }
5806  if (ccc0HF > 0.) {
5807  // i - # LSs:
5808  for (int i = 1; i <= nx; i++) {
5809  double ccc1 = Ghf1->GetBinContent(i, j);
5810  if (ccc1 > 0.) {
5811  double Rij = ccc1 / ccc0HF;
5812  Ghf7->Fill(Rij);
5813  }
5814  }
5815  }
5816  }
5817  Ghf7->SetMarkerStyle(20);
5818  Ghf7->SetMarkerSize(0.4);
5819  Ghf7->GetYaxis()->SetLabelSize(0.04);
5820  Ghf7->SetMarkerColor(2);
5821  Ghf7->SetLineColor(0);
5822  Ghf7->SetYTitle(" N \b");
5823  Ghf7->SetXTitle(" Rij \b");
5824  Ghf7->SetTitle(" Rij \b");
5825  //Ghf7->SetMinimum(0.8);Ghf7->SetMaximum(500.);
5826  gPad->SetGridy();
5827  gPad->SetGridx(); // gPad->SetLogy();
5828  // Ghf7->SetStats(1110000);
5829  Ghf7->GetYaxis()->SetLabelSize(0.025);
5830  Ghf7->Draw("Error");
5831  Float_t ymaxHF = Ghf7->GetMaximum();
5832  cout << "22HF-3 ymaxHF= " << ymaxHF << " MAXdif3rmsHFMIN= " << MAXdif3rmsHFMIN
5833  << " MINdif3rmsHFMAX= " << MINdif3rmsHFMAX << endl;
5834  TLine *lineHF = new TLine(MAXdif3rmsHFMIN, 0., MAXdif3rmsHFMIN, ymaxHF);
5835  lineHF->SetLineColor(kBlue);
5836  lineHF->Draw();
5837  TLine *line1HF = new TLine(MINdif3rmsHFMAX, 0., MINdif3rmsHFMAX, ymaxHF);
5838  line1HF->SetLineColor(kBlue);
5839  line1HF->Draw();
5840  //================
5842  cRBX31->Update();
5843  cRBX31->Print("RBX-HF-3plots.png");
5844  cRBX31->Clear();
5845  // clean-up
5846  if (Ghf5)
5847  delete Ghf5;
5848  if (Ghf60)
5849  delete Ghf60;
5850  if (Ghf61)
5851  delete Ghf61;
5852  if (Ghf6)
5853  delete Ghf6;
5854  if (Ghf7)
5855  delete Ghf7;
5856 
5857  if (G20hf60)
5858  delete G20hf60;
5859  if (G20hf61)
5860  delete G20hf61;
5861  if (G30hf60)
5862  delete G30hf60;
5863  if (G30hf61)
5864  delete G30hf61;
5865  if (G40hf60)
5866  delete G40hf60;
5867  if (G40hf61)
5868  delete G40hf61;
5869 
5870  if (Ghf1)
5871  delete Ghf1;
5872  //========================================================================================== 22-1 HF:: Ratio plots jeta = 0 - 21 jphi =0 - 17
5873  //======================================================================
5874  //======================================================================28.11.2018
5875  //======================================================================
5876  //======================================================================
5877 
5878  gStyle->SetOptStat(1110000);
5879  cout << " RBX HF Ratio plotsmore *****" << endl;
5880  cRBX31->Clear();
5882  cRBX31->Divide(3, 1);
5883  //================
5884  cRBX31->cd(1);
5885  G20hf6->GetZaxis()->SetLabelSize(0.025);
5886  G20hf6->SetXTitle(" #eta \b");
5887  G20hf6->SetYTitle(" #phi \b");
5888  G20hf6->SetTitle("<Rj> for |1-<R>| > 0.20 \b");
5889  G20hf6->SetStats(0);
5890  G20hf6->Draw("COLZ");
5891  //================
5892  cRBX31->cd(2);
5893  G30hf6->GetZaxis()->SetLabelSize(0.025);
5894  G30hf6->SetXTitle(" #eta \b");
5895  G30hf6->SetYTitle(" #phi \b");
5896  G30hf6->SetTitle("<Rj> for |1-<R>| > 0.30 \b");
5897  G30hf6->SetStats(0);
5898  G30hf6->Draw("COLZ");
5899  //================
5900  cRBX31->cd(3);
5901  G40hf6->GetZaxis()->SetLabelSize(0.025);
5902  G40hf6->SetXTitle(" #eta \b");
5903  G40hf6->SetYTitle(" #phi \b");
5904  G40hf6->SetTitle("<Rj> for |1-<R>| > 0.40 \b");
5905  G40hf6->SetStats(0);
5906  G40hf6->Draw("COLZ");
5907  //================
5908 
5910  cRBX31->Update();
5911  cRBX31->Print("RBX-HF-3plotsmore.png");
5912  cRBX31->Clear();
5913 
5914  // clean-up
5915  if (G20hf6)
5916  delete G20hf6;
5917  if (G30hf6)
5918  delete G30hf6;
5919  if (G40hf6)
5920  delete G40hf6;
5921  gStyle->SetOptStat(0);
5923  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5924  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5925  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5927 
5929 
5931  //=============================================================================== occupancyHB
5932  // For occupancy plots. Produces OccPlots_HBx.png (x=1)
5933  int mymaxbins = MaxLum;
5934  {
5935  cHB->Clear();
5936  cHB->Divide(2, 1);
5938  cHB->cd(1);
5939  TH2F *occhbm = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HBM");
5940  TH1F *uyhbm = new TH1F("uyhbm", "", mymaxbins, 1., mymaxbins + 1.);
5941  for (int i = 1; i <= occhbm->GetXaxis()->GetNbins(); i++) {
5942  double ccc1 = occhbm->GetBinContent(i);
5943  // if(ccc1>0.) cout<<" depth1_HB iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
5944  if (ccc1 > 0.)
5945  uyhbm->Fill(float(i), ccc1);
5946  }
5947  // gPad->SetLogy();
5948  uyhbm->SetMarkerStyle(20);
5949  uyhbm->SetMarkerSize(0.6);
5950  uyhbm->GetYaxis()->SetLabelSize(0.04);
5951  uyhbm->SetXTitle("min/av occupancy - HBM \b");
5952  uyhbm->SetMarkerColor(2);
5953  uyhbm->SetLineColor(0);
5954  uyhbm->SetMaximum(1.0);
5955  uyhbm->SetMinimum(0.2);
5956  gPad->SetGridy();
5957  uyhbm->Draw("Error");
5959  cHB->cd(2);
5960  TH2F *occhbp = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HBP");
5961  TH1F *uyhbp = new TH1F("uyhbp", "", mymaxbins, 1., mymaxbins + 1.);
5962  for (int i = 1; i <= occhbp->GetXaxis()->GetNbins(); i++) {
5963  double ccc1 = occhbp->GetBinContent(i);
5964  // if(ccc1>0.) cout<<" depth1_HB iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
5965  if (ccc1 > 0.)
5966  uyhbp->Fill(float(i), ccc1);
5967  }
5968  // gPad->SetLogy();
5969  uyhbp->SetMarkerStyle(20);
5970  uyhbp->SetMarkerSize(0.6);
5971  uyhbp->GetYaxis()->SetLabelSize(0.04);
5972  uyhbp->SetXTitle("min/av occupancy - HBP \b");
5973  uyhbp->SetMarkerColor(2);
5974  uyhbp->SetLineColor(0);
5975  uyhbp->SetMaximum(1.0);
5976  uyhbp->SetMinimum(0.2);
5977  gPad->SetGridy();
5978  uyhbp->Draw("Error");
5980 
5982  cHB->Update();
5983  cHB->Print(Form("OccPlots_HB.png"));
5984  cHB->Clear();
5985 
5986  // clean-up
5987  if (occhbm)
5988  delete occhbm;
5989  if (uyhbm)
5990  delete uyhbm;
5991  if (occhbp)
5992  delete occhbp;
5993  if (uyhbp)
5994  delete uyhbp;
5995  }
5996  //=============================================================================== occupancyHE
5997  // For occupancy plots. Produces OccPlots_HEx.png (x=1)
5998  {
5999  cHB->Clear();
6000  cHB->Divide(2, 1);
6002  cHB->cd(1);
6003  TH2F *occhem = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HEM");
6004  TH1F *uyhem = new TH1F("uyhem", "", mymaxbins, 1., mymaxbins + 1.);
6005  for (int i = 1; i <= occhem->GetXaxis()->GetNbins(); i++) {
6006  double ccc1 = occhem->GetBinContent(i);
6007  // if(ccc1>0.) cout<<" depth1_HE iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6008  if (ccc1 > 0.)
6009  uyhem->Fill(float(i), ccc1);
6010  }
6011  // gPad->SetLogy();
6012  uyhem->SetMarkerStyle(20);
6013  uyhem->SetMarkerSize(0.6);
6014  uyhem->GetYaxis()->SetLabelSize(0.04);
6015  uyhem->SetXTitle("min/av occupancy - HEM \b");
6016  uyhem->SetMarkerColor(2);
6017  uyhem->SetLineColor(0);
6018  uyhem->SetMaximum(1.0);
6019  uyhem->SetMinimum(0.2);
6020  gPad->SetGridy();
6021  uyhem->Draw("Error");
6023  cHB->cd(2);
6024  TH2F *occhep = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HEP");
6025  TH1F *uyhep = new TH1F("uyhep", "", mymaxbins, 1., mymaxbins + 1.);
6026  for (int i = 1; i <= occhep->GetXaxis()->GetNbins(); i++) {
6027  double ccc1 = occhep->GetBinContent(i);
6028  // if(ccc1>0.) cout<<" depth1_HE iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6029  if (ccc1 > 0.)
6030  uyhep->Fill(float(i), ccc1);
6031  }
6032  // gPad->SetLogy();
6033  uyhep->SetMarkerStyle(20);
6034  uyhep->SetMarkerSize(0.6);
6035  uyhep->GetYaxis()->SetLabelSize(0.04);
6036  uyhep->SetXTitle("min/av occupancy - HEP \b");
6037  uyhep->SetMarkerColor(2);
6038  uyhep->SetLineColor(0);
6039  uyhep->SetMaximum(1.0);
6040  uyhep->SetMinimum(0.2);
6041  gPad->SetGridy();
6042  uyhep->Draw("Error");
6044 
6046  cHB->Update();
6047  cHB->Print(Form("OccPlots_HE.png"));
6048  cHB->Clear();
6049 
6050  // clean-up
6051  if (occhem)
6052  delete occhem;
6053  if (uyhem)
6054  delete uyhem;
6055  if (occhep)
6056  delete occhep;
6057  if (uyhep)
6058  delete uyhep;
6059  }
6060  //=============================================================================== occupancyHO
6061  // For occupancy plots. Produces OccPlots_HOx.png (x=1)
6062  {
6063  cHB->Clear();
6064  cHB->Divide(2, 1);
6066  cHB->cd(1);
6067  TH2F *occhom = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HOM");
6068  TH1F *uyhom = new TH1F("uyhom", "", mymaxbins, 1., mymaxbins + 1.);
6069  for (int i = 1; i <= occhom->GetXaxis()->GetNbins(); i++) {
6070  double ccc1 = occhom->GetBinContent(i);
6071  // if(ccc1>0.) cout<<" depth1_HO iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6072  if (ccc1 > 0.)
6073  uyhom->Fill(float(i), ccc1);
6074  }
6075  // gPad->SetLogy();
6076  uyhom->SetMarkerStyle(20);
6077  uyhom->SetMarkerSize(0.6);
6078  uyhom->GetYaxis()->SetLabelSize(0.04);
6079  uyhom->SetXTitle("min/av occupancy - HOM \b");
6080  uyhom->SetMarkerColor(2);
6081  uyhom->SetLineColor(0);
6082  uyhom->SetMaximum(1.0);
6083  uyhom->SetMinimum(0.2);
6084  gPad->SetGridy();
6085  uyhom->Draw("Error");
6087  cHB->cd(2);
6088  TH2F *occhop = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HOP");
6089  TH1F *uyhop = new TH1F("uyhop", "", mymaxbins, 1., mymaxbins + 1.);
6090  for (int i = 1; i <= occhop->GetXaxis()->GetNbins(); i++) {
6091  double ccc1 = occhop->GetBinContent(i);
6092  // if(ccc1>0.) cout<<" depth1_HO iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6093  if (ccc1 > 0.)
6094  uyhop->Fill(float(i), ccc1);
6095  }
6096  // gPad->SetLogy();
6097  uyhop->SetMarkerStyle(20);
6098  uyhop->SetMarkerSize(0.6);
6099  uyhop->GetYaxis()->SetLabelSize(0.04);
6100  uyhop->SetXTitle("min/av occupancy - HOP \b");
6101  uyhop->SetMarkerColor(2);
6102  uyhop->SetLineColor(0);
6103  uyhop->SetMaximum(1.0);
6104  uyhop->SetMinimum(0.2);
6105  gPad->SetGridy();
6106  uyhop->Draw("Error");
6108 
6110  cHB->Update();
6111  cHB->Print(Form("OccPlots_HO.png"));
6112  cHB->Clear();
6113 
6114  // clean-up
6115  if (occhom)
6116  delete occhom;
6117  if (uyhom)
6118  delete uyhom;
6119  if (occhop)
6120  delete occhop;
6121  if (uyhop)
6122  delete uyhop;
6123  }
6124  //=============================================================================== occupancyHF
6125  // For occupancy plots. Produces OccPlots_HFx.png (x=1)
6126  {
6127  cHB->Clear();
6128  cHB->Divide(2, 1);
6130  cHB->cd(1);
6131  TH2F *occhfm = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HFM");
6132  TH1F *uyhfm = new TH1F("uyhfm", "", mymaxbins, 1., mymaxbins + 1.);
6133  for (int i = 1; i <= occhfm->GetXaxis()->GetNbins(); i++) {
6134  double ccc1 = occhfm->GetBinContent(i);
6135  // if(ccc1>0.) cout<<" depth1_HF iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6136  if (ccc1 > 0.)
6137  uyhfm->Fill(float(i), ccc1);
6138  }
6139  // gPad->SetLogy();
6140  uyhfm->SetMarkerStyle(20);
6141  uyhfm->SetMarkerSize(0.6);
6142  uyhfm->GetYaxis()->SetLabelSize(0.04);
6143  uyhfm->SetXTitle("min/av occupancy - HFM \b");
6144  uyhfm->SetMarkerColor(2);
6145  uyhfm->SetLineColor(0);
6146  uyhfm->SetMaximum(1.0);
6147  uyhfm->SetMinimum(0.2);
6148  gPad->SetGridy();
6149  uyhfm->Draw("Error");
6151  cHB->cd(2);
6152  TH2F *occhfp = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HFP");
6153  TH1F *uyhfp = new TH1F("uyhfp", "", mymaxbins, 1., mymaxbins + 1.);
6154  for (int i = 1; i <= occhfp->GetXaxis()->GetNbins(); i++) {
6155  double ccc1 = occhfp->GetBinContent(i);
6156  // if(ccc1>0.) cout<<" depth1_HF iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6157  if (ccc1 > 0.)
6158  uyhfp->Fill(float(i), ccc1);
6159  }
6160  // gPad->SetLogy();
6161  uyhfp->SetMarkerStyle(20);
6162  uyhfp->SetMarkerSize(0.6);
6163  uyhfp->GetYaxis()->SetLabelSize(0.04);
6164  uyhfp->SetXTitle("min/av occupancy - HFP \b");
6165  uyhfp->SetMarkerColor(2);
6166  uyhfp->SetLineColor(0);
6167  uyhfp->SetMaximum(1.0);
6168  uyhfp->SetMinimum(0.2);
6169  gPad->SetGridy();
6170  uyhfp->Draw("Error");
6172 
6174  cHB->Update();
6175  cHB->Print(Form("OccPlots_HF.png"));
6176  cHB->Clear();
6177 
6178  // clean-up
6179  if (occhfm)
6180  delete occhfm;
6181  if (uyhfm)
6182  delete uyhfm;
6183  if (occhfp)
6184  delete occhfp;
6185  if (uyhfp)
6186  delete uyhfp;
6187  }
6188  std::cout << "************>>> occupancy plots done" << std::endl;
6189 
6194  //************************* ***** Signal *****
6195  cout << ">>>>>>>>>>>>>>>>>>>>>>>>start Summed Amplitude Plots " << endl;
6196  int maxbins = MaxLum;
6197  cout << ">>>> maxbins = " << maxbins << endl;
6198  TH1F *SummedAmplitudeHisto[4]; // 1d histogramm for subdet
6199  SummedAmplitudeHisto[0] = (TH1F *)dir->FindObjectAny("h_averSIGNALsumamplitude_HB");
6200  SummedAmplitudeHisto[1] = (TH1F *)dir->FindObjectAny("h_averSIGNALsumamplitude_HE");
6201  SummedAmplitudeHisto[2] = (TH1F *)dir->FindObjectAny("h_averSIGNALsumamplitude_HO");
6202  SummedAmplitudeHisto[3] = (TH1F *)dir->FindObjectAny("h_averSIGNALsumamplitude_HF");
6203  TH1F *SummedAmplitudeOccupancyHisto[4]; // 1d histogramm for subdet
6204  SummedAmplitudeOccupancyHisto[0] = (TH1F *)dir->FindObjectAny("h_averSIGNALoccupancy_HB");
6205  SummedAmplitudeOccupancyHisto[1] = (TH1F *)dir->FindObjectAny("h_averSIGNALoccupancy_HE");
6206  SummedAmplitudeOccupancyHisto[2] = (TH1F *)dir->FindObjectAny("h_averSIGNALoccupancy_HO");
6207  SummedAmplitudeOccupancyHisto[3] = (TH1F *)dir->FindObjectAny("h_averSIGNALoccupancy_HF");
6208  for (int sub = 0; sub < 4; sub++) {
6209  cHE->Clear();
6210  cHE->Divide(2, 1);
6211  cHE->cd(1);
6212  TH1F *kslpq = new TH1F("kslpq", "", maxbins, 1., maxbins + 1.);
6213  // cout<<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> sub = "<< sub <<endl;
6214  for (int i = 1; i <= kslpq->GetXaxis()->GetNbins(); i++) {
6215  double ccc1 = 0.;
6216  if (SummedAmplitudeHisto[sub])
6217  ccc1 = SummedAmplitudeHisto[sub]->GetBinContent(i);
6218  // if(ccc1>0.) cout<<" iLS = "<<i<<" LS= "<<ccc1<<endl;
6219  if (ccc1 > 0.)
6220  kslpq->Fill(float(i), ccc1);
6221  }
6222  // gPad->SetLogy();
6223  kslpq->SetMarkerStyle(20);
6224  kslpq->SetMarkerSize(0.8);
6225  kslpq->GetYaxis()->SetLabelSize(0.04);
6226  kslpq->SetXTitle("SumA of channels w/ signal per LS \b");
6227  kslpq->SetMarkerColor(2);
6228  kslpq->SetLineColor(0);
6229  // kslpq->SetMinimum(0.8);
6230  gPad->SetGridx();
6231  kslpq->Draw("Error");
6233  cHE->cd(2);
6234  TH1F *pqmks = new TH1F("pqmks", "", maxbins, 1., maxbins + 1.);
6235  for (int i = 1; i <= pqmks->GetXaxis()->GetNbins(); i++) {
6236  double ccc1 = 0.;
6237  if (SummedAmplitudeOccupancyHisto[sub])
6238  ccc1 = SummedAmplitudeOccupancyHisto[sub]->GetBinContent(i);
6239  // if(ccc1>0.) cout<<" iLS = "<<i<<" LS= "<<ccc1<<endl;
6240  if (ccc1 > 0.)
6241  pqmks->Fill(float(i), ccc1);
6242  }
6243  // gPad->SetLogy();
6244  pqmks->SetMarkerStyle(20);
6245  pqmks->SetMarkerSize(0.8);
6246  pqmks->GetYaxis()->SetLabelSize(0.04);
6247  pqmks->SetXTitle("Occupancy of channels w/ signal per LS \b");
6248  pqmks->SetMarkerColor(4);
6249  pqmks->SetLineColor(0);
6250  // pqmks->SetMinimum(0.8);
6251  gPad->SetGridx();
6252  pqmks->Draw("Error");
6253  cHE->Update();
6254  if (sub == 0)
6255  cHE->Print("SummedAmplitudesSignal_HB.png");
6256  if (sub == 1)
6257  cHE->Print("SummedAmplitudesSignal_HE.png");
6258  if (sub == 2)
6259  cHE->Print("SummedAmplitudesSignal_HO.png");
6260  if (sub == 3)
6261  cHE->Print("SummedAmplitudesSignal_HF.png");
6262  cHE->Clear();
6263  if (kslpq)
6264  delete kslpq;
6265  if (pqmks)
6266  delete pqmks;
6267  } //for
6268  // clean-up
6269  //for (unsigned int i=0; i<4; i++) {delete SummedAmplitudeHisto[i];delete SummedAmplitudeOccupancyHisto[i];}
6270 
6273  //************************* ***** NoSignal *****
6274  cout << ">>>>>>>>>>>>>>>>>>>>>>>>start Summed Amplitude Plots NoSignal " << endl;
6275  TH1F *NoSignalSummedAmplitudeHisto[4]; // 1d histogramm for subdet
6276  NoSignalSummedAmplitudeHisto[0] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALsumamplitude_HB");
6277  NoSignalSummedAmplitudeHisto[1] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALsumamplitude_HE");
6278  NoSignalSummedAmplitudeHisto[2] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALsumamplitude_HO");
6279  NoSignalSummedAmplitudeHisto[3] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALsumamplitude_HF");
6280  TH1F *NoSignalSummedAmplitudeOccupancyHisto[4]; // 1d histogramm for subdet
6281  NoSignalSummedAmplitudeOccupancyHisto[0] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALoccupancy_HB");
6282  NoSignalSummedAmplitudeOccupancyHisto[1] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALoccupancy_HE");
6283  NoSignalSummedAmplitudeOccupancyHisto[2] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALoccupancy_HO");
6284  NoSignalSummedAmplitudeOccupancyHisto[3] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALoccupancy_HF");
6285  for (int sub = 0; sub < 4; sub++) {
6286  cHE->Clear();
6287  cHE->Divide(2, 1);
6288 
6289  cHE->cd(1);
6290  TH1F *kslpq = new TH1F("kslpq", "", maxbins, 1., maxbins + 1.);
6291  for (int i = 1; i <= kslpq->GetXaxis()->GetNbins(); i++) {
6292  double ccc1 = 0.;
6293  if (NoSignalSummedAmplitudeHisto[sub])
6294  ccc1 = NoSignalSummedAmplitudeHisto[sub]->GetBinContent(i);
6295  // if(ccc1>0.) cout<<" iLS = "<<i<<" LS= "<<ccc1<<endl;
6296  if (ccc1 > 0.)
6297  kslpq->Fill(float(i), ccc1);
6298  }
6299  // gPad->SetLogy();
6300  kslpq->SetMarkerStyle(20);
6301  kslpq->SetMarkerSize(0.8);
6302  kslpq->GetYaxis()->SetLabelSize(0.04);
6303  kslpq->SetXTitle("SumA of channels w/o signal per LS \b");
6304  kslpq->SetMarkerColor(2);
6305  kslpq->SetLineColor(0);
6306  if (sub == 0) {
6307  kslpq->SetMaximum(20000.);
6308  kslpq->SetMinimum(5000.);
6309  } else if (sub == 1) {
6310  kslpq->SetMaximum(40000.);
6311  kslpq->SetMinimum(0.);
6312  } else if (sub == 2) {
6313  kslpq->SetMaximum(10000.);
6314  kslpq->SetMinimum(15000.);
6315  } else if (sub == 3) {
6316  kslpq->SetMaximum(100000.);
6317  kslpq->SetMinimum(0.);
6318  }
6319  gPad->SetGridx();
6320  kslpq->Draw("Error");
6322  cHE->cd(2);
6323  TH1F *pqmks = new TH1F("pqmks", "", maxbins, 1., maxbins + 1.);
6324  for (int i = 1; i <= pqmks->GetXaxis()->GetNbins(); i++) {
6325  double ccc1 = 0.;
6326  if (NoSignalSummedAmplitudeOccupancyHisto[sub])
6327  ccc1 = NoSignalSummedAmplitudeOccupancyHisto[sub]->GetBinContent(i);
6328  // if(ccc1>0.) cout<<" iLS = "<<i<<" LS= "<<ccc1<<endl;
6329  if (ccc1 > 0.)
6330  pqmks->Fill(float(i), ccc1);
6331  }
6332  // gPad->SetLogy();
6333  pqmks->SetMarkerStyle(20);
6334  pqmks->SetMarkerSize(0.8);
6335  pqmks->GetYaxis()->SetLabelSize(0.04);
6336  pqmks->SetXTitle("Occupancy of channels w/o signal per LS \b");
6337  pqmks->SetMarkerColor(4);
6338  pqmks->SetLineColor(0);
6339  if (sub == 0) {
6340  pqmks->SetMaximum(600.);
6341  pqmks->SetMinimum(200.);
6342  } else if (sub == 1) {
6343  pqmks->SetMaximum(910.);
6344  pqmks->SetMinimum(10.);
6345  } else if (sub == 2) {
6346  pqmks->SetMaximum(200.);
6347  pqmks->SetMinimum(50.);
6348  } else if (sub == 3) {
6349  pqmks->SetMaximum(866.);
6350  pqmks->SetMinimum(856.);
6351  }
6352  gPad->SetGridx();
6353  pqmks->Draw("Error");
6354  cHE->Update();
6355  if (sub == 0)
6356  cHE->Print("NoSignalSummedAmplitudes_HB.png");
6357  if (sub == 1)
6358  cHE->Print("NoSignalSummedAmplitudes_HE.png");
6359  if (sub == 2)
6360  cHE->Print("NoSignalSummedAmplitudes_HO.png");
6361  if (sub == 3)
6362  cHE->Print("NoSignalSummedAmplitudes_HF.png");
6363  cHE->Clear();
6364  if (kslpq)
6365  delete kslpq;
6366  if (pqmks)
6367  delete pqmks;
6368  } //for
6369  // clean-up
6370  //for (unsigned int i=0; i<4; i++) {delete NoSignalSummedAmplitudeHisto[i];delete NoSignalSummedAmplitudeOccupancyHisto[i];}
6372 
6375  //************************* ***** MaxxValues *****
6376  cout << ">>>>>>>>>>>>>>>>>>>>>>>>start Summed Amplitude Plots Maxx " << endl;
6377  TH1F *MaxxSummedAmplitudeHisto[4]; // 1d histogramm for subdet
6378  MaxxSummedAmplitudeHisto[0] = (TH1F *)dir->FindObjectAny("h_maxxSUMAmpl_HB");
6379  MaxxSummedAmplitudeHisto[1] = (TH1F *)dir->FindObjectAny("h_maxxSUMAmpl_HE");
6380  MaxxSummedAmplitudeHisto[2] = (TH1F *)dir->FindObjectAny("h_maxxSUMAmpl_HO");
6381  MaxxSummedAmplitudeHisto[3] = (TH1F *)dir->FindObjectAny("h_maxxSUMAmpl_HF");
6382  TH1F *MaxxSummedAmplitudeOccupancyHisto[4]; // 1d histogramm for subdet
6383  MaxxSummedAmplitudeOccupancyHisto[0] = (TH1F *)dir->FindObjectAny("h_maxxOCCUP_HB");
6384  MaxxSummedAmplitudeOccupancyHisto[1] = (TH1F *)dir->FindObjectAny("h_maxxOCCUP_HE");
6385  MaxxSummedAmplitudeOccupancyHisto[2] = (TH1F *)dir->FindObjectAny("h_maxxOCCUP_HO");
6386  MaxxSummedAmplitudeOccupancyHisto[3] = (TH1F *)dir->FindObjectAny("h_maxxOCCUP_HF");
6387  TH1F *SAmplitudeHisto[4]; // 1d histogramm for subdet
6388  SAmplitudeHisto[0] = (TH1F *)dir->FindObjectAny("h_eventamplitude_HB");
6389  SAmplitudeHisto[1] = (TH1F *)dir->FindObjectAny("h_eventamplitude_HE");
6390  SAmplitudeHisto[2] = (TH1F *)dir->FindObjectAny("h_eventamplitude_HO");
6391  SAmplitudeHisto[3] = (TH1F *)dir->FindObjectAny("h_eventamplitude_HF");
6392  TH1F *OccupancyHisto[4]; // 1d histogramm for subdet
6393  OccupancyHisto[0] = (TH1F *)dir->FindObjectAny("h_eventoccupancy_HB");
6394  OccupancyHisto[1] = (TH1F *)dir->FindObjectAny("h_eventoccupancy_HE");
6395  OccupancyHisto[2] = (TH1F *)dir->FindObjectAny("h_eventoccupancy_HO");
6396  OccupancyHisto[3] = (TH1F *)dir->FindObjectAny("h_eventoccupancy_HF");
6397 
6398  int countamplmaxHB = 0;
6399  int countamplmaxHE = 0;
6400  int countamplmaxHO = 0;
6401  int countamplmaxHF = 0;
6402  int countoccumaxHB = 0;
6403  int countoccumaxHE = 0;
6404  int countoccumaxHO = 0;
6405  int countoccumaxHF = 0;
6406  unsigned long int countamplHB = 0;
6407  unsigned long int countamplHE = 0;
6408  unsigned long int countamplHO = 0;
6409  unsigned long int countamplHF = 0;
6410  unsigned long int countoccuHB = 0;
6411  unsigned long int countoccuHE = 0;
6412  unsigned long int countoccuHO = 0;
6413  unsigned long int countoccuHF = 0;
6414  gStyle->SetOptStat(110000);
6415  for (int sub = 0; sub < 4; sub++) {
6416  cFour->Clear();
6417  cFour->Divide(2, 2);
6418 
6419  cFour->cd(1);
6420  TH1F *lpqxc = new TH1F("lpqxc", "", maxbins, 1., maxbins + 1.);
6421  for (int i = 1; i <= lpqxc->GetXaxis()->GetNbins(); i++) {
6422  double ccc1 = 0.;
6423  if (MaxxSummedAmplitudeHisto[sub])
6424  ccc1 = MaxxSummedAmplitudeHisto[sub]->GetBinContent(i);
6425  // if(ccc1>0.) cout<<"111111111111111111111111111 iLS = "<<i<<" LS= "<<ccc1<<endl;
6426  if (ccc1 > 0.)
6427  lpqxc->Fill(float(i), ccc1);
6428  if (sub == 0 && ccc1 > 60000.)
6429  countamplmaxHB++;
6430  if (sub == 1 && ccc1 > 60000.)
6431  countamplmaxHE++;
6432  if (sub == 2 && ccc1 > 150000.)
6433  countamplmaxHO++;
6434  if (sub == 3 && ccc1 > 22000.)
6435  countamplmaxHF++;
6436  }
6437  // gPad->SetLogy();
6438  lpqxc->SetMarkerStyle(20);
6439  lpqxc->SetMarkerSize(0.8);
6440  // lpqxc->GetYaxis()->SetLabelSize(0.08);
6441  if (sub == 0)
6442  lpqxc->SetXTitle("HB: max SA over LS-events per LS \b");
6443  if (sub == 1)
6444  lpqxc->SetXTitle("HE: max SA over LS-events per LS \b");
6445  if (sub == 2)
6446  lpqxc->SetXTitle("HO: max SA over LS-events per LS \b");
6447  if (sub == 3)
6448  lpqxc->SetXTitle("HF: max SA over LS-events per LS \b");
6449  lpqxc->SetMarkerColor(2);
6450  lpqxc->SetLineColor(0);
6451  gPad->SetGridx();
6452  lpqxc->Draw("Error");
6453 
6455  cFour->cd(2);
6456  TH1F *hpzlm = new TH1F("hpzlm", "", maxbins, 1., maxbins + 1.);
6457  for (int i = 1; i <= hpzlm->GetXaxis()->GetNbins(); i++) {
6458  double ccc1 = 0.;
6459  if (MaxxSummedAmplitudeOccupancyHisto[sub])
6460  ccc1 = MaxxSummedAmplitudeOccupancyHisto[sub]->GetBinContent(i);
6461  // if(ccc1>0.) cout<<"2222222222222222222222222 iLS = "<<i<<" LS= "<<ccc1<<endl;
6462  if (ccc1 > 0.)
6463  hpzlm->Fill(float(i), ccc1);
6464  if (sub == 0 && ccc1 > 2000.)
6465  countoccumaxHB++;
6466  if (sub == 1 && ccc1 > 1200.)
6467  countoccumaxHE++;
6468  if (sub == 2 && ccc1 > 2000.)
6469  countoccumaxHO++;
6470  if (sub == 3 && ccc1 > 860.)
6471  countoccumaxHF++;
6472  }
6473  // gPad->SetLogy();
6474  hpzlm->SetMarkerStyle(20);
6475  hpzlm->SetMarkerSize(0.8);
6476  // hpzlm->GetYaxis()->SetLabelSize(0.08);
6477  if (sub == 0)
6478  hpzlm->SetXTitle("HB: max Occupancy over LS-events per LS \b");
6479  if (sub == 1)
6480  hpzlm->SetXTitle("HE: max Occupancy over LS-events per LS \b");
6481  if (sub == 2)
6482  hpzlm->SetXTitle("HO: max Occupancy over LS-events per LS \b");
6483  if (sub == 3)
6484  hpzlm->SetXTitle("HF: max Occupancy over LS-events per LS \b");
6485  hpzlm->SetMarkerColor(4);
6486  hpzlm->SetLineColor(0);
6487  gPad->SetGridx();
6488  if (sub == 3) {
6489  hpzlm->SetMaximum(866.);
6490  hpzlm->SetMinimum(856.);
6491  }
6492  hpzlm->Draw("Error");
6493 
6495  cFour->cd(3);
6496  gPad->SetLogy();
6497  if (SAmplitudeHisto[sub]) {
6498  for (int i = 1; i <= SAmplitudeHisto[sub]->GetXaxis()->GetNbins(); i++) {
6499  // if(sub==0 && i * 800> 60000.) {
6500  // cout<<">=>=>>=> countamplHB= "<<countamplHB<<" content = "<<SAmplitudeHisto[sub]->GetBinContent(i)<<" sub= "<<sub<<" i= "<<i<< endl;
6501  // countamplHB+=SAmplitudeHisto[sub]->GetBinContent(i);
6502  // }
6503  if (sub == 0 && i * 800 > 60000.)
6504  countamplHB += SAmplitudeHisto[sub]->GetBinContent(i);
6505  if (sub == 1 && i * 1000 > 60000.)
6506  countamplHE += SAmplitudeHisto[sub]->GetBinContent(i);
6507  if (sub == 2 && i * 2500 > 150000.)
6508  countamplHO += SAmplitudeHisto[sub]->GetBinContent(i);
6509  if (sub == 3 && i * 1400 > 22000.)
6510  countamplHF += SAmplitudeHisto[sub]->GetBinContent(i);
6511  }
6512  SAmplitudeHisto[sub]->SetMarkerStyle(20);
6513  SAmplitudeHisto[sub]->SetMarkerSize(0.8);
6514  if (sub == 0)
6515  SAmplitudeHisto[sub]->SetTitle("HB event Amplitude\b");
6516  if (sub == 1)
6517  SAmplitudeHisto[sub]->SetTitle("HE event Amplitude\b");
6518  if (sub == 2)
6519  SAmplitudeHisto[sub]->SetTitle("HO event Amplitude\b");
6520  if (sub == 3)
6521  SAmplitudeHisto[sub]->SetTitle("HF event Amplitude\b");
6522  // SAmplitudeHisto[sub]->GetYaxis()->SetLabelSize(0.08);
6523  SAmplitudeHisto[sub]->SetXTitle("event amplitude \b");
6524  SAmplitudeHisto[sub]->SetMarkerColor(2);
6525  SAmplitudeHisto[sub]->SetLineColor(2);
6526  SAmplitudeHisto[sub]->Draw("");
6527  }
6529  cFour->cd(4);
6530  gPad->SetLogy();
6531  if (OccupancyHisto[sub]) {
6532  for (int i = 1; i <= OccupancyHisto[sub]->GetXaxis()->GetNbins(); i++) {
6533  if (sub == 0 && i * 30 > 2000.)
6534  countoccuHB += OccupancyHisto[sub]->GetBinContent(i);
6535  if (sub == 1 && i * 20 > 1200.)
6536  countoccuHE += OccupancyHisto[sub]->GetBinContent(i);
6537  if (sub == 2 && i * 25 > 2000.)
6538  countoccuHO += OccupancyHisto[sub]->GetBinContent(i);
6539  if (sub == 3 && i * 10 > 860.)
6540  countoccuHF += OccupancyHisto[sub]->GetBinContent(i);
6541  }
6542  OccupancyHisto[sub]->SetMarkerStyle(20);
6543  OccupancyHisto[sub]->SetMarkerSize(0.8);
6544  if (sub == 0)
6545  OccupancyHisto[sub]->SetTitle("HB event Occupancy\b");
6546  if (sub == 1)
6547  OccupancyHisto[sub]->SetTitle("HE event Occupancy\b");
6548  if (sub == 2)
6549  OccupancyHisto[sub]->SetTitle("HO event Occupancy\b");
6550  if (sub == 3)
6551  OccupancyHisto[sub]->SetTitle("HF event Occupancy\b");
6552  // OccupancyHisto[sub]->GetYaxis()->SetLabelSize(0.08);
6553  OccupancyHisto[sub]->SetXTitle("event occupancy \b");
6554  OccupancyHisto[sub]->SetMarkerColor(4);
6555  OccupancyHisto[sub]->SetLineColor(4);
6556  OccupancyHisto[sub]->Draw("");
6557  }
6558 
6559  cFour->Update();
6560  if (sub == 0)
6561  cFour->Print("MaxxSummedAmplitudes_HB.png");
6562  if (sub == 1)
6563  cFour->Print("MaxxSummedAmplitudes_HE.png");
6564  if (sub == 2)
6565  cFour->Print("MaxxSummedAmplitudes_HO.png");
6566  if (sub == 3)
6567  cFour->Print("MaxxSummedAmplitudes_HF.png");
6568  cFour->Clear();
6569  if (lpqxc)
6570  delete lpqxc;
6571  if (hpzlm)
6572  delete hpzlm;
6573  } //for
6574  gStyle->SetOptStat(0);
6576  cout << ">=>=>>=> countamplmaxHB= " << countamplmaxHB << " countamplmaxHE= " << countamplmaxHE
6577  << " countamplmaxHO= " << countamplmaxHO << " countamplmaxHF= " << countamplmaxHF << endl;
6578  cout << ">=>=>>=> countoccumaxHB= " << countoccumaxHB << " countoccumaxHE= " << countoccumaxHE
6579  << " countoccumaxHO= " << countoccumaxHO << " countoccumaxHF= " << countoccumaxHF << endl;
6580  cout << ">=>=>>=> countamplHB= " << countamplHB << " countamplHE= " << countamplHE << " countamplHO= " << countamplHO
6581  << " countamplHF= " << countamplHF << endl;
6582  cout << ">=>=>>=> countoccuHB= " << countoccuHB << " countoccuHE= " << countoccuHE << " countoccuHO= " << countoccuHO
6583  << " countoccuHF= " << countoccuHF << endl;
6584 
6587  //************************* ***** channelsummedA over depths *****
6588  cout << ">>>>>>>>>>>>>>>>>>>>>>>>channelsummedA over depths " << endl;
6589  TH1F *ChannelDepthsummedAmplitudesPlots[4]; // 1d histogramm for subdet
6590  ChannelDepthsummedAmplitudesPlots[0] = (TH1F *)dir->FindObjectAny("h_sumamplitudechannel_HB");
6591  ChannelDepthsummedAmplitudesPlots[1] = (TH1F *)dir->FindObjectAny("h_sumamplitudechannel_HE");
6592  ChannelDepthsummedAmplitudesPlots[2] = (TH1F *)dir->FindObjectAny("h_sumamplitudechannel_HO");
6593  ChannelDepthsummedAmplitudesPlots[3] = (TH1F *)dir->FindObjectAny("h_sumamplitudechannel_HF");
6594  TLine *litebdt[4];
6595  if (ChannelDepthsummedAmplitudesPlots[0])
6596  litebdt[0] = new TLine(80., 0.8, 80., ChannelDepthsummedAmplitudesPlots[0]->GetBinContent(4) + 100.);
6597  if (ChannelDepthsummedAmplitudesPlots[1])
6598  litebdt[1] = new TLine(200., 0.8, 200., ChannelDepthsummedAmplitudesPlots[1]->GetBinContent(7) + 100.);
6599  if (ChannelDepthsummedAmplitudesPlots[2])
6600  litebdt[2] = new TLine(1200., 0.8, 1200., ChannelDepthsummedAmplitudesPlots[2]->GetBinContent(17) + 100.);
6601  if (ChannelDepthsummedAmplitudesPlots[3])
6602  litebdt[3] = new TLine(600., 0.8, 600., ChannelDepthsummedAmplitudesPlots[3]->GetBinContent(6) + 100.);
6603 
6604  gStyle->SetOptStat(110000);
6605  cFour1->Clear();
6606  cFour1->Divide(2, 2);
6607  for (int sub = 0; sub < 4; sub++) {
6608  if (sub == 0)
6609  cFour1->cd(1);
6610  if (sub == 1)
6611  cFour1->cd(2);
6612  if (sub == 2)
6613  cFour1->cd(3);
6614  if (sub == 3)
6615  cFour1->cd(4);
6616  gPad->SetLogy();
6617  ChannelDepthsummedAmplitudesPlots[sub]->SetMarkerStyle(20);
6618  ChannelDepthsummedAmplitudesPlots[sub]->SetMarkerSize(0.8);
6619  if (sub == 0)
6620  ChannelDepthsummedAmplitudesPlots[sub]->SetTitle("HB channel Amplitudes\b");
6621  if (sub == 1)
6622  ChannelDepthsummedAmplitudesPlots[sub]->SetTitle("HE channel Amplitudes\b");
6623  if (sub == 2)
6624  ChannelDepthsummedAmplitudesPlots[sub]->SetTitle("HO channel Amplitudes\b");
6625  if (sub == 3)
6626  ChannelDepthsummedAmplitudesPlots[sub]->SetTitle("HF channel Amplitudes\b");
6627  if (sub == 0)
6628  ChannelDepthsummedAmplitudesPlots[sub]->SetXTitle("HB channel depths summed Amplitudes \b");
6629  if (sub == 1)
6630  ChannelDepthsummedAmplitudesPlots[sub]->SetXTitle("HE channel depths summed Amplitudes \b");
6631  if (sub == 2)
6632  ChannelDepthsummedAmplitudesPlots[sub]->SetXTitle("HO channel depths summed Amplitudes \b");
6633  if (sub == 3)
6634  ChannelDepthsummedAmplitudesPlots[sub]->SetXTitle("HF channel depths summed Amplitudes \b");
6635  ChannelDepthsummedAmplitudesPlots[sub]->SetMarkerColor(2);
6636  ChannelDepthsummedAmplitudesPlots[sub]->SetLineColor(2);
6637  ChannelDepthsummedAmplitudesPlots[sub]->Draw("");
6638  litebdt[sub]->SetLineColor(kBlue);
6639  litebdt[sub]->Draw("s");
6640  } //for
6641  cFour1->Update();
6642  cFour1->Print("ChannelDepthsummedAmplitudes.png");
6643  cFour1->Clear();
6644  gStyle->SetOptStat(0);
6645 
6648  //************************* ***** Ataildepth1_HB *****
6649  cout << ">>>>>>>>>>>>>>>>>>>>>>>>2DAtaildepth " << endl;
6651  cHB->Clear();
6652  cHB->Divide(2, 1);
6653 
6654  TH2F *DAtaildepth1[2]; // 1d histogramm for subdet
6655  DAtaildepth1[0] = (TH2F *)dir->FindObjectAny("h_2DAtaildepth1_HB");
6656  DAtaildepth1[1] = (TH2F *)dir->FindObjectAny("h_2D0Ataildepth1_HB");
6657  cHB->cd(1);
6658  if (!DAtaildepth1[0] || !DAtaildepth1[1]) {
6659  cout << ">>>>>>>>>>>>>>>>>>>>>>>>Ataildepth1_HB EMPTY histoes for 2DAtaildepth 1" << endl;
6660  } else {
6661  TH2F *tail1 = (TH2F *)DAtaildepth1[0]->Clone("tail1");
6662  tail1->Divide(DAtaildepth1[0], DAtaildepth1[1], 1, 1, "B");
6663  // tail1->Sumw2();
6664  gPad->SetGridy();
6665  gPad->SetGridx();
6666  gPad->SetLogz();
6667  tail1->SetMarkerStyle(20);
6668  tail1->SetMarkerSize(0.4);
6669  tail1->SetTitle("Amplitudes for tail-events (HBdepth1) \b");
6670  tail1->SetXTitle("#eta \b");
6671  tail1->SetYTitle("#phi \b");
6672  tail1->SetZTitle("2D <A> in the tail - HB Depth1 \b");
6673  tail1->SetMarkerColor(2);
6674  tail1->SetLineColor(2);
6675  tail1->Draw("COLZ");
6676  }
6677  TH2F *DAtaildepth2[2]; // 1d histogramm for subdet
6678  DAtaildepth2[0] = (TH2F *)dir->FindObjectAny("h_2DAtaildepth2_HB");
6679  DAtaildepth2[1] = (TH2F *)dir->FindObjectAny("h_2D0Ataildepth2_HB");
6680  cHB->cd(2);
6681  if (!DAtaildepth2[0] || !DAtaildepth2[1]) {
6682  cout << ">>>>>>>>>>>>>>>>>>>>>>>>Ataildepth1_HB EMPTY histoes for 2DAtaildepth 2" << endl;
6683  } else {
6684  TH2F *tail2 = (TH2F *)DAtaildepth2[0]->Clone("tail2");
6685  tail2->Divide(DAtaildepth2[0], DAtaildepth2[1], 1, 1, "B");
6686  // tail2->Sumw2();
6687  gPad->SetGridy();
6688  gPad->SetGridx();
6689  gPad->SetLogz();
6690  tail2->SetMarkerStyle(20);
6691  tail2->SetMarkerSize(0.4);
6692  tail2->SetTitle("Amplitudes for tail-events (HBdepth2) \b");
6693  tail2->SetXTitle("#eta \b");
6694  tail2->SetYTitle("#phi \b");
6695  tail2->SetZTitle("2D <A> in the tail - HB Depth2 \b");
6696  tail2->SetMarkerColor(2);
6697  tail2->SetLineColor(2);
6698  tail2->Draw("COLZ");
6699  }
6700 
6701  cHB->Update();
6702  cHB->Print("AtaildepthHB.png");
6703  cHB->Clear();
6704 
6707  //************************* ***** sum(Signal+NoSignal) occupancy for HF *****
6708  cout << ">>>>>>>>>>>>>>>>>>>>>>>>sumOccupancyHF " << endl;
6710  cHB->Clear();
6711  cHB->Divide(1, 1);
6712  cHB->cd(1);
6713  if (SummedAmplitudeOccupancyHisto[3]) {
6714  TH1F *ufrew1 = (TH1F *)SummedAmplitudeOccupancyHisto[3]->Clone("ufrew1");
6715  if (SummedAmplitudeOccupancyHisto[3] && NoSignalSummedAmplitudeOccupancyHisto[3])
6716  ufrew1->Add(SummedAmplitudeOccupancyHisto[3], NoSignalSummedAmplitudeOccupancyHisto[3], 1, 1);
6717  ufrew1->GetXaxis()->SetRangeUser(1., maxbins + 1.);
6718  gPad->SetGridx();
6719  ufrew1->SetMarkerStyle(20);
6720  ufrew1->SetMarkerSize(0.8);
6721  ufrew1->GetYaxis()->SetLabelSize(0.04);
6722  ufrew1->SetTitle("HF Occupancy vs LS\b");
6723  ufrew1->SetXTitle("average occupancy per LS HF\b");
6724  ufrew1->SetMarkerColor(4);
6725  ufrew1->SetLineColor(0);
6726  ufrew1->SetMaximum(866.);
6727  ufrew1->SetMinimum(856.);
6728  ufrew1->Draw("Error");
6729  cHB->Update();
6730  cHB->Print("sumOccupancyHF.png");
6731  cHB->Clear();
6732  if (ufrew1)
6733  delete ufrew1;
6734  }
6735 
6743  //====================================================================================================================
6744  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =====================================================================" << endl;
6745 
6746  //=====================================================================================================
6747  cout << ">>>>>>>>>>>>>>>>>>>>>>>> ==================================================" << endl;
6748 
6749  //=====================================================================================
6750  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =================================" << endl;
6751  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =================================" << endl;
6752  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =================================" << endl;
6753  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =================================" << endl;
6754 
6755  cout << ">>>>>>> START NOW CREATING OF HTML PAGES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
6756  //======================================================================
6757  // Creating each test kind for each subdet html pages:
6758  std::string raw_class;
6759  int ind = 0;
6760  ofstream htmlFile;
6761  for (int test = 0; test <= 5; test++) { //Test: 0,
6762  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
6763 
6764  // cout<<"Creating each test kind for each subdet html pages: test= "<< test << " sub= " << sub << endl;
6765  if (test == 0) {
6766  if (sub == 1) {
6767  htmlFile.open("HB_CapID.html");
6768  }
6769  if (sub == 2) {
6770  htmlFile.open("HE_CapID.html");
6771  }
6772  if (sub == 3) {
6773  htmlFile.open("HO_CapID.html");
6774  }
6775  if (sub == 4) {
6776  htmlFile.open("HF_CapID.html");
6777  }
6778  }
6779  if (test == 1) {
6780  if (sub == 1) {
6781  htmlFile.open("HB_ADCampl.html");
6782  }
6783  if (sub == 2) {
6784  htmlFile.open("HE_ADCampl.html");
6785  }
6786  if (sub == 3) {
6787  htmlFile.open("HO_ADCampl.html");
6788  }
6789  if (sub == 4) {
6790  htmlFile.open("HF_ADCampl.html");
6791  }
6792  }
6793  if (test == 2) {
6794  if (sub == 1) {
6795  htmlFile.open("HB_Width.html");
6796  }
6797  if (sub == 2) {
6798  htmlFile.open("HE_Width.html");
6799  }
6800  if (sub == 3) {
6801  htmlFile.open("HO_Width.html");
6802  }
6803  if (sub == 4) {
6804  htmlFile.open("HF_Width.html");
6805  }
6806  }
6807  if (test == 3) {
6808  if (sub == 1) {
6809  htmlFile.open("HB_Ratio.html");
6810  }
6811  if (sub == 2) {
6812  htmlFile.open("HE_Ratio.html");
6813  }
6814  if (sub == 3) {
6815  htmlFile.open("HO_Ratio.html");
6816  }
6817  if (sub == 4) {
6818  htmlFile.open("HF_Ratio.html");
6819  }
6820  }
6821  if (test == 4) {
6822  if (sub == 1) {
6823  htmlFile.open("HB_Tmean.html");
6824  }
6825  if (sub == 2) {
6826  htmlFile.open("HE_Tmean.html");
6827  }
6828  if (sub == 3) {
6829  htmlFile.open("HO_Tmean.html");
6830  }
6831  if (sub == 4) {
6832  htmlFile.open("HF_Tmean.html");
6833  }
6834  }
6835  if (test == 5) {
6836  if (sub == 1) {
6837  htmlFile.open("HB_Tmax.html");
6838  }
6839  if (sub == 2) {
6840  htmlFile.open("HE_Tmax.html");
6841  }
6842  if (sub == 3) {
6843  htmlFile.open("HO_Tmax.html");
6844  }
6845  if (sub == 4) {
6846  htmlFile.open("HF_Tmax.html");
6847  }
6848  }
6849 
6850  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
6851  htmlFile << "<head>" << std::endl;
6852  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
6853  htmlFile << "<title> Certification Monitoring Tool </title>" << std::endl;
6854  htmlFile << "<style type=\"text/css\">" << std::endl;
6855  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
6856  << std::endl;
6857  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
6858  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
6859  "text-align: center;}"
6860  << std::endl;
6861  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
6862  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
6863  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
6864  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
6865  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
6866  htmlFile << "</style>" << std::endl;
6867  htmlFile << "<body>" << std::endl;
6868 
6869  if (test == 0) {
6870  if (sub == 1)
6871  htmlFile << "<h1> Cap ID estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
6872  if (sub == 2)
6873  htmlFile << "<h1> Cap ID estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
6874  if (sub == 3)
6875  htmlFile << "<h1> Cap ID estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
6876  if (sub == 4)
6877  htmlFile << "<h1> Cap ID estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
6878  }
6879  if (test == 1) {
6880  if (sub == 1)
6881  htmlFile << "<h1> Mean ADC Amplitude estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
6882  if (sub == 2)
6883  htmlFile << "<h1> Mean ADC Amplitude estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
6884  if (sub == 3)
6885  htmlFile << "<h1> Mean ADC Amplitude estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
6886  if (sub == 4)
6887  htmlFile << "<h1> Mean ADC Amplitude estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
6888  }
6889  if (test == 2) {
6890  if (sub == 1)
6891  htmlFile << "<h1> Width estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
6892  if (sub == 2)
6893  htmlFile << "<h1> Width estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
6894  if (sub == 3)
6895  htmlFile << "<h1> Width estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
6896  if (sub == 4)
6897  htmlFile << "<h1> Width estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
6898  }
6899  if (test == 3) {
6900  if (sub == 1)
6901  htmlFile << "<h1> Ratio estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
6902  if (sub == 2)
6903  htmlFile << "<h1> Ratio estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
6904  if (sub == 3)
6905  htmlFile << "<h1> Ratio estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
6906  if (sub == 4)
6907  htmlFile << "<h1> Ratio estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
6908  }
6909  if (test == 4) {
6910  if (sub == 1)
6911  htmlFile << "<h1> Mean bin timing estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
6912  if (sub == 2)
6913  htmlFile << "<h1> Mean bin timing estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
6914  if (sub == 3)
6915  htmlFile << "<h1> Mean bin timing estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
6916  if (sub == 4)
6917  htmlFile << "<h1> Mean bin timing estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
6918  }
6919  if (test == 5) {
6920  if (sub == 1)
6921  htmlFile << "<h1> Maximum bin timing estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
6922  if (sub == 2)
6923  htmlFile << "<h1> Maximum bin timing estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
6924  if (sub == 3)
6925  htmlFile << "<h1> Maximum bin timing estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
6926  if (sub == 4)
6927  htmlFile << "<h1> Maximum bin timing estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
6928  }
6929 
6930  if (test == 1) {
6931  htmlFile << "<a name=\"Top\"></a>\n";
6932  htmlFile << "<b>Contents:<br>\n";
6933  htmlFile << "1. <a href=\"#Aij\">A_ij_LS (averaged over events in LS) </a><br>\n";
6934  htmlFile << "2. <a href=\"#OverflowAij\">A_ij_LS in overflow & underflow</a><br>\n";
6935  htmlFile << "3. <a href=\"#MainEstimator\">Main Estimator !!! </a><br>\n";
6936  htmlFile << "4. <a href=\"#ErrorA\">Error type A </a><br>\n";
6937  htmlFile << "5. <a href=\"#ErrorAaverage\">ErrorA cross check</a><br>\n";
6938  htmlFile << "6. <a href=\"#ErrorAoccupancy\">ErrorA occupancy plots</a><br>\n";
6939  htmlFile << "7. <a href=\"#ErrorB\">Error type B</a><br>\n";
6940  htmlFile << "8. <a href=\"#LSstatus\">Table of Average channel-Amplitude in Depthes over LSs </a><br>\n";
6941  htmlFile << "9. <a href=\"#RBXstatus\">RBX Status </a><br>\n";
6942  htmlFile << "10. <a href=\"#RBXPHItable\">Table of Average RBX-Amplitude in Phi over LSs </a><br>\n";
6943  htmlFile << "11. <a href=\"#RBXETAtable\">Table of Average RBX-Amplitude in Eta over LSs </a><br>\n";
6944  htmlFile << "12. <a href=\"#RBX3plots\">RBX A-Ratio to 1st LS: 3 plots </a><br>\n";
6946  }
6947 
6948  // htmlFile << "<a href=\"#Top\">to top</a><br>\n";
6949 
6950  htmlFile << "<br>" << std::endl;
6951  if (test == 0) {
6952  htmlFile << "<h2> 0. Rate of CapID failures over all events of Run </h2>" << std::endl;
6953  htmlFile << "<h3> Channel legend: green - good, other colour - suspicious </h3>" << std::endl;
6954  if (sub == 1)
6955  htmlFile << " <img src=\"MapCapIdErrorHB.png\" />" << std::endl;
6956  if (sub == 2)
6957  htmlFile << " <img src=\"MapCapIdErrorHE.png\" />" << std::endl;
6958  if (sub == 3)
6959  htmlFile << " <img src=\"MapCapIdErrorHO.png\" />" << std::endl;
6960  if (sub == 4)
6961  htmlFile << " <img src=\"MapCapIdErrorHF.png\" />" << std::endl;
6962  }
6963  if (test == 1)
6964  htmlFile << "<a name=\"Aij\"></a>\n";
6965  if (test != 0)
6966  htmlFile << "<h2> 1. Distribution of estimator averaged over events in LS, histogramed over all channels and "
6967  "all LSs (only few depthes shown as example) </h2>"
6968  << std::endl;
6969  if (test == 0) {
6970  if (sub == 1)
6971  htmlFile << "<h2> 1. Average Nbcs for only LS containing events with abnormal number of Bad channels >"
6972  << CutAb[sub][1] << " (Depth1), " << CutAb[sub][2] << " (Depth2).</h2>" << std::endl;
6973  if (sub == 2)
6974  htmlFile << "<h2> 1. Average Nbcs for only LS containing events with abnormal number of Bad channels >"
6975  << CutAb[sub][1] << " (Depth1), " << CutAb[sub][2] << " (Depth2), " << CutAb[sub][3]
6976  << " (Depth3).</h2>" << std::endl;
6977  if (sub == 3)
6978  htmlFile << "<h2> 1. Average Nbcs for only LS containing events with abnormal number of Bad channels >"
6979  << CutAb[sub][1] << " (Depth4).</h2>" << std::endl;
6980  if (sub == 4)
6981  htmlFile << "<h2> 1. Average Nbcs for only LS containing events with abnormal number of Bad channels >"
6982  << CutAb[sub][1] << " (Depth1), " << CutAb[sub][2] << " (Depth2).</h2>" << std::endl;
6983  }
6984 
6985  if (test != 0)
6986  htmlFile << "<h3> see Overflow and Underflow </h3>" << std::endl;
6987  if (test == 0)
6988  htmlFile << "<h3> Legend: dots correspond to BAD LS candidates.</h3>" << std::endl;
6989 
6990  if (test == 0) {
6991  if (sub == 1)
6992  htmlFile << " <img src=\"Hist_CAPID_Abnorm_HB.png\" />" << std::endl;
6993  if (sub == 2)
6994  htmlFile << " <img src=\"Hist_CAPID_Abnorm_HE.png\" />" << std::endl;
6995  if (sub == 3)
6996  htmlFile << " <img src=\"Hist_CAPID_Abnorm_HO.png\" />" << std::endl;
6997  if (sub == 4)
6998  htmlFile << " <img src=\"Hist_CAPID_Abnorm_HF.png\" />" << std::endl;
6999  }
7000  if (test == 1) {
7001  if (sub == 1)
7002  htmlFile << " <img src=\"H_ADCamplHB.png\" />" << std::endl;
7003  if (sub == 2)
7004  htmlFile << " <img src=\"H_ADCamplHE.png\" />" << std::endl;
7005  if (sub == 3)
7006  htmlFile << " <img src=\"H_ADCamplHO.png\" />" << std::endl;
7007  if (sub == 4)
7008  htmlFile << " <img src=\"H_ADCamplHF.png\" />" << std::endl;
7009  }
7010  if (test == 2) {
7011  if (sub == 1)
7012  htmlFile << " <img src=\"H_WidthHB.png\" />" << std::endl;
7013  if (sub == 2)
7014  htmlFile << " <img src=\"H_WidthHE.png\" />" << std::endl;
7015  if (sub == 3)
7016  htmlFile << " <img src=\"H_WidthHO.png\" />" << std::endl;
7017  if (sub == 4)
7018  htmlFile << " <img src=\"H_WidthHF.png\" />" << std::endl;
7019  }
7020  if (test == 3) {
7021  if (sub == 1)
7022  htmlFile << " <img src=\"H_RatioHB.png\" />" << std::endl;
7023  if (sub == 2)
7024  htmlFile << " <img src=\"H_RatioHE.png\" />" << std::endl;
7025  if (sub == 3)
7026  htmlFile << " <img src=\"H_RatioHO.png\" />" << std::endl;
7027  if (sub == 4)
7028  htmlFile << " <img src=\"H_RatioHF.png\" />" << std::endl;
7029  }
7030  if (test == 4) {
7031  if (sub == 1)
7032  htmlFile << " <img src=\"H_TmeanHB.png\" />" << std::endl;
7033  if (sub == 2)
7034  htmlFile << " <img src=\"H_TmeanHE.png\" />" << std::endl;
7035  if (sub == 3)
7036  htmlFile << " <img src=\"H_TmeanHO.png\" />" << std::endl;
7037  if (sub == 4)
7038  htmlFile << " <img src=\"H_TmeanHF.png\" />" << std::endl;
7039  }
7040  if (test == 5) {
7041  if (sub == 1)
7042  htmlFile << " <img src=\"H_TmaxHB.png\" />" << std::endl;
7043  if (sub == 2)
7044  htmlFile << " <img src=\"H_TmaxHE.png\" />" << std::endl;
7045  if (sub == 3)
7046  htmlFile << " <img src=\"H_TmaxHO.png\" />" << std::endl;
7047  if (sub == 4)
7048  htmlFile << " <img src=\"H_TmaxHF.png\" />" << std::endl;
7049  }
7050  htmlFile << "<br>" << std::endl;
7051  if (test == 1)
7052  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7053 
7054  if (test == 0)
7055  htmlFile << "<h2> 2a. Number of bad channels per event distribution in Run</h2>" << std::endl;
7056  if (test == 0)
7057  htmlFile << "<h3> Legends: dots correspond to BAD LS candidates. </h3>" << std::endl;
7058  if (test == 0) {
7059  if (sub == 1)
7060  htmlFile << " <img src=\"HistNBadChsHB.png\" />" << std::endl;
7061  if (sub == 2)
7062  htmlFile << " <img src=\"HistNBadChsHE.png\" />" << std::endl;
7063  if (sub == 3)
7064  htmlFile << " <img src=\"HistNBadChsHO.png\" />" << std::endl;
7065  if (sub == 4)
7066  htmlFile << " <img src=\"HistNBadChsHF.png\" />" << std::endl;
7067  }
7068 
7069  if (test == 1)
7070  htmlFile << "<a name=\"OverflowAij\"></a>\n";
7071  if (test != 0)
7072  htmlFile << "<h2> 2. Estimator averaged over all events in the RUN for entries in overflow and underflow of "
7073  "corresponding histogram above (only few depthes shown as example) </h2>"
7074  << std::endl;
7075  // if (test !=0) htmlFile << "<h2> 2. Estimator averaged over all events in the RUN </h2>"<< std::endl;
7076  if (test == 0)
7077  htmlFile << "<h2> 2b. Averaged number of bad channels for each LS </h2>" << std::endl;
7078  // if (test !=0) htmlFile << "<h3> Channel legend: white - good, other colour - bad. </h3>"<< std::endl;
7079  if (test == 0) {
7080  if (sub == 1)
7081  htmlFile << "<h3> Legends: dots selected with following cuts: <td class=\"s6\" align=\"center\">"
7082  << Cut0[test][sub][1] << " (Depth1), " << Cut0[test][sub][2]
7083  << " (Depth2) correspond BAD LS.</td></h3>" << std::endl;
7084  if (sub == 2)
7085  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][1] << " (Depth1), "
7086  << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3) correspond BAD LS.</h3>"
7087  << std::endl;
7088  if (sub == 3)
7089  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][4]
7090  << " (Depth4) correspond BAD LS.</h3>" << std::endl;
7091  if (sub == 4)
7092  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][1] << " (Depth1), "
7093  << Cut0[test][sub][2] << " (Depth2) correspond BAD LS.</h3>" << std::endl;
7094  }
7095  if (test == 0) {
7096  if (sub == 1)
7097  htmlFile << " <img src=\"HistNBCMNHB.png\" />" << std::endl;
7098  if (sub == 2)
7099  htmlFile << " <img src=\"HistNBCMNHE.png\" />" << std::endl;
7100  if (sub == 3)
7101  htmlFile << " <img src=\"HistNBCMNHO.png\" />" << std::endl;
7102  if (sub == 4)
7103  htmlFile << " <img src=\"HistNBCMNHF.png\" />" << std::endl;
7104  }
7105  if (test == 1) {
7106  if (sub == 1)
7107  htmlFile << " <img src=\"MapADCamplHB.png\" />" << std::endl;
7108  if (sub == 2)
7109  htmlFile << " <img src=\"MapADCamplHE.png\" />" << std::endl;
7110  if (sub == 3)
7111  htmlFile << " <img src=\"MapADCamplHO.png\" />" << std::endl;
7112  if (sub == 4)
7113  htmlFile << " <img src=\"MapADCamplHF.png\" />" << std::endl;
7114  }
7115  if (test == 2) {
7116  if (sub == 1)
7117  htmlFile << " <img src=\"MapWidthHB.png\" />" << std::endl;
7118  if (sub == 2)
7119  htmlFile << " <img src=\"MapWidthHE.png\" />" << std::endl;
7120  if (sub == 3)
7121  htmlFile << " <img src=\"MapWidthHO.png\" />" << std::endl;
7122  if (sub == 4)
7123  htmlFile << " <img src=\"MapWidthHF.png\" />" << std::endl;
7124  }
7125  if (test == 3) {
7126  if (sub == 1)
7127  htmlFile << " <img src=\"MapRatioHB.png\" />" << std::endl;
7128  if (sub == 2)
7129  htmlFile << " <img src=\"MapRatioHE.png\" />" << std::endl;
7130  if (sub == 3)
7131  htmlFile << " <img src=\"MapRatioHO.png\" />" << std::endl;
7132  if (sub == 4)
7133  htmlFile << " <img src=\"MapRatioHF.png\" />" << std::endl;
7134  }
7135  if (test == 4) {
7136  if (sub == 1)
7137  htmlFile << " <img src=\"MapTmeanHB.png\" />" << std::endl;
7138  if (sub == 2)
7139  htmlFile << " <img src=\"MapTmeanHE.png\" />" << std::endl;
7140  if (sub == 3)
7141  htmlFile << " <img src=\"MapTmeanHO.png\" />" << std::endl;
7142  if (sub == 4)
7143  htmlFile << " <img src=\"MapTmeanHF.png\" />" << std::endl;
7144  }
7145  if (test == 5) {
7146  if (sub == 1)
7147  htmlFile << " <img src=\"MapTmaxHB.png\" />" << std::endl;
7148  if (sub == 2)
7149  htmlFile << " <img src=\"MapTmaxHE.png\" />" << std::endl;
7150  if (sub == 3)
7151  htmlFile << " <img src=\"MapTmaxHO.png\" />" << std::endl;
7152  if (sub == 4)
7153  htmlFile << " <img src=\"MapTmaxHF.png\" />" << std::endl;
7154  }
7155  htmlFile << "<br>" << std::endl;
7156  if (test == 1)
7157  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7158 
7159  if (test == 1)
7160  htmlFile << "<a name=\"MainEstimator\"></a>\n";
7161  if (test != 0)
7162  htmlFile
7163  << "<h2> 3. Distribution of estimator averaged over events in LS and over all channels for each LS </h2>"
7164  << std::endl;
7165  if (test == 0) {
7166  if (sub == 1)
7167  htmlFile << "<h2> 3. Portion of events with Nbcs>" << CutPo[sub][1] << " (Depth1), " << CutPo[sub][2]
7168  << " (Depth2) in each LS.</h2>" << std::endl;
7169  if (sub == 2)
7170  htmlFile << "<h2> 3. Portion of events with Nbcs>" << CutPo[sub][1] << " (Depth1), " << CutPo[sub][2]
7171  << " (Depth2), " << CutPo[sub][3] << " (Depth3) in each LS.</h2>" << std::endl;
7172  if (sub == 3)
7173  htmlFile << "<h2> 3. Portion of events with Nbcs>" << CutPo[sub][4] << " (Depth4) in each LS.</h2>"
7174  << std::endl;
7175  if (sub == 4)
7176  htmlFile << "<h2> 3. Portion of events with Nbcs>" << CutPo[sub][1] << " (Depth1), " << CutPo[sub][2]
7177  << " (Depth2) in each LS.</h2>" << std::endl;
7178  htmlFile << "<h3> Legend: dots correspond to BAD LS candidates.</h3>" << std::endl;
7179  }
7180  if (test != 0) {
7181  if (sub == 1)
7182  htmlFile << "<h3> Legends: dots selected with following cuts: <td class=\"s6\" align=\"center\">"
7183  << Cut0[test][sub][1] << " (Depth1), " << Cut0[test][sub][2]
7184  << " (Depth2) correspond BAD LS.</td></h3>" << std::endl;
7185  if (sub == 2)
7186  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][1] << " (Depth1), "
7187  << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3), " << Cut0[test][sub][4]
7188  << " (Depth4), " << Cut0[test][sub][5] << " (Depth5), " << Cut0[test][sub][6] << " (Depth6), "
7189  << Cut0[test][sub][7] << " (Depth7) correspond BAD LS. </h3>" << std::endl;
7190  if (sub == 3)
7191  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][4]
7192  << " (Depth4) correspond BAD LS. </h3>" << std::endl;
7193  if (sub == 4)
7194  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][1] << " (Depth1), "
7195  << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3), " << Cut0[test][sub][4]
7196  << " (Depth4) correspond BAD LS. </h3>" << std::endl;
7197  }
7198  if (test == 0) {
7199  if (sub == 1)
7200  htmlFile << " <img src=\"HistPortHB.png\" />" << std::endl;
7201  if (sub == 2)
7202  htmlFile << " <img src=\"HistPortHE.png\" />" << std::endl;
7203  if (sub == 3)
7204  htmlFile << " <img src=\"HistPortHO.png\" />" << std::endl;
7205  if (sub == 4)
7206  htmlFile << " <img src=\"HistPortHF.png\" />" << std::endl;
7207  }
7208  if (test == 1) {
7209  if (sub == 1)
7210  htmlFile << " <img src=\"HistADCamplHB.png\" />" << std::endl;
7211  if (sub == 2)
7212  htmlFile << " <img src=\"HistADCamplHE.png\" />" << std::endl;
7213  if (sub == 3)
7214  htmlFile << " <img src=\"HistADCamplHO.png\" />" << std::endl;
7215  if (sub == 4)
7216  htmlFile << " <img src=\"HistADCamplHF.png\" />" << std::endl;
7217  }
7218  if (test == 2) {
7219  if (sub == 1)
7220  htmlFile << " <img src=\"HistWidthHB.png\" />" << std::endl;
7221  if (sub == 2)
7222  htmlFile << " <img src=\"HistWidthHE.png\" />" << std::endl;
7223  if (sub == 3)
7224  htmlFile << " <img src=\"HistWidthHO.png\" />" << std::endl;
7225  if (sub == 4)
7226  htmlFile << " <img src=\"HistWidthHF.png\" />" << std::endl;
7227  }
7228  if (test == 3) {
7229  if (sub == 1)
7230  htmlFile << " <img src=\"HistRatioHB.png\" />" << std::endl;
7231  if (sub == 2)
7232  htmlFile << " <img src=\"HistRatioHE.png\" />" << std::endl;
7233  if (sub == 3)
7234  htmlFile << " <img src=\"HistRatioHO.png\" />" << std::endl;
7235  if (sub == 4)
7236  htmlFile << " <img src=\"HistRatioHF.png\" />" << std::endl;
7237  }
7238  if (test == 4) {
7239  if (sub == 1)
7240  htmlFile << " <img src=\"HistTmeanHB.png\" />" << std::endl;
7241  if (sub == 2)
7242  htmlFile << " <img src=\"HistTmeanHE.png\" />" << std::endl;
7243  if (sub == 3)
7244  htmlFile << " <img src=\"HistTmeanHO.png\" />" << std::endl;
7245  if (sub == 4)
7246  htmlFile << " <img src=\"HistTmeanHF.png\" />" << std::endl;
7247  }
7248  if (test == 5) {
7249  if (sub == 1)
7250  htmlFile << " <img src=\"HistTmaxHB.png\" />" << std::endl;
7251  if (sub == 2)
7252  htmlFile << " <img src=\"HistTmaxHE.png\" />" << std::endl;
7253  if (sub == 3)
7254  htmlFile << " <img src=\"HistTmaxHO.png\" />" << std::endl;
7255  if (sub == 4)
7256  htmlFile << " <img src=\"HistTmaxHF.png\" />" << std::endl;
7257  }
7258  htmlFile << "<br>" << std::endl;
7259 
7260  if (test == 1) {
7261  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7262  htmlFile << "<a name=\"ErrorA\"></a>\n";
7263  htmlFile << "<h2> 4. Error type A</h2>\n";
7264  htmlFile << "<h3> note: no sence to see plots of this item if max difference is too large(due to very high A "
7265  "of some channels)</h3>\n";
7266  htmlFile << "<br>\n";
7267 
7268  //HB:
7269  if (sub == 1) {
7270  htmlFile << "<h3>Mean of max difference between dependencies to be within: 0.1-1.6 (p-p collisions) </h3>\n";
7271  htmlFile << " <img src=\"HistErrA_HB.png\" />\n";
7272  htmlFile << "<br>\n";
7273  if (flagErrAB_HB[0] == -1)
7274  htmlFile << "<h3>test was not possible</h3>\n";
7275  else if (flagErrAB_HB[0] == 0)
7276  htmlFile << "<h3> Fine:NoErrorA_HB (Mean of max difference " << avedelta_HB
7277  << " is within 0.1-1.6) </h3>\n";
7278  else if (flagErrAB_HB[0] == 1)
7279  htmlFile << "<<h3> ErrorA_HB is available once Mean of max difference " << avedelta_HB
7280  << " is out 0.1-1.6 (p-p collisions)</font></h3>\n";
7281  else
7282  htmlFile << "<h3>auto-interpretation is not available</h3>\n";
7283  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7284 
7285  htmlFile << "<a name=\"ErrorAaverage\"></a>\n";
7286 
7287  htmlFile << "<h2> 5. Error type A cross check: see 2D pattern of channels (only 2 depthes shown as example) "
7288  "</h2>\n";
7289  htmlFile << "<h2> 1) with average channel Amplitudes(No cut), 2) with average channel Amplitudes(<A> >25), "
7290  "3) with channel Amplitude (A<35); </h2>\n";
7291  htmlFile << " <img src=\"ChkErrA_HB1.png\" /><br><br>\n";
7292  htmlFile << " <img src=\"ChkErrA_HB2.png\" /><br>\n";
7293  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7294 
7295  htmlFile << "<a name=\"ErrorAoccupancy\"></a>\n";
7296  htmlFile << "<h2> 6. Error type A: min/ave ratio for occupancy distributions with Amplitude bigger 25 "
7297  "(HBM:neg.eta;HBP:pos.eta) </h2>\n";
7298  htmlFile << "<h2> FOR CROSS-CHECK OLNY !!!</h2>\n";
7299  htmlFile << "<h2> TO IDENTIFY A-type errors: for most of LSs the ratio to be lower 0.6 at least for HF- or "
7300  "HF+ </h2>\n";
7301  htmlFile << "<h2> For runs without A-type errors: for most of LSs the ratio is higher 0.6 and is the same "
7302  "for HF- and HF+ </h2>\n";
7303  htmlFile << " <img src=\"OccPlots_HB.png\" /><br><br>\n";
7304  htmlFile << "<br>\n";
7305  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7306 
7307  htmlFile << "<a name=\"ErrorB\"></a>\n";
7308  htmlFile << "<h2> 7. Error type B (only 2 depthes shown as example) \n";
7309  htmlFile << "<h3> ErrorB identification: digi-collection size != 8.</h3>\n";
7310  htmlFile << " <img src=\"HistErrB_HB_1.png\" />\n<br>\n";
7311  htmlFile << " <img src=\"HistErrB_HB_2.png\" />\n<br>\n";
7312  htmlFile << "<br>\n";
7313  htmlFile << "<h3> if Error type B is available, it start from: " << LSofFirstErrB_HB << " LS </h3>\n";
7314  htmlFile << "<br>\n";
7315  }
7316 
7317  //HE:
7318  if (sub == 2) {
7319  htmlFile << "<h3>Mean of max difference between dependencies to be within: 0.2-1.8 (p-p collisions) </h3>\n";
7320  htmlFile << " <img src=\"HistErrA_HE.png\" />\n";
7321  htmlFile << "<br>\n";
7322  if (flagErrAB_HE[0] == -1)
7323  htmlFile << "<h3>test was not possible</h3>\n";
7324  else if (flagErrAB_HE[0] == 0)
7325  htmlFile << "<h3> Fine:NoErrorA_HE (Mean of max difference " << avedelta_HE
7326  << " is within 0.2-1.8) </h3>\n";
7327  else if (flagErrAB_HE[0] == 1)
7328  htmlFile << "<<h3> ErrorA_HE is available once Mean of max difference " << avedelta_HE
7329  << " is out 0.2-1.8 (p-p collisions)</font></h3>\n";
7330  else
7331  htmlFile << "<h3>auto-interpretation is not available</h3>\n";
7332  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7333 
7334  htmlFile << "<a name=\"ErrorAaverage\"></a>\n";
7335 
7336  htmlFile << "<h2> 5. Error type A cross check: see 2D pattern of channels (only 3 depthes shown as example) "
7337  " </h2>\n";
7338  htmlFile << "<h2> 1) with average channel Amplitudes(No cut), 2) with average channel Amplitudes(<A> "
7339  ">1000.fC), 3) with channel Amplitude (A<500fC); </h2>\n";
7340  htmlFile << " <img src=\"ChkErrA_HE1.png\" /><br><br>\n";
7341  htmlFile << " <img src=\"ChkErrA_HE2.png\" /><br>\n";
7342  htmlFile << " <img src=\"ChkErrA_HE3.png\" /><br>\n";
7343  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7344 
7345  htmlFile << "<a name=\"ErrorAoccupancy\"></a>\n";
7346  htmlFile << "<h2> 6. Error type A: min/ave ratio for occupancy distributions with Amplitude bigger 35 "
7347  "(HEM:neg.eta;HEP:pos.eta) </h2>\n";
7348  htmlFile << "<h2> FOR CROSS-CHECK OLNY !!!</h2>\n";
7349  htmlFile << "<h2> TO IDENTIFY A-type errors: for most of LSs the ratio to be lower 0.3 at least for HF- or "
7350  "HF+ </h2>\n";
7351  htmlFile << "<h2> For runs without A-type errors: for most of LSs the ratio is higher 0.3 and is the same "
7352  "for HF- and HF+ </h2>\n";
7353  htmlFile << " <img src=\"OccPlots_HE.png\" /><br><br>\n";
7354  htmlFile << "<br>\n";
7355  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7356 
7357  htmlFile << "<a name=\"ErrorB\"></a>\n";
7358  htmlFile << "<h2> 7. Error type B (only 3 depthes shown as example) \n";
7359  htmlFile << "<h3> ErrorB identification: digi-collection size != 8.</h3>\n";
7360  htmlFile << " <img src=\"HistErrB_HE_1.png\" />\n<br>\n";
7361  htmlFile << " <img src=\"HistErrB_HE_2.png\" />\n<br>\n";
7362  htmlFile << " <img src=\"HistErrB_HE_3.png\" />\n<br>\n";
7363  htmlFile << "<br>\n";
7364  htmlFile << "<h3> if Error type B is available, it start from: " << LSofFirstErrB_HE << " LS </h3>\n";
7365  htmlFile << "<br>\n";
7366  }
7367 
7368  //HO:
7369  if (sub == 3) {
7370  htmlFile << "<h3>Mean of max difference between dependencies to be within: 0.1-1.5 (p-p collisions) </h3>\n";
7371  htmlFile << " <img src=\"HistErrA_HO.png\" />\n";
7372  htmlFile << "<br>\n";
7373  if (flagErrAB_HO[0] == -1)
7374  htmlFile << "<h3>test was not possible</h3>\n";
7375  else if (flagErrAB_HO[0] == 0)
7376  htmlFile << "<h3> Fine:NoErrorA_HO (Mean of max difference " << avedelta_HO
7377  << " is within 0.1-1.5) </h3>\n";
7378  else if (flagErrAB_HO[0] == 1)
7379  htmlFile << "<<h3> ErrorA_HO is available once Mean of max difference " << avedelta_HO
7380  << " is out 0.1-1.5 (p-p collisions)</font></h3>\n";
7381  else
7382  htmlFile << "<h3>auto-interpretation is not available</h3>\n";
7383  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7384 
7385  htmlFile << "<a name=\"ErrorAaverage\"></a>\n";
7386 
7387  htmlFile << "<h2> 5. Error type A cross check: see 2D pattern of channels </h2>\n";
7388  htmlFile << "<h2> 1) with average channel Amplitudes(No cut), 2) with average channel Amplitudes(<A> >80), "
7389  "3) with channel Amplitude (A<100); </h2>\n";
7390  // htmlFile << "<h2> 2D. Cross check for error A</h2>\n";
7391  htmlFile << " <img src=\"ChkErrA_HO4.png\" /><br><br>\n";
7392  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7393 
7394  htmlFile << "<a name=\"ErrorAoccupancy\"></a>\n";
7395  htmlFile << "<h2> 6. Error type A: min/ave ratio for occupancy distributions with Amplitude bigger 80 "
7396  "(HOM:neg.eta;HOP:pos.eta) </h2>\n";
7397  htmlFile << "<h2> FOR CROSS-CHECK OLNY !!!</h2>\n";
7398  htmlFile << "<h2> TO IDENTIFY A-type errors: for most of LSs the ratio to be lower 0.8 at least for HF- or "
7399  "HF+ </h2>\n";
7400  htmlFile << "<h2> For runs without A-type errors: for most of LSs the ratio is higher 0.8 and is the same "
7401  "for HF- and HF+ </h2>\n";
7402  htmlFile << " <img src=\"OccPlots_HO.png\" /><br><br>\n";
7403  htmlFile << "<br>\n";
7404  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7405 
7406  htmlFile << "<a name=\"ErrorB\"></a>\n";
7407  htmlFile << "<h2> 7. Error type B\n";
7408  htmlFile << "<h3> ErrorB identification: digi-collection size != 10. </h3>\n";
7409  htmlFile << " <img src=\"HistErrB_HO_4.png\" />\n<br>\n";
7410  htmlFile << "<br>\n";
7411  htmlFile << "<h3> if Error type B is available, it start from: " << LSofFirstErrB_HO << " LS </h3>\n";
7412  htmlFile << "<br>\n";
7413  }
7414 
7415  //HF:
7416  if (sub == 4) {
7417  // flagSpecHF+=1;
7418  htmlFile << "<h3>Mean of max difference between dependencies to be within: 0.8-2.4 (p-p collisions) </h3>\n";
7419  htmlFile << " <img src=\"HistErrA_HF.png\" />\n";
7420  htmlFile << "<br>\n";
7421  if (flagErrAB_HF[0] == -1)
7422  htmlFile << "<h3>test was not possible</h3>\n";
7423  else if (flagErrAB_HF[0] == 0)
7424  htmlFile << "<h3> Fine:NoErrorA_HF (Mean of max difference " << avedelta_HF
7425  << " is within 0.8-2.4) </h3>\n";
7426  else if (flagErrAB_HF[0] == 1)
7427  htmlFile << "<<h3> ErrorA_HF is available once Mean of max difference " << avedelta_HF
7428  << " is out 0.8-2.4 (p-p collisions)</font></h3>\n";
7429  else
7430  htmlFile << "<h3>auto-interpretation is not available</h3>\n";
7431  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7432 
7433  htmlFile << "<a name=\"ErrorAaverage\"></a>\n";
7434 
7435  htmlFile << "<h2> 5. Error type A cross check: see 2D pattern of channels (only 2 depthes shown as example) "
7436  "</h2>\n";
7437  htmlFile << "<h2> 1) with average channel Amplitudes(No cut), 2) with average channel Amplitudes(<A> >20), "
7438  "3) with channel Amplitude (A<20); </h2>\n";
7439  // htmlFile << "<h2> 2D. Cross check for error A</h2>\n";
7440  htmlFile << " <img src=\"ChkErrA_HF1.png\" /><br><br>\n";
7441  htmlFile << " <img src=\"ChkErrA_HF2.png\" /><br>\n";
7442  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7443 
7444  htmlFile << "<a name=\"ErrorAoccupancy\"></a>\n";
7445  htmlFile << "<h2> 6. Error type A: min/ave ratio for occupancy distributions with Amplitude bigger 20 "
7446  "(HFM:neg.eta;HFP:pos.eta) </h2>\n";
7447  htmlFile << "<h2> FOR CROSS-CHECK OLNY !!!</h2>\n";
7448  htmlFile << "<h2> TO IDENTIFY A-type errors: for most of LSs the ratio to be lower 0.8 at least for HF- or "
7449  "HF+ </h2>\n";
7450  htmlFile << "<h2> For runs without A-type errors: for most of LSs the ratio is higher 0.8 and is the same "
7451  "for HF- and HF+ </h2>\n";
7452  htmlFile << " <img src=\"OccPlots_HF.png\" /><br><br>\n";
7453  htmlFile << "<br>\n";
7454  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7455 
7456  htmlFile << "<a name=\"ErrorB\"></a>\n";
7457  htmlFile << "<h2> 7. Error type B (only 2 depthes shown as example) \n";
7458  htmlFile << "<h3> ErrorB identification: digi-collection size != 4. </h3>\n";
7459  htmlFile << " <img src=\"HistErrB_HF_1.png\" />\n<br>\n";
7460  htmlFile << " <img src=\"HistErrB_HF_2.png\" />\n<br>\n";
7461  htmlFile << "<br>\n";
7462  htmlFile << "<h3> if Error type B is available, it start from: " << LSofFirstErrB_HF << " LS </h3>\n";
7463  htmlFile << "<br>\n";
7464  }
7465  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7466 
7467  } //test=1 Amplitude
7468 
7469  if (test == 1)
7470  htmlFile << "<a name=\"LSstatus\"></a>\n";
7471  // Continue with common sections
7472  if (sub == 1) {
7473  htmlFile << "<h2> 8.Lumisection Status for HB: </h2>" << std::endl;
7474  // htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: <td class=\"s6\" align=\"center\">"<<Cut0[test][sub][1]<<" (Depth1), "<<Cut0[test][sub][2]<<" (Depth2). </td></h3>"<< std::endl;
7475  htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: " << Cut0[test][sub][1]
7476  << " (Depth1), " << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3), "
7477  << Cut0[test][sub][4] << " (Depth4), </h3>" << std::endl;
7478  }
7479  if (sub == 2) {
7480  htmlFile << "<h2> 8.Lumisection Status for HE: </h2>" << std::endl;
7481  htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: " << Cut0[test][sub][1]
7482  << " (Depth1), " << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3),"
7483  << Cut0[test][sub][4] << " (Depth4)," << Cut0[test][sub][5] << " (Depth5)," << Cut0[test][sub][6]
7484  << " (Depth6)," << Cut0[test][sub][7] << " (Depth7). </h3>" << std::endl;
7485  }
7486  if (sub == 3) {
7487  // htmlFile << Form("<h2> %d.Lumisection Status for HO </h2>",4+flagSpecHF)<< std::endl;
7488  htmlFile << "<h2> 8.Lumisection Status for HO: </h2>" << std::endl;
7489  htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: " << Cut0[test][sub][4]
7490  << " (Depth4). </h3>" << std::endl;
7491  }
7492  if (sub == 4) {
7493  htmlFile << "<h2> 8.Lumisection Status for HF: </h2>" << std::endl;
7494  htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: " << Cut0[test][sub][1]
7495  << " (Depth1), " << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3), "
7496  << Cut0[test][sub][4] << " (Depth4), </h3>" << std::endl;
7497  }
7498  htmlFile << "<br>" << std::endl;
7499  htmlFile << "<table>" << std::endl;
7500  htmlFile << "<tr>";
7501  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
7502  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
7503  htmlFile << "<td class=\"s1\" align=\"center\">Number of events</td>" << std::endl;
7505 
7506  int kkkkkkmax = k_max[sub];
7507  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
7508  kkkkkkmax = k_maxupgrade[sub];
7509  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
7510  // if (test==1 && sub==4) kkkkkkmax = k_maxupgrade[sub];
7511 
7512  if (test == 0)
7513  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7514  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > Depth " << k << " </td>" << std::endl;
7515  if (test == 1)
7516  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7517  htmlFile << "<td class=\"s1\" align=\"center\">< A > Depth " << k << " </td>" << std::endl;
7518  if (test == 2)
7519  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7520  htmlFile << "<td class=\"s1\" align=\"center\">< W > Depth " << k << " </td>" << std::endl;
7521  if (test == 3)
7522  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7523  htmlFile << "<td class=\"s1\" align=\"center\">< R > Depth " << k << " </td>" << std::endl;
7524  if (test == 4)
7525  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7526  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > Depth " << k << " </td>" << std::endl;
7527  if (test == 5)
7528  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7529  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > Depth " << k << " </td>" << std::endl;
7530  htmlFile << "</tr>" << std::endl;
7531 
7532  ind = 0;
7533  // for (int i = 1; i <= MaxLum; i++) {
7534  for (int i = 1; i <= MaxLum000000; i++) {
7535  if ((ind % 2) == 1)
7536  raw_class = "<td class=\"s2\" align=\"center\">";
7537  else
7538  raw_class = "<td class=\"s3\" align=\"center\">";
7539  htmlFile << "<tr>" << std::endl;
7540  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
7541  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
7542  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
7543  for (int k = k_min[sub]; k <= kkkkkkmax; k++) {
7544  if (HistNumBadChanDepth[test][sub][k]->GetBinContent(i) > Cut0[test][sub][k]) {
7545  if (test == 1)
7546  htmlFile << "<td class=\"s6\" align=\"center\">"
7547  << int(HistNumBadChanDepth[test][sub][k]->GetBinContent(i)) << "</td>" << std::endl;
7548  else
7549  htmlFile << "<td class=\"s6\" align=\"center\">" << (HistNumBadChanDepth[test][sub][k]->GetBinContent(i))
7550  << "</td>" << std::endl;
7551  } else {
7552  if (test == 1)
7553  htmlFile << raw_class << int(HistNumBadChanDepth[test][sub][k]->GetBinContent(i)) << "</td>" << std::endl;
7554  else
7555  htmlFile << raw_class << (HistNumBadChanDepth[test][sub][k]->GetBinContent(i)) << "</td>" << std::endl;
7556  }
7557  }
7558  htmlFile << "</tr>" << std::endl;
7559  ind += 1;
7560  }
7561  htmlFile << "</table>" << std::endl;
7562 
7563  htmlFile << "<br>" << std::endl;
7564  if (test == 1)
7565  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7566  htmlFile << "<br>" << std::endl;
7567 
7568  // Only for Amplitudes (test=1):
7570  if (test == 1) {
7573  htmlFile << "<a name=\"RBXstatus\"></a>\n";
7574 
7575  //HB j = 7,8,9,10 11,12,13,14
7576  if (sub == 1) {
7577  htmlFile << "<h2> 9. Average Amplitudes of RBX for HB: </h2>" << std::endl;
7578  htmlFile << "<h3> where </h3>" << std::endl;
7579  htmlFile << "<h3> jeta = 7,8,9,10 (Negative direction); ............&& ............ jeta = 11,12,13,14 "
7580  "(Positive direction); </h3>"
7581  << std::endl;
7582  htmlFile << "<h3> jphi = 0, 1,..... 16, 17 </h3>" << std::endl;
7583  // htmlFile << "<h3> jphi = 0, 1, 2, 3, 4, 5 (range 1) ............&& ............ jphi = 6, 7, 8, 9,10,11 (range 2) ............&& ............ jphi = 12,13,14,15,16,17 (range 3)</h3>"<< std::endl;
7584  htmlFile << " <img src=\"RBX-HB-2Dplot.png\" />\n";
7585  htmlFile << "<br>\n";
7586 
7587  htmlFile << "<h2> Average Amplitudes of RBX-PHI for HB: </h2>" << std::endl;
7588  htmlFile << " <img src=\"RBX-HB-1Dplot.png\" />\n";
7589  htmlFile << "<br>\n";
7590 
7591  htmlFile << "<h2> Average Amplitudes of RBX-ETA for HB: </h2>" << std::endl;
7592  htmlFile << " <img src=\"RBX-HB-11Dplot.png\" />\n";
7593  htmlFile << "<br>\n";
7594 
7595  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7596  }
7597  // HE: j = 3,4,5, 6, 7 14,15,16,17,18
7598  if (sub == 2) {
7599  htmlFile << "<h2> 9. Averaged Amplitudes of RBX for HE: </h2>" << std::endl;
7600  htmlFile << "<h3> where </h3>" << std::endl;
7601  htmlFile << "<h3> jeta = 3,4,5, 6, 7 (Negative direction); ............&& ............ jeta = "
7602  "14,15,16,17,18 (Positive direction); </h3>"
7603  << std::endl;
7604  htmlFile << "<h3> jphi = 0, 1,..... 16, 17 </h3>" << std::endl;
7605  // htmlFile << "<h3> jphi = 0, 1, 2, 3, 4, 5 (range 1) ............&& ............ jphi = 6, 7, 8, 9,10,11 (range 2) ............&& ............ jphi = 12,13,14,15,16,17 (range 3)</h3>"<< std::endl;
7606  htmlFile << " <img src=\"RBX-HE-2Dplot.png\" />\n";
7607  htmlFile << "<br>\n";
7608 
7609  htmlFile << "<h2> Average Amplitudes of RBX-PHI for HE: </h2>" << std::endl;
7610  htmlFile << " <img src=\"RBX-HE-1Dplot.png\" />\n";
7611  htmlFile << "<br>\n";
7612 
7613  htmlFile << "<h2> Average Amplitudes of RBX-ETA for HE: </h2>" << std::endl;
7614  htmlFile << " <img src=\"RBX-HE-11Dplot.png\" />\n";
7615  htmlFile << "<br>\n";
7616 
7617  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7618  }
7619  // HO: j = 7,8,9,10 11,12,13,14
7620  if (sub == 3) {
7621  htmlFile << "<h2> 9. Averaged Amplitudes of RBX for HO: </h2>" << std::endl;
7622  htmlFile << "<h3> where </h3>" << std::endl;
7623  htmlFile << "<h3> jeta = 7,8,9,10 (Negative direction); ............&& ............ jeta = 11,12,13,14 "
7624  "(Positive direction); </h3>"
7625  << std::endl;
7626  htmlFile << "<h3> jphi = 0, 1,..... 16, 17 </h3>" << std::endl;
7627  // htmlFile << "<h3> jphi = 0, 1, 2, 3, 4, 5 (range 1) ............&& ............ jphi = 6, 7, 8, 9,10,11 (range 2) ............&& ............ jphi = 12,13,14,15,16,17 (range 3)</h3>"<< std::endl;
7628  htmlFile << " <img src=\"RBX-HO-2Dplot.png\" />\n";
7629  htmlFile << "<br>\n";
7630 
7631  htmlFile << "<h2> Average Amplitudes of RBX-PHI for HO: </h2>" << std::endl;
7632  htmlFile << " <img src=\"RBX-HO-1Dplot.png\" />\n";
7633  htmlFile << "<br>\n";
7634 
7635  htmlFile << "<h2> Average Amplitudes of RBX-ETA for HO: </h2>" << std::endl;
7636  htmlFile << " <img src=\"RBX-HO-11Dplot.png\" />\n";
7637  htmlFile << "<br>\n";
7638 
7639  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7640  }
7641  //HF:j = 0,1,2, 3 18,19,20,21
7642  if (sub == 4) {
7643  htmlFile << "<h2> 9. Averaged Amplitudes of RBX for HF: </h2>" << std::endl;
7644  htmlFile << "<h3> where </h3>" << std::endl;
7645  htmlFile << "<h3> jeta = 0,1,2, 3 (Negative direction); ............&& ............ jeta = 18,19,20,21 "
7646  "(Positive direction); </h3>"
7647  << std::endl;
7648  htmlFile << "<h3> jphi = 0, 1,..... 16, 17 </h3>" << std::endl;
7649  // htmlFile << "<h3> jphi = 0, 1, 2, 3, 4, 5 (range 1) ............&& ............ jphi = 6, 7, 8, 9,10,11 (range 2) ............&& ............ jphi = 12,13,14,15,16,17 (range 3)</h3>"<< std::endl;
7650  htmlFile << " <img src=\"RBX-HF-2Dplot.png\" />\n";
7651  htmlFile << "<br>\n";
7652 
7653  htmlFile << "<h2> Average Amplitudes of RBX-PHI for HF: </h2>" << std::endl;
7654  htmlFile << " <img src=\"RBX-HF-1Dplot.png\" />\n";
7655  htmlFile << "<br>\n";
7656 
7657  htmlFile << "<h2> Average Amplitudes of RBX-ETA for HF: </h2>" << std::endl;
7658  htmlFile << " <img src=\"RBX-HF-11Dplot.png\" />\n";
7659  htmlFile << "<br>\n";
7660 
7661  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7662  }
7663  htmlFile << "<br>" << std::endl;
7664 
7667 
7668  htmlFile << "<a name=\"RBXPHItable\"></a>\n";
7669  int cutA_ALL = 0;
7670  // float cutA_HB = 100.;float cutA_HE = 1000000.;float cutA_HO = 150.;float cutA_HF = 500.;
7671  if (sub == 1) {
7672  htmlFile << "<h2> 10. Average RBX-Amplitude in Phi over LSs for HB: </h2>" << std::endl;
7673  htmlFile
7674  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
7675  << cutA_HB << std::endl;
7676  cutA_ALL = cutA_HB;
7677  }
7678  if (sub == 2) {
7679  htmlFile << "<h2> 10. Average RBX-Amplitude in Phi over LSs for HE: </h2>" << std::endl;
7680  htmlFile
7681  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
7682  << cutA_HE << std::endl;
7683  cutA_ALL = cutA_HE;
7684  }
7685  if (sub == 3) {
7686  htmlFile << "<h2> 10. Average RBX-Amplitude in Phi over LSs for HO: </h2>" << std::endl;
7687  htmlFile
7688  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
7689  << cutA_HO << std::endl;
7690  cutA_ALL = cutA_HO;
7691  }
7692  if (sub == 4) {
7693  htmlFile << "<h2> 10. Average RBX-Amplitude in Phi over LSs for HF: </h2>" << std::endl;
7694  htmlFile
7695  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
7696  << cutA_HF << std::endl;
7697  cutA_ALL = cutA_HF;
7698  }
7699 
7700  htmlFile << "<br>" << std::endl;
7701  htmlFile << "<table>" << std::endl;
7702  htmlFile << "<tr>";
7703  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
7704  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
7705  htmlFile << "<td class=\"s1\" align=\"center\">Number of events</td>" << std::endl;
7707 
7708  // k is jphi
7709  for (int k = 0; k < njphi; k++)
7710  htmlFile << "<td class=\"s1\" align=\"center\"> iPHI " << k << " </td>" << std::endl;
7711  htmlFile << "</tr>" << std::endl;
7713 
7714  ind = 0;
7715  // i is LS
7716  for (int i = 1; i <= MaxLum; i++) {
7717  if ((ind % 2) == 1)
7718  raw_class = "<td class=\"s2\" align=\"center\">";
7719  else
7720  raw_class = "<td class=\"s3\" align=\"center\">";
7721  htmlFile << "<tr>" << std::endl;
7722  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
7723  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
7724  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
7725 
7726  // k is jphi
7727  for (int k = 0; k < njphi; k++) {
7728  if (sub == 1) {
7729  if (int(alexhb[k][i - 1]) > cutA_ALL) {
7730  htmlFile << "<td class=\"s6\" align=\"center\">" << int(alexhb[k][i - 1]) << "</td>" << std::endl;
7731  } else {
7732  htmlFile << raw_class << int(alexhb[k][i - 1]) << "</td>" << std::endl;
7733  }
7734  } // HB end
7735  if (sub == 2) {
7736  if (int(alexhe[k][i - 1]) > cutA_ALL) {
7737  htmlFile << "<td class=\"s6\" align=\"center\">" << int(alexhe[k][i - 1]) << "</td>" << std::endl;
7738  } else {
7739  htmlFile << raw_class << int(alexhe[k][i - 1]) << "</td>" << std::endl;
7740  }
7741  } // HE end
7742  if (sub == 3) {
7743  if (int(alexho[k][i - 1]) > cutA_ALL) {
7744  htmlFile << "<td class=\"s6\" align=\"center\">" << int(alexho[k][i - 1]) << "</td>" << std::endl;
7745  } else {
7746  htmlFile << raw_class << int(alexho[k][i - 1]) << "</td>" << std::endl;
7747  }
7748  } // HO end
7749  if (sub == 4) {
7750  if (int(alexhf[k][i - 1]) > cutA_ALL) {
7751  htmlFile << "<td class=\"s6\" align=\"center\">" << int(alexhf[k][i - 1]) << "</td>" << std::endl;
7752  } else {
7753  htmlFile << raw_class << int(alexhf[k][i - 1]) << "</td>" << std::endl;
7754  }
7755  } // HF end
7757  } // k over PHI-RBX
7758  htmlFile << "</tr>" << std::endl;
7759  ind += 1;
7760  } // i over LSs
7761  htmlFile << "</table>" << std::endl;
7762  htmlFile << "<br>" << std::endl;
7763  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7764  htmlFile << "<br>" << std::endl;
7766 
7767  htmlFile << "<a name=\"RBXETAtable\"></a>\n";
7768  int cutB_ALL = 0;
7769  // float cutB_HB = 100.;float cutB_HE = 1000000.;float cutB_HO = 150.;float cutB_HF = 500.;
7770  if (sub == 1) {
7771  htmlFile << "<h2> 11. Average RBX-Amplitude in Eta over LSs for HB: </h2>" << std::endl;
7772  htmlFile
7773  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
7774  << cutB_HB << std::endl;
7775  cutB_ALL = cutB_HB;
7776  }
7777  if (sub == 2) {
7778  htmlFile << "<h2> 11. Average RBX-Amplitude in Eta over LSs for HE: </h2>" << std::endl;
7779  htmlFile
7780  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
7781  << cutB_HE << std::endl;
7782  cutB_ALL = cutB_HE;
7783  }
7784  if (sub == 3) {
7785  htmlFile << "<h2> 11. Average RBX-Amplitude in Eta over LSs for HO: </h2>" << std::endl;
7786  htmlFile
7787  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
7788  << cutB_HO << std::endl;
7789  cutB_ALL = cutB_HO;
7790  }
7791  if (sub == 4) {
7792  htmlFile << "<h2> 11. Average RBX-Amplitude in Eta over LSs for HF: </h2>" << std::endl;
7793  htmlFile
7794  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
7795  << cutB_HF << std::endl;
7796  cutB_ALL = cutB_HF;
7797  }
7798 
7799  htmlFile << "<br>" << std::endl;
7800  htmlFile << "<table>" << std::endl;
7801  htmlFile << "<tr>";
7802  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
7803  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
7804  htmlFile << "<td class=\"s1\" align=\"center\">Number of events</td>" << std::endl;
7806 
7807  // k is jeta
7808  for (int k = 0; k < njeta; k++)
7809  htmlFile << "<td class=\"s1\" align=\"center\"> iETA " << k << " </td>" << std::endl;
7810  htmlFile << "</tr>" << std::endl;
7812 
7813  ind = 0;
7814  // i is LS
7815  for (int i = 1; i <= MaxLum; i++) {
7816  if ((ind % 2) == 1)
7817  raw_class = "<td class=\"s2\" align=\"center\">";
7818  else
7819  raw_class = "<td class=\"s3\" align=\"center\">";
7820  htmlFile << "<tr>" << std::endl;
7821  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
7822  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
7823  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
7824 
7825  // k is jeta
7826  for (int k = 0; k < njeta; k++) {
7827  if (sub == 1) {
7828  if (int(blexhb[k][i - 1]) > cutB_ALL) {
7829  htmlFile << "<td class=\"s6\" align=\"center\">" << int(blexhb[k][i - 1]) << "</td>" << std::endl;
7830  } else {
7831  htmlFile << raw_class << int(blexhb[k][i - 1]) << "</td>" << std::endl;
7832  }
7833  } // HB end
7834  if (sub == 2) {
7835  if (int(blexhe[k][i - 1]) > cutB_ALL) {
7836  htmlFile << "<td class=\"s6\" align=\"center\">" << int(blexhe[k][i - 1]) << "</td>" << std::endl;
7837  } else {
7838  htmlFile << raw_class << int(blexhe[k][i - 1]) << "</td>" << std::endl;
7839  }
7840  } // HE end
7841  if (sub == 3) {
7842  if (int(blexho[k][i - 1]) > cutB_ALL) {
7843  htmlFile << "<td class=\"s6\" align=\"center\">" << int(blexho[k][i - 1]) << "</td>" << std::endl;
7844  } else {
7845  htmlFile << raw_class << int(blexho[k][i - 1]) << "</td>" << std::endl;
7846  }
7847  } // HO end
7848  if (sub == 4) {
7849  if (int(blexhf[k][i - 1]) > cutB_ALL) {
7850  htmlFile << "<td class=\"s6\" align=\"center\">" << int(blexhf[k][i - 1]) << "</td>" << std::endl;
7851  } else {
7852  htmlFile << raw_class << int(blexhf[k][i - 1]) << "</td>" << std::endl;
7853  }
7854  } // HF end
7856  } // k over ETA-RBX
7857  htmlFile << "</tr>" << std::endl;
7858  ind += 1;
7859  } // i over LSs
7860  htmlFile << "</table>" << std::endl;
7861  htmlFile << "<br>" << std::endl;
7862  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7863  htmlFile << "<br>" << std::endl;
7865 
7868  htmlFile << "<a name=\"RBX3plots\"></a>\n";
7869  htmlFile << "<br>\n";
7870  htmlFile << "<h2> 12. (Rij) - RBX-amplitudes normilized on reference LS (~=1st) </h2>" << std::endl;
7871  htmlFile << "<h3> ( Rji . . is ratio of . . . . A_j_i . . to . . A_j_ref . . . . for . . j-RBX . . and . . "
7872  "i-LS . ) </h3>"
7873  << std::endl;
7874 
7875  htmlFile << "<br>\n";
7876  htmlFile << "<h2> . . . . . . . . . . . . . . 1) . average Ri vs iLS:. . . . . . . . . . . . . . . . . . . . . "
7877  ". . 2) . average Rj shown for Rij outside meanValue range either 0.95-1.05 or 3RMS: . . . . . . . "
7878  ". . . . . . . . . . . . . . . . . . 3) . Rij: </h2>"
7879  << std::endl;
7880  htmlFile << "<br>\n";
7881  if (sub == 1) {
7882  htmlFile << " <img src=\"RBX-HB-3plots.png\" />\n";
7883  }
7884  if (sub == 2) {
7885  htmlFile << " <img src=\"RBX-HE-3plots.png\" />\n";
7886  }
7887  if (sub == 3) {
7888  htmlFile << " <img src=\"RBX-HO-3plots.png\" />\n";
7889  }
7890  if (sub == 4) {
7891  htmlFile << " <img src=\"RBX-HF-3plots.png\" />\n";
7892  }
7893  htmlFile << "<br>\n";
7894 
7895  htmlFile << "<br>\n";
7896  htmlFile << "<h2> . 4). average Rj shown for Rij outside meanValue range 0.80-1.20: . . . . . . . .5) . "
7897  "average Rj shown for Rij outside meanValue range 0.70-1.30: . . . . . . . .6). average Rj shown "
7898  "for Rij outside meanValue range 0.60-1.40: </h2>"
7899  << std::endl;
7900  htmlFile << "<br>\n";
7901  if (sub == 1) {
7902  htmlFile << " <img src=\"RBX-HB-3plotsmore.png\" />\n";
7903  }
7904  if (sub == 2) {
7905  htmlFile << " <img src=\"RBX-HE-3plotsmore.png\" />\n";
7906  }
7907  if (sub == 3) {
7908  htmlFile << " <img src=\"RBX-HO-3plotsmore.png\" />\n";
7909  }
7910  if (sub == 4) {
7911  htmlFile << " <img src=\"RBX-HF-3plotsmore.png\" />\n";
7912  }
7913  htmlFile << "<br>\n";
7914 
7915  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7916 
7917  //=========================================================
7918 
7919  } // test=1
7920 
7921  //===============================================================================
7922 
7923  htmlFile.close();
7924  } // sub main loop
7925  } //test main loop
7926  //===============================================================================
7927  //===============================================================================
7928  //===============================================================================
7929  //===============================================================================
7930  //===============================================================================
7931 
7932  //======================================================================
7933  // Creating tests html pages:
7934 
7935  for (int test = 0; test <= 5; test++) { //Test: 0,
7936  if (test == 0)
7937  htmlFile.open("CapID_GL.html");
7938  if (test == 1)
7939  htmlFile.open("ADCampl_GL.html");
7940  if (test == 2)
7941  htmlFile.open("Width_GL.html");
7942  if (test == 3)
7943  htmlFile.open("Ratio_GL.html");
7944  if (test == 4)
7945  htmlFile.open("Tmean_GL.html");
7946  if (test == 5)
7947  htmlFile.open("Tmax_GL.html");
7948 
7949  // cout<<"Creating tests html pages: test= "<< test << endl;
7950 
7951  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
7952  htmlFile << "<head>" << std::endl;
7953  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
7954  htmlFile << "<title> Certification Monitoring Tool </title>" << std::endl;
7955  htmlFile << "<style type=\"text/css\">" << std::endl;
7956  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
7957  << std::endl;
7958  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
7959  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
7960  "text-align: center;}"
7961  << std::endl;
7962  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
7963  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
7964  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
7965  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
7966  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
7967  htmlFile << "</style>" << std::endl;
7968  htmlFile << "<body>" << std::endl;
7969  if (test == 0)
7970  htmlFile << "<h1> CAP ID ERRORS, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
7971  if (test == 1)
7972  htmlFile << "<h1> ADC AMPLITIDE, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
7973  if (test == 2)
7974  htmlFile << "<h1> WIDTH, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
7975  if (test == 3)
7976  htmlFile << "<h1> RATIO, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
7977  if (test == 4)
7978  htmlFile << "<h1> TIMING MEAN, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
7979  if (test == 5)
7980  htmlFile << "<h1> TIMING MAX, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
7981  htmlFile << "<br>" << std::endl;
7982  htmlFile << "<h2> 1. Map of suspicious channels with this criterion for whole HCAL </h2>" << std::endl;
7983  htmlFile << "<h3> Channel legend: green - good, other colour - suspicious </h3>" << std::endl;
7984  htmlFile << "<br>" << std::endl;
7985  if (test == 0)
7986  htmlFile << " <img src=\"MapCapIdError.png\" />" << std::endl;
7987  if (test == 1)
7988  htmlFile << " <img src=\"MapADCAmpl.png\" />" << std::endl;
7989  if (test == 2)
7990  htmlFile << " <img src=\"MapWidth.png\" />" << std::endl;
7991  if (test == 3)
7992  htmlFile << " <img src=\"MapRatio.png\" />" << std::endl;
7993  if (test == 4)
7994  htmlFile << " <img src=\"MapTmean.png\" />" << std::endl;
7995  if (test == 5)
7996  htmlFile << " <img src=\"MapTmax.png\" />" << std::endl;
7997  htmlFile << "<br>" << std::endl;
7998  htmlFile << "<h2> 2. For whole HCAL: </h2>" << std::endl;
7999  htmlFile << "<br>" << std::endl;
8000  if (test == 0)
8001  htmlFile << " <img src=\"HistCapID.png\" />" << std::endl;
8002  if (test == 1)
8003  htmlFile << " <img src=\"HistADCAmpl.png\" />" << std::endl;
8004  if (test == 2)
8005  htmlFile << " <img src=\"HistWidth.png\" />" << std::endl;
8006  if (test == 3)
8007  htmlFile << " <img src=\"HistRatio.png\" />" << std::endl;
8008  if (test == 4)
8009  htmlFile << " <img src=\"HistTmean.png\" />" << std::endl;
8010  if (test == 5)
8011  htmlFile << " <img src=\"HistTmax.png\" />" << std::endl;
8012  htmlFile << "<br>" << std::endl;
8013  htmlFile << "<h2> 3. Status of subdetectors </h2>" << std::endl;
8014  htmlFile << "<table width=\"400\">" << std::endl;
8015  htmlFile << "<tr>" << std::endl;
8016  if (test == 0) {
8017  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8018  << "/HB_CapID.html\">HB</a></td>" << std::endl;
8019  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8020  << "/HE_CapID.html\">HE</a></td>" << std::endl;
8021  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8022  << "/HO_CapID.html\">HO</a></td>" << std::endl;
8023  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8024  << "/HF_CapID.html\">HF</a></td>" << std::endl;
8025  }
8026  if (test == 1) {
8027  // AZ 11.03.2019
8028  /*
8029  htmlFile << " <td><a href=\"HB_ADCampl.html\">HB</a></td>"<< std::endl;
8030  htmlFile << " <td><a href=\"HE_ADCampl.html\">HE</a></td>"<< std::endl;
8031  htmlFile << " <td><a href=\"HO_ADCampl.html\">HO</a></td>"<< std::endl;
8032  htmlFile << " <td><a href=\"HF_ADCampl.html\">HF</a></td>"<< std::endl;
8033 */
8034 
8035  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8036  << "/HB_ADCampl.html\">HB</a></td>" << std::endl;
8037  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8038  << "/HE_ADCampl.html\">HE</a></td>" << std::endl;
8039  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8040  << "/HO_ADCampl.html\">HO</a></td>" << std::endl;
8041  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8042  << "/HF_ADCampl.html\">HF</a></td>" << std::endl;
8043  }
8044  if (test == 2) {
8045  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8046  << "/HB_Width.html\">HB</a></td>" << std::endl;
8047  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8048  << "/HE_Width.html\">HE</a></td>" << std::endl;
8049  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8050  << "/HO_Width.html\">HO</a></td>" << std::endl;
8051  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8052  << "/HF_Width.html\">HF</a></td>" << std::endl;
8053  }
8054  if (test == 3) {
8055  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8056  << "/HB_Ratio.html\">HB</a></td>" << std::endl;
8057  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8058  << "/HE_Ratio.html\">HE</a></td>" << std::endl;
8059  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8060  << "/HO_Ratio.html\">HO</a></td>" << std::endl;
8061  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8062  << "/HF_Ratio.html\">HF</a></td>" << std::endl;
8063  }
8064  if (test == 4) {
8065  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8066  << "/HB_Tmean.html\">HB</a></td>" << std::endl;
8067  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8068  << "/HE_Tmean.html\">HE</a></td>" << std::endl;
8069  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8070  << "/HO_Tmean.html\">HO</a></td>" << std::endl;
8071  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8072  << "/HF_Tmean.html\">HF</a></td>" << std::endl;
8073  }
8074  if (test == 5) {
8075  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8076  << "/HB_Tmax.html\">HB</a></td>" << std::endl;
8077  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8078  << "/HE_Tmax.html\">HE</a></td>" << std::endl;
8079  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8080  << "/HO_Tmax.html\">HO</a></td>" << std::endl;
8081  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8082  << "/HF_Tmax.html\">HF</a></td>" << std::endl;
8083  }
8084 
8085  htmlFile << "</tr>" << std::endl;
8086  htmlFile << "</table>" << std::endl;
8087  htmlFile << "<br>" << std::endl;
8088  // cout<<"Creating tests html pages: 111111" << endl;
8089 
8090  if (test != 0)
8091  htmlFile << "<h2> 4. Table of estimator-values in sub-detectors for ONLY suspicious LSs </h3>" << std::endl;
8092  if (test == 0)
8093  htmlFile << "<h2> 4. Table of average Nbcs in sub-detectors for ONLY suspicious LSs </h3>" << std::endl;
8094  htmlFile << "<table>" << std::endl;
8095  htmlFile << "<tr>";
8096  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
8097  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
8098  htmlFile << "<td class=\"s1\" align=\"center\">Number of events</td>" << std::endl;
8100  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
8101 
8102  // cout<<"Creating each test kind for each subdet html pages: test= "<< test << " sub= " << sub << endl;
8103  int kkkkkkmax = k_max[sub];
8104  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
8105  kkkkkkmax = k_maxupgrade[sub];
8106  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
8107  // if (test==1 && sub==4) kkkkkkmax = k_maxupgrade[sub];
8108  if (sub == 1) {
8109  if (test == 0)
8110  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8111  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > HBdep " << k << " </td>" << std::endl;
8112  if (test == 1)
8113  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8114  htmlFile << "<td class=\"s1\" align=\"center\">< A > HBdepth " << k << " </td>" << std::endl;
8115  if (test == 2)
8116  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8117  htmlFile << "<td class=\"s1\" align=\"center\">< W > HBdepth " << k << " </td>" << std::endl;
8118  if (test == 3)
8119  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8120  htmlFile << "<td class=\"s1\" align=\"center\">< R > HBdepth " << k << " </td>" << std::endl;
8121  if (test == 4)
8122  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8123  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > HBdep " << k << " </td>" << std::endl;
8124  if (test == 5)
8125  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8126  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > HBdep " << k << " </td>" << std::endl;
8127  } //
8128  if (sub == 2) {
8129  if (test == 0)
8130  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8131  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > HEdep " << k << " </td>" << std::endl;
8132  if (test == 1)
8133  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8134  htmlFile << "<td class=\"s1\" align=\"center\">< A > HEdepth " << k << " </td>" << std::endl;
8135  if (test == 2)
8136  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8137  htmlFile << "<td class=\"s1\" align=\"center\">< W > HEdepth " << k << " </td>" << std::endl;
8138  if (test == 3)
8139  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8140  htmlFile << "<td class=\"s1\" align=\"center\">< R > HEdepth " << k << " </td>" << std::endl;
8141  if (test == 4)
8142  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8143  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > HEdep " << k << " </td>" << std::endl;
8144  if (test == 5)
8145  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8146  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > HEdep " << k << " </td>" << std::endl;
8147  } //
8148  if (sub == 3) {
8149  if (test == 0)
8150  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8151  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > HOdep " << k << " </td>" << std::endl;
8152  if (test == 1)
8153  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8154  htmlFile << "<td class=\"s1\" align=\"center\">< A > HOdepth " << k << " </td>" << std::endl;
8155  if (test == 2)
8156  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8157  htmlFile << "<td class=\"s1\" align=\"center\">< W > HOdepth " << k << " </td>" << std::endl;
8158  if (test == 3)
8159  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8160  htmlFile << "<td class=\"s1\" align=\"center\">< R > HOdepth " << k << " </td>" << std::endl;
8161  if (test == 4)
8162  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8163  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > HOdep " << k << " </td>" << std::endl;
8164  if (test == 5)
8165  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8166  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > HOdep " << k << " </td>" << std::endl;
8167  } //
8168  if (sub == 4) {
8169  if (test == 0)
8170  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8171  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > HFdep " << k << " </td>" << std::endl;
8172  if (test == 1)
8173  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8174  htmlFile << "<td class=\"s1\" align=\"center\">< A > HFdepth " << k << " </td>" << std::endl;
8175  if (test == 2)
8176  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8177  htmlFile << "<td class=\"s1\" align=\"center\">< W > HFdepth " << k << " </td>" << std::endl;
8178  if (test == 3)
8179  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8180  htmlFile << "<td class=\"s1\" align=\"center\">< R > HFdepth " << k << " </td>" << std::endl;
8181  if (test == 4)
8182  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8183  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > HFdep " << k << " </td>" << std::endl;
8184  if (test == 5)
8185  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8186  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > HFdep " << k << " </td>" << std::endl;
8187  } //
8188  } // sub
8189  htmlFile << "</tr>" << std::endl;
8190 
8191  // htmlFile << "<td class=\"s1\" align=\"center\">HB Depth 1</td>"<< std::endl;
8192  // htmlFile << "<td class=\"s1\" align=\"center\">HB Depth 2</td>" << std::endl;
8193  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 1</td>" << std::endl;
8194  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 2</td>" << std::endl;
8195  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 3</td>" << std::endl;
8196  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 4</td>" << std::endl;
8197  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 5</td>" << std::endl;
8198  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 6</td>" << std::endl;
8199  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 7</td>" << std::endl;
8200  // htmlFile << "<td class=\"s1\" align=\"center\">HO Depth 4</td>" << std::endl;
8201  // htmlFile << "<td class=\"s1\" align=\"center\">HF Depth 1</td>" << std::endl;
8202  // htmlFile << "<td class=\"s1\" align=\"center\">HF Depth 2</td>" << std::endl;
8203  // htmlFile << "<td class=\"s1\" align=\"center\">HF Depth 3</td>" << std::endl;
8204  // htmlFile << "<td class=\"s1\" align=\"center\">HF Depth 4</td>" << std::endl;
8205  // htmlFile << "</tr>" << std::endl;
8206 
8207  ind = 0;
8208  // cout<<"Creating tests html pages: 222222" << endl;
8209  for (int i = 1; i <= MaxLum; i++) {
8210  // define al least one exceed in any sub-detector
8211  int met = 0;
8212  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
8213  int kkkkkkmax = k_max[sub];
8214  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
8215  kkkkkkmax = k_maxupgrade[sub];
8216  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
8217  for (int k = k_min[sub]; k <= kkkkkkmax; k++) {
8218  // line below is temporary, just to avoid contribution of HEP(M)17 in depthes 4,5,6,7 but keep in depthes 1,2,3
8219  // if (sub == 2 && k > 3) {
8220  // } else {
8221  if (HistNumBadChanDepth[test][sub][k]->GetBinContent(i) > Cut0[test][sub][k])
8222  met = 1;
8223  // }
8224  } //depth
8225  } //sub
8226  // if exceed then plot the line for all sub-detectors
8227  if (met == 1) {
8228  if ((ind % 2) == 1)
8229  raw_class = "<td class=\"s2\" align=\"center\">";
8230  else
8231  raw_class = "<td class=\"s3\" align=\"center\">";
8232  htmlFile << "<tr>" << std::endl;
8233  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
8234  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
8235  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
8236  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
8237  int kkkkkkmax = k_max[sub];
8238  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
8239  kkkkkkmax = k_maxupgrade[sub];
8240  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
8241  for (int k = k_min[sub]; k <= kkkkkkmax; k++) {
8242  if (HistNumBadChanDepth[test][sub][k]->GetBinContent(i) > Cut0[test][sub][k])
8243  htmlFile << "<td class=\"s6\" align=\"center\">" << HistNumBadChanDepth[test][sub][k]->GetBinContent(i)
8244  << "</td>" << std::endl;
8245  else
8246  htmlFile << raw_class << HistNumBadChanDepth[test][sub][k]->GetBinContent(i) << "</td>" << std::endl;
8247  // htmlFile << "</tr>" << std::endl;
8248  /*
8249  if (HistNumBadChanDepth[test][1][1]->GetBinContent(i) > Cut0[test][1][1]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][1][1]->GetBinContent(i)<<"</td>"<< std::endl;
8250  else htmlFile <<raw_class<<HistNumBadChanDepth[test][1][1]->GetBinContent(i)<<"</td>"<< std::endl;
8251  if (HistNumBadChanDepth[test][1][2]->GetBinContent(i) > Cut0[test][1][2]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][1][2]->GetBinContent(i)<<"</td>"<< std::endl;
8252  else htmlFile <<raw_class<<HistNumBadChanDepth[test][1][2]->GetBinContent(i)<<"</td>"<< std::endl;
8253  if (HistNumBadChanDepth[test][2][1]->GetBinContent(i) > Cut0[test][2][1]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][2][1]->GetBinContent(i)<<"</td>"<< std::endl;
8254  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][1]->GetBinContent(i)<<"</td>"<< std::endl;
8255  if (HistNumBadChanDepth[test][2][2]->GetBinContent(i) > Cut0[test][2][2]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][2][2]->GetBinContent(i)<<"</td>"<< std::endl;
8256  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][2]->GetBinContent(i)<<"</td>"<< std::endl;
8257  if (HistNumBadChanDepth[test][2][3]->GetBinContent(i) > Cut0[test][2][3]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][2][3]->GetBinContent(i)<<"</td>"<< std::endl;
8258  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][3]->GetBinContent(i)<<"</td>"<< std::endl;
8259  if (HistNumBadChanDepth[test][2][4]->GetBinContent(i) > Cut0[test][2][4]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][2][4]->GetBinContent(i)<<"</td>"<< std::endl;
8260  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][4]->GetBinContent(i)<<"</td>"<< std::endl;
8261  if (HistNumBadChanDepth[test][2][5]->GetBinContent(i) > Cut0[test][2][5]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][2][5]->GetBinContent(i)<<"</td>"<< std::endl;
8262  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][5]->GetBinContent(i)<<"</td>"<< std::endl;
8263  if (HistNumBadChanDepth[test][2][6]->GetBinContent(i) > Cut0[test][2][6]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][2][6]->GetBinContent(i)<<"</td>"<< std::endl;
8264  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][6]->GetBinContent(i)<<"</td>"<< std::endl;
8265  if (HistNumBadChanDepth[test][2][7]->GetBinContent(i) > Cut0[test][2][7]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][2][7]->GetBinContent(i)<<"</td>"<< std::endl;
8266  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][7]->GetBinContent(i)<<"</td>"<< std::endl;
8267  if (HistNumBadChanDepth[test][3][4]->GetBinContent(i) > Cut0[test][3][4]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][3][4]->GetBinContent(i)<<"</td>"<< std::endl;
8268  else htmlFile <<raw_class<<HistNumBadChanDepth[test][3][4]->GetBinContent(i)<<"</td>"<< std::endl;
8269  if (HistNumBadChanDepth[test][4][1]->GetBinContent(i) > Cut0[test][4][1]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][4][1]->GetBinContent(i)<<"</td>"<< std::endl;
8270  else htmlFile <<raw_class<<HistNumBadChanDepth[test][4][1]->GetBinContent(i)<<"</td>"<< std::endl;
8271  if (HistNumBadChanDepth[test][4][2]->GetBinContent(i) > Cut0[test][4][2]) htmlFile << "<td class=\"s6\" align=\"center\">"<<HistNumBadChanDepth[test][4][2]->GetBinContent(i)<<"</td>"<< std::endl;
8272  else htmlFile <<raw_class<<HistNumBadChanDepth[test][4][2]->GetBinContent(i)<<"</td>"<< std::endl;
8273  */
8274  } //k depthes
8275  } //sub
8276  htmlFile << "</tr>" << std::endl;
8277  ind += 1;
8278  } // met=1
8279  } //i bin lines
8280  // cout<<"Creating tests html pages: 333333" << endl;
8281  htmlFile << "</table>" << std::endl;
8282  htmlFile << "<br>" << std::endl;
8283  htmlFile << "</body> " << std::endl;
8284  htmlFile << "</html> " << std::endl;
8285  htmlFile.close();
8286  } //test
8287  //======================================================================
8288  // cout<<"for summed Amplitudes of each sub-detector" << endl;
8289 
8290  // for summed Amplitudes of each sub-detector
8291  htmlFile.open("SummedAmplitudes_GL.html");
8292  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
8293  htmlFile << "<head>" << std::endl;
8294  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
8295  htmlFile << "<title> for summed Amplitudes of each sub-detector </title>" << std::endl;
8296  htmlFile << "<style type=\"text/css\">" << std::endl;
8297  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
8298  << std::endl;
8299  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
8300  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
8301  "text-align: center;}"
8302  << std::endl;
8303  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
8304  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
8305  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
8306  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
8307  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
8308 
8309  htmlFile << "</style>" << std::endl;
8310  htmlFile << "<body>" << std::endl;
8311  htmlFile << "<h1> Averaged Summed Amplitudes & corresponding occupancy of each sub-detector in Global Run = "
8312  << runnumber << " </h1>" << std::endl;
8313  htmlFile << "<a name=\"Top\"></a>\n";
8314  htmlFile << "<b>Contents:<br>\n";
8315  htmlFile << "1. <a href=\"#SAhigh\">average SA&Occupancy for Signal </a><br>\n";
8316  htmlFile << "2. <a href=\"#SAlow\">average SA&Occupancy for NoSignal </a><br>\n";
8317  htmlFile << "3. <a href=\"#SAmax\"> maxSA & maxOccupancy; SA & Occupancy; </a><br>\n";
8318  htmlFile << "4. <a href=\"#FullTable\">Table(avA; avSA; avOccupancy; maxSA; maxOccupancy;) </a><br>\n";
8319 
8320  htmlFile << "<h2> Clarifying on averaged Summed Amplitude (avSA) : </h2>" << std::endl;
8321  htmlFile << "<h3> Summed Amplitudes (SA) are averaged over all events of each LS: avSA_LS = SUM (SA_eventsInLS) / "
8322  "N_eventsInLS ,</h3>"
8323  << std::endl;
8324  htmlFile << "<h3> where SA = SUM(A_i) ,and means that Amplitude is summed over all sub-detector channels, </h3>"
8325  << std::endl;
8326  htmlFile << "<h3> where A_i = SUM(A_depth) denotes channel amplitude summed over depths; </h3>" << std::endl;
8327  // htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_"<<runnumber<<"/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
8328  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/SAwriteup.html\"> see "
8329  "more details for SummedAmplitudes</a></td>"
8330  << std::endl;
8331  htmlFile << "<h2> Apply cuts on A_i to take into account channels with or/and without a'la Signal: </h2>"
8332  << std::endl;
8333  htmlFile << " <img src=\"ChannelDepthsummedAmplitudes.png\" />" << std::endl;
8334  htmlFile << "<br>" << std::endl;
8335  htmlFile << "<br>" << std::endl;
8336  htmlFile << "<a name=\"SAhigh\"></a>\n";
8337  htmlFile << "<h1> 1. for channels with signal </h1>" << std::endl;
8338  htmlFile << "<br>" << std::endl;
8339  htmlFile << "<h2> for HB: A_i> 80; </h2>" << std::endl;
8340  htmlFile << " <img src=\"SummedAmplitudesSignal_HB.png\" />" << std::endl;
8341  htmlFile << "<br>" << std::endl;
8342  htmlFile << "<h2> for HE: A_i> 200;</h2>" << std::endl;
8343  htmlFile << " <img src=\"SummedAmplitudesSignal_HE.png\" />" << std::endl;
8344  htmlFile << "<br>" << std::endl;
8345  htmlFile << "<h2> for HO: A_i> 1200;</h2>" << std::endl;
8346  htmlFile << " <img src=\"SummedAmplitudesSignal_HO.png\" />" << std::endl;
8347  htmlFile << "<br>" << std::endl;
8348  htmlFile << "<h2> for HF: A_i> 600;</h2>" << std::endl;
8349  htmlFile << " <img src=\"SummedAmplitudesSignal_HF.png\" />" << std::endl;
8350  htmlFile << "<br>" << std::endl;
8351  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8352 
8353  htmlFile << "<a name=\"SAlow\"></a>\n";
8354  htmlFile << "<h1> 2. for channels w/o signal </h1>" << std::endl;
8355  htmlFile << "<br>" << std::endl;
8356  htmlFile << "<h2> for HB: A_i< 80;</h2>" << std::endl;
8357  htmlFile << " <img src=\"NoSignalSummedAmplitudes_HB.png\" />" << std::endl;
8358  htmlFile << "<br>" << std::endl;
8359  htmlFile << "<h2> for HE: A_i< 200;</h2>" << std::endl;
8360  htmlFile << " <img src=\"NoSignalSummedAmplitudes_HE.png\" />" << std::endl;
8361  htmlFile << "<br>" << std::endl;
8362  htmlFile << "<h2> for HO: A_i< 1200;</h2>" << std::endl;
8363  htmlFile << " <img src=\"NoSignalSummedAmplitudes_HO.png\" />" << std::endl;
8364  htmlFile << "<br>" << std::endl;
8365  htmlFile << "<h2> for HF: A_i< 600;</h2>" << std::endl;
8366  htmlFile << " <img src=\"NoSignalSummedAmplitudes_HF.png\" />" << std::endl;
8367  htmlFile << "<br>" << std::endl;
8368  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8369 
8370  htmlFile << "<br>" << std::endl;
8371  htmlFile << "<br>" << std::endl;
8372  htmlFile << "<a name=\"SAmax\"></a>\n";
8373  htmlFile << "<h1> 3. four plots: ---1---> max SA ---2---> max Occupancy ---3---> SA ---4---> Occupancy over all "
8374  "events of LS </h1>"
8375  << std::endl;
8376  htmlFile << "<br>" << std::endl;
8377 
8378  htmlFile << "<h2> for HB: maxSA vs LS, masOccupancy vs LS, SA, Occupancy </h2>" << std::endl;
8379  htmlFile << " <img src=\"MaxxSummedAmplitudes_HB.png\" />" << std::endl;
8380  htmlFile << "<h2>"
8381  " ......(forCut:SAmax>60000) N= "
8382  << countamplmaxHB << " ...... (forCut:OCCUPmax>2000) N= " << countoccumaxHB << " </h2>" << std::endl;
8383  htmlFile << "<h2>"
8384  " ......(forCut:SA>60000) N= "
8385  << countamplHB << " ...... (forCut:OCCUP>2000) N= " << countoccuHB << " </h2>" << std::endl;
8386  htmlFile << "<br>" << std::endl;
8387  htmlFile << "<h3> ONLY for HB (cross-check): channel Amplitudes for events in the Tail (averaged): </h3>"
8388  << std::endl;
8389  htmlFile << " <img src=\"AtaildepthHB.png\" />" << std::endl;
8390  htmlFile << "<br>" << std::endl;
8391 
8392  htmlFile << "<h2> for HE: maxSA vs LS, masOccupancy vs LS, SA, Occupancy </h2>" << std::endl;
8393  htmlFile << " <img src=\"MaxxSummedAmplitudes_HE.png\" />" << std::endl;
8394  htmlFile << "<h2>"
8395  " ......(forCut:SAmax>60000) N= "
8396  << countamplmaxHE << " ...... (forCut:OCCUPmax>1200) N= " << countoccumaxHE << " </h2>" << std::endl;
8397  htmlFile << "<h2>"
8398  " ......(forCut:SA>60000) N= "
8399  << countamplHE << " ...... (forCut:OCCUP>1200) N= " << countoccuHE << " </h2>" << std::endl;
8400  htmlFile << "<br>" << std::endl;
8401 
8402  htmlFile << "<h2> for HO: maxSA vs LS, masOccupancy vs LS, SA, Occupancy </h2>" << std::endl;
8403  htmlFile << " <img src=\"MaxxSummedAmplitudes_HO.png\" />" << std::endl;
8404  htmlFile << "<h2>"
8405  " ......(forCut:SAmax>150000) N= "
8406  << countamplmaxHO << " ...... (forCut:OCCUPmax>2000) N= " << countoccumaxHO << " </h2>" << std::endl;
8407  htmlFile << "<h2>"
8408  " ......(forCut:SA>150000) N= "
8409  << countamplHO << " ...... (forCut:OCCUP>2000) N= " << countoccuHO << " </h2>" << std::endl;
8410  htmlFile << "<br>" << std::endl;
8411 
8412  htmlFile << "<h2> for HF: maxSA vs LS, masOccupancy vs LS, SA, Occupancy </h2>" << std::endl;
8413  htmlFile << " <img src=\"MaxxSummedAmplitudes_HF.png\" />" << std::endl;
8414  htmlFile << "<h2>"
8415  " ......(forCut:SAmax>22000) N= "
8416  << countamplmaxHF << " ...... (forCut:OCCUPmax>860) N= " << countoccumaxHF << " </h2>" << std::endl;
8417  htmlFile << "<h2>"
8418  " ......(forCut:SA>22000) N= "
8419  << countamplHF << " ...... (forCut:OCCUP>860) N= " << countoccuHF << " </h2>" << std::endl;
8420  htmlFile << "<br>" << std::endl;
8421  htmlFile << "<h2> Occupancy HF (ONLY) vs LS </h2>" << std::endl;
8422  htmlFile << " <img src=\"sumOccupancyHF.png\" />" << std::endl;
8423  htmlFile << "<br>" << std::endl;
8424  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8425 
8426  htmlFile << "<a name=\"FullTable\"></a>\n";
8427  htmlFile << "<h2> 4.Lumisection Status: </h2>" << std::endl;
8428  htmlFile << "<h3> Legends: HBdepth1 red boxes correspond LSs selected with cut: <td class=\"s6\" align=\"center\">"
8429  << Cut0[1][1][1] << std::endl;
8430  htmlFile << "<h3> Legends: HEdepth1 red boxes correspond LSs selected with cut: <td class=\"s6\" align=\"center\">"
8431  << Cut0[1][2][1] << std::endl;
8432  htmlFile << "<h3> Legends: HOdepth4 red boxes correspond LSs selected with cut: <td class=\"s6\" align=\"center\">"
8433  << Cut0[1][3][4] << std::endl;
8434  htmlFile << "<h3> Legends: HFdepth1 red boxes correspond LSs selected with cut: <td class=\"s6\" align=\"center\">"
8435  << Cut0[1][4][1] << std::endl;
8436  htmlFile << "<br>" << std::endl;
8437  // SummedAmplitudeHisto[i] SummedAmplitudeOccupancyHisto[i] NoSignalSummedAmplitudeHisto[i] NoSignalSummedAmplitudeOccupancyHisto[i]; i=0-3;(HF:i=3)
8438  htmlFile << "<br>" << std::endl;
8439  htmlFile << "<table>" << std::endl;
8440  htmlFile << "<tr>";
8441  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
8442  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
8443  htmlFile << "<td class=\"s1\" align=\"center\"> Num.of ev.</td>" << std::endl;
8444 
8445  // for (int k=k_min[sub];k<=k_max[sub]; k++) htmlFile << "<td class=\"s1\" align=\"center\">< A > Depth "<< k <<" </td>" << std::endl;
8446  // for (int sub=1;sub<=4;sub++) htmlFile << "<td class=\"s1\" align=\"center\">< A > Depth1, sub "<< sub <<" </td>" << std::endl;
8447 
8448  htmlFile << "<td class=\"s1\" align=\"center\">< A >HB Depth1</td>" << std::endl;
8449  htmlFile << "<td class=\"s1\" align=\"center\">< A >HE Depth1</td>" << std::endl;
8450  htmlFile << "<td class=\"s1\" align=\"center\">< A >HO Depth4</td>" << std::endl;
8451  htmlFile << "<td class=\"s1\" align=\"center\">< A >HF Depth1</td>" << std::endl;
8452 
8453  htmlFile << "<td class=\"s1\" align=\"center\">< SA >HB (Signal) </td>" << std::endl;
8454  htmlFile << "<td class=\"s1\" align=\"center\">< Occup. > HB (Signal) </td>" << std::endl;
8455  htmlFile << "<td class=\"s1\" align=\"center\">< SA >HF (Signal) </td>" << std::endl;
8456  htmlFile << "<td class=\"s1\" align=\"center\">< Occup. > HF (Signal) </td>" << std::endl;
8457 
8458  htmlFile << "<td class=\"s1\" align=\"center\">< SA >HB (NoSignal) </td>" << std::endl;
8459  htmlFile << "<td class=\"s1\" align=\"center\">< Occup. > HB (NoSignal) </td>" << std::endl;
8460  htmlFile << "<td class=\"s1\" align=\"center\">< SA >HF (NoSignal) </td>" << std::endl;
8461  htmlFile << "<td class=\"s1\" align=\"center\">< Occup. > HF (NoSignal) </td>" << std::endl;
8462 
8463  htmlFile << "<td class=\"s1\" align=\"center\"> maxSA HB </td>" << std::endl;
8464  htmlFile << "<td class=\"s1\" align=\"center\"> maxOccup. HB </td>" << std::endl;
8465  htmlFile << "<td class=\"s1\" align=\"center\"> maxSA HF </td>" << std::endl;
8466  htmlFile << "<td class=\"s1\" align=\"center\"> maxOccup. HF </td>" << std::endl;
8467 
8468  htmlFile << "</tr>" << std::endl;
8469 
8470  ind = 0;
8471  for (int i = 1; i <= MaxLum; i++) {
8472  if ((ind % 2) == 1)
8473  raw_class = "<td class=\"s2\" align=\"center\">";
8474  else
8475  raw_class = "<td class=\"s3\" align=\"center\">";
8476  htmlFile << "<tr>" << std::endl;
8477 
8478  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
8479 
8480  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
8481  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
8482 
8483  // (test==1) <Amplitude>
8484  int test = 1;
8485  // for (int k=k_min[sub];k<=k_max[sub]; k++) {
8486  for (int sub = 1; sub <= 4; sub++) {
8487  for (int k = k_min[sub]; k <= k_min[sub]; k++) {
8488  if (HistNumBadChanDepth[test][sub][k]->GetBinContent(i) > Cut0[test][sub][k])
8489  htmlFile << "<td class=\"s6\" align=\"center\">" << HistNumBadChanDepth[test][sub][k]->GetBinContent(i)
8490  << "</td>" << std::endl;
8491 
8492  else
8493  htmlFile << raw_class << HistNumBadChanDepth[test][sub][k]->GetBinContent(i) << "</td>" << std::endl;
8494  }
8495  }
8496  if (SummedAmplitudeHisto[0]) {
8497  htmlFile << raw_class << SummedAmplitudeHisto[0]->GetBinContent(i) << "</td>" << std::endl;
8498  htmlFile << raw_class << SummedAmplitudeOccupancyHisto[0]->GetBinContent(i) << "</td>" << std::endl;
8499  htmlFile << raw_class << SummedAmplitudeHisto[3]->GetBinContent(i) << "</td>" << std::endl;
8500  htmlFile << raw_class << SummedAmplitudeOccupancyHisto[3]->GetBinContent(i) << "</td>" << std::endl;
8501 
8502  htmlFile << raw_class << NoSignalSummedAmplitudeHisto[0]->GetBinContent(i) << "</td>" << std::endl;
8503  htmlFile << raw_class << NoSignalSummedAmplitudeOccupancyHisto[0]->GetBinContent(i) << "</td>" << std::endl;
8504  htmlFile << raw_class << NoSignalSummedAmplitudeHisto[3]->GetBinContent(i) << "</td>" << std::endl;
8505  htmlFile << raw_class << NoSignalSummedAmplitudeOccupancyHisto[3]->GetBinContent(i) << "</td>" << std::endl;
8506 
8507  htmlFile << raw_class << MaxxSummedAmplitudeHisto[0]->GetBinContent(i) << "</td>" << std::endl;
8508  htmlFile << raw_class << MaxxSummedAmplitudeOccupancyHisto[0]->GetBinContent(i) << "</td>" << std::endl;
8509  htmlFile << raw_class << MaxxSummedAmplitudeHisto[3]->GetBinContent(i) << "</td>" << std::endl;
8510  htmlFile << raw_class << MaxxSummedAmplitudeOccupancyHisto[3]->GetBinContent(i) << "</td>" << std::endl;
8511  }
8512  htmlFile << "</tr>" << std::endl;
8513  ind += 1;
8514  }
8515  htmlFile << "</table>" << std::endl;
8516  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8517 
8518  htmlFile << "<br>" << std::endl;
8519  htmlFile << "</body> " << std::endl;
8520  htmlFile << "</html> " << std::endl;
8521  htmlFile.close();
8522 
8523  //====================================================================== // Creating description of html-files
8524 
8525  /*
8526  //======================================================================
8527  // Creating description HELP.html file:
8528  htmlFile.open("HELP.html");
8529  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< std::endl;
8530  htmlFile << "<head>"<< std::endl;
8531  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< std::endl;
8532  htmlFile << "<title> Certification Monitoring Tool </title>"<< std::endl;
8533  htmlFile << "<style type=\"text/css\">"<< std::endl;
8534  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< std::endl;
8535  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }"<< std::endl;
8536  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
8537  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< std::endl;
8538  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< std::endl;
8539  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< std::endl;
8540  htmlFile << "</style>"<< std::endl;
8541  htmlFile << "<body>"<< std::endl;
8542  htmlFile << "<h1> Description of Remote Monitoring Tool criteria for bad channel selection</h1>"<< std::endl;
8543  htmlFile << "<br>"<< std::endl;
8544  htmlFile << "<h3> - CAPID Errors assuming we inspect CAPID non-rotation,error & validation bits, and for this criterion - no need to apply any cuts to select bcs.</h3> "<< std::endl;
8545  htmlFile << "<br>"<< std::endl;
8546  htmlFile << "<h3> - Amplitude is full amplitude collected over all time slices </h3> "<< std::endl;
8547  htmlFile << "<h3> - Ratio criterion is where we define as a bad, the channels, for which the signal portion in 4 middle TSs(plus one, minus two around TS with maximal amplitude) is out of some range of reasonable values </h3> "<< std::endl;
8548  htmlFile << "<br>"<< std::endl;
8549  htmlFile << "<h3> - Width of shape distribution. Width is defined as square root from dispersion. </h3> "<< std::endl;
8550  htmlFile << "<br>"<< std::endl;
8551  htmlFile << "<h3> - Mean TS time slice position of adc signal. </h3> "<< std::endl;
8552  htmlFile << "<br>"<< std::endl;
8553  htmlFile << "<h3> - TS number of maximum signal </h3> "<< std::endl;
8554  htmlFile << "<br>"<< std::endl;
8555  htmlFile << "<h3> For more details see https://twiki.cern.ch/twiki/bin/viewauth/CMS/HcalRemoteCertificationMonitoring </h3> "<< std::endl;
8556  htmlFile << "</body> " << std::endl;
8557  htmlFile << "</html> " << std::endl;
8558  htmlFile.close();
8559 */
8560  //======================================================================
8561  // Creating description CMTresults.html file:
8562  htmlFile.open("CMTresults.html");
8563  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
8564  htmlFile << "<head>" << std::endl;
8565  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
8566  htmlFile << "<title> Certification Monitoring Tool </title>" << std::endl;
8567  htmlFile << "<style type=\"text/css\">" << std::endl;
8568  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
8569  << std::endl;
8570  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
8571  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
8572  "text-align: center;}"
8573  << std::endl;
8574  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
8575  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
8576  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
8577  htmlFile << "</style>" << std::endl;
8578  htmlFile << "<body>" << std::endl;
8579  htmlFile << "<h1> LS-certification (recommendation) from analysis of CMT-dependencies of THIS run </h1>"
8580  << std::endl;
8581  htmlFile << "<br>" << std::endl;
8582  htmlFile << "<br>" << std::endl;
8583  htmlFile << "<h2> - List of suspicious LSs: </h2> " << std::endl;
8584  htmlFile << "<br>" << std::endl;
8585  htmlFile << "<h3> to be added </h3> " << std::endl;
8586  htmlFile << "<br>" << std::endl;
8587  htmlFile << "<br>" << std::endl;
8588  htmlFile << "<br>" << std::endl;
8589  htmlFile << "<h2> - Comments: </h2> " << std::endl;
8590  htmlFile << "<br>" << std::endl;
8591  htmlFile << "<h3> to be added </h3> " << std::endl;
8592  htmlFile << "<br>" << std::endl;
8593  htmlFile << "<br>" << std::endl;
8594  htmlFile << "<br>" << std::endl;
8595  htmlFile << "</body> " << std::endl;
8596  htmlFile << "</html> " << std::endl;
8597  htmlFile.close();
8598 
8599  //======================================================================
8600  // Creating main html file:
8601 
8602  htmlFile.open("LumiList.html");
8603  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
8604  htmlFile << "<head>" << std::endl;
8605  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
8606  htmlFile << "<title> Certification Monitoring Tool </title>" << std::endl;
8607  htmlFile << "<style type=\"text/css\">" << std::endl;
8608  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
8609  << std::endl;
8610  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
8611  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
8612  "text-align: center;}"
8613  << std::endl;
8614  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
8615  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
8616  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
8617  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
8618  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
8619 
8620  htmlFile << "</style>" << std::endl;
8621  htmlFile << "<body>" << std::endl;
8622 
8623  htmlFile << "<h1> Certification Monitoring Tool, GLOBAL RUN = " << runnumber << ". </h1>" << std::endl;
8624  htmlFile << "<br>" << std::endl;
8625  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8626  << "/CMTresults.html\"> CMT-analysis RESULTS (for this run) </a></td>" << std::endl;
8627  htmlFile << "<br>" << std::endl;
8628  htmlFile << "<br>" << std::endl;
8629 
8630  // htmlFile << "<h2> 1. General information </h2>"<< std::endl;
8631  htmlFile << "<h2> 1. General information (Full number of LS = " << MaxLum000000 << " ). </h2>" << std::endl;
8632  htmlFile << " <img src=\"LumiEvent.png\" />" << std::endl;
8633  htmlFile << "<br>" << std::endl;
8634 
8635  htmlFile << "<h2> 2. HCAL status for different criteria </h2>" << std::endl;
8636  // htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_"<<runnumber<<"/HELP.html\"> Description of criteria for bad channel selection</a></td>"<< std::endl;
8637  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/HELP.html\"> "
8638  "Description of criteria for bad channel selection</a></td>"
8639  << std::endl;
8640  htmlFile << "<br>" << std::endl;
8641  htmlFile << "<table width=\"600\">" << std::endl;
8642  htmlFile << "<tr>" << std::endl;
8643  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8644  << "/CapID_GL.html\">Cap ID errors</a></td>" << std::endl;
8645  // AZ 11.03.2019
8646  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8647  << "/ADCampl_GL.html\">Amplitude</a></td>" << std::endl;
8648  // htmlFile << " <td><a href=\"ADCampl_GL.html\">Amplitude</a></td>"<< std::endl;
8649  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8650  << "/Width_GL.html\">Width</a></td>" << std::endl;
8651  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8652  << "/Ratio_GL.html\">Ratio</a></td>" << std::endl;
8653  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8654  << "/Tmean_GL.html\">TS mean</a></td>" << std::endl;
8655  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8656  << "/Tmax_GL.html\">TS max</a></td>" << std::endl;
8657 
8658  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8659  << "/SummedAmplitudes_GL.html\">SummedAmplitudes</a></td>" << std::endl;
8660 
8661  htmlFile << "</tr>" << std::endl;
8662  htmlFile << "</table>" << std::endl;
8663  htmlFile << "<br>" << std::endl;
8664  htmlFile << "</body> " << std::endl;
8665  htmlFile << "</html> " << std::endl;
8666  htmlFile.close();
8667  //======================================================================
8668 
8669  //======================================================================
8670  // Close and delete all possible things:
8671  hfile->Close();
8672  // hfile->Delete();
8673  // Exit Root
8674  gSystem->Exit(0);
8675  //======================================================================
8676 }
8677 
8678 // ------------------------------------------------------------
8679 
8680 int copyContents(TH1F **hDest, TString hname, TString htitle, const TH1F *hSrc, int lastBin) {
8681  if (lastBin > hSrc->GetNbinsX()) {
8682  std::cout << "copyContents from " << hSrc->GetName() << ": histo has " << hSrc->GetNbinsX()
8683  << " bins, when lastBin=" << lastBin << " was requested\n";
8684  return 0;
8685  }
8686 
8687  (*hDest) = new TH1F(hname, htitle, lastBin, 0, lastBin);
8688  (*hDest)->SetDirectory(0);
8689  (*hDest)->SetStats(0);
8690 
8691  for (int ibin = 1; ibin <= lastBin; ibin++) {
8692  (*hDest)->SetBinContent(ibin, hSrc->GetBinContent(ibin));
8693  (*hDest)->SetBinError(ibin, hSrc->GetBinError(ibin));
8694  }
8695  return 1;
8696 }
8697 
8698 // ------------------------------------------------------------
int main(int argc, char *argv[])
#define NULL
Definition: scimark2.h:8
double isum
Definition: EPCuts.h:4
T sqrt(T t)
Definition: SSEVec.h:19
int copyContents(TH1F **hDest, TString hname, TString htitle, const TH1F *hSrc, int lastBin)
string fname
main script
float x