Useful macros for the shifter
[u/mrichter/AliRoot.git] / ZDC / CheckLaserHistos.C
CommitLineData
17d83603 1#if !defined(__CINT__) || defined(__MAKECINT__)
2
3#include <TROOT.h>
4#include <TStyle.h>
5#include <Riostream.h>
6#include <TStopwatch.h>
7#include <TDatime.h>
8#include <TClassTable.h>
9#include <TH1.h>
10#include <TH2.h>
11#include <TF1.h>
12#include <TProfile.h>
13#include <TFunction.h>
14#include <TCanvas.h>
15#include <TGrid.h>
16#include <TFile.h>
17
18#endif
19
20void CheckLaserHistos(Int_t nRun=0, Int_t optPlot = 1)
21{
22 if(nRun==0){
23 printf("\n\n YOU MUST PROVIDE A RUN NUMBER!!! \n\n");
24 return;
25 }
26
27 TGrid::Connect("alien:",0,0,"t");
28
29 char histoFName[150];
30 sprintf(histoFName,"alien:///alice/data/2010/Reference/ZDC/%d_laserReference.root",nRun);
31
32 TFile *file = TFile::Open(histoFName);
33 file->cd();
34 TH1F::AddDirectory(0);
35 //
36 // --- Histos for reference PMTs (high gain chains)
37 TH1F *hPMRefChg = new TH1F("hPMRefChg","hPMRefChg", 100,0.,1000.);
38 TH1F *hPMRefAhg = new TH1F("hPMRefAhg","hPMRefAhg", 100,0.,1000.);
39 TH1F *hPMRefClg = new TH1F("hPMRefClg","hPMRefClg", 100,0.,4000.);
40 TH1F *hPMRefAlg = new TH1F("hPMRefAlg","hPMRefAlg", 100,0.,4000.);
41 //
42 hPMRefChg = (TH1F*) file->Get("hPMRefChg");
43 hPMRefAhg = (TH1F*) file->Get("hPMRefAhg");
44 hPMRefClg = (TH1F*) file->Get("hPMRefClg");
45 hPMRefAlg = (TH1F*) file->Get("hPMRefAlg");
46 // --- Histos for detector PMTs
47 TH1F *hZNChg[5], *hZPChg[5], *hZNAhg[5], *hZPAhg[5], *hZEMhg[2];
48 TH1F *hZNClg[5], *hZPClg[5], *hZNAlg[5], *hZPAlg[5], *hZEMlg[2];
49 char hnamZNChg[20], hnamZPChg[20], hnamZNAhg[20], hnamZPAhg[20];
50 char hnamZNClg[20], hnamZPClg[20], hnamZNAlg[20], hnamZPAlg[20];
51 char hnamZEMhg[20], hnamZEMlg[20];
52 for(Int_t j=0; j<5; j++){
53 sprintf(hnamZNChg,"ZNChg-tow%d",j);
54 sprintf(hnamZPChg,"ZPChg-tow%d",j);
55 sprintf(hnamZNAhg,"ZNAhg-tow%d",j);
56 sprintf(hnamZPAhg,"ZPAhg-tow%d",j);
57 //
58 hZNChg[j] = new TH1F(hnamZNChg, hnamZNChg, 100, 0., 1000.);
59 hZPChg[j] = new TH1F(hnamZPChg, hnamZPChg, 100, 0., 1000.);
60 hZNAhg[j] = new TH1F(hnamZNAhg, hnamZNAhg, 100, 0., 1000.);
61 hZPAhg[j] = new TH1F(hnamZPAhg, hnamZPAhg, 100, 0., 1000.);
62 //
63 sprintf(hnamZNClg,"ZNClg-tow%d",j);
64 sprintf(hnamZPClg,"ZPClg-tow%d",j);
65 sprintf(hnamZNAlg,"ZNAlg-tow%d",j);
66 sprintf(hnamZPAlg,"ZPAlg-tow%d",j);
67 //
68 hZNClg[j] = new TH1F(hnamZNClg, hnamZNClg, 100, 0., 4000.);
69 hZPClg[j] = new TH1F(hnamZPClg, hnamZPClg, 100, 0., 4000.);
70 hZNAlg[j] = new TH1F(hnamZNAlg, hnamZNAlg, 100, 0., 4000.);
71 hZPAlg[j] = new TH1F(hnamZPAlg, hnamZPAlg, 100, 0., 4000.);
72 //
73 if(j<2){
74 sprintf(hnamZEMhg,"ZEM%dhg",j);
75 sprintf(hnamZEMlg,"ZEM%dlg",j);
76 //
77 hZEMhg[j] = new TH1F(hnamZEMhg, hnamZEMhg, 100, 0., 1000.);
78 hZEMlg[j] = new TH1F(hnamZEMlg, hnamZEMlg, 100, 0., 4000.);
79 }
80 //
81 hZNChg[j] = (TH1F*) file->Get(hnamZNChg);
82 hZPChg[j] = (TH1F*) file->Get(hnamZPChg);
83 hZNAhg[j] = (TH1F*) file->Get(hnamZNAhg);
84 hZPAhg[j] = (TH1F*) file->Get(hnamZPAhg);
85 //
86 hZNClg[j] = (TH1F*) file->Get(hnamZNClg);
87 hZPClg[j] = (TH1F*) file->Get(hnamZPClg);
88 hZNAlg[j] = (TH1F*) file->Get(hnamZNAlg);
89 hZPAlg[j] = (TH1F*) file->Get(hnamZPAlg);
90
91
92 }
93
94 if(optPlot==1){
95 // Plot the retrieved histos
96 //***********************************************************
97 // #### ROOT initialization
98 gROOT->Reset();
99 gStyle->SetCanvasColor(10);
100 gStyle->SetFrameFillColor(10);
101 gStyle->SetOptTitle(0);
102 gStyle->SetOptStat(1111);
103 gStyle->SetOptFit(111);
104 gStyle->SetTitleTextColor(9);
105 gStyle->SetStatTextColor(4);
106 gStyle->SetLineColor(1);
107 gStyle->SetPalette(1);
108 //***********************************************************
109 TCanvas *c1 = new TCanvas("c1","ZNC",0,0,1000,400);
110 c1->Divide(5,2);
111 for(Int_t y=0; y<5; y++){
112 c1->cd(y+1);
113 hZNChg[y]->Draw();
114 c1->cd(y+6);
115 hZNClg[y]->Draw();
116 }
117 c1->Print("ZNCLaser.ps");
118 //
119 TCanvas *c2 = new TCanvas("c2","ZPC",300,0,1000,400);
120 c2->Divide(5,2);
121 for(Int_t y=0; y<5; y++){
122 c2->cd(y+1);
123 hZPChg[y]->Draw();
124 c2->cd(y+6);
125 hZPClg[y]->Draw();
126 }
127 c2->Print("ZPCLaser.ps");
128 //
129 TCanvas *c3 = new TCanvas("c3","ZEM",400,0,400,400);
130 c3->Divide(2,2);
131 for(Int_t y=0; y<2; y++){
132 c3->cd(y+1);
133 hZEMhg[y]->Draw();
134 c3->cd(y+3);
135 hZEMlg[y]->Draw();
136 }
137 c3->Print("ZEMLaser.ps");
138 //
139 TCanvas *c4 = new TCanvas("c4","ZNA",0,400,1000,400);
140 c4->Divide(5,2);
141 for(Int_t y=0; y<5; y++){
142 c4->cd(y+1);
143 hZNAhg[y]->Draw();
144 c4->cd(y+6);
145 hZNAlg[y]->Draw();
146 }
147 c4->Print("ZNALaser.ps");
148 //
149 TCanvas *c5 = new TCanvas("c5","ZPA",300,400,1000,400);
150 c5->Divide(5,2);
151 for(Int_t y=0; y<5; y++){
152 c5->cd(y+1);
153 hZPAhg[y]->Draw();
154 c5->cd(y+6);
155 hZPAlg[y]->Draw();
156 }
157 c5->Print("ZPALaser.ps");
158 //
159 TCanvas *c6 = new TCanvas("c6","Ref",400,0,400,400);
160 c6->Divide(2,2);
161 c6->cd(1);
162 hPMRefChg->Draw();
163 c6->cd(2);
164 hPMRefAhg->Draw();
165 c6->cd(3);
166 hPMRefClg->Draw();
167 c6->cd(4);
168 hPMRefAlg->Draw();
169 //
170 c6->Print("RefLaser.ps");
171 }
172}