CMS 3D CMS Logo

zadcampltest.cc
Go to the documentation of this file.
1 #include <TChain.h>
2 #include <TH1D.h>
3 #include <TH2D.h>
4 #include <TProfile.h>
5 #include <TFitResult.h>
6 #include <TFitResultPtr.h>
7 #include <TPaveStats.h>
8 #include <vector>
9 #include <string>
10 #include <iomanip>
11 //#####
12 #include <iostream>
13 #include <fstream>
14 #include "TH1.h"
15 #include "TH2.h"
16 #include "TCanvas.h"
17 #include "TROOT.h"
18 #include <TMath.h>
19 #include "TStyle.h"
20 #include "TSystem.h"
21 #include "TLegend.h"
22 #include "TText.h"
23 #include "TAxis.h"
24 #include "TFile.h"
25 #include "TLine.h"
26 #include "TGraph.h"
27 #include <TPaveText.h>
28 #include <TPostScript.h>
29 #include <TClass.h>
30 
31 //
32 using namespace std;
33 //
34 //
35 
36 //inline void HERE(const char *msg) { std::cout << msg << std::endl; }
37 
38 int main(int argc, char *argv[]) {
39  std::string dirnm = "Analyzer";
40  //======================================================================
41  printf("reco: gROOT Reset \n");
42  gROOT->Reset();
43  gROOT->SetStyle("Plain");
44  // gStyle->SetOptStat(0); // no statistics _or_
45  // gStyle->SetOptStat(11111111);
46  //gStyle->SetOptStat(1101);// name mean and rms
47  // gStyle->SetOptStat(0101);// name and entries
48  // gStyle->SetOptStat(1100);// mean and rms only !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
49  // gStyle->SetOptStat(1110000);// und over, integral !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
50  gStyle->SetOptStat(101110); // entries, mean, rms, overflow !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
51  // gStyle->SetOptStat(100000);// over !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
52  //
53  //gStyle->SetOptFit(00010);// constant, mean and sigma only !!
54  // gStyle->SetOptFit(00001);// hi2/nu, constant, mean and sigma only !!
55  gStyle->SetOptFit(0010); // constant, mean and sigma only !!
56  // gStyle->SetOptFit(00011);// constant, mean and sigma only !!
57  // gStyle->SetOptFit(1101);
58  // gStyle->SetOptFit(1011);
59  //
60  //gStyle->SetStatX(0.98);
61  //gStyle->SetStatY(0.99);
62  //gStyle->SetStatW(0.30);
63  //gStyle->SetStatH(0.25);
64  gStyle->SetStatX(0.91);
65  gStyle->SetStatY(0.75);
66  gStyle->SetStatW(0.20);
67  gStyle->SetStatH(0.10);
68  // gStyle->SetStatH(0.35);
69  //
70 
71  // Float_t LeftOffset = 0.12;
72  //Float_t TopOffset = 0.12;
73  Float_t LeftOffset = 0.12;
74  Float_t TopOffset = 0.22;
75 
76  gStyle->SetLineWidth(1);
77  gStyle->SetErrorX(0);
78 
79  //---=[ Titles,Labels ]=-----------
80  gStyle->SetOptTitle(0); // title on/off
81  // gStyle->SetTitleColor(0); // title color
82  gStyle->SetTitleColor(1); // title color
83  // gStyle->SetTitleX(0.35); // title x-position
84  gStyle->SetTitleX(0.15); // title x-position
85  gStyle->SetTitleH(0.15); // title height
86  // gStyle->SetTitleW(0.53); // title width
87  gStyle->SetTitleW(0.60); // title width
88  gStyle->SetTitleFont(42); // title font
89  gStyle->SetTitleFontSize(0.07); // title font size
90 
91  gStyle->SetPalette(1);
92  //---=[ Histogram style ]=----------
93  // gStyle->SetHistFillColor(38);
94  // gStyle->SetFrameFillColor(41);// jelto-kori4nev-svetl
95  // gStyle->SetFrameFillColor(5);// jeltyi
96  // gStyle->SetFrameFillColor(17);// seryi
97  // gStyle->SetFrameFillColor(18);// svetlo seryi
98  // gStyle->SetFrameFillColor(20);// svetlo kori4nev
99  // gStyle->SetFrameFillColor(33);// sine-seryi
100  // gStyle->SetFrameFillColor(40);// fiolet-seryi
101  // gStyle->SetFrameFillColor(23);// sv.kor
102 
103  //---=[ Pad style ]=----------------
104  gStyle->SetPadTopMargin(TopOffset);
105  gStyle->SetPadBottomMargin(LeftOffset);
106  gStyle->SetPadRightMargin(TopOffset);
107  gStyle->SetPadLeftMargin(LeftOffset);
108  //---=[ SetCanvasDef ]=----------------
109  //======================================================================
110  //
111  // Connect the input file and get the 2-d histogram in memory
112  //======================================================================
113  // TBrowser *b = new TBrowser
114 
115  // TFile *hfile1= new TFile("test.root", "READ");
116  //
117 
118  // TFile *hfile1= new TFile("testNZS.root", "READ");
119  // TFile *hfile1= new TFile("test.root", "READ");
120 
121  // TFile *hfile1= new TFile("newruns/Global_234034.root", "READ");
122  //
123 
124  // TFile *hfile1= new TFile("/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/CMTweb/histos/Global_234556.root", "READ");
125  // TFile *hfile1= new TFile("Global_234034.root", "READ");
126  // TFile *hfile1= new TFile("test211006.root", "READ");
127  // TFile *hfile1= new TFile("test234457.root", "READ");
128 
129  // TFile *hfile1= new TFile("Global_51.root", "READ");
130  // TFile *hfile1= new TFile("Global_235698.root", "READ");
131 
132  // TFile *hfile1= new TFile("Global_39.root", "READ");
133  // TFile *hfile1= new TFile("test237165.root", "READ");
134  //
135  // TFile *hfile1= new TFile("Laser_238187.root", "READ");
136  // TFile *hfile1= new TFile("Laser_238183.root", "READ");
137 
138  // TFile *hfile1= new TFile("Global_255031.root", "READ");
139 
140  // TFile *hfile1= new TFile("Global_256001.root", "READ");
141  // TFile *hfile1= new TFile("Global_256167.root", "READ");
142  // TFile *hfile1= new TFile("Global_256348.root", "READ");
143  // TFile *hfile1= new TFile("Global_256630.root", "READ");
144 
145  // TFile *hfile1= new TFile("../PYTHON_runlist_test/Global_283884_1.root", "READ");
146  // TFile *hfile1= new TFile("Global_test.root", "READ");
147 
148  // TFile *hfile1= new TFile("LED_280702.root", "READ");
149  // TFile *hfile2= new TFile("LED_287824.root", "READ");
150 
151  // TFile *hfile1= new TFile("LED_284352.root", "READ");
152  // TFile *hfile1= new TFile("LEDtest.root", "READ");
153  // TFile *hfile1 = new TFile("Global_346445.root", "READ");
154 
155  TFile *hfile1 = new TFile("Global_346300.root", "READ");
156  // TH1D *hist1(nullptr);
157  // hist1 = (TH1D *)dir->FindObjectAny("h_mapDepth1_HE");
158 
159  // TFile *hfile2= new TFile("LED_284902.root", "READ");
160  // TFile *hfile2= new TFile("LED_284499.root", "READ");
161  // TFile *hfile2= new TFile("LED_284352.root", "READ");
162 
163  // TFile *hfile2= new TFile("LED_286590.root", "READ");
164 
165  // getchar();
166  //
167  TPostScript psfile("zadcampltest.ps", 111);
168 
169  //
170 
171  TCanvas *c1 = new TCanvas("c1", "Hcal4test", 200, 10, 700, 900);
172 
173  hfile1->ls();
174  TDirectory *dir = (TDirectory *)hfile1->FindObjectAny(dirnm.c_str());
175 
176  //========================================================================================== 1
177  //======================================================================
178  //======================================================================
179  //================
180  //======================================================================
181  c1->Clear();
182  c1->Divide(2, 4);
183 
184  c1->cd(1);
185  // TH2F *Zzzdepth1hef1 = (TH2F *)hfile1->Get("h_mapDepth1_HE");
186  TH2F *Zzzdepth1hef1 = (TH2F *)dir->FindObjectAny("h_mapDepth1_HE");
187  gPad->SetGridy();
188  gPad->SetGridx();
189  gPad->SetLogz();
190  Zzzdepth1hef1->SetXTitle("#eta \b");
191  Zzzdepth1hef1->SetYTitle("#phi \b");
192  Zzzdepth1hef1->SetZTitle("h_mapDepth1_HE \b");
193  Zzzdepth1hef1->Draw("COLZ");
194 
195  c1->cd(2);
196  TH2F *Zzzdepth1hef2 = (TH2F *)dir->FindObjectAny("h_mapDepth2_HE");
197  gPad->SetGridy();
198  gPad->SetGridx();
199  gPad->SetLogz();
200  Zzzdepth1hef2->SetXTitle("#eta \b");
201  Zzzdepth1hef2->SetYTitle("#phi \b");
202  Zzzdepth1hef2->SetZTitle("h_mapDepth2_HE \b");
203  Zzzdepth1hef2->Draw("COLZ");
204 
205  c1->cd(3);
206  TH2F *Zzzdepth1hef3 = (TH2F *)dir->FindObjectAny("h_mapDepth3_HE");
207  gPad->SetGridy();
208  gPad->SetGridx();
209  gPad->SetLogz();
210  Zzzdepth1hef3->SetXTitle("#eta \b");
211  Zzzdepth1hef3->SetYTitle("#phi \b");
212  Zzzdepth1hef3->SetZTitle("h_mapDepth3_HE \b");
213  Zzzdepth1hef3->Draw("COLZ");
214 
215  c1->cd(4);
216  TH2F *Zzzdepth1hef4 = (TH2F *)dir->FindObjectAny("h_mapDepth4_HE");
217  gPad->SetGridy();
218  gPad->SetGridx();
219  gPad->SetLogz();
220  Zzzdepth1hef4->SetXTitle("#eta \b");
221  Zzzdepth1hef4->SetYTitle("#phi \b");
222  Zzzdepth1hef4->SetZTitle("h_mapDepth4_HE \b");
223  Zzzdepth1hef4->Draw("COLZ");
224 
225  c1->cd(5);
226  TH2F *Zzzdepth1hef5 = (TH2F *)dir->FindObjectAny("h_mapDepth5_HE");
227  gPad->SetGridy();
228  gPad->SetGridx();
229  gPad->SetLogz();
230  Zzzdepth1hef5->SetXTitle("#eta \b");
231  Zzzdepth1hef5->SetYTitle("#phi \b");
232  Zzzdepth1hef5->SetZTitle("h_mapDepth5_HE \b");
233  Zzzdepth1hef5->Draw("COLZ");
234 
235  c1->cd(6);
236  TH2F *Zzzdepth1hef6 = (TH2F *)dir->FindObjectAny("h_mapDepth6_HE");
237  gPad->SetGridy();
238  gPad->SetGridx();
239  gPad->SetLogz();
240  Zzzdepth1hef6->SetXTitle("#eta \b");
241  Zzzdepth1hef6->SetYTitle("#phi \b");
242  Zzzdepth1hef6->SetZTitle("h_mapDepth6_HE \b");
243  Zzzdepth1hef6->Draw("COLZ");
244 
245  c1->cd(7);
246  TH2F *Zzzdepth1hef7 = (TH2F *)dir->FindObjectAny("h_mapDepth7_HE");
247  gPad->SetGridy();
248  gPad->SetGridx();
249  gPad->SetLogz();
250  Zzzdepth1hef7->SetXTitle("#eta \b");
251  Zzzdepth1hef7->SetYTitle("#phi \b");
252  Zzzdepth1hef7->SetZTitle("h_mapDepth7_HE \b");
253  Zzzdepth1hef7->Draw("COLZ");
254 
255  c1->cd(8);
256  TH1F *jdjswi8 = (TH1F *)dir->FindObjectAny("h_ADCAmpl_HE");
257  gPad->SetLogy(kFALSE);
258  // gPad->SetLogx();
259  jdjswi8->SetMarkerStyle(20);
260  jdjswi8->SetMarkerSize(0.8);
261  jdjswi8->GetYaxis()->SetLabelSize(0.04);
262  jdjswi8->SetXTitle("h_ADCAmpl_HE \b");
263  jdjswi8->SetMarkerColor(2);
264  jdjswi8->SetLineColor(2);
265  jdjswi8->Draw("");
266 
267  c1->Update();
268 
269  //========================================================================================== 2
270  //======================================================================
271  //======================================================================
272  //================
273  //======================================================================
274  c1->Clear();
275  c1->Divide(2, 4);
276 
277  c1->cd(1);
278  TH1F *wqwhef1 = (TH1F *)dir->FindObjectAny("h_mapDepth1ADCAmpl_HE");
279  gPad->SetGridy();
280  gPad->SetGridx();
281  gPad->SetLogz();
282  wqwhef1->SetZTitle("h_mapDepth1ADCAmpl_HE \b");
283  wqwhef1->Draw("COLZ");
284 
285  c1->cd(2);
286  TH1F *wqwhef2 = (TH1F *)dir->FindObjectAny("h_mapDepth2ADCAmpl_HE");
287  gPad->SetGridy();
288  gPad->SetGridx();
289  gPad->SetLogz();
290  wqwhef2->SetZTitle("h_mapDepth2ADCAmpl_HE \b");
291  wqwhef2->Draw("COLZ");
292 
293  c1->cd(3);
294  TH1F *wqwhef3 = (TH1F *)dir->FindObjectAny("h_mapDepth3ADCAmpl_HE");
295  gPad->SetGridy();
296  gPad->SetGridx();
297  gPad->SetLogz();
298  wqwhef3->SetZTitle("h_mapDepth3ADCAmpl_HE \b");
299  wqwhef3->Draw("COLZ");
300 
301  c1->cd(4);
302  TH1F *wqwhef4 = (TH1F *)dir->FindObjectAny("h_mapDepth4ADCAmpl_HE");
303  gPad->SetGridy();
304  gPad->SetGridx();
305  gPad->SetLogz();
306  wqwhef4->SetZTitle("h_mapDepth4ADCAmpl_HE \b");
307  wqwhef4->Draw("COLZ");
308 
309  c1->cd(5);
310  TH1F *wqwhef5 = (TH1F *)dir->FindObjectAny("h_mapDepth5ADCAmpl_HE");
311  gPad->SetGridy();
312  gPad->SetGridx();
313  gPad->SetLogz();
314  wqwhef5->SetZTitle("h_mapDepth5ADCAmpl_HE \b");
315  wqwhef5->Draw("COLZ");
316 
317  c1->cd(6);
318  TH1F *wqwhef6 = (TH1F *)dir->FindObjectAny("h_mapDepth6ADCAmpl_HE");
319  gPad->SetGridy();
320  gPad->SetGridx();
321  gPad->SetLogz();
322  wqwhef6->SetZTitle("h_mapDepth6ADCAmpl_HE \b");
323  wqwhef6->Draw("COLZ");
324 
325  c1->cd(7);
326  TH1F *wqwhef7 = (TH1F *)dir->FindObjectAny("h_mapDepth7ADCAmpl_HE");
327  gPad->SetGridy();
328  gPad->SetGridx();
329  gPad->SetLogz();
330  wqwhef7->SetZTitle("h_mapDepth7ADCAmpl_HE \b");
331  wqwhef7->Draw("COLZ");
332 
333  c1->Update();
334 
335  //========================================================================================== 3
336  //======================================================================
337  //======================================================================
338  //================
339  //======================================================================
340  c1->Clear();
341  c1->Divide(2, 4);
342 
343  c1->cd(1);
344  TH1F *azzdepth1hef1 = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS3");
345  gPad->SetGridy();
346  gPad->SetGridx();
347  azzdepth1hef1->SetZTitle("h_sumADCAmplperLS3 \b");
348  azzdepth1hef1->Draw("");
349 
350  c1->cd(2);
351  TH1F *azzdepth1hef2 = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS4");
352  gPad->SetGridy();
353  gPad->SetGridx();
354  azzdepth1hef2->SetZTitle("h_sumADCAmplperLS3 \b");
355  azzdepth1hef2->Draw("");
356 
357  c1->cd(3);
358  TH1F *azzdepth1hef3 = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLS5");
359  gPad->SetGridy();
360  gPad->SetGridx();
361  azzdepth1hef3->SetZTitle("h_sumADCAmplperLS3 \b");
362  azzdepth1hef3->Draw("");
363 
364  c1->cd(4);
365  TH1F *azzdepth1hef4 = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth4HEu");
366  gPad->SetGridy();
367  gPad->SetGridx();
368  azzdepth1hef4->SetZTitle("h_sumADCAmplperLS3 \b");
369  azzdepth1hef4->Draw("");
370 
371  c1->cd(5);
372  TH1F *azzdepth1hef5 = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth5HEu");
373  gPad->SetGridy();
374  gPad->SetGridx();
375  azzdepth1hef5->SetZTitle("h_sumADCAmplperLS3 \b");
376  azzdepth1hef5->Draw("");
377 
378  c1->cd(6);
379  TH1F *azzdepth1hef6 = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth6HEu");
380  gPad->SetGridy();
381  gPad->SetGridx();
382  azzdepth1hef6->SetZTitle("h_sumADCAmplperLS3 \b");
383  azzdepth1hef6->Draw("");
384 
385  c1->cd(7);
386  TH1F *azzdepth1hef7 = (TH1F *)dir->FindObjectAny("h_sumADCAmplperLSdepth7HEu");
387  gPad->SetGridy();
388  gPad->SetGridx();
389  azzdepth1hef7->SetZTitle("h_sumADCAmplperLS3 \b");
390  azzdepth1hef7->Draw("");
391 
392  c1->Update();
393 
394  //========================================================================================== 4
395  //======================================================================
396  //======================================================================
397  //================
398  //======================================================================
399  c1->Clear();
400  c1->Divide(2, 4);
401 
402  c1->cd(1);
403  TH1F *poqw1 = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS3");
404  gPad->SetGridy();
405  gPad->SetGridx();
406  poqw1->SetZTitle("h_sumCutADCAmplperLS3 \b");
407  poqw1->Draw("");
408 
409  c1->cd(2);
410  TH1F *poqw2 = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS4");
411  gPad->SetGridy();
412  gPad->SetGridx();
413  poqw2->SetZTitle("h_sumCutADCAmplperLS3 \b");
414  poqw2->Draw("");
415 
416  c1->cd(3);
417  TH1F *poqw3 = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLS5");
418  gPad->SetGridy();
419  gPad->SetGridx();
420  poqw3->SetZTitle("h_sumCutADCAmplperLS3 \b");
421  poqw3->Draw("");
422 
423  c1->cd(4);
424  TH1F *poqw4 = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth4HEu");
425  gPad->SetGridy();
426  gPad->SetGridx();
427  poqw4->SetZTitle("h_sumCutADCAmplperLS3 \b");
428  poqw4->Draw("");
429 
430  c1->cd(5);
431  TH1F *poqw5 = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth5HEu");
432  gPad->SetGridy();
433  gPad->SetGridx();
434  poqw5->SetZTitle("h_sumCutADCAmplperLS3 \b");
435  poqw5->Draw("");
436 
437  c1->cd(6);
438  TH1F *poqw6 = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth6HEu");
439  gPad->SetGridy();
440  gPad->SetGridx();
441  poqw6->SetZTitle("h_sumCutADCAmplperLS3 \b");
442  poqw6->Draw("");
443 
444  c1->cd(7);
445  TH1F *poqw7 = (TH1F *)dir->FindObjectAny("h_sumCutADCAmplperLSdepth7HEu");
446  gPad->SetGridy();
447  gPad->SetGridx();
448  poqw7->SetZTitle("h_sumCutADCAmplperLS3 \b");
449  poqw7->Draw("");
450 
451  c1->Update();
452 
453  //========================================================================================== 5
454  //======================================================================
455  //======================================================================
456  //================
457  //======================================================================
458  c1->Clear();
459  c1->Divide(2, 4);
460 
461  c1->cd(1);
462  TH1F *cdew1 = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS3");
463  gPad->SetGridy();
464  gPad->SetGridx();
465  cdew1->SetZTitle("h_sum0ADCAmplperLS3 \b");
466  cdew1->Draw("");
467 
468  c1->cd(2);
469  TH1F *cdew2 = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS4");
470  gPad->SetGridy();
471  gPad->SetGridx();
472  cdew2->SetZTitle("h_sum0ADCAmplperLS3 \b");
473  cdew2->Draw("");
474 
475  c1->cd(3);
476  TH1F *cdew3 = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLS5");
477  gPad->SetGridy();
478  gPad->SetGridx();
479  cdew3->SetZTitle("h_sum0ADCAmplperLS3 \b");
480  cdew3->Draw("");
481 
482  c1->cd(4);
483  TH1F *cdew4 = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth4HEu");
484  gPad->SetGridy();
485  gPad->SetGridx();
486  cdew4->SetZTitle("h_sum0ADCAmplperLS3 \b");
487  cdew4->Draw("");
488 
489  c1->cd(5);
490  TH1F *cdew5 = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth5HEu");
491  gPad->SetGridy();
492  gPad->SetGridx();
493  cdew5->SetZTitle("h_sum0ADCAmplperLS3 \b");
494  cdew5->Draw("");
495 
496  c1->cd(6);
497  TH1F *cdew6 = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth6HEu");
498  gPad->SetGridy();
499  gPad->SetGridx();
500  cdew6->SetZTitle("h_sum0ADCAmplperLS3 \b");
501  cdew6->Draw("");
502 
503  c1->cd(7);
504  TH1F *cdew7 = (TH1F *)dir->FindObjectAny("h_sum0ADCAmplperLSdepth7HEu");
505  gPad->SetGridy();
506  gPad->SetGridx();
507  cdew7->SetZTitle("h_sum0ADCAmplperLS3 \b");
508  cdew7->Draw("");
509 
510  c1->Update();
511 
512  //======================================================================
513  //==================================================================================================== end
514  //======================================================================
515  //======================================================================
516  // close and delete all possible things:
517 
518  // psfile->Close();
519  psfile.Close();
520 
521  hfile1->Close();
522  // hfile1->Delete();
523  hfile1->Close();
524  // hfile1->Delete();
525 
526  // Exit Root
527  gSystem->Exit(0);
528  //======================================================================
529 }
int main(int argc, char *argv[])
Definition: zadcampltest.cc:38