1 #if !defined(__CINT__) || defined(__MAKECINT__)
9 #include "AliCDBEntry.h"
10 #include "AliITSCalibrationSDD.h"
13 // Macro to plot the calibration parameters from the OCDB file
14 // created from PEDESTAL and PULSER runs (OCDB/ITS/Calib/CalibSDD)
15 // Two methods ShowCalibrationSDD:
16 // - the first takes the name of the file to be displayed
17 // - the second builds the alien path+name from run number and file version
19 // Origin: F. Prino (prino@to.infn.it)
21 void ShowCalibrationSDD(Int_t iMod=0, Char_t *filnam="$ALICE_ROOT/ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root"){
24 TFile *f=TFile::Open(filnam);
25 AliCDBEntry *ent=(AliCDBEntry*)f->Get("AliCDBEntry");
26 TObjArray *calSDD = (TObjArray *)ent->GetObject();
27 printf("Entries in array=%d\n",calSDD->GetEntriesFast());
28 TH1F* hmodstatus=new TH1F("hmodstatus","",260,0.5,260.5);
29 TH1F* hnbadch=new TH1F("hnbadch","",260,0.5,260.5);
30 TH1F* hbase=new TH1F("hbase","",60,0.5,120.5);
31 TH1F* hnoise=new TH1F("hnoise","",100,0.,7.);
32 TH1F* hgain=new TH1F("hgain","",100,0.,4.);
33 TH1F* hchstatus=new TH1F("hchstatus","",2,-0.5,1.5);
34 AliITSCalibrationSDD *cal;
35 Int_t badModCounter3=0;
36 Int_t badModCounter4=0;
37 Int_t badAnodeCounter3=0;
38 Int_t badAnodeCounter4=0;
39 Int_t badAnodeCounterGoodMod3=0;
40 Int_t badAnodeCounterGoodMod4=0;
41 Int_t badAnodeCounterGoodModAndChip3=0;
42 Int_t badAnodeCounterGoodModAndChip4=0;
43 Int_t badChipCounter3=0;
44 Int_t badChipCounter4=0;
45 for(Int_t i=0; i<260; i++){
46 cal=(AliITSCalibrationSDD*)calSDD->At(i);
48 printf("Module %d (%d) status = ",i,i+240);
51 if(i<84) badModCounter3++;
52 else badModCounter4++;
53 hmodstatus->SetBinContent(i+1,0);
57 hmodstatus->SetBinContent(i+1,1);
58 if(i<84) badAnodeCounterGoodMod3+=cal->GetDeadChannels();
59 else badAnodeCounterGoodMod4+=cal->GetDeadChannels();
61 printf(" Chip Status (0=OK, 1=BAD): ");
62 for(Int_t ic=0; ic<8;ic++){
63 printf("%d ",cal->IsChipBad(ic));
64 if(cal->IsChipBad(ic) && !cal->IsBad()){
65 if(i<84) badChipCounter3++;
66 else badChipCounter4++;
69 if(cal->IsAMAt20MHz()) printf(" 20 MHz sampling");
70 else printf(" 40 MHz sampling");
72 if(i<84) badAnodeCounter3+=cal->GetDeadChannels();
73 else badAnodeCounter4+=cal->GetDeadChannels();
74 hnbadch->SetBinContent(i+1,cal->GetDeadChannels());
75 for(Int_t iAn=0; iAn<512; iAn++){
76 Int_t ic=cal->GetChip(iAn);
77 if(!cal->IsChipBad(ic) && !cal->IsBad() && cal->IsBadChannel(iAn)){
78 if(i<84) badAnodeCounterGoodModAndChip3++;
79 else badAnodeCounterGoodModAndChip4++;
81 Float_t base=cal->GetBaseline(iAn);
82 Float_t noise=cal->GetNoiseAfterElectronics(iAn);
83 Float_t gain=cal->GetChannelGain(iAn);
84 if(cal->IsBadChannel(iAn)) hchstatus->Fill(0);
85 if(!cal->IsBadChannel(iAn)){
93 Int_t totbad3=badModCounter3*512+badChipCounter3*64+badAnodeCounterGoodModAndChip3;
95 Float_t fracbad3=(Float_t)totbad3/(Float_t)tot3;
96 Int_t totbad4=badModCounter4*512+badChipCounter4*64+badAnodeCounterGoodModAndChip4;
98 Float_t fracbad4=(Float_t)totbad4/(Float_t)tot4;
99 Float_t fractot=(Float_t)(totbad3+totbad4)/(Float_t)(tot3+tot4);
100 printf("----------------------Summary----------------------\n");
101 printf("---- Layer 3 ----\n");
102 printf("# of bad modules = %d\n",badModCounter3);
103 printf("# of bad chips in good modules = %d\n",badChipCounter3);
104 printf("# of bad anodes in good modules+chips = %d\n",badAnodeCounterGoodModAndChip3);
105 printf("Fraction of bads (anodes+chips+mod) = %f\n",fracbad3);
106 printf("---- Layer 4 ----\n");
107 printf("# of bad modules = %d\n",badModCounter4);
108 printf("# of bad chips in good modules = %d\n",badChipCounter4);
109 printf("# of bad anodes in good modules+chips = %d\n",badAnodeCounterGoodModAndChip4);
110 printf("Fraction of bads (anodes+chips+mod) = %f\n",fracbad4);
111 printf("---- Total ----\n");
112 printf("# of bad modules = %d\n",badModCounter3+badModCounter4);
113 printf("# of bad chips in good modules = %d\n",badChipCounter3+badChipCounter4);
114 printf("# of bad anodes in good modules+chips = %d\n",badAnodeCounterGoodModAndChip3+badAnodeCounterGoodModAndChip4);
115 printf("Fraction of bads (anodes+chips+mod) = %f\n",fractot);
116 printf("---------------------------------------------------\n");
119 TCanvas *c0=new TCanvas("c0","Module status",800,800);
123 hmodstatus->GetXaxis()->SetTitle("Module number");
124 hmodstatus->GetYaxis()->SetTitle("Module status (1=OK, 0=BAD)");
127 hnbadch->GetXaxis()->SetTitle("Module number");
128 hnbadch->GetYaxis()->SetTitle("Number of bad anodes");
130 TCanvas *c1=new TCanvas("c1","Anode calibration",800,800);
134 hbase->GetXaxis()->SetTitle("Baseline after equalization");
135 hbase->GetXaxis()->CenterTitle();
138 hnoise->GetXaxis()->SetTitle("Noise");
139 hnoise->GetXaxis()->CenterTitle();
142 hgain->GetXaxis()->SetTitle("Gain");
143 hgain->GetXaxis()->CenterTitle();
146 hchstatus->GetXaxis()->SetTitle("Anode status (0=bad, 1=OK)");
147 hchstatus->GetXaxis()->CenterTitle();
150 // Plot quantities for specified module
152 cal=(AliITSCalibrationSDD*)calSDD->At(iMod);
154 printf("-----------------------------------\n");
155 printf("Module %d status = ",iMod);
156 if(cal->IsBad()) printf("BAD\n");
158 printf(" Chip Status (0=OK, 1=BAD): ");
159 for(Int_t ic=0; ic<8;ic++) printf("%d ",cal->IsChipBad(ic));
161 printf(" Number of bad anodes =%d\n",cal->GetDeadChannels());
162 printf("-----------------------------------\n");
164 TGraph *gbad=new TGraph(0);
165 gbad->SetTitle("Bad Channels");
166 TGraph *gbase=new TGraph(0);
167 gbase->SetTitle("Baselines");
168 TGraph *gnoi=new TGraph(0);
169 gnoi->SetTitle("Noise");
170 TGraph *ggain=new TGraph(0);
171 ggain->SetTitle("Gain");
172 for(Int_t iAn=0; iAn<512; iAn++){
174 if(cal->IsBadChannel(iAn)) bad=0;
175 Float_t base=cal->GetBaseline(iAn);
176 Float_t noise=cal->GetNoiseAfterElectronics(iAn);
177 Float_t gain=cal->GetChannelGain(iAn);
178 gbad->SetPoint(ipt,(Float_t)iAn,bad);
179 gbase->SetPoint(ipt,(Float_t)iAn,base);
180 ggain->SetPoint(ipt,(Float_t)iAn,gain);
181 gnoi->SetPoint(ipt,(Float_t)iAn,noise);
185 sprintf(ctit,"Module %d",iMod);
187 TCanvas *c2=new TCanvas("c2",ctit,1200,800);
191 gbase->SetMarkerStyle(7);
193 gbase->GetXaxis()->SetTitle("Anode Number");
194 gbase->GetYaxis()->SetTitle("Baseline after equalization");
196 gnoi->SetMarkerStyle(7);
198 gnoi->GetXaxis()->SetTitle("Anode Number");
199 gnoi->GetYaxis()->SetTitle("Noise");
201 ggain->SetMarkerStyle(7);
203 ggain->GetXaxis()->SetTitle("Anode Number");
204 ggain->GetYaxis()->SetTitle("Gain");
206 gbad->SetMarkerStyle(7);
208 gbad->SetMinimum(-0.1);
209 gbad->GetXaxis()->SetTitle("Anode Number");
210 gbad->GetYaxis()->SetTitle("Anode Status (1=OK, 0=bad)");
213 void ShowCalibrationSDD(Int_t nrun, Int_t nv, Char_t* dir="LHC08d", Int_t nmod=0){
214 TGrid::Connect("alien:",0,0,"t");
216 sprintf(filnam,"alien:///alice/data/2008/%s/OCDB/ITS/Calib/CalibSDD/Run%d_999999999_v%d_s0.root",dir,nrun,nv);
217 printf("Open file: %s\n",filnam);
218 ShowCalibrationSDD(nmod,filnam);