Useful macros for the shifter
[u/mrichter/AliRoot.git] / ZDC / CheckPedestalHistos.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 CheckPedestalHistos(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_pedestalReference.root",nRun);
31
32 int const kNChannels = 24;
33 //
34 TFile *file = TFile::Open(histoFName);
35 file->cd();
36 TH1F::AddDirectory(0);
37 //
38 TH1F *hPedhg[kNChannels], *hPedOutOfTimehg[kNChannels];
39 TH2F *hPedCorrhg[kNChannels];
40 TH1F *hPedlg[kNChannels], *hPedOutOfTimelg[kNChannels];
41 TH2F *hPedCorrlg[kNChannels];
42 //
43 char namhist1hg[50], namhist2hg[50], namhist3hg[50];
44 char namhist1lg[50], namhist2lg[50], namhist3lg[50];
45 for(Int_t j=0; j<kNChannels; j++){
46 if(j<=4){ // ZNC
47 sprintf(namhist1hg,"PedZNChg_%d",j);
48 sprintf(namhist2hg,"PedZNChgOutOfTime_%d",j);
49 sprintf(namhist3hg,"PedCorrZNChg_%d",j);
50 //
51 sprintf(namhist1lg,"PedZNClg_%d",j);
52 sprintf(namhist2lg,"PedZNClgOutOfTime_%d",j);
53 sprintf(namhist3lg,"PedCorrZNClg_%d",j);
54 }
55 else if(j>=5 && j<=9){ // ZPC
56 sprintf(namhist1hg,"PedZPChg_%d",j-5);
57 sprintf(namhist2hg,"PedZPChgOutOfTime_%d",j-5);
58 sprintf(namhist3hg,"PedCorrZPChg_%d",j-5);
59 //
60 sprintf(namhist1lg,"PedZPClg_%d",j-5);
61 sprintf(namhist2lg,"PedZPClgOutOfTime_%d",j-5);
62 sprintf(namhist3lg,"PedCorrZPClg_%d",j-5);
63 }
64 else if(j==10 || j==11){ // ZEM
65 sprintf(namhist1hg,"PedZEMhg_%d",j-9);
66 sprintf(namhist2hg,"PedZEMhgOutOfTime_%d",j-9);
67 sprintf(namhist3hg,"PedCorrZEMhg_%d",j-9);
68 //
69 sprintf(namhist1lg,"PedZEMlg_%d",j-9);
70 sprintf(namhist2lg,"PedZEMlgOutOfTime_%d",j-9);
71 sprintf(namhist3lg,"PedCorrZEMlg_%d",j-9);
72 }
73 else if(j>=12 && j<=16){ // ZNA
74 sprintf(namhist1hg,"PedZNAhg_%d",j-12);
75 sprintf(namhist2hg,"PedZNAhgOutOfTime_%d",j-12);
76 sprintf(namhist3hg,"PedCorrZNAhg_%d",j-12);
77 //
78 sprintf(namhist1lg,"PedZNAlg_%d",j-12);
79 sprintf(namhist2lg,"PedZNAlgOutOfTime_%d",j-12);
80 sprintf(namhist3lg,"PedCorrZNAlg_%d",j-12);
81 }
82 else if(j>=17 && j<=21){ // ZPA
83 sprintf(namhist1hg,"PedZPAhg_%d",j-17);
84 sprintf(namhist2hg,"PedZPAhgOutOfTime_%d",j-17);
85 sprintf(namhist3hg,"PedCorrZPAhg_%d",j-17);
86 //
87 sprintf(namhist1lg,"PedZPAlg_%d",j-17);
88 sprintf(namhist2lg,"PedZPAlgOutOfTime_%d",j-17);
89 sprintf(namhist3lg,"PedCorrZPAlg_%d",j-17);
90 }
91 else if(j==22 || j==23){ //Reference PMs
92 sprintf(namhist1hg,"PedRefhg_%d",j-22);
93 sprintf(namhist2hg,"PedRefhgOutOfTime_%d",j-22);
94 sprintf(namhist3hg,"PedCorrRefhg_%d",j-22);
95 //
96 sprintf(namhist1lg,"PedReflg_%d",j-22);
97 sprintf(namhist2lg,"PedReflgOutOfTime_%d",j-22);
98 sprintf(namhist3lg,"PedCorrReflg_%d",j-22);
99 }
100 // --- High gain chain histos
101 hPedhg[j] = (TH1F*) file->Get(namhist1hg);
102 hPedOutOfTimehg[j] = (TH1F*) file->Get(namhist2hg);
103 hPedCorrhg[j] = (TH2F*) file->Get(namhist3hg);
104 // --- Low gain chain histos
105 hPedlg[j] = (TH1F*) file->Get(namhist1lg);
106 hPedOutOfTimelg[j] =(TH1F*) file->Get(namhist2lg);
107 hPedCorrlg[j] = (TH2F*) file->Get(namhist3lg);
108 }
109
110 if(optPlot==1){
111 // Plot the retrieved histos
112 //***********************************************************
113 // #### ROOT initialization
114 gROOT->Reset();
115 gStyle->SetCanvasColor(10);
116 gStyle->SetFrameFillColor(10);
117 gStyle->SetOptTitle(0);
118 gStyle->SetOptStat(1111);
119 gStyle->SetOptFit(111);
120 gStyle->SetTitleTextColor(9);
121 gStyle->SetStatTextColor(4);
122 gStyle->SetLineColor(1);
123 gStyle->SetPalette(1);
124 //***********************************************************
125 TCanvas *c6 = new TCanvas("c6","Side C correlations",0,200,1000,800);
126 c6->Divide(5,4);
127 for(Int_t t=0; t<10; t++){
128 c6->cd(t+1);
129 hPedCorrhg[t]->Draw();
130 c6->cd(t+11);
131 hPedCorrlg[t]->Draw();
132 }
133 c6->Print("CorrSideC.ps");
134 //
135 TCanvas *c7 = new TCanvas("c7","Side A correlations",300,200,1000,800);
136 c7->Divide(5,4);
137 for(Int_t t=0; t<10; t++){
138 c7->cd(t+1);
139 hPedCorrhg[t+12]->Draw();
140 c7->cd(t+11);
141 hPedCorrlg[t+12]->Draw();
142 }
143 c7->Print("CorrSideA.ps");
144 //
145 TCanvas *c8 = new TCanvas("c8","ZEM correlations",400,200,400,400);
146 c8->Divide(2,2);
147 for(Int_t t=0; t<2; t++){
148 c8->cd(t+1);
149 hPedCorrhg[t+10]->Draw();
150 c8->cd(t+3);
151 hPedCorrlg[t+10]->Draw();
152 }
153 c8->Print("CorrZEM.ps");
154 //***********************************************************
155 TCanvas *c1 = new TCanvas("c1","ZNC pedestals",0,0,1000,400);
156 c1->Divide(5,2);
157 for(Int_t y=0; y<5; y++){
158 c1->cd(y+1);
159 hPedhg[y]->Draw();
160 c1->cd(y+6);
161 hPedlg[y]->Draw();
162 }
163 c1->Print("ZNCPed.ps");
164 //
165 TCanvas *c2 = new TCanvas("c2","ZPC pedestals",300,0,1000,400);
166 c2->Divide(5,2);
167 for(Int_t y=0; y<5; y++){
168 c2->cd(y+1);
169 hPedhg[y+5]->Draw();
170 c2->cd(y+6);
171 hPedlg[y+5]->Draw();
172 }
173 c2->Print("ZPCPed.ps");
174 //
175 TCanvas *c3 = new TCanvas("c3","ZEM pedestals",400,0,400,400);
176 c3->Divide(2,2);
177 for(Int_t y=0; y<2; y++){
178 c3->cd(y+1);
179 hPedhg[y+10]->Draw();
180 c3->cd(y+3);
181 hPedlg[y+10]->Draw();
182 }
183 c3->Print("ZEMPed.ps");
184 //
185 TCanvas *c4 = new TCanvas("c4","ZNA pedestals",0,400,1000,400);
186 c4->Divide(5,2);
187 for(Int_t y=0; y<5; y++){
188 c4->cd(y+1);
189 hPedhg[y+12]->Draw();
190 c4->cd(y+6);
191 hPedlg[y+12]->Draw();
192 }
193 c4->Print("ZNAPed.ps");
194 //
195 TCanvas *c5 = new TCanvas("c5","ZPA pedestals",300,400,1000,400);
196 c5->Divide(5,2);
197 for(Int_t y=0; y<5; y++){
198 c5->cd(y+1);
199 hPedhg[y+17]->Draw();
200 c5->cd(y+6);
201 hPedlg[y+17]->Draw();
202 }
203 c5->Print("ZPAPed.ps");
204 }
205}