]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/macrosSDD/ShowCalibrationSDD.C
Add plot with map of working modules vs. DDL and Carlos
[u/mrichter/AliRoot.git] / ITS / macrosSDD / ShowCalibrationSDD.C
CommitLineData
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>
e34418c7 6#include <TExec.h>
40b3a8c7 7#include <TStyle.h>
551eb942 8#include <TString.h>
9#include <TSystem.h>
40b3a8c7 10#include <TGrid.h>
3615e762 11#include <TLine.h>
40b3a8c7 12#include <TCanvas.h>
13#include <TObjArray.h>
14#include "AliCDBEntry.h"
15#include "AliITSCalibrationSDD.h"
3615e762 16#include "AliITSgeomTGeo.h"
40b3a8c7 17#endif
18
131c4834 19/* $Id$ */
20
40b3a8c7 21// Macro to plot the calibration parameters from the OCDB file
22// created from PEDESTAL and PULSER runs (OCDB/ITS/Calib/CalibSDD)
23// Two methods ShowCalibrationSDD:
24// - the first takes the name of the file to be displayed
25// - the second builds the alien path+name from run number and file version
26//
27// Origin: F. Prino (prino@to.infn.it)
28
e34418c7 29void MakePalette(){
30 Int_t palette[3]={kGray,2,3};
31 gStyle->SetPalette(3,palette);
32}
33
551eb942 34void ShowCalibrationSDD(Char_t *filnam="$ALICE_ROOT/OCDB/ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root", Int_t iMod=0){
40b3a8c7 35
36
37 TFile *f=TFile::Open(filnam);
38 AliCDBEntry *ent=(AliCDBEntry*)f->Get("AliCDBEntry");
296ee458 39 TH2I* hlay3=new TH2I("hlay3","Layer 3",12,-0.5,5.5,14,-0.5,13.5);
3615e762 40 hlay3->GetXaxis()->SetTitle("Detector");
41 hlay3->GetYaxis()->SetTitle("Ladder");
42 hlay3->GetXaxis()->SetTickLength(0);
43 hlay3->GetYaxis()->SetTickLength(0);
44 hlay3->SetStats(0);
45 hlay3->SetMinimum(-1);
296ee458 46 TH2I* hlay4=new TH2I("hlay4","Layer 4",16,-0.5,7.5,22,-0.5,21.5);
3615e762 47 hlay4->GetXaxis()->SetTitle("Detector");
48 hlay4->GetYaxis()->SetTitle("Ladder");
49 hlay4->GetXaxis()->SetTickLength(0);
50 hlay4->GetYaxis()->SetTickLength(0);
51 hlay4->GetYaxis()->SetTitle("Ladder");
52 hlay4->SetStats(0);
53 hlay4->SetMinimum(-1);
9c3758ab 54 TH2I* hdeadlay3=new TH2I("hdlay3","Layer 3",6,-0.5,5.5,14,-0.5,13.5);
e34418c7 55 hdeadlay3->GetXaxis()->SetTitle("Detector");
56 hdeadlay3->GetYaxis()->SetTitle("Ladder");
57 hdeadlay3->GetXaxis()->SetTickLength(0);
58 hdeadlay3->GetYaxis()->SetTickLength(0);
59 hdeadlay3->SetStats(0);
60 hdeadlay3->SetMinimum(-1.);
9c3758ab 61 TH2I* hdeadlay4=new TH2I("hdlay4","Layer 4",8,-0.5,7.5,22,-0.5,21.5);
e34418c7 62 hdeadlay4->GetXaxis()->SetTitle("Detector");
63 hdeadlay4->GetYaxis()->SetTitle("Ladder");
64 hdeadlay4->GetXaxis()->SetTickLength(0);
65 hdeadlay4->GetYaxis()->SetTickLength(0);
66 hdeadlay4->GetYaxis()->SetTitle("Ladder");
67 hdeadlay4->SetStats(0);
68 hdeadlay4->SetMinimum(-1.);
3615e762 69
40b3a8c7 70 TObjArray *calSDD = (TObjArray *)ent->GetObject();
71 printf("Entries in array=%d\n",calSDD->GetEntriesFast());
72 TH1F* hmodstatus=new TH1F("hmodstatus","",260,0.5,260.5);
73 TH1F* hnbadch=new TH1F("hnbadch","",260,0.5,260.5);
74 TH1F* hbase=new TH1F("hbase","",60,0.5,120.5);
aa5cbbc5 75 TH2F* hbasemod=new TH2F("hbasemod","",260,239.5,499.5,50,0.,100.);
40b3a8c7 76 TH1F* hnoise=new TH1F("hnoise","",100,0.,7.);
aa5cbbc5 77 TH2F* hnoisemod=new TH2F("hnoisemod","",260,239.5,499.5,50,0.,10.);
40b3a8c7 78 TH1F* hgain=new TH1F("hgain","",100,0.,4.);
aa5cbbc5 79 TH2F* hgainmod=new TH2F("hgainmod","",260,239.5,499.5,50,0.,4.);
40b3a8c7 80 TH1F* hchstatus=new TH1F("hchstatus","",2,-0.5,1.5);
aa5cbbc5 81
131c4834 82 AliITSDDLModuleMapSDD* dmap=new AliITSDDLModuleMapSDD();
83 dmap->SetJun09Map();
84 TH2I *hddlcarlos=new TH2I("hddlcarlos","",24,-0.5,11.5,24,-0.5,23.5);
85 hddlcarlos->GetXaxis()->SetTitle("Module");
86 hddlcarlos->GetYaxis()->SetTitle("DDL");
87 hddlcarlos->GetXaxis()->SetTickLength(0);
88 hddlcarlos->GetYaxis()->SetTickLength(0);
89 hddlcarlos->SetStats(0);
90 hddlcarlos->SetMinimum(-1.);
aa5cbbc5 91
40b3a8c7 92 AliITSCalibrationSDD *cal;
b3ba5bd1 93 Int_t badModCounter3=0;
94 Int_t badModCounter4=0;
8b452ac7 95 Int_t badHybridCounter3=0;
96 Int_t badHybridCounter4=0;
b3ba5bd1 97 Int_t badAnodeCounter3=0;
98 Int_t badAnodeCounter4=0;
99 Int_t badAnodeCounterGoodMod3=0;
100 Int_t badAnodeCounterGoodMod4=0;
8b452ac7 101 Int_t badAnodeCounterGoodHybrid3=0;
102 Int_t badAnodeCounterGoodHybrid4=0;
b3ba5bd1 103 Int_t badAnodeCounterGoodModAndChip3=0;
104 Int_t badAnodeCounterGoodModAndChip4=0;
105 Int_t badChipCounter3=0;
106 Int_t badChipCounter4=0;
40b3a8c7 107 for(Int_t i=0; i<260; i++){
108 cal=(AliITSCalibrationSDD*)calSDD->At(i);
109 if(cal==0) continue;
110 printf("Module %d (%d) status = ",i,i+240);
3615e762 111 Int_t lay,lad,det;
112 AliITSgeomTGeo::GetModuleId(i+240,lay,lad,det);
296ee458 113 Int_t index=1+(det-1)*2;
131c4834 114 Int_t ddl,carlos;
115 dmap->FindInDDLMap(i+240,ddl,carlos);
116 Int_t index2=1+carlos*2;
117 ddl+=1;
b3ba5bd1 118 if(cal->IsBad()){
119 printf("BAD\t");
131c4834 120 hddlcarlos->SetBinContent(index2,ddl,0);
121 hddlcarlos->SetBinContent(index2+1,ddl,0);
3615e762 122 if(lay==3){
123 badModCounter3++;
8b452ac7 124 badHybridCounter3+=2;
296ee458 125 hlay3->SetBinContent(index,lad,0);
126 hlay3->SetBinContent(index+1,lad,0);
3615e762 127 }else if(lay==4){
128 badModCounter4++;
8b452ac7 129 badHybridCounter4+=2;
296ee458 130 hlay4->SetBinContent(index,lad,0);
131 hlay4->SetBinContent(index+1,lad,0);
3615e762 132 }
b3ba5bd1 133 hmodstatus->SetBinContent(i+1,0);
3615e762 134 }else{
b3ba5bd1 135 printf("OK\t");
136 hmodstatus->SetBinContent(i+1,1);
3615e762 137 if(lay==3){
138 badAnodeCounterGoodMod3+=cal->GetDeadChannels();
296ee458 139 if(cal->IsChipBad(0) && cal->IsChipBad(1) && cal->IsChipBad(2) && cal->IsChipBad(3)){
140 hlay3->SetBinContent(index,lad,0);
131c4834 141 hddlcarlos->SetBinContent(index2,ddl,0);
8b452ac7 142 badHybridCounter3++;
296ee458 143 }else{
144 hlay3->SetBinContent(index,lad,1);
131c4834 145 hddlcarlos->SetBinContent(index2,ddl,1);
8b452ac7 146 for(Int_t iAn=0; iAn<256; iAn++){
147 if(cal->IsBadChannel(iAn)) badAnodeCounterGoodHybrid3++;
148 }
296ee458 149 }
150 if(cal->IsChipBad(4) && cal->IsChipBad(5) && cal->IsChipBad(6) && cal->IsChipBad(7)){
151 hlay3->SetBinContent(index+1,lad,0);
131c4834 152 hddlcarlos->SetBinContent(index2+1,ddl,0);
8b452ac7 153 badHybridCounter3++;
296ee458 154 }else{
155 hlay3->SetBinContent(index+1,lad,1);
131c4834 156 hddlcarlos->SetBinContent(index2+1,ddl,1);
8b452ac7 157 for(Int_t iAn=256; iAn<512; iAn++){
158 if(cal->IsBadChannel(iAn)) badAnodeCounterGoodHybrid3++;
159 }
296ee458 160 }
3615e762 161 }else{
162 badAnodeCounterGoodMod4+=cal->GetDeadChannels();
296ee458 163 if(cal->IsChipBad(0) && cal->IsChipBad(1) && cal->IsChipBad(2) && cal->IsChipBad(3)){
164 hlay4->SetBinContent(index,lad,0);
131c4834 165 hddlcarlos->SetBinContent(index2,ddl,0);
8b452ac7 166 badHybridCounter4++;
296ee458 167 }else{
168 hlay4->SetBinContent(index,lad,1);
131c4834 169 hddlcarlos->SetBinContent(index2,ddl,1);
8b452ac7 170 for(Int_t iAn=0; iAn<256; iAn++){
171 if(cal->IsBadChannel(iAn)) badAnodeCounterGoodHybrid4++;
172 }
296ee458 173 }
174 if(cal->IsChipBad(4) && cal->IsChipBad(5) && cal->IsChipBad(6) && cal->IsChipBad(7)){
175 hlay4->SetBinContent(index+1,lad,0);
131c4834 176 hddlcarlos->SetBinContent(index2+1,ddl,0);
8b452ac7 177 badHybridCounter4++;
296ee458 178 }else{
179 hlay4->SetBinContent(index+1,lad,1);
131c4834 180 hddlcarlos->SetBinContent(index2+1,ddl,1);
8b452ac7 181 for(Int_t iAn=256; iAn<512; iAn++){
182 if(cal->IsBadChannel(iAn)) badAnodeCounterGoodHybrid4++;
183 }
296ee458 184 }
3615e762 185 }
8b452ac7 186 }
40b3a8c7 187 printf(" Chip Status (0=OK, 1=BAD): ");
b3ba5bd1 188 for(Int_t ic=0; ic<8;ic++){
189 printf("%d ",cal->IsChipBad(ic));
190 if(cal->IsChipBad(ic) && !cal->IsBad()){
191 if(i<84) badChipCounter3++;
192 else badChipCounter4++;
193 }
194 }
bc031ee2 195 printf(" # bad anodes = %d ",cal->GetDeadChannels());
40b3a8c7 196 if(cal->IsAMAt20MHz()) printf(" 20 MHz sampling");
197 else printf(" 40 MHz sampling");
aa5cbbc5 198 printf(" Threshold L %d %d H %d %d\n",cal->GetZSLowThreshold(0),cal->GetZSLowThreshold(1),cal->GetZSHighThreshold(0),cal->GetZSHighThreshold(1));
b3ba5bd1 199 if(i<84) badAnodeCounter3+=cal->GetDeadChannels();
200 else badAnodeCounter4+=cal->GetDeadChannels();
40b3a8c7 201 hnbadch->SetBinContent(i+1,cal->GetDeadChannels());
e34418c7 202 if(lay==3) hdeadlay3->SetBinContent(det,lad,cal->GetDeadChannels());
203 if(lay==4) hdeadlay4->SetBinContent(det,lad,cal->GetDeadChannels());
40b3a8c7 204 for(Int_t iAn=0; iAn<512; iAn++){
b3ba5bd1 205 Int_t ic=cal->GetChip(iAn);
206 if(!cal->IsChipBad(ic) && !cal->IsBad() && cal->IsBadChannel(iAn)){
207 if(i<84) badAnodeCounterGoodModAndChip3++;
208 else badAnodeCounterGoodModAndChip4++;
209 }
40b3a8c7 210 Float_t base=cal->GetBaseline(iAn);
211 Float_t noise=cal->GetNoiseAfterElectronics(iAn);
212 Float_t gain=cal->GetChannelGain(iAn);
213 if(cal->IsBadChannel(iAn)) hchstatus->Fill(0);
266a4b47 214 if(!cal->IsBadChannel(iAn) && !cal->IsChipBad(ic) && !cal->IsBad() ){
40b3a8c7 215 hbase->Fill(base);
aa5cbbc5 216 hbasemod->Fill(i+240,base);
40b3a8c7 217 hchstatus->Fill(1);
218 hnoise->Fill(noise);
aa5cbbc5 219 hnoisemod->Fill(i+240,noise);
40b3a8c7 220 hgain->Fill(gain);
aa5cbbc5 221 hgainmod->Fill(i+240,gain);
40b3a8c7 222 }
223 }
224 }
b3ba5bd1 225 Int_t totbad3=badModCounter3*512+badChipCounter3*64+badAnodeCounterGoodModAndChip3;
226 Int_t tot3=6*14*512;
227 Float_t fracbad3=(Float_t)totbad3/(Float_t)tot3;
aa5cbbc5 228 Float_t fracgm3=(Float_t)(84.-badModCounter3)/84.;
229 Float_t fracgm4=(Float_t)(176.-badModCounter4)/176.;
8b452ac7 230 Float_t fracgh3=(Float_t)(84.*2.-badHybridCounter3)/84./2.;
231 Float_t fracgh4=(Float_t)(176.*2-badHybridCounter4)/176./2.;
aa5cbbc5 232 Float_t fraccgm3=1.-(Float_t)(badAnodeCounterGoodModAndChip3+badChipCounter3*64)/(512.*(Float_t)(84.-badModCounter3));
233 Float_t fraccgm4=1.-(Float_t)(badAnodeCounterGoodModAndChip4+badChipCounter4*64)/(512.*(Float_t)(176.-badModCounter4));
8b452ac7 234 Float_t fraccgh3=1.-(Float_t)badAnodeCounterGoodHybrid3/(256.*(84.*2.-badHybridCounter3));
235 Float_t fraccgh4=1.-(Float_t)badAnodeCounterGoodHybrid4/(256.*(176.*2.-badHybridCounter4));
b3ba5bd1 236 Int_t totbad4=badModCounter4*512+badChipCounter4*64+badAnodeCounterGoodModAndChip4;
237 Int_t tot4=8*22*512;
238 Float_t fracbad4=(Float_t)totbad4/(Float_t)tot4;
239 Float_t fractot=(Float_t)(totbad3+totbad4)/(Float_t)(tot3+tot4);
240 printf("----------------------Summary----------------------\n");
241 printf("---- Layer 3 ----\n");
242 printf("# of bad modules = %d\n",badModCounter3);
243 printf("# of bad chips in good modules = %d\n",badChipCounter3);
8b452ac7 244 printf("# of bad hybrids = %d\n",badHybridCounter3);
245 printf("# of bad anodes in good hybrids = %d\n",badAnodeCounterGoodHybrid3);
aa5cbbc5 246 printf("Fraction of Good modules=%f\n",fracgm3);
8b452ac7 247 printf("Fraction of Good hybrids=%f\n",fracgh3);
248 printf("Fraction of good anodes in good modules = %f\n",fraccgm3);
249 printf("Fraction of good anodes in good hybrids = %f\n",fraccgh3);
250 printf("Fraction of bads (anodes+chips+mod) = %f\n",fracbad3);
b3ba5bd1 251 printf("---- Layer 4 ----\n");
252 printf("# of bad modules = %d\n",badModCounter4);
253 printf("# of bad chips in good modules = %d\n",badChipCounter4);
8b452ac7 254 printf("# of bad hybrids = %d\n",badHybridCounter4);
255 printf("# of bad anodes in good hybrids = %d\n",badAnodeCounterGoodHybrid4);
aa5cbbc5 256 printf("Fraction of Good modules=%f\n",fracgm4);
8b452ac7 257 printf("Fraction of Good hybrids=%f\n",fracgh4);
258 printf("Fraction of good anodes in good modules = %f\n",fraccgm4);
259 printf("Fraction of good anodes in good hybrids = %f\n",fraccgh4);
260 printf("Fraction of bads (anodes+chips+mod) = %f\n",fracbad4);
b3ba5bd1 261 printf("---- Total ----\n");
262 printf("# of bad modules = %d\n",badModCounter3+badModCounter4);
263 printf("# of bad chips in good modules = %d\n",badChipCounter3+badChipCounter4);
264 printf("# of bad anodes in good modules+chips = %d\n",badAnodeCounterGoodModAndChip3+badAnodeCounterGoodModAndChip4);
265 printf("Fraction of bads (anodes+chips+mod) = %f\n",fractot);
266 printf("---------------------------------------------------\n");
267
268
e34418c7 269 TLine* lin=new TLine(0,0,0,23);
270 TExec *ex1 = new TExec("ex1","MakePalette();");
271 TExec *ex2 = new TExec("ex2","gStyle->SetPalette(1);");
272
273 TCanvas* clay=new TCanvas("clay","Layer status",900,600);
274 clay->Divide(2,1);
275 clay->cd(1);
276 hlay3->Draw("col");
277 ex1->Draw();
278 hlay3->DrawCopy("col same");
279 for(Int_t i=0;i<6;i++){
280 lin->SetY1(-0.5);
281 lin->SetY2(13.5);
282 lin->SetX1(i+0.5);
283 lin->SetX2(i+0.5);
284 lin->DrawClone();
285 }
286 for(Int_t i=0;i<14;i++){
287 lin->SetX1(-0.5);
288 lin->SetX2(5.5);
289 lin->SetY1(i+0.5);
290 lin->SetY2(i+0.5);
291 lin->DrawClone();
292 }
293 clay->cd(2);
294 hlay4->DrawCopy("col");
295 for(Int_t i=0;i<8;i++){
296 lin->SetY1(-0.5);
297 lin->SetY2(21.5);
298 lin->SetX1(i+0.5);
299 lin->SetX2(i+0.5);
300 lin->DrawClone();
301 }
302 for(Int_t i=0;i<22;i++){
303 lin->SetX1(-0.5);
304 lin->SetX2(7.5);
305 lin->SetY1(i+0.5);
306 lin->SetY2(i+0.5);
307 lin->DrawClone();
308 }
309
e34418c7 310
131c4834 311 TCanvas* cddl=new TCanvas("cddl","DDL status",800,800);
312 hddlcarlos->Draw("col");
313 ex1->Draw();
314 hddlcarlos->DrawCopy("col same");
315 for(Int_t i=0;i<12;i++){
316 lin->SetY1(-0.5);
317 lin->SetY2(23.5);
318 lin->SetX1(i+0.5);
319 lin->SetX2(i+0.5);
320 lin->DrawClone();
321 }
322 for(Int_t i=0;i<24;i++){
323 lin->SetX1(-0.5);
324 lin->SetX2(11.5);
325 lin->SetY1(i+0.5);
326 lin->SetY2(i+0.5);
327 lin->DrawClone();
328 }
329
e34418c7 330
331 TCanvas *c0b=new TCanvas("c0b","Bad Channels",900,600);
332 c0b->Divide(2,1);
333 c0b->cd(1);
334 hdeadlay3->DrawCopy("colz");
335 ex2->Draw();
336 hdeadlay3->DrawCopy("colz same");
3615e762 337 for(Int_t i=0;i<6;i++){
338 lin->SetY1(-0.5);
339 lin->SetY2(13.5);
340 lin->SetX1(i+0.5);
341 lin->SetX2(i+0.5);
342 lin->DrawClone();
343 }
344 for(Int_t i=0;i<14;i++){
345 lin->SetX1(-0.5);
346 lin->SetX2(5.5);
347 lin->SetY1(i+0.5);
348 lin->SetY2(i+0.5);
349 lin->DrawClone();
350 }
e34418c7 351 c0b->cd(2);
352 hdeadlay4->DrawCopy("colz");
353 ex2->Draw();
354 hdeadlay4->DrawCopy("colz same");
3615e762 355 for(Int_t i=0;i<8;i++){
356 lin->SetY1(-0.5);
357 lin->SetY2(21.5);
358 lin->SetX1(i+0.5);
359 lin->SetX2(i+0.5);
360 lin->DrawClone();
361 }
362 for(Int_t i=0;i<22;i++){
363 lin->SetX1(-0.5);
364 lin->SetX2(7.5);
365 lin->SetY1(i+0.5);
366 lin->SetY2(i+0.5);
367 lin->DrawClone();
368 }
369
370
e34418c7 371
372 TCanvas *c1=new TCanvas("c1","Anode calibration",800,800);
373 c1->Divide(2,2);
374 c1->cd(1);
375 hbase->Draw();
376 hbase->GetXaxis()->SetTitle("Baseline after equalization");
377 hbase->GetXaxis()->CenterTitle();
378 c1->cd(2);
379 hnoise->Draw();
380 hnoise->GetXaxis()->SetTitle("Noise");
381 hnoise->GetXaxis()->CenterTitle();
382 c1->cd(3);
383 hgain->Draw();
384 hgain->GetXaxis()->SetTitle("Gain");
385 hgain->GetXaxis()->CenterTitle();
386 c1->cd(4);
387 hchstatus->Draw();
388 hchstatus->GetXaxis()->SetTitle("Anode status (0=bad, 1=OK)");
389 hchstatus->GetXaxis()->CenterTitle();
390
aa5cbbc5 391 TCanvas *c1m=new TCanvas("c1m","Calib. vs. mod",1000,800);
392 c1m->Divide(2,2);
393 c1m->cd(1);
394 gPad->SetRightMargin(0.14);
395 hbasemod->SetStats(0);
396 hbasemod->Draw("colz");
397 hbasemod->GetXaxis()->SetTitle("Module Number");
398 hbasemod->GetYaxis()->SetTitle("Baseline");
399 c1m->cd(2);
400 gPad->SetRightMargin(0.14);
401 hnoisemod->SetStats(0);
402 hnoisemod->Draw("colz");
403 hnoisemod->GetXaxis()->SetTitle("Module Number");
404 hnoisemod->GetYaxis()->SetTitle("Noise");
405 c1m->cd(3);
406 gPad->SetRightMargin(0.14);
407 hgainmod->SetStats(0);
408 hgainmod->Draw("colz");
409 hgainmod->GetXaxis()->SetTitle("Module Number");
410 hgainmod->GetYaxis()->SetTitle("Gain");
411 c1m->cd(4);
412 hnbadch->Scale(1/512.);
413 hnbadch->SetMarkerStyle(20);
414 hnbadch->SetMarkerSize(0.8);
415 hnbadch->SetStats(0);
416 hnbadch->Draw("P");
417 hnbadch->GetXaxis()->SetTitle("Module number");
418 hnbadch->GetYaxis()->SetTitle("Fraction of bad anodes");
e34418c7 419
420
421
422
423
424
40b3a8c7 425
b3ba5bd1 426
427 // Plot quantities for specified module
428
40b3a8c7 429 cal=(AliITSCalibrationSDD*)calSDD->At(iMod);
430 if(cal==0) return;
431 printf("-----------------------------------\n");
432 printf("Module %d status = ",iMod);
433 if(cal->IsBad()) printf("BAD\n");
434 else printf("OK\n");
435 printf(" Chip Status (0=OK, 1=BAD): ");
436 for(Int_t ic=0; ic<8;ic++) printf("%d ",cal->IsChipBad(ic));
437 printf("\n");
b3ba5bd1 438 printf(" Number of bad anodes =%d\n",cal->GetDeadChannels());
40b3a8c7 439 printf("-----------------------------------\n");
440 Int_t ipt=0;
441 TGraph *gbad=new TGraph(0);
442 gbad->SetTitle("Bad Channels");
443 TGraph *gbase=new TGraph(0);
444 gbase->SetTitle("Baselines");
445 TGraph *gnoi=new TGraph(0);
446 gnoi->SetTitle("Noise");
447 TGraph *ggain=new TGraph(0);
448 ggain->SetTitle("Gain");
449 for(Int_t iAn=0; iAn<512; iAn++){
450 Float_t bad=1;
451 if(cal->IsBadChannel(iAn)) bad=0;
452 Float_t base=cal->GetBaseline(iAn);
453 Float_t noise=cal->GetNoiseAfterElectronics(iAn);
454 Float_t gain=cal->GetChannelGain(iAn);
455 gbad->SetPoint(ipt,(Float_t)iAn,bad);
456 gbase->SetPoint(ipt,(Float_t)iAn,base);
457 ggain->SetPoint(ipt,(Float_t)iAn,gain);
458 gnoi->SetPoint(ipt,(Float_t)iAn,noise);
459 ipt++;
460 }
461 Char_t ctit[100];
462 sprintf(ctit,"Module %d",iMod);
463
464 TCanvas *c2=new TCanvas("c2",ctit,1200,800);
465 c2->Divide(2,2);
466
467 c2->cd(1);
468 gbase->SetMarkerStyle(7);
469 gbase->Draw("AP");
470 gbase->GetXaxis()->SetTitle("Anode Number");
471 gbase->GetYaxis()->SetTitle("Baseline after equalization");
472 c2->cd(2);
473 gnoi->SetMarkerStyle(7);
474 gnoi->Draw("AP");
475 gnoi->GetXaxis()->SetTitle("Anode Number");
476 gnoi->GetYaxis()->SetTitle("Noise");
477 c2->cd(3);
478 ggain->SetMarkerStyle(7);
479 ggain->Draw("AP");
480 ggain->GetXaxis()->SetTitle("Anode Number");
481 ggain->GetYaxis()->SetTitle("Gain");
482 c2->cd(4);
483 gbad->SetMarkerStyle(7);
484 gbad->Draw("AP");
485 gbad->SetMinimum(-0.1);
486 gbad->GetXaxis()->SetTitle("Anode Number");
487 gbad->GetYaxis()->SetTitle("Anode Status (1=OK, 0=bad)");
488}
489
a26920b9 490void ShowCalibrationSDD(Int_t nrun, Int_t year=2012, Int_t nmod=0){
40b3a8c7 491 TGrid::Connect("alien:",0,0,"t");
551eb942 492 TString cmd=Form("gbbox find \"/alice/data/%d/OCDB/ITS/Calib/CalibSDD\" \"Run%d*.root\" > run.txt",year,nrun);
493 gSystem->Exec(cmd.Data());
494 Char_t filnam[200],filnamalien[200];
495 FILE* runtxt=fopen("run.txt","r");
496 fscanf(runtxt,"%s\n",filnam);
497 if(!strstr(filnam,"/alice/data/")){
498 printf("Bad run number\n");
499 gSystem->Exec("rm run.txt");
500 return;
501 }
502 sprintf(filnamalien,"alien://%s",filnam);
503
504 printf("Open file: %s\n",filnamalien);
505 ShowCalibrationSDD(filnamalien,nmod);
506 fclose(runtxt);
507 gSystem->Exec("rm run.txt");
40b3a8c7 508}