]>
Commit | Line | Data |
---|---|---|
40b3a8c7 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TFile.h> | |
3 | #include <TH1F.h> | |
3615e762 | 4 | #include <TH2I.h> |
40b3a8c7 | 5 | #include <TGraph.h> |
6 | #include <TStyle.h> | |
7 | #include <TGrid.h> | |
3615e762 | 8 | #include <TLine.h> |
40b3a8c7 | 9 | #include <TCanvas.h> |
10 | #include <TObjArray.h> | |
11 | #include "AliCDBEntry.h" | |
12 | #include "AliITSCalibrationSDD.h" | |
3615e762 | 13 | #include "AliITSgeomTGeo.h" |
40b3a8c7 | 14 | #endif |
15 | ||
16 | // Macro to plot the calibration parameters from the OCDB file | |
17 | // created from PEDESTAL and PULSER runs (OCDB/ITS/Calib/CalibSDD) | |
18 | // Two methods ShowCalibrationSDD: | |
19 | // - the first takes the name of the file to be displayed | |
20 | // - the second builds the alien path+name from run number and file version | |
21 | // | |
22 | // Origin: F. Prino (prino@to.infn.it) | |
23 | ||
b3ba5bd1 | 24 | void ShowCalibrationSDD(Int_t iMod=0, Char_t *filnam="$ALICE_ROOT/ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root"){ |
40b3a8c7 | 25 | |
26 | ||
27 | TFile *f=TFile::Open(filnam); | |
28 | AliCDBEntry *ent=(AliCDBEntry*)f->Get("AliCDBEntry"); | |
296ee458 | 29 | TH2I* hlay3=new TH2I("hlay3","Layer 3",12,-0.5,5.5,14,-0.5,13.5); |
3615e762 | 30 | hlay3->GetXaxis()->SetTitle("Detector"); |
31 | hlay3->GetYaxis()->SetTitle("Ladder"); | |
32 | hlay3->GetXaxis()->SetTickLength(0); | |
33 | hlay3->GetYaxis()->SetTickLength(0); | |
34 | hlay3->SetStats(0); | |
35 | hlay3->SetMinimum(-1); | |
296ee458 | 36 | TH2I* hlay4=new TH2I("hlay4","Layer 4",16,-0.5,7.5,22,-0.5,21.5); |
3615e762 | 37 | hlay4->GetXaxis()->SetTitle("Detector"); |
38 | hlay4->GetYaxis()->SetTitle("Ladder"); | |
39 | hlay4->GetXaxis()->SetTickLength(0); | |
40 | hlay4->GetYaxis()->SetTickLength(0); | |
41 | hlay4->GetYaxis()->SetTitle("Ladder"); | |
42 | hlay4->SetStats(0); | |
43 | hlay4->SetMinimum(-1); | |
44 | ||
40b3a8c7 | 45 | TObjArray *calSDD = (TObjArray *)ent->GetObject(); |
46 | printf("Entries in array=%d\n",calSDD->GetEntriesFast()); | |
47 | TH1F* hmodstatus=new TH1F("hmodstatus","",260,0.5,260.5); | |
48 | TH1F* hnbadch=new TH1F("hnbadch","",260,0.5,260.5); | |
49 | TH1F* hbase=new TH1F("hbase","",60,0.5,120.5); | |
50 | TH1F* hnoise=new TH1F("hnoise","",100,0.,7.); | |
51 | TH1F* hgain=new TH1F("hgain","",100,0.,4.); | |
52 | TH1F* hchstatus=new TH1F("hchstatus","",2,-0.5,1.5); | |
53 | AliITSCalibrationSDD *cal; | |
b3ba5bd1 | 54 | Int_t badModCounter3=0; |
55 | Int_t badModCounter4=0; | |
56 | Int_t badAnodeCounter3=0; | |
57 | Int_t badAnodeCounter4=0; | |
58 | Int_t badAnodeCounterGoodMod3=0; | |
59 | Int_t badAnodeCounterGoodMod4=0; | |
60 | Int_t badAnodeCounterGoodModAndChip3=0; | |
61 | Int_t badAnodeCounterGoodModAndChip4=0; | |
62 | Int_t badChipCounter3=0; | |
63 | Int_t badChipCounter4=0; | |
40b3a8c7 | 64 | for(Int_t i=0; i<260; i++){ |
65 | cal=(AliITSCalibrationSDD*)calSDD->At(i); | |
66 | if(cal==0) continue; | |
67 | printf("Module %d (%d) status = ",i,i+240); | |
3615e762 | 68 | Int_t lay,lad,det; |
69 | AliITSgeomTGeo::GetModuleId(i+240,lay,lad,det); | |
296ee458 | 70 | Int_t index=1+(det-1)*2; |
b3ba5bd1 | 71 | if(cal->IsBad()){ |
72 | printf("BAD\t"); | |
3615e762 | 73 | if(lay==3){ |
74 | badModCounter3++; | |
296ee458 | 75 | hlay3->SetBinContent(index,lad,0); |
76 | hlay3->SetBinContent(index+1,lad,0); | |
3615e762 | 77 | }else if(lay==4){ |
78 | badModCounter4++; | |
296ee458 | 79 | hlay4->SetBinContent(index,lad,0); |
80 | hlay4->SetBinContent(index+1,lad,0); | |
3615e762 | 81 | } |
b3ba5bd1 | 82 | hmodstatus->SetBinContent(i+1,0); |
3615e762 | 83 | }else{ |
b3ba5bd1 | 84 | printf("OK\t"); |
85 | hmodstatus->SetBinContent(i+1,1); | |
3615e762 | 86 | if(lay==3){ |
87 | badAnodeCounterGoodMod3+=cal->GetDeadChannels(); | |
296ee458 | 88 | if(cal->IsChipBad(0) && cal->IsChipBad(1) && cal->IsChipBad(2) && cal->IsChipBad(3)){ |
89 | hlay3->SetBinContent(index,lad,0); | |
90 | }else{ | |
91 | hlay3->SetBinContent(index,lad,1); | |
92 | } | |
93 | if(cal->IsChipBad(4) && cal->IsChipBad(5) && cal->IsChipBad(6) && cal->IsChipBad(7)){ | |
94 | hlay3->SetBinContent(index+1,lad,0); | |
95 | }else{ | |
96 | hlay3->SetBinContent(index+1,lad,1); | |
97 | } | |
3615e762 | 98 | }else{ |
99 | badAnodeCounterGoodMod4+=cal->GetDeadChannels(); | |
296ee458 | 100 | if(cal->IsChipBad(0) && cal->IsChipBad(1) && cal->IsChipBad(2) && cal->IsChipBad(3)){ |
101 | hlay4->SetBinContent(index,lad,0); | |
102 | }else{ | |
103 | hlay4->SetBinContent(index,lad,1); | |
104 | } | |
105 | if(cal->IsChipBad(4) && cal->IsChipBad(5) && cal->IsChipBad(6) && cal->IsChipBad(7)){ | |
106 | hlay4->SetBinContent(index+1,lad,0); | |
107 | }else{ | |
108 | hlay4->SetBinContent(index+1,lad,1); | |
109 | } | |
3615e762 | 110 | } |
111 | } | |
40b3a8c7 | 112 | printf(" Chip Status (0=OK, 1=BAD): "); |
b3ba5bd1 | 113 | for(Int_t ic=0; ic<8;ic++){ |
114 | printf("%d ",cal->IsChipBad(ic)); | |
115 | if(cal->IsChipBad(ic) && !cal->IsBad()){ | |
116 | if(i<84) badChipCounter3++; | |
117 | else badChipCounter4++; | |
118 | } | |
119 | } | |
bc031ee2 | 120 | printf(" # bad anodes = %d ",cal->GetDeadChannels()); |
40b3a8c7 | 121 | if(cal->IsAMAt20MHz()) printf(" 20 MHz sampling"); |
122 | else printf(" 40 MHz sampling"); | |
123 | printf("\n"); | |
b3ba5bd1 | 124 | if(i<84) badAnodeCounter3+=cal->GetDeadChannels(); |
125 | else badAnodeCounter4+=cal->GetDeadChannels(); | |
40b3a8c7 | 126 | hnbadch->SetBinContent(i+1,cal->GetDeadChannels()); |
127 | for(Int_t iAn=0; iAn<512; iAn++){ | |
b3ba5bd1 | 128 | Int_t ic=cal->GetChip(iAn); |
129 | if(!cal->IsChipBad(ic) && !cal->IsBad() && cal->IsBadChannel(iAn)){ | |
130 | if(i<84) badAnodeCounterGoodModAndChip3++; | |
131 | else badAnodeCounterGoodModAndChip4++; | |
132 | } | |
40b3a8c7 | 133 | Float_t base=cal->GetBaseline(iAn); |
134 | Float_t noise=cal->GetNoiseAfterElectronics(iAn); | |
135 | Float_t gain=cal->GetChannelGain(iAn); | |
136 | if(cal->IsBadChannel(iAn)) hchstatus->Fill(0); | |
266a4b47 | 137 | if(!cal->IsBadChannel(iAn) && !cal->IsChipBad(ic) && !cal->IsBad() ){ |
40b3a8c7 | 138 | hbase->Fill(base); |
139 | hchstatus->Fill(1); | |
140 | hnoise->Fill(noise); | |
141 | hgain->Fill(gain); | |
142 | } | |
143 | } | |
144 | } | |
b3ba5bd1 | 145 | Int_t totbad3=badModCounter3*512+badChipCounter3*64+badAnodeCounterGoodModAndChip3; |
146 | Int_t tot3=6*14*512; | |
147 | Float_t fracbad3=(Float_t)totbad3/(Float_t)tot3; | |
148 | Int_t totbad4=badModCounter4*512+badChipCounter4*64+badAnodeCounterGoodModAndChip4; | |
149 | Int_t tot4=8*22*512; | |
150 | Float_t fracbad4=(Float_t)totbad4/(Float_t)tot4; | |
151 | Float_t fractot=(Float_t)(totbad3+totbad4)/(Float_t)(tot3+tot4); | |
152 | printf("----------------------Summary----------------------\n"); | |
153 | printf("---- Layer 3 ----\n"); | |
154 | printf("# of bad modules = %d\n",badModCounter3); | |
155 | printf("# of bad chips in good modules = %d\n",badChipCounter3); | |
156 | printf("# of bad anodes in good modules+chips = %d\n",badAnodeCounterGoodModAndChip3); | |
157 | printf("Fraction of bads (anodes+chips+mod) = %f\n",fracbad3); | |
158 | printf("---- Layer 4 ----\n"); | |
159 | printf("# of bad modules = %d\n",badModCounter4); | |
160 | printf("# of bad chips in good modules = %d\n",badChipCounter4); | |
161 | printf("# of bad anodes in good modules+chips = %d\n",badAnodeCounterGoodModAndChip4); | |
162 | printf("Fraction of bads (anodes+chips+mod) = %f\n",fracbad4); | |
163 | printf("---- Total ----\n"); | |
164 | printf("# of bad modules = %d\n",badModCounter3+badModCounter4); | |
165 | printf("# of bad chips in good modules = %d\n",badChipCounter3+badChipCounter4); | |
166 | printf("# of bad anodes in good modules+chips = %d\n",badAnodeCounterGoodModAndChip3+badAnodeCounterGoodModAndChip4); | |
167 | printf("Fraction of bads (anodes+chips+mod) = %f\n",fractot); | |
168 | printf("---------------------------------------------------\n"); | |
169 | ||
170 | ||
40b3a8c7 | 171 | TCanvas *c0=new TCanvas("c0","Module status",800,800); |
172 | c0->Divide(1,2); | |
173 | c0->cd(1); | |
174 | hmodstatus->Draw(); | |
175 | hmodstatus->GetXaxis()->SetTitle("Module number"); | |
176 | hmodstatus->GetYaxis()->SetTitle("Module status (1=OK, 0=BAD)"); | |
177 | c0->cd(2); | |
178 | hnbadch->Draw(); | |
179 | hnbadch->GetXaxis()->SetTitle("Module number"); | |
180 | hnbadch->GetYaxis()->SetTitle("Number of bad anodes"); | |
181 | ||
182 | TCanvas *c1=new TCanvas("c1","Anode calibration",800,800); | |
183 | c1->Divide(2,2); | |
184 | c1->cd(1); | |
185 | hbase->Draw(); | |
186 | hbase->GetXaxis()->SetTitle("Baseline after equalization"); | |
187 | hbase->GetXaxis()->CenterTitle(); | |
188 | c1->cd(2); | |
3615e762 | 189 | hnoise->Draw(); |
40b3a8c7 | 190 | hnoise->GetXaxis()->SetTitle("Noise"); |
191 | hnoise->GetXaxis()->CenterTitle(); | |
192 | c1->cd(3); | |
193 | hgain->Draw(); | |
194 | hgain->GetXaxis()->SetTitle("Gain"); | |
195 | hgain->GetXaxis()->CenterTitle(); | |
196 | c1->cd(4); | |
197 | hchstatus->Draw(); | |
198 | hchstatus->GetXaxis()->SetTitle("Anode status (0=bad, 1=OK)"); | |
199 | hchstatus->GetXaxis()->CenterTitle(); | |
3615e762 | 200 | Int_t palette[3]={kGray,2,3}; |
201 | gStyle->SetPalette(3,palette); | |
202 | ||
203 | TLine* lin=new TLine(0,0,0,23); | |
204 | TCanvas* clay=new TCanvas("clay","Layer status",900,600); | |
205 | clay->Divide(2,1); | |
206 | clay->cd(1); | |
207 | hlay3->Draw("col"); | |
208 | for(Int_t i=0;i<6;i++){ | |
209 | lin->SetY1(-0.5); | |
210 | lin->SetY2(13.5); | |
211 | lin->SetX1(i+0.5); | |
212 | lin->SetX2(i+0.5); | |
213 | lin->DrawClone(); | |
214 | } | |
215 | for(Int_t i=0;i<14;i++){ | |
216 | lin->SetX1(-0.5); | |
217 | lin->SetX2(5.5); | |
218 | lin->SetY1(i+0.5); | |
219 | lin->SetY2(i+0.5); | |
220 | lin->DrawClone(); | |
221 | } | |
222 | clay->cd(2); | |
223 | hlay4->Draw("col"); | |
224 | for(Int_t i=0;i<8;i++){ | |
225 | lin->SetY1(-0.5); | |
226 | lin->SetY2(21.5); | |
227 | lin->SetX1(i+0.5); | |
228 | lin->SetX2(i+0.5); | |
229 | lin->DrawClone(); | |
230 | } | |
231 | for(Int_t i=0;i<22;i++){ | |
232 | lin->SetX1(-0.5); | |
233 | lin->SetX2(7.5); | |
234 | lin->SetY1(i+0.5); | |
235 | lin->SetY2(i+0.5); | |
236 | lin->DrawClone(); | |
237 | } | |
238 | ||
239 | ||
40b3a8c7 | 240 | |
b3ba5bd1 | 241 | |
242 | // Plot quantities for specified module | |
243 | ||
40b3a8c7 | 244 | cal=(AliITSCalibrationSDD*)calSDD->At(iMod); |
245 | if(cal==0) return; | |
246 | printf("-----------------------------------\n"); | |
247 | printf("Module %d status = ",iMod); | |
248 | if(cal->IsBad()) printf("BAD\n"); | |
249 | else printf("OK\n"); | |
250 | printf(" Chip Status (0=OK, 1=BAD): "); | |
251 | for(Int_t ic=0; ic<8;ic++) printf("%d ",cal->IsChipBad(ic)); | |
252 | printf("\n"); | |
b3ba5bd1 | 253 | printf(" Number of bad anodes =%d\n",cal->GetDeadChannels()); |
40b3a8c7 | 254 | printf("-----------------------------------\n"); |
255 | Int_t ipt=0; | |
256 | TGraph *gbad=new TGraph(0); | |
257 | gbad->SetTitle("Bad Channels"); | |
258 | TGraph *gbase=new TGraph(0); | |
259 | gbase->SetTitle("Baselines"); | |
260 | TGraph *gnoi=new TGraph(0); | |
261 | gnoi->SetTitle("Noise"); | |
262 | TGraph *ggain=new TGraph(0); | |
263 | ggain->SetTitle("Gain"); | |
264 | for(Int_t iAn=0; iAn<512; iAn++){ | |
265 | Float_t bad=1; | |
266 | if(cal->IsBadChannel(iAn)) bad=0; | |
267 | Float_t base=cal->GetBaseline(iAn); | |
268 | Float_t noise=cal->GetNoiseAfterElectronics(iAn); | |
269 | Float_t gain=cal->GetChannelGain(iAn); | |
270 | gbad->SetPoint(ipt,(Float_t)iAn,bad); | |
271 | gbase->SetPoint(ipt,(Float_t)iAn,base); | |
272 | ggain->SetPoint(ipt,(Float_t)iAn,gain); | |
273 | gnoi->SetPoint(ipt,(Float_t)iAn,noise); | |
274 | ipt++; | |
275 | } | |
276 | Char_t ctit[100]; | |
277 | sprintf(ctit,"Module %d",iMod); | |
278 | ||
279 | TCanvas *c2=new TCanvas("c2",ctit,1200,800); | |
280 | c2->Divide(2,2); | |
281 | ||
282 | c2->cd(1); | |
283 | gbase->SetMarkerStyle(7); | |
284 | gbase->Draw("AP"); | |
285 | gbase->GetXaxis()->SetTitle("Anode Number"); | |
286 | gbase->GetYaxis()->SetTitle("Baseline after equalization"); | |
287 | c2->cd(2); | |
288 | gnoi->SetMarkerStyle(7); | |
289 | gnoi->Draw("AP"); | |
290 | gnoi->GetXaxis()->SetTitle("Anode Number"); | |
291 | gnoi->GetYaxis()->SetTitle("Noise"); | |
292 | c2->cd(3); | |
293 | ggain->SetMarkerStyle(7); | |
294 | ggain->Draw("AP"); | |
295 | ggain->GetXaxis()->SetTitle("Anode Number"); | |
296 | ggain->GetYaxis()->SetTitle("Gain"); | |
297 | c2->cd(4); | |
298 | gbad->SetMarkerStyle(7); | |
299 | gbad->Draw("AP"); | |
300 | gbad->SetMinimum(-0.1); | |
301 | gbad->GetXaxis()->SetTitle("Anode Number"); | |
302 | gbad->GetYaxis()->SetTitle("Anode Status (1=OK, 0=bad)"); | |
303 | } | |
304 | ||
266a4b47 | 305 | void ShowCalibrationSDD(Int_t nrun, Int_t nv, Int_t year=2009, Int_t nmod=0){ |
40b3a8c7 | 306 | TGrid::Connect("alien:",0,0,"t"); |
307 | Char_t filnam[200]; | |
266a4b47 | 308 | sprintf(filnam,"alien:///alice/data/%d/OCDB/ITS/Calib/CalibSDD/Run%d_999999999_v%d_s0.root",year,nrun,nv); |
40b3a8c7 | 309 | printf("Open file: %s\n",filnam); |
b3ba5bd1 | 310 | ShowCalibrationSDD(nmod,filnam); |
40b3a8c7 | 311 | } |