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 // TH1F* h_nbadchannels_depth4_HO; +
6 // TH1F* h_runnbadchannels_depth4_HO; +
7 // TH1F* h_runnbadchannelsC_depth4_HO;
8 // TH1F* h_runbadrate_depth4_HO;
9 // TH1F* h_runbadrateC_depth4_HO;
10 // TH1F* h_runbadrate0_depth4_HO;
11 //
12 #include "LogEleMapdb.h"
13 
14 #include <iostream>
15 #include <fstream>
16 
17 #include "TH1.h"
18 #include "TH2.h"
19 #include "TCanvas.h"
20 #include "TROOT.h"
21 #include <TMath.h>
22 #include "TStyle.h"
23 #include "TSystem.h"
24 #include "TLegend.h"
25 #include "TText.h"
26 #include "TAxis.h"
27 #include "TFile.h"
28 #include "TLine.h"
29 #include "TGraph.h"
30 #include <THStack.h>
31 #include <TPaveText.h>
32 
33 // https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT
34 // https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/HcalRemoteMonitoring/CMT
35 
36 using namespace std;
37 //inline void HERE(const char *msg) { std::cout << msg << std::endl; } kfitq
38 int copyContents(TH1F **hDest, TString hname, TString htitle, const TH1F *hSrc, int lastBin);
39 
40 // -----------------------------------------------------
41 
42 int main(int argc, char *argv[]) {
43  std::string dirnm = "Analyzer";
44  gROOT->Reset();
45  gROOT->SetStyle("Plain");
46  gStyle->SetOptStat(0);
47  gStyle->SetOptTitle(1);
48 
49  if (argc < 1)
50  return 1;
51  char fname[300];
52  sprintf(fname, "%s", argv[1]);
53  std::cout << fname << std::endl;
54 
55  //======================================================================
56  // Connect the input files, parameters and get the 2-d histogram in memory
57  // TFile *hfile= new TFile("GlobalHist.root", "READ");
58  string promt = (string)fname;
59  string runnumber = "";
60  for (unsigned int i = promt.size() - 11; i < promt.size() - 5; i++)
61  runnumber += fname[i];
62 
63  TFile *hfile = new TFile(fname, "READ");
64  hfile->ls();
65  TDirectory *dir = (TDirectory *)hfile->FindObjectAny(dirnm.c_str());
66  // Cut [test][sub][depth]
67  // Empty HB HE HO HF
68  double Cut0[7][5][8] = {
69  {{0., 0., 0., 0., 0., 0., 0., 0.},
70  {0., 0., 0., 0., 0., 0., 0., 0.},
71  {0., 0., 0., 0., 0., 0., 0., 0.},
72  {0., 0., 0., 0., 0., 0., 0., 0.},
73  {0., 0., 0., 0., 0., 0., 0., 0.}}, //CapID 0,HB,HE,HO,HF
74  // {{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
75  //
76  // {{0., 0., 0., 0., 0., 0., 0., 0.},
77  // {0., 10., 10., 10., 10., 0., 0., 0.},
78  // {0., 10., 10., 10., 10., 10., 10., 10.},
79  // {0., 0., 0., 0., 10., 0., 0., 0.},
80  // {0., 10., 10., 10., 10., 0., 0., 0.}}, //Amplitude 0,HB,HE,HO,HF
81  {{0., 0., 0., 0., 0., 0., 0., 0.},
82  {0., 3500., 3500., 3500., 3500., 0., 0., 0.},
83  {0., 12000., 4500., 3500., 3500., 4000., 4500., 5500.},
84  {0., 0., 0., 0., 200., 0., 0., 0.},
85  {0., 4500., 4500., 4500., 4500., 0., 0., 0.}}, //Amplitude 0,HB,HE,HO,HF
86  {{0., 0., 0., 0., 0., 0., 0., 0.},
87  {0., 3., 3., 0., 0., 0., 0., 0.},
88  {0., 3., 3., 3., 0., 0., 0., 0.},
89  {0., 0., 0., 0., 3., 0., 0., 0.},
90  {0., 2., 2., 0., 0., 0., 0., 0.}}, //Width 0,HB,HE,HO,HF
91  {{0., 0., 0., 0., 0., 0., 0., 0.},
92  {0., 0.4, 0.4, 0., 0., 0., 0., 0.},
93  {0., 0.4, 0.4, 0.4, 0., 0., 0., 0.},
94  {0., 0., 0., 0., 0.4, 0., 0., 0.},
95  {0., 0.8, 0.8, 0., 0., 0., 0., 0.}}, //Ratio 0,HB,HE,HO,HF
96  {{0., 0., 0., 0., 0., 0., 0., 0.},
97  {0., 4.7, 4.7, 0., 0., 0., 0., 0.},
98  {0., 4.8, 4.8, 5.0, 0., 0., 0., 0.},
99  {0., 0., 0., 0., 4.8, 0., 0., 0.},
100  {0., 4.0, 4.0, 0., 0., 0., 0., 0.}}, //TSn 0,HB,HE,HO,HF
101  {{0., 0., 0., 0., 0., 0., 0., 0.},
102  {0., 3.5, 3.5, 0., 0., 0., 0., 0.},
103  {0., 4.0, 4.0, 4.0, 0., 0., 0., 0.},
104  {0., 0., 0., 0., 3., 0., 0., 0.},
105  {0., 3.5, 3.5, 0., 0., 0., 0., 0.}}, //TSx 0,HB,HE,HO,HF
106  {{0., 0., 0., 0., 0., 0., 0., 0.},
107  {0., 0., 0., 0., 0., 0., 0., 0.},
108  {0., 0., 0., 0., 0., 0., 0., 0.},
109  {0., 0., 0., 0., 0., 0., 0., 0.},
110  {0., 0., 0., 0., 0., 0., 0., 0.}}}; //Empty
111 
112  double CutAb[5][8] = {{0., 0., 0., 0., 0., 0., 0., 0.},
113  {0., 0., 0., 0., 0., 0., 0., 0.},
114  {0., 0., 0., 0., 0., 0., 0., 0.},
115  {0., 0., 0., 0., 0., 0., 0., 0.},
116  {0., 0., 0., 0., 0., 0., 0., 0.}}; // cut 1 for CapIdErrors 0,HB,HE,HO,HF
117 
118  double CutPo[5][8] = {{0., 0., 0., 0., 0., 0., 0., 0.},
119  {0., 0., 0., 0., 0., 0., 0., 0.},
120  {0., 0., 0., 0., 0., 0., 0., 0.},
121  {0., 0., 0., 0., 0., 0., 0., 0.},
122  {0., 0., 0., 0., 0., 0., 0., 0.}}; //cut 3 for CapIdErrors (portions) 0,HB,HE,HO,HF
123 
124  //======================================================================
125 
126  // CUTs FOR IPHI RBX:
127  int cutA_HB = 100;
128  int cutA_HE = 6000;
129  int cutA_HO = 150;
130  int cutA_HF = 500;
131  // CUTs FOR IETA RBX:
132  int cutB_HB = 100;
133  int cutB_HE = 10000;
134  int cutB_HO = 150;
135  int cutB_HF = 500;
136 
137  //======================================================================
138  // Prepare histograms and plot them to .png files
139  // TCanvas *cHB = new TCanvas("cHB", "cHB", 200, 10, 700, 900);
140  TCanvas *cHB = new TCanvas("cHB", "cHB", 1000, 500);
141  TCanvas *cHE = new TCanvas("cHE", "cHE", 1500, 500);
142  TCanvas *cONE = new TCanvas("cONE", "cONE", 500, 500);
143  TCanvas *cFour = new TCanvas("cFour", "cFour", 1500, 1000);
144  TCanvas *cFour1 = new TCanvas("cFour1", "cFour1", 1200, 800);
145  TCanvas *cNine = new TCanvas("cNine", "cNine", 1500, 1500);
146 
147  TCanvas *cSix = new TCanvas("cSix", "cSix", 200, 10, 700, 900);
148 
149  // RBX:
150  // TCanvas *c4x6 = new TCanvas("c4x6","c4x6",1500,3000);
151  TCanvas *c4x6 = new TCanvas("c4x6", "c4x6", 1200, 2400);
152  //TCanvas *c5x6 = new TCanvas("c5x6","c5x6",2000,3000);
153  TCanvas *c5x6 = new TCanvas("c5x6", "c5x6", 1500, 2400);
154  // TCanvas *cRBX1 = new TCanvas("cRBX1","cRBX1",200,10,1300,1110);
155  TCanvas *cRBX1 = new TCanvas("cRBX1", "cRBX1", 1200, 1000);
156  //
157  // TCanvas *cRBX31 = new TCanvas("cRBX31","cRBX31",1800,600);
158  TCanvas *cRBX31 = new TCanvas("cRBX31", "cRBX31", 1860, 600);
159  // TCanvas *cRBX31 = new TCanvas("cRBX31","cRBX31",200,10,,1800,600);
160 
161  // char *str = (char*)alloca(10000);
162 
163  int k_min[5] = {0, 1, 1, 4, 1}; // minimum depth for each subdet HB HE HO HF
164 
165  int k_max[5] = {0, 2, 3, 4, 2}; // maximum depth for each subdet HB HE HO HF
166  // int k_maxupgrade[5]={0,2,3,4,4}; // maximum depth for each subdet HB HE HO HF
167  int k_maxupgrade[5] = {0, 4, 7, 4, 4}; // maximum depth for each subdet HB HE HO HF
168 
169  //+++++++++++++++++++++++++++++
170  // Lumi iLumi and number of events
171  //+++++++++++++++++++++++++++++
172  // with TfileService implementation, change everywhere below: hfile->Get to dir->FindObjectAny
173  cHB->Divide(2, 1);
174  cHB->cd(1);
175  TH1F *LumLum = (TH1F *)dir->FindObjectAny("h_lsnumber_per_eachLS");
176  int MaxLumDanila = LumLum->GetBinContent(LumLum->GetMaximumBin()); // old variant of Danila
177  cout << " MaxLumDanila= " << MaxLumDanila << endl;
178  gStyle->SetOptStat(110000);
179  gPad->SetGridy();
180  gPad->SetGridx();
181  LumLum->SetMarkerStyle(21);
182  LumLum->SetMarkerSize(0.8);
183  LumLum->GetYaxis()->SetLabelSize(0.04);
184  LumLum->SetTitle("Cont. number per LS \b");
185  LumLum->SetXTitle("Cont.number \b");
186  LumLum->SetYTitle("Ls \b");
187  LumLum->SetMarkerColor(4);
188  LumLum->SetLineColor(0);
189  LumLum->SetMinimum(0.8);
190  LumLum->GetXaxis()->SetRangeUser(0, MaxLumDanila + 5.);
191  LumLum->Draw("Error");
192 
193  cHB->cd(2);
194  TH1F *LumiEv = (TH1F *)dir->FindObjectAny("h_nevents_per_eachRealLS");
195  int MaxLum0 = LumiEv->GetBinContent(LumiEv->GetMaximumBin());
196  int MaxLum = 0;
197  for (int i = 1; i <= LumiEv->GetXaxis()->GetNbins(); i++) {
198  if (LumiEv->GetBinContent(i)) {
199  MaxLum = i;
200  }
201  }
202  cout << " Nev in bin of MaxLum = " << MaxLum0 << " MaxLum= " << MaxLum << endl;
203 
204  gStyle->SetOptStat(110000);
205  gPad->SetGridy();
206  gPad->SetGridx();
207  gPad->SetLogy();
208  // gPad->SetLogx();
209  LumiEv->GetYaxis()->SetLabelSize(0.04);
210  LumiEv->SetTitle("Number of events per LS");
211  LumiEv->SetXTitle("LS");
212  LumiEv->SetYTitle("Number of events ");
213  LumiEv->SetMarkerStyle(21);
214  LumiEv->SetMarkerSize(0.8);
215  LumiEv->SetMarkerColor(4);
216  LumiEv->SetLineColor(0);
217  // LumiEv->SetMinimum(0.8);
218  LumiEv->GetXaxis()->SetRangeUser(0, MaxLum + 5.);
219  LumiEv->Draw("Error");
220 
221  cHB->Print("LumiEvent.png");
222  cHB->Clear();
223 
224  //=======================================================================================================
225  // Shape criteria: 1d histogram first definition
226  //=======================================================================================================
227  TH1F *H_NumBadChanDepth[7][5][5]; // 1d histogramm for test,subdet, depth
228 
229  //+++++++++++++++++++++++++++++
230  // ADC Amplitude
231  //+++++++++++++++++++++++++++++
232 
233  H_NumBadChanDepth[1][1][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS1");
234  H_NumBadChanDepth[1][1][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS2");
235 
236  H_NumBadChanDepth[1][2][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS3");
237  H_NumBadChanDepth[1][2][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS4");
238  H_NumBadChanDepth[1][2][3] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS5");
239 
240  H_NumBadChanDepth[1][3][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS8");
241 
242  H_NumBadChanDepth[1][4][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS6");
243  H_NumBadChanDepth[1][4][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplLS7");
244 
245  //+++++++++++++++++++++++++++++
246  // Width
247  //+++++++++++++++++++++++++++++
248 
249  H_NumBadChanDepth[2][1][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS1");
250  H_NumBadChanDepth[2][1][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS2");
251 
252  H_NumBadChanDepth[2][2][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS3");
253  H_NumBadChanDepth[2][2][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS4");
254  H_NumBadChanDepth[2][2][3] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS5");
255 
256  H_NumBadChanDepth[2][3][4] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS8");
257 
258  H_NumBadChanDepth[2][4][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS6");
259  H_NumBadChanDepth[2][4][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeLS7");
260 
261  //+++++++++++++++++++++++++++++
262  // Ratio
263  //+++++++++++++++++++++++++++++
264 
265  H_NumBadChanDepth[3][1][1] = (TH1F *)dir->FindObjectAny("h_sumAmplLS1");
266  H_NumBadChanDepth[3][1][2] = (TH1F *)dir->FindObjectAny("h_sumAmplLS2");
267 
268  H_NumBadChanDepth[3][2][1] = (TH1F *)dir->FindObjectAny("h_sumAmplLS3");
269  H_NumBadChanDepth[3][2][2] = (TH1F *)dir->FindObjectAny("h_sumAmplLS4");
270  H_NumBadChanDepth[3][2][3] = (TH1F *)dir->FindObjectAny("h_sumAmplLS5");
271 
272  H_NumBadChanDepth[3][3][4] = (TH1F *)dir->FindObjectAny("h_sumAmplLS8");
273 
274  H_NumBadChanDepth[3][4][1] = (TH1F *)dir->FindObjectAny("h_sumAmplLS6");
275  H_NumBadChanDepth[3][4][2] = (TH1F *)dir->FindObjectAny("h_sumAmplLS7");
276 
277  //+++++++++++++++++++++++++++++
278  // Tmean
279  //+++++++++++++++++++++++++++++
280 
281  H_NumBadChanDepth[4][1][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS1");
282  H_NumBadChanDepth[4][1][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS2");
283 
284  H_NumBadChanDepth[4][2][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS3");
285  H_NumBadChanDepth[4][2][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS4");
286  H_NumBadChanDepth[4][2][3] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS5");
287 
288  H_NumBadChanDepth[4][3][4] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS8");
289 
290  H_NumBadChanDepth[4][4][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS6");
291  H_NumBadChanDepth[4][4][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanALS7");
292 
293  //+++++++++++++++++++++++++++++
294  // Tmax
295  //+++++++++++++++++++++++++++++
296 
297  H_NumBadChanDepth[5][1][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS1");
298  H_NumBadChanDepth[5][1][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS2");
299 
300  H_NumBadChanDepth[5][2][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS3");
301  H_NumBadChanDepth[5][2][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS4");
302  H_NumBadChanDepth[5][2][3] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS5");
303 
304  H_NumBadChanDepth[5][3][4] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS8");
305 
306  H_NumBadChanDepth[5][4][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS6");
307  H_NumBadChanDepth[5][4][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxALS7");
308 
309  gStyle->SetOptStat(110000);
310 
311  for (int test = 1; test <= 5; test++) { //Test: 0,
312  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
313  if (sub == 1)
314  cHB->Divide(2, 1);
315  if (sub == 2)
316  cHE->Divide(3, 1);
317  if (sub == 3)
318  cONE->Divide(1, 1);
319  if (sub == 4)
320  cHB->Divide(2, 1);
321  for (int k = k_min[sub]; k <= k_max[sub]; k++) { //Depth
322  if (sub == 1)
323  cHB->cd(k);
324  if (sub == 2)
325  cHE->cd(k);
326  if (sub == 3)
327  cONE->cd(k - 3);
328  if (sub == 4)
329  cHB->cd(k);
330  gPad->SetGridy();
331  gPad->SetGridx();
332  gPad->SetLogy();
333  H_NumBadChanDepth[test][sub][k]->SetMarkerStyle(20);
334  H_NumBadChanDepth[test][sub][k]->SetMarkerSize(0.8);
335  if (k == 1)
336  H_NumBadChanDepth[test][sub][k]->SetTitle("Depth 1\b");
337  if (k == 2)
338  H_NumBadChanDepth[test][sub][k]->SetTitle("Depth 2\b");
339  if (k == 3)
340  H_NumBadChanDepth[test][sub][k]->SetTitle("Depth 3\b");
341  if (k == 4)
342  H_NumBadChanDepth[test][sub][k]->SetTitle("Depth 4\b");
343  if (test == 1)
344  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <Amplitude> \b");
345  if (test == 2)
346  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <Width> \b");
347  if (test == 3)
348  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <Ratio> \b");
349  if (test == 4)
350  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <TS mean> \b");
351  if (test == 5)
352  H_NumBadChanDepth[test][sub][k]->SetXTitle(" <TS max> \b");
353  H_NumBadChanDepth[test][sub][k]->SetYTitle("Number of channel-LSs\b");
354  H_NumBadChanDepth[test][sub][k]->SetMarkerColor(4);
355  H_NumBadChanDepth[test][sub][k]->SetLineColor(0);
356  // H_NumBadChanDepth[test][sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
357  H_NumBadChanDepth[test][sub][k]->SetMinimum(0.8);
358  H_NumBadChanDepth[test][sub][k]->Draw("Error");
359  }
360  if (test == 0) {
361  if (sub == 1) {
362  cHB->Print("H_NBCMNHB.png");
363  cHB->Clear();
364  }
365  if (sub == 2) {
366  cHE->Print("H_NBCMNHE.png");
367  cHE->Clear();
368  }
369  if (sub == 3) {
370  cONE->Print("H_NBCMNHO.png");
371  cONE->Clear();
372  }
373  if (sub == 4) {
374  cHB->Print("H_NBCMNHF.png");
375  cHB->Clear();
376  }
377  }
378 
379  if (test == 1) {
380  if (sub == 1) {
381  cHB->Print("H_ADCamplHB.png");
382  cHB->Clear();
383  }
384  if (sub == 2) {
385  cHE->Print("H_ADCamplHE.png");
386  cHE->Clear();
387  }
388  if (sub == 3) {
389  cONE->Print("H_ADCamplHO.png");
390  cONE->Clear();
391  }
392  if (sub == 4) {
393  cHB->Print("H_ADCamplHF.png");
394  cHB->Clear();
395  }
396  }
397  if (test == 2) {
398  if (sub == 1) {
399  cHB->Print("H_WidthHB.png");
400  cHB->Clear();
401  }
402  if (sub == 2) {
403  cHE->Print("H_WidthHE.png");
404  cHE->Clear();
405  }
406  if (sub == 3) {
407  cONE->Print("H_WidthHO.png");
408  cONE->Clear();
409  }
410  if (sub == 4) {
411  cHB->Print("H_WidthHF.png");
412  cHB->Clear();
413  }
414  }
415  if (test == 3) {
416  if (sub == 1) {
417  cHB->Print("H_RatioHB.png");
418  cHB->Clear();
419  }
420  if (sub == 2) {
421  cHE->Print("H_RatioHE.png");
422  cHE->Clear();
423  }
424  if (sub == 3) {
425  cONE->Print("H_RatioHO.png");
426  cONE->Clear();
427  }
428  if (sub == 4) {
429  cHB->Print("H_RatioHF.png");
430  cHB->Clear();
431  }
432  }
433  if (test == 4) {
434  if (sub == 1) {
435  cHB->Print("H_TmeanHB.png");
436  cHB->Clear();
437  }
438  if (sub == 2) {
439  cHE->Print("H_TmeanHE.png");
440  cHE->Clear();
441  }
442  if (sub == 3) {
443  cONE->Print("H_TmeanHO.png");
444  cONE->Clear();
445  }
446  if (sub == 4) {
447  cHB->Print("H_TmeanHF.png");
448  cHB->Clear();
449  }
450  }
451  if (test == 5) {
452  if (sub == 1) {
453  cHB->Print("H_TmaxHB.png");
454  cHB->Clear();
455  }
456  if (sub == 2) {
457  cHE->Print("H_TmaxHE.png");
458  cHE->Clear();
459  }
460  if (sub == 3) {
461  cONE->Print("H_TmaxHO.png");
462  cONE->Clear();
463  }
464  if (sub == 4) {
465  cHB->Print("H_TmaxHF.png");
466  cHB->Clear();
467  }
468  }
469  } // end sub
470  } //end test
471 
472  gStyle->SetOptStat(0);
473  //================================================================================================================================
474 
475  //=======================================================================================================
476  // 2-d histograms second definition
477  //=========================================================
478  TH2F *MapNumBadChanDepth[7][5][5]; // 1d Mapogramm for test,subdet, depth
479  TH2F *MapNumChanDepth[7][5][5]; // 1d Mapogramm for test,subdet, depth
480  TH2F *MapNumBadChanFull[7]; // 1d Mapogramm for test
481  TH2F *MapNumChanFull[7]; // 1d Mapogramm for test
482 
483  //+++++++++++++++++++++++++++++
484  // CapID
485  //+++++++++++++++++++++++++++++
486 
487  MapNumBadChanDepth[0][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HB");
488  MapNumBadChanDepth[0][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HB");
489 
490  MapNumBadChanDepth[0][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HE");
491  MapNumBadChanDepth[0][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HE");
492  MapNumBadChanDepth[0][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3Error_HE");
493 
494  MapNumBadChanDepth[0][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4Error_HO");
495 
496  MapNumBadChanDepth[0][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1Error_HF");
497  MapNumBadChanDepth[0][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2Error_HF");
498 
499  MapNumBadChanFull[0] = (TH2F *)MapNumBadChanDepth[0][1][1]->Clone();
500 
501  MapNumChanDepth[0][1][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HB");
502  MapNumChanDepth[0][1][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HB");
503 
504  MapNumChanDepth[0][2][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HE");
505  MapNumChanDepth[0][2][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HE");
506  MapNumChanDepth[0][2][3] = (TH2F *)dir->FindObjectAny("h_mapDepth3_HE");
507 
508  MapNumChanDepth[0][3][4] = (TH2F *)dir->FindObjectAny("h_mapDepth4_HO");
509 
510  MapNumChanDepth[0][4][1] = (TH2F *)dir->FindObjectAny("h_mapDepth1_HF");
511  MapNumChanDepth[0][4][2] = (TH2F *)dir->FindObjectAny("h_mapDepth2_HF");
512 
513  MapNumChanFull[0] = (TH2F *)MapNumChanDepth[0][1][1]->Clone();
514 
515  //+++++++++++++++++++++++++++++
516  // ADC Amplitude
517  //+++++++++++++++++++++++++++++
518 
519  MapNumBadChanDepth[1][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS1");
520  MapNumBadChanDepth[1][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS2");
521 
522  MapNumBadChanDepth[1][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS3");
523  MapNumBadChanDepth[1][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS4");
524  MapNumBadChanDepth[1][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS5");
525 
526  MapNumBadChanDepth[1][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS8");
527 
528  MapNumBadChanDepth[1][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS6");
529  MapNumBadChanDepth[1][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplLS7");
530 
531  MapNumBadChanFull[1] = (TH2F *)MapNumBadChanDepth[1][1][1]->Clone();
532 
533  MapNumChanDepth[1][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS1");
534  MapNumChanDepth[1][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS2");
535 
536  MapNumChanDepth[1][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS3");
537  MapNumChanDepth[1][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS4");
538  MapNumChanDepth[1][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS5");
539 
540  MapNumChanDepth[1][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS8");
541 
542  MapNumChanDepth[1][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS6");
543  MapNumChanDepth[1][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumADCAmplLS7");
544 
545  MapNumChanFull[1] = (TH2F *)MapNumChanDepth[1][1][1]->Clone();
546 
547  //+++++++++++++++++++++++++++++
548  // Width
549  //+++++++++++++++++++++++++++++
550 
551  MapNumBadChanDepth[2][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS1");
552  MapNumBadChanDepth[2][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS2");
553 
554  MapNumBadChanDepth[2][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS3");
555  MapNumBadChanDepth[2][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS4");
556  MapNumBadChanDepth[2][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS5");
557 
558  MapNumBadChanDepth[2][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS8");
559 
560  MapNumBadChanDepth[2][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS6");
561  MapNumBadChanDepth[2][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplitudeLS7");
562 
563  MapNumBadChanFull[2] = (TH2F *)MapNumBadChanDepth[2][1][1]->Clone();
564 
565  MapNumChanDepth[2][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS1");
566  MapNumChanDepth[2][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS2");
567 
568  MapNumChanDepth[2][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS3");
569  MapNumChanDepth[2][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS4");
570  MapNumChanDepth[2][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS5");
571 
572  MapNumChanDepth[2][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS8");
573 
574  MapNumChanDepth[2][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS6");
575  MapNumChanDepth[2][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplitudeLS7");
576 
577  MapNumChanFull[2] = (TH2F *)MapNumChanDepth[2][1][1]->Clone();
578 
579  //+++++++++++++++++++++++++++++
580  // Ratio
581  //+++++++++++++++++++++++++++++
582 
583  MapNumBadChanDepth[3][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS1");
584  MapNumBadChanDepth[3][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS2");
585 
586  MapNumBadChanDepth[3][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS3");
587  MapNumBadChanDepth[3][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS4");
588  MapNumBadChanDepth[3][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS5");
589 
590  MapNumBadChanDepth[3][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS8");
591 
592  MapNumBadChanDepth[3][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS6");
593  MapNumBadChanDepth[3][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumAmplLS7");
594 
595  MapNumBadChanFull[3] = (TH2F *)MapNumBadChanDepth[3][1][1]->Clone();
596 
597  MapNumChanDepth[3][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS1");
598  MapNumChanDepth[3][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS2");
599 
600  MapNumChanDepth[3][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS3");
601  MapNumChanDepth[3][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS4");
602  MapNumChanDepth[3][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS5");
603 
604  MapNumChanDepth[3][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS8");
605 
606  MapNumChanDepth[3][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS6");
607  MapNumChanDepth[3][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumAmplLS7");
608 
609  MapNumChanFull[3] = (TH2F *)MapNumChanDepth[3][1][1]->Clone();
610 
611  //+++++++++++++++++++++++++++++
612  // Tmean
613  //+++++++++++++++++++++++++++++
614 
615  MapNumBadChanDepth[4][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS1");
616  MapNumBadChanDepth[4][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS2");
617 
618  MapNumBadChanDepth[4][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS3");
619  MapNumBadChanDepth[4][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS4");
620  MapNumBadChanDepth[4][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS5");
621 
622  MapNumBadChanDepth[4][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS8");
623 
624  MapNumBadChanDepth[4][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS6");
625  MapNumBadChanDepth[4][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmeanALS7");
626 
627  MapNumBadChanFull[4] = (TH2F *)MapNumBadChanDepth[4][1][1]->Clone();
628 
629  MapNumChanDepth[4][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS1");
630  MapNumChanDepth[4][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS2");
631 
632  MapNumChanDepth[4][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS3");
633  MapNumChanDepth[4][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS4");
634  MapNumChanDepth[4][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS5");
635 
636  MapNumChanDepth[4][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS8");
637 
638  MapNumChanDepth[4][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS6");
639  MapNumChanDepth[4][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmeanALS7");
640 
641  MapNumChanFull[4] = (TH2F *)MapNumChanDepth[4][1][1]->Clone();
642 
643  //+++++++++++++++++++++++++++++
644  // Tmax
645  //+++++++++++++++++++++++++++++
646 
647  MapNumBadChanDepth[5][1][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS1");
648  MapNumBadChanDepth[5][1][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS2");
649 
650  MapNumBadChanDepth[5][2][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS3");
651  MapNumBadChanDepth[5][2][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS4");
652  MapNumBadChanDepth[5][2][3] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS5");
653 
654  MapNumBadChanDepth[5][3][4] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS8");
655 
656  MapNumBadChanDepth[5][4][1] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS6");
657  MapNumBadChanDepth[5][4][2] = (TH2F *)dir->FindObjectAny("h_2DsumTSmaxALS7");
658 
659  MapNumBadChanFull[5] = (TH2F *)MapNumBadChanDepth[5][1][1]->Clone();
660 
661  MapNumChanDepth[5][1][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS1");
662  MapNumChanDepth[5][1][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS2");
663 
664  MapNumChanDepth[5][2][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS3");
665  MapNumChanDepth[5][2][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS4");
666  MapNumChanDepth[5][2][3] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS5");
667 
668  MapNumChanDepth[5][3][4] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS8");
669 
670  MapNumChanDepth[5][4][1] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS6");
671  MapNumChanDepth[5][4][2] = (TH2F *)dir->FindObjectAny("h_2D0sumTSmaxALS7");
672 
673  MapNumChanFull[5] = (TH2F *)MapNumChanDepth[5][1][1]->Clone();
674 
675  for (int test = 0; test <= 5; test++) { //Test: 0,
676  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
677  if (sub == 1)
678  cHB->Divide(2, 1);
679  if (sub == 2)
680  cHE->Divide(3, 1);
681  if (sub == 3)
682  cONE->Divide(1, 1);
683  if (sub == 4)
684  cHB->Divide(2, 1);
685  for (int k = k_min[sub]; k <= k_max[sub]; k++) { //Depth
686  if (sub == 1)
687  cHB->cd(k);
688  if (sub == 2)
689  cHE->cd(k);
690  if (sub == 3)
691  cONE->cd(k - 3);
692  if (sub == 4)
693  cHB->cd(k);
694  MapNumBadChanDepth[test][sub][k]->Divide(
695  MapNumBadChanDepth[test][sub][k], MapNumChanDepth[test][sub][k], 1, 1, "B");
696 
697  for (int x = 1; x <= MapNumBadChanFull[test]->GetXaxis()->GetNbins(); ++x) {
698  for (int y = 1; y <= MapNumBadChanFull[test]->GetYaxis()->GetNbins(); ++y) {
699  double ccc1 = MapNumBadChanDepth[test][sub][k]->GetBinContent(x, y);
700  MapNumBadChanFull[test]->SetBinContent(x, y, MapNumBadChanFull[test]->GetBinContent(x, y) + ccc1);
701  } //end y
702  } //end x
703 
704  if (k == 1)
705  MapNumBadChanDepth[test][sub][k]->SetTitle("Depth 1\b");
706  if (k == 2)
707  MapNumBadChanDepth[test][sub][k]->SetTitle("Depth 2\b");
708  if (k == 3)
709  MapNumBadChanDepth[test][sub][k]->SetTitle("Depth 3\b");
710  if (k == 4)
711  MapNumBadChanDepth[test][sub][k]->SetTitle("Depth 4\b");
712  gPad->SetGridy();
713  gPad->SetGridx();
714  gPad->SetLogz();
715  //
716  // gPad->DrawFrame(0.0, 0.0001, 1.0, 1000);
717  // gPad->DrawFrame(0.2, 0.0002, 0.8, 10000);
718  MapNumBadChanDepth[test][sub][k]->SetXTitle("#eta \b");
719  MapNumBadChanDepth[test][sub][k]->SetYTitle("#phi \b");
720  MapNumBadChanDepth[test][sub][k]->SetZTitle("Average estimator \b");
722  MapNumBadChanDepth[test][sub][k]->SetTitleOffset(0.75, "Z");
723  MapNumBadChanDepth[test][sub][k]->Draw("COLZ");
724  // MapNumBadChanDepth[test][sub][k]->Draw("same");
725  // MapNumBadChanDepth[test][sub][k]->GetYaxis()->SetRangeUser(0, 72.);
726  MapNumBadChanDepth[test][sub][k]->GetZaxis()->SetRangeUser(0.000001, 1.);
727  }
728  if (test == 0) {
729  if (sub == 1) {
730  cHB->Print("MapCapIdErrorHB.png");
731  cHB->Clear();
732  }
733  if (sub == 2) {
734  cHE->Print("MapCapIdErrorHE.png");
735  cHE->Clear();
736  }
737  if (sub == 3) {
738  cONE->Print("MapCapIdErrorHO.png");
739  cONE->Clear();
740  }
741  if (sub == 4) {
742  cHB->Print("MapCapIdErrorHF.png");
743  cHB->Clear();
744  }
745  }
746  if (test == 1) {
747  if (sub == 1) {
748  cHB->Print("MapADCamplHB.png");
749  cHB->Clear();
750  }
751  if (sub == 2) {
752  cHE->Print("MapADCamplHE.png");
753  cHE->Clear();
754  }
755  if (sub == 3) {
756  cONE->Print("MapADCamplHO.png");
757  cONE->Clear();
758  }
759  if (sub == 4) {
760  cHB->Print("MapADCamplHF.png");
761  cHB->Clear();
762  }
763  }
764  if (test == 2) {
765  if (sub == 1) {
766  cHB->Print("MapWidthHB.png");
767  cHB->Clear();
768  }
769  if (sub == 2) {
770  cHE->Print("MapWidthHE.png");
771  cHE->Clear();
772  }
773  if (sub == 3) {
774  cONE->Print("MapWidthHO.png");
775  cONE->Clear();
776  }
777  if (sub == 4) {
778  cHB->Print("MapWidthHF.png");
779  cHB->Clear();
780  }
781  }
782  if (test == 3) {
783  if (sub == 1) {
784  cHB->Print("MapRatioHB.png");
785  cHB->Clear();
786  }
787  if (sub == 2) {
788  cHE->Print("MapRatioHE.png");
789  cHE->Clear();
790  }
791  if (sub == 3) {
792  cONE->Print("MapRatioHO.png");
793  cONE->Clear();
794  }
795  if (sub == 4) {
796  cHB->Print("MapRatioHF.png");
797  cHB->Clear();
798  }
799  }
800  if (test == 4) {
801  if (sub == 1) {
802  cHB->Print("MapTmeanHB.png");
803  cHB->Clear();
804  }
805  if (sub == 2) {
806  cHE->Print("MapTmeanHE.png");
807  cHE->Clear();
808  }
809  if (sub == 3) {
810  cONE->Print("MapTmeanHO.png");
811  cONE->Clear();
812  }
813  if (sub == 4) {
814  cHB->Print("MapTmeanHF.png");
815  cHB->Clear();
816  }
817  }
818  if (test == 5) {
819  if (sub == 1) {
820  cHB->Print("MapTmaxHB.png");
821  cHB->Clear();
822  }
823  if (sub == 2) {
824  cHE->Print("MapTmaxHE.png");
825  cHE->Clear();
826  }
827  if (sub == 3) {
828  cONE->Print("MapTmaxHO.png");
829  cONE->Clear();
830  }
831  if (sub == 4) {
832  cHB->Print("MapTmaxHF.png");
833  cHB->Clear();
834  }
835  }
836  } // end sub
837 
838  cONE->Divide(1, 1);
839  cONE->cd(1);
840  gPad->SetGridy();
841  gPad->SetGridx();
842  gPad->SetLogz();
843  MapNumBadChanFull[test]->SetTitle("All subdetectors\b");
844  MapNumBadChanFull[test]->SetXTitle("#eta \b");
845  MapNumBadChanFull[test]->SetYTitle("#phi \b");
846  if (test == 0)
847  MapNumBadChanFull[test]->SetZTitle("Average Nbcs \b");
848  if (test != 0)
849  MapNumBadChanFull[test]->SetZTitle("Average estimator \b");
850  // MapNumBadChanFull[test]->GetZaxis()->SetLabelSize(0.008);
851  MapNumBadChanFull[test]->SetTitleOffset(0.75, "Z");
852  MapNumBadChanFull[test]->Draw("COLZ");
853  // MapNumBadChanFull[test]->GetYaxis()->SetRangeUser(0, 72.);
854  // MapNumBadChanFull[test]->GetZaxis()->SetRangeUser(0.0001, 1.);
855  if (test == 0) {
856  cONE->Print("MapCapIdError.png");
857  cONE->Clear();
858  }
859  if (test == 1) {
860  cONE->Print("MapADCAmpl.png");
861  cONE->Clear();
862  }
863  if (test == 2) {
864  cONE->Print("MapWidth.png");
865  cONE->Clear();
866  }
867  if (test == 3) {
868  cONE->Print("MapRatio.png");
869  cONE->Clear();
870  }
871  if (test == 4) {
872  cONE->Print("MapTmean.png");
873  cONE->Clear();
874  }
875  if (test == 5) {
876  cONE->Print("MapTmax.png");
877  cONE->Clear();
878  }
879  } //end test
880 
881  //================================================================================================================================
882 
883  //=======================================================================================================
884  // 1-d histograms third definition
885 
886  TH1F *HistNumBadChanDepth[7][5][8]; // 1d histogramm for test,subdet, depth
887  TH1F *HistCutNumBadChanDepth[7][5][8]; // 1d histogramm for test,subdet, depth
888  TH1F *HistNumChanDepth[7][5][8]; // 1d histogramm for test,subdet, depth
889 
890  // TH1F *HistNumBadChanDepth[7][5][5]; // 1d histogramm for test,subdet, depth
891  // TH1F *HistCutNumBadChanDepth[7][5][5]; // 1d histogramm for test,subdet, depth
892  // TH1F *HistNumChanDepth[7][5][5]; // 1d histogramm for test,subdet, depth
893 
894  TH1F *HistNumBadChanFull[7]; // 1d histogramm for test
895  TH1F *HistNumChanFull[7]; // 1d histogramm for test
896 
897  //+++++++++++++++++++++++++++++
898  // Rate of Cap ID errors
899  //+++++++++++++++++++++++++++++
900 
901  HistNumBadChanDepth[0][1][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HB");
902  HistNumBadChanDepth[0][1][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HB");
903  HistNumBadChanDepth[0][1][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth3_HB");
904  HistNumBadChanDepth[0][1][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HB");
905 
906  HistNumBadChanDepth[0][2][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HE");
907  HistNumBadChanDepth[0][2][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HE");
908  HistNumBadChanDepth[0][2][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth3_HE");
909  HistNumBadChanDepth[0][2][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HE");
910  HistNumBadChanDepth[0][2][5] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth5_HE");
911  HistNumBadChanDepth[0][2][6] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth6_HE");
912  HistNumBadChanDepth[0][2][7] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth7_HE");
913 
914  HistNumBadChanDepth[0][3][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HO");
915 
916  HistNumBadChanDepth[0][4][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HF");
917  HistNumBadChanDepth[0][4][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HF");
918  HistNumBadChanDepth[0][4][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth3_HF");
919  HistNumBadChanDepth[0][4][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HF");
920 
921  HistNumBadChanFull[0] = (TH1F *)HistNumBadChanDepth[0][1][1]->Clone();
922 
923  HistCutNumBadChanDepth[0][1][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HB");
924  HistCutNumBadChanDepth[0][1][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HB");
925  HistCutNumBadChanDepth[0][1][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth3_HB");
926  HistCutNumBadChanDepth[0][1][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HB");
927 
928  HistCutNumBadChanDepth[0][2][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HE");
929  HistCutNumBadChanDepth[0][2][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HE");
930  HistCutNumBadChanDepth[0][2][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth3_HE");
931  HistCutNumBadChanDepth[0][2][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HE");
932  HistCutNumBadChanDepth[0][2][5] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth5_HE");
933  HistCutNumBadChanDepth[0][2][6] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth6_HE");
934  HistCutNumBadChanDepth[0][2][7] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth7_HE");
935 
936  HistCutNumBadChanDepth[0][3][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HO");
937 
938  HistCutNumBadChanDepth[0][4][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth1_HF");
939  HistCutNumBadChanDepth[0][4][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth2_HF");
940  HistCutNumBadChanDepth[0][4][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth3_HF");
941  HistCutNumBadChanDepth[0][4][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannels_depth4_HF");
942 
943  HistNumChanDepth[0][1][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HB");
944  HistNumChanDepth[0][1][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HB");
945  HistNumChanDepth[0][1][3] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth3_HB");
946  HistNumChanDepth[0][1][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HB");
947 
948  HistNumChanDepth[0][2][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HE");
949  HistNumChanDepth[0][2][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HE");
950  HistNumChanDepth[0][2][3] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth3_HE");
951  HistNumChanDepth[0][2][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HE");
952  HistNumChanDepth[0][2][5] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth5_HE");
953  HistNumChanDepth[0][2][6] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth6_HE");
954  HistNumChanDepth[0][2][7] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth7_HE");
955 
956  HistNumChanDepth[0][3][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HO");
957 
958  HistNumChanDepth[0][4][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HF");
959  HistNumChanDepth[0][4][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HF");
960  HistNumChanDepth[0][4][3] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth3_HF");
961  HistNumChanDepth[0][4][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HF");
962 
963  HistNumChanFull[0] = (TH1F *)HistNumChanDepth[0][1][1]->Clone();
964 
965  //+++++++++++++++++++++++++++++
966  // ADC Amplitude
967  //+++++++++++++++++++++++++++++
968 
970  // HB:
971  HistNumBadChanDepth[1][1][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS1");
972  HistNumBadChanDepth[1][1][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS2");
973  // HB upgrade:
974  HistNumBadChanDepth[1][1][3] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth3HBu");
975  HistNumBadChanDepth[1][1][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth4HBu");
976 
977  // HE:
978  HistNumBadChanDepth[1][2][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS3");
979  HistNumBadChanDepth[1][2][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS4");
980  HistNumBadChanDepth[1][2][3] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS5");
981  // HE upgrade:
982  HistNumBadChanDepth[1][2][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth4HEu");
983  HistNumBadChanDepth[1][2][5] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth5HEu");
984  HistNumBadChanDepth[1][2][6] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth6HEu");
985  HistNumBadChanDepth[1][2][7] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth7HEu");
986 
987  // HO:
988  HistNumBadChanDepth[1][3][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS8");
989 
990  // HF:
991  HistNumBadChanDepth[1][4][1] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS6");
992  HistNumBadChanDepth[1][4][2] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS7");
993  // HF upgrade:
994  HistNumBadChanDepth[1][4][3] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS6u");
995  HistNumBadChanDepth[1][4][4] = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS7u");
996 
997  // other cases:
998  HistNumBadChanFull[1] = (TH1F *)HistNumBadChanDepth[1][1][1]->Clone();
999 
1001  // HB:
1002  HistCutNumBadChanDepth[1][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS1");
1003  HistCutNumBadChanDepth[1][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS2");
1004  // HB upgrade:
1005  HistCutNumBadChanDepth[1][1][3] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth3HBu");
1006  HistCutNumBadChanDepth[1][1][4] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth4HBu");
1007 
1008  // HE:
1009  HistCutNumBadChanDepth[1][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS3");
1010  HistCutNumBadChanDepth[1][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS4");
1011  HistCutNumBadChanDepth[1][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS5");
1012  // HE upgrade:
1013  HistCutNumBadChanDepth[1][2][4] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth4HEu");
1014  HistCutNumBadChanDepth[1][2][5] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth5HEu");
1015  HistCutNumBadChanDepth[1][2][6] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth6HEu");
1016  HistCutNumBadChanDepth[1][2][7] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth7HEu");
1017 
1018  // HO:
1019  HistCutNumBadChanDepth[1][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS8");
1020 
1021  // HF:
1022  HistCutNumBadChanDepth[1][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS6");
1023  HistCutNumBadChanDepth[1][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS7");
1024  // HF upgrade:
1025  HistCutNumBadChanDepth[1][4][3] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS6u");
1026  HistCutNumBadChanDepth[1][4][4] = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS7u");
1027 
1029  // HB:
1030  HistNumChanDepth[1][1][1] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS1");
1031  HistNumChanDepth[1][1][2] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS2");
1032  // HB upgrade:
1033  HistNumChanDepth[1][1][3] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth3HBu");
1034  HistNumChanDepth[1][1][4] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth4HBu");
1035 
1036  // HE:
1037  HistNumChanDepth[1][2][1] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS3");
1038  HistNumChanDepth[1][2][2] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS4");
1039  HistNumChanDepth[1][2][3] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS5");
1040  // HE upgrade:
1041  HistNumChanDepth[1][2][4] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth4HEu");
1042  HistNumChanDepth[1][2][5] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth5HEu");
1043  HistNumChanDepth[1][2][6] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth6HEu");
1044  HistNumChanDepth[1][2][7] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth7HEu");
1045 
1046  // HO:
1047  HistNumChanDepth[1][3][4] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS8");
1048 
1049  // HF:
1050  HistNumChanDepth[1][4][1] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS6");
1051  HistNumChanDepth[1][4][2] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS7");
1052  // HF upgrade:
1053  HistNumChanDepth[1][4][3] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS6u");
1054  HistNumChanDepth[1][4][4] = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS7u");
1055 
1056  // other cases:
1057  HistNumChanFull[1] = (TH1F *)HistNumChanDepth[1][1][1]->Clone();
1058  // just initialization of [6] massive for alternative <A> calculation
1059  HistNumChanFull[6] = (TH1F *)HistNumChanDepth[1][1][1]->Clone();
1060 
1061  //+++++++++++++++++++++++++++++
1062  // Width
1063  //+++++++++++++++++++++++++++++
1064 
1065  HistNumBadChanDepth[2][1][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS1");
1066  HistNumBadChanDepth[2][1][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS2");
1067 
1068  HistNumBadChanDepth[2][2][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS3");
1069  HistNumBadChanDepth[2][2][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS4");
1070  HistNumBadChanDepth[2][2][3] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS5");
1071 
1072  HistNumBadChanDepth[2][3][4] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS8");
1073 
1074  HistNumBadChanDepth[2][4][1] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS6");
1075  HistNumBadChanDepth[2][4][2] = (TH1F *)dir->FindObjectAny("h_sumAmplitudeperLS7");
1076 
1077  HistNumBadChanFull[2] = (TH1F *)HistNumBadChanDepth[2][1][1]->Clone();
1078 
1079  HistCutNumBadChanDepth[2][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS1");
1080  HistCutNumBadChanDepth[2][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS2");
1081 
1082  HistCutNumBadChanDepth[2][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS3");
1083  HistCutNumBadChanDepth[2][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS4");
1084  HistCutNumBadChanDepth[2][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS5");
1085 
1086  HistCutNumBadChanDepth[2][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS8");
1087 
1088  HistCutNumBadChanDepth[2][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS6");
1089  HistCutNumBadChanDepth[2][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplitudeperLS7");
1090 
1091  HistNumChanDepth[2][1][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS1");
1092  HistNumChanDepth[2][1][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS2");
1093 
1094  HistNumChanDepth[2][2][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS3");
1095  HistNumChanDepth[2][2][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS4");
1096  HistNumChanDepth[2][2][3] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS5");
1097 
1098  HistNumChanDepth[2][3][4] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS8");
1099 
1100  HistNumChanDepth[2][4][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS6");
1101  HistNumChanDepth[2][4][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplitudeperLS7");
1102 
1103  HistNumChanFull[2] = (TH1F *)HistNumChanDepth[2][1][1]->Clone();
1104  //+++++++++++++++++++++++++++++
1105  // Ratio
1106  //+++++++++++++++++++++++++++++
1107 
1108  HistNumBadChanDepth[3][1][1] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS1");
1109  HistNumBadChanDepth[3][1][2] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS2");
1110 
1111  HistNumBadChanDepth[3][2][1] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS3");
1112  HistNumBadChanDepth[3][2][2] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS4");
1113  HistNumBadChanDepth[3][2][3] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS5");
1114 
1115  HistNumBadChanDepth[3][3][4] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS8");
1116 
1117  HistNumBadChanDepth[3][4][1] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS6");
1118  HistNumBadChanDepth[3][4][2] = (TH1F *)dir->FindObjectAny("h_sumAmplperLS7");
1119 
1120  HistNumBadChanFull[3] = (TH1F *)HistNumBadChanDepth[3][1][1]->Clone();
1121 
1122  HistCutNumBadChanDepth[3][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS1");
1123  HistCutNumBadChanDepth[3][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS2");
1124 
1125  HistCutNumBadChanDepth[3][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS3");
1126  HistCutNumBadChanDepth[3][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS4");
1127  HistCutNumBadChanDepth[3][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS5");
1128 
1129  HistCutNumBadChanDepth[3][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS8");
1130 
1131  HistCutNumBadChanDepth[3][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS6");
1132  HistCutNumBadChanDepth[3][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutAmplperLS7");
1133 
1134  HistNumChanDepth[3][1][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS1");
1135  HistNumChanDepth[3][1][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS2");
1136 
1137  HistNumChanDepth[3][2][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS3");
1138  HistNumChanDepth[3][2][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS4");
1139  HistNumChanDepth[3][2][3] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS5");
1140 
1141  HistNumChanDepth[3][3][4] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS8");
1142 
1143  HistNumChanDepth[3][4][1] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS6");
1144  HistNumChanDepth[3][4][2] = (TH1F *)dir->FindObjectAny("h_sum0AmplperLS7");
1145 
1146  HistNumChanFull[3] = (TH1F *)HistNumChanDepth[3][1][1]->Clone();
1147  //+++++++++++++++++++++++++++++
1148  // Tmean
1149  //+++++++++++++++++++++++++++++
1150 
1151  HistNumBadChanDepth[4][1][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS1");
1152  HistNumBadChanDepth[4][1][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS2");
1153 
1154  HistNumBadChanDepth[4][2][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS3");
1155  HistNumBadChanDepth[4][2][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS4");
1156  HistNumBadChanDepth[4][2][3] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS5");
1157 
1158  HistNumBadChanDepth[4][3][4] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS8");
1159 
1160  HistNumBadChanDepth[4][4][1] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS6");
1161  HistNumBadChanDepth[4][4][2] = (TH1F *)dir->FindObjectAny("h_sumTSmeanAperLS7");
1162 
1163  HistNumBadChanFull[4] = (TH1F *)HistNumBadChanDepth[4][1][1]->Clone();
1164 
1165  HistCutNumBadChanDepth[4][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS1");
1166  HistCutNumBadChanDepth[4][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS2");
1167 
1168  HistCutNumBadChanDepth[4][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS3");
1169  HistCutNumBadChanDepth[4][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS4");
1170  HistCutNumBadChanDepth[4][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS5");
1171 
1172  HistCutNumBadChanDepth[4][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS8");
1173 
1174  HistCutNumBadChanDepth[4][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS6");
1175  HistCutNumBadChanDepth[4][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmeanAperLS7");
1176 
1177  HistNumChanDepth[4][1][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS1");
1178  HistNumChanDepth[4][1][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS2");
1179 
1180  HistNumChanDepth[4][2][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS3");
1181  HistNumChanDepth[4][2][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS4");
1182  HistNumChanDepth[4][2][3] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS5");
1183 
1184  HistNumChanDepth[4][3][4] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS8");
1185 
1186  HistNumChanDepth[4][4][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS6");
1187  HistNumChanDepth[4][4][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmeanAperLS7");
1188 
1189  HistNumChanFull[4] = (TH1F *)HistNumChanDepth[4][1][1]->Clone();
1190  //+++++++++++++++++++++++++++++
1191  // Tmax
1192  //+++++++++++++++++++++++++++++
1193 
1194  HistNumBadChanDepth[5][1][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS1");
1195  HistNumBadChanDepth[5][1][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS2");
1196 
1197  HistNumBadChanDepth[5][2][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS3");
1198  HistNumBadChanDepth[5][2][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS4");
1199  HistNumBadChanDepth[5][2][3] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS5");
1200 
1201  HistNumBadChanDepth[5][3][4] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS8");
1202 
1203  HistNumBadChanDepth[5][4][1] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS6");
1204  HistNumBadChanDepth[5][4][2] = (TH1F *)dir->FindObjectAny("h_sumTSmaxAperLS7");
1205 
1206  HistNumBadChanFull[5] = (TH1F *)HistNumBadChanDepth[5][1][1]->Clone();
1207 
1208  HistCutNumBadChanDepth[5][1][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS1");
1209  HistCutNumBadChanDepth[5][1][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS2");
1210 
1211  HistCutNumBadChanDepth[5][2][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS3");
1212  HistCutNumBadChanDepth[5][2][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS4");
1213  HistCutNumBadChanDepth[5][2][3] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS5");
1214 
1215  HistCutNumBadChanDepth[5][3][4] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS8");
1216 
1217  HistCutNumBadChanDepth[5][4][1] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS6");
1218  HistCutNumBadChanDepth[5][4][2] = (TH1F *)dir->FindObjectAny("h_sumCutTSmaxAperLS7");
1219 
1220  HistNumChanDepth[5][1][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS1");
1221  HistNumChanDepth[5][1][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS2");
1222 
1223  HistNumChanDepth[5][2][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS3");
1224  HistNumChanDepth[5][2][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS4");
1225  HistNumChanDepth[5][2][3] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS5");
1226 
1227  HistNumChanDepth[5][3][4] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS8");
1228 
1229  HistNumChanDepth[5][4][1] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS6");
1230  HistNumChanDepth[5][4][2] = (TH1F *)dir->FindObjectAny("h_sum0TSmaxAperLS7");
1231 
1232  HistNumChanFull[5] = (TH1F *)HistNumChanDepth[5][1][1]->Clone();
1233 
1234  for (int test = 0; test <= 5; test++) { //Test: =0(CapIdErrors), =1(Amplitude), =2...
1235  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1236  if (sub == 1 && test > 1)
1237  cHE->Divide(2, 1); //HB
1238  if (sub == 1 && test < 2) {
1239  cFour1->Clear();
1240  cFour1->Divide(2, 2);
1241  } //HB upgrade with new depthes 3,4
1242  if (sub == 2 && test > 1)
1243  cHE->Divide(3, 1); //HE
1244  if (sub == 2 && test < 2) {
1245  cNine->Clear();
1246  cNine->Divide(3, 3);
1247  } //HE upgrade with new depthes 4,5,6,7
1248  if (sub == 3)
1249  cHB->Divide(1, 1); //HO
1250  if (sub == 4 && test > 1)
1251  cHE->Divide(2, 1); //HF
1252  if (sub == 4 && test < 2) {
1253  cFour1->Clear();
1254  cFour1->Divide(2, 2);
1255  } // HF upgrade with new depthes 3 and 4
1256 
1257  int kkkkkkmax = k_max[sub];
1258  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
1259  if ((sub == 4 || sub == 2 || sub == 1) && test < 2)
1260  kkkkkkmax = k_maxupgrade[sub];
1261  for (int k = k_min[sub]; k <= kkkkkkmax; k++) { //Depth
1262  if (sub == 1 && test > 1)
1263  cHE->cd(k); //HB
1264  if (sub == 1 && test < 2)
1265  cFour1->cd(k); //HB
1266  if (sub == 2 && test > 1)
1267  cHE->cd(k); //HE
1268  if (sub == 2 && test < 2)
1269  cNine->cd(k); //HE upgrade with new depthes 4,5,6,7
1270  if (sub == 3)
1271  cHB->cd(k - 3); //HO
1272  if (sub == 4 && test > 1)
1273  cHE->cd(k); //HF
1274  if (sub == 4 && test < 2)
1275  cFour1->cd(k); // HF upgrade with new depthes 3 and 4
1276  gPad->SetGridy();
1277  gPad->SetGridx();
1278  // gPad->SetLogy();
1279 
1280  if (sub == 1 && k == 1) {
1281  } else {
1282  // use "else" because ...Full[test] are filled by estimastor for sub==1 && k== 1 at initialization of ...Full[test] variables
1283  for (int x = 1; x <= HistNumBadChanFull[test]->GetXaxis()->GetNbins(); x++) {
1284  double ccc1 = HistNumBadChanDepth[test][sub][k]->GetBinContent(x);
1285  HistNumBadChanFull[test]->SetBinContent(x, HistNumBadChanFull[test]->GetBinContent(x) + ccc1);
1286  double ccc2 = HistNumChanDepth[test][sub][k]->GetBinContent(x);
1287  HistNumChanFull[test]->SetBinContent(x, HistNumChanFull[test]->GetBinContent(x) + ccc2);
1288  }
1289  } //end x
1290 
1291  // !!!!!! change the sense of HistNumBadChanDepth: now it's averaged values(estimators)
1292  HistNumBadChanDepth[test][sub][k]->Divide(
1293  HistNumBadChanDepth[test][sub][k], HistNumChanDepth[test][sub][k], 1, 1, "B");
1294  // errors abnulling:
1295  for (int x = 1; x <= HistNumBadChanDepth[test][sub][k]->GetXaxis()->GetNbins(); x++) {
1296  HistNumBadChanDepth[test][sub][k]->SetBinError(float(x), 0.01);
1297  }
1298 
1299  // int myMaxLum= HistNumBadChanDepth[test][sub][k]->GetBinContent(HistNumBadChanDepth[test][sub][k]->GetMaximumBin());
1300  // cout<<"********************>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> myMaxLum = "<<myMaxLum<<" MaxLum = "<<MaxLum<<endl;
1301  HistNumBadChanDepth[test][sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1302 
1303  // // // // // // // // // // // // // // // // // //
1304  HistNumBadChanDepth[test][sub][k]->SetMarkerStyle(20);
1305  HistNumBadChanDepth[test][sub][k]->SetMarkerSize(0.4);
1306  HistNumBadChanDepth[test][sub][k]->GetYaxis()->SetLabelSize(0.04);
1307  if (k == 1)
1308  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 1\b");
1309  if (k == 2)
1310  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 2\b");
1311  if (k == 3)
1312  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 3\b");
1313  if (k == 4)
1314  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 4\b");
1315  if (k == 5)
1316  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 5\b");
1317  if (k == 6)
1318  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 6\b");
1319  if (k == 7)
1320  HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 7\b");
1321  HistNumBadChanDepth[test][sub][k]->SetXTitle("LS \b");
1322  if (test == 0)
1323  HistNumBadChanDepth[test][sub][k]->SetYTitle("<Number of bad channels> \b");
1324  if (test != 0)
1325  HistNumBadChanDepth[test][sub][k]->SetYTitle("Averaged estimator \b");
1326  HistNumBadChanDepth[test][sub][k]->SetMarkerColor(2);
1327  HistNumBadChanDepth[test][sub][k]->SetLineColor(0);
1328  // gPad->SetGridx();
1329  gPad->SetLogy();
1330  gPad->SetGridy();
1331  gPad->SetGridx();
1332  // if (test == 1) HistNumBadChanDepth[test][sub][k]->SetMinimum(0.1);
1333  HistNumBadChanDepth[test][sub][k]->Draw("Error");
1334  /*
1335  if (k == 1) HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 1\b");
1336  if (k == 2) HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 2\b");
1337  if (k == 3) HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 3\b");
1338  if (k == 4) HistNumBadChanDepth[test][sub][k]->SetTitle("Depth 4\b");
1339  HistNumBadChanDepth[test][sub][k]->SetXTitle("LS \b");
1340  if (test == 0) HistNumBadChanDepth[test][sub][k]->SetYTitle("<Number of bad channels> \b");
1341  if (test != 0) HistNumBadChanDepth[test][sub][k]->SetYTitle("Averaged estimator \b");
1342 
1343  if (MaxLum<=1000){
1344  HistNumBadChanDepth[test][sub][k]->SetMarkerStyle(20);
1345  HistNumBadChanDepth[test][sub][k]->SetMarkerSize(0.5);
1346  HistNumBadChanDepth[test][sub][k]->SetMarkerColor(2);
1347  HistNumBadChanDepth[test][sub][k]->SetLineColor(0);
1348  HistNumBadChanDepth[test][sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1349  HistNumBadChanDepth[test][sub][k]->Draw("P");
1350  }
1351  else{
1352  HistNumBadChanDepth[test][sub][k]->SetLineColor(2);
1353  HistNumBadChanDepth[test][sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1354  HistNumBadChanDepth[test][sub][k]->Draw("L");
1355  }
1356  */
1357  /*
1358  float min_x[] = {0,10000};
1359  float min_y[] = {(float)(Cut0[test][sub][k]),(float)(Cut0[test][sub][k])};
1360  TGraph* MIN = new TGraph(2, min_x, min_y);
1361  MIN->SetLineStyle(2);
1362  MIN->SetLineColor(5);
1363  MIN->SetLineWidth(2 + 100*100);
1364  MIN->SetFillStyle(3005);
1365  MIN->SetFillColor(5);
1366  gPad->SetGridy();
1367  gPad->SetGridx();
1368  MIN->Draw("L");
1369 */
1370 
1371  if (test == 1 || test == 0) {
1372  if (sub == 1) {
1373  cFour1->Modified();
1374  } // HB upgrade
1375  if (sub == 2) {
1376  cNine->Modified();
1377  } // HE upgrade
1378  if (sub == 3) {
1379  cHB->Modified();
1380  }
1381  if (sub == 4) {
1382  cFour1->Modified();
1383  } // HF upgrade
1384  } else {
1385  if (sub == 1) {
1386  cHE->Modified();
1387  }
1388  if (sub == 2) {
1389  cHE->Modified();
1390  }
1391  if (sub == 3) {
1392  cHB->Modified();
1393  }
1394  if (sub == 4) {
1395  cHE->Modified();
1396  }
1397  }
1398 
1399  } // k loop
1400 
1401  // CapIdErrors:
1402  if (test == 0) {
1403  if (sub == 1) {
1404  cFour1->Print("HistNBCMNHB.png");
1405  cFour1->Clear();
1406  } // HB upgrade
1407  if (sub == 2) {
1408  cNine->Print("HistNBCMNHE.png");
1409  cNine->Clear();
1410  } // HE upgrade
1411  if (sub == 3) {
1412  cHB->Print("HistNBCMNHO.png");
1413  cHB->Clear();
1414  }
1415  if (sub == 4) {
1416  cFour1->Print("HistNBCMNHF.png");
1417  cHE->Clear();
1418  }
1419  }
1420  // Amplitude:
1421  if (test == 1) {
1422  if (sub == 1) {
1423  cFour1->Print("HistADCamplHB.png");
1424  cFour1->Clear();
1425  } // HB upgrade
1426  if (sub == 2) {
1427  cNine->Print("HistADCamplHE.png");
1428  cNine->Clear();
1429  } // HE upgrade
1430  if (sub == 3) {
1431  cHB->Print("HistADCamplHO.png");
1432  cHB->Clear();
1433  }
1434  if (sub == 4) {
1435  cFour1->Print("HistADCamplHF.png");
1436  cFour1->Clear();
1437  } // HF upgrade
1438  }
1439  if (test == 2) {
1440  if (sub == 1) {
1441  cHE->Print("HistWidthHB.png");
1442  cHE->Clear();
1443  }
1444  if (sub == 2) {
1445  cHE->Print("HistWidthHE.png");
1446  cHE->Clear();
1447  }
1448  if (sub == 3) {
1449  cHB->Print("HistWidthHO.png");
1450  cHB->Clear();
1451  }
1452  if (sub == 4) {
1453  cHE->Print("HistWidthHF.png");
1454  cHE->Clear();
1455  }
1456  }
1457  if (test == 3) {
1458  if (sub == 1) {
1459  cHE->Print("HistRatioHB.png");
1460  cHE->Clear();
1461  }
1462  if (sub == 2) {
1463  cHE->Print("HistRatioHE.png");
1464  cHE->Clear();
1465  }
1466  if (sub == 3) {
1467  cHB->Print("HistRatioHO.png");
1468  cHB->Clear();
1469  }
1470  if (sub == 4) {
1471  cHE->Print("HistRatioHF.png");
1472  cHE->Clear();
1473  }
1474  }
1475  if (test == 4) {
1476  if (sub == 1) {
1477  cHE->Print("HistTmeanHB.png");
1478  cHE->Clear();
1479  }
1480  if (sub == 2) {
1481  cHE->Print("HistTmeanHE.png");
1482  cHE->Clear();
1483  }
1484  if (sub == 3) {
1485  cHB->Print("HistTmeanHO.png");
1486  cHB->Clear();
1487  }
1488  if (sub == 4) {
1489  cHE->Print("HistTmeanHF.png");
1490  cHE->Clear();
1491  }
1492  }
1493  if (test == 5) {
1494  if (sub == 1) {
1495  cHE->Print("HistTmaxHB.png");
1496  cHE->Clear();
1497  }
1498  if (sub == 2) {
1499  cHE->Print("HistTmaxHE.png");
1500  cHE->Clear();
1501  }
1502  if (sub == 3) {
1503  cHB->Print("HistTmaxHO.png");
1504  cHB->Clear();
1505  }
1506  if (sub == 4) {
1507  cHE->Print("HistTmaxHF.png");
1508  cHE->Clear();
1509  }
1510  }
1511  } // end sub
1513  // if (test == 1 || test == 0) {
1514  if (test == 1) {
1515  for (int x = 1; x <= HistNumChanFull[6]->GetXaxis()->GetNbins(); x++) {
1516  HistNumChanFull[6]->SetBinContent(x, 0.0);
1517  int depthsubcount = 0.;
1518  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1519  int kkkkkkmax = k_max[sub];
1520  if (sub == 4 || sub == 2 || sub == 1)
1521  kkkkkkmax = k_maxupgrade[sub];
1522  // if ( sub==4 || sub==2) kkkkkkmax = k_maxupgrade[sub];
1523  for (int k = k_min[sub]; k <= kkkkkkmax; k++) { //Depth
1524  // 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
1525  // if(sub==2 && k>3 ) break;
1526  depthsubcount++;
1527  double ccc1 = HistNumBadChanDepth[test][sub][k]->GetBinContent(x);
1528  HistNumChanFull[6]->SetBinContent(x, HistNumChanFull[6]->GetBinContent(x) + ccc1);
1529  } //depth
1530  } //sub
1531  if (depthsubcount > 0.) {
1532  HistNumChanFull[6]->SetBinContent(x, (HistNumChanFull[6]->GetBinContent(x)) / depthsubcount);
1533  } else {
1534  HistNumChanFull[6]->SetBinContent(x, (HistNumChanFull[6]->GetBinContent(x)) / 8.);
1535  }
1536  } //x
1537  } //test
1539 
1540  // if (test == 1 || test == 0) {
1541  if (test == 1) {
1542  cHE->Divide(2, 1);
1543  cHE->cd(1);
1544  } else {
1545  cHB->Divide(1, 1);
1546  cHB->cd(1);
1547  }
1548 
1549  HistNumBadChanFull[test]->Divide(HistNumBadChanFull[test], HistNumChanFull[test], 1, 1, "B");
1550  TH1F *kfitq = new TH1F("kfitq", "", MaxLum, 1., MaxLum + 1.);
1551  int nx = kfitq->GetXaxis()->GetNbins();
1552  for (int i = 1; i <= nx; i++) {
1553  double ccc1 = HistNumBadChanFull[test]->GetBinContent(i);
1554  if (ccc1 > 0.) {
1555  kfitq->Fill(float(i), ccc1);
1556  kfitq->SetBinError(float(i), 0.01);
1557  }
1558  }
1559  kfitq->SetMarkerStyle(20);
1560  kfitq->SetMarkerSize(0.4);
1561  kfitq->GetYaxis()->SetLabelSize(0.04);
1562  if (test == 0)
1563  kfitq->SetTitle("Average Nbch for whole Hcal \b");
1564  if (test != 0)
1565  kfitq->SetTitle("Averaged estimator for whole Hcal \b");
1566  kfitq->SetXTitle("LS \b");
1567  if (test == 0)
1568  kfitq->SetYTitle("<Number of bad channels> \b");
1569  if (test != 0)
1570  kfitq->SetYTitle("Averaged estimator \b");
1571  kfitq->SetMarkerColor(2);
1572  kfitq->SetLineColor(0);
1573  gPad->SetGridx();
1574  kfitq->Draw("Error");
1575  /*
1576  HistNumBadChanFull[test]->SetMarkerStyle(20);
1577  HistNumBadChanFull[test]->SetMarkerSize(0.8);
1578  HistNumBadChanFull[test]->SetTitle("Averaged estimator for whole Hcal \b");
1579  HistNumBadChanFull[test]->SetXTitle("LS \b");
1580  if (test == 0) HistNumBadChanFull[test]->SetYTitle("<Number of bad channels> \b");
1581  if (test != 0) HistNumBadChanFull[test]->SetYTitle("Averaged estimator \b");
1582  if (MaxLum<=1000){
1583  HistNumBadChanFull[test]->SetMarkerColor(1);
1584  HistNumBadChanFull[test]->SetLineColor(0);
1585  HistNumBadChanFull[test]->Draw("P");
1586  }
1587  else {
1588  HistNumBadChanFull[test]->SetLineColor(1);
1589  HistNumBadChanFull[test]->Draw("L");
1590  }
1591  */
1592 
1593  if (test == 1) {
1594  // if (test == 1 || test == 0) {
1595  cHE->cd(2);
1596  TH1F *lpuio = new TH1F("lpuio", "", MaxLum, 1., MaxLum + 1.);
1597  int nx = lpuio->GetXaxis()->GetNbins();
1598  for (int i = 1; i <= nx; i++) {
1599  double ccc1 = HistNumChanFull[6]->GetBinContent(i);
1600  if (ccc1 > 0.) {
1601  lpuio->Fill(float(i), ccc1);
1602  lpuio->SetBinError(float(i), 0.01);
1603  }
1604  }
1605  lpuio->SetMarkerStyle(20);
1606  lpuio->SetMarkerSize(0.4);
1607  lpuio->GetYaxis()->SetLabelSize(0.04);
1608  lpuio->SetTitle("Mean of Averaged Amplitudes over all Hcal sub-detectors \b");
1609  lpuio->SetXTitle("LS \b");
1610  lpuio->SetYTitle("Mean of Averaged estimator \b");
1611  lpuio->SetMarkerColor(2);
1612  lpuio->SetLineColor(0);
1613  gPad->SetGridx();
1614  lpuio->Draw("Error");
1615  }
1616  if (test == 0) {
1617  cHB->Print("HistCapID.png");
1618  cHB->Clear();
1619  }
1620  if (test == 1) {
1621  cHE->Print("HistADCAmpl.png");
1622  cHE->Clear();
1623  }
1624  if (test == 2) {
1625  cHB->Print("HistWidth.png");
1626  cHB->Clear();
1627  }
1628  if (test == 3) {
1629  cHB->Print("HistRatio.png");
1630  cHB->Clear();
1631  }
1632  if (test == 4) {
1633  cHB->Print("HistTmean.png");
1634  cHB->Clear();
1635  }
1636  if (test == 5) {
1637  cHB->Print("HistTmax.png");
1638  cHB->Clear();
1639  }
1640 
1641  // clean-up
1642  if (kfitq)
1643  delete kfitq;
1644  } //end test
1645 
1646  //================================================================================================================================
1647 
1648  //=======================================================================================================333
1649  //CapID 1-d histograms
1650 
1651  //TH1F *HistAbnormNumBadChanDepth[5][5]; // 1d histogramm for subdet, depth
1652  TH1F *HistAbnormNumBadChanDepth[5][8]; // 1d histogramm for subdet, depth
1653 
1654  //+++++++++++++++++++++++++++++
1655  // Abnormal Bad Channels Rate of Cap ID errors first set of histograms
1656  //+++++++++++++++++++++++++++++
1657 
1658  HistAbnormNumBadChanDepth[1][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth1_HB");
1659  HistAbnormNumBadChanDepth[1][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth2_HB");
1660  HistAbnormNumBadChanDepth[1][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth3_HB");
1661  HistAbnormNumBadChanDepth[1][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth4_HB");
1662  HistAbnormNumBadChanDepth[2][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth1_HE");
1663  HistAbnormNumBadChanDepth[2][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth2_HE");
1664  HistAbnormNumBadChanDepth[2][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth3_HE");
1665  HistAbnormNumBadChanDepth[2][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth4_HE");
1666  HistAbnormNumBadChanDepth[2][5] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth5_HE");
1667  HistAbnormNumBadChanDepth[2][6] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth6_HE");
1668  HistAbnormNumBadChanDepth[2][7] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth7_HE");
1669  HistAbnormNumBadChanDepth[3][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth4_HO");
1670  HistAbnormNumBadChanDepth[4][1] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth1_HF");
1671  HistAbnormNumBadChanDepth[4][2] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth2_HF");
1672  HistAbnormNumBadChanDepth[4][3] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth3_HF");
1673  HistAbnormNumBadChanDepth[4][4] = (TH1F *)dir->FindObjectAny("h_runnbadchannelsC_depth4_HF");
1674 
1675  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1676  if (sub == 1) {
1677  cFour1->Clear();
1678  cFour1->Divide(2, 2);
1679  } //HB upgrade with new depthes 3,4
1680  if (sub == 2) {
1681  cNine->Clear();
1682  cNine->Divide(3, 3);
1683  } //HE upgrade with new depthes 4,5,6,7
1684  if (sub == 3)
1685  cHB->Divide(1, 1); //HO
1686  if (sub == 4) {
1687  cFour1->Clear();
1688  cFour1->Divide(2, 2);
1689  } // HF upgrade with new depthes 3 and 4
1690 
1691  int kkkkkkmax = k_max[sub];
1692  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
1693  if ((sub == 4 || sub == 2 || sub == 1))
1694  kkkkkkmax = k_maxupgrade[sub];
1695  for (int k = k_min[sub]; k <= kkkkkkmax; k++) { //Depth
1696  if (sub == 1)
1697  cFour1->cd(k); //HB upgrade with new depthes 3 and 4
1698  if (sub == 2)
1699  cNine->cd(k); //HE upgrade with new depthes 4,5,6,7
1700  if (sub == 3)
1701  cHB->cd(k - 3); //HO
1702  if (sub == 4)
1703  cFour1->cd(k); // HF upgrade with new depthes 3 and 4
1704  gPad->SetGridy();
1705  gPad->SetGridx();
1706  // gPad->SetLogy();
1707 
1708  HistAbnormNumBadChanDepth[sub][k]->Divide(
1709  HistAbnormNumBadChanDepth[sub][k], HistNumChanDepth[0][sub][k], 1, 1, "B");
1710  if (k == 1)
1711  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 1\b");
1712  if (k == 2)
1713  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 2\b");
1714  if (k == 3)
1715  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 3\b");
1716  if (k == 4)
1717  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 4\b");
1718  if (k == 5)
1719  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 5\b");
1720  if (k == 6)
1721  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 6\b");
1722  if (k == 7)
1723  HistAbnormNumBadChanDepth[sub][k]->SetTitle("Depth 7\b");
1724 
1725  HistAbnormNumBadChanDepth[sub][k]->SetXTitle("LS \b");
1726  HistAbnormNumBadChanDepth[sub][k]->SetYTitle("< Number of bad channels > \b");
1727  if (MaxLum <= 1000) {
1728  HistAbnormNumBadChanDepth[sub][k]->SetMarkerStyle(20);
1729  HistAbnormNumBadChanDepth[sub][k]->SetMarkerSize(0.5);
1730  HistAbnormNumBadChanDepth[sub][k]->SetMarkerColor(1);
1731  HistAbnormNumBadChanDepth[sub][k]->SetLineColor(0);
1732  HistAbnormNumBadChanDepth[sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1733  HistAbnormNumBadChanDepth[sub][k]->Draw("P");
1734  } else {
1735  HistAbnormNumBadChanDepth[sub][k]->SetLineColor(1);
1736  HistAbnormNumBadChanDepth[sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1737  HistAbnormNumBadChanDepth[sub][k]->Draw("L");
1738  }
1739  } // end k
1740 
1741  if (sub == 1) {
1742  cFour1->Modified();
1743  } // HB upgrade
1744  if (sub == 2) {
1745  cNine->Modified();
1746  } // HE upgrade
1747  if (sub == 3) {
1748  cHB->Modified();
1749  }
1750  if (sub == 4) {
1751  cFour1->Modified();
1752  } // HF upgrade
1753 
1754  if (sub == 1) {
1755  cFour1->Print("Hist_CAPID_Abnorm_HB.png");
1756  cFour1->Clear();
1757  } // HB upgrade
1758  if (sub == 2) {
1759  cNine->Print("Hist_CAPID_Abnorm_HE.png");
1760  cNine->Clear();
1761  } // HE upgrade
1762  if (sub == 3) {
1763  cHB->Print("Hist_CAPID_Abnorm_HO.png");
1764  cHB->Clear();
1765  }
1766  if (sub == 4) {
1767  cFour1->Print("Hist_CAPID_Abnorm_HF.png");
1768  cFour1->Clear();
1769  } // HF upgrade
1770 
1771  } // end sub
1772 
1773  //+++++++++++++++++++++++++++++
1774  // Portions of bad channels events identified by Cap ID errors third set of histograms
1775  //+++++++++++++++++++++++++++++
1776 
1777  TH1F *HistPortBadEventsDepth[5][8]; // 1d histogramm for subdet, depth
1778 
1779  HistPortBadEventsDepth[1][1] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth1_HB");
1780  HistPortBadEventsDepth[1][2] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth2_HB");
1781  HistPortBadEventsDepth[1][3] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth3_HB");
1782  HistPortBadEventsDepth[1][4] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth4_HB");
1783  HistPortBadEventsDepth[2][1] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth1_HE");
1784  HistPortBadEventsDepth[2][2] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth2_HE");
1785  HistPortBadEventsDepth[2][3] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth3_HE");
1786  HistPortBadEventsDepth[2][4] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth4_HE");
1787  HistPortBadEventsDepth[2][5] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth5_HE");
1788  HistPortBadEventsDepth[2][6] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth6_HE");
1789  HistPortBadEventsDepth[2][7] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth7_HE");
1790  HistPortBadEventsDepth[3][4] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth4_HO");
1791  HistPortBadEventsDepth[4][1] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth1_HF");
1792  HistPortBadEventsDepth[4][2] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth2_HF");
1793  HistPortBadEventsDepth[4][3] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth3_HF");
1794  HistPortBadEventsDepth[4][4] = (TH1F *)dir->FindObjectAny("h_runbadrateC_depth4_HF");
1795 
1796  TH1F *HistNumRateDepth[5][8];
1797  HistNumRateDepth[1][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HB");
1798  HistNumRateDepth[1][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HB");
1799  HistNumRateDepth[1][3] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth3_HB");
1800  HistNumRateDepth[1][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HB");
1801  HistNumRateDepth[2][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HE");
1802  HistNumRateDepth[2][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HE");
1803  HistNumRateDepth[2][3] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth3_HE");
1804  HistNumRateDepth[2][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HE");
1805  HistNumRateDepth[2][5] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth5_HE");
1806  HistNumRateDepth[2][6] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth6_HE");
1807  HistNumRateDepth[2][7] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth7_HE");
1808  HistNumRateDepth[3][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HO");
1809  HistNumRateDepth[4][1] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth1_HF");
1810  HistNumRateDepth[4][2] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth2_HF");
1811  HistNumRateDepth[4][3] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth3_HF");
1812  HistNumRateDepth[4][4] = (TH1F *)dir->FindObjectAny("h_runbadrate0_depth4_HF");
1813 
1814  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1815  if (sub == 1) {
1816  cFour1->Clear();
1817  cFour1->Divide(2, 2);
1818  } //HB upgrade with new depthes 3,4
1819  if (sub == 2) {
1820  cNine->Clear();
1821  cNine->Divide(3, 3);
1822  } //HE upgrade with new depthes 4,5,6,7
1823  if (sub == 3)
1824  cHB->Divide(1, 1); //HO
1825  if (sub == 4) {
1826  cFour1->Clear();
1827  cFour1->Divide(2, 2);
1828  } // HF upgrade with new depthes 3 and 4
1829 
1830  int kkkkkkmax = k_max[sub];
1831  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
1832  if ((sub == 4 || sub == 2 || sub == 1))
1833  kkkkkkmax = k_maxupgrade[sub];
1834  for (int k = k_min[sub]; k <= kkkkkkmax; k++) { //Depth
1835  if (sub == 1)
1836  cFour1->cd(k); //HB upgrade with new depthes 3 and 4
1837  if (sub == 2)
1838  cNine->cd(k); //HE upgrade with new depthes 4,5,6,7
1839  if (sub == 3)
1840  cHB->cd(k - 3); //HO
1841  if (sub == 4)
1842  cFour1->cd(k); // HF upgrade with new depthes 3 and 4
1843  gPad->SetGridy();
1844  gPad->SetGridx();
1845  // gPad->SetLogy();
1846 
1847  HistPortBadEventsDepth[sub][k]->Divide(HistPortBadEventsDepth[sub][k], HistNumRateDepth[sub][k], 1, 1, "B");
1848 
1849  if (k == 1)
1850  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 1\b");
1851  if (k == 2)
1852  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 2\b");
1853  if (k == 3)
1854  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 3\b");
1855  if (k == 4)
1856  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 4\b");
1857  if (k == 5)
1858  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 5\b");
1859  if (k == 6)
1860  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 6\b");
1861  if (k == 7)
1862  HistPortBadEventsDepth[sub][k]->SetTitle("Depth 7\b");
1863 
1864  HistPortBadEventsDepth[sub][k]->SetXTitle("LS \b");
1865  HistPortBadEventsDepth[sub][k]->SetYTitle("< Number of bad channels > \b");
1866  if (MaxLum <= 1000) {
1867  HistPortBadEventsDepth[sub][k]->SetMarkerStyle(20);
1868  HistPortBadEventsDepth[sub][k]->SetMarkerSize(0.5);
1869  HistPortBadEventsDepth[sub][k]->SetMarkerColor(1);
1870  HistPortBadEventsDepth[sub][k]->SetLineColor(0);
1871  HistPortBadEventsDepth[sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1872  HistPortBadEventsDepth[sub][k]->Draw("P");
1873  } else {
1874  HistPortBadEventsDepth[sub][k]->SetLineColor(1);
1875  HistPortBadEventsDepth[sub][k]->GetXaxis()->SetRangeUser(0, MaxLum);
1876  HistPortBadEventsDepth[sub][k]->Draw("L");
1877  }
1878  } // end k
1879 
1880  if (sub == 1) {
1881  cFour1->Modified();
1882  } // HB upgrade
1883  if (sub == 2) {
1884  cNine->Modified();
1885  } // HE upgrade
1886  if (sub == 3) {
1887  cHB->Modified();
1888  }
1889  if (sub == 4) {
1890  cFour1->Modified();
1891  } // HF upgrade
1892 
1893  if (sub == 1) {
1894  cFour1->Print("HistPortHB.png");
1895  cFour1->Clear();
1896  } // HB upgrade
1897  if (sub == 2) {
1898  cNine->Print("HistPortHE.png");
1899  cNine->Clear();
1900  } // HE upgrade
1901  if (sub == 3) {
1902  cHB->Print("HistPortHO.png");
1903  cHB->Clear();
1904  }
1905  if (sub == 4) {
1906  cFour1->Print("HistPortHF.png");
1907  cFour1->Clear();
1908  } // HF upgrade
1909 
1910  } // end sub
1911 
1912  //================================================================================================================================
1913 
1914  //+++++++++++++++++++++++++++++
1915  // Number of bad channels events identified by Cap ID errors third set of histograms
1916  //+++++++++++++++++++++++++++++
1917 
1918  TH1F *HistNBadChsDepth[5][8]; // 1d histogramm for subdet, depth
1919 
1920  HistNBadChsDepth[1][1] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth1_HB");
1921  HistNBadChsDepth[1][2] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth2_HB");
1922  HistNBadChsDepth[1][3] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth3_HB");
1923  HistNBadChsDepth[1][4] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth4_HB");
1924  HistNBadChsDepth[2][1] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth1_HE");
1925  HistNBadChsDepth[2][2] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth2_HE");
1926  HistNBadChsDepth[2][3] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth3_HE");
1927  HistNBadChsDepth[2][4] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth4_HE");
1928  HistNBadChsDepth[2][5] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth5_HE");
1929  HistNBadChsDepth[2][6] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth6_HE");
1930  HistNBadChsDepth[2][7] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth7_HE");
1931  HistNBadChsDepth[3][4] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth4_HO");
1932  HistNBadChsDepth[4][1] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth1_HF");
1933  HistNBadChsDepth[4][2] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth2_HF");
1934  HistNBadChsDepth[4][3] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth3_HF");
1935  HistNBadChsDepth[4][4] = (TH1F *)dir->FindObjectAny("h_nbadchannels_depth4_HF");
1936 
1937  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
1938  if (sub == 1) {
1939  cFour1->Clear();
1940  cFour1->Divide(2, 2);
1941  } //HB upgrade with new depthes 3,4
1942  if (sub == 2) {
1943  cNine->Clear();
1944  cNine->Divide(3, 3);
1945  } //HE upgrade with new depthes 4,5,6,7
1946  if (sub == 3)
1947  cHB->Divide(1, 1); //HO
1948  if (sub == 4) {
1949  cFour1->Clear();
1950  cFour1->Divide(2, 2);
1951  } // HF upgrade with new depthes 3 and 4
1952 
1953  int kkkkkkmax = k_max[sub];
1954  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
1955  if ((sub == 4 || sub == 2 || sub == 1))
1956  kkkkkkmax = k_maxupgrade[sub];
1957  for (int k = k_min[sub]; k <= kkkkkkmax; k++) { //Depth
1958  if (sub == 1)
1959  cFour1->cd(k); //HB upgrade with new depthes 3 and 4
1960  if (sub == 2)
1961  cNine->cd(k); //HE upgrade with new depthes 4,5,6,7
1962  if (sub == 3)
1963  cHB->cd(k - 3); //HO
1964  if (sub == 4)
1965  cFour1->cd(k); // HF upgrade with new depthes 3 and 4
1966  gPad->SetGridy();
1967  gPad->SetGridx();
1968  gPad->SetLogy();
1969 
1970  if (k == 1)
1971  HistNBadChsDepth[sub][k]->SetTitle("Depth 1\b");
1972  if (k == 2)
1973  HistNBadChsDepth[sub][k]->SetTitle("Depth 2\b");
1974  if (k == 3)
1975  HistNBadChsDepth[sub][k]->SetTitle("Depth 3\b");
1976  if (k == 4)
1977  HistNBadChsDepth[sub][k]->SetTitle("Depth 4\b");
1978  if (k == 5)
1979  HistNBadChsDepth[sub][k]->SetTitle("Depth 5\b");
1980  if (k == 6)
1981  HistNBadChsDepth[sub][k]->SetTitle("Depth 6\b");
1982  if (k == 7)
1983  HistNBadChsDepth[sub][k]->SetTitle("Depth 7\b");
1984 
1985  HistNBadChsDepth[sub][k]->SetXTitle("Number of bad channels\b");
1986  HistNBadChsDepth[sub][k]->SetYTitle("Number of events\b");
1987  // HistNBadChsDepth[sub][k]->SetMarkerStyle(20);
1988  // HistNBadChsDepth[sub][k]->SetMarkerSize(0.5);
1989  // HistNBadChsDepth[sub][k]->SetMarkerColor(1);
1990  // HistNBadChsDepth[sub][k]->SetLineColor(0);
1991  HistNBadChsDepth[sub][k]->Draw("");
1992  }
1993 
1994  if (sub == 1) {
1995  cFour1->Modified();
1996  } // HB upgrade
1997  if (sub == 2) {
1998  cNine->Modified();
1999  } // HE upgrade
2000  if (sub == 3) {
2001  cHB->Modified();
2002  }
2003  if (sub == 4) {
2004  cFour1->Modified();
2005  } // HF upgrade
2006 
2007  if (sub == 1) {
2008  cFour1->Print("HistNBadChsHB.png");
2009  cFour1->Clear();
2010  } // HB upgrade
2011  if (sub == 2) {
2012  cNine->Print("HistNBadChsHE.png");
2013  cNine->Clear();
2014  } // HE upgrade
2015  if (sub == 3) {
2016  cHB->Print("HistNBadChsHO.png");
2017  cHB->Clear();
2018  }
2019  if (sub == 4) {
2020  cFour1->Print("HistNBadChsHF.png");
2021  cFour1->Clear();
2022  } // HF upgrade
2023 
2024  } // end sub
2025 
2026  //====================================================================== HB :
2027  //====================================================================== HB :
2028  //====================================================================== HB :
2029  // Special test of errors type A and B in HB
2030  // AZ 08.02.2016
2031 
2032  int flagErrAB_HB[2];
2033  flagErrAB_HB[0] = -1;
2034  flagErrAB_HB[1] = -1;
2035  double avedelta_HB = 0.;
2036  int lastLumiBin_HB = -1;
2037  int LSofFirstErrB_HB = -1;
2038  {
2039  const int specCountA = 4;
2040  const int specColors[specCountA] = {1, 2, 3, 4};
2041  const TString hnames[specCountA][2] = {{"h_sumADCAmplperLS1_P1", "h_sum0ADCAmplperLS1_P1"},
2042  {"h_sumADCAmplperLS1_P2", "h_sum0ADCAmplperLS1_P2"},
2043  {"h_sumADCAmplperLS1_M1", "h_sum0ADCAmplperLS1_M1"},
2044  {"h_sumADCAmplperLS1_M2", "h_sum0ADCAmplperLS1_M2"}};
2045 
2046  std::vector<TH1F *> hV;
2047  THStack *hs = new THStack("hs", "ADCAmplerLS1");
2048  cHB->Clear();
2049  // cHB->cd();
2050  cHB->Divide(2, 1);
2051  cHB->cd(1);
2052 
2054  for (int i = 0; i < specCountA; i++) {
2055  if (1)
2056  std::cout << "debugger: errA_HB : get histos for i=" << i << " " << hnames[i][0] << " and " << hnames[i][1]
2057  << "\n";
2058  TH1F *h1 = (TH1F *)dir->FindObjectAny(hnames[i][0]);
2059  TH1F *h0 = (TH1F *)dir->FindObjectAny(hnames[i][1]);
2060  if (!h1 || !h0) {
2061  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2062  ptext->AddText("Missing histo");
2063  if (!h1) {
2064  std::cout << "\tfailed to get " << hnames[i][0] << "\n";
2065  ptext->AddText(hnames[i][0]);
2066  }
2067  if (!h0) {
2068  std::cout << "\tfailed to get " << hnames[i][1] << "\n";
2069  ptext->AddText(hnames[i][1]);
2070  }
2071  ptext->Draw();
2072  continue;
2073  }
2074  TH1F *hERT1orig = (TH1F *)h1->Clone(Form("ERT1orig_%d", i));
2075  hERT1orig->Divide(h1, h0, 1, 1, "B");
2076 
2077  if ((lastLumiBin_HB < 0) && (i == 0)) {
2078  for (int ibin = hERT1orig->GetNbinsX(); ibin >= 1; ibin--) {
2079  if (hERT1orig->GetBinContent(ibin) == 0)
2080  lastLumiBin_HB = ibin;
2081  else
2082  break;
2083  }
2084  lastLumiBin_HB += 3; // show more bins
2085  if (lastLumiBin_HB >= hERT1orig->GetNbinsX())
2086  lastLumiBin_HB = -1;
2087  }
2088  TH1F *hERT1 = NULL;
2089  if (lastLumiBin_HB > 1) {
2090  if (!copyContents(&hERT1, Form("ERT1_%d", i), "", hERT1orig, lastLumiBin_HB)) {
2091  std::cout << "code failed" << std::endl;
2092  gSystem->Exit(1);
2093  }
2094  } else
2095  hERT1 = hERT1orig;
2096 
2097  hERT1->GetXaxis()->SetTitle("<ADCAmpl> per LS HB: black-P1, red-P2,green-M1,blue-M2");
2098  hV.push_back(hERT1);
2099  hERT1->SetMarkerStyle(20);
2100  hERT1->SetMarkerSize(0.4);
2101  hERT1->SetXTitle("<A>(ev.in LS & ch.) - HB P1 - iLS \b");
2102  hERT1->SetMarkerColor(specColors[i]);
2103  hERT1->SetLineColor(0);
2104  hs->Add(hERT1);
2105  delete h1;
2106  delete h0;
2107  if (hERT1 != hERT1orig)
2108  delete hERT1orig;
2109  }
2110  hs->Draw("LPE1 nostack");
2111  cHB->Update(); // activate the axes
2112  hs->GetXaxis()->SetTitle("<A> per LS: black-P1, red-P2,green-M1,blue-M2");
2113  hs->Draw("LPE1 nostack");
2114  gPad->SetGridy();
2116 
2117  // AZ corrections 08.02.2016
2118  cHB->cd(2);
2119  TH1F *diff = new TH1F("diff", "", 100, 0., 4.);
2120 
2121  if (int(hV.size()) == specCountA) {
2122  flagErrAB_HB[0] = 0; // If we have the expected number of histograms, set the flag
2123  double sumdelta = 0.;
2124  int nnndelta = 0;
2125  for (int ibin = 1; ibin <= hV[0]->GetNbinsX(); ibin++) {
2126  double delta = 0.;
2127  double maxdelta = 0.;
2128  for (unsigned int i = 0; i < hV.size(); i++) {
2129  const TH1F *hi = hV[i];
2130  for (unsigned int j = 1; j < hV.size(); j++) {
2131  const TH1F *hj = hV[j];
2132  delta = fabs(hi->GetBinContent(ibin) - hj->GetBinContent(ibin));
2133  if (delta > maxdelta)
2134  maxdelta = delta;
2135  } //for
2136  } //for
2137  if (maxdelta > 0.) {
2138  diff->Fill(maxdelta);
2139  sumdelta += maxdelta;
2140  nnndelta++;
2141  }
2142  } //for ibin
2143  // avedelta_HB = sumdelta/hV[0]->GetNbinsX();
2144  avedelta_HB = sumdelta / nnndelta;
2145  std::cout << "******************>>>>>> ErrA_HB: avedelta_HB = " << avedelta_HB << std::endl;
2146  if (avedelta_HB > 0.24 || (avedelta_HB < 0.14 && avedelta_HB > 0.)) {
2147  flagErrAB_HB[0] = 1;
2148  } //if
2149  } //hV.size
2150  diff->SetMarkerStyle(20);
2151  diff->SetMarkerSize(0.8);
2152  diff->SetXTitle("max difference \b");
2153  diff->SetMarkerColor(2);
2154  diff->SetLineColor(0);
2155  gPad->SetGridx();
2156  gPad->SetLogy();
2157  diff->Draw("Error");
2159  cHB->Update();
2160  cHB->Print("HistErrA_HB.png");
2161  cHB->Clear();
2163 
2164  // clean-up
2165  if (diff)
2166  delete diff;
2167  for (unsigned int i = 0; i < hV.size(); i++)
2168  delete hV[i];
2169  } // ErrorA in HB
2170 
2172 
2173  { // errors type B
2174  const int specCountB = 4;
2175  const TString hnames[specCountB][2] = {{"h_2DsumErrorBLS1", "h_2D0sumErrorBLS1"},
2176  {"h_sumErrorBperLS1", "h_sum0ErrorBperLS1"},
2177  {"h_2DsumErrorBLS2", "h_2D0sumErrorBLS2"},
2178  {"h_sumErrorBperLS2", "h_sum0ErrorBperLS2"}};
2179 
2180  for (int depth = 1; depth <= 2; depth++) {
2181  cHB->Clear();
2182  cHB->Divide(2, 1);
2183  cHB->cd(1);
2184 
2185  TH1F *hRate2orig = NULL;
2186  TH2F *h2Cefz6 = NULL;
2187  TString hname1 = hnames[2 * depth - 2][0];
2188  TString hname0 = hnames[2 * depth - 2][1];
2189  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
2190  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
2191  if (1)
2192  std::cout << "debugger: errB_HB depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2193  if (!twod1 || !twod0) {
2194  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2195  ptext->AddText("Missing histos");
2196  if (!twod1) {
2197  std::cout << "\tfailed to get " << hname1 << "\n";
2198  ptext->AddText(hname1);
2199  }
2200  if (!twod0) {
2201  std::cout << "\tfailed to get " << hname0 << "\n";
2202  ptext->AddText(hname0);
2203  }
2204  ptext->Draw();
2205  } else {
2206  h2Cefz6 = (TH2F *)twod1->Clone(Form("Cefz6_%d", depth));
2207  h2Cefz6->SetTitle(Form("HB Depth %d \b", depth));
2208  h2Cefz6->Divide(twod1, twod0, 1, 1, "B");
2209 
2210  gPad->SetGridy();
2211  gPad->SetGridx();
2212  gPad->SetLogz();
2213  h2Cefz6->SetTitle(Form("Depth %d \b", depth));
2214  h2Cefz6->SetMarkerStyle(20);
2215  h2Cefz6->SetMarkerSize(0.4);
2216  // h2Cefz6->GetZaxis()->SetLabelSize(0.04);
2217  h2Cefz6->SetXTitle("#eta \b");
2218  h2Cefz6->SetYTitle("#phi \b");
2219  h2Cefz6->SetZTitle(Form("<ErrorB> - HB Depth%d \b", depth));
2220  h2Cefz6->SetMarkerColor(2);
2221  h2Cefz6->SetLineColor(2);
2222  h2Cefz6->Draw("COLZ");
2223 
2224  delete twod1;
2225  delete twod0;
2226  } // histos ok
2227 
2228  cHB->cd(2);
2229  hname1 = hnames[2 * depth - 1][0];
2230  hname0 = hnames[2 * depth - 1][1];
2231  TH1F *h1 = (TH1F *)dir->FindObjectAny(hname1);
2232  TH1F *h0 = (TH1F *)dir->FindObjectAny(hname0);
2233  if (1)
2234  std::cout << "errB_HB depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2235  if (!h1 || !h0) {
2236  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2237  ptext->AddText("Missing histo");
2238  if (!h1) {
2239  std::cout << "\tfailed to get " << hname1 << "\n";
2240  ptext->AddText(hname1);
2241  }
2242  if (!h0) {
2243  std::cout << "\tfailed to get " << hname0 << "\n";
2244  ptext->AddText(hname0);
2245  }
2246  ptext->Draw();
2247  } else {
2248  gPad->SetGridx();
2249  gPad->SetGridy();
2250  // gPad->SetLogy();
2251  hRate2orig = (TH1F *)h1->Clone(Form("Rate2orig_%d", depth));
2252  hRate2orig->Divide(h1, h0, 1, 1, "B");
2253 
2254  TH1F *hRate2 = NULL;
2255  if (lastLumiBin_HB > 1) {
2256  if (!copyContents(&hRate2, Form("Rate2_%d", depth), "", hRate2orig, lastLumiBin_HB)) {
2257  std::cout << "code failed" << std::endl;
2258  gSystem->Exit(1);
2259  }
2260  } else
2261  hRate2 = hRate2orig;
2262 
2263  hRate2->SetTitle(Form("Depth %d \b", depth));
2264  hRate2->SetMarkerStyle(20);
2265  hRate2->SetMarkerSize(0.8);
2266  // hRate2->GetZaxis()->SetLabelSize(0.04);
2267  hRate2->SetXTitle(Form("<ErrorB>(ev.in LS & ch.) - HB depth%d - iLS \b", depth));
2268  hRate2->SetMarkerColor(2);
2269  hRate2->SetLineColor(0);
2270  hRate2->Draw("Error");
2271 
2272  if (LSofFirstErrB_HB == -1) {
2273  int nx = hRate2->GetXaxis()->GetNbins();
2274  for (int i = 1; i <= nx; i++) {
2275  double ccc1 = hRate2->GetBinContent(i);
2276  if (ccc1 > 0.) {
2277  cout << "****************>>>>>>>>>>> ErrB_HB bad LS start at iLS = " << i << " with rate = " << ccc1
2278  << endl;
2279  LSofFirstErrB_HB = i;
2280  break;
2281  }
2282  }
2283  }
2284 
2285  delete h1;
2286  delete h0;
2287  if (hRate2 != hRate2orig) {
2288  delete hRate2orig;
2289  hRate2orig = hRate2;
2290  }
2291  }
2292 
2293  cHB->Update();
2294  cHB->Print(Form("HistErrB_HB_%d.png", depth));
2295  cHB->Clear();
2296  if (h2Cefz6)
2297  delete h2Cefz6;
2298  if (hRate2orig)
2299  delete hRate2orig;
2300  }
2301  } // ErrorsB in HB
2302 
2303  //====================================================================== HE :
2304  //====================================================================== HE :
2305  //====================================================================== HE :
2306  // Special test of errors type A and B in HE
2307  // AZ 08.02.2016
2308 
2309  int flagErrAB_HE[2];
2310  flagErrAB_HE[0] = -1;
2311  flagErrAB_HE[1] = -1;
2312  double avedelta_HE = 0.;
2313  int lastLumiBin_HE = -1;
2314  int LSofFirstErrB_HE = -1;
2315  {
2316  const int specCountA = 4;
2317  const int specColors[specCountA] = {1, 2, 3, 4};
2318  const TString hnames[specCountA][2] = {{"h_sumADCAmplperLS3_P1", "h_sum0ADCAmplperLS3_P1"},
2319  {"h_sumADCAmplperLS3_P2", "h_sum0ADCAmplperLS3_P2"},
2320  {"h_sumADCAmplperLS3_M1", "h_sum0ADCAmplperLS3_M1"},
2321  {"h_sumADCAmplperLS3_M2", "h_sum0ADCAmplperLS3_M2"}};
2322 
2323  std::vector<TH1F *> hV;
2324  THStack *hs = new THStack("hs", "ADCAmplerLS1");
2325  cHB->Clear();
2326  // cHB->cd();
2327  cHB->Divide(2, 1);
2328  cHB->cd(1);
2329 
2331  for (int i = 0; i < specCountA; i++) {
2332  if (1)
2333  std::cout << "debugger: errA_HE : get histos for i=" << i << " " << hnames[i][0] << " and " << hnames[i][1]
2334  << "\n";
2335  TH1F *h1 = (TH1F *)dir->FindObjectAny(hnames[i][0]);
2336  TH1F *h0 = (TH1F *)dir->FindObjectAny(hnames[i][1]);
2337  if (!h1 || !h0) {
2338  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2339  ptext->AddText("Missing histo");
2340  if (!h1) {
2341  std::cout << "\tfailed to get " << hnames[i][0] << "\n";
2342  ptext->AddText(hnames[i][0]);
2343  }
2344  if (!h0) {
2345  std::cout << "\tfailed to get " << hnames[i][1] << "\n";
2346  ptext->AddText(hnames[i][1]);
2347  }
2348  ptext->Draw();
2349  continue;
2350  }
2351  TH1F *hERT1orig = (TH1F *)h1->Clone(Form("ERT1orig_%d", i));
2352  hERT1orig->Divide(h1, h0, 1, 1, "B");
2353 
2354  if ((lastLumiBin_HE < 0) && (i == 0)) {
2355  for (int ibin = hERT1orig->GetNbinsX(); ibin >= 1; ibin--) {
2356  if (hERT1orig->GetBinContent(ibin) == 0)
2357  lastLumiBin_HE = ibin;
2358  else
2359  break;
2360  }
2361  lastLumiBin_HE += 3; // show more bins
2362  if (lastLumiBin_HE >= hERT1orig->GetNbinsX())
2363  lastLumiBin_HE = -1;
2364  }
2365  TH1F *hERT1 = NULL;
2366  if (lastLumiBin_HE > 1) {
2367  if (!copyContents(&hERT1, Form("ERT1_%d", i), "", hERT1orig, lastLumiBin_HE)) {
2368  std::cout << "code failed" << std::endl;
2369  gSystem->Exit(1);
2370  }
2371  } else
2372  hERT1 = hERT1orig;
2373 
2374  hERT1->GetXaxis()->SetTitle("<ADCAmpl> per LS HE: black-P1, red-P2,green-M1,blue-M2");
2375  hV.push_back(hERT1);
2376  hERT1->SetMarkerStyle(20);
2377  hERT1->SetMarkerSize(0.4);
2378  hERT1->SetXTitle("<A>(ev.in LS & ch.) - HE P1 - iLS \b");
2379  hERT1->SetMarkerColor(specColors[i]);
2380  hERT1->SetLineColor(0);
2381  hs->Add(hERT1);
2382  delete h1;
2383  delete h0;
2384  if (hERT1 != hERT1orig)
2385  delete hERT1orig;
2386  }
2387  hs->Draw("LPE1 nostack");
2388  cHB->Update(); // activate the axes
2389  hs->GetXaxis()->SetTitle("<A> per LS: black-P1, red-P2,green-M1,blue-M2");
2390  hs->Draw("LPE1 nostack");
2391  gPad->SetGridy();
2393 
2394  // AZ corrections 08.02.2016
2395  cHB->cd(2);
2396  TH1F *diff = new TH1F("diff", "", 100, 0., 4.);
2397 
2398  if (int(hV.size()) == specCountA) {
2399  flagErrAB_HE[0] = 0; // If we have the expected number of histograms, set the flag
2400  double sumdelta = 0.;
2401  int nnndelta = 0;
2402  for (int ibin = 1; ibin <= hV[0]->GetNbinsX(); ibin++) {
2403  double delta = 0.;
2404  double maxdelta = 0.;
2405  for (unsigned int i = 0; i < hV.size(); i++) {
2406  const TH1F *hi = hV[i];
2407  for (unsigned int j = 1; j < hV.size(); j++) {
2408  const TH1F *hj = hV[j];
2409  delta = fabs(hi->GetBinContent(ibin) - hj->GetBinContent(ibin));
2410  if (delta > maxdelta)
2411  maxdelta = delta;
2412  } //for
2413  } //for
2414  if (maxdelta > 0.) {
2415  diff->Fill(maxdelta);
2416  sumdelta += maxdelta;
2417  nnndelta++;
2418  }
2419  } //for ibin
2420  // avedelta_HE = sumdelta/hV[0]->GetNbinsX();
2421  avedelta_HE = sumdelta / nnndelta;
2422  std::cout << "******************>>>>>> ErrA_HE: avedelta_HE = " << avedelta_HE << std::endl;
2423  if (avedelta_HE > 1.1 || (avedelta_HE < 0.5 && avedelta_HE > 0.)) {
2424  flagErrAB_HE[0] = 1;
2425  } //if
2426  } //hV.size
2427  diff->SetMarkerStyle(20);
2428  diff->SetMarkerSize(0.8);
2429  diff->SetXTitle("max difference \b");
2430  diff->SetMarkerColor(2);
2431  diff->SetLineColor(0);
2432  gPad->SetGridx();
2433  gPad->SetLogy();
2434  diff->Draw("Error");
2436  cHB->Update();
2437  cHB->Print("HistErrA_HE.png");
2438  cHB->Clear();
2440 
2441  // clean-up
2442  if (diff)
2443  delete diff;
2444  for (unsigned int i = 0; i < hV.size(); i++)
2445  delete hV[i];
2446  } // ErrorA in HE
2447 
2449 
2450  { // errors type B
2451  const int specCountB = 6;
2452  const TString hnames[specCountB][2] = {{"h_2DsumErrorBLS3", "h_2D0sumErrorBLS3"},
2453  {"h_sumErrorBperLS3", "h_sum0ErrorBperLS3"},
2454  {"h_2DsumErrorBLS4", "h_2D0sumErrorBLS4"},
2455  {"h_sumErrorBperLS4", "h_sum0ErrorBperLS4"},
2456  {"h_2DsumErrorBLS5", "h_2D0sumErrorBLS5"},
2457  {"h_sumErrorBperLS5", "h_sum0ErrorBperLS5"}};
2458 
2459  for (int depth = 1; depth <= 3; depth++) {
2460  cHB->Clear();
2461  cHB->Divide(2, 1);
2462  cHB->cd(1);
2463 
2464  TH1F *hRate2orig = NULL;
2465  TH2F *h2Cefz6 = NULL;
2466  TString hname1 = hnames[2 * depth - 2][0];
2467  TString hname0 = hnames[2 * depth - 2][1];
2468  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
2469  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
2470  if (1)
2471  std::cout << "debugger: errB_HE depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2472  if (!twod1 || !twod0) {
2473  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2474  ptext->AddText("Missing histos");
2475  if (!twod1) {
2476  std::cout << "\tfailed to get " << hname1 << "\n";
2477  ptext->AddText(hname1);
2478  }
2479  if (!twod0) {
2480  std::cout << "\tfailed to get " << hname0 << "\n";
2481  ptext->AddText(hname0);
2482  }
2483  ptext->Draw();
2484  } else {
2485  h2Cefz6 = (TH2F *)twod1->Clone(Form("Cefz6_%d", depth));
2486  h2Cefz6->SetTitle(Form("HE Depth %d \b", depth));
2487  h2Cefz6->Divide(twod1, twod0, 1, 1, "B");
2488 
2489  gPad->SetGridy();
2490  gPad->SetGridx();
2491  gPad->SetLogz();
2492  h2Cefz6->SetTitle(Form("Depth %d \b", depth));
2493  h2Cefz6->SetMarkerStyle(20);
2494  h2Cefz6->SetMarkerSize(0.4);
2495  // h2Cefz6->GetZaxis()->SetLabelSize(0.04);
2496  h2Cefz6->SetXTitle("#eta \b");
2497  h2Cefz6->SetYTitle("#phi \b");
2498  h2Cefz6->SetZTitle(Form("<ErrorB> - HE Depth%d \b", depth));
2499  h2Cefz6->SetMarkerColor(2);
2500  h2Cefz6->SetLineColor(2);
2501  h2Cefz6->Draw("COLZ");
2502 
2503  delete twod1;
2504  delete twod0;
2505  } // histos ok
2506 
2507  cHB->cd(2);
2508  hname1 = hnames[2 * depth - 1][0];
2509  hname0 = hnames[2 * depth - 1][1];
2510  TH1F *h1 = (TH1F *)dir->FindObjectAny(hname1);
2511  TH1F *h0 = (TH1F *)dir->FindObjectAny(hname0);
2512  if (1)
2513  std::cout << "errB_HE depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2514  if (!h1 || !h0) {
2515  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2516  ptext->AddText("Missing histo");
2517  if (!h1) {
2518  std::cout << "\tfailed to get " << hname1 << "\n";
2519  ptext->AddText(hname1);
2520  }
2521  if (!h0) {
2522  std::cout << "\tfailed to get " << hname0 << "\n";
2523  ptext->AddText(hname0);
2524  }
2525  ptext->Draw();
2526  } else {
2527  gPad->SetGridx();
2528  gPad->SetGridy();
2529  // gPad->SetLogy();
2530  hRate2orig = (TH1F *)h1->Clone(Form("Rate2orig_%d", depth));
2531  hRate2orig->Divide(h1, h0, 1, 1, "B");
2532 
2533  TH1F *hRate2 = NULL;
2534  if (lastLumiBin_HE > 1) {
2535  if (!copyContents(&hRate2, Form("Rate2_%d", depth), "", hRate2orig, lastLumiBin_HE)) {
2536  std::cout << "code failed" << std::endl;
2537  gSystem->Exit(1);
2538  }
2539  } else
2540  hRate2 = hRate2orig;
2541 
2542  hRate2->SetTitle(Form("Depth %d \b", depth));
2543  hRate2->SetMarkerStyle(20);
2544  hRate2->SetMarkerSize(0.8);
2545  // hRate2->GetZaxis()->SetLabelSize(0.04);
2546  hRate2->SetXTitle(Form("<ErrorB>(ev.in LS & ch.) - HE depth%d - iLS \b", depth));
2547  hRate2->SetMarkerColor(2);
2548  hRate2->SetLineColor(0);
2549  hRate2->Draw("Error");
2550 
2551  if (LSofFirstErrB_HE == -1) {
2552  int nx = hRate2->GetXaxis()->GetNbins();
2553  for (int i = 1; i <= nx; i++) {
2554  double ccc1 = hRate2->GetBinContent(i);
2555  if (ccc1 > 0.) {
2556  cout << "****************>>>>>>>>>>> ErrB_HE bad LS start at iLS = " << i << " with rate = " << ccc1
2557  << endl;
2558  LSofFirstErrB_HE = i;
2559  break;
2560  }
2561  }
2562  }
2563 
2564  delete h1;
2565  delete h0;
2566  if (hRate2 != hRate2orig) {
2567  delete hRate2orig;
2568  hRate2orig = hRate2;
2569  }
2570  }
2571 
2572  cHB->Update();
2573  cHB->Print(Form("HistErrB_HE_%d.png", depth));
2574  cHB->Clear();
2575  if (h2Cefz6)
2576  delete h2Cefz6;
2577  if (hRate2orig)
2578  delete hRate2orig;
2579  }
2580  } // ErrorsB in HE
2581 
2582  //====================================================================== HO :
2583  //====================================================================== HO :
2584  //====================================================================== HO :
2585  // Special test of errors type A and B in HO
2586  // AZ 08.02.2016
2587 
2588  int flagErrAB_HO[2];
2589  flagErrAB_HO[0] = -1;
2590  flagErrAB_HO[1] = -1;
2591  double avedelta_HO = 0.;
2592  int lastLumiBin_HO = -1;
2593  int LSofFirstErrB_HO = -1;
2594  {
2595  const int specCountA = 4;
2596  const int specColors[specCountA] = {1, 2, 3, 4};
2597  const TString hnames[specCountA][2] = {{"h_sumADCAmplperLS8_P1", "h_sum0ADCAmplperLS8_P1"},
2598  {"h_sumADCAmplperLS8_P2", "h_sum0ADCAmplperLS8_P2"},
2599  {"h_sumADCAmplperLS8_M1", "h_sum0ADCAmplperLS8_M1"},
2600  {"h_sumADCAmplperLS8_M2", "h_sum0ADCAmplperLS8_M2"}};
2601 
2602  std::vector<TH1F *> hV;
2603  THStack *hs = new THStack("hs", "ADCAmplerLS1");
2604  cHB->Clear();
2605  // cHB->cd();
2606  cHB->Divide(2, 1);
2607  cHB->cd(1);
2608 
2610  for (int i = 0; i < specCountA; i++) {
2611  if (1)
2612  std::cout << "debugger: errA_HO : get histos for i=" << i << " " << hnames[i][0] << " and " << hnames[i][1]
2613  << "\n";
2614  TH1F *h1 = (TH1F *)dir->FindObjectAny(hnames[i][0]);
2615  TH1F *h0 = (TH1F *)dir->FindObjectAny(hnames[i][1]);
2616  if (!h1 || !h0) {
2617  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2618  ptext->AddText("Missing histo");
2619  if (!h1) {
2620  std::cout << "\tfailed to get " << hnames[i][0] << "\n";
2621  ptext->AddText(hnames[i][0]);
2622  }
2623  if (!h0) {
2624  std::cout << "\tfailed to get " << hnames[i][1] << "\n";
2625  ptext->AddText(hnames[i][1]);
2626  }
2627  ptext->Draw();
2628  continue;
2629  }
2630  TH1F *hoRT1orig = (TH1F *)h1->Clone(Form("ERT1orig_%d", i));
2631  hoRT1orig->Divide(h1, h0, 1, 1, "B");
2632 
2633  if ((lastLumiBin_HO < 0) && (i == 0)) {
2634  for (int ibin = hoRT1orig->GetNbinsX(); ibin >= 1; ibin--) {
2635  if (hoRT1orig->GetBinContent(ibin) == 0)
2636  lastLumiBin_HO = ibin;
2637  else
2638  break;
2639  }
2640  lastLumiBin_HO += 3; // show more bins
2641  if (lastLumiBin_HO >= hoRT1orig->GetNbinsX())
2642  lastLumiBin_HO = -1;
2643  }
2644  TH1F *hoRT1 = NULL;
2645  if (lastLumiBin_HO > 1) {
2646  if (!copyContents(&hoRT1, Form("ERT1_%d", i), "", hoRT1orig, lastLumiBin_HO)) {
2647  std::cout << "code failed" << std::endl;
2648  gSystem->Exit(1);
2649  }
2650  } else
2651  hoRT1 = hoRT1orig;
2652 
2653  hoRT1->GetXaxis()->SetTitle("<ADCAmpl> per LS HO: black-P1, red-P2,green-M1,blue-M2");
2654  hV.push_back(hoRT1);
2655  hoRT1->SetMarkerStyle(20);
2656  hoRT1->SetMarkerSize(0.4);
2657  hoRT1->SetXTitle("<A>(ev.in LS & ch.) - HO P1 - iLS \b");
2658  hoRT1->SetMarkerColor(specColors[i]);
2659  hoRT1->SetLineColor(0);
2660  hs->Add(hoRT1);
2661  delete h1;
2662  delete h0;
2663  if (hoRT1 != hoRT1orig)
2664  delete hoRT1orig;
2665  }
2666  hs->Draw("LPE1 nostack");
2667  cHB->Update(); // activate tho axes
2668  hs->GetXaxis()->SetTitle("<A> per LS: black-P1, red-P2,green-M1,blue-M2");
2669  hs->Draw("LPE1 nostack");
2670  gPad->SetGridy();
2672 
2673  // AZ corrections 08.02.2016
2674  cHB->cd(2);
2675  TH1F *diff = new TH1F("diff", "", 100, 0., 4.);
2676 
2677  if (int(hV.size()) == specCountA) {
2678  flagErrAB_HO[0] = 0; // If we have tho expected number of histograms, set tho flag
2679  double sumdelta = 0.;
2680  int nnndelta = 0;
2681  for (int ibin = 1; ibin <= hV[0]->GetNbinsX(); ibin++) {
2682  double delta = 0.;
2683  double maxdelta = 0.;
2684  for (unsigned int i = 0; i < hV.size(); i++) {
2685  const TH1F *hi = hV[i];
2686  for (unsigned int j = 1; j < hV.size(); j++) {
2687  const TH1F *hj = hV[j];
2688  delta = fabs(hi->GetBinContent(ibin) - hj->GetBinContent(ibin));
2689  if (delta > maxdelta)
2690  maxdelta = delta;
2691  } //for
2692  } //for
2693  if (maxdelta > 0.) {
2694  diff->Fill(maxdelta);
2695  sumdelta += maxdelta;
2696  nnndelta++;
2697  }
2698  } //for ibin
2699  // avedelta_HO = sumdelta/hV[0]->GetNbinsX();
2700  avedelta_HO = sumdelta / nnndelta;
2701  std::cout << "******************>>>>>> ErrA_HO: avedelta_HO = " << avedelta_HO << std::endl;
2702  if (avedelta_HO > 0.8 || (avedelta_HO < 0.2 && avedelta_HO > 0.)) {
2703  flagErrAB_HO[0] = 1;
2704  } //if
2705  } //hV.size
2706  diff->SetMarkerStyle(20);
2707  diff->SetMarkerSize(0.8);
2708  diff->SetXTitle("max difference \b");
2709  diff->SetMarkerColor(2);
2710  diff->SetLineColor(0);
2711  gPad->SetGridx();
2712  gPad->SetLogy();
2713  diff->Draw("Error");
2715  cHB->Update();
2716  cHB->Print("HistErrA_HO.png");
2717  cHB->Clear();
2719 
2720  // clean-up
2721  if (diff)
2722  delete diff;
2723  for (unsigned int i = 0; i < hV.size(); i++)
2724  delete hV[i];
2725  } // ErrorA in HO
2726 
2728 
2729  { // errors type B
2730  const int specCountB = 2;
2731  const TString hnames[specCountB][2] = {{"h_2DsumErrorBLS8", "h_2D0sumErrorBLS8"},
2732  {"h_sumErrorBperLS8", "h_sum0ErrorBperLS8"}};
2733 
2734  for (int depth = 4; depth <= 4; depth++) {
2735  cHB->Clear();
2736  cHB->Divide(2, 1);
2737  cHB->cd(1);
2738 
2739  TH1F *hRate2orig = NULL;
2740  TH2F *h2Cefz6 = NULL;
2741  TString hname1 = hnames[2 * depth - 8][0];
2742  TString hname0 = hnames[2 * depth - 8][1];
2743  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
2744  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
2745  if (1)
2746  std::cout << "debugger: errB_HO depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2747  if (!twod1 || !twod0) {
2748  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2749  ptext->AddText("Missing histos");
2750  if (!twod1) {
2751  std::cout << "\tfailed to get " << hname1 << "\n";
2752  ptext->AddText(hname1);
2753  }
2754  if (!twod0) {
2755  std::cout << "\tfailed to get " << hname0 << "\n";
2756  ptext->AddText(hname0);
2757  }
2758  ptext->Draw();
2759  } else {
2760  h2Cefz6 = (TH2F *)twod1->Clone(Form("Cefz6_%d", depth));
2761  h2Cefz6->SetTitle(Form("HO Depth %d \b", depth));
2762  h2Cefz6->Divide(twod1, twod0, 1, 1, "B");
2763 
2764  gPad->SetGridy();
2765  gPad->SetGridx();
2766  gPad->SetLogz();
2767  h2Cefz6->SetTitle(Form("Depth %d \b", depth));
2768  h2Cefz6->SetMarkerStyle(20);
2769  h2Cefz6->SetMarkerSize(0.4);
2770  // h2Cefz6->GetZaxis()->SetLabelSize(0.04);
2771  h2Cefz6->SetXTitle("#eta \b");
2772  h2Cefz6->SetYTitle("#phi \b");
2773  h2Cefz6->SetZTitle(Form("<ErrorB> - HO Depth%d \b", depth));
2774  h2Cefz6->SetMarkerColor(2);
2775  h2Cefz6->SetLineColor(2);
2776  h2Cefz6->Draw("COLZ");
2777 
2778  delete twod1;
2779  delete twod0;
2780  } // histos ok
2781 
2782  cHB->cd(2);
2783  hname1 = hnames[2 * depth - 7][0];
2784  hname0 = hnames[2 * depth - 7][1];
2785  TH1F *h1 = (TH1F *)dir->FindObjectAny(hname1);
2786  TH1F *h0 = (TH1F *)dir->FindObjectAny(hname0);
2787  if (1)
2788  std::cout << "errB_HO depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
2789  if (!h1 || !h0) {
2790  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2791  ptext->AddText("Missing histo");
2792  if (!h1) {
2793  std::cout << "\tfailed to get " << hname1 << "\n";
2794  ptext->AddText(hname1);
2795  }
2796  if (!h0) {
2797  std::cout << "\tfailed to get " << hname0 << "\n";
2798  ptext->AddText(hname0);
2799  }
2800  ptext->Draw();
2801  } else {
2802  gPad->SetGridx();
2803  gPad->SetGridy();
2804  // gPad->SetLogy();
2805  hRate2orig = (TH1F *)h1->Clone(Form("Rate2orig_%d", depth));
2806  hRate2orig->Divide(h1, h0, 1, 1, "B");
2807 
2808  TH1F *hRate2 = NULL;
2809  if (lastLumiBin_HO > 1) {
2810  if (!copyContents(&hRate2, Form("Rate2_%d", depth), "", hRate2orig, lastLumiBin_HO)) {
2811  std::cout << "code failed" << std::endl;
2812  gSystem->Exit(1);
2813  }
2814  } else
2815  hRate2 = hRate2orig;
2816 
2817  hRate2->SetTitle(Form("Depth %d \b", depth));
2818  hRate2->SetMarkerStyle(20);
2819  hRate2->SetMarkerSize(0.8);
2820  // hRate2->GetZaxis()->SetLabelSize(0.04);
2821  hRate2->SetXTitle(Form("<ErrorB>(ev.in LS & ch.) - HO depth%d - iLS \b", depth));
2822  hRate2->SetMarkerColor(2);
2823  hRate2->SetLineColor(0);
2824  hRate2->Draw("Error");
2825 
2826  if (LSofFirstErrB_HO == -1) {
2827  int nx = hRate2->GetXaxis()->GetNbins();
2828  for (int i = 1; i <= nx; i++) {
2829  double ccc1 = hRate2->GetBinContent(i);
2830  if (ccc1 > 0.) {
2831  cout << "****************>>>>>>>>>>> ErrB_HO bad LS start at iLS = " << i << " with rate = " << ccc1
2832  << endl;
2833  LSofFirstErrB_HO = i;
2834  break;
2835  }
2836  }
2837  }
2838 
2839  delete h1;
2840  delete h0;
2841  if (hRate2 != hRate2orig) {
2842  delete hRate2orig;
2843  hRate2orig = hRate2;
2844  }
2845  }
2846 
2847  cHB->Update();
2848  cHB->Print(Form("HistErrB_HO_%d.png", depth));
2849  cHB->Clear();
2850  if (h2Cefz6)
2851  delete h2Cefz6;
2852  if (hRate2orig)
2853  delete hRate2orig;
2854  }
2855  } // ErrorsB in HO
2856 
2857  //====================================================================== done by Andrius for HF:
2858  //====================================================================== done by Andrius for HF:
2859  //====================================================================== done by Andrius for HF:
2860  // Special test of errors type A and B in HF
2861 
2862  int flagErrAB_HF[2];
2863  flagErrAB_HF[0] = -1;
2864  flagErrAB_HF[1] = -1;
2865  double avedelta_HF = 0.;
2866  int lastLumiBin_HF = -1;
2867  int LSofFirstErrB_HF = -1;
2868  {
2869  const int specCountA = 4;
2870  const int specColors[specCountA] = {1, 2, 3, 4};
2871  const TString hnames[specCountA][2] = {{"h_sumADCAmplperLS6_P1", "h_sum0ADCAmplperLS6_P1"},
2872  {"h_sumADCAmplperLS6_P2", "h_sum0ADCAmplperLS6_P2"},
2873  {"h_sumADCAmplperLS6_M1", "h_sum0ADCAmplperLS6_M1"},
2874  {"h_sumADCAmplperLS6_M2", "h_sum0ADCAmplperLS6_M2"}};
2875 
2876  std::vector<TH1F *> hV;
2877  THStack *hs = new THStack("hs", "ADCAmplerLS6");
2878  cHB->Clear();
2879  // cHB->cd();
2880  cHB->Divide(2, 1);
2881  cHB->cd(1);
2882 
2884  for (int i = 0; i < specCountA; i++) {
2885  if (1)
2886  std::cout << "debugger: errA_HF : get histos for i=" << i << " " << hnames[i][0] << " and " << hnames[i][1]
2887  << "\n";
2888  TH1F *h1 = (TH1F *)dir->FindObjectAny(hnames[i][0]);
2889  TH1F *h0 = (TH1F *)dir->FindObjectAny(hnames[i][1]);
2890  if (!h1 || !h0) {
2891  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
2892  ptext->AddText("Missing histo");
2893  if (!h1) {
2894  std::cout << "\tfailed to get " << hnames[i][0] << "\n";
2895  ptext->AddText(hnames[i][0]);
2896  }
2897  if (!h0) {
2898  std::cout << "\tfailed to get " << hnames[i][1] << "\n";
2899  ptext->AddText(hnames[i][1]);
2900  }
2901  ptext->Draw();
2902  continue;
2903  }
2904  TH1F *hERT1orig = (TH1F *)h1->Clone(Form("ERT1orig_%d", i));
2905  hERT1orig->Divide(h1, h0, 1, 1, "B");
2906 
2907  if ((lastLumiBin_HF < 0) && (i == 0)) {
2908  for (int ibin = hERT1orig->GetNbinsX(); ibin >= 1; ibin--) {
2909  if (hERT1orig->GetBinContent(ibin) == 0)
2910  lastLumiBin_HF = ibin;
2911  else
2912  break;
2913  }
2914  lastLumiBin_HF += 3; // show more bins
2915  if (lastLumiBin_HF >= hERT1orig->GetNbinsX())
2916  lastLumiBin_HF = -1;
2917  }
2918  TH1F *hERT1 = NULL;
2919  if (lastLumiBin_HF > 1) {
2920  if (!copyContents(&hERT1, Form("ERT1_%d", i), "", hERT1orig, lastLumiBin_HF)) {
2921  std::cout << "code failed" << std::endl;
2922  gSystem->Exit(1);
2923  }
2924  } else
2925  hERT1 = hERT1orig;
2926 
2927  hERT1->GetXaxis()->SetTitle("<ADCAmpl> per LS HF: black-P1, red-P2,green-M1,blue-M2");
2928  hV.push_back(hERT1);
2929  hERT1->SetMarkerStyle(20);
2930  hERT1->SetMarkerSize(0.4);
2931  hERT1->SetXTitle("<A>(ev.in LS & ch.) - HF P1 - iLS \b");
2932  hERT1->SetMarkerColor(specColors[i]);
2933  hERT1->SetLineColor(0);
2934  hs->Add(hERT1);
2935  delete h1;
2936  delete h0;
2937  if (hERT1 != hERT1orig)
2938  delete hERT1orig;
2939  }
2940  hs->Draw("LPE1 nostack");
2941  cHB->Update(); // activate the axes
2942  hs->GetXaxis()->SetTitle("<A> per LS: black-P1, red-P2,green-M1,blue-M2");
2943  hs->Draw("LPE1 nostack");
2944  gPad->SetGridy();
2946 
2947  // AZ corrections 04.02.2016
2948  cHB->cd(2);
2949  TH1F *diff = new TH1F("diff", "", 100, 0., 4.);
2950 
2951  if (int(hV.size()) == specCountA) {
2952  flagErrAB_HF[0] = 0; // If we have the expected number of histograms, set the flag
2953  double sumdelta = 0.;
2954  int nnndelta = 0;
2955  std::cout << "******** GetNbinsX = " << hV[0]->GetNbinsX() << std::endl;
2956  for (int ibin = 1; ibin <= hV[0]->GetNbinsX(); ibin++) {
2957  double delta = 0.;
2958  double maxdelta = 0.;
2959  for (unsigned int i = 0; i < hV.size(); i++) {
2960  const TH1F *hi = hV[i];
2961  for (unsigned int j = 1; j < hV.size(); j++) {
2962  const TH1F *hj = hV[j];
2963  delta = fabs(hi->GetBinContent(ibin) - hj->GetBinContent(ibin));
2964  if (delta > maxdelta)
2965  maxdelta = delta;
2966  } //for
2967  } //for
2968  // std::cout << "***** ibin = " << ibin << " nnndelta= " << nnndelta << " maxdelta= " << maxdelta <<std::endl;
2969  if (maxdelta > 0.) {
2970  diff->Fill(maxdelta);
2971  sumdelta += maxdelta;
2972  nnndelta++;
2973  }
2974  } //for ibin
2975  // avedelta_HF = sumdelta/hV[0]->GetNbinsX();
2976  avedelta_HF = sumdelta / nnndelta;
2977  // std::cout << "******************>>>>>> ErrA_HF: avedelta_HF = " << avedelta_HF << " Npoints for comparison= " << nnndelta <<std::endl;
2978  if (avedelta_HF > 2.4 || (avedelta_HF < 0.8 && avedelta_HF > 0.)) {
2979  flagErrAB_HF[0] = 1;
2980  } //if
2981  } //hV.size
2982  diff->SetMarkerStyle(20);
2983  diff->SetMarkerSize(0.8);
2984  diff->SetXTitle("max difference \b");
2985  diff->SetMarkerColor(2);
2986  diff->SetLineColor(0);
2987  gPad->SetGridx();
2988  gPad->SetLogy();
2989  diff->Draw("Error");
2991  cHB->Update();
2992  cHB->Print("HistErrA_HF.png");
2993  cHB->Clear();
2995  // clean-up
2996  if (diff)
2997  delete diff;
2998  for (unsigned int i = 0; i < hV.size(); i++)
2999  delete hV[i];
3000  } // ErrorA in HF
3003  { // errors type B
3004  const int specCountB = 4;
3005  const TString hnames[specCountB][2] = {{"h_2DsumErrorBLS6", "h_2D0sumErrorBLS6"},
3006  {"h_sumErrorBperLS6", "h_sum0ErrorBperLS6"},
3007  {"h_2DsumErrorBLS7", "h_2D0sumErrorBLS7"},
3008  {"h_sumErrorBperLS7", "h_sum0ErrorBperLS7"}};
3009 
3010  for (int depth = 1; depth <= 2; depth++) {
3011  cHB->Clear();
3012  cHB->Divide(2, 1);
3013  cHB->cd(1);
3014  TH1F *hRate2orig = NULL;
3015  TH2F *h2Cefz6 = NULL;
3016  TString hname1 = hnames[2 * depth - 2][0];
3017  TString hname0 = hnames[2 * depth - 2][1];
3018  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
3019  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
3020  if (1)
3021  std::cout << "debugger: errB_HF depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
3022  if (!twod1 || !twod0) {
3023  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3024  ptext->AddText("Missing histos");
3025  if (!twod1) {
3026  std::cout << "\tfailed to get " << hname1 << "\n";
3027  ptext->AddText(hname1);
3028  }
3029  if (!twod0) {
3030  std::cout << "\tfailed to get " << hname0 << "\n";
3031  ptext->AddText(hname0);
3032  }
3033  ptext->Draw();
3034  } else {
3035  h2Cefz6 = (TH2F *)twod1->Clone(Form("Cefz6_%d", depth));
3036  h2Cefz6->SetTitle(Form("HF Depth %d \b", depth));
3037  h2Cefz6->Divide(twod1, twod0, 1, 1, "B");
3038 
3039  gPad->SetGridy();
3040  gPad->SetGridx();
3041  gPad->SetLogz();
3042  h2Cefz6->SetTitle(Form("Depth %d \b", depth));
3043  h2Cefz6->SetMarkerStyle(20);
3044  h2Cefz6->SetMarkerSize(0.4);
3045  // h2Cefz6->GetZaxis()->SetLabelSize(0.04);
3046  h2Cefz6->SetXTitle("#eta \b");
3047  h2Cefz6->SetYTitle("#phi \b");
3048  h2Cefz6->SetZTitle(Form("<ErrorB> - HF Depth%d \b", depth));
3049  h2Cefz6->SetMarkerColor(2);
3050  h2Cefz6->SetLineColor(2);
3051  h2Cefz6->Draw("COLZ");
3052  delete twod1;
3053  delete twod0;
3054  } // histos ok
3055  cHB->cd(2);
3056  hname1 = hnames[2 * depth - 1][0];
3057  hname0 = hnames[2 * depth - 1][1];
3058  TH1F *h1 = (TH1F *)dir->FindObjectAny(hname1);
3059  TH1F *h0 = (TH1F *)dir->FindObjectAny(hname0);
3060  if (1)
3061  std::cout << "errB_HF depth=" << depth << ". get 2D histos " << hname1 << " and " << hname0 << "\n";
3062  if (!h1 || !h0) {
3063  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3064  ptext->AddText("Missing histo");
3065  if (!h1) {
3066  std::cout << "\tfailed to get " << hname1 << "\n";
3067  ptext->AddText(hname1);
3068  }
3069  if (!h0) {
3070  std::cout << "\tfailed to get " << hname0 << "\n";
3071  ptext->AddText(hname0);
3072  }
3073  ptext->Draw();
3074  } else {
3075  gPad->SetGridx();
3076  gPad->SetGridy();
3077  // gPad->SetLogy();
3078  hRate2orig = (TH1F *)h1->Clone(Form("Rate2orig_%d", depth));
3079  hRate2orig->Divide(h1, h0, 1, 1, "B");
3080 
3081  TH1F *hRate2 = NULL;
3082  if (lastLumiBin_HF > 1) {
3083  if (!copyContents(&hRate2, Form("Rate2_%d", depth), "", hRate2orig, lastLumiBin_HF)) {
3084  std::cout << "code failed" << std::endl;
3085  gSystem->Exit(1);
3086  }
3087  } else
3088  hRate2 = hRate2orig;
3089  hRate2->SetTitle(Form("Depth %d \b", depth));
3090  hRate2->SetMarkerStyle(20);
3091  hRate2->SetMarkerSize(0.8);
3092  // hRate2->GetZaxis()->SetLabelSize(0.04);
3093  hRate2->SetXTitle(Form("<ErrorB>(ev.in LS & ch.) - HF depth%d - iLS \b", depth));
3094  hRate2->SetMarkerColor(2);
3095  hRate2->SetLineColor(0);
3096  hRate2->Draw("Error");
3097  if (LSofFirstErrB_HF == -1) {
3098  int nx = hRate2->GetXaxis()->GetNbins();
3099  for (int i = 1; i <= nx; i++) {
3100  double ccc1 = hRate2->GetBinContent(i);
3101  if (ccc1 > 0.) {
3102  cout << "****************>>>>>>>>>>> ErrB_HF bad LS start at iLS = " << i << " with rate = " << ccc1
3103  << endl;
3104  LSofFirstErrB_HF = i;
3105  break;
3106  }
3107  }
3108  }
3109  delete h1;
3110  delete h0;
3111  if (hRate2 != hRate2orig) {
3112  delete hRate2orig;
3113  hRate2orig = hRate2;
3114  }
3115  }
3116  cHB->Update();
3117  cHB->Print(Form("HistErrB_HF_%d.png", depth));
3118  cHB->Clear();
3119  if (h2Cefz6)
3120  delete h2Cefz6;
3121  if (hRate2orig)
3122  delete hRate2orig;
3123  }
3124  } // ErrorsB in HF
3125 
3127 
3128  //=============================================================================== err A HB
3130  // For 2D and 1D plots with Amplitude. Produces ChkErrA_HBx.png
3131 
3132  for (int depth = 1; depth <= 2; depth++) {
3133  TH2F *h2Ceff = NULL;
3134  TH2F *h2Diffe = NULL;
3135  // TH1F* h1diffADCAmpl= NULL;
3136  TH2F *h3Ceff = NULL;
3137 
3138  cHE->Clear();
3139  cHE->Divide(3, 1);
3140 
3141  cHE->cd(1);
3142  // h_mapDepth1ADCAmpl_HB div h_mapDepth1_HB
3143  TString hname1 = Form("h_mapDepth%dADCAmpl_HB", depth);
3144  TString hname0 = Form("h_mapDepth%d_HB", depth);
3145  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
3146  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
3147  if (!twod1 || !twod0) {
3148  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3149  ptext->AddText("Missing histo");
3150  std::cout << "specHB test: failed to load " << hname1 << " and/or " << hname0 << "\n";
3151  if (!twod1)
3152  ptext->AddText(hname1);
3153  if (!twod0)
3154  ptext->AddText(hname0);
3155  ptext->Draw();
3156  continue;
3157  } else {
3158  // To IDENTIFY: see color different bins in eta-phi space
3159  h2Ceff = (TH2F *)twod1->Clone(Form("Ceff_HB%d", depth));
3160  h2Ceff->SetTitle(Form("HB Depth %d. (No cut) \b", depth));
3161  h2Ceff->Divide(twod1, twod0, 1, 1, "B");
3162 
3163  gPad->SetGridy();
3164  gPad->SetGridx();
3165  gPad->SetLogz();
3166  h2Ceff->SetMarkerStyle(20);
3167  h2Ceff->SetMarkerSize(0.4);
3168  //h2Ceff->GetZaxis()->SetLabelSize(0.08);
3169  h2Ceff->SetXTitle("#eta \b");
3170  h2Ceff->SetYTitle("#phi \b");
3171  h2Ceff->SetZTitle("h_mapDepth1ADCAmpl_HB \b");
3172  h2Ceff->SetMarkerColor(2);
3173  h2Ceff->SetLineColor(2);
3174  h2Ceff->Draw("COLZ");
3175  }
3176 
3177  cHE->cd(2);
3179  if (h2Ceff) {
3180  // TO IDENTIFY: see red bins in eta-phi space
3181  h2Diffe = (TH2F *)h2Ceff->Clone(Form("Diffe_Depth%d_HB", depth));
3182  h2Diffe->SetTitle(Form("HB Depth %d. Cut avg(ADCAmpl) > 25 \b", depth));
3183  int nx = h2Ceff->GetXaxis()->GetNbins();
3184  int ny = h2Ceff->GetYaxis()->GetNbins();
3185  for (int i = 1; i <= nx; i++) {
3186  for (int j = 1; j <= ny; j++) {
3187  double ccc1 = h2Ceff->GetBinContent(i, j);
3188  h2Diffe->SetBinContent(i, j, 0.);
3189  if (ccc1 > 25.)
3190  h2Diffe->SetBinContent(i, j, ccc1);
3191  }
3192  }
3193  gPad->SetGridy();
3194  gPad->SetGridx();
3195  gPad->SetLogz();
3196  h2Diffe->SetMarkerStyle(20);
3197  h2Diffe->SetMarkerSize(0.4);
3198  //h2Diffe->GetZaxis()->SetLabelSize(0.08);
3199  h2Diffe->SetXTitle("#eta \b");
3200  h2Diffe->SetYTitle("#phi \b");
3201  h2Diffe->SetZTitle("<ADCAmpl> bigger 25.- HB Depth1 \b");
3202  h2Diffe->SetMarkerColor(2);
3203  h2Diffe->SetLineColor(2);
3204  h2Diffe->Draw("COLZ");
3205  }
3206 
3207  cHE->cd(3);
3208  TString hname3 = Form("h_mapDepth%dADCAmpl225Copy_HB", depth);
3209  TH2F *twod3 = (TH2F *)dir->FindObjectAny(hname3);
3210  if (!twod3 || !twod0) {
3211  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3212  ptext->AddText("Missing histo");
3213  std::cout << "specHB test: failed to load " << hname3 << " and/or " << hname0 << "\n";
3214  if (!twod3)
3215  ptext->AddText(hname3);
3216  if (!twod0)
3217  ptext->AddText(hname0);
3218  ptext->Draw();
3219  continue;
3220  } else {
3221  // To IDENTIFY: see color different bins in eta-phi space
3222  h3Ceff = (TH2F *)twod3->Clone(Form("CeffA_HB%d", depth));
3223  h3Ceff->SetTitle(Form("HB Depth %d. \b", depth));
3224  h3Ceff->Divide(twod3, twod0, 1, 1, "B");
3225  gPad->SetGridy();
3226  gPad->SetGridx();
3227  gPad->SetLogz();
3228  h3Ceff->SetMarkerStyle(20);
3229  h3Ceff->SetMarkerSize(0.4);
3230  // h3Ceff->GetZaxis()->SetLabelSize(0.08);
3231  h3Ceff->SetXTitle("#eta \b");
3232  h3Ceff->SetYTitle("#phi \b");
3233  h3Ceff->SetZTitle("rate for channels of HB \b");
3234  h3Ceff->SetMarkerColor(2);
3235  h3Ceff->SetLineColor(2);
3236  h3Ceff->Draw("COLZ");
3237  }
3238 
3239  cHE->Update();
3240  cHE->Print(Form("ChkErrA_HB%d.png", depth));
3241  cHE->Clear();
3242 
3243  if (h2Ceff)
3244  delete h2Ceff;
3245  if (h2Diffe)
3246  delete h2Diffe;
3247  // if (h1diffADCAmpl) delete h1diffADCAmpl;
3248  // if (twod0) delete twod0;// do not delete - sometimes causes trouble later
3249  if (twod1)
3250  delete twod1;
3251  if (twod3)
3252  delete twod3;
3253  if (h3Ceff)
3254  delete h3Ceff;
3255  } // depth
3256 
3257  //=============================================================================== err A HE
3259  // For 2D and 1D plots with Amplitude. Produces ChkErrA_HEx.png
3260 
3261  for (int depth = 1; depth <= 3; depth++) {
3262  TH2F *h2Ceff = NULL;
3263  TH2F *h2Diffe = NULL;
3264  // TH1F* h1diffADCAmpl= NULL;
3265  TH2F *h3Ceff = NULL;
3266 
3267  cHE->Clear();
3268  cHE->Divide(3, 1);
3269 
3270  cHE->cd(1);
3271  // h_mapDepth1ADCAmpl_HE div h_mapDepth1_HE
3272  TString hname1 = Form("h_mapDepth%dADCAmpl_HE", depth);
3273  TString hname0 = Form("h_mapDepth%d_HE", depth);
3274  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
3275  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
3276  if (!twod1 || !twod0) {
3277  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3278  ptext->AddText("Missing histo");
3279  std::cout << "specHE test: failed to load " << hname1 << " and/or " << hname0 << "\n";
3280  if (!twod1)
3281  ptext->AddText(hname1);
3282  if (!twod0)
3283  ptext->AddText(hname0);
3284  ptext->Draw();
3285  continue;
3286  } else {
3287  // To IDENTIFY: see color different bins in eta-phi space
3288  h2Ceff = (TH2F *)twod1->Clone(Form("Ceff_HE%d", depth));
3289  h2Ceff->SetTitle(Form("HE Depth %d. (No cut) \b", depth));
3290  h2Ceff->Divide(twod1, twod0, 1, 1, "B");
3291 
3292  gPad->SetGridy();
3293  gPad->SetGridx();
3294  gPad->SetLogz();
3295  h2Ceff->SetTitleOffset(0.75, "Z");
3296  h2Ceff->SetMarkerStyle(20);
3297  h2Ceff->SetMarkerSize(0.4);
3298  //h2Ceff->GetZaxis()->SetLabelSize(0.08);
3299  h2Ceff->SetXTitle("#eta \b");
3300  h2Ceff->SetYTitle("#phi \b");
3301  h2Ceff->SetZTitle("h_mapDepth1ADCAmpl_HE \b");
3302  h2Ceff->SetMarkerColor(2);
3303  h2Ceff->SetLineColor(2);
3304  h2Ceff->Draw("COLZ");
3305  }
3306 
3307  cHE->cd(2);
3309  if (h2Ceff) {
3310  // TO IDENTIFY: see red bins in eta-phi space
3311  h2Diffe = (TH2F *)h2Ceff->Clone(Form("Diffe_Depth%d_HE", depth));
3312  h2Diffe->SetTitle(Form("HE Depth %d. Cut avg(ADCAmpl) > 1000 fC \b", depth));
3313  int nx = h2Ceff->GetXaxis()->GetNbins();
3314  int ny = h2Ceff->GetYaxis()->GetNbins();
3315  for (int i = 1; i <= nx; i++) {
3316  for (int j = 1; j <= ny; j++) {
3317  double ccc1 = h2Ceff->GetBinContent(i, j);
3318  h2Diffe->SetBinContent(i, j, 0.);
3319  if (ccc1 > 1000.)
3320  h2Diffe->SetBinContent(i, j, ccc1);
3321  }
3322  }
3323  gPad->SetGridy();
3324  gPad->SetGridx();
3325  gPad->SetLogz();
3326  h2Diffe->SetMarkerStyle(20);
3327  h2Diffe->SetMarkerSize(0.4);
3328  //h2Diffe->GetZaxis()->SetLabelSize(0.08);
3329  h2Diffe->SetXTitle("#eta \b");
3330  h2Diffe->SetYTitle("#phi \b");
3331  h2Diffe->SetZTitle("<ADCAmpl> bigger 1000.fC - HE Depth1 \b");
3332  h2Diffe->SetMarkerColor(2);
3333  h2Diffe->SetLineColor(2);
3334  h2Diffe->Draw("COLZ");
3335  }
3336 
3337  cHE->cd(3);
3338  TString hname3 = Form("h_mapDepth%dADCAmpl225Copy_HE", depth);
3339  TH2F *twod3 = (TH2F *)dir->FindObjectAny(hname3);
3340  if (!twod3 || !twod0) {
3341  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3342  ptext->AddText("Missing histo");
3343  std::cout << "specHE test: failed to load " << hname3 << " and/or " << hname0 << "\n";
3344  if (!twod3)
3345  ptext->AddText(hname3);
3346  if (!twod0)
3347  ptext->AddText(hname0);
3348  ptext->Draw();
3349  continue;
3350  } else {
3351  // To IDENTIFY: see color different bins in eta-phi space
3352  h3Ceff = (TH2F *)twod3->Clone(Form("CeffA_HE%d", depth));
3353  h3Ceff->SetTitle(Form("HE Depth %d. \b", depth));
3354  h3Ceff->Divide(twod3, twod0, 1, 1, "B");
3355  gPad->SetGridy();
3356  gPad->SetGridx();
3357  gPad->SetLogz();
3358  h3Ceff->SetMarkerStyle(20);
3359  h3Ceff->SetMarkerSize(0.4);
3360  // h3Ceff->GetZaxis()->SetLabelSize(0.08);
3361  h3Ceff->SetXTitle("#eta \b");
3362  h3Ceff->SetYTitle("#phi \b");
3363  h3Ceff->SetZTitle("rate for channels of HE \b");
3364  h3Ceff->SetMarkerColor(2);
3365  h3Ceff->SetLineColor(2);
3366  h3Ceff->Draw("COLZ");
3367  }
3368 
3369  cHE->Update();
3370  cHE->Print(Form("ChkErrA_HE%d.png", depth));
3371  cHE->Clear();
3372 
3373  if (h2Ceff)
3374  delete h2Ceff;
3375  if (h2Diffe)
3376  delete h2Diffe;
3377  // if (h1diffADCAmpl) delete h1diffADCAmpl;
3378  // if (twod0) delete twod0;// do not delete - sometimes causes trouble later
3379  if (twod1)
3380  delete twod1;
3381  if (twod3)
3382  delete twod3;
3383  if (h3Ceff)
3384  delete h3Ceff;
3385  } // depth
3386 
3387  //=============================================================================== err A HO
3389  // For 2D and 1D plots with Amplitude. Produces ChkErrA_HOx.png
3390 
3391  for (int depth = 4; depth <= 4; depth++) {
3392  TH2F *h2Ceff = NULL;
3393  TH2F *h2Diffe = NULL;
3394  // TH1F* h1diffADCAmpl= NULL;
3395  TH2F *h3Ceff = NULL;
3396 
3397  cHE->Clear();
3398  cHE->Divide(3, 1);
3399 
3400  cHE->cd(1);
3401  // h_mapDepth1ADCAmpl_HO div h_mapDepth1_HO
3402  TString hname1 = Form("h_mapDepth%dADCAmpl_HO", depth);
3403  TString hname0 = Form("h_mapDepth%d_HO", depth);
3404  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
3405  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
3406  if (!twod1 || !twod0) {
3407  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3408  ptext->AddText("Missing histo");
3409  std::cout << "specHO test: failed to load " << hname1 << " and/or " << hname0 << "\n";
3410  if (!twod1)
3411  ptext->AddText(hname1);
3412  if (!twod0)
3413  ptext->AddText(hname0);
3414  ptext->Draw();
3415  continue;
3416  } else {
3417  // To IDENTIFY: see color different bins in eta-phi space
3418  h2Ceff = (TH2F *)twod1->Clone(Form("Ceff_HO%d", depth));
3419  h2Ceff->SetTitle(Form("HO Depth %d. (No cut) \b", depth));
3420  h2Ceff->Divide(twod1, twod0, 1, 1, "B");
3421 
3422  gPad->SetGridy();
3423  gPad->SetGridx();
3424  gPad->SetLogz();
3425  h2Ceff->SetMarkerStyle(20);
3426  h2Ceff->SetMarkerSize(0.4);
3427  //h2Ceff->GetZaxis()->SetLabelSize(0.08);
3428  h2Ceff->SetXTitle("#eta \b");
3429  h2Ceff->SetYTitle("#phi \b");
3430  h2Ceff->SetZTitle("h_mapDepth1ADCAmpl_HO \b");
3431  h2Ceff->SetMarkerColor(2);
3432  h2Ceff->SetLineColor(2);
3433  h2Ceff->Draw("COLZ");
3434  }
3435 
3436  cHE->cd(2);
3438  if (h2Ceff) {
3439  // TO IDENTIFY: see red bins in eta-phi space (applied cut on Aij: <20 || >3000
3440  h2Diffe = (TH2F *)h2Ceff->Clone(Form("Diffe_Depth%d_HO", depth));
3441  h2Diffe->SetTitle(Form("HO Depth %d. Cut avg(ADCAmpl) > 80 \b", depth));
3442  int nx = h2Ceff->GetXaxis()->GetNbins();
3443  int ny = h2Ceff->GetYaxis()->GetNbins();
3444  for (int i = 1; i <= nx; i++) {
3445  for (int j = 1; j <= ny; j++) {
3446  double ccc1 = h2Ceff->GetBinContent(i, j);
3447  h2Diffe->SetBinContent(i, j, 0.);
3448  if (ccc1 > 20.)
3449  h2Diffe->SetBinContent(i, j, ccc1);
3450  }
3451  }
3452  gPad->SetGridy();
3453  gPad->SetGridx();
3454  gPad->SetLogz();
3455  h2Diffe->SetMarkerStyle(20);
3456  h2Diffe->SetMarkerSize(0.4);
3457  //h2Diffe->GetZaxis()->SetLabelSize(0.08);
3458  h2Diffe->SetXTitle("#eta \b");
3459  h2Diffe->SetYTitle("#phi \b");
3460  h2Diffe->SetZTitle("<ADCAmpl> bigger 80.- HO Depth1 \b");
3461  h2Diffe->SetMarkerColor(2);
3462  h2Diffe->SetLineColor(2);
3463  h2Diffe->Draw("COLZ");
3464  }
3465 
3466  cHE->cd(3);
3467  TString hname3 = Form("h_mapDepth%dADCAmpl225Copy_HO", depth);
3468  TH2F *twod3 = (TH2F *)dir->FindObjectAny(hname3);
3469  if (!twod3 || !twod0) {
3470  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3471  ptext->AddText("Missing histo");
3472  std::cout << "specHO test: failed to load " << hname3 << " and/or " << hname0 << "\n";
3473  if (!twod3)
3474  ptext->AddText(hname3);
3475  if (!twod0)
3476  ptext->AddText(hname0);
3477  ptext->Draw();
3478  continue;
3479  } else {
3480  // To IDENTIFY: see color different bins in eta-phi space
3481  h3Ceff = (TH2F *)twod3->Clone(Form("CeffA_HO%d", depth));
3482  h3Ceff->SetTitle(Form("HO Depth %d. \b", depth));
3483  h3Ceff->Divide(twod3, twod0, 1, 1, "B");
3484  gPad->SetGridy();
3485  gPad->SetGridx();
3486  gPad->SetLogz();
3487  h3Ceff->SetMarkerStyle(20);
3488  h3Ceff->SetMarkerSize(0.4);
3489  // h3Ceff->GetZaxis()->SetLabelSize(0.08);
3490  h3Ceff->SetXTitle("#eta \b");
3491  h3Ceff->SetYTitle("#phi \b");
3492  h3Ceff->SetZTitle("rate for channels of HO \b");
3493  h3Ceff->SetMarkerColor(2);
3494  h3Ceff->SetLineColor(2);
3495  h3Ceff->Draw("COLZ");
3496  }
3497 
3498  cHE->Update();
3499  cHE->Print(Form("ChkErrA_HO%d.png", depth));
3500  cHE->Clear();
3501 
3502  if (h2Ceff)
3503  delete h2Ceff;
3504  if (h2Diffe)
3505  delete h2Diffe;
3506  // if (h1diffADCAmpl) delete h1diffADCAmpl;
3507  // if (twod0) delete twod0;// do not delete - sometimes causes trouble later
3508  if (twod1)
3509  delete twod1;
3510  if (twod3)
3511  delete twod3;
3512  if (h3Ceff)
3513  delete h3Ceff;
3514  } // depth
3515 
3516  //=============================================================================== err A HF
3518  // For 2D and 1D plots with Amplitude. Produces ChkErrA_HFx.png
3519 
3520  for (int depth = 1; depth <= 2; depth++) {
3521  TH2F *h2Ceff = NULL;
3522  TH2F *h2Diffe = NULL;
3523  // TH1F* h1diffADCAmpl= NULL;
3524  TH2F *h3Ceff = NULL;
3525 
3526  cHE->Clear();
3527  cHE->Divide(3, 1);
3528 
3529  cHE->cd(1);
3530  // h_mapDepth1ADCAmpl_HF div h_mapDepth1_HF
3531  TString hname1 = Form("h_mapDepth%dADCAmpl_HF", depth);
3532  TString hname0 = Form("h_mapDepth%d_HF", depth);
3533  TH2F *twod1 = (TH2F *)dir->FindObjectAny(hname1);
3534  TH2F *twod0 = (TH2F *)dir->FindObjectAny(hname0);
3535  if (!twod1 || !twod0) {
3536  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3537  ptext->AddText("Missing histo");
3538  std::cout << "specHF test: failed to load " << hname1 << " and/or " << hname0 << "\n";
3539  if (!twod1)
3540  ptext->AddText(hname1);
3541  if (!twod0)
3542  ptext->AddText(hname0);
3543  ptext->Draw();
3544  continue;
3545  } else {
3546  // To IDENTIFY: see color different bins in eta-phi space
3547  h2Ceff = (TH2F *)twod1->Clone(Form("Ceff_HF%d", depth));
3548  h2Ceff->SetTitle(Form("HF Depth %d. (No cut) \b", depth));
3549  h2Ceff->Divide(twod1, twod0, 1, 1, "B");
3550 
3551  gPad->SetGridy();
3552  gPad->SetGridx();
3553  gPad->SetLogz();
3554  h2Ceff->SetMarkerStyle(20);
3555  h2Ceff->SetMarkerSize(0.4);
3556  //h2Ceff->GetZaxis()->SetLabelSize(0.08);
3557  h2Ceff->SetXTitle("#eta \b");
3558  h2Ceff->SetYTitle("#phi \b");
3559  h2Ceff->SetZTitle("h_mapDepth1ADCAmpl_HF \b");
3560  h2Ceff->SetMarkerColor(2);
3561  h2Ceff->SetLineColor(2);
3562  h2Ceff->Draw("COLZ");
3563  }
3564 
3565  cHE->cd(2);
3567  if (h2Ceff) {
3568  // TO IDENTIFY: see red bins in eta-phi space (applied cut on Aij: <20 || >3000
3569  h2Diffe = (TH2F *)h2Ceff->Clone(Form("Diffe_Depth%d_HF", depth));
3570  h2Diffe->SetTitle(Form("HF Depth %d. Cut avg(ADCAmpl) > 20 \b", depth));
3571  int nx = h2Ceff->GetXaxis()->GetNbins();
3572  int ny = h2Ceff->GetYaxis()->GetNbins();
3573  for (int i = 1; i <= nx; i++) {
3574  for (int j = 1; j <= ny; j++) {
3575  double ccc1 = h2Ceff->GetBinContent(i, j);
3576  h2Diffe->SetBinContent(i, j, 0.);
3577  if (ccc1 > 20.)
3578  h2Diffe->SetBinContent(i, j, ccc1);
3579  }
3580  }
3581  gPad->SetGridy();
3582  gPad->SetGridx();
3583  gPad->SetLogz();
3584  h2Diffe->SetMarkerStyle(20);
3585  h2Diffe->SetMarkerSize(0.4);
3586  //h2Diffe->GetZaxis()->SetLabelSize(0.08);
3587  h2Diffe->SetXTitle("#eta \b");
3588  h2Diffe->SetYTitle("#phi \b");
3589  h2Diffe->SetZTitle("<ADCAmpl> bigger 20.- HF Depth1 \b");
3590  h2Diffe->SetMarkerColor(2);
3591  h2Diffe->SetLineColor(2);
3592  h2Diffe->Draw("COLZ");
3593  }
3594 
3595  cHE->cd(3);
3596  /*
3597  if (h2Ceff) {
3598  h1diffADCAmpl = new TH1F(Form("diffADCAmpl_Depth%d_HF",depth),"",
3599  100, -20.,200.);
3600  h1diffADCAmpl->SetTitle(Form("HF Depth %d \b",depth));
3601  int nx = h2Ceff->GetXaxis()->GetNbins();
3602  int ny = h2Ceff->GetYaxis()->GetNbins();
3603  for (int i=1;i<=nx;i++) {
3604  for (int j=1;j<=ny;j++) {
3605  if(h2Ceff->GetBinContent(i,j) !=0 ) {
3606  double ccc1 = h2Ceff->GetBinContent(i,j) ;
3607  h1diffADCAmpl->Fill(ccc1);
3608  }
3609  }
3610  }
3611  gPad->SetLogy();
3612  h1diffADCAmpl->SetMarkerStyle(20);
3613  h1diffADCAmpl->SetMarkerSize(0.4);
3614  h1diffADCAmpl->GetYaxis()->SetLabelSize(0.04);
3615  h1diffADCAmpl->SetXTitle("<ADCAmpl> in each cell \b");
3616  h1diffADCAmpl->SetMarkerColor(2);
3617  h1diffADCAmpl->SetLineColor(2);
3618  h1diffADCAmpl->Draw("");
3619  }
3620  */
3621  TString hname3 = Form("h_mapDepth%dADCAmpl225Copy_HF", depth);
3622  TH2F *twod3 = (TH2F *)dir->FindObjectAny(hname3);
3623  if (!twod3 || !twod0) {
3624  TPaveText *ptext = new TPaveText(0.05, 0.85, 0.95, 0.95);
3625  ptext->AddText("Missing histo");
3626  std::cout << "specHF test: failed to load " << hname3 << " and/or " << hname0 << "\n";
3627  if (!twod3)
3628  ptext->AddText(hname3);
3629  if (!twod0)
3630  ptext->AddText(hname0);
3631  ptext->Draw();
3632  continue;
3633  } else {
3634  // To IDENTIFY: see color different bins in eta-phi space
3635  h3Ceff = (TH2F *)twod3->Clone(Form("CeffA_HF%d", depth));
3636  h3Ceff->SetTitle(Form("HF Depth %d. \b", depth));
3637  h3Ceff->Divide(twod3, twod0, 1, 1, "B");
3638  gPad->SetGridy();
3639  gPad->SetGridx();
3640  gPad->SetLogz();
3641  h3Ceff->SetMarkerStyle(20);
3642  h3Ceff->SetMarkerSize(0.4);
3643  // h3Ceff->GetZaxis()->SetLabelSize(0.08);
3644  h3Ceff->SetXTitle("#eta \b");
3645  h3Ceff->SetYTitle("#phi \b");
3646  h3Ceff->SetZTitle("rate for channels of HF \b");
3647  h3Ceff->SetMarkerColor(2);
3648  h3Ceff->SetLineColor(2);
3649  h3Ceff->Draw("COLZ");
3650  }
3651 
3652  cHE->Update();
3653  cHE->Print(Form("ChkErrA_HF%d.png", depth));
3654  cHE->Clear();
3655 
3656  if (h2Ceff)
3657  delete h2Ceff;
3658  if (h2Diffe)
3659  delete h2Diffe;
3660  // if (h1diffADCAmpl) delete h1diffADCAmpl;
3661  // if (twod0) delete twod0;// do not delete - sometimes causes trouble later
3662  if (twod1)
3663  delete twod1;
3664  if (twod3)
3665  delete twod3;
3666  if (h3Ceff)
3667  delete h3Ceff;
3668  } // depth
3669 
3670  std::cout << "************>>> average Amplitudes done" << std::endl;
3671 
3672  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3673  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3674  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3675  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3676  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3677 
3682  int MaxLum000000 = 0;
3683  MaxLum000000 = MaxLum;
3684 
3685  cout << " RBX analysis START for **************************" << endl;
3686  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3687  // int njeta = 22; int njphi = 18; int lsmax=2600;
3688  int njeta = 22;
3689  int njphi = 18;
3690  int lsmax0 = 1850;
3691  cout << ">>>>>>>>>>>>>>>>>>>>>>>> int njeta = 22; int njphi = 18; int lsmax0=1850; MaxLum = " << MaxLum << endl;
3692  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3693 
3694  if (MaxLum > lsmax0) {
3695  MaxLum = lsmax0;
3696  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3697  cout << "*********************************** EXCEEDED limit for MaxLum, it's bigger lsmax0. So we do limit "
3698  "MaxLum = lsmax0 "
3699  << endl;
3700  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3701  }
3702 
3703  int lsmax = MaxLum;
3704  //if (lsmax > 1800) lsmax = 1800;
3705  double alexall[njeta][njphi][lsmax];
3706 
3707  // for phi tables(!):
3708  double alexhb[njphi][lsmax];
3709  double alexhe[njphi][lsmax];
3710  double alexho[njphi][lsmax];
3711  double alexhf[njphi][lsmax];
3712 
3713  // for eta tables(!):
3714  double blexhb[njeta][lsmax];
3715  double blexhe[njeta][lsmax];
3716  double blexho[njeta][lsmax];
3717  double blexhf[njeta][lsmax];
3718 
3719  cout << ">>>>>>>>>>>>>>>>>>>>>>>> For massive:alexall AND for eta and phi tables:::: " << endl;
3720  cout << ">>>>>>>>>>>>>>>>>>>>>>>> alex... [njeta][njphi][lsmax]; lsmax = MaxLum; " << endl;
3721  cout << ">>>>>>>>>>>>>>>>>>>>>>>> alex... BUT, Max of lsmax = 1800 " << endl;
3722  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3723  int maxbinsRBX = MaxLum;
3724  int nx = maxbinsRBX; // # LS
3725  cout << ">>>>>>>>>>>>>>>>>>>>>>>> maxbinsRBX = MaxLum; " << endl;
3726  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
3727 
3728  for (int i = 0; i < nx; i++) {
3729  for (int jphi = 0; jphi < njphi; jphi++) {
3730  alexhb[jphi][i] = 0.;
3731  alexhe[jphi][i] = 0.;
3732  alexho[jphi][i] = 0.;
3733  alexhf[jphi][i] = 0.;
3734 
3735  for (int jeta = 0; jeta < njeta; jeta++) {
3736  if (jphi == 0) {
3737  blexhb[jeta][i] = 0.;
3738  blexhe[jeta][i] = 0.;
3739  blexho[jeta][i] = 0.;
3740  blexhf[jeta][i] = 0.;
3741  }
3742 
3743  alexall[jeta][jphi][i] = 0.;
3744  }
3745  }
3746  }
3747 
3749  /*
3750  // j = ietaphi = 1- 396
3751  int ietaphimax = 396;
3752  int ny = ietaphimax + 1 ;
3753  for (int j=1;j<ny;j++) {
3754  int jeta = (j-1)/znphi;
3755  int jphi = (j-1)-znphi*jeta+1;// jphi=1-18
3756  jeta += 1;// jeta = 1-22 }
3757 // Outout is jeta = 1-22 jphi=1-18
3758 HB: j = 7,8,9,10 11,12,13,14
3759 HE: j = 3,4,5, 6, 7 14,15,16,17,18
3760 HO: j = 7,8,9,10 11,12,13,14
3761 HF: j = 0,1,2, 3 18,19,20,21
3762 */
3763 
3765  //======================================================================
3766  //======================================================================
3767  //======================================================================
3768  cout << " RBX general for HB **************************" << endl;
3769  TH2F *Ghb1KKK = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs0");
3770  TH2F *Ghb1LLL = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs00");
3771  TH2F *Ghb1 = (TH2F *)Ghb1LLL->Clone("Ghb1");
3772  Ghb1->Divide(Ghb1KKK, Ghb1LLL, 1, 1, "B"); // average A
3773  // Ghb1->Sumw2();
3774  // int nx = Ghb1->GetXaxis()->GetNbins(); // # LS
3775  int ny = Ghb1->GetYaxis()->GetNbins(); // # jetaphi indexes = 396 = 18*22
3776  // cout<<"***************************************** HB 54 ny= "<< ny <<endl;
3777  for (int j = 1; j <= ny; j++) {
3778  int jeta = (j - 1) / njphi; // jeta = 0-21
3779  if (jeta > 6 && jeta < 15) {
3780  int jphi = (j - 1) - njphi * jeta; // jphi=0-17
3781  // cout<<"HB 54 jeta= "<< jeta <<" jphi = "<<jphi <<endl;
3782  // over LS:
3783  for (int i = 1; i <= nx; i++) {
3784  double ccc1 = Ghb1->GetBinContent(i, j);
3785  alexall[jeta][jphi][i - 1] = ccc1;
3786  // if( i == 1 ) cout<<"HB 54 for LS=1 ccc1= "<< ccc1 <<endl;
3787  // if( ccc1 <= 0 ) cout<<"HB 54 ccc1= "<< ccc1 <<" iLS= "<< i <<" eta= "<< jeta <<" phi= "<< jphi <<endl;
3788  // cout<<"HB 54 ccc1= "<< ccc1 <<" j= "<< j <<" iLS= "<< i <<" eta= "<< jeta <<" phi= "<< jphi <<endl;
3789  } //i
3790  } //if
3791  } //j
3792  // clean-up
3793  if (Ghb1KKK)
3794  delete Ghb1KKK;
3795  if (Ghb1LLL)
3796  delete Ghb1LLL;
3797  // if (Ghb1) delete Ghb1;
3798 
3799  //====================================================================== alexhb[k][i]
3800  for (int jphi = 0; jphi < njphi; jphi++) {
3801  for (int i = 0; i < nx; i++) {
3802  double sumccc1 = 0.;
3803  int isum = 0;
3804  for (int jeta = 0; jeta < njeta; jeta++) {
3805  double ccc1 = alexall[jeta][jphi][i];
3806  if (ccc1 > 0.) {
3807  sumccc1 += ccc1;
3808  isum++;
3809  }
3810  } // for jeta
3811  if (isum > 0.)
3812  sumccc1 /= isum;
3813  alexhb[jphi][i] = sumccc1;
3814  }
3815  } //for for
3816 
3817  //====================================================================== blexhb[k][i]
3818  for (int keta = 0; keta < njeta; keta++) {
3819  for (int i = 0; i < nx; i++) {
3820  double sumccc1 = 0.;
3821  int isum = 0;
3822  for (int kphi = 0; kphi < njphi; kphi++) {
3823  double ccc1 = alexall[keta][kphi][i];
3824  if (ccc1 > 0.) {
3825  sumccc1 += ccc1;
3826  isum++;
3827  }
3828  } // for kphi
3829  if (isum > 0.)
3830  sumccc1 /= isum;
3831  blexhb[keta][i] = sumccc1;
3832  }
3833  } //for for
3834 
3836  //========================================================================================== 11 HB:: 2D jeta = 0 - 21 jphi =0 - 17
3837  //======================================================================
3838  //======================================================================
3839  //======================================================================
3840  //======================================================================
3841  cout << " RBX HB 2D plot *****" << endl;
3842  cRBX1->Clear();
3844  cRBX1->Divide(1, 1);
3845  cRBX1->cd(1);
3846  // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ; k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
3847  // TH2F* Ghb42D = new TH2F("Ghb42D","", 22, -11., 11., 18, 0., 18. );
3848  // TH2F* Ghb42D0 = new TH2F("Ghb42D0","", 22, -11., 11., 18, 0., 18. );
3849  TH2F *Ghb42D = new TH2F("Ghb42D", "", 23, -11.5, 11.5, 18, 0., 18.);
3850  TH2F *Ghb42D0 = new TH2F("Ghb42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
3851  TH2F *Ghb42DF = (TH2F *)Ghb42D0->Clone("Ghb42DF");
3852  for (int jphi = 0; jphi < njphi; jphi++) {
3853  for (int jeta = 0; jeta < njeta; jeta++) {
3854  for (int i = 0; i < nx; i++) {
3855  double ccc1 = alexall[jeta][jphi][i];
3856  int neweta = jeta - 11 - 0.5;
3857  if (jeta >= 11)
3858  neweta = jeta - 11 + 1.5;
3859  if (ccc1 > 0.) {
3860  Ghb42D->Fill(neweta, jphi, ccc1);
3861  Ghb42D0->Fill(neweta, jphi, 1.);
3862  }
3863  // if(ccc1>0.) {Ghb42D ->Fill(jeta-11,jphi,ccc1); Ghb42D0 ->Fill(jeta-11,jphi,1.); }
3864  }
3865  }
3866  }
3867  Ghb42DF->Divide(Ghb42D, Ghb42D0, 1, 1, "B"); // average A
3868  // Ghb1->Sumw2();
3869  gPad->SetGridy();
3870  gPad->SetGridx(); // gPad->SetLogz();
3871  Ghb42DF->SetMarkerStyle(20);
3872  Ghb42DF->SetMarkerSize(0.4);
3873  Ghb42DF->GetZaxis()->SetLabelSize(0.04);
3874  Ghb42DF->SetXTitle("<A>_RBX #eta \b");
3875  Ghb42DF->SetYTitle(" #phi \b");
3876  Ghb42DF->SetZTitle("<A>_RBX - All \b");
3877  Ghb42DF->SetMarkerColor(2);
3878  Ghb42DF->SetLineColor(2); // Ghb42DF->SetMaximum(1.000); // Ghb42DF->SetMinimum(1.0);
3879  Ghb42DF->Draw("COLZ");
3880 
3882  cRBX1->Update();
3883  cRBX1->Print("RBX-HB-2Dplot.png");
3884  cRBX1->Clear();
3885  // clean-up
3886  if (Ghb42D)
3887  delete Ghb42D;
3888  if (Ghb42D0)
3889  delete Ghb42D0;
3890  if (Ghb42DF)
3891  delete Ghb42DF;
3892 
3893  //========================================================================================== 61 HB:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
3894  //======================================================================
3895  //======================================================================
3896  //======================================================================
3897  //======================================================================
3898  cout << " RBX HB 1D plot *****" << endl;
3899  cRBX1->Clear();
3901  cRBX1->Divide(1, 1);
3902  cRBX1->cd(1);
3903  TH1F *GphiHB1D = new TH1F("GphiHB1D", "", 18, 0., 18.);
3904  TH1F *GphiHB1D0 = new TH1F("GphiHB1D0", "", 18, 0., 18.);
3905  TH1F *GphiHB1DF = (TH1F *)GphiHB1D0->Clone("GphiHB1DF");
3906  for (int jphi = 0; jphi < 18; jphi++) {
3907  for (int jeta = 0; jeta < 22; jeta++) {
3908  for (int i = 0; i < nx; i++) {
3909  double ccc1 = alexall[jeta][jphi][i];
3910  if (ccc1 > 0.) {
3911  GphiHB1D->Fill(jphi, ccc1);
3912  GphiHB1D0->Fill(jphi, 1.);
3913  }
3914  }
3915  }
3916  }
3917  // GphiHB1D->Sumw2();GphiHB1D0->Sumw2();
3918  GphiHB1DF->Divide(GphiHB1D, GphiHB1D0, 1, 1, "B"); // average A
3919  // GphiHB1DF->Sumw2();
3920  for (int jphi = 1; jphi < 19; jphi++) {
3921  GphiHB1DF->SetBinError(jphi, 0.01);
3922  }
3923  gPad->SetGridy();
3924  gPad->SetGridx(); // gPad->SetLogz();
3925  GphiHB1DF->SetMarkerStyle(20);
3926  GphiHB1DF->SetMarkerSize(1.4);
3927  GphiHB1DF->GetZaxis()->SetLabelSize(0.08);
3928  GphiHB1DF->SetXTitle("PHI of RBX\b");
3929  GphiHB1DF->SetYTitle(" <Amplitude> \b");
3930  GphiHB1DF->SetZTitle("<A>_PHI - All \b");
3931  GphiHB1DF->SetMarkerColor(4);
3932  GphiHB1DF->SetLineColor(4);
3933  GphiHB1DF->SetMinimum(0.8); // GphiHB1DF->SetMaximum(1.000);
3934  GphiHB1DF->Draw("Error");
3936  cRBX1->Update();
3937  cRBX1->Print("RBX-HB-1Dplot.png");
3938  cRBX1->Clear();
3939  // clean-up
3940  if (GphiHB1D)
3941  delete GphiHB1D;
3942  if (GphiHB1D0)
3943  delete GphiHB1D0;
3944  if (GphiHB1DF)
3945  delete GphiHB1DF;
3946 
3947  //========================================================================================== 62 HB:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
3948  //======================================================================
3949  //======================================================================
3950  //======================================================================
3951  //======================================================================
3952  cout << " RBX HB 11D plot *eta*" << endl;
3953  cRBX1->Clear();
3955  cRBX1->Divide(1, 1);
3956  cRBX1->cd(1);
3957  TH1F *GetaHB11D = new TH1F("GetaHB11D", "", 23, -11.5, 11.5);
3958  TH1F *GetaHB11D0 = new TH1F("GetaHB11D0", "", 23, -11.5, 11.5);
3959  TH1F *GetaHB11DF = (TH1F *)GetaHB11D0->Clone("GetaHB11DF");
3960 
3961  for (int jeta = 0; jeta < 22; jeta++) {
3962  for (int jphi = 0; jphi < 18; jphi++) {
3963  for (int i = 0; i < nx; i++) {
3964  double ccc1 = alexall[jeta][jphi][i];
3965  int neweta = jeta - 11 - 0.5;
3966  if (jeta >= 11)
3967  neweta = jeta - 11 + 1.5;
3968  if (ccc1 > 0.) {
3969  GetaHB11D->Fill(neweta, ccc1);
3970  GetaHB11D0->Fill(neweta, 1.);
3971  // if( i == 0 ) cout<<"62 HB: ibin= "<< i <<" jphi= "<< jphi <<" jeta= "<< jeta <<" A= "<< ccc1 <<endl;
3972  }
3973  }
3974  }
3975  }
3976  // GetaHB11D->Sumw2();GetaHB11D0->Sumw2();
3977  GetaHB11DF->Divide(GetaHB11D, GetaHB11D0, 1, 1, "B"); // average A
3978  // GetaHB11DF->Sumw2();
3979  for (int jeta = 1; jeta < 24; jeta++) {
3980  GetaHB11DF->SetBinError(jeta, 0.01);
3981  }
3982  gPad->SetGridy();
3983  gPad->SetGridx(); // gPad->SetLogz();
3984  GetaHB11DF->SetMarkerStyle(20);
3985  GetaHB11DF->SetMarkerSize(1.4);
3986  GetaHB11DF->GetZaxis()->SetLabelSize(0.08);
3987  GetaHB11DF->SetXTitle("#eta \b");
3988  GetaHB11DF->SetYTitle(" <A> \b");
3989  GetaHB11DF->SetZTitle("<A>_ETA - All \b");
3990  GetaHB11DF->SetMarkerColor(4);
3991  GetaHB11DF->SetLineColor(4);
3992  GetaHB11DF->SetMinimum(0.8); // GetaHB11DF->SetMaximum(1.000);
3993  GetaHB11DF->Draw("Error");
3994 
3996  cRBX1->Update();
3997  cRBX1->Print("RBX-HB-11Dplot.png");
3998  cRBX1->Clear();
3999  // clean-up
4000  if (GetaHB11D)
4001  delete GetaHB11D;
4002  if (GetaHB11D0)
4003  delete GetaHB11D0;
4004  if (GetaHB11DF)
4005  delete GetaHB11DF;
4006 
4007  //========================================================================================== 22 HB:: Ratio plots jeta = 0 - 21 jphi =0 - 17
4008  //======================================================================
4009  //======================================================================22.11.2018
4010  //======================================================================
4011  //======================================================================
4012 
4013  gStyle->SetOptStat(1110000);
4014  cout << " RBX HB Ratio plots *****" << endl;
4015  cRBX31->Clear();
4017  // gain stabilitY:
4018  // Rij = Aij / A1j , where i-over LSs, j-channels
4019  //
4020  // nx = maxbinsRBX; // # LS
4021  //
4022  double ccc0HB = 0.;
4023  cRBX31->Divide(3, 1);
4024  //================
4025  cRBX31->cd(1);
4026  // TH1F* Ghb5 = new TH1F("Ghb5","", nx, 1., nx+1.);
4027  TH1F *Ghb51 = new TH1F("Ghb51", "", nx, 1., nx + 1.);
4028  TH1F *Ghb50 = new TH1F("Ghb50", "", nx, 1., nx + 1.);
4029  TH1F *Ghb5 = (TH1F *)Ghb50->Clone("Ghb5");
4030  // j - etaphi index:
4031  for (int j = 1; j <= ny; j++) {
4032  ccc0HB = Ghb1->GetBinContent(1, j);
4033  // 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;} }
4034  if (ccc0HB <= 0.)
4035  for (int i = 1; i <= nx; i++) {
4036  double ccc2 = Ghb1->GetBinContent(i, j);
4037  if (ccc2 > 0.) {
4038  ccc0HB = ccc2;
4039  break;
4040  }
4041  }
4042  if (ccc0HB > 0.) {
4043  // i - # LSs:
4044  for (int i = 1; i <= nx; i++) {
4045  double ccc1 = Ghb1->GetBinContent(i, j);
4046  if (ccc1 > 0.) {
4047  double Rij = ccc1 / ccc0HB;
4048  // Ghb5 ->Fill( float(i), Rij);
4049  Ghb51->Fill(float(i), Rij);
4050  Ghb50->Fill(float(i), 1.);
4051  }
4052  }
4053  }
4054  }
4055  Ghb5->Divide(Ghb51, Ghb50, 1, 1, "B"); // average A
4056  for (int i = 1; i <= nx; i++) {
4057  Ghb5->SetBinError(i, 0.0001);
4058  }
4059  Ghb5->SetMarkerStyle(20);
4060  Ghb5->SetMarkerSize(0.4);
4061  Ghb5->GetYaxis()->SetLabelSize(0.04);
4062  Ghb5->SetMarkerColor(2);
4063  Ghb5->SetLineColor(0);
4064  Ghb5->SetXTitle(" iLS \b");
4065  Ghb5->SetYTitle(" <R> \b");
4066  Ghb5->SetTitle("<Ri> vs iLS \b");
4067  Ghb5->SetMinimum(0.); //Ghb5->SetMaximum(2.5);
4068  // gPad->SetLogy();
4069  gPad->SetGridy();
4070  gPad->SetGridx();
4071  Ghb5->SetStats(0);
4072  Ghb5->GetYaxis()->SetLabelSize(0.025);
4073  Ghb5->Draw("Error");
4074  //================
4075  cRBX31->cd(2);
4076  TH2F *Ghb60 = new TH2F("Ghb60", "", 22, -11., 11., 18, 0., 18.);
4077  TH2F *Ghb61 = new TH2F("Ghb61", "", 22, -11., 11., 18, 0., 18.);
4078  TH2F *Ghb6 = new TH2F("Ghb6", "", 22, -11., 11., 18, 0., 18.);
4079 
4080  TH2F *G20hb60 = new TH2F("G20hb60", "", 22, -11., 11., 18, 0., 18.);
4081  TH2F *G20hb61 = new TH2F("G20hb61", "", 22, -11., 11., 18, 0., 18.);
4082  TH2F *G20hb6 = new TH2F("G20hb6", "", 22, -11., 11., 18, 0., 18.);
4083  TH2F *G30hb60 = new TH2F("G30hb60", "", 22, -11., 11., 18, 0., 18.);
4084  TH2F *G30hb61 = new TH2F("G30hb61", "", 22, -11., 11., 18, 0., 18.);
4085  TH2F *G30hb6 = new TH2F("G30hb6", "", 22, -11., 11., 18, 0., 18.);
4086  TH2F *G40hb60 = new TH2F("G40hb60", "", 22, -11., 11., 18, 0., 18.);
4087  TH2F *G40hb61 = new TH2F("G40hb61", "", 22, -11., 11., 18, 0., 18.);
4088  TH2F *G40hb6 = new TH2F("G40hb6", "", 22, -11., 11., 18, 0., 18.);
4089  // j - etaphi index; i - # LSs;
4090  //
4091  // define mean and RMS:
4092  double sumjHB = 0.;
4093  int njHB = 0;
4094  double meanjHB = 0.;
4095  for (int j = 1; j <= ny; j++) {
4096  ccc0HB = Ghb1->GetBinContent(1, j);
4097  if (ccc0HB <= 0.)
4098  for (int i = 1; i <= nx; i++) {
4099  double ccc2 = Ghb1->GetBinContent(i, j);
4100  if (ccc2 > 0.) {
4101  ccc0HB = ccc2;
4102  break;
4103  }
4104  }
4105  if (ccc0HB > 0.) {
4106  for (int i = 1; i <= nx; i++) {
4107  double ccc1 = Ghb1->GetBinContent(i, j) / ccc0HB;
4108  if (ccc1 > 0.) {
4109  sumjHB += ccc1;
4110  njHB++;
4111  }
4112  }
4113  meanjHB = sumjHB / njHB;
4114  }
4115  } // j
4116 
4117  double ssumjHB = 0.;
4118  njHB = 0;
4119  double sigmajHB = 0.;
4120  for (int j = 1; j <= ny; j++) {
4121  ccc0HB = Ghb1->GetBinContent(1, j);
4122  if (ccc0HB <= 0.)
4123  for (int i = 1; i <= nx; i++) {
4124  double ccc2 = Ghb1->GetBinContent(i, j);
4125  if (ccc2 > 0.) {
4126  ccc0HB = ccc2;
4127  break;
4128  }
4129  }
4130  if (ccc0HB > 0.) {
4131  for (int i = 1; i <= nx; i++) {
4132  double ccc1 = Ghb1->GetBinContent(i, j) / ccc0HB;
4133  if (ccc1 > 0.) {
4134  ssumjHB += (ccc1 - meanjHB) * (ccc1 - meanjHB);
4135  njHB++;
4136  }
4137  }
4138  sigmajHB = sqrt(ssumjHB / njHB);
4139  }
4140  } // j
4141 
4142  double dif3rmsHBMIN = meanjHB - 3 * sigmajHB;
4143  if (dif3rmsHBMIN < 0.)
4144  dif3rmsHBMIN = 0.;
4145  double dif3rmsHBMAX = meanjHB + 3 * sigmajHB;
4146  cout << "22HB-2 meanjHB= " << meanjHB << " sigmajHB= " << sigmajHB << " dif3rmsHBMIN= " << dif3rmsHBMIN
4147  << " dif3rmsHBMAX= " << dif3rmsHBMAX << endl;
4148 
4149  double MAXdif3rmsHBMIN = dif3rmsHBMIN;
4150  double MINdif3rmsHBMAX = dif3rmsHBMAX;
4151  if (MAXdif3rmsHBMIN < 0.95)
4152  MAXdif3rmsHBMIN = 0.95;
4153  if (MINdif3rmsHBMAX > 1.05)
4154  MINdif3rmsHBMAX = 1.05;
4155  cout << "22HB-2 MAXdif3rmsHBMIN= " << MAXdif3rmsHBMIN << " MINdif3rmsHBMAX= " << MINdif3rmsHBMAX << endl;
4156  //
4157  for (int j = 1; j <= ny; j++) {
4158  ccc0HB = Ghb1->GetBinContent(1, j);
4159  if (ccc0HB <= 0.)
4160  for (int i = 1; i <= nx; i++) {
4161  double ccc2 = Ghb1->GetBinContent(i, j);
4162  if (ccc2 > 0.) {
4163  ccc0HB = ccc2;
4164  break;
4165  }
4166  }
4167  if (ccc0HB > 0.) {
4168  int jeta = (j - 1) / 18; // jeta = 0-21
4169  int jphi = (j - 1) - 18 * jeta; // jphi=0-17
4170  // i - # LSs:
4171  for (int i = 1; i <= nx; i++) {
4172  double ccc1 = Ghb1->GetBinContent(i, j);
4173  if (ccc1 > 0.) {
4174  double Rij = ccc1 / ccc0HB;
4175  if (Rij < MAXdif3rmsHBMIN || Rij > MINdif3rmsHBMAX) {
4176  Ghb61->Fill(jeta - 11, jphi, Rij);
4177  Ghb60->Fill(jeta - 11, jphi, 1.);
4178  }
4179  if (Rij < 0.8 || Rij > 1.2) {
4180  G20hb61->Fill(jeta - 11, jphi, Rij);
4181  G20hb60->Fill(jeta - 11, jphi, 1.);
4182  }
4183  if (Rij < 0.7 || Rij > 1.3) {
4184  G30hb61->Fill(jeta - 11, jphi, Rij);
4185  G30hb60->Fill(jeta - 11, jphi, 1.);
4186  }
4187  if (Rij < 0.6 || Rij > 1.4) {
4188  G40hb61->Fill(jeta - 11, jphi, Rij);
4189  G40hb60->Fill(jeta - 11, jphi, 1.);
4190  }
4191  } //if(ccc1>0.
4192  } // i
4193  } //if(ccc0HB>0
4194  } // j
4195  Ghb6->Divide(Ghb61, Ghb60, 1, 1, "B"); // average R
4196  G20hb6->Divide(G20hb61, G20hb60, 1, 1, "B"); // average R
4197  G30hb6->Divide(G30hb61, G30hb60, 1, 1, "B"); // average R
4198  G40hb6->Divide(G40hb61, G40hb60, 1, 1, "B"); // average R
4199 
4200  Ghb6->GetZaxis()->SetLabelSize(0.025);
4201  Ghb6->SetXTitle(" #eta \b");
4202  Ghb6->SetYTitle(" #phi \b");
4203  Ghb6->SetTitle("<Rj> for |1-<R>| > 0.05 \b");
4204  Ghb6->SetStats(0);
4205  Ghb6->Draw("COLZ");
4206  //================
4207  cRBX31->cd(3);
4208  TH1F *Ghb7 = new TH1F("Ghb7", "", 120, 0.4, 1.6);
4209  // j - etaphi index:
4210  for (int j = 1; j <= ny; j++) {
4211  ccc0HB = Ghb1->GetBinContent(1, j);
4212  if (ccc0HB <= 0.)
4213  for (int i = 1; i <= nx; i++) {
4214  double ccc2 = Ghb1->GetBinContent(i, j);
4215  if (ccc2 > 0.) {
4216  ccc0HB = ccc2;
4217  break;
4218  }
4219  }
4220  if (ccc0HB > 0.) {
4221  // i - # LSs:
4222  for (int i = 1; i <= nx; i++) {
4223  double ccc1 = Ghb1->GetBinContent(i, j);
4224  if (ccc1 > 0.) {
4225  double Rij = ccc1 / ccc0HB;
4226  Ghb7->Fill(Rij);
4227  }
4228  }
4229  }
4230  }
4231  Ghb7->SetMarkerStyle(20);
4232  Ghb7->SetMarkerSize(0.4);
4233  Ghb7->GetYaxis()->SetLabelSize(0.04);
4234  Ghb7->SetMarkerColor(2);
4235  Ghb7->SetLineColor(0);
4236  Ghb7->SetYTitle(" N \b");
4237  Ghb7->SetXTitle(" Rij \b");
4238  Ghb7->SetTitle(" Rij \b");
4239  //Ghb7->SetMinimum(0.8);Ghb7->SetMaximum(500.);
4240  gPad->SetGridy();
4241  gPad->SetGridx(); // gPad->SetLogy();
4242  // Ghb7->SetStats(1110000);
4243  Ghb7->GetYaxis()->SetLabelSize(0.025);
4244  Ghb7->Draw("Error");
4245  Float_t ymaxHB = Ghb7->GetMaximum();
4246  cout << "22HB-3 ymaxHB= " << ymaxHB << " MAXdif3rmsHBMIN= " << MAXdif3rmsHBMIN
4247  << " MINdif3rmsHBMAX= " << MINdif3rmsHBMAX << endl;
4248  TLine *lineHB = new TLine(MAXdif3rmsHBMIN, 0., MAXdif3rmsHBMIN, ymaxHB);
4249  lineHB->SetLineColor(kBlue);
4250  lineHB->Draw();
4251  TLine *line1HB = new TLine(MINdif3rmsHBMAX, 0., MINdif3rmsHBMAX, ymaxHB);
4252  line1HB->SetLineColor(kBlue);
4253  line1HB->Draw();
4254  //================
4256  cRBX31->Update();
4257  cRBX31->Print("RBX-HB-3plots.png");
4258  cRBX31->Clear();
4259  // clean-up
4260  if (Ghb5)
4261  delete Ghb5;
4262  if (Ghb60)
4263  delete Ghb60;
4264  if (Ghb61)
4265  delete Ghb61;
4266  if (Ghb6)
4267  delete Ghb6;
4268  if (Ghb7)
4269  delete Ghb7;
4270 
4271  if (G20hb60)
4272  delete G20hb60;
4273  if (G20hb61)
4274  delete G20hb61;
4275  if (G30hb60)
4276  delete G30hb60;
4277  if (G30hb61)
4278  delete G30hb61;
4279  if (G40hb60)
4280  delete G40hb60;
4281  if (G40hb61)
4282  delete G40hb61;
4283 
4284  if (Ghb1)
4285  delete Ghb1;
4286  //========================================================================================== 22-1 HB:: Ratio plots jeta = 0 - 21 jphi =0 - 17
4287  //======================================================================
4288  //======================================================================28.11.2018
4289  //======================================================================
4290  //======================================================================
4291 
4292  gStyle->SetOptStat(1110000);
4293  cout << " RBX HB Ratio plotsmore *****" << endl;
4294  cRBX31->Clear();
4296  cRBX31->Divide(3, 1);
4297  //================
4298  cRBX31->cd(1);
4299  G20hb6->GetZaxis()->SetLabelSize(0.025);
4300  G20hb6->SetXTitle(" #eta \b");
4301  G20hb6->SetYTitle(" #phi \b");
4302  G20hb6->SetTitle("<Rj> for |1-<R>| > 0.20 \b");
4303  G20hb6->SetStats(0);
4304  G20hb6->Draw("COLZ");
4305  //================
4306  cRBX31->cd(2);
4307  G30hb6->GetZaxis()->SetLabelSize(0.025);
4308  G30hb6->SetXTitle(" #eta \b");
4309  G30hb6->SetYTitle(" #phi \b");
4310  G30hb6->SetTitle("<Rj> for |1-<R>| > 0.30 \b");
4311  G30hb6->SetStats(0);
4312  G30hb6->Draw("COLZ");
4313  //================
4314  cRBX31->cd(3);
4315  G40hb6->GetZaxis()->SetLabelSize(0.025);
4316  G40hb6->SetXTitle(" #eta \b");
4317  G40hb6->SetYTitle(" #phi \b");
4318  G40hb6->SetTitle("<Rj> for |1-<R>| > 0.40 \b");
4319  G40hb6->SetStats(0);
4320  G40hb6->Draw("COLZ");
4321  //================
4322 
4324  cRBX31->Update();
4325  cRBX31->Print("RBX-HB-3plotsmore.png");
4326  cRBX31->Clear();
4327 
4328  // clean-up
4329  if (G20hb6)
4330  delete G20hb6;
4331  if (G30hb6)
4332  delete G30hb6;
4333  if (G40hb6)
4334  delete G40hb6;
4335  gStyle->SetOptStat(0);
4336 
4338 
4339  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4340  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4341  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4342  for (int jphi = 0; jphi < njphi; jphi++) {
4343  for (int jeta = 0; jeta < njeta; jeta++) {
4344  for (int i = 0; i < nx; i++) {
4345  alexall[jeta][jphi][i] = 0.;
4346  }
4347  }
4348  } // nulling
4349 
4351 
4353  //======================================================================
4354  //======================================================================
4355  //======================================================================
4356  cout << " RBX general for HE **************************" << endl;
4357  TH2F *Ghe1KKK = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs1");
4358  TH2F *Ghe1LLL = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs10");
4359  TH2F *Ghe1 = (TH2F *)Ghe1LLL->Clone("Ghe1");
4360  Ghe1->Divide(Ghe1KKK, Ghe1LLL, 1, 1, "B"); // average A
4361  // Ghe1->Sumw2();
4362  // int nx = Ghe1->GetXaxis()->GetNbins(); // # LS
4363  // nx = maxbinsRBX; // # LS
4364  ny = Ghe1->GetYaxis()->GetNbins(); // # jetaphi indexes
4365  for (int j = 1; j <= ny; j++) {
4366  int jeta = (j - 1) / njphi; // jeta = 0-21
4367  if ((jeta < 8 && jeta > 2) || (jeta < 19 && jeta > 13)) {
4368  int jphi = (j - 1) - njphi * jeta; // jphi=0-17
4369  // cout<<"HE 54 jeta= "<< jeta <<" jphi = "<<jphi <<endl;
4370  // over LS:
4371  for (int i = 1; i <= nx; i++) {
4372  double ccc1 = Ghe1->GetBinContent(i, j);
4373  alexall[jeta][jphi][i - 1] = ccc1;
4374  // if( i == 1 ) cout<<"HE 54 for LS=1 ccc1= "<< ccc1 <<endl;
4375  } //i
4376  } //if
4377  } //j
4378  // clean-up
4379  if (Ghe1KKK)
4380  delete Ghe1KKK;
4381  if (Ghe1LLL)
4382  delete Ghe1LLL;
4383  // if (Ghe1) delete Ghe1;
4384 
4385  //====================================================================== alexhe[k][i]
4386  for (int jphi = 0; jphi < njphi; jphi++) {
4387  for (int i = 0; i < nx; i++) {
4388  double sumccc1 = 0.;
4389  int isum = 0;
4390  for (int jeta = 0; jeta < njeta; jeta++) {
4391  double ccc1 = alexall[jeta][jphi][i];
4392  if (ccc1 > 0.) {
4393  sumccc1 += ccc1;
4394  isum++;
4395  }
4396  } // for jeta
4397  if (isum > 0.)
4398  sumccc1 /= isum;
4399  alexhe[jphi][i] = sumccc1;
4400  }
4401  } //for for
4402  //====================================================================== blexhe[k][i]
4403  for (int keta = 0; keta < njeta; keta++) {
4404  for (int i = 0; i < nx; i++) {
4405  double sumccc1 = 0.;
4406  int isum = 0;
4407  for (int kphi = 0; kphi < njphi; kphi++) {
4408  double ccc1 = alexall[keta][kphi][i];
4409  if (ccc1 > 0.) {
4410  sumccc1 += ccc1;
4411  isum++;
4412  }
4413  } // for kphi
4414  if (isum > 0.)
4415  sumccc1 /= isum;
4416  blexhe[keta][i] = sumccc1;
4417  }
4418  } //for for
4420  //========================================================================================== 21 HE:: 2D jeta = 0 - 21 jphi =0 - 17
4421  //======================================================================
4422  //======================================================================
4423  //======================================================================
4424  //======================================================================
4425  cout << " RBX HE 2D plot *****" << endl;
4426  cRBX1->Clear();
4428  cRBX1->Divide(1, 1);
4429  cRBX1->cd(1);
4430  // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ; k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
4431  TH2F *Ghe42D = new TH2F("Ghe42D", "", 23, -11.5, 11.5, 18, 0., 18.);
4432  TH2F *Ghe42D0 = new TH2F("Ghe42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
4433  // TH2F* Ghe42D = new TH2F("Ghe42D","", 22, -11., 11., 18, 0., 18. );
4434  // TH2F* Ghe42D0 = new TH2F("Ghe42D0","", 22, -11., 11., 18, 0., 18. );
4435  TH2F *Ghe42DF = (TH2F *)Ghe42D0->Clone("Ghe42DF");
4436  for (int jphi = 0; jphi < njphi; jphi++) {
4437  for (int jeta = 0; jeta < njeta; jeta++) {
4438  for (int i = 0; i < nx; i++) {
4439  double ccc1 = alexall[jeta][jphi][i];
4440  int neweta = jeta - 11 - 0.5;
4441  if (jeta >= 11)
4442  neweta = jeta - 11 + 1.5;
4443  if (ccc1 > 0.) {
4444  Ghe42D->Fill(neweta, jphi, ccc1);
4445  Ghe42D0->Fill(neweta, jphi, 1.);
4446  }
4447  // if(ccc1>0.) {Ghe42D ->Fill(jeta-11,jphi,ccc1); Ghe42D0 ->Fill(jeta-11,jphi,1.); }
4448  }
4449  }
4450  }
4451  Ghe42DF->Divide(Ghe42D, Ghe42D0, 1, 1, "B"); // average A
4452  // Ghe1->Sumw2();
4453  gPad->SetGridy();
4454  gPad->SetGridx(); // gPad->SetLogz();
4455  Ghe42DF->SetMarkerStyle(20);
4456  Ghe42DF->SetMarkerSize(0.4);
4457  Ghe42DF->GetZaxis()->SetLabelSize(0.04);
4458  Ghe42DF->SetXTitle("<A>_RBX #eta \b");
4459  Ghe42DF->SetYTitle(" #phi \b");
4460  Ghe42DF->SetZTitle("<A>_RBX - All \b");
4461  Ghe42DF->SetMarkerColor(2);
4462  Ghe42DF->SetLineColor(2); // Ghe42DF->SetMaximum(1.000); // Ghe42DF->SetMinimum(1.0);
4463  Ghe42DF->Draw("COLZ");
4464 
4466  cRBX1->Update();
4467  cRBX1->Print("RBX-HE-2Dplot.png");
4468  cRBX1->Clear();
4469  // clean-up
4470  if (Ghe42D)
4471  delete Ghe42D;
4472  if (Ghe42D0)
4473  delete Ghe42D0;
4474  if (Ghe42DF)
4475  delete Ghe42DF;
4476 
4477  //========================================================================================== 61 HE:: 1D j = 3,4,5, 6, 7 14,15,16,17,18 jphi =0 - 17
4478  //======================================================================
4479  //======================================================================
4480  //======================================================================
4481  //======================================================================
4482  cout << " RBX HE 1D plot *****" << endl;
4483  cRBX1->Clear();
4485  cRBX1->Divide(1, 1);
4486  cRBX1->cd(1);
4487  TH1F *GphiHE1D = new TH1F("GphiHE1D", "", 18, 0., 18.);
4488  TH1F *GphiHE1D0 = new TH1F("GphiHE1D0", "", 18, 0., 18.);
4489  TH1F *GphiHE1DF = (TH1F *)GphiHE1D0->Clone("GphiHE1DF");
4490  for (int jphi = 0; jphi < 18; jphi++) {
4491  for (int jeta = 0; jeta < 22; jeta++) {
4492  for (int i = 0; i < nx; i++) {
4493  double ccc1 = alexall[jeta][jphi][i];
4494  if (ccc1 > 0.) {
4495  GphiHE1D->Fill(jphi, ccc1);
4496  GphiHE1D0->Fill(jphi, 1.);
4497  }
4498  }
4499  }
4500  }
4501  // GphiHE1D->Sumw2();GphiHE1D0->Sumw2();
4502  GphiHE1DF->Divide(GphiHE1D, GphiHE1D0, 1, 1, "B"); // average A
4503  // GphiHE1DF->Sumw2();
4504  for (int jphi = 1; jphi < 19; jphi++) {
4505  GphiHE1DF->SetBinError(jphi, 0.01);
4506  }
4507  gPad->SetGridy();
4508  gPad->SetGridx(); // gPad->SetLogz();
4509  GphiHE1DF->SetMarkerStyle(20);
4510  GphiHE1DF->SetMarkerSize(1.4);
4511  GphiHE1DF->GetZaxis()->SetLabelSize(0.08);
4512  GphiHE1DF->SetXTitle("PHI of RBX\b");
4513  GphiHE1DF->SetYTitle(" <Amplitude> \b");
4514  GphiHE1DF->SetZTitle("<A>_PHI - All \b");
4515  GphiHE1DF->SetMarkerColor(4);
4516  GphiHE1DF->SetLineColor(4);
4517  GphiHE1DF->SetMinimum(0.8); // GphiHE1DF->SetMaximum(1.000);
4518  GphiHE1DF->Draw("Error");
4520  cRBX1->Update();
4521  cRBX1->Print("RBX-HE-1Dplot.png");
4522  cRBX1->Clear();
4523  // clean-up
4524  if (GphiHE1D)
4525  delete GphiHE1D;
4526  if (GphiHE1D0)
4527  delete GphiHE1D0;
4528  if (GphiHE1DF)
4529  delete GphiHE1DF;
4530 
4531  //========================================================================================== 62 HE:: 1D j = 3,4,5, 6, 7 14,15,16,17,18 jphi =0 - 17
4532  //======================================================================
4533  //======================================================================
4534  //======================================================================
4535  //======================================================================
4536  cout << " RBX HE 11D plot *eta*" << endl;
4537  cRBX1->Clear();
4539  cRBX1->Divide(1, 1);
4540  cRBX1->cd(1);
4541  TH1F *GetaHE11D = new TH1F("GetaHE11D", "", 23, -11.5, 11.5);
4542  TH1F *GetaHE11D0 = new TH1F("GetaHE11D0", "", 23, -11.5, 11.5);
4543  TH1F *GetaHE11DF = (TH1F *)GetaHE11D0->Clone("GetaHE11DF");
4544 
4545  for (int jeta = 0; jeta < 22; jeta++) {
4546  for (int jphi = 0; jphi < 18; jphi++) {
4547  for (int i = 0; i < nx; i++) {
4548  double ccc1 = alexall[jeta][jphi][i];
4549  int neweta = jeta - 11 - 0.5;
4550  if (jeta >= 11)
4551  neweta = jeta - 11 + 1.5;
4552  if (ccc1 > 0.) {
4553  GetaHE11D->Fill(neweta, ccc1);
4554  GetaHE11D0->Fill(neweta, 1.);
4555  // if( i == 0 ) cout<<"62 HE: ibin= "<< i <<" jphi= "<< jphi <<" jeta= "<< jeta <<" A= "<< ccc1 <<endl;
4556  }
4557  }
4558  }
4559  }
4560  // GetaHE11D->Sumw2();GetaHE11D0->Sumw2();
4561  GetaHE11DF->Divide(GetaHE11D, GetaHE11D0, 1, 1, "B"); // average A
4562  // GetaHE11DF->Sumw2();
4563  for (int jeta = 1; jeta < 24; jeta++) {
4564  GetaHE11DF->SetBinError(jeta, 0.01);
4565  }
4566  gPad->SetGridy();
4567  gPad->SetGridx(); // gPad->SetLogz();
4568  GetaHE11DF->SetMarkerStyle(20);
4569  GetaHE11DF->SetMarkerSize(1.4);
4570  GetaHE11DF->GetZaxis()->SetLabelSize(0.08);
4571  GetaHE11DF->SetXTitle("#eta \b");
4572  GetaHE11DF->SetYTitle(" <A> \b");
4573  GetaHE11DF->SetZTitle("<A>_ETA - All \b");
4574  GetaHE11DF->SetMarkerColor(4);
4575  GetaHE11DF->SetLineColor(4);
4576  GetaHE11DF->SetMinimum(0.8); // GetaHE11DF->SetMaximum(1.000);
4577  GetaHE11DF->Draw("Error");
4578 
4580  cRBX1->Update();
4581  cRBX1->Print("RBX-HE-11Dplot.png");
4582  cRBX1->Clear();
4583  // clean-up
4584  if (GetaHE11D)
4585  delete GetaHE11D;
4586  if (GetaHE11D0)
4587  delete GetaHE11D0;
4588  if (GetaHE11DF)
4589  delete GetaHE11DF;
4590 
4591  //========================================================================================== 22 HE:: Ratio plots jeta = 0 - 21 jphi =0 - 17
4592  //======================================================================
4593  //======================================================================22.11.2018
4594  //======================================================================
4595  //======================================================================
4596 
4597  gStyle->SetOptStat(1110000);
4598  cout << " RBX HE Ratio plots *****" << endl;
4599  cRBX31->Clear();
4601  // gain stabilitY:
4602  // Rij = Aij / A1j , where i-over LSs, j-channels
4603  //
4604  // nx = maxbinsRBX; // # LS
4605  //
4606  double ccc0HE = 0.;
4607  cRBX31->Divide(3, 1);
4608  //================
4609  cRBX31->cd(1);
4610  // TH1F* Ghe5 = new TH1F("Ghe5","", nx, 1., nx+1.);
4611  TH1F *Ghe51 = new TH1F("Ghe51", "", nx, 1., nx + 1.);
4612  TH1F *Ghe50 = new TH1F("Ghe50", "", nx, 1., nx + 1.);
4613  TH1F *Ghe5 = (TH1F *)Ghe50->Clone("Ghe5");
4614  // j - etaphi index:
4615  for (int j = 1; j <= ny; j++) {
4616  ccc0HE = Ghe1->GetBinContent(1, j);
4617  // 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;} }
4618  if (ccc0HE <= 0.)
4619  for (int i = 1; i <= nx; i++) {
4620  double ccc2 = Ghe1->GetBinContent(i, j);
4621  if (ccc2 > 0.) {
4622  ccc0HE = ccc2;
4623  break;
4624  }
4625  }
4626  if (ccc0HE > 0.) {
4627  // i - # LSs:
4628  for (int i = 1; i <= nx; i++) {
4629  double ccc1 = Ghe1->GetBinContent(i, j);
4630  if (ccc1 > 0.) {
4631  double Rij = ccc1 / ccc0HE;
4632  // Ghe5 ->Fill( float(i), Rij);
4633  Ghe51->Fill(float(i), Rij);
4634  Ghe50->Fill(float(i), 1.);
4635  }
4636  }
4637  }
4638  }
4639  Ghe5->Divide(Ghe51, Ghe50, 1, 1, "B"); // average A
4640  for (int i = 1; i <= nx; i++) {
4641  Ghe5->SetBinError(i, 0.0001);
4642  }
4643  Ghe5->SetMarkerStyle(20);
4644  Ghe5->SetMarkerSize(0.4);
4645  Ghe5->GetYaxis()->SetLabelSize(0.04);
4646  Ghe5->SetMarkerColor(2);
4647  Ghe5->SetLineColor(0);
4648  Ghe5->SetXTitle(" iLS \b");
4649  Ghe5->SetYTitle(" <R> \b");
4650  Ghe5->SetTitle("<Ri> vs iLS \b");
4651  Ghe5->SetMinimum(0.); //Ghe5->SetMaximum(2.5);
4652  // gPad->SetLogy();
4653  gPad->SetGridy();
4654  gPad->SetGridx();
4655  Ghe5->SetStats(0);
4656  Ghe5->GetYaxis()->SetLabelSize(0.025);
4657  Ghe5->Draw("Error");
4658  //================
4659  cRBX31->cd(2);
4660  TH2F *Ghe60 = new TH2F("Ghe60", "", 22, -11., 11., 18, 0., 18.);
4661  TH2F *Ghe61 = new TH2F("Ghe61", "", 22, -11., 11., 18, 0., 18.);
4662  TH2F *Ghe6 = new TH2F("Ghe6", "", 22, -11., 11., 18, 0., 18.);
4663 
4664  TH2F *G20he60 = new TH2F("G20he60", "", 22, -11., 11., 18, 0., 18.);
4665  TH2F *G20he61 = new TH2F("G20he61", "", 22, -11., 11., 18, 0., 18.);
4666  TH2F *G20he6 = new TH2F("G20he6", "", 22, -11., 11., 18, 0., 18.);
4667  TH2F *G30he60 = new TH2F("G30he60", "", 22, -11., 11., 18, 0., 18.);
4668  TH2F *G30he61 = new TH2F("G30he61", "", 22, -11., 11., 18, 0., 18.);
4669  TH2F *G30he6 = new TH2F("G30he6", "", 22, -11., 11., 18, 0., 18.);
4670  TH2F *G40he60 = new TH2F("G40he60", "", 22, -11., 11., 18, 0., 18.);
4671  TH2F *G40he61 = new TH2F("G40he61", "", 22, -11., 11., 18, 0., 18.);
4672  TH2F *G40he6 = new TH2F("G40he6", "", 22, -11., 11., 18, 0., 18.);
4673  // j - etaphi index; i - # LSs;
4674  //
4675  // define mean and RMS:
4676  double sumjHE = 0.;
4677  int njHE = 0;
4678  double meanjHE = 0.;
4679  for (int j = 1; j <= ny; j++) {
4680  ccc0HE = Ghe1->GetBinContent(1, j);
4681  if (ccc0HE <= 0.)
4682  for (int i = 1; i <= nx; i++) {
4683  double ccc2 = Ghe1->GetBinContent(i, j);
4684  if (ccc2 > 0.) {
4685  ccc0HE = ccc2;
4686  break;
4687  }
4688  }
4689  if (ccc0HE > 0.) {
4690  for (int i = 1; i <= nx; i++) {
4691  double ccc1 = Ghe1->GetBinContent(i, j) / ccc0HE;
4692  if (ccc1 > 0.) {
4693  sumjHE += ccc1;
4694  njHE++;
4695  }
4696  }
4697  meanjHE = sumjHE / njHE;
4698  }
4699  } // j
4700 
4701  double ssumjHE = 0.;
4702  njHE = 0;
4703  double sigmajHE = 0.;
4704  for (int j = 1; j <= ny; j++) {
4705  ccc0HE = Ghe1->GetBinContent(1, j);
4706  if (ccc0HE <= 0.)
4707  for (int i = 1; i <= nx; i++) {
4708  double ccc2 = Ghe1->GetBinContent(i, j);
4709  if (ccc2 > 0.) {
4710  ccc0HE = ccc2;
4711  break;
4712  }
4713  }
4714  if (ccc0HE > 0.) {
4715  for (int i = 1; i <= nx; i++) {
4716  double ccc1 = Ghe1->GetBinContent(i, j) / ccc0HE;
4717  if (ccc1 > 0.) {
4718  ssumjHE += (ccc1 - meanjHE) * (ccc1 - meanjHE);
4719  njHE++;
4720  }
4721  }
4722  sigmajHE = sqrt(ssumjHE / njHE);
4723  }
4724  } // j
4725 
4726  double dif3rmsHEMIN = meanjHE - 3 * sigmajHE;
4727  if (dif3rmsHEMIN < 0.)
4728  dif3rmsHEMIN = 0.;
4729  double dif3rmsHEMAX = meanjHE + 3 * sigmajHE;
4730  cout << "22HE-2 meanjHE= " << meanjHE << " sigmajHE= " << sigmajHE << " dif3rmsHEMIN= " << dif3rmsHEMIN
4731  << " dif3rmsHEMAX= " << dif3rmsHEMAX << endl;
4732 
4733  double MAXdif3rmsHEMIN = dif3rmsHEMIN;
4734  double MINdif3rmsHEMAX = dif3rmsHEMAX;
4735  if (MAXdif3rmsHEMIN < 0.95)
4736  MAXdif3rmsHEMIN = 0.95;
4737  if (MINdif3rmsHEMAX > 1.05)
4738  MINdif3rmsHEMAX = 1.05;
4739  cout << "22HE-2 MAXdif3rmsHEMIN= " << MAXdif3rmsHEMIN << " MINdif3rmsHEMAX= " << MINdif3rmsHEMAX << endl;
4740  //
4741  for (int j = 1; j <= ny; j++) {
4742  ccc0HE = Ghe1->GetBinContent(1, j);
4743  if (ccc0HE <= 0.)
4744  for (int i = 1; i <= nx; i++) {
4745  double ccc2 = Ghe1->GetBinContent(i, j);
4746  if (ccc2 > 0.) {
4747  ccc0HE = ccc2;
4748  break;
4749  }
4750  }
4751  if (ccc0HE > 0.) {
4752  int jeta = (j - 1) / 18; // jeta = 0-21
4753  int jphi = (j - 1) - 18 * jeta; // jphi=0-17
4754  // i - # LSs:
4755  for (int i = 1; i <= nx; i++) {
4756  double ccc1 = Ghe1->GetBinContent(i, j);
4757  if (ccc1 > 0.) {
4758  double Rij = ccc1 / ccc0HE;
4759  if (Rij < MAXdif3rmsHEMIN || Rij > MINdif3rmsHEMAX) {
4760  Ghe61->Fill(jeta - 11, jphi, Rij);
4761  Ghe60->Fill(jeta - 11, jphi, 1.);
4762  }
4763  if (Rij < 0.8 || Rij > 1.2) {
4764  G20he61->Fill(jeta - 11, jphi, Rij);
4765  G20he60->Fill(jeta - 11, jphi, 1.);
4766  }
4767  if (Rij < 0.7 || Rij > 1.3) {
4768  G30he61->Fill(jeta - 11, jphi, Rij);
4769  G30he60->Fill(jeta - 11, jphi, 1.);
4770  }
4771  if (Rij < 0.6 || Rij > 1.4) {
4772  G40he61->Fill(jeta - 11, jphi, Rij);
4773  G40he60->Fill(jeta - 11, jphi, 1.);
4774  }
4775  } //if(ccc1>0.
4776  } // i
4777  } //if(ccc0HE>0
4778  } // j
4779  Ghe6->Divide(Ghe61, Ghe60, 1, 1, "B"); // average R
4780  G20he6->Divide(G20he61, G20he60, 1, 1, "B"); // average R
4781  G30he6->Divide(G30he61, G30he60, 1, 1, "B"); // average R
4782  G40he6->Divide(G40he61, G40he60, 1, 1, "B"); // average R
4783 
4784  // Ghe6->SetLabelOffset (Float_t offset=0.005, Option_t *axis="X")//Set offset between axis and axis' labels
4785  // Ghe6->GetZaxis()->SetLabelOffset(-0.05);
4786  Ghe6->GetZaxis()->SetLabelSize(0.025);
4787 
4788  Ghe6->SetXTitle(" #eta \b");
4789  Ghe6->SetYTitle(" #phi \b");
4790  Ghe6->SetTitle(
4791  "<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);
4792  //gStyle->SetOptStat(kFALSE);
4793  Ghe6->SetStats(0);
4794  Ghe6->Draw("COLZ");
4795  //================
4796  cRBX31->cd(3);
4797  TH1F *Ghe7 = new TH1F("Ghe7", "", 120, 0.4, 1.6);
4798  // j - etaphi index:
4799  for (int j = 1; j <= ny; j++) {
4800  ccc0HE = Ghe1->GetBinContent(1, j);
4801  if (ccc0HE <= 0.)
4802  for (int i = 1; i <= nx; i++) {
4803  double ccc2 = Ghe1->GetBinContent(i, j);
4804  if (ccc2 > 0.) {
4805  ccc0HE = ccc2;
4806  break;
4807  }
4808  }
4809  if (ccc0HE > 0.) {
4810  // i - # LSs:
4811  for (int i = 1; i <= nx; i++) {
4812  double ccc1 = Ghe1->GetBinContent(i, j);
4813  if (ccc1 > 0.) {
4814  double Rij = ccc1 / ccc0HE;
4815  Ghe7->Fill(Rij);
4816  }
4817  }
4818  }
4819  }
4820  Ghe7->SetMarkerStyle(20);
4821  Ghe7->SetMarkerSize(0.4);
4822  Ghe7->GetYaxis()->SetLabelSize(0.04);
4823  Ghe7->SetMarkerColor(2);
4824  Ghe7->SetLineColor(0);
4825  Ghe7->SetYTitle(" N \b");
4826  Ghe7->SetXTitle(" Rij \b");
4827  Ghe7->SetTitle(" Rij \b");
4828  //Ghe7->SetMinimum(0.8);Ghe7->SetMaximum(500.);
4829  gPad->SetGridy();
4830  gPad->SetGridx(); // gPad->SetLogy();
4831  // Ghe7->SetStats(1110000);
4832  Ghe7->GetYaxis()->SetLabelSize(0.025);
4833  Ghe7->Draw("Error");
4834  Float_t ymaxHE = Ghe7->GetMaximum();
4835  cout << "22HE-3 ymaxHE= " << ymaxHE << " MAXdif3rmsHEMIN= " << MAXdif3rmsHEMIN
4836  << " MINdif3rmsHEMAX= " << MINdif3rmsHEMAX << endl;
4837  TLine *lineHE = new TLine(MAXdif3rmsHEMIN, 0., MAXdif3rmsHEMIN, ymaxHE);
4838  lineHE->SetLineColor(kBlue);
4839  lineHE->Draw();
4840  TLine *line1HE = new TLine(MINdif3rmsHEMAX, 0., MINdif3rmsHEMAX, ymaxHE);
4841  line1HE->SetLineColor(kBlue);
4842  line1HE->Draw();
4843  //================
4845  cRBX31->Update();
4846  cRBX31->Print("RBX-HE-3plots.png");
4847  cRBX31->Clear();
4848  // clean-up
4849  if (Ghe5)
4850  delete Ghe5;
4851  if (Ghe60)
4852  delete Ghe60;
4853  if (Ghe61)
4854  delete Ghe61;
4855  if (Ghe6)
4856  delete Ghe6;
4857  if (Ghe7)
4858  delete Ghe7;
4859 
4860  if (G20he60)
4861  delete G20he60;
4862  if (G20he61)
4863  delete G20he61;
4864  if (G30he60)
4865  delete G30he60;
4866  if (G30he61)
4867  delete G30he61;
4868  if (G40he60)
4869  delete G40he60;
4870  if (G40he61)
4871  delete G40he61;
4872 
4873  if (Ghe1)
4874  delete Ghe1;
4875  //========================================================================================== 22-1 HE:: Ratio plots jeta = 0 - 21 jphi =0 - 17
4876  //======================================================================
4877  //======================================================================28.11.2018
4878  //======================================================================
4879  //======================================================================
4880 
4881  gStyle->SetOptStat(1110000);
4882  cout << " RBX HE Ratio plotsmore *****" << endl;
4883  cRBX31->Clear();
4885  cRBX31->Divide(3, 1);
4886  //================
4887  cRBX31->cd(1);
4888  G20he6->GetZaxis()->SetLabelSize(0.025);
4889  G20he6->SetXTitle(" #eta \b");
4890  G20he6->SetYTitle(" #phi \b");
4891  G20he6->SetTitle("<Rj> for |1-<R>| > 0.20 \b");
4892  G20he6->SetStats(0);
4893  G20he6->Draw("COLZ");
4894  //================
4895  cRBX31->cd(2);
4896  G30he6->GetZaxis()->SetLabelSize(0.025);
4897  G30he6->SetXTitle(" #eta \b");
4898  G30he6->SetYTitle(" #phi \b");
4899  G30he6->SetTitle("<Rj> for |1-<R>| > 0.30 \b");
4900  G30he6->SetStats(0);
4901  G30he6->Draw("COLZ");
4902  //================
4903  cRBX31->cd(3);
4904  G40he6->GetZaxis()->SetLabelSize(0.025);
4905  G40he6->SetXTitle(" #eta \b");
4906  G40he6->SetYTitle(" #phi \b");
4907  G40he6->SetTitle("<Rj> for |1-<R>| > 0.40 \b");
4908  G40he6->SetStats(0);
4909  G40he6->Draw("COLZ");
4910  //================
4911 
4913  cRBX31->Update();
4914  cRBX31->Print("RBX-HE-3plotsmore.png");
4915  cRBX31->Clear();
4916 
4917  // clean-up
4918  if (G20he6)
4919  delete G20he6;
4920  if (G30he6)
4921  delete G30he6;
4922  if (G40he6)
4923  delete G40he6;
4924  gStyle->SetOptStat(0);
4926 
4927  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4928  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4929  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
4930  for (int jphi = 0; jphi < njphi; jphi++) {
4931  for (int jeta = 0; jeta < njeta; jeta++) {
4932  for (int i = 0; i < nx; i++) {
4933  alexall[jeta][jphi][i] = 0.;
4934  }
4935  }
4936  } // nulling
4937 
4939 
4941  //======================================================================
4942  //======================================================================
4943  //======================================================================
4944  cout << " RBX general for HO **************************" << endl;
4945  TH2F *Gho1KKK = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs2");
4946  TH2F *Gho1LLL = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs20");
4947  TH2F *Gho1 = (TH2F *)Gho1LLL->Clone("Gho1");
4948  Gho1->Divide(Gho1KKK, Gho1LLL, 1, 1, "B"); // average A
4949  // Gho1->Sumw2();
4950  // int nx = Gho1->GetXaxis()->GetNbins(); // # LS
4951  // nx = maxbinsRBX; // # LS
4952  ny = Gho1->GetYaxis()->GetNbins(); // # jetaphi indexes
4953  for (int j = 1; j <= ny; j++) {
4954  int jeta = (j - 1) / njphi; // jeta = 0-21
4955  if (jeta < 15 && jeta > 6) {
4956  int jphi = (j - 1) - njphi * jeta; // jphi=0-17
4957  // cout<<"HO 54 jeta= "<< jeta <<" jphi = "<<jphi <<endl;
4958  // over LS:
4959  for (int i = 1; i <= nx; i++) {
4960  double ccc1 = Gho1->GetBinContent(i, j);
4961  alexall[jeta][jphi][i - 1] = ccc1;
4962  // if( i == 1 ) cout<<"HO 54 for LS=1 ccc1= "<< ccc1 <<endl;
4963  } //i
4964  } //if
4965  } //j
4966  // clean-up
4967  if (Gho1KKK)
4968  delete Gho1KKK;
4969  if (Gho1LLL)
4970  delete Gho1LLL;
4971  // if (Gho1) delete Gho1;
4972 
4973  //====================================================================== alexho[k][i]
4974  for (int jphi = 0; jphi < njphi; jphi++) {
4975  for (int i = 0; i < nx; i++) {
4976  double sumccc1 = 0.;
4977  int isum = 0;
4978  for (int jeta = 0; jeta < njeta; jeta++) {
4979  double ccc1 = alexall[jeta][jphi][i];
4980  if (ccc1 > 0.) {
4981  sumccc1 += ccc1;
4982  isum++;
4983  }
4984  } // for jeta
4985  if (isum > 0.)
4986  sumccc1 /= isum;
4987  alexho[jphi][i] = sumccc1;
4988  }
4989  } //for for
4990  //====================================================================== blexho[k][i]
4991  for (int keta = 0; keta < njeta; keta++) {
4992  for (int i = 0; i < nx; i++) {
4993  double sumccc1 = 0.;
4994  int isum = 0;
4995  for (int kphi = 0; kphi < njphi; kphi++) {
4996  double ccc1 = alexall[keta][kphi][i];
4997  if (ccc1 > 0.) {
4998  sumccc1 += ccc1;
4999  isum++;
5000  }
5001  } // for kphi
5002  if (isum > 0.)
5003  sumccc1 /= isum;
5004  blexho[keta][i] = sumccc1;
5005  }
5006  } //for for
5007 
5009  //========================================================================================== 33 HO:: 2D jeta = 0 - 21 jphi =0 - 17
5010  //======================================================================
5011  //======================================================================
5012  //======================================================================
5013  //======================================================================
5014  cout << " RBX HO 2D plot *****" << endl;
5015  cRBX1->Clear();
5017  cRBX1->Divide(1, 1);
5018  cRBX1->cd(1);
5019  // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ; k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
5020  TH2F *Gho42D = new TH2F("Gho42D", "", 23, -11.5, 11.5, 18, 0., 18.);
5021  TH2F *Gho42D0 = new TH2F("Gho42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
5022  // TH2F* Gho42D = new TH2F("Gho42D","", 22, -11., 11., 18, 0., 18. );
5023  // TH2F* Gho42D0 = new TH2F("Gho42D0","", 22, -11., 11., 18, 0., 18. );
5024  TH2F *Gho42DF = (TH2F *)Gho42D0->Clone("Gho42DF");
5025  for (int jphi = 0; jphi < njphi; jphi++) {
5026  for (int jeta = 0; jeta < njeta; jeta++) {
5027  for (int i = 0; i < nx; i++) {
5028  double ccc1 = alexall[jeta][jphi][i];
5029  int neweta = jeta - 11 - 0.5;
5030  if (jeta >= 11)
5031  neweta = jeta - 11 + 1.5;
5032  if (ccc1 > 0.) {
5033  Gho42D->Fill(neweta, jphi, ccc1);
5034  Gho42D0->Fill(neweta, jphi, 1.);
5035  }
5036  // if(ccc1>0.) {Gho42D ->Fill(jeta-11,jphi,ccc1); Gho42D0 ->Fill(jeta-11,jphi,1.); }
5037  }
5038  }
5039  }
5040  Gho42DF->Divide(Gho42D, Gho42D0, 1, 1, "B"); // average A
5041  // Gho1->Sumw2();
5042  gPad->SetGridy();
5043  gPad->SetGridx(); // gPad->SetLogz();
5044  Gho42DF->SetMarkerStyle(20);
5045  Gho42DF->SetMarkerSize(0.4);
5046  Gho42DF->GetZaxis()->SetLabelSize(0.04);
5047  Gho42DF->SetXTitle("<A>_RBX #eta \b");
5048  Gho42DF->SetYTitle(" #phi \b");
5049  Gho42DF->SetZTitle("<A>_RBX - All \b");
5050  Gho42DF->SetMarkerColor(2);
5051  Gho42DF->SetLineColor(2); // Gho42DF->SetMaximum(1.000); // Gho42DF->SetMinimum(1.0);
5052  Gho42DF->Draw("COLZ");
5053 
5055  cRBX1->Update();
5056  cRBX1->Print("RBX-HO-2Dplot.png");
5057  cRBX1->Clear();
5058  // clean-up
5059  if (Gho42D)
5060  delete Gho42D;
5061  if (Gho42D0)
5062  delete Gho42D0;
5063  if (Gho42DF)
5064  delete Gho42DF;
5065 
5066  //========================================================================================== 61 HO:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
5067  //======================================================================
5068  //======================================================================
5069  //======================================================================
5070  //======================================================================
5071  cout << " RBX HO 1D plot *****" << endl;
5072  cRBX1->Clear();
5074  cRBX1->Divide(1, 1);
5075  cRBX1->cd(1);
5076  TH1F *GphiHO1D = new TH1F("GphiHO1D", "", 18, 0., 18.);
5077  TH1F *GphiHO1D0 = new TH1F("GphiHO1D0", "", 18, 0., 18.);
5078  TH1F *GphiHO1DF = (TH1F *)GphiHO1D0->Clone("GphiHO1DF");
5079  for (int jphi = 0; jphi < 18; jphi++) {
5080  for (int jeta = 0; jeta < 22; jeta++) {
5081  for (int i = 0; i < nx; i++) {
5082  double ccc1 = alexall[jeta][jphi][i];
5083  if (ccc1 > 0.) {
5084  GphiHO1D->Fill(jphi, ccc1);
5085  GphiHO1D0->Fill(jphi, 1.);
5086  }
5087  }
5088  }
5089  }
5090  // GphiHO1D->Sumw2();GphiHO1D0->Sumw2();
5091  GphiHO1DF->Divide(GphiHO1D, GphiHO1D0, 1, 1, "B"); // average A
5092  // GphiHO1DF->Sumw2();
5093  for (int jphi = 1; jphi < 19; jphi++) {
5094  GphiHO1DF->SetBinError(jphi, 0.01);
5095  }
5096  gPad->SetGridy();
5097  gPad->SetGridx(); // gPad->SetLogz();
5098  GphiHO1DF->SetMarkerStyle(20);
5099  GphiHO1DF->SetMarkerSize(1.4);
5100  GphiHO1DF->GetZaxis()->SetLabelSize(0.08);
5101  GphiHO1DF->SetXTitle("PHI of RBX\b");
5102  GphiHO1DF->SetYTitle(" <Amplitude> \b");
5103  GphiHO1DF->SetZTitle("<A>_PHI - All \b");
5104  GphiHO1DF->SetMarkerColor(4);
5105  GphiHO1DF->SetLineColor(4);
5106  GphiHO1DF->SetMinimum(0.8); // GphiHO1DF->SetMaximum(1.000);
5107  GphiHO1DF->Draw("Error");
5109  cRBX1->Update();
5110  cRBX1->Print("RBX-HO-1Dplot.png");
5111  cRBX1->Clear();
5112  // clean-up
5113  if (GphiHO1D)
5114  delete GphiHO1D;
5115  if (GphiHO1D0)
5116  delete GphiHO1D0;
5117  if (GphiHO1DF)
5118  delete GphiHO1DF;
5119 
5120  //========================================================================================== 62 HO:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
5121  //======================================================================
5122  //======================================================================
5123  //======================================================================
5124  //======================================================================
5125  cout << " RBX HO 11D plot *eta*" << endl;
5126  cRBX1->Clear();
5128  cRBX1->Divide(1, 1);
5129  cRBX1->cd(1);
5130  TH1F *GetaHO11D = new TH1F("GetaHO11D", "", 23, -11.5, 11.5);
5131  TH1F *GetaHO11D0 = new TH1F("GetaHO11D0", "", 23, -11.5, 11.5);
5132  TH1F *GetaHO11DF = (TH1F *)GetaHO11D0->Clone("GetaHO11DF");
5133 
5134  for (int jeta = 0; jeta < 22; jeta++) {
5135  for (int jphi = 0; jphi < 18; jphi++) {
5136  for (int i = 0; i < nx; i++) {
5137  double ccc1 = alexall[jeta][jphi][i];
5138  int neweta = jeta - 11 - 0.5;
5139  if (jeta >= 11)
5140  neweta = jeta - 11 + 1.5;
5141  if (ccc1 > 0.) {
5142  GetaHO11D->Fill(neweta, ccc1);
5143  GetaHO11D0->Fill(neweta, 1.);
5144  // if( i == 0 ) cout<<"62 HO: ibin= "<< i <<" jphi= "<< jphi <<" jeta= "<< jeta <<" A= "<< ccc1 <<endl;
5145  }
5146  }
5147  }
5148  }
5149  // GetaHO11D->Sumw2();GetaHO11D0->Sumw2();
5150  GetaHO11DF->Divide(GetaHO11D, GetaHO11D0, 1, 1, "B"); // average A
5151  // GetaHO11DF->Sumw2();
5152  for (int jeta = 1; jeta < 24; jeta++) {
5153  GetaHO11DF->SetBinError(jeta, 0.01);
5154  }
5155  gPad->SetGridy();
5156  gPad->SetGridx(); // gPad->SetLogz();
5157  GetaHO11DF->SetMarkerStyle(20);
5158  GetaHO11DF->SetMarkerSize(1.4);
5159  GetaHO11DF->GetZaxis()->SetLabelSize(0.08);
5160  GetaHO11DF->SetXTitle("#eta \b");
5161  GetaHO11DF->SetYTitle(" <A> \b");
5162  GetaHO11DF->SetZTitle("<A>_ETA - All \b");
5163  GetaHO11DF->SetMarkerColor(4);
5164  GetaHO11DF->SetLineColor(4);
5165  GetaHO11DF->SetMinimum(0.8); // GetaHO11DF->SetMaximum(1.000);
5166  GetaHO11DF->Draw("Error");
5167 
5169  cRBX1->Update();
5170  cRBX1->Print("RBX-HO-11Dplot.png");
5171  cRBX1->Clear();
5172  // clean-up
5173  if (GetaHO11D)
5174  delete GetaHO11D;
5175  if (GetaHO11D0)
5176  delete GetaHO11D0;
5177  if (GetaHO11DF)
5178  delete GetaHO11DF;
5179 
5180  //========================================================================================== 22 HO:: Ratio plots jeta = 0 - 21 jphi =0 - 17
5181  //======================================================================
5182  //======================================================================22.11.2018
5183  //======================================================================
5184  //======================================================================
5185 
5186  gStyle->SetOptStat(1110000);
5187  cout << " RBX HO Ratio plots *****" << endl;
5188  cRBX31->Clear();
5190  // gain stabilitY:
5191  // Rij = Aij / A1j , where i-over LSs, j-channels
5192  //
5193  // nx = maxbinsRBX; // # LS
5194  //
5195  double ccc0HO = 0.;
5196  cRBX31->Divide(3, 1);
5197  //================
5198  cRBX31->cd(1);
5199  // TH1F* Gho5 = new TH1F("Gho5","", nx, 1., nx+1.);
5200  TH1F *Gho51 = new TH1F("Gho51", "", nx, 1., nx + 1.);
5201  TH1F *Gho50 = new TH1F("Gho50", "", nx, 1., nx + 1.);
5202  TH1F *Gho5 = (TH1F *)Gho50->Clone("Gho5");
5203  // j - etaphi index:
5204  for (int j = 1; j <= ny; j++) {
5205  ccc0HO = Gho1->GetBinContent(1, j);
5206  // 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;} }
5207  if (ccc0HO <= 0.)
5208  for (int i = 1; i <= nx; i++) {
5209  double ccc2 = Gho1->GetBinContent(i, j);
5210  if (ccc2 > 0.) {
5211  ccc0HO = ccc2;
5212  break;
5213  }
5214  }
5215  if (ccc0HO > 0.) {
5216  // i - # LSs:
5217  for (int i = 1; i <= nx; i++) {
5218  double ccc1 = Gho1->GetBinContent(i, j);
5219  if (ccc1 > 0.) {
5220  double Rij = ccc1 / ccc0HO;
5221  // Gho5 ->Fill( float(i), Rij);
5222  Gho51->Fill(float(i), Rij);
5223  Gho50->Fill(float(i), 1.);
5224  }
5225  }
5226  }
5227  }
5228  Gho5->Divide(Gho51, Gho50, 1, 1, "B"); // average A
5229  for (int i = 1; i <= nx; i++) {
5230  Gho5->SetBinError(i, 0.0001);
5231  }
5232  Gho5->SetMarkerStyle(20);
5233  Gho5->SetMarkerSize(0.4);
5234  Gho5->GetYaxis()->SetLabelSize(0.04);
5235  Gho5->SetMarkerColor(2);
5236  Gho5->SetLineColor(0);
5237  Gho5->SetXTitle(" iLS \b");
5238  Gho5->SetYTitle(" <R> \b");
5239  Gho5->SetTitle("<Ri> vs iLS \b");
5240  Gho5->SetMinimum(0.); //Gho5->SetMaximum(2.5);
5241  // gPad->SetLogy();
5242  gPad->SetGridy();
5243  gPad->SetGridx();
5244  Gho5->SetStats(0);
5245  Gho5->GetYaxis()->SetLabelSize(0.025);
5246  Gho5->Draw("Error");
5247  //================
5248  cRBX31->cd(2);
5249  TH2F *Gho60 = new TH2F("Gho60", "", 22, -11., 11., 18, 0., 18.);
5250  TH2F *Gho61 = new TH2F("Gho61", "", 22, -11., 11., 18, 0., 18.);
5251  TH2F *Gho6 = new TH2F("Gho6", "", 22, -11., 11., 18, 0., 18.);
5252 
5253  TH2F *G20ho60 = new TH2F("G20ho60", "", 22, -11., 11., 18, 0., 18.);
5254  TH2F *G20ho61 = new TH2F("G20ho61", "", 22, -11., 11., 18, 0., 18.);
5255  TH2F *G20ho6 = new TH2F("G20ho6", "", 22, -11., 11., 18, 0., 18.);
5256  TH2F *G30ho60 = new TH2F("G30ho60", "", 22, -11., 11., 18, 0., 18.);
5257  TH2F *G30ho61 = new TH2F("G30ho61", "", 22, -11., 11., 18, 0., 18.);
5258  TH2F *G30ho6 = new TH2F("G30ho6", "", 22, -11., 11., 18, 0., 18.);
5259  TH2F *G40ho60 = new TH2F("G40ho60", "", 22, -11., 11., 18, 0., 18.);
5260  TH2F *G40ho61 = new TH2F("G40ho61", "", 22, -11., 11., 18, 0., 18.);
5261  TH2F *G40ho6 = new TH2F("G40ho6", "", 22, -11., 11., 18, 0., 18.);
5262 
5263  // j - etaphi index; i - # LSs;
5264  //
5265  // define mean and RMS:
5266  double sumjHO = 0.;
5267  int njHO = 0;
5268  double meanjHO = 0.;
5269  for (int j = 1; j <= ny; j++) {
5270  ccc0HO = Gho1->GetBinContent(1, j);
5271  if (ccc0HO <= 0.)
5272  for (int i = 1; i <= nx; i++) {
5273  double ccc2 = Gho1->GetBinContent(i, j);
5274  if (ccc2 > 0.) {
5275  ccc0HO = ccc2;
5276  break;
5277  }
5278  }
5279  if (ccc0HO > 0.) {
5280  for (int i = 1; i <= nx; i++) {
5281  double ccc1 = Gho1->GetBinContent(i, j) / ccc0HO;
5282  if (ccc1 > 0.) {
5283  sumjHO += ccc1;
5284  njHO++;
5285  }
5286  }
5287  meanjHO = sumjHO / njHO;
5288  }
5289  } // j
5290 
5291  double ssumjHO = 0.;
5292  njHO = 0;
5293  double sigmajHO = 0.;
5294  for (int j = 1; j <= ny; j++) {
5295  ccc0HO = Gho1->GetBinContent(1, j);
5296  if (ccc0HO <= 0.)
5297  for (int i = 1; i <= nx; i++) {
5298  double ccc2 = Gho1->GetBinContent(i, j);
5299  if (ccc2 > 0.) {
5300  ccc0HO = ccc2;
5301  break;
5302  }
5303  }
5304  if (ccc0HO > 0.) {
5305  for (int i = 1; i <= nx; i++) {
5306  double ccc1 = Gho1->GetBinContent(i, j) / ccc0HO;
5307  if (ccc1 > 0.) {
5308  ssumjHO += (ccc1 - meanjHO) * (ccc1 - meanjHO);
5309  njHO++;
5310  }
5311  }
5312  sigmajHO = sqrt(ssumjHO / njHO);
5313  }
5314  } // j
5315 
5316  double dif3rmsHOMIN = meanjHO - 3 * sigmajHO;
5317  if (dif3rmsHOMIN < 0.)
5318  dif3rmsHOMIN = 0.;
5319  double dif3rmsHOMAX = meanjHO + 3 * sigmajHO;
5320  cout << "22HO-2 meanjHO= " << meanjHO << " sigmajHO= " << sigmajHO << " dif3rmsHOMIN= " << dif3rmsHOMIN
5321  << " dif3rmsHOMAX= " << dif3rmsHOMAX << endl;
5322 
5323  double MAXdif3rmsHOMIN = dif3rmsHOMIN;
5324  double MINdif3rmsHOMAX = dif3rmsHOMAX;
5325  if (MAXdif3rmsHOMIN < 0.95)
5326  MAXdif3rmsHOMIN = 0.95;
5327  if (MINdif3rmsHOMAX > 1.05)
5328  MINdif3rmsHOMAX = 1.05;
5329  cout << "22HO-2 MAXdif3rmsHOMIN= " << MAXdif3rmsHOMIN << " MINdif3rmsHOMAX= " << MINdif3rmsHOMAX << endl;
5330  //
5331  for (int j = 1; j <= ny; j++) {
5332  ccc0HO = Gho1->GetBinContent(1, j);
5333  if (ccc0HO <= 0.)
5334  for (int i = 1; i <= nx; i++) {
5335  double ccc2 = Gho1->GetBinContent(i, j);
5336  if (ccc2 > 0.) {
5337  ccc0HO = ccc2;
5338  break;
5339  }
5340  }
5341  if (ccc0HO > 0.) {
5342  int jeta = (j - 1) / 18; // jeta = 0-21
5343  int jphi = (j - 1) - 18 * jeta; // jphi=0-17
5344  // i - # LSs:
5345  for (int i = 1; i <= nx; i++) {
5346  double ccc1 = Gho1->GetBinContent(i, j);
5347  if (ccc1 > 0.) {
5348  double Rij = ccc1 / ccc0HO;
5349  if (Rij < MAXdif3rmsHOMIN || Rij > MINdif3rmsHOMAX) {
5350  Gho61->Fill(jeta - 11, jphi, Rij);
5351  Gho60->Fill(jeta - 11, jphi, 1.);
5352  }
5353  if (Rij < 0.8 || Rij > 1.2) {
5354  G20ho61->Fill(jeta - 11, jphi, Rij);
5355  G20ho60->Fill(jeta - 11, jphi, 1.);
5356  }
5357  if (Rij < 0.7 || Rij > 1.3) {
5358  G30ho61->Fill(jeta - 11, jphi, Rij);
5359  G30ho60->Fill(jeta - 11, jphi, 1.);
5360  }
5361  if (Rij < 0.6 || Rij > 1.4) {
5362  G40ho61->Fill(jeta - 11, jphi, Rij);
5363  G40ho60->Fill(jeta - 11, jphi, 1.);
5364  }
5365  } //if(ccc1>0.
5366  } // i
5367  } //if(ccc0HO>0
5368  } // j
5369  Gho6->Divide(Gho61, Gho60, 1, 1, "B"); // average R
5370  G20ho6->Divide(G20ho61, G20ho60, 1, 1, "B"); // average R
5371  G30ho6->Divide(G30ho61, G30ho60, 1, 1, "B"); // average R
5372  G40ho6->Divide(G40ho61, G40ho60, 1, 1, "B"); // average R
5373  // Gho6->SetLabelOffset (Float_t offset=0.005, Option_t *axis="X")//Set offset between axis and axis' labels
5374  // Gho6->GetZaxis()->SetLabelOffset(-0.05);
5375  Gho6->GetZaxis()->SetLabelSize(0.025);
5376 
5377  Gho6->SetXTitle(" #eta \b");
5378  Gho6->SetYTitle(" #phi \b");
5379  Gho6->SetTitle(
5380  "<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);
5381  //gStyle->SetOptStat(kFALSE);
5382  Gho6->SetStats(0);
5383  Gho6->Draw("COLZ");
5384  //================
5385  cRBX31->cd(3);
5386  TH1F *Gho7 = new TH1F("Gho7", "", 120, 0.4, 1.6);
5387  // j - etaphi index:
5388  for (int j = 1; j <= ny; j++) {
5389  ccc0HO = Gho1->GetBinContent(1, j);
5390  if (ccc0HO <= 0.)
5391  for (int i = 1; i <= nx; i++) {
5392  double ccc2 = Gho1->GetBinContent(i, j);
5393  if (ccc2 > 0.) {
5394  ccc0HO = ccc2;
5395  break;
5396  }
5397  }
5398  if (ccc0HO > 0.) {
5399  // i - # LSs:
5400  for (int i = 1; i <= nx; i++) {
5401  double ccc1 = Gho1->GetBinContent(i, j);
5402  if (ccc1 > 0.) {
5403  double Rij = ccc1 / ccc0HO;
5404  Gho7->Fill(Rij);
5405  }
5406  }
5407  }
5408  }
5409  Gho7->SetMarkerStyle(20);
5410  Gho7->SetMarkerSize(0.4);
5411  Gho7->GetYaxis()->SetLabelSize(0.04);
5412  Gho7->SetMarkerColor(2);
5413  Gho7->SetLineColor(0);
5414  Gho7->SetYTitle(" N \b");
5415  Gho7->SetXTitle(" Rij \b");
5416  Gho7->SetTitle(" Rij \b");
5417  //Gho7->SetMinimum(0.8);Gho7->SetMaximum(500.);
5418  gPad->SetGridy();
5419  gPad->SetGridx(); // gPad->SetLogy();
5420  // Gho7->SetStats(1110000);
5421  Gho7->GetYaxis()->SetLabelSize(0.025);
5422  Gho7->Draw("Error");
5423  Float_t ymaxHO = Gho7->GetMaximum();
5424  cout << "22HO-3 ymaxHO= " << ymaxHO << " MAXdif3rmsHOMIN= " << MAXdif3rmsHOMIN
5425  << " MINdif3rmsHOMAX= " << MINdif3rmsHOMAX << endl;
5426  TLine *lineHO = new TLine(MAXdif3rmsHOMIN, 0., MAXdif3rmsHOMIN, ymaxHO);
5427  lineHO->SetLineColor(kBlue);
5428  lineHO->Draw();
5429  TLine *line1HO = new TLine(MINdif3rmsHOMAX, 0., MINdif3rmsHOMAX, ymaxHO);
5430  line1HO->SetLineColor(kBlue);
5431  line1HO->Draw();
5432  //================
5434  cRBX31->Update();
5435  cRBX31->Print("RBX-HO-3plots.png");
5436  cRBX31->Clear();
5437  // clean-up
5438  if (Gho5)
5439  delete Gho5;
5440  if (Gho60)
5441  delete Gho60;
5442  if (Gho61)
5443  delete Gho61;
5444  if (Gho6)
5445  delete Gho6;
5446  if (Gho7)
5447  delete Gho7;
5448 
5449  if (G20ho60)
5450  delete G20ho60;
5451  if (G20ho61)
5452  delete G20ho61;
5453  if (G30ho60)
5454  delete G30ho60;
5455  if (G30ho61)
5456  delete G30ho61;
5457  if (G40ho60)
5458  delete G40ho60;
5459  if (G40ho61)
5460  delete G40ho61;
5461 
5462  if (Gho1)
5463  delete Gho1;
5464  //========================================================================================== 22-1 HO:: Ratio plots jeta = 0 - 21 jphi =0 - 17
5465  //======================================================================
5466  //======================================================================28.11.2018
5467  //======================================================================
5468  //======================================================================
5469 
5470  gStyle->SetOptStat(1110000);
5471  cout << " RBX HO Ratio plotsmore *****" << endl;
5472  cRBX31->Clear();
5474  cRBX31->Divide(3, 1);
5475  //================
5476  cRBX31->cd(1);
5477  G20ho6->GetZaxis()->SetLabelSize(0.025);
5478  G20ho6->SetXTitle(" #eta \b");
5479  G20ho6->SetYTitle(" #phi \b");
5480  G20ho6->SetTitle("<Rj> for |1-<R>| > 0.20 \b");
5481  G20ho6->SetStats(0);
5482  G20ho6->Draw("COLZ");
5483  //================
5484  cRBX31->cd(2);
5485  G30ho6->GetZaxis()->SetLabelSize(0.025);
5486  G30ho6->SetXTitle(" #eta \b");
5487  G30ho6->SetYTitle(" #phi \b");
5488  G30ho6->SetTitle("<Rj> for |1-<R>| > 0.30 \b");
5489  G30ho6->SetStats(0);
5490  G30ho6->Draw("COLZ");
5491  //================
5492  cRBX31->cd(3);
5493  G40ho6->GetZaxis()->SetLabelSize(0.025);
5494  G40ho6->SetXTitle(" #eta \b");
5495  G40ho6->SetYTitle(" #phi \b");
5496  G40ho6->SetTitle("<Rj> for |1-<R>| > 0.40 \b");
5497  G40ho6->SetStats(0);
5498  G40ho6->Draw("COLZ");
5499  //================
5500 
5502  cRBX31->Update();
5503  cRBX31->Print("RBX-HO-3plotsmore.png");
5504  cRBX31->Clear();
5505 
5506  // clean-up
5507  if (G20ho6)
5508  delete G20ho6;
5509  if (G30ho6)
5510  delete G30ho6;
5511  if (G40ho6)
5512  delete G40ho6;
5513  gStyle->SetOptStat(0);
5515 
5516  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5517  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5518  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
5519  for (int jphi = 0; jphi < njphi; jphi++) {
5520  for (int jeta = 0; jeta < njeta; jeta++) {
5521  for (int i = 0; i < nx; i++) {
5522  alexall[jeta][jphi][i] = 0.;
5523  }
5524  }
5525  } // nulling
5526 
5528 
5530  //======================================================================
5531  //======================================================================
5532  //======================================================================
5533  cout << " RBX general for HF **************************" << endl;
5534  TH2F *Ghf1KKK = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs3");
5535  TH2F *Ghf1LLL = (TH2F *)dir->FindObjectAny("h_2DsumADCAmplEtaPhiLs30");
5536  TH2F *Ghf1 = (TH2F *)Ghf1LLL->Clone("Ghf1");
5537  Ghf1->Divide(Ghf1KKK, Ghf1LLL, 1, 1, "B"); // average A
5538  // Ghf1->Sumw2();
5539  // int nx = Ghf1->GetXaxis()->GetNbins(); // # LS
5540  // nx = maxbinsRBX; // # LS
5541  ny = Ghf1->GetYaxis()->GetNbins(); // # jetaphi indexes
5542  for (int j = 1; j <= ny; j++) {
5543  int jeta = (j - 1) / njphi; // jeta = 0-21
5544  if (jeta < 4 || jeta > 17) {
5545  int jphi = (j - 1) - njphi * jeta; // jphi=0-17
5546  // cout<<"HF 54 jeta= "<< jeta <<" jphi = "<<jphi <<endl;
5547  // over LS:
5548  for (int i = 1; i <= nx; i++) {
5549  double ccc1 = Ghf1->GetBinContent(i, j);
5550  alexall[jeta][jphi][i - 1] = ccc1;
5551  // if( i == 1 ) cout<<"HF 54 for LS=1 ccc1= "<< ccc1 <<endl;
5552  } //i
5553  } //if
5554  } //j
5555  // clean-up
5556  if (Ghf1KKK)
5557  delete Ghf1KKK;
5558  if (Ghf1LLL)
5559  delete Ghf1LLL;
5560  // if (Ghf1) delete Ghf1;
5561 
5562  //====================================================================== alexhf[k][i]
5563  for (int jphi = 0; jphi < njphi; jphi++) {
5564  for (int i = 0; i < nx; i++) {
5565  double sumccc1 = 0.;
5566  int isum = 0;
5567  for (int jeta = 0; jeta < njeta; jeta++) {
5568  double ccc1 = alexall[jeta][jphi][i];
5569  if (ccc1 > 0.) {
5570  sumccc1 += ccc1;
5571  isum++;
5572  }
5573  } // for jeta
5574  if (isum > 0.)
5575  sumccc1 /= isum;
5576  alexhf[jphi][i] = sumccc1;
5577  }
5578  } //for for
5579  //====================================================================== blexhf[k][i]
5580  for (int keta = 0; keta < njeta; keta++) {
5581  for (int i = 0; i < nx; i++) {
5582  double sumccc1 = 0.;
5583  int isum = 0;
5584  for (int kphi = 0; kphi < njphi; kphi++) {
5585  double ccc1 = alexall[keta][kphi][i];
5586  if (ccc1 > 0.) {
5587  sumccc1 += ccc1;
5588  isum++;
5589  }
5590  } // for kphi
5591  if (isum > 0.)
5592  sumccc1 /= isum;
5593  blexhf[keta][i] = sumccc1;
5594  }
5595  } //for for
5597  //========================================================================================== 60 HF:: 2D jeta = 0 - 21 jphi =0 - 17
5598  //======================================================================
5599  //======================================================================
5600  //======================================================================
5601  //======================================================================
5602  cout << " RBX HF 2D plot *****" << endl;
5603  cRBX1->Clear();
5605  cRBX1->Divide(1, 1);
5606  cRBX1->cd(1);
5607  // int ietaphi = 0; ietaphi = ((k2+1)-1)*nphi + (k3+1) ; k2=0-neta-1; k3=0-nphi-1; neta=18; nphi=22;
5608  TH2F *Ghf42D = new TH2F("Ghf42D", "", 23, -11.5, 11.5, 18, 0., 18.);
5609  TH2F *Ghf42D0 = new TH2F("Ghf42D0", "", 23, -11.5, 11.5, 18, 0., 18.);
5610  // TH2F* Ghf42D = new TH2F("Ghf42D","", 22, -11., 11., 18, 0., 18. );
5611  // TH2F* Ghf42D0 = new TH2F("Ghf42D0","", 22, -11., 11., 18, 0., 18. );
5612  TH2F *Ghf42DF = (TH2F *)Ghf42D0->Clone("Ghf42DF");
5613  for (int jphi = 0; jphi < njphi; jphi++) {
5614  for (int jeta = 0; jeta < njeta; jeta++) {
5615  for (int i = 0; i < nx; i++) {
5616  double ccc1 = alexall[jeta][jphi][i];
5617  int neweta = jeta - 11 - 0.5;
5618  if (jeta >= 11)
5619  neweta = jeta - 11 + 1.5;
5620  if (ccc1 > 0.) {
5621  Ghf42D->Fill(neweta, jphi, ccc1);
5622  Ghf42D0->Fill(neweta, jphi, 1.);
5623  }
5624  // if(ccc1>0.) {Ghf42D ->Fill(jeta-11,jphi,ccc1); Ghf42D0 ->Fill(jeta-11,jphi,1.); }
5625  }
5626  }
5627  }
5628  Ghf42DF->Divide(Ghf42D, Ghf42D0, 1, 1, "B"); // average A
5629  // Ghf1->Sumw2();
5630  gPad->SetGridy();
5631  gPad->SetGridx(); // gPad->SetLogz();
5632  Ghf42DF->SetMarkerStyle(20);
5633  Ghf42DF->SetMarkerSize(0.4);
5634  Ghf42DF->GetZaxis()->SetLabelSize(0.04);
5635  Ghf42DF->SetXTitle("<A>_RBX #eta \b");
5636  Ghf42DF->SetYTitle(" #phi \b");
5637  Ghf42DF->SetZTitle("<A>_RBX - All \b");
5638  Ghf42DF->SetMarkerColor(2);
5639  Ghf42DF->SetLineColor(2); // Ghf42DF->SetMaximum(1.000); // Ghf42DF->SetMinimum(1.0);
5640  Ghf42DF->Draw("COLZ");
5641 
5643  cRBX1->Update();
5644  cRBX1->Print("RBX-HF-2Dplot.png");
5645  cRBX1->Clear();
5646  // clean-up
5647  if (Ghf42D)
5648  delete Ghf42D;
5649  if (Ghf42D0)
5650  delete Ghf42D0;
5651  if (Ghf42DF)
5652  delete Ghf42DF;
5653 
5654  //========================================================================================== 61 HF:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
5655  //======================================================================
5656  //======================================================================
5657  //======================================================================
5658  //======================================================================
5659  cout << " RBX HF 1D plot *****" << endl;
5660  cRBX1->Clear();
5662  cRBX1->Divide(1, 1);
5663  cRBX1->cd(1);
5664  TH1F *GphiHF1D = new TH1F("GphiHF1D", "", 18, 0., 18.);
5665  TH1F *GphiHF1D0 = new TH1F("GphiHF1D0", "", 18, 0., 18.);
5666  TH1F *GphiHF1DF = (TH1F *)GphiHF1D0->Clone("GphiHF1DF");
5667  for (int jphi = 0; jphi < 18; jphi++) {
5668  for (int jeta = 0; jeta < 22; jeta++) {
5669  for (int i = 0; i < nx; i++) {
5670  double ccc1 = alexall[jeta][jphi][i];
5671  if (ccc1 > 0.) {
5672  GphiHF1D->Fill(jphi, ccc1);
5673  GphiHF1D0->Fill(jphi, 1.);
5674  }
5675  }
5676  }
5677  }
5678  // GphiHF1D->Sumw2();GphiHF1D0->Sumw2();
5679  GphiHF1DF->Divide(GphiHF1D, GphiHF1D0, 1, 1, "B"); // average A
5680  // GphiHF1DF->Sumw2();
5681  for (int jphi = 1; jphi < 19; jphi++) {
5682  GphiHF1DF->SetBinError(jphi, 0.01);
5683  }
5684  gPad->SetGridy();
5685  gPad->SetGridx(); // gPad->SetLogz();
5686  GphiHF1DF->SetMarkerStyle(20);
5687  GphiHF1DF->SetMarkerSize(1.4);
5688  GphiHF1DF->GetZaxis()->SetLabelSize(0.08);
5689  GphiHF1DF->SetXTitle("PHI of RBX\b");
5690  GphiHF1DF->SetYTitle(" <Amplitude> \b");
5691  GphiHF1DF->SetZTitle("<A>_PHI - All \b");
5692  GphiHF1DF->SetMarkerColor(4);
5693  GphiHF1DF->SetLineColor(4);
5694  GphiHF1DF->SetMinimum(0.8); // GphiHF1DF->SetMaximum(1.000);
5695  GphiHF1DF->Draw("Error");
5697  cRBX1->Update();
5698  cRBX1->Print("RBX-HF-1Dplot.png");
5699  cRBX1->Clear();
5700  // clean-up
5701  if (GphiHF1D)
5702  delete GphiHF1D;
5703  if (GphiHF1D0)
5704  delete GphiHF1D0;
5705  if (GphiHF1DF)
5706  delete GphiHF1DF;
5707 
5708  //========================================================================================== 62 HF:: 1D j = 7,8,9,10 ; 11,12,13,14 jphi =0 - 17
5709  //======================================================================
5710  //======================================================================
5711  //======================================================================
5712  //======================================================================
5713  cout << " RBX HF 11D plot *eta*" << endl;
5714  cRBX1->Clear();
5716  cRBX1->Divide(1, 1);
5717  cRBX1->cd(1);
5718  TH1F *GetaHF11D = new TH1F("GetaHF11D", "", 23, -11.5, 11.5);
5719  TH1F *GetaHF11D0 = new TH1F("GetaHF11D0", "", 23, -11.5, 11.5);
5720  TH1F *GetaHF11DF = (TH1F *)GetaHF11D0->Clone("GetaHF11DF");
5721 
5722  for (int jeta = 0; jeta < 22; jeta++) {
5723  for (int jphi = 0; jphi < 18; jphi++) {
5724  for (int i = 0; i < nx; i++) {
5725  double ccc1 = alexall[jeta][jphi][i];
5726  int neweta = jeta - 11 - 0.5;
5727  if (jeta >= 11)
5728  neweta = jeta - 11 + 1.5;
5729  if (ccc1 > 0.) {
5730  GetaHF11D->Fill(neweta, ccc1);
5731  GetaHF11D0->Fill(neweta, 1.);
5732  // if( i == 0 ) cout<<"62 HF: ibin= "<< i <<" jphi= "<< jphi <<" jeta= "<< jeta <<" A= "<< ccc1 <<endl;
5733  }
5734  }
5735  }
5736  }
5737  // GetaHF11D->Sumw2();GetaHF11D0->Sumw2();
5738  GetaHF11DF->Divide(GetaHF11D, GetaHF11D0, 1, 1, "B"); // average A
5739  // GetaHF11DF->Sumw2();
5740  for (int jeta = 1; jeta < 24; jeta++) {
5741  GetaHF11DF->SetBinError(jeta, 0.01);
5742  }
5743  gPad->SetGridy();
5744  gPad->SetGridx(); // gPad->SetLogz();
5745  GetaHF11DF->SetMarkerStyle(20);
5746  GetaHF11DF->SetMarkerSize(1.4);
5747  GetaHF11DF->GetZaxis()->SetLabelSize(0.08);
5748  GetaHF11DF->SetXTitle("#eta \b");
5749  GetaHF11DF->SetYTitle(" <A> \b");
5750  GetaHF11DF->SetZTitle("<A>_ETA - All \b");
5751  GetaHF11DF->SetMarkerColor(4);
5752  GetaHF11DF->SetLineColor(4);
5753  GetaHF11DF->SetMinimum(0.8); // GetaHF11DF->SetMaximum(1.000);
5754  GetaHF11DF->Draw("Error");
5755 
5757  cRBX1->Update();
5758  cRBX1->Print("RBX-HF-11Dplot.png");
5759  cRBX1->Clear();
5760  // clean-up
5761  if (GetaHF11D)
5762  delete GetaHF11D;
5763  if (GetaHF11D0)
5764  delete GetaHF11D0;
5765  if (GetaHF11DF)
5766  delete GetaHF11DF;
5767 
5768  //========================================================================================== 22 HF:: Ratio plots jeta = 0 - 21 jphi =0 - 17
5769  //======================================================================
5770  //======================================================================22.11.2018
5771  //======================================================================
5772  //======================================================================
5773 
5774  gStyle->SetOptStat(1110000);
5775  cout << " RBX HF Ratio plots *****" << endl;
5776  cRBX31->Clear();
5778  // gain stabilitY:
5779  // Rij = Aij / A1j , where i-over LSs, j-channels
5780  //
5781  // nx = maxbinsRBX; // # LS
5782  //
5783  double ccc0HF = 0.;
5784  cRBX31->Divide(3, 1);
5785  //================
5786  cRBX31->cd(1);
5787  // TH1F* Ghf5 = new TH1F("Ghf5","", nx, 1., nx+1.);
5788  TH1F *Ghf51 = new TH1F("Ghf51", "", nx, 1., nx + 1.);
5789  TH1F *Ghf50 = new TH1F("Ghf50", "", nx, 1., nx + 1.);
5790  TH1F *Ghf5 = (TH1F *)Ghf50->Clone("Ghf5");
5791  // j - etaphi index:
5792  for (int j = 1; j <= ny; j++) {
5793  ccc0HF = Ghf1->GetBinContent(1, j);
5794  // 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;} }
5795  if (ccc0HF <= 0.)
5796  for (int i = 1; i <= nx; i++) {
5797  double ccc2 = Ghf1->GetBinContent(i, j);
5798  if (ccc2 > 0.) {
5799  ccc0HF = ccc2;
5800  break;
5801  }
5802  }
5803  if (ccc0HF > 0.) {
5804  // i - # LSs:
5805  for (int i = 1; i <= nx; i++) {
5806  double ccc1 = Ghf1->GetBinContent(i, j);
5807  if (ccc1 > 0.) {
5808  double Rij = ccc1 / ccc0HF;
5809  // Ghf5 ->Fill( float(i), Rij);
5810  Ghf51->Fill(float(i), Rij);
5811  Ghf50->Fill(float(i), 1.);
5812  }
5813  }
5814  }
5815  }
5816  Ghf5->Divide(Ghf51, Ghf50, 1, 1, "B"); // average A
5817  for (int i = 1; i <= nx; i++) {
5818  Ghf5->SetBinError(i, 0.0001);
5819  }
5820  Ghf5->SetMarkerStyle(20);
5821  Ghf5->SetMarkerSize(0.4);
5822  Ghf5->GetYaxis()->SetLabelSize(0.04);
5823  Ghf5->SetMarkerColor(2);
5824  Ghf5->SetLineColor(0);
5825  Ghf5->SetXTitle(" iLS \b");
5826  Ghf5->SetYTitle(" <R> \b");
5827  Ghf5->SetTitle("<Ri> vs iLS \b");
5828  Ghf5->SetMinimum(0.); //Ghf5->SetMaximum(2.5);
5829  // gPad->SetLogy();
5830  gPad->SetGridy();
5831  gPad->SetGridx();
5832  Ghf5->SetStats(0);
5833  Ghf5->GetYaxis()->SetLabelSize(0.025);
5834  Ghf5->Draw("Error");
5835  //================
5836  cRBX31->cd(2);
5837  TH2F *Ghf60 = new TH2F("Ghf60", "", 22, -11., 11., 18, 0., 18.);
5838  TH2F *Ghf61 = new TH2F("Ghf61", "", 22, -11., 11., 18, 0., 18.);
5839  TH2F *Ghf6 = new TH2F("Ghf6", "", 22, -11., 11., 18, 0., 18.);
5840 
5841  TH2F *G20hf60 = new TH2F("G20hf60", "", 22, -11., 11., 18, 0., 18.);
5842  TH2F *G20hf61 = new TH2F("G20hf61", "", 22, -11., 11., 18, 0., 18.);
5843  TH2F *G20hf6 = new TH2F("G20hf6", "", 22, -11., 11., 18, 0., 18.);
5844  TH2F *G30hf60 = new TH2F("G30hf60", "", 22, -11., 11., 18, 0., 18.);
5845  TH2F *G30hf61 = new TH2F("G30hf61", "", 22, -11., 11., 18, 0., 18.);
5846  TH2F *G30hf6 = new TH2F("G30hf6", "", 22, -11., 11., 18, 0., 18.);
5847  TH2F *G40hf60 = new TH2F("G40hf60", "", 22, -11., 11., 18, 0., 18.);
5848  TH2F *G40hf61 = new TH2F("G40hf61", "", 22, -11., 11., 18, 0., 18.);
5849  TH2F *G40hf6 = new TH2F("G40hf6", "", 22, -11., 11., 18, 0., 18.);
5850  // j - etaphi index; i - # LSs;
5851  //
5852  // define mean and RMS:
5853  double sumjHF = 0.;
5854  int njHF = 0;
5855  double meanjHF = 0.;
5856  for (int j = 1; j <= ny; j++) {
5857  ccc0HF = Ghf1->GetBinContent(1, j);
5858  if (ccc0HF <= 0.)
5859  for (int i = 1; i <= nx; i++) {
5860  double ccc2 = Ghf1->GetBinContent(i, j);
5861  if (ccc2 > 0.) {
5862  ccc0HF = ccc2;
5863  break;
5864  }
5865  }
5866  if (ccc0HF > 0.) {
5867  for (int i = 1; i <= nx; i++) {
5868  double ccc1 = Ghf1->GetBinContent(i, j) / ccc0HF;
5869  if (ccc1 > 0.) {
5870  sumjHF += ccc1;
5871  njHF++;
5872  }
5873  }
5874  meanjHF = sumjHF / njHF;
5875  }
5876  } // j
5877 
5878  double ssumjHF = 0.;
5879  njHF = 0;
5880  double sigmajHF = 0.;
5881  for (int j = 1; j <= ny; j++) {
5882  ccc0HF = Ghf1->GetBinContent(1, j);
5883  if (ccc0HF <= 0.)
5884  for (int i = 1; i <= nx; i++) {
5885  double ccc2 = Ghf1->GetBinContent(i, j);
5886  if (ccc2 > 0.) {
5887  ccc0HF = ccc2;
5888  break;
5889  }
5890  }
5891  if (ccc0HF > 0.) {
5892  for (int i = 1; i <= nx; i++) {
5893  double ccc1 = Ghf1->GetBinContent(i, j) / ccc0HF;
5894  if (ccc1 > 0.) {
5895  ssumjHF += (ccc1 - meanjHF) * (ccc1 - meanjHF);
5896  njHF++;
5897  }
5898  }
5899  sigmajHF = sqrt(ssumjHF / njHF);
5900  }
5901  } // j
5902 
5903  double dif3rmsHFMIN = meanjHF - 3 * sigmajHF;
5904  if (dif3rmsHFMIN < 0.)
5905  dif3rmsHFMIN = 0.;
5906  double dif3rmsHFMAX = meanjHF + 3 * sigmajHF;
5907  cout << "22HF-2 meanjHF= " << meanjHF << " sigmajHF= " << sigmajHF << " dif3rmsHFMIN= " << dif3rmsHFMIN
5908  << " dif3rmsHFMAX= " << dif3rmsHFMAX << endl;
5909 
5910  double MAXdif3rmsHFMIN = dif3rmsHFMIN;
5911  double MINdif3rmsHFMAX = dif3rmsHFMAX;
5912  if (MAXdif3rmsHFMIN < 0.95)
5913  MAXdif3rmsHFMIN = 0.95;
5914  if (MINdif3rmsHFMAX > 1.05)
5915  MINdif3rmsHFMAX = 1.05;
5916  cout << "22HF-2 MAXdif3rmsHFMIN= " << MAXdif3rmsHFMIN << " MINdif3rmsHFMAX= " << MINdif3rmsHFMAX << endl;
5917  //
5918  for (int j = 1; j <= ny; j++) {
5919  ccc0HF = Ghf1->GetBinContent(1, j);
5920  if (ccc0HF <= 0.)
5921  for (int i = 1; i <= nx; i++) {
5922  double ccc2 = Ghf1->GetBinContent(i, j);
5923  if (ccc2 > 0.) {
5924  ccc0HF = ccc2;
5925  break;
5926  }
5927  }
5928  if (ccc0HF > 0.) {
5929  int jeta = (j - 1) / 18; // jeta = 0-21
5930  int jphi = (j - 1) - 18 * jeta; // jphi=0-17
5931  // i - # LSs:
5932  for (int i = 1; i <= nx; i++) {
5933  double ccc1 = Ghf1->GetBinContent(i, j);
5934  if (ccc1 > 0.) {
5935  double Rij = ccc1 / ccc0HF;
5936  if (Rij < MAXdif3rmsHFMIN || Rij > MINdif3rmsHFMAX) {
5937  Ghf61->Fill(jeta - 11, jphi, Rij);
5938  Ghf60->Fill(jeta - 11, jphi, 1.);
5939  }
5940  if (Rij < 0.8 || Rij > 1.2) {
5941  G20hf61->Fill(jeta - 11, jphi, Rij);
5942  G20hf60->Fill(jeta - 11, jphi, 1.);
5943  }
5944  if (Rij < 0.7 || Rij > 1.3) {
5945  G30hf61->Fill(jeta - 11, jphi, Rij);
5946  G30hf60->Fill(jeta - 11, jphi, 1.);
5947  }
5948  if (Rij < 0.6 || Rij > 1.4) {
5949  G40hf61->Fill(jeta - 11, jphi, Rij);
5950  G40hf60->Fill(jeta - 11, jphi, 1.);
5951  }
5952  } //if(ccc1>0.
5953  } // i
5954  } //if(ccc0HF>0
5955  } // j
5956  Ghf6->Divide(Ghf61, Ghf60, 1, 1, "B"); // average R
5957  G20hf6->Divide(G20hf61, G20hf60, 1, 1, "B"); // average R
5958  G30hf6->Divide(G30hf61, G30hf60, 1, 1, "B"); // average R
5959  G40hf6->Divide(G40hf61, G40hf60, 1, 1, "B"); // average R
5960  // Ghf6->SetLabelOffset (Float_t offset=0.005, Option_t *axis="X")//Set offset between axis and axis' labels
5961  // Ghf6->GetZaxis()->SetLabelOffset(-0.05);
5962  Ghf6->GetZaxis()->SetLabelSize(0.025);
5963 
5964  Ghf6->SetXTitle(" #eta \b");
5965  Ghf6->SetYTitle(" #phi \b");
5966  Ghf6->SetTitle(
5967  "<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);
5968  //gStyle->SetOptStat(kFALSE);
5969  Ghf6->SetStats(0);
5970  Ghf6->Draw("COLZ");
5971  //================
5972  cRBX31->cd(3);
5973  TH1F *Ghf7 = new TH1F("Ghf7", "", 120, 0.4, 1.6);
5974  // j - etaphi index:
5975  for (int j = 1; j <= ny; j++) {
5976  ccc0HF = Ghf1->GetBinContent(1, j);
5977  if (ccc0HF <= 0.)
5978  for (int i = 1; i <= nx; i++) {
5979  double ccc2 = Ghf1->GetBinContent(i, j);
5980  if (ccc2 > 0.) {
5981  ccc0HF = ccc2;
5982  break;
5983  }
5984  }
5985  if (ccc0HF > 0.) {
5986  // i - # LSs:
5987  for (int i = 1; i <= nx; i++) {
5988  double ccc1 = Ghf1->GetBinContent(i, j);
5989  if (ccc1 > 0.) {
5990  double Rij = ccc1 / ccc0HF;
5991  Ghf7->Fill(Rij);
5992  }
5993  }
5994  }
5995  }
5996  Ghf7->SetMarkerStyle(20);
5997  Ghf7->SetMarkerSize(0.4);
5998  Ghf7->GetYaxis()->SetLabelSize(0.04);
5999  Ghf7->SetMarkerColor(2);
6000  Ghf7->SetLineColor(0);
6001  Ghf7->SetYTitle(" N \b");
6002  Ghf7->SetXTitle(" Rij \b");
6003  Ghf7->SetTitle(" Rij \b");
6004  //Ghf7->SetMinimum(0.8);Ghf7->SetMaximum(500.);
6005  gPad->SetGridy();
6006  gPad->SetGridx(); // gPad->SetLogy();
6007  // Ghf7->SetStats(1110000);
6008  Ghf7->GetYaxis()->SetLabelSize(0.025);
6009  Ghf7->Draw("Error");
6010  Float_t ymaxHF = Ghf7->GetMaximum();
6011  cout << "22HF-3 ymaxHF= " << ymaxHF << " MAXdif3rmsHFMIN= " << MAXdif3rmsHFMIN
6012  << " MINdif3rmsHFMAX= " << MINdif3rmsHFMAX << endl;
6013  TLine *lineHF = new TLine(MAXdif3rmsHFMIN, 0., MAXdif3rmsHFMIN, ymaxHF);
6014  lineHF->SetLineColor(kBlue);
6015  lineHF->Draw();
6016  TLine *line1HF = new TLine(MINdif3rmsHFMAX, 0., MINdif3rmsHFMAX, ymaxHF);
6017  line1HF->SetLineColor(kBlue);
6018  line1HF->Draw();
6019  //================
6021  cRBX31->Update();
6022  cRBX31->Print("RBX-HF-3plots.png");
6023  cRBX31->Clear();
6024  // clean-up
6025  if (Ghf5)
6026  delete Ghf5;
6027  if (Ghf60)
6028  delete Ghf60;
6029  if (Ghf61)
6030  delete Ghf61;
6031  if (Ghf6)
6032  delete Ghf6;
6033  if (Ghf7)
6034  delete Ghf7;
6035 
6036  if (G20hf60)
6037  delete G20hf60;
6038  if (G20hf61)
6039  delete G20hf61;
6040  if (G30hf60)
6041  delete G30hf60;
6042  if (G30hf61)
6043  delete G30hf61;
6044  if (G40hf60)
6045  delete G40hf60;
6046  if (G40hf61)
6047  delete G40hf61;
6048 
6049  if (Ghf1)
6050  delete Ghf1;
6051  //========================================================================================== 22-1 HF:: Ratio plots jeta = 0 - 21 jphi =0 - 17
6052  //======================================================================
6053  //======================================================================28.11.2018
6054  //======================================================================
6055  //======================================================================
6056 
6057  gStyle->SetOptStat(1110000);
6058  cout << " RBX HF Ratio plotsmore *****" << endl;
6059  cRBX31->Clear();
6061  cRBX31->Divide(3, 1);
6062  //================
6063  cRBX31->cd(1);
6064  G20hf6->GetZaxis()->SetLabelSize(0.025);
6065  G20hf6->SetXTitle(" #eta \b");
6066  G20hf6->SetYTitle(" #phi \b");
6067  G20hf6->SetTitle("<Rj> for |1-<R>| > 0.20 \b");
6068  G20hf6->SetStats(0);
6069  G20hf6->Draw("COLZ");
6070  //================
6071  cRBX31->cd(2);
6072  G30hf6->GetZaxis()->SetLabelSize(0.025);
6073  G30hf6->SetXTitle(" #eta \b");
6074  G30hf6->SetYTitle(" #phi \b");
6075  G30hf6->SetTitle("<Rj> for |1-<R>| > 0.30 \b");
6076  G30hf6->SetStats(0);
6077  G30hf6->Draw("COLZ");
6078  //================
6079  cRBX31->cd(3);
6080  G40hf6->GetZaxis()->SetLabelSize(0.025);
6081  G40hf6->SetXTitle(" #eta \b");
6082  G40hf6->SetYTitle(" #phi \b");
6083  G40hf6->SetTitle("<Rj> for |1-<R>| > 0.40 \b");
6084  G40hf6->SetStats(0);
6085  G40hf6->Draw("COLZ");
6086  //================
6087 
6089  cRBX31->Update();
6090  cRBX31->Print("RBX-HF-3plotsmore.png");
6091  cRBX31->Clear();
6092 
6093  // clean-up
6094  if (G20hf6)
6095  delete G20hf6;
6096  if (G30hf6)
6097  delete G30hf6;
6098  if (G40hf6)
6099  delete G40hf6;
6100  gStyle->SetOptStat(0);
6102  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
6103  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
6104  cout << ">>>>>>>>>>>>>>>>>>>>>>>> " << endl;
6106 
6108 
6110  //=============================================================================== occupancyHB
6111  // For occupancy plots. Produces OccPlots_HBx.png (x=1)
6112  int mymaxbins = MaxLum;
6113  {
6114  cHB->Clear();
6115  cHB->Divide(2, 1);
6117  cHB->cd(1);
6118  TH2F *occhbm = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HBM");
6119  TH1F *uyhbm = new TH1F("uyhbm", "", mymaxbins, 1., mymaxbins + 1.);
6120  for (int i = 1; i <= occhbm->GetXaxis()->GetNbins(); i++) {
6121  double ccc1 = occhbm->GetBinContent(i);
6122  // if(ccc1>0.) cout<<" depth1_HB iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6123  if (ccc1 > 0.)
6124  uyhbm->Fill(float(i), ccc1);
6125  }
6126  // gPad->SetLogy();
6127  uyhbm->SetMarkerStyle(20);
6128  uyhbm->SetMarkerSize(0.6);
6129  uyhbm->GetYaxis()->SetLabelSize(0.04);
6130  uyhbm->SetXTitle("min/av occupancy - HBM \b");
6131  uyhbm->SetMarkerColor(2);
6132  uyhbm->SetLineColor(0);
6133  uyhbm->SetMaximum(1.0);
6134  uyhbm->SetMinimum(0.2);
6135  gPad->SetGridy();
6136  uyhbm->Draw("Error");
6138  cHB->cd(2);
6139  TH2F *occhbp = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HBP");
6140  TH1F *uyhbp = new TH1F("uyhbp", "", mymaxbins, 1., mymaxbins + 1.);
6141  for (int i = 1; i <= occhbp->GetXaxis()->GetNbins(); i++) {
6142  double ccc1 = occhbp->GetBinContent(i);
6143  // if(ccc1>0.) cout<<" depth1_HB iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6144  if (ccc1 > 0.)
6145  uyhbp->Fill(float(i), ccc1);
6146  }
6147  // gPad->SetLogy();
6148  uyhbp->SetMarkerStyle(20);
6149  uyhbp->SetMarkerSize(0.6);
6150  uyhbp->GetYaxis()->SetLabelSize(0.04);
6151  uyhbp->SetXTitle("min/av occupancy - HBP \b");
6152  uyhbp->SetMarkerColor(2);
6153  uyhbp->SetLineColor(0);
6154  uyhbp->SetMaximum(1.0);
6155  uyhbp->SetMinimum(0.2);
6156  gPad->SetGridy();
6157  uyhbp->Draw("Error");
6159 
6161  cHB->Update();
6162  cHB->Print(Form("OccPlots_HB.png"));
6163  cHB->Clear();
6164 
6165  // clean-up
6166  if (occhbm)
6167  delete occhbm;
6168  if (uyhbm)
6169  delete uyhbm;
6170  if (occhbp)
6171  delete occhbp;
6172  if (uyhbp)
6173  delete uyhbp;
6174  }
6175  //=============================================================================== occupancyHE
6176  // For occupancy plots. Produces OccPlots_HEx.png (x=1)
6177  {
6178  cHB->Clear();
6179  cHB->Divide(2, 1);
6181  cHB->cd(1);
6182  TH2F *occhem = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HEM");
6183  TH1F *uyhem = new TH1F("uyhem", "", mymaxbins, 1., mymaxbins + 1.);
6184  for (int i = 1; i <= occhem->GetXaxis()->GetNbins(); i++) {
6185  double ccc1 = occhem->GetBinContent(i);
6186  // if(ccc1>0.) cout<<" depth1_HE iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6187  if (ccc1 > 0.)
6188  uyhem->Fill(float(i), ccc1);
6189  }
6190  // gPad->SetLogy();
6191  uyhem->SetMarkerStyle(20);
6192  uyhem->SetMarkerSize(0.6);
6193  uyhem->GetYaxis()->SetLabelSize(0.04);
6194  uyhem->SetXTitle("min/av occupancy - HEM \b");
6195  uyhem->SetMarkerColor(2);
6196  uyhem->SetLineColor(0);
6197  uyhem->SetMaximum(1.0);
6198  uyhem->SetMinimum(0.2);
6199  gPad->SetGridy();
6200  uyhem->Draw("Error");
6202  cHB->cd(2);
6203  TH2F *occhep = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HEP");
6204  TH1F *uyhep = new TH1F("uyhep", "", mymaxbins, 1., mymaxbins + 1.);
6205  for (int i = 1; i <= occhep->GetXaxis()->GetNbins(); i++) {
6206  double ccc1 = occhep->GetBinContent(i);
6207  // if(ccc1>0.) cout<<" depth1_HE iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6208  if (ccc1 > 0.)
6209  uyhep->Fill(float(i), ccc1);
6210  }
6211  // gPad->SetLogy();
6212  uyhep->SetMarkerStyle(20);
6213  uyhep->SetMarkerSize(0.6);
6214  uyhep->GetYaxis()->SetLabelSize(0.04);
6215  uyhep->SetXTitle("min/av occupancy - HEP \b");
6216  uyhep->SetMarkerColor(2);
6217  uyhep->SetLineColor(0);
6218  uyhep->SetMaximum(1.0);
6219  uyhep->SetMinimum(0.2);
6220  gPad->SetGridy();
6221  uyhep->Draw("Error");
6223 
6225  cHB->Update();
6226  cHB->Print(Form("OccPlots_HE.png"));
6227  cHB->Clear();
6228 
6229  // clean-up
6230  if (occhem)
6231  delete occhem;
6232  if (uyhem)
6233  delete uyhem;
6234  if (occhep)
6235  delete occhep;
6236  if (uyhep)
6237  delete uyhep;
6238  }
6239  //=============================================================================== occupancyHO
6240  // For occupancy plots. Produces OccPlots_HOx.png (x=1)
6241  {
6242  cHB->Clear();
6243  cHB->Divide(2, 1);
6245  cHB->cd(1);
6246  TH2F *occhom = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HOM");
6247  TH1F *uyhom = new TH1F("uyhom", "", mymaxbins, 1., mymaxbins + 1.);
6248  for (int i = 1; i <= occhom->GetXaxis()->GetNbins(); i++) {
6249  double ccc1 = occhom->GetBinContent(i);
6250  // if(ccc1>0.) cout<<" depth1_HO iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6251  if (ccc1 > 0.)
6252  uyhom->Fill(float(i), ccc1);
6253  }
6254  // gPad->SetLogy();
6255  uyhom->SetMarkerStyle(20);
6256  uyhom->SetMarkerSize(0.6);
6257  uyhom->GetYaxis()->SetLabelSize(0.04);
6258  uyhom->SetXTitle("min/av occupancy - HOM \b");
6259  uyhom->SetMarkerColor(2);
6260  uyhom->SetLineColor(0);
6261  uyhom->SetMaximum(1.0);
6262  uyhom->SetMinimum(0.2);
6263  gPad->SetGridy();
6264  uyhom->Draw("Error");
6266  cHB->cd(2);
6267  TH2F *occhop = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HOP");
6268  TH1F *uyhop = new TH1F("uyhop", "", mymaxbins, 1., mymaxbins + 1.);
6269  for (int i = 1; i <= occhop->GetXaxis()->GetNbins(); i++) {
6270  double ccc1 = occhop->GetBinContent(i);
6271  // if(ccc1>0.) cout<<" depth1_HO iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6272  if (ccc1 > 0.)
6273  uyhop->Fill(float(i), ccc1);
6274  }
6275  // gPad->SetLogy();
6276  uyhop->SetMarkerStyle(20);
6277  uyhop->SetMarkerSize(0.6);
6278  uyhop->GetYaxis()->SetLabelSize(0.04);
6279  uyhop->SetXTitle("min/av occupancy - HOP \b");
6280  uyhop->SetMarkerColor(2);
6281  uyhop->SetLineColor(0);
6282  uyhop->SetMaximum(1.0);
6283  uyhop->SetMinimum(0.2);
6284  gPad->SetGridy();
6285  uyhop->Draw("Error");
6287 
6289  cHB->Update();
6290  cHB->Print(Form("OccPlots_HO.png"));
6291  cHB->Clear();
6292 
6293  // clean-up
6294  if (occhom)
6295  delete occhom;
6296  if (uyhom)
6297  delete uyhom;
6298  if (occhop)
6299  delete occhop;
6300  if (uyhop)
6301  delete uyhop;
6302  }
6303  //=============================================================================== occupancyHF
6304  // For occupancy plots. Produces OccPlots_HFx.png (x=1)
6305  {
6306  cHB->Clear();
6307  cHB->Divide(2, 1);
6309  cHB->cd(1);
6310  TH2F *occhfm = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HFM");
6311  TH1F *uyhfm = new TH1F("uyhfm", "", mymaxbins, 1., mymaxbins + 1.);
6312  for (int i = 1; i <= occhfm->GetXaxis()->GetNbins(); i++) {
6313  double ccc1 = occhfm->GetBinContent(i);
6314  // if(ccc1>0.) cout<<" depth1_HF iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6315  if (ccc1 > 0.)
6316  uyhfm->Fill(float(i), ccc1);
6317  }
6318  // gPad->SetLogy();
6319  uyhfm->SetMarkerStyle(20);
6320  uyhfm->SetMarkerSize(0.6);
6321  uyhfm->GetYaxis()->SetLabelSize(0.04);
6322  uyhfm->SetXTitle("min/av occupancy - HFM \b");
6323  uyhfm->SetMarkerColor(2);
6324  uyhfm->SetLineColor(0);
6325  uyhfm->SetMaximum(1.0);
6326  uyhfm->SetMinimum(0.2);
6327  gPad->SetGridy();
6328  uyhfm->Draw("Error");
6330  cHB->cd(2);
6331  TH2F *occhfp = (TH2F *)dir->FindObjectAny("h_RatioOccupancy_HFP");
6332  TH1F *uyhfp = new TH1F("uyhfp", "", mymaxbins, 1., mymaxbins + 1.);
6333  for (int i = 1; i <= occhfp->GetXaxis()->GetNbins(); i++) {
6334  double ccc1 = occhfp->GetBinContent(i);
6335  // if(ccc1>0.) cout<<" depth1_HF iLS = "<<i<<" <As> per LS= "<<ccc1<<endl;
6336  if (ccc1 > 0.)
6337  uyhfp->Fill(float(i), ccc1);
6338  }
6339  // gPad->SetLogy();
6340  uyhfp->SetMarkerStyle(20);
6341  uyhfp->SetMarkerSize(0.6);
6342  uyhfp->GetYaxis()->SetLabelSize(0.04);
6343  uyhfp->SetXTitle("min/av occupancy - HFP \b");
6344  uyhfp->SetMarkerColor(2);
6345  uyhfp->SetLineColor(0);
6346  uyhfp->SetMaximum(1.0);
6347  uyhfp->SetMinimum(0.2);
6348  gPad->SetGridy();
6349  uyhfp->Draw("Error");
6351 
6353  cHB->Update();
6354  cHB->Print(Form("OccPlots_HF.png"));
6355  cHB->Clear();
6356 
6357  // clean-up
6358  if (occhfm)
6359  delete occhfm;
6360  if (uyhfm)
6361  delete uyhfm;
6362  if (occhfp)
6363  delete occhfp;
6364  if (uyhfp)
6365  delete uyhfp;
6366  }
6367  std::cout << "************>>> occupancy plots done" << std::endl;
6368 
6373  //************************* ***** Signal *****
6374  cout << ">>>>>>>>>>>>>>>>>>>>>>>>start Summed Amplitude Plots " << endl;
6375  int maxbins = MaxLum;
6376  cout << ">>>> maxbins = " << maxbins << endl;
6377  TH1F *SummedAmplitudeHisto[4]; // 1d histogramm for subdet
6378  SummedAmplitudeHisto[0] = (TH1F *)dir->FindObjectAny("h_averSIGNALsumamplitude_HB");
6379  SummedAmplitudeHisto[1] = (TH1F *)dir->FindObjectAny("h_averSIGNALsumamplitude_HE");
6380  SummedAmplitudeHisto[2] = (TH1F *)dir->FindObjectAny("h_averSIGNALsumamplitude_HO");
6381  SummedAmplitudeHisto[3] = (TH1F *)dir->FindObjectAny("h_averSIGNALsumamplitude_HF");
6382  TH1F *SummedAmplitudeOccupancyHisto[4]; // 1d histogramm for subdet
6383  SummedAmplitudeOccupancyHisto[0] = (TH1F *)dir->FindObjectAny("h_averSIGNALoccupancy_HB");
6384  SummedAmplitudeOccupancyHisto[1] = (TH1F *)dir->FindObjectAny("h_averSIGNALoccupancy_HE");
6385  SummedAmplitudeOccupancyHisto[2] = (TH1F *)dir->FindObjectAny("h_averSIGNALoccupancy_HO");
6386  SummedAmplitudeOccupancyHisto[3] = (TH1F *)dir->FindObjectAny("h_averSIGNALoccupancy_HF");
6387  for (int sub = 0; sub < 4; sub++) {
6388  cHE->Clear();
6389  cHE->Divide(2, 1);
6390  cHE->cd(1);
6391  TH1F *kslpq = new TH1F("kslpq", "", maxbins, 1., maxbins + 1.);
6392  // cout<<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> sub = "<< sub <<endl;
6393  for (int i = 1; i <= kslpq->GetXaxis()->GetNbins(); i++) {
6394  double ccc1 = 0.;
6395  if (SummedAmplitudeHisto[sub])
6396  ccc1 = SummedAmplitudeHisto[sub]->GetBinContent(i);
6397  // if(ccc1>0.) cout<<" iLS = "<<i<<" LS= "<<ccc1<<endl;
6398  if (ccc1 > 0.)
6399  kslpq->Fill(float(i), ccc1);
6400  }
6401  // gPad->SetLogy();
6402  kslpq->SetMarkerStyle(20);
6403  kslpq->SetMarkerSize(0.8);
6404  kslpq->GetYaxis()->SetLabelSize(0.04);
6405  kslpq->SetXTitle("SumA of channels w/ signal per LS \b");
6406  kslpq->SetMarkerColor(2);
6407  kslpq->SetLineColor(0);
6408  // kslpq->SetMinimum(0.8);
6409  gPad->SetGridx();
6410  kslpq->Draw("Error");
6412  cHE->cd(2);
6413  TH1F *pqmks = new TH1F("pqmks", "", maxbins, 1., maxbins + 1.);
6414  for (int i = 1; i <= pqmks->GetXaxis()->GetNbins(); i++) {
6415  double ccc1 = 0.;
6416  if (SummedAmplitudeOccupancyHisto[sub])
6417  ccc1 = SummedAmplitudeOccupancyHisto[sub]->GetBinContent(i);
6418  // if(ccc1>0.) cout<<" iLS = "<<i<<" LS= "<<ccc1<<endl;
6419  if (ccc1 > 0.)
6420  pqmks->Fill(float(i), ccc1);
6421  }
6422  // gPad->SetLogy();
6423  pqmks->SetMarkerStyle(20);
6424  pqmks->SetMarkerSize(0.8);
6425  pqmks->GetYaxis()->SetLabelSize(0.04);
6426  pqmks->SetXTitle("Occupancy of channels w/ signal per LS \b");
6427  pqmks->SetMarkerColor(4);
6428  pqmks->SetLineColor(0);
6429  // pqmks->SetMinimum(0.8);
6430  gPad->SetGridx();
6431  pqmks->Draw("Error");
6432  cHE->Update();
6433  if (sub == 0)
6434  cHE->Print("SummedAmplitudesSignal_HB.png");
6435  if (sub == 1)
6436  cHE->Print("SummedAmplitudesSignal_HE.png");
6437  if (sub == 2)
6438  cHE->Print("SummedAmplitudesSignal_HO.png");
6439  if (sub == 3)
6440  cHE->Print("SummedAmplitudesSignal_HF.png");
6441  cHE->Clear();
6442  if (kslpq)
6443  delete kslpq;
6444  if (pqmks)
6445  delete pqmks;
6446  } //for
6447  // clean-up
6448  //for (unsigned int i=0; i<4; i++) {delete SummedAmplitudeHisto[i];delete SummedAmplitudeOccupancyHisto[i];}
6449 
6452  //************************* ***** NoSignal *****
6453  cout << ">>>>>>>>>>>>>>>>>>>>>>>>start Summed Amplitude Plots NoSignal " << endl;
6454  TH1F *NoSignalSummedAmplitudeHisto[4]; // 1d histogramm for subdet
6455  NoSignalSummedAmplitudeHisto[0] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALsumamplitude_HB");
6456  NoSignalSummedAmplitudeHisto[1] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALsumamplitude_HE");
6457  NoSignalSummedAmplitudeHisto[2] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALsumamplitude_HO");
6458  NoSignalSummedAmplitudeHisto[3] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALsumamplitude_HF");
6459  TH1F *NoSignalSummedAmplitudeOccupancyHisto[4]; // 1d histogramm for subdet
6460  NoSignalSummedAmplitudeOccupancyHisto[0] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALoccupancy_HB");
6461  NoSignalSummedAmplitudeOccupancyHisto[1] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALoccupancy_HE");
6462  NoSignalSummedAmplitudeOccupancyHisto[2] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALoccupancy_HO");
6463  NoSignalSummedAmplitudeOccupancyHisto[3] = (TH1F *)dir->FindObjectAny("h_averNOSIGNALoccupancy_HF");
6464  for (int sub = 0; sub < 4; sub++) {
6465  cHE->Clear();
6466  cHE->Divide(2, 1);
6467 
6468  cHE->cd(1);
6469  TH1F *kslpq = new TH1F("kslpq", "", maxbins, 1., maxbins + 1.);
6470  for (int i = 1; i <= kslpq->GetXaxis()->GetNbins(); i++) {
6471  double ccc1 = 0.;
6472  if (NoSignalSummedAmplitudeHisto[sub])
6473  ccc1 = NoSignalSummedAmplitudeHisto[sub]->GetBinContent(i);
6474  // if(ccc1>0.) cout<<" iLS = "<<i<<" LS= "<<ccc1<<endl;
6475  if (ccc1 > 0.)
6476  kslpq->Fill(float(i), ccc1);
6477  }
6478  // gPad->SetLogy();
6479  kslpq->SetMarkerStyle(20);
6480  kslpq->SetMarkerSize(0.8);
6481  kslpq->GetYaxis()->SetLabelSize(0.04);
6482  kslpq->SetXTitle("SumA of channels w/o signal per LS \b");
6483  kslpq->SetMarkerColor(2);
6484  kslpq->SetLineColor(0);
6485  if (sub == 0) {
6486  kslpq->SetMaximum(20000.);
6487  kslpq->SetMinimum(5000.);
6488  } else if (sub == 1) {
6489  kslpq->SetMaximum(40000.);
6490  kslpq->SetMinimum(0.);
6491  } else if (sub == 2) {
6492  kslpq->SetMaximum(10000.);
6493  kslpq->SetMinimum(15000.);
6494  } else if (sub == 3) {
6495  kslpq->SetMaximum(100000.);
6496  kslpq->SetMinimum(0.);
6497  }
6498  gPad->SetGridx();
6499  kslpq->Draw("Error");
6501  cHE->cd(2);
6502  TH1F *pqmks = new TH1F("pqmks", "", maxbins, 1., maxbins + 1.);
6503  for (int i = 1; i <= pqmks->GetXaxis()->GetNbins(); i++) {
6504  double ccc1 = 0.;
6505  if (NoSignalSummedAmplitudeOccupancyHisto[sub])
6506  ccc1 = NoSignalSummedAmplitudeOccupancyHisto[sub]->GetBinContent(i);
6507  // if(ccc1>0.) cout<<" iLS = "<<i<<" LS= "<<ccc1<<endl;
6508  if (ccc1 > 0.)
6509  pqmks->Fill(float(i), ccc1);
6510  }
6511  // gPad->SetLogy();
6512  pqmks->SetMarkerStyle(20);
6513  pqmks->SetMarkerSize(0.8);
6514  pqmks->GetYaxis()->SetLabelSize(0.04);
6515  pqmks->SetXTitle("Occupancy of channels w/o signal per LS \b");
6516  pqmks->SetMarkerColor(4);
6517  pqmks->SetLineColor(0);
6518  if (sub == 0) {
6519  pqmks->SetMaximum(600.);
6520  pqmks->SetMinimum(200.);
6521  } else if (sub == 1) {
6522  pqmks->SetMaximum(910.);
6523  pqmks->SetMinimum(10.);
6524  } else if (sub == 2) {
6525  pqmks->SetMaximum(200.);
6526  pqmks->SetMinimum(50.);
6527  } else if (sub == 3) {
6528  pqmks->SetMaximum(866.);
6529  pqmks->SetMinimum(856.);
6530  }
6531  gPad->SetGridx();
6532  pqmks->Draw("Error");
6533  cHE->Update();
6534  if (sub == 0)
6535  cHE->Print("NoSignalSummedAmplitudes_HB.png");
6536  if (sub == 1)
6537  cHE->Print("NoSignalSummedAmplitudes_HE.png");
6538  if (sub == 2)
6539  cHE->Print("NoSignalSummedAmplitudes_HO.png");
6540  if (sub == 3)
6541  cHE->Print("NoSignalSummedAmplitudes_HF.png");
6542  cHE->Clear();
6543  if (kslpq)
6544  delete kslpq;
6545  if (pqmks)
6546  delete pqmks;
6547  } //for
6548  // clean-up
6549  //for (unsigned int i=0; i<4; i++) {delete NoSignalSummedAmplitudeHisto[i];delete NoSignalSummedAmplitudeOccupancyHisto[i];}
6551 
6554  //************************* ***** MaxxValues *****
6555  cout << ">>>>>>>>>>>>>>>>>>>>>>>>start Summed Amplitude Plots Maxx " << endl;
6556  TH1F *MaxxSummedAmplitudeHisto[4]; // 1d histogramm for subdet
6557  MaxxSummedAmplitudeHisto[0] = (TH1F *)dir->FindObjectAny("h_maxxSUMAmpl_HB");
6558  MaxxSummedAmplitudeHisto[1] = (TH1F *)dir->FindObjectAny("h_maxxSUMAmpl_HE");
6559  MaxxSummedAmplitudeHisto[2] = (TH1F *)dir->FindObjectAny("h_maxxSUMAmpl_HO");
6560  MaxxSummedAmplitudeHisto[3] = (TH1F *)dir->FindObjectAny("h_maxxSUMAmpl_HF");
6561  TH1F *MaxxSummedAmplitudeOccupancyHisto[4]; // 1d histogramm for subdet
6562  MaxxSummedAmplitudeOccupancyHisto[0] = (TH1F *)dir->FindObjectAny("h_maxxOCCUP_HB");
6563  MaxxSummedAmplitudeOccupancyHisto[1] = (TH1F *)dir->FindObjectAny("h_maxxOCCUP_HE");
6564  MaxxSummedAmplitudeOccupancyHisto[2] = (TH1F *)dir->FindObjectAny("h_maxxOCCUP_HO");
6565  MaxxSummedAmplitudeOccupancyHisto[3] = (TH1F *)dir->FindObjectAny("h_maxxOCCUP_HF");
6566  TH1F *SAmplitudeHisto[4]; // 1d histogramm for subdet
6567  SAmplitudeHisto[0] = (TH1F *)dir->FindObjectAny("h_eventamplitude_HB");
6568  SAmplitudeHisto[1] = (TH1F *)dir->FindObjectAny("h_eventamplitude_HE");
6569  SAmplitudeHisto[2] = (TH1F *)dir->FindObjectAny("h_eventamplitude_HO");
6570  SAmplitudeHisto[3] = (TH1F *)dir->FindObjectAny("h_eventamplitude_HF");
6571  TH1F *OccupancyHisto[4]; // 1d histogramm for subdet
6572  OccupancyHisto[0] = (TH1F *)dir->FindObjectAny("h_eventoccupancy_HB");
6573  OccupancyHisto[1] = (TH1F *)dir->FindObjectAny("h_eventoccupancy_HE");
6574  OccupancyHisto[2] = (TH1F *)dir->FindObjectAny("h_eventoccupancy_HO");
6575  OccupancyHisto[3] = (TH1F *)dir->FindObjectAny("h_eventoccupancy_HF");
6576 
6577  int countamplmaxHB = 0;
6578  int countamplmaxHE = 0;
6579  int countamplmaxHO = 0;
6580  int countamplmaxHF = 0;
6581  int countoccumaxHB = 0;
6582  int countoccumaxHE = 0;
6583  int countoccumaxHO = 0;
6584  int countoccumaxHF = 0;
6585  unsigned long int countamplHB = 0;
6586  unsigned long int countamplHE = 0;
6587  unsigned long int countamplHO = 0;
6588  unsigned long int countamplHF = 0;
6589  unsigned long int countoccuHB = 0;
6590  unsigned long int countoccuHE = 0;
6591  unsigned long int countoccuHO = 0;
6592  unsigned long int countoccuHF = 0;
6593  gStyle->SetOptStat(110000);
6594  for (int sub = 0; sub < 4; sub++) {
6595  cFour->Clear();
6596  cFour->Divide(2, 2);
6597 
6598  cFour->cd(1);
6599  TH1F *lpqxc = new TH1F("lpqxc", "", maxbins, 1., maxbins + 1.);
6600  for (int i = 1; i <= lpqxc->GetXaxis()->GetNbins(); i++) {
6601  double ccc1 = 0.;
6602  if (MaxxSummedAmplitudeHisto[sub])
6603  ccc1 = MaxxSummedAmplitudeHisto[sub]->GetBinContent(i);
6604  // if(ccc1>0.) cout<<"111111111111111111111111111 iLS = "<<i<<" LS= "<<ccc1<<endl;
6605  if (ccc1 > 0.)
6606  lpqxc->Fill(float(i), ccc1);
6607  if (sub == 0 && ccc1 > 60000.)
6608  countamplmaxHB++;
6609  if (sub == 1 && ccc1 > 60000.)
6610  countamplmaxHE++;
6611  if (sub == 2 && ccc1 > 150000.)
6612  countamplmaxHO++;
6613  if (sub == 3 && ccc1 > 22000.)
6614  countamplmaxHF++;
6615  }
6616  // gPad->SetLogy();
6617  lpqxc->SetMarkerStyle(20);
6618  lpqxc->SetMarkerSize(0.8);
6619  // lpqxc->GetYaxis()->SetLabelSize(0.08);
6620  if (sub == 0)
6621  lpqxc->SetXTitle("HB: max SA over LS-events per LS \b");
6622  if (sub == 1)
6623  lpqxc->SetXTitle("HE: max SA over LS-events per LS \b");
6624  if (sub == 2)
6625  lpqxc->SetXTitle("HO: max SA over LS-events per LS \b");
6626  if (sub == 3)
6627  lpqxc->SetXTitle("HF: max SA over LS-events per LS \b");
6628  lpqxc->SetMarkerColor(2);
6629  lpqxc->SetLineColor(0);
6630  gPad->SetGridx();
6631  lpqxc->Draw("Error");
6632 
6634  cFour->cd(2);
6635  TH1F *hpzlm = new TH1F("hpzlm", "", maxbins, 1., maxbins + 1.);
6636  for (int i = 1; i <= hpzlm->GetXaxis()->GetNbins(); i++) {
6637  double ccc1 = 0.;
6638  if (MaxxSummedAmplitudeOccupancyHisto[sub])
6639  ccc1 = MaxxSummedAmplitudeOccupancyHisto[sub]->GetBinContent(i);
6640  // if(ccc1>0.) cout<<"2222222222222222222222222 iLS = "<<i<<" LS= "<<ccc1<<endl;
6641  if (ccc1 > 0.)
6642  hpzlm->Fill(float(i), ccc1);
6643  if (sub == 0 && ccc1 > 2000.)
6644  countoccumaxHB++;
6645  if (sub == 1 && ccc1 > 1200.)
6646  countoccumaxHE++;
6647  if (sub == 2 && ccc1 > 2000.)
6648  countoccumaxHO++;
6649  if (sub == 3 && ccc1 > 860.)
6650  countoccumaxHF++;
6651  }
6652  // gPad->SetLogy();
6653  hpzlm->SetMarkerStyle(20);
6654  hpzlm->SetMarkerSize(0.8);
6655  // hpzlm->GetYaxis()->SetLabelSize(0.08);
6656  if (sub == 0)
6657  hpzlm->SetXTitle("HB: max Occupancy over LS-events per LS \b");
6658  if (sub == 1)
6659  hpzlm->SetXTitle("HE: max Occupancy over LS-events per LS \b");
6660  if (sub == 2)
6661  hpzlm->SetXTitle("HO: max Occupancy over LS-events per LS \b");
6662  if (sub == 3)
6663  hpzlm->SetXTitle("HF: max Occupancy over LS-events per LS \b");
6664  hpzlm->SetMarkerColor(4);
6665  hpzlm->SetLineColor(0);
6666  gPad->SetGridx();
6667  if (sub == 3) {
6668  hpzlm->SetMaximum(866.);
6669  hpzlm->SetMinimum(856.);
6670  }
6671  hpzlm->Draw("Error");
6672 
6674  cFour->cd(3);
6675  gPad->SetLogy();
6676  if (SAmplitudeHisto[sub]) {
6677  for (int i = 1; i <= SAmplitudeHisto[sub]->GetXaxis()->GetNbins(); i++) {
6678  // if(sub==0 && i * 800> 60000.) {
6679  // cout<<">=>=>>=> countamplHB= "<<countamplHB<<" content = "<<SAmplitudeHisto[sub]->GetBinContent(i)<<" sub= "<<sub<<" i= "<<i<< endl;
6680  // countamplHB+=SAmplitudeHisto[sub]->GetBinContent(i);
6681  // }
6682  if (sub == 0 && i * 800 > 60000.)
6683  countamplHB += SAmplitudeHisto[sub]->GetBinContent(i);
6684  if (sub == 1 && i * 1000 > 60000.)
6685  countamplHE += SAmplitudeHisto[sub]->GetBinContent(i);
6686  if (sub == 2 && i * 2500 > 150000.)
6687  countamplHO += SAmplitudeHisto[sub]->GetBinContent(i);
6688  if (sub == 3 && i * 1400 > 22000.)
6689  countamplHF += SAmplitudeHisto[sub]->GetBinContent(i);
6690  }
6691  SAmplitudeHisto[sub]->SetMarkerStyle(20);
6692  SAmplitudeHisto[sub]->SetMarkerSize(0.8);
6693  if (sub == 0)
6694  SAmplitudeHisto[sub]->SetTitle("HB event Amplitude\b");
6695  if (sub == 1)
6696  SAmplitudeHisto[sub]->SetTitle("HE event Amplitude\b");
6697  if (sub == 2)
6698  SAmplitudeHisto[sub]->SetTitle("HO event Amplitude\b");
6699  if (sub == 3)
6700  SAmplitudeHisto[sub]->SetTitle("HF event Amplitude\b");
6701  // SAmplitudeHisto[sub]->GetYaxis()->SetLabelSize(0.08);
6702  SAmplitudeHisto[sub]->SetXTitle("event amplitude \b");
6703  SAmplitudeHisto[sub]->SetMarkerColor(2);
6704  SAmplitudeHisto[sub]->SetLineColor(2);
6705  SAmplitudeHisto[sub]->Draw("");
6706  }
6708  cFour->cd(4);
6709  gPad->SetLogy();
6710  if (OccupancyHisto[sub]) {
6711  for (int i = 1; i <= OccupancyHisto[sub]->GetXaxis()->GetNbins(); i++) {
6712  if (sub == 0 && i * 30 > 2000.)
6713  countoccuHB += OccupancyHisto[sub]->GetBinContent(i);
6714  if (sub == 1 && i * 20 > 1200.)
6715  countoccuHE += OccupancyHisto[sub]->GetBinContent(i);
6716  if (sub == 2 && i * 25 > 2000.)
6717  countoccuHO += OccupancyHisto[sub]->GetBinContent(i);
6718  if (sub == 3 && i * 10 > 860.)
6719  countoccuHF += OccupancyHisto[sub]->GetBinContent(i);
6720  }
6721  OccupancyHisto[sub]->SetMarkerStyle(20);
6722  OccupancyHisto[sub]->SetMarkerSize(0.8);
6723  if (sub == 0)
6724  OccupancyHisto[sub]->SetTitle("HB event Occupancy\b");
6725  if (sub == 1)
6726  OccupancyHisto[sub]->SetTitle("HE event Occupancy\b");
6727  if (sub == 2)
6728  OccupancyHisto[sub]->SetTitle("HO event Occupancy\b");
6729  if (sub == 3)
6730  OccupancyHisto[sub]->SetTitle("HF event Occupancy\b");
6731  // OccupancyHisto[sub]->GetYaxis()->SetLabelSize(0.08);
6732  OccupancyHisto[sub]->SetXTitle("event occupancy \b");
6733  OccupancyHisto[sub]->SetMarkerColor(4);
6734  OccupancyHisto[sub]->SetLineColor(4);
6735  OccupancyHisto[sub]->Draw("");
6736  }
6737 
6738  cFour->Update();
6739  if (sub == 0)
6740  cFour->Print("MaxxSummedAmplitudes_HB.png");
6741  if (sub == 1)
6742  cFour->Print("MaxxSummedAmplitudes_HE.png");
6743  if (sub == 2)
6744  cFour->Print("MaxxSummedAmplitudes_HO.png");
6745  if (sub == 3)
6746  cFour->Print("MaxxSummedAmplitudes_HF.png");
6747  cFour->Clear();
6748  if (lpqxc)
6749  delete lpqxc;
6750  if (hpzlm)
6751  delete hpzlm;
6752  } //for
6753  gStyle->SetOptStat(0);
6755  cout << ">=>=>>=> countamplmaxHB= " << countamplmaxHB << " countamplmaxHE= " << countamplmaxHE
6756  << " countamplmaxHO= " << countamplmaxHO << " countamplmaxHF= " << countamplmaxHF << endl;
6757  cout << ">=>=>>=> countoccumaxHB= " << countoccumaxHB << " countoccumaxHE= " << countoccumaxHE
6758  << " countoccumaxHO= " << countoccumaxHO << " countoccumaxHF= " << countoccumaxHF << endl;
6759  cout << ">=>=>>=> countamplHB= " << countamplHB << " countamplHE= " << countamplHE << " countamplHO= " << countamplHO
6760  << " countamplHF= " << countamplHF << endl;
6761  cout << ">=>=>>=> countoccuHB= " << countoccuHB << " countoccuHE= " << countoccuHE << " countoccuHO= " << countoccuHO
6762  << " countoccuHF= " << countoccuHF << endl;
6763 
6766  //************************* ***** channelsummedA over depths *****
6767  cout << ">>>>>>>>>>>>>>>>>>>>>>>>channelsummedA over depths " << endl;
6768  TH1F *ChannelDepthsummedAmplitudesPlots[4]; // 1d histogramm for subdet
6769  ChannelDepthsummedAmplitudesPlots[0] = (TH1F *)dir->FindObjectAny("h_sumamplitudechannel_HB");
6770  ChannelDepthsummedAmplitudesPlots[1] = (TH1F *)dir->FindObjectAny("h_sumamplitudechannel_HE");
6771  ChannelDepthsummedAmplitudesPlots[2] = (TH1F *)dir->FindObjectAny("h_sumamplitudechannel_HO");
6772  ChannelDepthsummedAmplitudesPlots[3] = (TH1F *)dir->FindObjectAny("h_sumamplitudechannel_HF");
6773  TLine *litebdt[4];
6774  if (ChannelDepthsummedAmplitudesPlots[0])
6775  litebdt[0] = new TLine(80., 0.8, 80., ChannelDepthsummedAmplitudesPlots[0]->GetBinContent(4) + 100.);
6776  if (ChannelDepthsummedAmplitudesPlots[1])
6777  litebdt[1] = new TLine(200., 0.8, 200., ChannelDepthsummedAmplitudesPlots[1]->GetBinContent(7) + 100.);
6778  if (ChannelDepthsummedAmplitudesPlots[2])
6779  litebdt[2] = new TLine(1200., 0.8, 1200., ChannelDepthsummedAmplitudesPlots[2]->GetBinContent(17) + 100.);
6780  if (ChannelDepthsummedAmplitudesPlots[3])
6781  litebdt[3] = new TLine(600., 0.8, 600., ChannelDepthsummedAmplitudesPlots[3]->GetBinContent(6) + 100.);
6782 
6783  gStyle->SetOptStat(110000);
6784  cFour1->Clear();
6785  cFour1->Divide(2, 2);
6786  for (int sub = 0; sub < 4; sub++) {
6787  if (sub == 0)
6788  cFour1->cd(1);
6789  if (sub == 1)
6790  cFour1->cd(2);
6791  if (sub == 2)
6792  cFour1->cd(3);
6793  if (sub == 3)
6794  cFour1->cd(4);
6795  gPad->SetLogy();
6796  ChannelDepthsummedAmplitudesPlots[sub]->SetMarkerStyle(20);
6797  ChannelDepthsummedAmplitudesPlots[sub]->SetMarkerSize(0.8);
6798  if (sub == 0)
6799  ChannelDepthsummedAmplitudesPlots[sub]->SetTitle("HB channel Amplitudes\b");
6800  if (sub == 1)
6801  ChannelDepthsummedAmplitudesPlots[sub]->SetTitle("HE channel Amplitudes\b");
6802  if (sub == 2)
6803  ChannelDepthsummedAmplitudesPlots[sub]->SetTitle("HO channel Amplitudes\b");
6804  if (sub == 3)
6805  ChannelDepthsummedAmplitudesPlots[sub]->SetTitle("HF channel Amplitudes\b");
6806  if (sub == 0)
6807  ChannelDepthsummedAmplitudesPlots[sub]->SetXTitle("HB channel depths summed Amplitudes \b");
6808  if (sub == 1)
6809  ChannelDepthsummedAmplitudesPlots[sub]->SetXTitle("HE channel depths summed Amplitudes \b");
6810  if (sub == 2)
6811  ChannelDepthsummedAmplitudesPlots[sub]->SetXTitle("HO channel depths summed Amplitudes \b");
6812  if (sub == 3)
6813  ChannelDepthsummedAmplitudesPlots[sub]->SetXTitle("HF channel depths summed Amplitudes \b");
6814  ChannelDepthsummedAmplitudesPlots[sub]->SetMarkerColor(2);
6815  ChannelDepthsummedAmplitudesPlots[sub]->SetLineColor(2);
6816  ChannelDepthsummedAmplitudesPlots[sub]->Draw("");
6817  litebdt[sub]->SetLineColor(kBlue);
6818  litebdt[sub]->Draw("s");
6819  } //for
6820  cFour1->Update();
6821  cFour1->Print("ChannelDepthsummedAmplitudes.png");
6822  cFour1->Clear();
6823  gStyle->SetOptStat(0);
6824 
6827  //************************* ***** Ataildepth1_HB *****
6828  cout << ">>>>>>>>>>>>>>>>>>>>>>>>2DAtaildepth " << endl;
6830  cHB->Clear();
6831  cHB->Divide(2, 1);
6832 
6833  TH2F *DAtaildepth1[2]; // 1d histogramm for subdet
6834  DAtaildepth1[0] = (TH2F *)dir->FindObjectAny("h_2DAtaildepth1_HB");
6835  DAtaildepth1[1] = (TH2F *)dir->FindObjectAny("h_2D0Ataildepth1_HB");
6836  cHB->cd(1);
6837  if (!DAtaildepth1[0] || !DAtaildepth1[1]) {
6838  cout << ">>>>>>>>>>>>>>>>>>>>>>>>Ataildepth1_HB EMPTY histoes for 2DAtaildepth 1" << endl;
6839  } else {
6840  TH2F *tail1 = (TH2F *)DAtaildepth1[0]->Clone("tail1");
6841  tail1->Divide(DAtaildepth1[0], DAtaildepth1[1], 1, 1, "B");
6842  // tail1->Sumw2();
6843  gPad->SetGridy();
6844  gPad->SetGridx();
6845  gPad->SetLogz();
6846  tail1->SetMarkerStyle(20);
6847  tail1->SetMarkerSize(0.4);
6848  tail1->SetTitle("Amplitudes for tail-events (HBdepth1) \b");
6849  tail1->SetXTitle("#eta \b");
6850  tail1->SetYTitle("#phi \b");
6851  tail1->SetZTitle("2D <A> in the tail - HB Depth1 \b");
6852  tail1->SetMarkerColor(2);
6853  tail1->SetLineColor(2);
6854  tail1->Draw("COLZ");
6855  }
6856  TH2F *DAtaildepth2[2]; // 1d histogramm for subdet
6857  DAtaildepth2[0] = (TH2F *)dir->FindObjectAny("h_2DAtaildepth2_HB");
6858  DAtaildepth2[1] = (TH2F *)dir->FindObjectAny("h_2D0Ataildepth2_HB");
6859  cHB->cd(2);
6860  if (!DAtaildepth2[0] || !DAtaildepth2[1]) {
6861  cout << ">>>>>>>>>>>>>>>>>>>>>>>>Ataildepth1_HB EMPTY histoes for 2DAtaildepth 2" << endl;
6862  } else {
6863  TH2F *tail2 = (TH2F *)DAtaildepth2[0]->Clone("tail2");
6864  tail2->Divide(DAtaildepth2[0], DAtaildepth2[1], 1, 1, "B");
6865  // tail2->Sumw2();
6866  gPad->SetGridy();
6867  gPad->SetGridx();
6868  gPad->SetLogz();
6869  tail2->SetMarkerStyle(20);
6870  tail2->SetMarkerSize(0.4);
6871  tail2->SetTitle("Amplitudes for tail-events (HBdepth2) \b");
6872  tail2->SetXTitle("#eta \b");
6873  tail2->SetYTitle("#phi \b");
6874  tail2->SetZTitle("2D <A> in the tail - HB Depth2 \b");
6875  tail2->SetMarkerColor(2);
6876  tail2->SetLineColor(2);
6877  tail2->Draw("COLZ");
6878  }
6879 
6880  cHB->Update();
6881  cHB->Print("AtaildepthHB.png");
6882  cHB->Clear();
6883 
6886  //************************* ***** sum(Signal+NoSignal) occupancy for HF *****
6887  cout << ">>>>>>>>>>>>>>>>>>>>>>>>sumOccupancyHF " << endl;
6889  cHB->Clear();
6890  cHB->Divide(1, 1);
6891  cHB->cd(1);
6892  if (SummedAmplitudeOccupancyHisto[3]) {
6893  TH1F *ufrew1 = (TH1F *)SummedAmplitudeOccupancyHisto[3]->Clone("ufrew1");
6894  if (SummedAmplitudeOccupancyHisto[3] && NoSignalSummedAmplitudeOccupancyHisto[3])
6895  ufrew1->Add(SummedAmplitudeOccupancyHisto[3], NoSignalSummedAmplitudeOccupancyHisto[3], 1, 1);
6896  ufrew1->GetXaxis()->SetRangeUser(1., maxbins + 1.);
6897  gPad->SetGridx();
6898  ufrew1->SetMarkerStyle(20);
6899  ufrew1->SetMarkerSize(0.8);
6900  ufrew1->GetYaxis()->SetLabelSize(0.04);
6901  ufrew1->SetTitle("HF Occupancy vs LS\b");
6902  ufrew1->SetXTitle("average occupancy per LS HF\b");
6903  ufrew1->SetMarkerColor(4);
6904  ufrew1->SetLineColor(0);
6905  ufrew1->SetMaximum(866.);
6906  ufrew1->SetMinimum(856.);
6907  ufrew1->Draw("Error");
6908  cHB->Update();
6909  cHB->Print("sumOccupancyHF.png");
6910  cHB->Clear();
6911  if (ufrew1)
6912  delete ufrew1;
6913  }
6914 
6917  //======================================================================
6918  cSix->Clear();
6919  cSix->Divide(2, 3);
6920 
6921  cSix->cd(1);
6922  TH1F *MiliEvHB8 = (TH1F *)dir->FindObjectAny("h_nadccounts8_HB");
6923  int MaxMil0HB8 = MiliEvHB8->GetBinContent(MiliEvHB8->GetMaximumBin());
6924  int MaxMilHB8 = 0;
6925  for (int i = 1; i <= MiliEvHB8->GetXaxis()->GetNbins(); i++) {
6926  if (MiliEvHB8->GetBinContent(i)) {
6927  MaxMilHB8 = i;
6928  }
6929  }
6930  cout << "HB8- MaxMil0HB8= " << MaxMil0HB8 << " MaxMilHB8= " << MaxMilHB8 << endl;
6931  gPad->SetLogy();
6932  MiliEvHB8->GetYaxis()->SetLabelSize(0.04);
6933  MiliEvHB8->SetTitle("Number of events per nadccountsHB8");
6934  MiliEvHB8->SetXTitle("nadccountsHB8");
6935  MiliEvHB8->SetYTitle("Number of events HB8");
6936  MiliEvHB8->SetMarkerStyle(20);
6937  MiliEvHB8->SetMarkerSize(0.4);
6938  MiliEvHB8->SetMarkerColor(4);
6939  MiliEvHB8->SetLineColor(0);
6940  MiliEvHB8->GetXaxis()->SetRangeUser(0, MaxMilHB8);
6941  MiliEvHB8->Draw("Error");
6942 
6943  cSix->cd(2);
6944  TH1F *MiliEvHB6 = (TH1F *)dir->FindObjectAny("h_nadccounts6_HB");
6945  int MaxMil0HB6 = MiliEvHB6->GetBinContent(MiliEvHB6->GetMaximumBin());
6946  int MaxMilHB6 = 0;
6947  for (int i = 1; i <= MiliEvHB6->GetXaxis()->GetNbins(); i++) {
6948  if (MiliEvHB6->GetBinContent(i)) {
6949  MaxMilHB6 = i;
6950  }
6951  }
6952  cout << "HB6- MaxMil0HB6= " << MaxMil0HB6 << " MaxMilHB6= " << MaxMilHB6 << endl;
6953  // gPad->SetGridy();
6954  // gPad->SetGridx();
6955  gPad->SetLogy();
6956  // gPad->SetLogx();
6957  MiliEvHB6->GetYaxis()->SetLabelSize(0.04);
6958  MiliEvHB6->SetTitle("Number of events per nadccountsHB6");
6959  MiliEvHB6->SetXTitle("nadccountsHB6");
6960  MiliEvHB6->SetYTitle("Number of events HB6");
6961  MiliEvHB6->SetMarkerStyle(20);
6962  MiliEvHB6->SetMarkerSize(0.4);
6963  MiliEvHB6->SetMarkerColor(4);
6964  MiliEvHB6->SetLineColor(0);
6965  // MiliEvHB6->SetMinimum(0.8);
6966  MiliEvHB6->GetXaxis()->SetRangeUser(0, MaxMilHB6);
6967  MiliEvHB6->Draw("Error");
6968 
6969  cSix->cd(3);
6970  TH1F *MiliEvHB4 = (TH1F *)dir->FindObjectAny("h_nadccounts4_HB");
6971  int MaxMil0HB4 = MiliEvHB4->GetBinContent(MiliEvHB4->GetMaximumBin());
6972  int MaxMilHB4 = 0;
6973  for (int i = 1; i <= MiliEvHB4->GetXaxis()->GetNbins(); i++) {
6974  if (MiliEvHB4->GetBinContent(i)) {
6975  MaxMilHB4 = i;
6976  }
6977  }
6978  gPad->SetLogy();
6979  MiliEvHB4->GetYaxis()->SetLabelSize(0.04);
6980  MiliEvHB4->SetTitle("Number of events per nadccountsHB4");
6981  MiliEvHB4->SetXTitle("nadccountsHB4");
6982  MiliEvHB4->SetYTitle("Number of events HB4");
6983  MiliEvHB4->SetMarkerStyle(20);
6984  MiliEvHB4->SetMarkerSize(0.4);
6985  MiliEvHB4->SetMarkerColor(4);
6986  MiliEvHB4->SetLineColor(0);
6987  MiliEvHB4->GetXaxis()->SetRangeUser(0, MaxMilHB4);
6988  MiliEvHB4->Draw("Error");
6989 
6990  cSix->cd(4);
6991  TH1F *MiliEvHB3 = (TH1F *)dir->FindObjectAny("h_nadccounts3_HB");
6992  int MaxMil0HB3 = MiliEvHB3->GetBinContent(MiliEvHB3->GetMaximumBin());
6993  int MaxMilHB3 = 0;
6994  for (int i = 1; i <= MiliEvHB3->GetXaxis()->GetNbins(); i++) {
6995  if (MiliEvHB3->GetBinContent(i)) {
6996  MaxMilHB3 = i;
6997  }
6998  }
6999  gPad->SetLogy();
7000  MiliEvHB3->GetYaxis()->SetLabelSize(0.04);
7001  MiliEvHB3->SetTitle("Number of events per nadccountsHB3");
7002  MiliEvHB3->SetXTitle("nadccountsHB3");
7003  MiliEvHB3->SetYTitle("Number of events HB3");
7004  MiliEvHB3->SetMarkerStyle(20);
7005  MiliEvHB3->SetMarkerSize(0.4);
7006  MiliEvHB3->SetMarkerColor(4);
7007  MiliEvHB3->SetLineColor(0);
7008  MiliEvHB3->GetXaxis()->SetRangeUser(0, MaxMilHB3);
7009  MiliEvHB3->Draw("Error");
7010 
7011  cSix->cd(5);
7012  TH1F *MiliEvHB2 = (TH1F *)dir->FindObjectAny("h_nadccounts2_HB");
7013  int MaxMil0HB2 = MiliEvHB2->GetBinContent(MiliEvHB2->GetMaximumBin());
7014  int MaxMilHB2 = 0;
7015  for (int i = 1; i <= MiliEvHB2->GetXaxis()->GetNbins(); i++) {
7016  if (MiliEvHB2->GetBinContent(i)) {
7017  MaxMilHB2 = i;
7018  }
7019  }
7020  gPad->SetLogy();
7021  MiliEvHB2->GetYaxis()->SetLabelSize(0.04);
7022  MiliEvHB2->SetTitle("Number of events per nadccountsHB2");
7023  MiliEvHB2->SetXTitle("nadccountsHB2");
7024  MiliEvHB2->SetYTitle("Number of events HB2");
7025  MiliEvHB2->SetMarkerStyle(20);
7026  MiliEvHB2->SetMarkerSize(0.4);
7027  MiliEvHB2->SetMarkerColor(4);
7028  MiliEvHB2->SetLineColor(0);
7029  MiliEvHB2->GetXaxis()->SetRangeUser(0, MaxMilHB2);
7030  MiliEvHB2->Draw("Error");
7031 
7032  cSix->cd(6);
7033  TH1F *MiliEvHB0 = (TH1F *)dir->FindObjectAny("h_nadccounts0_HB");
7034  int MaxMil0HB0 = MiliEvHB0->GetBinContent(MiliEvHB0->GetMaximumBin());
7035  int MaxMilHB0 = 0;
7036  for (int i = 1; i <= MiliEvHB0->GetXaxis()->GetNbins(); i++) {
7037  if (MiliEvHB0->GetBinContent(i)) {
7038  MaxMilHB0 = i;
7039  }
7040  }
7041  gPad->SetLogy();
7042  MiliEvHB0->GetYaxis()->SetLabelSize(0.04);
7043  MiliEvHB0->SetTitle("Number of events per nadccountsHB0");
7044  MiliEvHB0->SetXTitle("nadccountsHB0");
7045  MiliEvHB0->SetYTitle("Number of events HB0");
7046  MiliEvHB0->SetMarkerStyle(20);
7047  MiliEvHB0->SetMarkerSize(0.4);
7048  MiliEvHB0->SetMarkerColor(4);
7049  MiliEvHB0->SetLineColor(0);
7050  MiliEvHB0->GetXaxis()->SetRangeUser(0, MaxMilHB0);
7051  MiliEvHB0->Draw("Error");
7052 
7053  cSix->Update();
7054  cSix->Print("Sticking_cases86432HB.png");
7055  cSix->Clear();
7056  if (MiliEvHB8)
7057  delete MiliEvHB8;
7058  if (MiliEvHB6)
7059  delete MiliEvHB6;
7060  if (MiliEvHB4)
7061  delete MiliEvHB4;
7062  if (MiliEvHB3)
7063  delete MiliEvHB3;
7064  if (MiliEvHB2)
7065  delete MiliEvHB2;
7066  if (MiliEvHB0)
7067  delete MiliEvHB0;
7068 
7070  //======================================================================
7071  cSix->Clear();
7072  cSix->Divide(2, 3);
7073 
7074  cSix->cd(1);
7075  TH1F *MiliEvHE8 = (TH1F *)dir->FindObjectAny("h_nadccounts8_HE");
7076  int MaxMil0HE8 = MiliEvHE8->GetBinContent(MiliEvHE8->GetMaximumBin());
7077  int MaxMilHE8 = 0;
7078  for (int i = 1; i <= MiliEvHE8->GetXaxis()->GetNbins(); i++) {
7079  if (MiliEvHE8->GetBinContent(i)) {
7080  MaxMilHE8 = i;
7081  }
7082  }
7083  cout << "HE8- MaxMil0HE8= " << MaxMil0HE8 << " MaxMilHE8= " << MaxMilHE8 << endl;
7084  gPad->SetLogy();
7085  MiliEvHE8->GetYaxis()->SetLabelSize(0.04);
7086  MiliEvHE8->SetTitle("Number of events per nadccountsHE8");
7087  MiliEvHE8->SetXTitle("nadccountsHE8");
7088  MiliEvHE8->SetYTitle("Number of events HE8");
7089  MiliEvHE8->SetMarkerStyle(20);
7090  MiliEvHE8->SetMarkerSize(0.4);
7091  MiliEvHE8->SetMarkerColor(4);
7092  MiliEvHE8->SetLineColor(0);
7093  MiliEvHE8->GetXaxis()->SetRangeUser(0, MaxMilHE8);
7094  MiliEvHE8->Draw("Error");
7095 
7096  cSix->cd(2);
7097  TH1F *MiliEvHE6 = (TH1F *)dir->FindObjectAny("h_nadccounts6_HE");
7098  int MaxMil0HE6 = MiliEvHE6->GetBinContent(MiliEvHE6->GetMaximumBin());
7099  int MaxMilHE6 = 0;
7100  for (int i = 1; i <= MiliEvHE6->GetXaxis()->GetNbins(); i++) {
7101  if (MiliEvHE6->GetBinContent(i)) {
7102  MaxMilHE6 = i;
7103  }
7104  }
7105  cout << "HE6- MaxMil0HE6= " << MaxMil0HE6 << " MaxMilHE6= " << MaxMilHE6 << endl;
7106  // gPad->SetGridy();
7107  // gPad->SetGridx();
7108  gPad->SetLogy();
7109  // gPad->SetLogx();
7110  MiliEvHE6->GetYaxis()->SetLabelSize(0.04);
7111  MiliEvHE6->SetTitle("Number of events per nadccountsHE6");
7112  MiliEvHE6->SetXTitle("nadccountsHE6");
7113  MiliEvHE6->SetYTitle("Number of events HE6");
7114  MiliEvHE6->SetMarkerStyle(20);
7115  MiliEvHE6->SetMarkerSize(0.4);
7116  MiliEvHE6->SetMarkerColor(4);
7117  MiliEvHE6->SetLineColor(0);
7118  // MiliEvHE6->SetMinimum(0.8);
7119  MiliEvHE6->GetXaxis()->SetRangeUser(0, MaxMilHE6);
7120  MiliEvHE6->Draw("Error");
7121 
7122  cSix->cd(3);
7123  TH1F *MiliEvHE4 = (TH1F *)dir->FindObjectAny("h_nadccounts4_HE");
7124  int MaxMil0HE4 = MiliEvHE4->GetBinContent(MiliEvHE4->GetMaximumBin());
7125  int MaxMilHE4 = 0;
7126  for (int i = 1; i <= MiliEvHE4->GetXaxis()->GetNbins(); i++) {
7127  if (MiliEvHE4->GetBinContent(i)) {
7128  MaxMilHE4 = i;
7129  }
7130  }
7131  gPad->SetLogy();
7132  MiliEvHE4->GetYaxis()->SetLabelSize(0.04);
7133  MiliEvHE4->SetTitle("Number of events per nadccountsHE4");
7134  MiliEvHE4->SetXTitle("nadccountsHE4");
7135  MiliEvHE4->SetYTitle("Number of events HE4");
7136  MiliEvHE4->SetMarkerStyle(20);
7137  MiliEvHE4->SetMarkerSize(0.4);
7138  MiliEvHE4->SetMarkerColor(4);
7139  MiliEvHE4->SetLineColor(0);
7140  MiliEvHE4->GetXaxis()->SetRangeUser(0, MaxMilHE4);
7141  MiliEvHE4->Draw("Error");
7142 
7143  cSix->cd(4);
7144  TH1F *MiliEvHE3 = (TH1F *)dir->FindObjectAny("h_nadccounts3_HE");
7145  int MaxMil0HE3 = MiliEvHE3->GetBinContent(MiliEvHE3->GetMaximumBin());
7146  int MaxMilHE3 = 0;
7147  for (int i = 1; i <= MiliEvHE3->GetXaxis()->GetNbins(); i++) {
7148  if (MiliEvHE3->GetBinContent(i)) {
7149  MaxMilHE3 = i;
7150  }
7151  }
7152  gPad->SetLogy();
7153  MiliEvHE3->GetYaxis()->SetLabelSize(0.04);
7154  MiliEvHE3->SetTitle("Number of events per nadccountsHE3");
7155  MiliEvHE3->SetXTitle("nadccountsHE3");
7156  MiliEvHE3->SetYTitle("Number of events HE3");
7157  MiliEvHE3->SetMarkerStyle(20);
7158  MiliEvHE3->SetMarkerSize(0.4);
7159  MiliEvHE3->SetMarkerColor(4);
7160  MiliEvHE3->SetLineColor(0);
7161  MiliEvHE3->GetXaxis()->SetRangeUser(0, MaxMilHE3);
7162  MiliEvHE3->Draw("Error");
7163 
7164  cSix->cd(5);
7165  TH1F *MiliEvHE2 = (TH1F *)dir->FindObjectAny("h_nadccounts2_HE");
7166  int MaxMil0HE2 = MiliEvHE2->GetBinContent(MiliEvHE2->GetMaximumBin());
7167  int MaxMilHE2 = 0;
7168  for (int i = 1; i <= MiliEvHE2->GetXaxis()->GetNbins(); i++) {
7169  if (MiliEvHE2->GetBinContent(i)) {
7170  MaxMilHE2 = i;
7171  }
7172  }
7173  gPad->SetLogy();
7174  MiliEvHE2->GetYaxis()->SetLabelSize(0.04);
7175  MiliEvHE2->SetTitle("Number of events per nadccountsHE2");
7176  MiliEvHE2->SetXTitle("nadccountsHE2");
7177  MiliEvHE2->SetYTitle("Number of events HE2");
7178  MiliEvHE2->SetMarkerStyle(20);
7179  MiliEvHE2->SetMarkerSize(0.4);
7180  MiliEvHE2->SetMarkerColor(4);
7181  MiliEvHE2->SetLineColor(0);
7182  MiliEvHE2->GetXaxis()->SetRangeUser(0, MaxMilHE2);
7183  MiliEvHE2->Draw("Error");
7184 
7185  cSix->cd(6);
7186  TH1F *MiliEvHE0 = (TH1F *)dir->FindObjectAny("h_nadccounts0_HE");
7187  int MaxMil0HE0 = MiliEvHE0->GetBinContent(MiliEvHE0->GetMaximumBin());
7188  int MaxMilHE0 = 0;
7189  for (int i = 1; i <= MiliEvHE0->GetXaxis()->GetNbins(); i++) {
7190  if (MiliEvHE0->GetBinContent(i)) {
7191  MaxMilHE0 = i;
7192  }
7193  }
7194  gPad->SetLogy();
7195  MiliEvHE0->GetYaxis()->SetLabelSize(0.04);
7196  MiliEvHE0->SetTitle("Number of events per nadccountsHE0");
7197  MiliEvHE0->SetXTitle("nadccountsHE0");
7198  MiliEvHE0->SetYTitle("Number of events HE0");
7199  MiliEvHE0->SetMarkerStyle(20);
7200  MiliEvHE0->SetMarkerSize(0.4);
7201  MiliEvHE0->SetMarkerColor(4);
7202  MiliEvHE0->SetLineColor(0);
7203  MiliEvHE0->GetXaxis()->SetRangeUser(0, MaxMilHE0);
7204  MiliEvHE0->Draw("Error");
7205 
7206  cSix->Update();
7207  cSix->Print("Sticking_cases86432HE.png");
7208  cSix->Clear();
7209  if (MiliEvHE8)
7210  delete MiliEvHE8;
7211  if (MiliEvHE6)
7212  delete MiliEvHE6;
7213  if (MiliEvHE4)
7214  delete MiliEvHE4;
7215  if (MiliEvHE3)
7216  delete MiliEvHE3;
7217  if (MiliEvHE2)
7218  delete MiliEvHE2;
7219  if (MiliEvHE0)
7220  delete MiliEvHE0;
7221 
7222  //====================================================================================================================
7223  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =====================================================================" << endl;
7224 
7225  //=====================================================================================================
7226  cout << ">>>>>>>>>>>>>>>>>>>>>>>> ==================================================" << endl;
7227 
7228  //=====================================================================================
7229  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =================================" << endl;
7230  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =================================" << endl;
7231  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =================================" << endl;
7232  cout << ">>>>>>>>>>>>>>>>>>>>>>>> =================================" << endl;
7233 
7234  cout << ">>>>>>> START NOW CREATING OF HTML PAGES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
7235  //======================================================================
7236  // Creating each test kind for each subdet html pages:
7237  std::string raw_class;
7238  int ind = 0;
7239  ofstream htmlFile;
7240  for (int test = 0; test <= 5; test++) { //Test: 0,
7241  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
7242 
7243  // cout<<"Creating each test kind for each subdet html pages: test= "<< test << " sub= " << sub << endl;
7244  if (test == 0) {
7245  if (sub == 1) {
7246  htmlFile.open("HB_CapID.html");
7247  }
7248  if (sub == 2) {
7249  htmlFile.open("HE_CapID.html");
7250  }
7251  if (sub == 3) {
7252  htmlFile.open("HO_CapID.html");
7253  }
7254  if (sub == 4) {
7255  htmlFile.open("HF_CapID.html");
7256  }
7257  }
7258  if (test == 1) {
7259  if (sub == 1) {
7260  htmlFile.open("HB_ADCampl.html");
7261  }
7262  if (sub == 2) {
7263  htmlFile.open("HE_ADCampl.html");
7264  }
7265  if (sub == 3) {
7266  htmlFile.open("HO_ADCampl.html");
7267  }
7268  if (sub == 4) {
7269  htmlFile.open("HF_ADCampl.html");
7270  }
7271  }
7272  if (test == 2) {
7273  if (sub == 1) {
7274  htmlFile.open("HB_Width.html");
7275  }
7276  if (sub == 2) {
7277  htmlFile.open("HE_Width.html");
7278  }
7279  if (sub == 3) {
7280  htmlFile.open("HO_Width.html");
7281  }
7282  if (sub == 4) {
7283  htmlFile.open("HF_Width.html");
7284  }
7285  }
7286  if (test == 3) {
7287  if (sub == 1) {
7288  htmlFile.open("HB_Ratio.html");
7289  }
7290  if (sub == 2) {
7291  htmlFile.open("HE_Ratio.html");
7292  }
7293  if (sub == 3) {
7294  htmlFile.open("HO_Ratio.html");
7295  }
7296  if (sub == 4) {
7297  htmlFile.open("HF_Ratio.html");
7298  }
7299  }
7300  if (test == 4) {
7301  if (sub == 1) {
7302  htmlFile.open("HB_Tmean.html");
7303  }
7304  if (sub == 2) {
7305  htmlFile.open("HE_Tmean.html");
7306  }
7307  if (sub == 3) {
7308  htmlFile.open("HO_Tmean.html");
7309  }
7310  if (sub == 4) {
7311  htmlFile.open("HF_Tmean.html");
7312  }
7313  }
7314  if (test == 5) {
7315  if (sub == 1) {
7316  htmlFile.open("HB_Tmax.html");
7317  }
7318  if (sub == 2) {
7319  htmlFile.open("HE_Tmax.html");
7320  }
7321  if (sub == 3) {
7322  htmlFile.open("HO_Tmax.html");
7323  }
7324  if (sub == 4) {
7325  htmlFile.open("HF_Tmax.html");
7326  }
7327  }
7328 
7329  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
7330  htmlFile << "<head>" << std::endl;
7331  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
7332  htmlFile << "<title> Certification Monitoring Tool </title>" << std::endl;
7333  htmlFile << "<style type=\"text/css\">" << std::endl;
7334  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
7335  << std::endl;
7336  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
7337  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
7338  "text-align: center;}"
7339  << std::endl;
7340  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
7341  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
7342  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
7343  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
7344  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
7345  htmlFile << "</style>" << std::endl;
7346  htmlFile << "<body>" << std::endl;
7347 
7348  if (test == 0) {
7349  if (sub == 1)
7350  htmlFile << "<h1> Cap ID estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
7351  if (sub == 2)
7352  htmlFile << "<h1> Cap ID estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
7353  if (sub == 3)
7354  htmlFile << "<h1> Cap ID estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
7355  if (sub == 4)
7356  htmlFile << "<h1> Cap ID estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
7357  }
7358  if (test == 1) {
7359  if (sub == 1)
7360  htmlFile << "<h1> Mean ADC Amplitude estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
7361  if (sub == 2)
7362  htmlFile << "<h1> Mean ADC Amplitude estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
7363  if (sub == 3)
7364  htmlFile << "<h1> Mean ADC Amplitude estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
7365  if (sub == 4)
7366  htmlFile << "<h1> Mean ADC Amplitude estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
7367  }
7368  if (test == 2) {
7369  if (sub == 1)
7370  htmlFile << "<h1> Width estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
7371  if (sub == 2)
7372  htmlFile << "<h1> Width estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
7373  if (sub == 3)
7374  htmlFile << "<h1> Width estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
7375  if (sub == 4)
7376  htmlFile << "<h1> Width estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
7377  }
7378  if (test == 3) {
7379  if (sub == 1)
7380  htmlFile << "<h1> Ratio estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
7381  if (sub == 2)
7382  htmlFile << "<h1> Ratio estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
7383  if (sub == 3)
7384  htmlFile << "<h1> Ratio estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
7385  if (sub == 4)
7386  htmlFile << "<h1> Ratio estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
7387  }
7388  if (test == 4) {
7389  if (sub == 1)
7390  htmlFile << "<h1> Mean bin timing estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
7391  if (sub == 2)
7392  htmlFile << "<h1> Mean bin timing estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
7393  if (sub == 3)
7394  htmlFile << "<h1> Mean bin timing estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
7395  if (sub == 4)
7396  htmlFile << "<h1> Mean bin timing estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
7397  }
7398  if (test == 5) {
7399  if (sub == 1)
7400  htmlFile << "<h1> Maximum bin timing estimator for HB, RUN = " << runnumber << " </h1>" << std::endl;
7401  if (sub == 2)
7402  htmlFile << "<h1> Maximum bin timing estimator for HE, RUN = " << runnumber << " </h1>" << std::endl;
7403  if (sub == 3)
7404  htmlFile << "<h1> Maximum bin timing estimator for HO, RUN = " << runnumber << " </h1>" << std::endl;
7405  if (sub == 4)
7406  htmlFile << "<h1> Maximum bin timing estimator for HF, RUN = " << runnumber << " </h1>" << std::endl;
7407  }
7408 
7409  if (test == 1) {
7410  htmlFile << "<a name=\"Top\"></a>\n";
7411  htmlFile << "<b>Contents:<br>\n";
7412  htmlFile << "1. <a href=\"#Aij\">A_ij_LS (averaged over events in LS) </a><br>\n";
7413  htmlFile << "2. <a href=\"#OverflowAij\">A_ij_LS in overflow & underflow</a><br>\n";
7414  htmlFile << "3. <a href=\"#MainEstimator\">Main Estimator !!! </a><br>\n";
7415  htmlFile << "4. <a href=\"#ErrorA\">Error type A </a><br>\n";
7416  htmlFile << "5. <a href=\"#ErrorAaverage\">ErrorA cross check</a><br>\n";
7417  htmlFile << "6. <a href=\"#ErrorAoccupancy\">ErrorA occupancy plots</a><br>\n";
7418  htmlFile << "7. <a href=\"#ErrorB\">Error type B</a><br>\n";
7419  htmlFile << "8. <a href=\"#LSstatus\">Table of Average channel-Amplitude in Depthes over LSs </a><br>\n";
7420  htmlFile << "9. <a href=\"#RBXstatus\">RBX Status </a><br>\n";
7421  htmlFile << "10. <a href=\"#RBXPHItable\">Table of Average RBX-Amplitude in Phi over LSs </a><br>\n";
7422  htmlFile << "11. <a href=\"#RBXETAtable\">Table of Average RBX-Amplitude in Eta over LSs </a><br>\n";
7423  htmlFile << "12. <a href=\"#RBX3plots\">RBX A-Ratio to 1st LS: 3 plots </a><br>\n";
7425  }
7426 
7427  // htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7428 
7429  htmlFile << "<br>" << std::endl;
7430  if (test == 0) {
7431  htmlFile << "<h2> 0. Rate of CapID failures over all events of Run </h2>" << std::endl;
7432  htmlFile << "<h3> Channel legend: green - good, other colour - suspicious </h3>" << std::endl;
7433  if (sub == 1)
7434  htmlFile << " <img src=\"MapCapIdErrorHB.png\" />" << std::endl;
7435  if (sub == 2)
7436  htmlFile << " <img src=\"MapCapIdErrorHE.png\" />" << std::endl;
7437  if (sub == 3)
7438  htmlFile << " <img src=\"MapCapIdErrorHO.png\" />" << std::endl;
7439  if (sub == 4)
7440  htmlFile << " <img src=\"MapCapIdErrorHF.png\" />" << std::endl;
7441  }
7442  if (test == 1)
7443  htmlFile << "<a name=\"Aij\"></a>\n";
7444  if (test != 0)
7445  htmlFile << "<h2> 1. Distribution of estimator averaged over events in LS, histogramed over all channels and "
7446  "all LSs (only few depthes shown as example) </h2>"
7447  << std::endl;
7448  if (test == 0) {
7449  if (sub == 1)
7450  htmlFile << "<h2> 1. Average Nbcs for only LS containing events with abnormal number of Bad channels >"
7451  << CutAb[sub][1] << " (Depth1), " << CutAb[sub][2] << " (Depth2,3,4).</h2>" << std::endl;
7452  if (sub == 2)
7453  htmlFile << "<h2> 1. Average Nbcs for only LS containing events with abnormal number of Bad channels >"
7454  << CutAb[sub][1] << " (Depth1), " << CutAb[sub][2] << " (Depth2), " << CutAb[sub][3]
7455  << " (Depth3,4,5,6,7).</h2>" << std::endl;
7456  if (sub == 3)
7457  htmlFile << "<h2> 1. Average Nbcs for only LS containing events with abnormal number of Bad channels >"
7458  << CutAb[sub][1] << " (Depth4).</h2>" << std::endl;
7459  if (sub == 4)
7460  htmlFile << "<h2> 1. Average Nbcs for only LS containing events with abnormal number of Bad channels >"
7461  << CutAb[sub][1] << " (Depth1), " << CutAb[sub][2] << " (Depth2,3,4).</h2>" << std::endl;
7462  }
7463 
7464  if (test != 0)
7465  htmlFile << "<h3> see Overflow and Underflow </h3>" << std::endl;
7466  if (test == 0)
7467  htmlFile << "<h3> Legend: dots correspond to BAD LS candidates.</h3>" << std::endl;
7468 
7469  if (test == 0) {
7470  if (sub == 1)
7471  htmlFile << " <img src=\"Hist_CAPID_Abnorm_HB.png\" />" << std::endl;
7472  if (sub == 2)
7473  htmlFile << " <img src=\"Hist_CAPID_Abnorm_HE.png\" />" << std::endl;
7474  if (sub == 3)
7475  htmlFile << " <img src=\"Hist_CAPID_Abnorm_HO.png\" />" << std::endl;
7476  if (sub == 4)
7477  htmlFile << " <img src=\"Hist_CAPID_Abnorm_HF.png\" />" << std::endl;
7478  }
7479  if (test == 1) {
7480  if (sub == 1)
7481  htmlFile << " <img src=\"H_ADCamplHB.png\" />" << std::endl;
7482  if (sub == 2)
7483  htmlFile << " <img src=\"H_ADCamplHE.png\" />" << std::endl;
7484  if (sub == 3)
7485  htmlFile << " <img src=\"H_ADCamplHO.png\" />" << std::endl;
7486  if (sub == 4)
7487  htmlFile << " <img src=\"H_ADCamplHF.png\" />" << std::endl;
7488  }
7489  if (test == 2) {
7490  if (sub == 1)
7491  htmlFile << " <img src=\"H_WidthHB.png\" />" << std::endl;
7492  if (sub == 2)
7493  htmlFile << " <img src=\"H_WidthHE.png\" />" << std::endl;
7494  if (sub == 3)
7495  htmlFile << " <img src=\"H_WidthHO.png\" />" << std::endl;
7496  if (sub == 4)
7497  htmlFile << " <img src=\"H_WidthHF.png\" />" << std::endl;
7498  }
7499  if (test == 3) {
7500  if (sub == 1)
7501  htmlFile << " <img src=\"H_RatioHB.png\" />" << std::endl;
7502  if (sub == 2)
7503  htmlFile << " <img src=\"H_RatioHE.png\" />" << std::endl;
7504  if (sub == 3)
7505  htmlFile << " <img src=\"H_RatioHO.png\" />" << std::endl;
7506  if (sub == 4)
7507  htmlFile << " <img src=\"H_RatioHF.png\" />" << std::endl;
7508  }
7509  if (test == 4) {
7510  if (sub == 1)
7511  htmlFile << " <img src=\"H_TmeanHB.png\" />" << std::endl;
7512  if (sub == 2)
7513  htmlFile << " <img src=\"H_TmeanHE.png\" />" << std::endl;
7514  if (sub == 3)
7515  htmlFile << " <img src=\"H_TmeanHO.png\" />" << std::endl;
7516  if (sub == 4)
7517  htmlFile << " <img src=\"H_TmeanHF.png\" />" << std::endl;
7518  }
7519  if (test == 5) {
7520  if (sub == 1)
7521  htmlFile << " <img src=\"H_TmaxHB.png\" />" << std::endl;
7522  if (sub == 2)
7523  htmlFile << " <img src=\"H_TmaxHE.png\" />" << std::endl;
7524  if (sub == 3)
7525  htmlFile << " <img src=\"H_TmaxHO.png\" />" << std::endl;
7526  if (sub == 4)
7527  htmlFile << " <img src=\"H_TmaxHF.png\" />" << std::endl;
7528  }
7529  htmlFile << "<br>" << std::endl;
7530  if (test == 1)
7531  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7532 
7533  if (test == 0)
7534  htmlFile << "<h2> 2a. Number of bad channels per event distribution in Run</h2>" << std::endl;
7535  if (test == 0)
7536  htmlFile << "<h3> Legends: dots correspond to BAD LS candidates. </h3>" << std::endl;
7537  if (test == 0) {
7538  if (sub == 1)
7539  htmlFile << " <img src=\"HistNBadChsHB.png\" />" << std::endl;
7540  if (sub == 2)
7541  htmlFile << " <img src=\"HistNBadChsHE.png\" />" << std::endl;
7542  if (sub == 3)
7543  htmlFile << " <img src=\"HistNBadChsHO.png\" />" << std::endl;
7544  if (sub == 4)
7545  htmlFile << " <img src=\"HistNBadChsHF.png\" />" << std::endl;
7546  }
7547 
7548  if (test == 1)
7549  htmlFile << "<a name=\"OverflowAij\"></a>\n";
7550  if (test != 0)
7551  htmlFile << "<h2> 2. Estimator averaged over all events in the RUN for entries in overflow and underflow of "
7552  "corresponding histogram above (only few depthes shown as example) </h2>"
7553  << std::endl;
7554  // if (test !=0) htmlFile << "<h2> 2. Estimator averaged over all events in the RUN </h2>"<< std::endl;
7555  if (test == 0)
7556  htmlFile << "<h2> 2b. Averaged number of bad channels for each LS </h2>" << std::endl;
7557  // if (test !=0) htmlFile << "<h3> Channel legend: white - good, other colour - bad. </h3>"<< std::endl;
7558  if (test == 0) {
7559  if (sub == 1)
7560  htmlFile << "<h3> Legends: dots selected with following cuts: <td class=\"s6\" align=\"center\">"
7561  << Cut0[test][sub][1] << " (Depth1), " << Cut0[test][sub][2]
7562  << " (Depth2,3,4) correspond BAD LS.</td></h3>" << std::endl;
7563  if (sub == 2)
7564  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][1] << " (Depth1), "
7565  << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3]
7566  << " (Depth3,4,5,6,7) correspond BAD LS.</h3>" << std::endl;
7567  if (sub == 3)
7568  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][4]
7569  << " (Depth4) correspond BAD LS.</h3>" << std::endl;
7570  if (sub == 4)
7571  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][1] << " (Depth1), "
7572  << Cut0[test][sub][2] << " (Depth2,3,4) correspond BAD LS.</h3>" << std::endl;
7573  }
7574  if (test == 0) {
7575  if (sub == 1)
7576  htmlFile << " <img src=\"HistNBCMNHB.png\" />" << std::endl;
7577  if (sub == 2)
7578  htmlFile << " <img src=\"HistNBCMNHE.png\" />" << std::endl;
7579  if (sub == 3)
7580  htmlFile << " <img src=\"HistNBCMNHO.png\" />" << std::endl;
7581  if (sub == 4)
7582  htmlFile << " <img src=\"HistNBCMNHF.png\" />" << std::endl;
7583  }
7584  if (test == 1) {
7585  if (sub == 1)
7586  htmlFile << " <img src=\"MapADCamplHB.png\" />" << std::endl;
7587  if (sub == 2)
7588  htmlFile << " <img src=\"MapADCamplHE.png\" />" << std::endl;
7589  if (sub == 3)
7590  htmlFile << " <img src=\"MapADCamplHO.png\" />" << std::endl;
7591  if (sub == 4)
7592  htmlFile << " <img src=\"MapADCamplHF.png\" />" << std::endl;
7593  }
7594  if (test == 2) {
7595  if (sub == 1)
7596  htmlFile << " <img src=\"MapWidthHB.png\" />" << std::endl;
7597  if (sub == 2)
7598  htmlFile << " <img src=\"MapWidthHE.png\" />" << std::endl;
7599  if (sub == 3)
7600  htmlFile << " <img src=\"MapWidthHO.png\" />" << std::endl;
7601  if (sub == 4)
7602  htmlFile << " <img src=\"MapWidthHF.png\" />" << std::endl;
7603  }
7604  if (test == 3) {
7605  if (sub == 1)
7606  htmlFile << " <img src=\"MapRatioHB.png\" />" << std::endl;
7607  if (sub == 2)
7608  htmlFile << " <img src=\"MapRatioHE.png\" />" << std::endl;
7609  if (sub == 3)
7610  htmlFile << " <img src=\"MapRatioHO.png\" />" << std::endl;
7611  if (sub == 4)
7612  htmlFile << " <img src=\"MapRatioHF.png\" />" << std::endl;
7613  }
7614  if (test == 4) {
7615  if (sub == 1)
7616  htmlFile << " <img src=\"MapTmeanHB.png\" />" << std::endl;
7617  if (sub == 2)
7618  htmlFile << " <img src=\"MapTmeanHE.png\" />" << std::endl;
7619  if (sub == 3)
7620  htmlFile << " <img src=\"MapTmeanHO.png\" />" << std::endl;
7621  if (sub == 4)
7622  htmlFile << " <img src=\"MapTmeanHF.png\" />" << std::endl;
7623  }
7624  if (test == 5) {
7625  if (sub == 1)
7626  htmlFile << " <img src=\"MapTmaxHB.png\" />" << std::endl;
7627  if (sub == 2)
7628  htmlFile << " <img src=\"MapTmaxHE.png\" />" << std::endl;
7629  if (sub == 3)
7630  htmlFile << " <img src=\"MapTmaxHO.png\" />" << std::endl;
7631  if (sub == 4)
7632  htmlFile << " <img src=\"MapTmaxHF.png\" />" << std::endl;
7633  }
7634  htmlFile << "<br>" << std::endl;
7635  if (test == 1)
7636  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7637 
7638  if (test == 1)
7639  htmlFile << "<a name=\"MainEstimator\"></a>\n";
7640  if (test != 0)
7641  htmlFile
7642  << "<h2> 3. Distribution of estimator averaged over events in LS and over all channels for each LS </h2>"
7643  << std::endl;
7644  if (test == 0) {
7645  if (sub == 1)
7646  htmlFile << "<h2> 3. Portion of events with Nbcs>" << CutPo[sub][1] << " (Depth1), " << CutPo[sub][2]
7647  << " (Depth2,3,4) in each LS.</h2>" << std::endl;
7648  if (sub == 2)
7649  htmlFile << "<h2> 3. Portion of events with Nbcs>" << CutPo[sub][1] << " (Depth1), " << CutPo[sub][2]
7650  << " (Depth2), " << CutPo[sub][3] << " (Depth3,4,5,6,7) in each LS.</h2>" << std::endl;
7651  if (sub == 3)
7652  htmlFile << "<h2> 3. Portion of events with Nbcs>" << CutPo[sub][4] << " (Depth4) in each LS.</h2>"
7653  << std::endl;
7654  if (sub == 4)
7655  htmlFile << "<h2> 3. Portion of events with Nbcs>" << CutPo[sub][1] << " (Depth1), " << CutPo[sub][2]
7656  << " (Depth2,3,4) in each LS.</h2>" << std::endl;
7657  htmlFile << "<h3> Legend: dots correspond to BAD LS candidates.</h3>" << std::endl;
7658  }
7659  if (test != 0) {
7660  if (sub == 1)
7661  htmlFile << "<h3> Legends: dots selected with following cuts: <td class=\"s6\" align=\"center\">"
7662  << Cut0[test][sub][1] << " (Depth1), " << Cut0[test][sub][2]
7663  << " (Depth2) correspond BAD LS.</td></h3>" << std::endl;
7664  if (sub == 2)
7665  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][1] << " (Depth1), "
7666  << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3), " << Cut0[test][sub][4]
7667  << " (Depth4), " << Cut0[test][sub][5] << " (Depth5), " << Cut0[test][sub][6] << " (Depth6), "
7668  << Cut0[test][sub][7] << " (Depth7) correspond BAD LS. </h3>" << std::endl;
7669  if (sub == 3)
7670  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][4]
7671  << " (Depth4) correspond BAD LS. </h3>" << std::endl;
7672  if (sub == 4)
7673  htmlFile << "<h3> Legends: dots selected with following cuts: " << Cut0[test][sub][1] << " (Depth1), "
7674  << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3), " << Cut0[test][sub][4]
7675  << " (Depth4) correspond BAD LS. </h3>" << std::endl;
7676  }
7677  if (test == 0) {
7678  if (sub == 1)
7679  htmlFile << " <img src=\"HistPortHB.png\" />" << std::endl;
7680  if (sub == 2)
7681  htmlFile << " <img src=\"HistPortHE.png\" />" << std::endl;
7682  if (sub == 3)
7683  htmlFile << " <img src=\"HistPortHO.png\" />" << std::endl;
7684  if (sub == 4)
7685  htmlFile << " <img src=\"HistPortHF.png\" />" << std::endl;
7686  }
7687  if (test == 1) {
7688  if (sub == 1)
7689  htmlFile << " <img src=\"HistADCamplHB.png\" />" << std::endl;
7690  if (sub == 2)
7691  htmlFile << " <img src=\"HistADCamplHE.png\" />" << std::endl;
7692  if (sub == 3)
7693  htmlFile << " <img src=\"HistADCamplHO.png\" />" << std::endl;
7694  if (sub == 4)
7695  htmlFile << " <img src=\"HistADCamplHF.png\" />" << std::endl;
7696  }
7697  if (test == 2) {
7698  if (sub == 1)
7699  htmlFile << " <img src=\"HistWidthHB.png\" />" << std::endl;
7700  if (sub == 2)
7701  htmlFile << " <img src=\"HistWidthHE.png\" />" << std::endl;
7702  if (sub == 3)
7703  htmlFile << " <img src=\"HistWidthHO.png\" />" << std::endl;
7704  if (sub == 4)
7705  htmlFile << " <img src=\"HistWidthHF.png\" />" << std::endl;
7706  }
7707  if (test == 3) {
7708  if (sub == 1)
7709  htmlFile << " <img src=\"HistRatioHB.png\" />" << std::endl;
7710  if (sub == 2)
7711  htmlFile << " <img src=\"HistRatioHE.png\" />" << std::endl;
7712  if (sub == 3)
7713  htmlFile << " <img src=\"HistRatioHO.png\" />" << std::endl;
7714  if (sub == 4)
7715  htmlFile << " <img src=\"HistRatioHF.png\" />" << std::endl;
7716  }
7717  if (test == 4) {
7718  if (sub == 1)
7719  htmlFile << " <img src=\"HistTmeanHB.png\" />" << std::endl;
7720  if (sub == 2)
7721  htmlFile << " <img src=\"HistTmeanHE.png\" />" << std::endl;
7722  if (sub == 3)
7723  htmlFile << " <img src=\"HistTmeanHO.png\" />" << std::endl;
7724  if (sub == 4)
7725  htmlFile << " <img src=\"HistTmeanHF.png\" />" << std::endl;
7726  }
7727  if (test == 5) {
7728  if (sub == 1)
7729  htmlFile << " <img src=\"HistTmaxHB.png\" />" << std::endl;
7730  if (sub == 2)
7731  htmlFile << " <img src=\"HistTmaxHE.png\" />" << std::endl;
7732  if (sub == 3)
7733  htmlFile << " <img src=\"HistTmaxHO.png\" />" << std::endl;
7734  if (sub == 4)
7735  htmlFile << " <img src=\"HistTmaxHF.png\" />" << std::endl;
7736  }
7737  htmlFile << "<br>" << std::endl;
7738 
7739  if (test == 1) {
7740  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7741  htmlFile << "<a name=\"ErrorA\"></a>\n";
7742  htmlFile << "<h2> 4. Error type A</h2>\n";
7743  htmlFile << "<h3> note: no sence to see plots of this item if max difference is too large(due to very high A "
7744  "of some channels)</h3>\n";
7745  htmlFile << "<br>\n";
7746 
7747  //HB:
7748  if (sub == 1) {
7749  htmlFile << "<h3>Mean of max difference between dependencies to be within: 0.1-1.6 (p-p collisions) </h3>\n";
7750  htmlFile << " <img src=\"HistErrA_HB.png\" />\n";
7751  htmlFile << "<br>\n";
7752  if (flagErrAB_HB[0] == -1)
7753  htmlFile << "<h3>test was not possible</h3>\n";
7754  else if (flagErrAB_HB[0] == 0)
7755  htmlFile << "<h3> Fine:NoErrorA_HB (Mean of max difference " << avedelta_HB
7756  << " is within 0.1-1.6) </h3>\n";
7757  else if (flagErrAB_HB[0] == 1)
7758  htmlFile << "<<h3> ErrorA_HB is available once Mean of max difference " << avedelta_HB
7759  << " is out 0.1-1.6 (p-p collisions)</font></h3>\n";
7760  else
7761  htmlFile << "<h3>auto-interpretation is not available</h3>\n";
7762  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7763 
7764  htmlFile << "<a name=\"ErrorAaverage\"></a>\n";
7765 
7766  htmlFile << "<h2> 5. Error type A cross check: see 2D pattern of channels (only 2 depthes shown as example) "
7767  "</h2>\n";
7768  htmlFile << "<h2> 1) with average channel Amplitudes(No cut), 2) with average channel Amplitudes(<A> >25), "
7769  "3) with channel Amplitude (A<35); </h2>\n";
7770  htmlFile << " <img src=\"ChkErrA_HB1.png\" /><br><br>\n";
7771  htmlFile << " <img src=\"ChkErrA_HB2.png\" /><br>\n";
7772  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7773 
7774  htmlFile << "<a name=\"ErrorAoccupancy\"></a>\n";
7775  htmlFile << "<h2> 6. Error type A: min/ave ratio for occupancy distributions with Amplitude bigger 25 "
7776  "(HBM:neg.eta;HBP:pos.eta) </h2>\n";
7777  htmlFile << "<h2> FOR CROSS-CHECK OLNY !!!</h2>\n";
7778  htmlFile << "<h2> TO IDENTIFY A-type errors: for most of LSs the ratio to be lower 0.6 at least for HF- or "
7779  "HF+ </h2>\n";
7780  htmlFile << "<h2> For runs without A-type errors: for most of LSs the ratio is higher 0.6 and is the same "
7781  "for HF- and HF+ </h2>\n";
7782  htmlFile << " <img src=\"OccPlots_HB.png\" /><br><br>\n";
7783  htmlFile << "<br>\n";
7784  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7785 
7786  htmlFile << "<a name=\"ErrorB\"></a>\n";
7787  htmlFile << "<h2> 7. Error type B (only 2 depthes shown as example) \n";
7788  htmlFile << "<h3> ErrorB identification: digi-collection size != 8.</h3>\n";
7789  htmlFile << " <img src=\"HistErrB_HB_1.png\" />\n<br>\n";
7790  htmlFile << " <img src=\"HistErrB_HB_2.png\" />\n<br>\n";
7791  htmlFile << "<br>\n";
7792  htmlFile << "<h3> if Error type B is available, it start from: " << LSofFirstErrB_HB << " LS </h3>\n";
7793  htmlFile << "<br>\n";
7794  }
7795 
7796  //HE:
7797  if (sub == 2) {
7798  htmlFile << "<h3>Mean of max difference between dependencies to be within: 0.2-1.8 (p-p collisions) </h3>\n";
7799  htmlFile << " <img src=\"HistErrA_HE.png\" />\n";
7800  htmlFile << "<br>\n";
7801  if (flagErrAB_HE[0] == -1)
7802  htmlFile << "<h3>test was not possible</h3>\n";
7803  else if (flagErrAB_HE[0] == 0)
7804  htmlFile << "<h3> Fine:NoErrorA_HE (Mean of max difference " << avedelta_HE
7805  << " is within 0.2-1.8) </h3>\n";
7806  else if (flagErrAB_HE[0] == 1)
7807  htmlFile << "<<h3> ErrorA_HE is available once Mean of max difference " << avedelta_HE
7808  << " is out 0.2-1.8 (p-p collisions)</font></h3>\n";
7809  else
7810  htmlFile << "<h3>auto-interpretation is not available</h3>\n";
7811  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7812 
7813  htmlFile << "<a name=\"ErrorAaverage\"></a>\n";
7814 
7815  htmlFile << "<h2> 5. Error type A cross check: see 2D pattern of channels (only 3 depthes shown as example) "
7816  " </h2>\n";
7817  htmlFile << "<h2> 1) with average channel Amplitudes(No cut), 2) with average channel Amplitudes(<A> "
7818  ">1000.fC), 3) with channel Amplitude (A<500fC); </h2>\n";
7819  htmlFile << " <img src=\"ChkErrA_HE1.png\" /><br><br>\n";
7820  htmlFile << " <img src=\"ChkErrA_HE2.png\" /><br>\n";
7821  htmlFile << " <img src=\"ChkErrA_HE3.png\" /><br>\n";
7822  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7823 
7824  htmlFile << "<a name=\"ErrorAoccupancy\"></a>\n";
7825  htmlFile << "<h2> 6. Error type A: min/ave ratio for occupancy distributions with Amplitude bigger 35 "
7826  "(HEM:neg.eta;HEP:pos.eta) </h2>\n";
7827  htmlFile << "<h2> FOR CROSS-CHECK OLNY !!!</h2>\n";
7828  htmlFile << "<h2> TO IDENTIFY A-type errors: for most of LSs the ratio to be lower 0.3 at least for HF- or "
7829  "HF+ </h2>\n";
7830  htmlFile << "<h2> For runs without A-type errors: for most of LSs the ratio is higher 0.3 and is the same "
7831  "for HF- and HF+ </h2>\n";
7832  htmlFile << " <img src=\"OccPlots_HE.png\" /><br><br>\n";
7833  htmlFile << "<br>\n";
7834  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7835 
7836  htmlFile << "<a name=\"ErrorB\"></a>\n";
7837  htmlFile << "<h2> 7. Error type B (only 3 depthes shown as example) \n";
7838  htmlFile << "<h3> ErrorB identification: digi-collection size != 8.</h3>\n";
7839  htmlFile << " <img src=\"HistErrB_HE_1.png\" />\n<br>\n";
7840  htmlFile << " <img src=\"HistErrB_HE_2.png\" />\n<br>\n";
7841  htmlFile << " <img src=\"HistErrB_HE_3.png\" />\n<br>\n";
7842  htmlFile << "<br>\n";
7843  htmlFile << "<h3> if Error type B is available, it start from: " << LSofFirstErrB_HE << " LS </h3>\n";
7844  htmlFile << "<br>\n";
7845  }
7846 
7847  //HO:
7848  if (sub == 3) {
7849  htmlFile << "<h3>Mean of max difference between dependencies to be within: 0.1-1.5 (p-p collisions) </h3>\n";
7850  htmlFile << " <img src=\"HistErrA_HO.png\" />\n";
7851  htmlFile << "<br>\n";
7852  if (flagErrAB_HO[0] == -1)
7853  htmlFile << "<h3>test was not possible</h3>\n";
7854  else if (flagErrAB_HO[0] == 0)
7855  htmlFile << "<h3> Fine:NoErrorA_HO (Mean of max difference " << avedelta_HO
7856  << " is within 0.1-1.5) </h3>\n";
7857  else if (flagErrAB_HO[0] == 1)
7858  htmlFile << "<<h3> ErrorA_HO is available once Mean of max difference " << avedelta_HO
7859  << " is out 0.1-1.5 (p-p collisions)</font></h3>\n";
7860  else
7861  htmlFile << "<h3>auto-interpretation is not available</h3>\n";
7862  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7863 
7864  htmlFile << "<a name=\"ErrorAaverage\"></a>\n";
7865 
7866  htmlFile << "<h2> 5. Error type A cross check: see 2D pattern of channels </h2>\n";
7867  htmlFile << "<h2> 1) with average channel Amplitudes(No cut), 2) with average channel Amplitudes(<A> >80), "
7868  "3) with channel Amplitude (A<100); </h2>\n";
7869  // htmlFile << "<h2> 2D. Cross check for error A</h2>\n";
7870  htmlFile << " <img src=\"ChkErrA_HO4.png\" /><br><br>\n";
7871  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7872 
7873  htmlFile << "<a name=\"ErrorAoccupancy\"></a>\n";
7874  htmlFile << "<h2> 6. Error type A: min/ave ratio for occupancy distributions with Amplitude bigger 80 "
7875  "(HOM:neg.eta;HOP:pos.eta) </h2>\n";
7876  htmlFile << "<h2> FOR CROSS-CHECK OLNY !!!</h2>\n";
7877  htmlFile << "<h2> TO IDENTIFY A-type errors: for most of LSs the ratio to be lower 0.8 at least for HF- or "
7878  "HF+ </h2>\n";
7879  htmlFile << "<h2> For runs without A-type errors: for most of LSs the ratio is higher 0.8 and is the same "
7880  "for HF- and HF+ </h2>\n";
7881  htmlFile << " <img src=\"OccPlots_HO.png\" /><br><br>\n";
7882  htmlFile << "<br>\n";
7883  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7884 
7885  htmlFile << "<a name=\"ErrorB\"></a>\n";
7886  htmlFile << "<h2> 7. Error type B\n";
7887  htmlFile << "<h3> ErrorB identification: digi-collection size != 10. </h3>\n";
7888  htmlFile << " <img src=\"HistErrB_HO_4.png\" />\n<br>\n";
7889  htmlFile << "<br>\n";
7890  htmlFile << "<h3> if Error type B is available, it start from: " << LSofFirstErrB_HO << " LS </h3>\n";
7891  htmlFile << "<br>\n";
7892  }
7893 
7894  //HF:
7895  if (sub == 4) {
7896  // flagSpecHF+=1;
7897  htmlFile << "<h3>Mean of max difference between dependencies to be within: 0.8-2.4 (p-p collisions) </h3>\n";
7898  htmlFile << " <img src=\"HistErrA_HF.png\" />\n";
7899  htmlFile << "<br>\n";
7900  if (flagErrAB_HF[0] == -1)
7901  htmlFile << "<h3>test was not possible</h3>\n";
7902  else if (flagErrAB_HF[0] == 0)
7903  htmlFile << "<h3> Fine:NoErrorA_HF (Mean of max difference " << avedelta_HF
7904  << " is within 0.8-2.4) </h3>\n";
7905  else if (flagErrAB_HF[0] == 1)
7906  htmlFile << "<<h3> ErrorA_HF is available once Mean of max difference " << avedelta_HF
7907  << " is out 0.8-2.4 (p-p collisions)</font></h3>\n";
7908  else
7909  htmlFile << "<h3>auto-interpretation is not available</h3>\n";
7910  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7911 
7912  htmlFile << "<a name=\"ErrorAaverage\"></a>\n";
7913 
7914  htmlFile << "<h2> 5. Error type A cross check: see 2D pattern of channels (only 2 depthes shown as example) "
7915  "</h2>\n";
7916  htmlFile << "<h2> 1) with average channel Amplitudes(No cut), 2) with average channel Amplitudes(<A> >20), "
7917  "3) with channel Amplitude (A<20); </h2>\n";
7918  // htmlFile << "<h2> 2D. Cross check for error A</h2>\n";
7919  htmlFile << " <img src=\"ChkErrA_HF1.png\" /><br><br>\n";
7920  htmlFile << " <img src=\"ChkErrA_HF2.png\" /><br>\n";
7921  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7922 
7923  htmlFile << "<a name=\"ErrorAoccupancy\"></a>\n";
7924  htmlFile << "<h2> 6. Error type A: min/ave ratio for occupancy distributions with Amplitude bigger 20 "
7925  "(HFM:neg.eta;HFP:pos.eta) </h2>\n";
7926  htmlFile << "<h2> FOR CROSS-CHECK OLNY !!!</h2>\n";
7927  htmlFile << "<h2> TO IDENTIFY A-type errors: for most of LSs the ratio to be lower 0.8 at least for HF- or "
7928  "HF+ </h2>\n";
7929  htmlFile << "<h2> For runs without A-type errors: for most of LSs the ratio is higher 0.8 and is the same "
7930  "for HF- and HF+ </h2>\n";
7931  htmlFile << " <img src=\"OccPlots_HF.png\" /><br><br>\n";
7932  htmlFile << "<br>\n";
7933  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7934 
7935  htmlFile << "<a name=\"ErrorB\"></a>\n";
7936  htmlFile << "<h2> 7. Error type B (only 2 depthes shown as example) \n";
7937  htmlFile << "<h3> ErrorB identification: digi-collection size != 4. </h3>\n";
7938  htmlFile << " <img src=\"HistErrB_HF_1.png\" />\n<br>\n";
7939  htmlFile << " <img src=\"HistErrB_HF_2.png\" />\n<br>\n";
7940  htmlFile << "<br>\n";
7941  htmlFile << "<h3> if Error type B is available, it start from: " << LSofFirstErrB_HF << " LS </h3>\n";
7942  htmlFile << "<br>\n";
7943  }
7944  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
7945 
7946  } //test=1 Amplitude
7947 
7948  if (test == 1)
7949  htmlFile << "<a name=\"LSstatus\"></a>\n";
7950  // Continue with common sections
7951  if (sub == 1) {
7952  htmlFile << "<h2> 8.Lumisection Status for HB: </h2>" << std::endl;
7953  // 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;
7954  htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: " << Cut0[test][sub][1]
7955  << " (Depth1), " << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3), "
7956  << Cut0[test][sub][4] << " (Depth4), </h3>" << std::endl;
7957  }
7958  if (sub == 2) {
7959  htmlFile << "<h2> 8.Lumisection Status for HE: </h2>" << std::endl;
7960  htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: " << Cut0[test][sub][1]
7961  << " (Depth1), " << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3),"
7962  << Cut0[test][sub][4] << " (Depth4)," << Cut0[test][sub][5] << " (Depth5)," << Cut0[test][sub][6]
7963  << " (Depth6)," << Cut0[test][sub][7] << " (Depth7). </h3>" << std::endl;
7964  }
7965  if (sub == 3) {
7966  // htmlFile << Form("<h2> %d.Lumisection Status for HO </h2>",4+flagSpecHF)<< std::endl;
7967  htmlFile << "<h2> 8.Lumisection Status for HO: </h2>" << std::endl;
7968  htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: " << Cut0[test][sub][4]
7969  << " (Depth4). </h3>" << std::endl;
7970  }
7971  if (sub == 4) {
7972  htmlFile << "<h2> 8.Lumisection Status for HF: </h2>" << std::endl;
7973  htmlFile << "<h3> Legends: Red boxes correspond BAD LS selected with following cuts: " << Cut0[test][sub][1]
7974  << " (Depth1), " << Cut0[test][sub][2] << " (Depth2), " << Cut0[test][sub][3] << " (Depth3), "
7975  << Cut0[test][sub][4] << " (Depth4), </h3>" << std::endl;
7976  }
7977  htmlFile << "<br>" << std::endl;
7978  htmlFile << "<table>" << std::endl;
7979  htmlFile << "<tr>";
7980  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
7981  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
7982  htmlFile << "<td class=\"s1\" align=\"center\">Number of events</td>" << std::endl;
7984 
7985  int kkkkkkmax = k_max[sub];
7986  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
7987  kkkkkkmax = k_maxupgrade[sub];
7988  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
7989  // if (test==1 && sub==4) kkkkkkmax = k_maxupgrade[sub];
7990 
7991  if (test == 0)
7992  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7993  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > Depth " << k << " </td>" << std::endl;
7994  if (test == 1)
7995  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7996  htmlFile << "<td class=\"s1\" align=\"center\">< A > Depth " << k << " </td>" << std::endl;
7997  if (test == 2)
7998  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
7999  htmlFile << "<td class=\"s1\" align=\"center\">< W > Depth " << k << " </td>" << std::endl;
8000  if (test == 3)
8001  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8002  htmlFile << "<td class=\"s1\" align=\"center\">< R > Depth " << k << " </td>" << std::endl;
8003  if (test == 4)
8004  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8005  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > Depth " << k << " </td>" << std::endl;
8006  if (test == 5)
8007  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8008  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > Depth " << k << " </td>" << std::endl;
8009  htmlFile << "</tr>" << std::endl;
8010 
8011  ind = 0;
8012  // for (int i = 1; i <= MaxLum; i++) {
8013  for (int i = 1; i <= MaxLum000000; i++) {
8014  if ((ind % 2) == 1)
8015  raw_class = "<td class=\"s2\" align=\"center\">";
8016  else
8017  raw_class = "<td class=\"s3\" align=\"center\">";
8018  htmlFile << "<tr>" << std::endl;
8019  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
8020  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
8021  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
8022  for (int k = k_min[sub]; k <= kkkkkkmax; k++) {
8023  if (HistNumBadChanDepth[test][sub][k]->GetBinContent(i) > Cut0[test][sub][k]) {
8024  if (test == 1)
8025  htmlFile << "<td class=\"s6\" align=\"center\">"
8026  << int(HistNumBadChanDepth[test][sub][k]->GetBinContent(i)) << "</td>" << std::endl;
8027  else
8028  htmlFile << "<td class=\"s6\" align=\"center\">" << (HistNumBadChanDepth[test][sub][k]->GetBinContent(i))
8029  << "</td>" << std::endl;
8030  } else {
8031  if (test == 1)
8032  htmlFile << raw_class << int(HistNumBadChanDepth[test][sub][k]->GetBinContent(i)) << "</td>" << std::endl;
8033  else
8034  htmlFile << raw_class << (HistNumBadChanDepth[test][sub][k]->GetBinContent(i)) << "</td>" << std::endl;
8035  }
8036  }
8037  htmlFile << "</tr>" << std::endl;
8038  ind += 1;
8039  }
8040  htmlFile << "</table>" << std::endl;
8041 
8042  htmlFile << "<br>" << std::endl;
8043  if (test == 1)
8044  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8045  htmlFile << "<br>" << std::endl;
8046 
8047  // Only for Amplitudes (test=1):
8049  if (test == 1) {
8052  htmlFile << "<a name=\"RBXstatus\"></a>\n";
8053 
8054  //HB j = 7,8,9,10 11,12,13,14
8055  if (sub == 1) {
8056  htmlFile << "<h2> 9. Average Amplitudes of RBX for HB: </h2>" << std::endl;
8057  htmlFile << "<h3> where </h3>" << std::endl;
8058  htmlFile << "<h3> jeta = 7,8,9,10 (Negative direction); ............&& ............ jeta = 11,12,13,14 "
8059  "(Positive direction); </h3>"
8060  << std::endl;
8061  htmlFile << "<h3> jphi = 0, 1,..... 16, 17 </h3>" << std::endl;
8062  // 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;
8063  htmlFile << " <img src=\"RBX-HB-2Dplot.png\" />\n";
8064  htmlFile << "<br>\n";
8065 
8066  htmlFile << "<h2> Average Amplitudes of RBX-PHI for HB: </h2>" << std::endl;
8067  htmlFile << " <img src=\"RBX-HB-1Dplot.png\" />\n";
8068  htmlFile << "<br>\n";
8069 
8070  htmlFile << "<h2> Average Amplitudes of RBX-ETA for HB: </h2>" << std::endl;
8071  htmlFile << " <img src=\"RBX-HB-11Dplot.png\" />\n";
8072  htmlFile << "<br>\n";
8073 
8074  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8075  }
8076  // HE: j = 3,4,5, 6, 7 14,15,16,17,18
8077  if (sub == 2) {
8078  htmlFile << "<h2> 9. Averaged Amplitudes of RBX for HE: </h2>" << std::endl;
8079  htmlFile << "<h3> where </h3>" << std::endl;
8080  htmlFile << "<h3> jeta = 3,4,5, 6, 7 (Negative direction); ............&& ............ jeta = "
8081  "14,15,16,17,18 (Positive direction); </h3>"
8082  << std::endl;
8083  htmlFile << "<h3> jphi = 0, 1,..... 16, 17 </h3>" << std::endl;
8084  // 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;
8085  htmlFile << " <img src=\"RBX-HE-2Dplot.png\" />\n";
8086  htmlFile << "<br>\n";
8087 
8088  htmlFile << "<h2> Average Amplitudes of RBX-PHI for HE: </h2>" << std::endl;
8089  htmlFile << " <img src=\"RBX-HE-1Dplot.png\" />\n";
8090  htmlFile << "<br>\n";
8091 
8092  htmlFile << "<h2> Average Amplitudes of RBX-ETA for HE: </h2>" << std::endl;
8093  htmlFile << " <img src=\"RBX-HE-11Dplot.png\" />\n";
8094  htmlFile << "<br>\n";
8095 
8096  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8097  }
8098  // HO: j = 7,8,9,10 11,12,13,14
8099  if (sub == 3) {
8100  htmlFile << "<h2> 9. Averaged Amplitudes of RBX for HO: </h2>" << std::endl;
8101  htmlFile << "<h3> where </h3>" << std::endl;
8102  htmlFile << "<h3> jeta = 7,8,9,10 (Negative direction); ............&& ............ jeta = 11,12,13,14 "
8103  "(Positive direction); </h3>"
8104  << std::endl;
8105  htmlFile << "<h3> jphi = 0, 1,..... 16, 17 </h3>" << std::endl;
8106  // 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;
8107  htmlFile << " <img src=\"RBX-HO-2Dplot.png\" />\n";
8108  htmlFile << "<br>\n";
8109 
8110  htmlFile << "<h2> Average Amplitudes of RBX-PHI for HO: </h2>" << std::endl;
8111  htmlFile << " <img src=\"RBX-HO-1Dplot.png\" />\n";
8112  htmlFile << "<br>\n";
8113 
8114  htmlFile << "<h2> Average Amplitudes of RBX-ETA for HO: </h2>" << std::endl;
8115  htmlFile << " <img src=\"RBX-HO-11Dplot.png\" />\n";
8116  htmlFile << "<br>\n";
8117 
8118  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8119  }
8120  //HF:j = 0,1,2, 3 18,19,20,21
8121  if (sub == 4) {
8122  htmlFile << "<h2> 9. Averaged Amplitudes of RBX for HF: </h2>" << std::endl;
8123  htmlFile << "<h3> where </h3>" << std::endl;
8124  htmlFile << "<h3> jeta = 0,1,2, 3 (Negative direction); ............&& ............ jeta = 18,19,20,21 "
8125  "(Positive direction); </h3>"
8126  << std::endl;
8127  htmlFile << "<h3> jphi = 0, 1,..... 16, 17 </h3>" << std::endl;
8128  // 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;
8129  htmlFile << " <img src=\"RBX-HF-2Dplot.png\" />\n";
8130  htmlFile << "<br>\n";
8131 
8132  htmlFile << "<h2> Average Amplitudes of RBX-PHI for HF: </h2>" << std::endl;
8133  htmlFile << " <img src=\"RBX-HF-1Dplot.png\" />\n";
8134  htmlFile << "<br>\n";
8135 
8136  htmlFile << "<h2> Average Amplitudes of RBX-ETA for HF: </h2>" << std::endl;
8137  htmlFile << " <img src=\"RBX-HF-11Dplot.png\" />\n";
8138  htmlFile << "<br>\n";
8139 
8140  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8141  }
8142  htmlFile << "<br>" << std::endl;
8143 
8146 
8147  htmlFile << "<a name=\"RBXPHItable\"></a>\n";
8148  int cutA_ALL = 0;
8149  // float cutA_HB = 100.;float cutA_HE = 1000000.;float cutA_HO = 150.;float cutA_HF = 500.;
8150  if (sub == 1) {
8151  htmlFile << "<h2> 10. Average RBX-Amplitude in Phi over LSs for HB: </h2>" << std::endl;
8152  htmlFile
8153  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
8154  << cutA_HB << std::endl;
8155  cutA_ALL = cutA_HB;
8156  }
8157  if (sub == 2) {
8158  htmlFile << "<h2> 10. Average RBX-Amplitude in Phi over LSs for HE: </h2>" << std::endl;
8159  htmlFile
8160  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
8161  << cutA_HE << std::endl;
8162  cutA_ALL = cutA_HE;
8163  }
8164  if (sub == 3) {
8165  htmlFile << "<h2> 10. Average RBX-Amplitude in Phi over LSs for HO: </h2>" << std::endl;
8166  htmlFile
8167  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
8168  << cutA_HO << std::endl;
8169  cutA_ALL = cutA_HO;
8170  }
8171  if (sub == 4) {
8172  htmlFile << "<h2> 10. Average RBX-Amplitude in Phi over LSs for HF: </h2>" << std::endl;
8173  htmlFile
8174  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
8175  << cutA_HF << std::endl;
8176  cutA_ALL = cutA_HF;
8177  }
8178 
8179  htmlFile << "<br>" << std::endl;
8180  htmlFile << "<table>" << std::endl;
8181  htmlFile << "<tr>";
8182  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
8183  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
8184  htmlFile << "<td class=\"s1\" align=\"center\">Number of events</td>" << std::endl;
8186 
8187  // k is jphi
8188  for (int k = 0; k < njphi; k++)
8189  htmlFile << "<td class=\"s1\" align=\"center\"> iPHI " << k << " </td>" << std::endl;
8190  htmlFile << "</tr>" << std::endl;
8192 
8193  ind = 0;
8194  // i is LS
8195  for (int i = 1; i <= MaxLum; i++) {
8196  if ((ind % 2) == 1)
8197  raw_class = "<td class=\"s2\" align=\"center\">";
8198  else
8199  raw_class = "<td class=\"s3\" align=\"center\">";
8200  htmlFile << "<tr>" << std::endl;
8201  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
8202  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
8203  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
8204 
8205  // k is jphi
8206  for (int k = 0; k < njphi; k++) {
8207  if (sub == 1) {
8208  if (int(alexhb[k][i - 1]) > cutA_ALL) {
8209  htmlFile << "<td class=\"s6\" align=\"center\">" << int(alexhb[k][i - 1]) << "</td>" << std::endl;
8210  } else {
8211  htmlFile << raw_class << int(alexhb[k][i - 1]) << "</td>" << std::endl;
8212  }
8213  } // HB end
8214  if (sub == 2) {
8215  if (int(alexhe[k][i - 1]) > cutA_ALL) {
8216  htmlFile << "<td class=\"s6\" align=\"center\">" << int(alexhe[k][i - 1]) << "</td>" << std::endl;
8217  } else {
8218  htmlFile << raw_class << int(alexhe[k][i - 1]) << "</td>" << std::endl;
8219  }
8220  } // HE end
8221  if (sub == 3) {
8222  if (int(alexho[k][i - 1]) > cutA_ALL) {
8223  htmlFile << "<td class=\"s6\" align=\"center\">" << int(alexho[k][i - 1]) << "</td>" << std::endl;
8224  } else {
8225  htmlFile << raw_class << int(alexho[k][i - 1]) << "</td>" << std::endl;
8226  }
8227  } // HO end
8228  if (sub == 4) {
8229  if (int(alexhf[k][i - 1]) > cutA_ALL) {
8230  htmlFile << "<td class=\"s6\" align=\"center\">" << int(alexhf[k][i - 1]) << "</td>" << std::endl;
8231  } else {
8232  htmlFile << raw_class << int(alexhf[k][i - 1]) << "</td>" << std::endl;
8233  }
8234  } // HF end
8236  } // k over PHI-RBX
8237  htmlFile << "</tr>" << std::endl;
8238  ind += 1;
8239  } // i over LSs
8240  htmlFile << "</table>" << std::endl;
8241  htmlFile << "<br>" << std::endl;
8242  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8243  htmlFile << "<br>" << std::endl;
8245 
8246  htmlFile << "<a name=\"RBXETAtable\"></a>\n";
8247  int cutB_ALL = 0;
8248  // float cutB_HB = 100.;float cutB_HE = 1000000.;float cutB_HO = 150.;float cutB_HF = 500.;
8249  if (sub == 1) {
8250  htmlFile << "<h2> 11. Average RBX-Amplitude in Eta over LSs for HB: </h2>" << std::endl;
8251  htmlFile
8252  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
8253  << cutB_HB << std::endl;
8254  cutB_ALL = cutB_HB;
8255  }
8256  if (sub == 2) {
8257  htmlFile << "<h2> 11. Average RBX-Amplitude in Eta over LSs for HE: </h2>" << std::endl;
8258  htmlFile
8259  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
8260  << cutB_HE << std::endl;
8261  cutB_ALL = cutB_HE;
8262  }
8263  if (sub == 3) {
8264  htmlFile << "<h2> 11. Average RBX-Amplitude in Eta over LSs for HO: </h2>" << std::endl;
8265  htmlFile
8266  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
8267  << cutB_HO << std::endl;
8268  cutB_ALL = cutB_HO;
8269  }
8270  if (sub == 4) {
8271  htmlFile << "<h2> 11. Average RBX-Amplitude in Eta over LSs for HF: </h2>" << std::endl;
8272  htmlFile
8273  << "<h3> Legends: Red boxes correspond BAD LS selected with cut = <td class=\"s6\" align=\"center\">"
8274  << cutB_HF << std::endl;
8275  cutB_ALL = cutB_HF;
8276  }
8277 
8278  htmlFile << "<br>" << std::endl;
8279  htmlFile << "<table>" << std::endl;
8280  htmlFile << "<tr>";
8281  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
8282  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
8283  htmlFile << "<td class=\"s1\" align=\"center\">Number of events</td>" << std::endl;
8285 
8286  // k is jeta
8287  for (int k = 0; k < njeta; k++)
8288  htmlFile << "<td class=\"s1\" align=\"center\"> iETA " << k << " </td>" << std::endl;
8289  htmlFile << "</tr>" << std::endl;
8291 
8292  ind = 0;
8293  // i is LS
8294  for (int i = 1; i <= MaxLum; i++) {
8295  if ((ind % 2) == 1)
8296  raw_class = "<td class=\"s2\" align=\"center\">";
8297  else
8298  raw_class = "<td class=\"s3\" align=\"center\">";
8299  htmlFile << "<tr>" << std::endl;
8300  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
8301  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
8302  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
8303 
8304  // k is jeta
8305  for (int k = 0; k < njeta; k++) {
8306  if (sub == 1) {
8307  if (int(blexhb[k][i - 1]) > cutB_ALL) {
8308  htmlFile << "<td class=\"s6\" align=\"center\">" << int(blexhb[k][i - 1]) << "</td>" << std::endl;
8309  } else {
8310  htmlFile << raw_class << int(blexhb[k][i - 1]) << "</td>" << std::endl;
8311  }
8312  } // HB end
8313  if (sub == 2) {
8314  if (int(blexhe[k][i - 1]) > cutB_ALL) {
8315  htmlFile << "<td class=\"s6\" align=\"center\">" << int(blexhe[k][i - 1]) << "</td>" << std::endl;
8316  } else {
8317  htmlFile << raw_class << int(blexhe[k][i - 1]) << "</td>" << std::endl;
8318  }
8319  } // HE end
8320  if (sub == 3) {
8321  if (int(blexho[k][i - 1]) > cutB_ALL) {
8322  htmlFile << "<td class=\"s6\" align=\"center\">" << int(blexho[k][i - 1]) << "</td>" << std::endl;
8323  } else {
8324  htmlFile << raw_class << int(blexho[k][i - 1]) << "</td>" << std::endl;
8325  }
8326  } // HO end
8327  if (sub == 4) {
8328  if (int(blexhf[k][i - 1]) > cutB_ALL) {
8329  htmlFile << "<td class=\"s6\" align=\"center\">" << int(blexhf[k][i - 1]) << "</td>" << std::endl;
8330  } else {
8331  htmlFile << raw_class << int(blexhf[k][i - 1]) << "</td>" << std::endl;
8332  }
8333  } // HF end
8335  } // k over ETA-RBX
8336  htmlFile << "</tr>" << std::endl;
8337  ind += 1;
8338  } // i over LSs
8339  htmlFile << "</table>" << std::endl;
8340  htmlFile << "<br>" << std::endl;
8341  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8342  htmlFile << "<br>" << std::endl;
8344 
8347  htmlFile << "<a name=\"RBX3plots\"></a>\n";
8348  htmlFile << "<br>\n";
8349  htmlFile << "<h2> 12. (Rij) - RBX-amplitudes normilized on reference LS (~=1st) </h2>" << std::endl;
8350  htmlFile << "<h3> ( Rji . . is ratio of . . . . A_j_i . . to . . A_j_ref . . . . for . . j-RBX . . and . . "
8351  "i-LS . ) </h3>"
8352  << std::endl;
8353 
8354  htmlFile << "<br>\n";
8355  htmlFile << "<h2> . . . . . . . . . . . . . . 1) . average Ri vs iLS:. . . . . . . . . . . . . . . . . . . . . "
8356  ". . 2) . average Rj shown for Rij outside meanValue range either 0.95-1.05 or 3RMS: . . . . . . . "
8357  ". . . . . . . . . . . . . . . . . . 3) . Rij: </h2>"
8358  << std::endl;
8359  htmlFile << "<br>\n";
8360  if (sub == 1) {
8361  htmlFile << " <img src=\"RBX-HB-3plots.png\" />\n";
8362  }
8363  if (sub == 2) {
8364  htmlFile << " <img src=\"RBX-HE-3plots.png\" />\n";
8365  }
8366  if (sub == 3) {
8367  htmlFile << " <img src=\"RBX-HO-3plots.png\" />\n";
8368  }
8369  if (sub == 4) {
8370  htmlFile << " <img src=\"RBX-HF-3plots.png\" />\n";
8371  }
8372  htmlFile << "<br>\n";
8373 
8374  htmlFile << "<br>\n";
8375  htmlFile << "<h2> . 4). average Rj shown for Rij outside meanValue range 0.80-1.20: . . . . . . . .5) . "
8376  "average Rj shown for Rij outside meanValue range 0.70-1.30: . . . . . . . .6). average Rj shown "
8377  "for Rij outside meanValue range 0.60-1.40: </h2>"
8378  << std::endl;
8379  htmlFile << "<br>\n";
8380  if (sub == 1) {
8381  htmlFile << " <img src=\"RBX-HB-3plotsmore.png\" />\n";
8382  }
8383  if (sub == 2) {
8384  htmlFile << " <img src=\"RBX-HE-3plotsmore.png\" />\n";
8385  }
8386  if (sub == 3) {
8387  htmlFile << " <img src=\"RBX-HO-3plotsmore.png\" />\n";
8388  }
8389  if (sub == 4) {
8390  htmlFile << " <img src=\"RBX-HF-3plotsmore.png\" />\n";
8391  }
8392  htmlFile << "<br>\n";
8393 
8394  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8395 
8396  //=========================================================
8397 
8398  } // test=1
8399 
8400  //===============================================================================
8401 
8402  htmlFile.close();
8403  } // sub main loop
8404  } //test main loop
8405  //===============================================================================
8406  //===============================================================================
8407  //===============================================================================
8408  //===============================================================================
8409  //===============================================================================
8410 
8411  //======================================================================
8412  // Creating tests html pages:
8413 
8414  for (int test = 0; test <= 5; test++) { //Test: 0,
8415  if (test == 0)
8416  htmlFile.open("CapID_GL.html");
8417  if (test == 1)
8418  htmlFile.open("ADCampl_GL.html");
8419  if (test == 2)
8420  htmlFile.open("Width_GL.html");
8421  if (test == 3)
8422  htmlFile.open("Ratio_GL.html");
8423  if (test == 4)
8424  htmlFile.open("Tmean_GL.html");
8425  if (test == 5)
8426  htmlFile.open("Tmax_GL.html");
8427 
8428  // cout<<"Creating tests html pages: test= "<< test << endl;
8429 
8430  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
8431  htmlFile << "<head>" << std::endl;
8432  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
8433  htmlFile << "<title> Certification Monitoring Tool </title>" << std::endl;
8434  htmlFile << "<style type=\"text/css\">" << std::endl;
8435  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
8436  << std::endl;
8437  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
8438  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
8439  "text-align: center;}"
8440  << std::endl;
8441  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
8442  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
8443  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
8444  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
8445  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
8446  htmlFile << "</style>" << std::endl;
8447  htmlFile << "<body>" << std::endl;
8448  if (test == 0)
8449  htmlFile << "<h1> CAP ID ERRORS, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
8450  if (test == 1)
8451  htmlFile << "<h1> ADC AMPLITIDE, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
8452  if (test == 2)
8453  htmlFile << "<h1> WIDTH, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
8454  if (test == 3)
8455  htmlFile << "<h1> RATIO, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
8456  if (test == 4)
8457  htmlFile << "<h1> TIMING MEAN, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
8458  if (test == 5)
8459  htmlFile << "<h1> TIMING MAX, GLOBAL RUN = " << runnumber << " </h1>" << std::endl;
8460  htmlFile << "<br>" << std::endl;
8461  htmlFile << "<h2> 1. Map of suspicious channels with this criterion for whole HCAL </h2>" << std::endl;
8462  htmlFile << "<h3> Channel legend: green - good, other colour - suspicious </h3>" << std::endl;
8463  htmlFile << "<br>" << std::endl;
8464  if (test == 0)
8465  htmlFile << " <img src=\"MapCapIdError.png\" />" << std::endl;
8466  if (test == 1)
8467  htmlFile << " <img src=\"MapADCAmpl.png\" />" << std::endl;
8468  if (test == 2)
8469  htmlFile << " <img src=\"MapWidth.png\" />" << std::endl;
8470  if (test == 3)
8471  htmlFile << " <img src=\"MapRatio.png\" />" << std::endl;
8472  if (test == 4)
8473  htmlFile << " <img src=\"MapTmean.png\" />" << std::endl;
8474  if (test == 5)
8475  htmlFile << " <img src=\"MapTmax.png\" />" << std::endl;
8476  htmlFile << "<br>" << std::endl;
8477  htmlFile << "<h2> 2. For whole HCAL: </h2>" << std::endl;
8478  htmlFile << "<br>" << std::endl;
8479  if (test == 0)
8480  htmlFile << " <img src=\"HistCapID.png\" />" << std::endl;
8481  if (test == 1)
8482  htmlFile << " <img src=\"HistADCAmpl.png\" />" << std::endl;
8483  if (test == 2)
8484  htmlFile << " <img src=\"HistWidth.png\" />" << std::endl;
8485  if (test == 3)
8486  htmlFile << " <img src=\"HistRatio.png\" />" << std::endl;
8487  if (test == 4)
8488  htmlFile << " <img src=\"HistTmean.png\" />" << std::endl;
8489  if (test == 5)
8490  htmlFile << " <img src=\"HistTmax.png\" />" << std::endl;
8491  htmlFile << "<br>" << std::endl;
8492  htmlFile << "<h2> 3. Status of subdetectors </h2>" << std::endl;
8493  htmlFile << "<table width=\"400\">" << std::endl;
8494  htmlFile << "<tr>" << std::endl;
8495  if (test == 0) {
8496  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8497  << "/HB_CapID.html\">HB</a></td>" << std::endl;
8498  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8499  << "/HE_CapID.html\">HE</a></td>" << std::endl;
8500  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8501  << "/HO_CapID.html\">HO</a></td>" << std::endl;
8502  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8503  << "/HF_CapID.html\">HF</a></td>" << std::endl;
8504  }
8505  if (test == 1) {
8506  // AZ 11.03.2019
8507  /*
8508  htmlFile << " <td><a href=\"HB_ADCampl.html\">HB</a></td>"<< std::endl;
8509  htmlFile << " <td><a href=\"HE_ADCampl.html\">HE</a></td>"<< std::endl;
8510  htmlFile << " <td><a href=\"HO_ADCampl.html\">HO</a></td>"<< std::endl;
8511  htmlFile << " <td><a href=\"HF_ADCampl.html\">HF</a></td>"<< std::endl;
8512 */
8513 
8514  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8515  << "/HB_ADCampl.html\">HB</a></td>" << std::endl;
8516  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8517  << "/HE_ADCampl.html\">HE</a></td>" << std::endl;
8518  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8519  << "/HO_ADCampl.html\">HO</a></td>" << std::endl;
8520  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8521  << "/HF_ADCampl.html\">HF</a></td>" << std::endl;
8522  }
8523  if (test == 2) {
8524  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8525  << "/HB_Width.html\">HB</a></td>" << std::endl;
8526  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8527  << "/HE_Width.html\">HE</a></td>" << std::endl;
8528  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8529  << "/HO_Width.html\">HO</a></td>" << std::endl;
8530  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8531  << "/HF_Width.html\">HF</a></td>" << std::endl;
8532  }
8533  if (test == 3) {
8534  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8535  << "/HB_Ratio.html\">HB</a></td>" << std::endl;
8536  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8537  << "/HE_Ratio.html\">HE</a></td>" << std::endl;
8538  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8539  << "/HO_Ratio.html\">HO</a></td>" << std::endl;
8540  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8541  << "/HF_Ratio.html\">HF</a></td>" << std::endl;
8542  }
8543  if (test == 4) {
8544  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8545  << "/HB_Tmean.html\">HB</a></td>" << std::endl;
8546  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8547  << "/HE_Tmean.html\">HE</a></td>" << std::endl;
8548  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8549  << "/HO_Tmean.html\">HO</a></td>" << std::endl;
8550  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8551  << "/HF_Tmean.html\">HF</a></td>" << std::endl;
8552  }
8553  if (test == 5) {
8554  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8555  << "/HB_Tmax.html\">HB</a></td>" << std::endl;
8556  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8557  << "/HE_Tmax.html\">HE</a></td>" << std::endl;
8558  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8559  << "/HO_Tmax.html\">HO</a></td>" << std::endl;
8560  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
8561  << "/HF_Tmax.html\">HF</a></td>" << std::endl;
8562  }
8563 
8564  htmlFile << "</tr>" << std::endl;
8565  htmlFile << "</table>" << std::endl;
8566  htmlFile << "<br>" << std::endl;
8567  // cout<<"Creating tests html pages: 111111" << endl;
8568 
8569  if (test != 0)
8570  htmlFile << "<h2> 4. Table of estimator-values in sub-detectors for ONLY suspicious LSs </h3>" << std::endl;
8571  if (test == 0)
8572  htmlFile << "<h2> 4. Table of average Nbcs in sub-detectors for ONLY suspicious LSs </h3>" << std::endl;
8573  htmlFile << "<table>" << std::endl;
8574  htmlFile << "<tr>";
8575  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
8576  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
8577  htmlFile << "<td class=\"s1\" align=\"center\">Number of events</td>" << std::endl;
8579  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HO, 4-HF
8580 
8581  // cout<<"Creating each test kind for each subdet html pages: test= "<< test << " sub= " << sub << endl;
8582  int kkkkkkmax = k_max[sub];
8583  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
8584  kkkkkkmax = k_maxupgrade[sub];
8585  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
8586  // if (test==1 && sub==4) kkkkkkmax = k_maxupgrade[sub];
8587  if (sub == 1) {
8588  if (test == 0)
8589  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8590  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > HBdep " << k << " </td>" << std::endl;
8591  if (test == 1)
8592  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8593  htmlFile << "<td class=\"s1\" align=\"center\">< A > HBdepth " << k << " </td>" << std::endl;
8594  if (test == 2)
8595  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8596  htmlFile << "<td class=\"s1\" align=\"center\">< W > HBdepth " << k << " </td>" << std::endl;
8597  if (test == 3)
8598  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8599  htmlFile << "<td class=\"s1\" align=\"center\">< R > HBdepth " << k << " </td>" << std::endl;
8600  if (test == 4)
8601  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8602  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > HBdep " << k << " </td>" << std::endl;
8603  if (test == 5)
8604  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8605  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > HBdep " << k << " </td>" << std::endl;
8606  } //
8607  if (sub == 2) {
8608  if (test == 0)
8609  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8610  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > HEdep " << k << " </td>" << std::endl;
8611  if (test == 1)
8612  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8613  htmlFile << "<td class=\"s1\" align=\"center\">< A > HEdepth " << k << " </td>" << std::endl;
8614  if (test == 2)
8615  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8616  htmlFile << "<td class=\"s1\" align=\"center\">< W > HEdepth " << k << " </td>" << std::endl;
8617  if (test == 3)
8618  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8619  htmlFile << "<td class=\"s1\" align=\"center\">< R > HEdepth " << k << " </td>" << std::endl;
8620  if (test == 4)
8621  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8622  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > HEdep " << k << " </td>" << std::endl;
8623  if (test == 5)
8624  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8625  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > HEdep " << k << " </td>" << std::endl;
8626  } //
8627  if (sub == 3) {
8628  if (test == 0)
8629  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8630  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > HOdep " << k << " </td>" << std::endl;
8631  if (test == 1)
8632  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8633  htmlFile << "<td class=\"s1\" align=\"center\">< A > HOdepth " << k << " </td>" << std::endl;
8634  if (test == 2)
8635  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8636  htmlFile << "<td class=\"s1\" align=\"center\">< W > HOdepth " << k << " </td>" << std::endl;
8637  if (test == 3)
8638  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8639  htmlFile << "<td class=\"s1\" align=\"center\">< R > HOdepth " << k << " </td>" << std::endl;
8640  if (test == 4)
8641  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8642  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > HOdep " << k << " </td>" << std::endl;
8643  if (test == 5)
8644  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8645  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > HOdep " << k << " </td>" << std::endl;
8646  } //
8647  if (sub == 4) {
8648  if (test == 0)
8649  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8650  htmlFile << "<td class=\"s1\" align=\"center\">< Nbcs > HFdep " << k << " </td>" << std::endl;
8651  if (test == 1)
8652  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8653  htmlFile << "<td class=\"s1\" align=\"center\">< A > HFdepth " << k << " </td>" << std::endl;
8654  if (test == 2)
8655  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8656  htmlFile << "<td class=\"s1\" align=\"center\">< W > HFdepth " << k << " </td>" << std::endl;
8657  if (test == 3)
8658  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8659  htmlFile << "<td class=\"s1\" align=\"center\">< R > HFdepth " << k << " </td>" << std::endl;
8660  if (test == 4)
8661  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8662  htmlFile << "<td class=\"s1\" align=\"center\">< TSn > HFdep " << k << " </td>" << std::endl;
8663  if (test == 5)
8664  for (int k = k_min[sub]; k <= kkkkkkmax; k++)
8665  htmlFile << "<td class=\"s1\" align=\"center\">< TSx > HFdep " << k << " </td>" << std::endl;
8666  } //
8667  } // sub
8668  htmlFile << "</tr>" << std::endl;
8669 
8670  // htmlFile << "<td class=\"s1\" align=\"center\">HB Depth 1</td>"<< std::endl;
8671  // htmlFile << "<td class=\"s1\" align=\"center\">HB Depth 2</td>" << std::endl;
8672  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 1</td>" << std::endl;
8673  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 2</td>" << std::endl;
8674  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 3</td>" << std::endl;
8675  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 4</td>" << std::endl;
8676  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 5</td>" << std::endl;
8677  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 6</td>" << std::endl;
8678  // htmlFile << "<td class=\"s1\" align=\"center\">HE Depth 7</td>" << std::endl;
8679  // htmlFile << "<td class=\"s1\" align=\"center\">HO Depth 4</td>" << std::endl;
8680  // htmlFile << "<td class=\"s1\" align=\"center\">HF Depth 1</td>" << std::endl;
8681  // htmlFile << "<td class=\"s1\" align=\"center\">HF Depth 2</td>" << std::endl;
8682  // htmlFile << "<td class=\"s1\" align=\"center\">HF Depth 3</td>" << std::endl;
8683  // htmlFile << "<td class=\"s1\" align=\"center\">HF Depth 4</td>" << std::endl;
8684  // htmlFile << "</tr>" << std::endl;
8685 
8686  ind = 0;
8687  // cout<<"Creating tests html pages: 222222" << endl;
8688  for (int i = 1; i <= MaxLum; i++) {
8689  // define al least one exceed in any sub-detector
8690  int met = 0;
8691  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
8692  int kkkkkkmax = k_max[sub];
8693  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
8694  kkkkkkmax = k_maxupgrade[sub];
8695  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
8696  for (int k = k_min[sub]; k <= kkkkkkmax; k++) {
8697  // 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
8698  // if (sub == 2 && k > 3) {
8699  // } else {
8700  if (HistNumBadChanDepth[test][sub][k]->GetBinContent(i) > Cut0[test][sub][k])
8701  met = 1;
8702  // }
8703  } //depth
8704  } //sub
8705  // if exceed then plot the line for all sub-detectors
8706  if (met == 1) {
8707  if ((ind % 2) == 1)
8708  raw_class = "<td class=\"s2\" align=\"center\">";
8709  else
8710  raw_class = "<td class=\"s3\" align=\"center\">";
8711  htmlFile << "<tr>" << std::endl;
8712  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
8713  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
8714  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
8715  for (int sub = 1; sub <= 4; sub++) { //Subdetector: 1-HB, 2-HE, 3-HF, 4-HO
8716  int kkkkkkmax = k_max[sub];
8717  if ((sub == 4 || sub == 2 || sub == 1) && test == 1)
8718  kkkkkkmax = k_maxupgrade[sub];
8719  // if ( (sub==4 || sub==2) && test==1) kkkkkkmax = k_maxupgrade[sub];
8720  for (int k = k_min[sub]; k <= kkkkkkmax; k++) {
8721  if (HistNumBadChanDepth[test][sub][k]->GetBinContent(i) > Cut0[test][sub][k])
8722  htmlFile << "<td class=\"s6\" align=\"center\">" << HistNumBadChanDepth[test][sub][k]->GetBinContent(i)
8723  << "</td>" << std::endl;
8724  else
8725  htmlFile << raw_class << HistNumBadChanDepth[test][sub][k]->GetBinContent(i) << "</td>" << std::endl;
8726  // htmlFile << "</tr>" << std::endl;
8727  /*
8728  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;
8729  else htmlFile <<raw_class<<HistNumBadChanDepth[test][1][1]->GetBinContent(i)<<"</td>"<< std::endl;
8730  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;
8731  else htmlFile <<raw_class<<HistNumBadChanDepth[test][1][2]->GetBinContent(i)<<"</td>"<< std::endl;
8732  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;
8733  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][1]->GetBinContent(i)<<"</td>"<< std::endl;
8734  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;
8735  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][2]->GetBinContent(i)<<"</td>"<< std::endl;
8736  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;
8737  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][3]->GetBinContent(i)<<"</td>"<< std::endl;
8738  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;
8739  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][4]->GetBinContent(i)<<"</td>"<< std::endl;
8740  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;
8741  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][5]->GetBinContent(i)<<"</td>"<< std::endl;
8742  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;
8743  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][6]->GetBinContent(i)<<"</td>"<< std::endl;
8744  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;
8745  else htmlFile <<raw_class<<HistNumBadChanDepth[test][2][7]->GetBinContent(i)<<"</td>"<< std::endl;
8746  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;
8747  else htmlFile <<raw_class<<HistNumBadChanDepth[test][3][4]->GetBinContent(i)<<"</td>"<< std::endl;
8748  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;
8749  else htmlFile <<raw_class<<HistNumBadChanDepth[test][4][1]->GetBinContent(i)<<"</td>"<< std::endl;
8750  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;
8751  else htmlFile <<raw_class<<HistNumBadChanDepth[test][4][2]->GetBinContent(i)<<"</td>"<< std::endl;
8752  */
8753  } //k depthes
8754  } //sub
8755  htmlFile << "</tr>" << std::endl;
8756  ind += 1;
8757  } // met=1
8758  } //i bin lines
8759  // cout<<"Creating tests html pages: 333333" << endl;
8760  htmlFile << "</table>" << std::endl;
8761  htmlFile << "<br>" << std::endl;
8762  htmlFile << "</body> " << std::endl;
8763  htmlFile << "</html> " << std::endl;
8764  htmlFile.close();
8765  } //test
8766  //======================================================================
8767 
8769  // for sticking adc counts in neughbouring TS of each sub-detector
8770  htmlFile.open("StickingADCcounts_GL.html");
8771  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
8772  htmlFile << "<head>" << std::endl;
8773  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
8774  htmlFile << "<title> for sticking adc counts in neughbouring TS of each sub-detector </title>" << std::endl;
8775  htmlFile << "<style type=\"text/css\">" << std::endl;
8776  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
8777  << std::endl;
8778  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
8779  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
8780  "text-align: center;}"
8781  << std::endl;
8782  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
8783  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
8784  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
8785  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
8786  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
8787 
8788  htmlFile << "</style>" << std::endl;
8789  htmlFile << "<body>" << std::endl;
8790  htmlFile << "<h1> Monitoring of sticking adc counts in neughbouring TS in Global Run = " << runnumber << " </h1>"
8791  << std::endl;
8792 
8793  htmlFile << "<h3> Sticking_cases HB8, HB6, HB4, HB3, HB2: </h3>" << std::endl;
8794  htmlFile << " <img src=\"Sticking_cases86432HB.png\" />" << std::endl;
8795  htmlFile << "<br>" << std::endl;
8796  htmlFile << "<br>" << std::endl;
8797  htmlFile << "<br>" << std::endl;
8798 
8799  htmlFile << "<h3> Sticking_cases HE8, HE6, HE4, HE3, HE2: </h3>" << std::endl;
8800  htmlFile << " <img src=\"Sticking_cases86432HE.png\" />" << std::endl;
8801  htmlFile << "<br>" << std::endl;
8802 
8803  htmlFile << "<br>" << std::endl;
8804  htmlFile << "</body> " << std::endl;
8805  htmlFile << "</html> " << std::endl;
8806  htmlFile.close();
8807 
8809  // cout<<"for summed Amplitudes of each sub-detector" << endl;
8810  // for summed Amplitudes of each sub-detector
8811  htmlFile.open("SummedAmplitudes_GL.html");
8812  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
8813  htmlFile << "<head>" << std::endl;
8814  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
8815  htmlFile << "<title> for summed Amplitudes of each sub-detector </title>" << std::endl;
8816  htmlFile << "<style type=\"text/css\">" << std::endl;
8817  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
8818  << std::endl;
8819  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
8820  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
8821  "text-align: center;}"
8822  << std::endl;
8823  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
8824  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
8825  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
8826  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
8827  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
8828 
8829  htmlFile << "</style>" << std::endl;
8830  htmlFile << "<body>" << std::endl;
8831  htmlFile << "<h1> Averaged Summed Amplitudes & corresponding occupancy of each sub-detector in Global Run = "
8832  << runnumber << " </h1>" << std::endl;
8833  htmlFile << "<a name=\"Top\"></a>\n";
8834  htmlFile << "<b>Contents:<br>\n";
8835  htmlFile << "1. <a href=\"#SAhigh\">average SA&Occupancy for Signal </a><br>\n";
8836  htmlFile << "2. <a href=\"#SAlow\">average SA&Occupancy for NoSignal </a><br>\n";
8837  htmlFile << "3. <a href=\"#SAmax\"> maxSA & maxOccupancy; SA & Occupancy; </a><br>\n";
8838  htmlFile << "4. <a href=\"#FullTable\">Table(avA; avSA; avOccupancy; maxSA; maxOccupancy;) </a><br>\n";
8839 
8840  htmlFile << "<h2> Clarifying on averaged Summed Amplitude (avSA) : </h2>" << std::endl;
8841  htmlFile << "<h3> Summed Amplitudes (SA) are averaged over all events of each LS: avSA_LS = SUM (SA_eventsInLS) / "
8842  "N_eventsInLS ,</h3>"
8843  << std::endl;
8844  htmlFile << "<h3> where SA = SUM(A_i) ,and means that Amplitude is summed over all sub-detector channels, </h3>"
8845  << std::endl;
8846  htmlFile << "<h3> where A_i = SUM(A_depth) denotes channel amplitude summed over depths; </h3>" << std::endl;
8847  // 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;
8848  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/SAwriteup.html\"> see "
8849  "more details for SummedAmplitudes</a></td>"
8850  << std::endl;
8851  htmlFile << "<h2> Apply cuts on A_i to take into account channels with or/and without a'la Signal: </h2>"
8852  << std::endl;
8853  htmlFile << " <img src=\"ChannelDepthsummedAmplitudes.png\" />" << std::endl;
8854  htmlFile << "<br>" << std::endl;
8855  htmlFile << "<br>" << std::endl;
8856  htmlFile << "<a name=\"SAhigh\"></a>\n";
8857  htmlFile << "<h1> 1. for channels with signal </h1>" << std::endl;
8858  htmlFile << "<br>" << std::endl;
8859  htmlFile << "<h2> for HB: A_i> 80; </h2>" << std::endl;
8860  htmlFile << " <img src=\"SummedAmplitudesSignal_HB.png\" />" << std::endl;
8861  htmlFile << "<br>" << std::endl;
8862  htmlFile << "<h2> for HE: A_i> 200;</h2>" << std::endl;
8863  htmlFile << " <img src=\"SummedAmplitudesSignal_HE.png\" />" << std::endl;
8864  htmlFile << "<br>" << std::endl;
8865  htmlFile << "<h2> for HO: A_i> 1200;</h2>" << std::endl;
8866  htmlFile << " <img src=\"SummedAmplitudesSignal_HO.png\" />" << std::endl;
8867  htmlFile << "<br>" << std::endl;
8868  htmlFile << "<h2> for HF: A_i> 600;</h2>" << std::endl;
8869  htmlFile << " <img src=\"SummedAmplitudesSignal_HF.png\" />" << std::endl;
8870  htmlFile << "<br>" << std::endl;
8871  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8872 
8873  htmlFile << "<a name=\"SAlow\"></a>\n";
8874  htmlFile << "<h1> 2. for channels w/o signal </h1>" << std::endl;
8875  htmlFile << "<br>" << std::endl;
8876  htmlFile << "<h2> for HB: A_i< 80;</h2>" << std::endl;
8877  htmlFile << " <img src=\"NoSignalSummedAmplitudes_HB.png\" />" << std::endl;
8878  htmlFile << "<br>" << std::endl;
8879  htmlFile << "<h2> for HE: A_i< 200;</h2>" << std::endl;
8880  htmlFile << " <img src=\"NoSignalSummedAmplitudes_HE.png\" />" << std::endl;
8881  htmlFile << "<br>" << std::endl;
8882  htmlFile << "<h2> for HO: A_i< 1200;</h2>" << std::endl;
8883  htmlFile << " <img src=\"NoSignalSummedAmplitudes_HO.png\" />" << std::endl;
8884  htmlFile << "<br>" << std::endl;
8885  htmlFile << "<h2> for HF: A_i< 600;</h2>" << std::endl;
8886  htmlFile << " <img src=\"NoSignalSummedAmplitudes_HF.png\" />" << std::endl;
8887  htmlFile << "<br>" << std::endl;
8888  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8889 
8890  htmlFile << "<br>" << std::endl;
8891  htmlFile << "<br>" << std::endl;
8892  htmlFile << "<a name=\"SAmax\"></a>\n";
8893  htmlFile << "<h1> 3. four plots: ---1---> max SA ---2---> max Occupancy ---3---> SA ---4---> Occupancy over all "
8894  "events of LS </h1>"
8895  << std::endl;
8896  htmlFile << "<br>" << std::endl;
8897 
8898  htmlFile << "<h2> for HB: maxSA vs LS, masOccupancy vs LS, SA, Occupancy </h2>" << std::endl;
8899  htmlFile << " <img src=\"MaxxSummedAmplitudes_HB.png\" />" << std::endl;
8900  htmlFile << "<h2>"
8901  " ......(forCut:SAmax>60000) N= "
8902  << countamplmaxHB << " ...... (forCut:OCCUPmax>2000) N= " << countoccumaxHB << " </h2>" << std::endl;
8903  htmlFile << "<h2>"
8904  " ......(forCut:SA>60000) N= "
8905  << countamplHB << " ...... (forCut:OCCUP>2000) N= " << countoccuHB << " </h2>" << std::endl;
8906  htmlFile << "<br>" << std::endl;
8907  htmlFile << "<h3> ONLY for HB (cross-check): channel Amplitudes for events in the Tail (averaged): </h3>"
8908  << std::endl;
8909  htmlFile << " <img src=\"AtaildepthHB.png\" />" << std::endl;
8910  htmlFile << "<br>" << std::endl;
8911 
8912  htmlFile << "<h2> for HE: maxSA vs LS, masOccupancy vs LS, SA, Occupancy </h2>" << std::endl;
8913  htmlFile << " <img src=\"MaxxSummedAmplitudes_HE.png\" />" << std::endl;
8914  htmlFile << "<h2>"
8915  " ......(forCut:SAmax>60000) N= "
8916  << countamplmaxHE << " ...... (forCut:OCCUPmax>1200) N= " << countoccumaxHE << " </h2>" << std::endl;
8917  htmlFile << "<h2>"
8918  " ......(forCut:SA>60000) N= "
8919  << countamplHE << " ...... (forCut:OCCUP>1200) N= " << countoccuHE << " </h2>" << std::endl;
8920  htmlFile << "<br>" << std::endl;
8921 
8922  htmlFile << "<h2> for HO: maxSA vs LS, masOccupancy vs LS, SA, Occupancy </h2>" << std::endl;
8923  htmlFile << " <img src=\"MaxxSummedAmplitudes_HO.png\" />" << std::endl;
8924  htmlFile << "<h2>"
8925  " ......(forCut:SAmax>150000) N= "
8926  << countamplmaxHO << " ...... (forCut:OCCUPmax>2000) N= " << countoccumaxHO << " </h2>" << std::endl;
8927  htmlFile << "<h2>"
8928  " ......(forCut:SA>150000) N= "
8929  << countamplHO << " ...... (forCut:OCCUP>2000) N= " << countoccuHO << " </h2>" << std::endl;
8930  htmlFile << "<br>" << std::endl;
8931 
8932  htmlFile << "<h2> for HF: maxSA vs LS, masOccupancy vs LS, SA, Occupancy </h2>" << std::endl;
8933  htmlFile << " <img src=\"MaxxSummedAmplitudes_HF.png\" />" << std::endl;
8934  htmlFile << "<h2>"
8935  " ......(forCut:SAmax>22000) N= "
8936  << countamplmaxHF << " ...... (forCut:OCCUPmax>860) N= " << countoccumaxHF << " </h2>" << std::endl;
8937  htmlFile << "<h2>"
8938  " ......(forCut:SA>22000) N= "
8939  << countamplHF << " ...... (forCut:OCCUP>860) N= " << countoccuHF << " </h2>" << std::endl;
8940  htmlFile << "<br>" << std::endl;
8941  htmlFile << "<h2> Occupancy HF (ONLY) vs LS </h2>" << std::endl;
8942  htmlFile << " <img src=\"sumOccupancyHF.png\" />" << std::endl;
8943  htmlFile << "<br>" << std::endl;
8944  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
8945 
8946  htmlFile << "<a name=\"FullTable\"></a>\n";
8947  htmlFile << "<h2> 4.Lumisection Status: </h2>" << std::endl;
8948  htmlFile << "<h3> Legends: HBdepth1 red boxes correspond LSs selected with cut: <td class=\"s6\" align=\"center\">"
8949  << Cut0[1][1][1] << std::endl;
8950  htmlFile << "<h3> Legends: HEdepth1 red boxes correspond LSs selected with cut: <td class=\"s6\" align=\"center\">"
8951  << Cut0[1][2][1] << std::endl;
8952  htmlFile << "<h3> Legends: HOdepth4 red boxes correspond LSs selected with cut: <td class=\"s6\" align=\"center\">"
8953  << Cut0[1][3][4] << std::endl;
8954  htmlFile << "<h3> Legends: HFdepth1 red boxes correspond LSs selected with cut: <td class=\"s6\" align=\"center\">"
8955  << Cut0[1][4][1] << std::endl;
8956  htmlFile << "<br>" << std::endl;
8957  // SummedAmplitudeHisto[i] SummedAmplitudeOccupancyHisto[i] NoSignalSummedAmplitudeHisto[i] NoSignalSummedAmplitudeOccupancyHisto[i]; i=0-3;(HF:i=3)
8958  htmlFile << "<br>" << std::endl;
8959  htmlFile << "<table>" << std::endl;
8960  htmlFile << "<tr>";
8961  htmlFile << "<td class=\"s4\" align=\"center\">LS</td>" << std::endl;
8962  // htmlFile << "<td class=\"s1\" align=\"center\">LS</td>" << std::endl;
8963  htmlFile << "<td class=\"s1\" align=\"center\"> Num.of ev.</td>" << std::endl;
8964 
8965  // for (int k=k_min[sub];k<=k_max[sub]; k++) htmlFile << "<td class=\"s1\" align=\"center\">< A > Depth "<< k <<" </td>" << std::endl;
8966  // for (int sub=1;sub<=4;sub++) htmlFile << "<td class=\"s1\" align=\"center\">< A > Depth1, sub "<< sub <<" </td>" << std::endl;
8967 
8968  htmlFile << "<td class=\"s1\" align=\"center\">< A >HB Depth1</td>" << std::endl;
8969  htmlFile << "<td class=\"s1\" align=\"center\">< A >HE Depth1</td>" << std::endl;
8970  htmlFile << "<td class=\"s1\" align=\"center\">< A >HO Depth4</td>" << std::endl;
8971  htmlFile << "<td class=\"s1\" align=\"center\">< A >HF Depth1</td>" << std::endl;
8972 
8973  htmlFile << "<td class=\"s1\" align=\"center\">< SA >HB (Signal) </td>" << std::endl;
8974  htmlFile << "<td class=\"s1\" align=\"center\">< Occup. > HB (Signal) </td>" << std::endl;
8975  htmlFile << "<td class=\"s1\" align=\"center\">< SA >HF (Signal) </td>" << std::endl;
8976  htmlFile << "<td class=\"s1\" align=\"center\">< Occup. > HF (Signal) </td>" << std::endl;
8977 
8978  htmlFile << "<td class=\"s1\" align=\"center\">< SA >HB (NoSignal) </td>" << std::endl;
8979  htmlFile << "<td class=\"s1\" align=\"center\">< Occup. > HB (NoSignal) </td>" << std::endl;
8980  htmlFile << "<td class=\"s1\" align=\"center\">< SA >HF (NoSignal) </td>" << std::endl;
8981  htmlFile << "<td class=\"s1\" align=\"center\">< Occup. > HF (NoSignal) </td>" << std::endl;
8982 
8983  htmlFile << "<td class=\"s1\" align=\"center\"> maxSA HB </td>" << std::endl;
8984  htmlFile << "<td class=\"s1\" align=\"center\"> maxOccup. HB </td>" << std::endl;
8985  htmlFile << "<td class=\"s1\" align=\"center\"> maxSA HF </td>" << std::endl;
8986  htmlFile << "<td class=\"s1\" align=\"center\"> maxOccup. HF </td>" << std::endl;
8987 
8988  htmlFile << "</tr>" << std::endl;
8989 
8990  ind = 0;
8991  for (int i = 1; i <= MaxLum; i++) {
8992  if ((ind % 2) == 1)
8993  raw_class = "<td class=\"s2\" align=\"center\">";
8994  else
8995  raw_class = "<td class=\"s3\" align=\"center\">";
8996  htmlFile << "<tr>" << std::endl;
8997 
8998  htmlFile << "<td class=\"s4\" align=\"center\">" << i << "</td>" << std::endl;
8999 
9000  // htmlFile << raw_class<< LumLum->GetBinContent(i)<<"</td>"<< std::endl;
9001  htmlFile << raw_class << LumiEv->GetBinContent(i) << "</td>" << std::endl;
9002 
9003  // (test==1) <Amplitude>
9004  int test = 1;
9005  // for (int k=k_min[sub];k<=k_max[sub]; k++) {
9006  for (int sub = 1; sub <= 4; sub++) {
9007  for (int k = k_min[sub]; k <= k_min[sub]; k++) {
9008  if (HistNumBadChanDepth[test][sub][k]->GetBinContent(i) > Cut0[test][sub][k])
9009  htmlFile << "<td class=\"s6\" align=\"center\">" << HistNumBadChanDepth[test][sub][k]->GetBinContent(i)
9010  << "</td>" << std::endl;
9011 
9012  else
9013  htmlFile << raw_class << HistNumBadChanDepth[test][sub][k]->GetBinContent(i) << "</td>" << std::endl;
9014  }
9015  }
9016  if (SummedAmplitudeHisto[0]) {
9017  htmlFile << raw_class << SummedAmplitudeHisto[0]->GetBinContent(i) << "</td>" << std::endl;
9018  htmlFile << raw_class << SummedAmplitudeOccupancyHisto[0]->GetBinContent(i) << "</td>" << std::endl;
9019  htmlFile << raw_class << SummedAmplitudeHisto[3]->GetBinContent(i) << "</td>" << std::endl;
9020  htmlFile << raw_class << SummedAmplitudeOccupancyHisto[3]->GetBinContent(i) << "</td>" << std::endl;
9021 
9022  htmlFile << raw_class << NoSignalSummedAmplitudeHisto[0]->GetBinContent(i) << "</td>" << std::endl;
9023  htmlFile << raw_class << NoSignalSummedAmplitudeOccupancyHisto[0]->GetBinContent(i) << "</td>" << std::endl;
9024  htmlFile << raw_class << NoSignalSummedAmplitudeHisto[3]->GetBinContent(i) << "</td>" << std::endl;
9025  htmlFile << raw_class << NoSignalSummedAmplitudeOccupancyHisto[3]->GetBinContent(i) << "</td>" << std::endl;
9026 
9027  htmlFile << raw_class << MaxxSummedAmplitudeHisto[0]->GetBinContent(i) << "</td>" << std::endl;
9028  htmlFile << raw_class << MaxxSummedAmplitudeOccupancyHisto[0]->GetBinContent(i) << "</td>" << std::endl;
9029  htmlFile << raw_class << MaxxSummedAmplitudeHisto[3]->GetBinContent(i) << "</td>" << std::endl;
9030  htmlFile << raw_class << MaxxSummedAmplitudeOccupancyHisto[3]->GetBinContent(i) << "</td>" << std::endl;
9031  }
9032  htmlFile << "</tr>" << std::endl;
9033  ind += 1;
9034  }
9035  htmlFile << "</table>" << std::endl;
9036  htmlFile << "<a href=\"#Top\">to top</a><br>\n";
9037 
9038  htmlFile << "<br>" << std::endl;
9039  htmlFile << "</body> " << std::endl;
9040  htmlFile << "</html> " << std::endl;
9041  htmlFile.close();
9042 
9043  //====================================================================== // Creating description of html-files
9044 
9045  /*
9046  //======================================================================
9047  // Creating description HELP.html file:
9048  htmlFile.open("HELP.html");
9049  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< std::endl;
9050  htmlFile << "<head>"<< std::endl;
9051  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< std::endl;
9052  htmlFile << "<title> Certification Monitoring Tool </title>"<< std::endl;
9053  htmlFile << "<style type=\"text/css\">"<< std::endl;
9054  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< std::endl;
9055  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }"<< std::endl;
9056  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
9057  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< std::endl;
9058  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< std::endl;
9059  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< std::endl;
9060  htmlFile << "</style>"<< std::endl;
9061  htmlFile << "<body>"<< std::endl;
9062  htmlFile << "<h1> Description of Remote Monitoring Tool criteria for bad channel selection</h1>"<< std::endl;
9063  htmlFile << "<br>"<< std::endl;
9064  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;
9065  htmlFile << "<br>"<< std::endl;
9066  htmlFile << "<h3> - Amplitude is full amplitude collected over all time slices </h3> "<< std::endl;
9067  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;
9068  htmlFile << "<br>"<< std::endl;
9069  htmlFile << "<h3> - Width of shape distribution. Width is defined as square root from dispersion. </h3> "<< std::endl;
9070  htmlFile << "<br>"<< std::endl;
9071  htmlFile << "<h3> - Mean TS time slice position of adc signal. </h3> "<< std::endl;
9072  htmlFile << "<br>"<< std::endl;
9073  htmlFile << "<h3> - TS number of maximum signal </h3> "<< std::endl;
9074  htmlFile << "<br>"<< std::endl;
9075  htmlFile << "<h3> For more details see https://twiki.cern.ch/twiki/bin/viewauth/CMS/HcalRemoteCertificationMonitoring </h3> "<< std::endl;
9076  htmlFile << "</body> " << std::endl;
9077  htmlFile << "</html> " << std::endl;
9078  htmlFile.close();
9079 */
9080  //======================================================================
9081  // Creating description CMTresults.html file:
9082  htmlFile.open("CMTresults.html");
9083  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
9084  htmlFile << "<head>" << std::endl;
9085  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
9086  htmlFile << "<title> Certification Monitoring Tool </title>" << std::endl;
9087  htmlFile << "<style type=\"text/css\">" << std::endl;
9088  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
9089  << std::endl;
9090  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
9091  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
9092  "text-align: center;}"
9093  << std::endl;
9094  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
9095  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
9096  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
9097  htmlFile << "</style>" << std::endl;
9098  htmlFile << "<body>" << std::endl;
9099  htmlFile << "<h1> LS-certification (recommendation) from analysis of CMT-dependencies of THIS run </h1>"
9100  << std::endl;
9101  htmlFile << "<br>" << std::endl;
9102  htmlFile << "<br>" << std::endl;
9103  htmlFile << "<h2> - List of suspicious LSs: </h2> " << std::endl;
9104  htmlFile << "<br>" << std::endl;
9105  htmlFile << "<h3> to be added </h3> " << std::endl;
9106  htmlFile << "<br>" << std::endl;
9107  htmlFile << "<br>" << std::endl;
9108  htmlFile << "<br>" << std::endl;
9109  htmlFile << "<h2> - Comments: </h2> " << std::endl;
9110  htmlFile << "<br>" << std::endl;
9111  htmlFile << "<h3> to be added </h3> " << std::endl;
9112  htmlFile << "<br>" << std::endl;
9113  htmlFile << "<br>" << std::endl;
9114  htmlFile << "<br>" << std::endl;
9115  htmlFile << "</body> " << std::endl;
9116  htmlFile << "</html> " << std::endl;
9117  htmlFile.close();
9118 
9119  //======================================================================
9120  // Creating main html file:
9121 
9122  htmlFile.open("LumiList.html");
9123  htmlFile << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
9124  htmlFile << "<head>" << std::endl;
9125  htmlFile << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>" << std::endl;
9126  htmlFile << "<title> Certification Monitoring Tool </title>" << std::endl;
9127  htmlFile << "<style type=\"text/css\">" << std::endl;
9128  htmlFile << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"
9129  << std::endl;
9130  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; }" << std::endl;
9131  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; "
9132  "text-align: center;}"
9133  << std::endl;
9134  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }" << std::endl;
9135  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }" << std::endl;
9136  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }" << std::endl;
9137  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: #00FF00; }" << std::endl;
9138  htmlFile << " td.s6 { font-family: arial, arial ce, helvetica; background-color: #FF0000; }" << std::endl;
9139 
9140  htmlFile << "</style>" << std::endl;
9141  htmlFile << "<body>" << std::endl;
9142 
9143  htmlFile << "<h1> Certification Monitoring Tool, GLOBAL RUN = " << runnumber << ". </h1>" << std::endl;
9144  htmlFile << "<br>" << std::endl;
9145  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9146  << "/CMTresults.html\"> CMT-analysis RESULTS (for this run) </a></td>" << std::endl;
9147  htmlFile << "<br>" << std::endl;
9148  htmlFile << "<br>" << std::endl;
9149 
9150  // htmlFile << "<h2> 1. General information </h2>"<< std::endl;
9151  htmlFile << "<h2> 1. General information (Full number of LS = " << MaxLum000000 << " ). </h2>" << std::endl;
9152  htmlFile << " <img src=\"LumiEvent.png\" />" << std::endl;
9153  htmlFile << "<br>" << std::endl;
9154 
9155  htmlFile << "<h2> 2. HCAL status for different criteria </h2>" << std::endl;
9156  // 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;
9157  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/HELP.html\"> "
9158  "Description of criteria for bad channel selection</a></td>"
9159  << std::endl;
9160  htmlFile << "<br>" << std::endl;
9161  htmlFile << "<table width=\"600\">" << std::endl;
9162  htmlFile << "<tr>" << std::endl;
9163  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9164  << "/CapID_GL.html\">Cap ID errors</a></td>" << std::endl;
9165  // AZ 11.03.2019
9166  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9167  << "/ADCampl_GL.html\">Amplitude</a></td>" << std::endl;
9168  // htmlFile << " <td><a href=\"ADCampl_GL.html\">Amplitude</a></td>"<< std::endl;
9169  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9170  << "/Width_GL.html\">Width</a></td>" << std::endl;
9171  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9172  << "/Ratio_GL.html\">Ratio</a></td>" << std::endl;
9173  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9174  << "/Tmean_GL.html\">TS mean</a></td>" << std::endl;
9175  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9176  << "/Tmax_GL.html\">TS max</a></td>" << std::endl;
9177 
9178  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9179  << "/SummedAmplitudes_GL.html\">SummedAmplitudes</a></td>" << std::endl;
9180 
9181  htmlFile << " <td><a href=\"https://cms-conddb.cern.ch/eosweb/hcal/HcalRemoteMonitoring/CMT/GLOBAL_" << runnumber
9182  << "/StickingADCcounts_GL.html\">StickingADCcounts</a></td>" << std::endl;
9183 
9184  htmlFile << "</tr>" << std::endl;
9185  htmlFile << "</table>" << std::endl;
9186  htmlFile << "<br>" << std::endl;
9187  htmlFile << "</body> " << std::endl;
9188  htmlFile << "</html> " << std::endl;
9189  htmlFile.close();
9190  //======================================================================
9191 
9192  //======================================================================
9193  // Close and delete all possible things:
9194  hfile->Close();
9195  // hfile->Delete();
9196  // Exit Root
9197  gSystem->Exit(0);
9198  //======================================================================
9199 }
9200 
9201 // ------------------------------------------------------------
9202 
9203 int copyContents(TH1F **hDest, TString hname, TString htitle, const TH1F *hSrc, int lastBin) {
9204  if (lastBin > hSrc->GetNbinsX()) {
9205  std::cout << "copyContents from " << hSrc->GetName() << ": histo has " << hSrc->GetNbinsX()
9206  << " bins, when lastBin=" << lastBin << " was requested\n";
9207  return 0;
9208  }
9209 
9210  (*hDest) = new TH1F(hname, htitle, lastBin, 0, lastBin);
9211  (*hDest)->SetDirectory(0);
9212  (*hDest)->SetStats(0);
9213 
9214  for (int ibin = 1; ibin <= lastBin; ibin++) {
9215  (*hDest)->SetBinContent(ibin, hSrc->GetBinContent(ibin));
9216  (*hDest)->SetBinError(ibin, hSrc->GetBinError(ibin));
9217  }
9218  return 1;
9219 }
9220 
9221 // ------------------------------------------------------------
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:23
int copyContents(TH1F **hDest, TString hname, TString htitle, const TH1F *hSrc, int lastBin)
string fname
main script
float x