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