]>
Commit | Line | Data |
---|---|---|
40b3a8c7 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TFile.h> | |
3 | #include <TH1F.h> | |
4 | #include <TGraph.h> | |
5 | #include <TStyle.h> | |
551eb942 | 6 | #include <TSystem.h> |
7 | #include <TString.h> | |
40b3a8c7 | 8 | #include <TGrid.h> |
9 | #include <TCanvas.h> | |
10 | #include <TLatex.h> | |
11 | #include <TObjArray.h> | |
12 | #include "AliCDBEntry.h" | |
13 | #include "AliITSDriftSpeedArraySDD.h" | |
14 | #endif | |
15 | ||
16 | // Macro to plot the calibration parameters from the OCDB file | |
17 | // created from an INJECTOR run (OCDB/ITS/Calib/DriftSpeedSDD) | |
18 | // Two methods ShowDriftSpeedSDD: | |
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 | ||
b70dd7af | 24 | Bool_t kNoDraw = kFALSE; // set to kTRUE to eliminate module dependent plots |
25 | ||
26 | void ShowDriftSpeedSDD(Char_t filnam[150]="$ALICE_ROOT/ITS/Calib/DriftSpeedSDD/Run0_9999999_v0_s0.root", Int_t firstmod=0, Int_t lastmod=260,Int_t nrun=0){ | |
40b3a8c7 | 27 | TFile *f= TFile::Open(filnam); |
28 | AliCDBEntry *ent=(AliCDBEntry*)f->Get("AliCDBEntry"); | |
29 | TObjArray *drspSDD = (TObjArray *)ent->GetObject(); | |
30 | AliITSDriftSpeedArraySDD *vdriftarr0; | |
31 | AliITSDriftSpeedArraySDD *vdriftarr1; | |
32 | TGraph **gvdr0=new TGraph*[260]; | |
33 | TGraph **gvdr1=new TGraph*[260]; | |
b70dd7af | 34 | TCanvas *c0=NULL; |
35 | if(!kNoDraw)c0=new TCanvas("c0","Module Drift Speed",1100,500); | |
40b3a8c7 | 36 | |
37 | TGraph *vvsmod0=new TGraph(0); | |
38 | TGraph *vvsmod1=new TGraph(0); | |
915c0469 | 39 | TGraph *poldegvsmod0=new TGraph(0); |
40 | TGraph *poldegvsmod1=new TGraph(0); | |
41 | TGraph *anmaxvsmod0=new TGraph(0); | |
42 | TGraph *anmaxvsmod1=new TGraph(0); | |
43 | TGraph *dvcevsmod0=new TGraph(0); | |
44 | TGraph *dvcevsmod1=new TGraph(0); | |
45 | TGraph *dveevsmod0=new TGraph(0); | |
46 | TGraph *dveevsmod1=new TGraph(0); | |
47 | ||
b70dd7af | 48 | char tit0[100]; |
49 | sprintf(tit0,"Drift Speed vs. mod. number"); | |
50 | if(nrun!=0)sprintf(tit0,"Drift Speed vs. mod. number - Run %d",nrun); | |
51 | vvsmod0->SetTitle(tit0); | |
52 | vvsmod1->SetTitle(tit0); | |
915c0469 | 53 | |
54 | sprintf(tit0,"Degree of poly fit vs. mod. number"); | |
55 | if(nrun!=0)sprintf(tit0,"Degree of poly fit vs. mod. number - Run %d",nrun); | |
56 | poldegvsmod0->SetTitle(tit0); | |
57 | poldegvsmod1->SetTitle(tit0); | |
58 | ||
59 | sprintf(tit0,"Anode with max. vdrift vs. mod. number"); | |
60 | if(nrun!=0)sprintf(tit0,"Anode with max. vdrift vs. mod. number - Run %d",nrun); | |
61 | anmaxvsmod0->SetTitle(tit0); | |
62 | anmaxvsmod1->SetTitle(tit0); | |
63 | ||
64 | sprintf(tit0,"Delta Vdrift 128-0 vs. mod. number"); | |
65 | if(nrun!=0)sprintf(tit0,"Delta Vdrift 128-0 vs. mod. number - Run %d",nrun); | |
66 | dvcevsmod0->SetTitle(tit0); | |
67 | dvcevsmod1->SetTitle(tit0); | |
68 | ||
69 | sprintf(tit0,"Delta Vdrift 256-0 vs. mod. number"); | |
70 | if(nrun!=0)sprintf(tit0,"Delta Vdrift 256-0 vs. mod. number - Run %d",nrun); | |
71 | dveevsmod0->SetTitle(tit0); | |
72 | dveevsmod1->SetTitle(tit0); | |
73 | ||
74 | TF1* fPoly=new TF1("fPoly","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.,256.); | |
40b3a8c7 | 75 | Char_t tit[100]; |
915c0469 | 76 | Int_t iGoodInj=0; |
77 | Int_t iAverSpeed=0; | |
40b3a8c7 | 78 | for(Int_t i=firstmod; i<lastmod; i++){ |
266a4b47 | 79 | Int_t iMod=i+240; |
b70dd7af | 80 | if(!kNoDraw){ |
b70dd7af | 81 | } |
40b3a8c7 | 82 | Int_t i0=2*i; |
83 | Int_t i1=1+2*i; | |
84 | vdriftarr0=(AliITSDriftSpeedArraySDD*)drspSDD->At(i0); | |
85 | vdriftarr1=(AliITSDriftSpeedArraySDD*)drspSDD->At(i1); | |
915c0469 | 86 | AliITSDriftSpeedSDD* vdrift0=0x0; |
87 | if(vdriftarr0) vdrift0=vdriftarr0->GetDriftSpeedObject(0); | |
88 | AliITSDriftSpeedSDD* vdrift1=0x0; | |
89 | if(vdriftarr1) vdrift1=vdriftarr1->GetDriftSpeedObject(0); | |
90 | ||
40b3a8c7 | 91 | gvdr0[i]=new TGraph(0); |
92 | gvdr1[i]=new TGraph(0); | |
93 | gvdr0[i]->SetMarkerStyle(7); | |
94 | gvdr1[i]->SetMarkerStyle(7); | |
95 | gvdr0[i]->SetMinimum(5.); | |
96 | gvdr1[i]->SetMinimum(5.); | |
97 | gvdr0[i]->SetMaximum(9.); | |
98 | gvdr1[i]->SetMaximum(9.); | |
266a4b47 | 99 | sprintf(tit,"Mod %d\n",iMod); |
40b3a8c7 | 100 | gvdr0[i]->SetTitle(tit); |
101 | gvdr1[i]->SetTitle(tit); | |
102 | ||
103 | for(Int_t iAn=0; iAn<256; iAn++){ | |
104 | Float_t vel0=0; | |
915c0469 | 105 | if(vdrift0) vel0=vdrift0->GetDriftSpeedAtAnode(iAn); |
40b3a8c7 | 106 | Float_t vel1=0; |
915c0469 | 107 | if(vdrift1) vel1=vdrift1->GetDriftSpeedAtAnode(iAn); |
40b3a8c7 | 108 | gvdr0[i]->SetPoint(iAn,(Float_t)iAn,vel0); |
109 | gvdr1[i]->SetPoint(iAn,(Float_t)iAn,vel1); | |
110 | } | |
915c0469 | 111 | if(vdriftarr0->GetInjectorStatus()>0) iGoodInj++; |
112 | else iAverSpeed++; | |
113 | if(vdriftarr1->GetInjectorStatus()>0) iGoodInj++; | |
114 | else iAverSpeed++; | |
115 | ||
50d25e98 | 116 | printf(" Mod. %d \tStatusLR=%X %X \t v(an 128l)= %f",iMod,vdriftarr0->GetInjectorStatus(),vdriftarr1->GetInjectorStatus(),vdriftarr0->GetDriftSpeed(0,128)); |
915c0469 | 117 | printf(" \t v(an 128r)= %f Degree=%d %d\n",vdriftarr1->GetDriftSpeed(0,128),vdrift0->GetDegreeofPoly(),vdrift1->GetDegreeofPoly()); |
118 | c0->Clear(); | |
119 | c0->Divide(2,1); | |
120 | c0->cd(1); | |
121 | gvdr0[i]->Draw("AP"); | |
122 | gvdr0[i]->GetXaxis()->SetTitle("Anode"); | |
123 | gvdr0[i]->GetYaxis()->SetTitle("Vdrift (#mum/ns)"); | |
124 | c0->cd(2); | |
125 | gvdr1[i]->Draw("AP"); | |
126 | gvdr1[i]->GetXaxis()->SetTitle("Anode"); | |
127 | gvdr1[i]->GetYaxis()->SetTitle("Vdrift (#mum/ns)"); | |
128 | c0->Update(); | |
129 | ||
40b3a8c7 | 130 | Float_t vel0=0; |
915c0469 | 131 | Float_t pd0=0; |
132 | if(vdrift0){ | |
133 | vel0=vdrift0->GetDriftSpeedAtAnode(128); | |
134 | pd0=vdrift0->GetDegreeofPoly(); | |
135 | } | |
40b3a8c7 | 136 | Float_t vel1=0; |
915c0469 | 137 | Float_t pd1=0; |
138 | if(vdrift1){ | |
139 | vel1=vdrift1->GetDriftSpeedAtAnode(128); | |
140 | pd1=vdrift1->GetDegreeofPoly(); | |
141 | } | |
266a4b47 | 142 | vvsmod0->SetPoint(vvsmod0->GetN(),(Float_t)iMod,vel0); |
143 | vvsmod1->SetPoint(vvsmod1->GetN(),(Float_t)iMod,vel1); | |
915c0469 | 144 | poldegvsmod0->SetPoint(poldegvsmod0->GetN(),(Float_t)iMod,pd0); |
145 | poldegvsmod1->SetPoint(poldegvsmod1->GetN(),(Float_t)iMod,pd1); | |
146 | ||
147 | for(Int_t ipar=0; ipar<=vdrift0->GetDegreeofPoly(); ipar++){ | |
148 | fPoly->SetParameter(ipar,vdrift0->GetDriftSpeedParameter(ipar)); | |
149 | } | |
150 | if(vdrift0->GetDegreeofPoly()<3){ | |
151 | for(Int_t ipar=vdrift0->GetDegreeofPoly()+1; ipar<=3; ipar++) fPoly->SetParameter(ipar,0.); | |
152 | } | |
153 | ||
154 | anmaxvsmod0->SetPoint(anmaxvsmod0->GetN(),(Float_t)iMod,fPoly->GetMaximumX(0.,256.)); | |
155 | dvcevsmod0->SetPoint(dvcevsmod0->GetN(),(Float_t)iMod,fPoly->Eval(128)-fPoly->Eval(0)); | |
156 | dveevsmod0->SetPoint(dveevsmod0->GetN(),(Float_t)iMod,fPoly->Eval(256)-fPoly->Eval(0)); | |
40b3a8c7 | 157 | |
915c0469 | 158 | for(Int_t ipar=0; ipar<=vdrift1->GetDegreeofPoly(); ipar++){ |
159 | fPoly->SetParameter(ipar,vdrift1->GetDriftSpeedParameter(ipar)); | |
160 | } | |
161 | if(vdrift1->GetDegreeofPoly()<3){ | |
162 | for(Int_t ipar=vdrift1->GetDegreeofPoly()+1; ipar<=3; ipar++) fPoly->SetParameter(ipar,0.); | |
163 | } | |
164 | anmaxvsmod1->SetPoint(anmaxvsmod1->GetN(),(Float_t)iMod,fPoly->GetMaximumX(0.,256.)); | |
165 | dvcevsmod1->SetPoint(dvcevsmod1->GetN(),(Float_t)iMod,fPoly->Eval(128)-fPoly->Eval(0)); | |
166 | dveevsmod1->SetPoint(dveevsmod1->GetN(),(Float_t)iMod,fPoly->Eval(256)-fPoly->Eval(0)); | |
40b3a8c7 | 167 | // getchar(); |
168 | } | |
915c0469 | 169 | |
170 | printf("Number of half-modules with drift speed from injectors = %d\n",iGoodInj); | |
171 | printf("Number of half-modules with average drift speed = %d\n",iAverSpeed); | |
172 | ||
40b3a8c7 | 173 | TCanvas* c2; |
174 | c2=new TCanvas("c2","",1000,700); | |
175 | vvsmod0->SetMarkerStyle(20); | |
176 | vvsmod0->Draw("AP"); | |
177 | vvsmod0->GetXaxis()->SetTitle("Module Number"); | |
178 | vvsmod0->GetYaxis()->SetTitle("Vdrift (#mum/ns)"); | |
179 | vvsmod1->SetMarkerStyle(21); | |
180 | vvsmod1->SetMarkerColor(2); | |
181 | vvsmod1->Draw("SAMEP"); | |
b70dd7af | 182 | TLatex* tleft=new TLatex(0.2,0.82,"Side 0"); |
40b3a8c7 | 183 | tleft->SetNDC(); |
184 | tleft->SetTextColor(1); | |
185 | tleft->Draw(); | |
b70dd7af | 186 | TLatex* tright=new TLatex(0.2,0.75,"Side 1"); |
40b3a8c7 | 187 | tright->SetNDC(); |
188 | tright->SetTextColor(2); | |
189 | tright->Draw(); | |
190 | ||
915c0469 | 191 | TCanvas* c3; |
192 | c3=new TCanvas("c3","",900,900); | |
193 | c3->Divide(2,2); | |
194 | ||
195 | c3->cd(1); | |
196 | gPad->SetLeftMargin(0.14); | |
197 | poldegvsmod0->SetMarkerStyle(20); | |
198 | poldegvsmod0->Draw("AP"); | |
199 | poldegvsmod0->GetXaxis()->SetTitle("Module Number"); | |
200 | poldegvsmod0->GetYaxis()->SetTitle("Degree of Polynomial fit"); | |
201 | poldegvsmod0->GetYaxis()->SetTitleOffset(1.4); | |
202 | poldegvsmod1->SetMarkerStyle(21); | |
203 | poldegvsmod1->SetMarkerColor(2); | |
204 | poldegvsmod1->Draw("SAMEP"); | |
205 | tleft->Draw(); | |
206 | tright->Draw(); | |
207 | c3->cd(2); | |
208 | gPad->SetLeftMargin(0.14); | |
209 | anmaxvsmod0->SetMarkerStyle(20); | |
210 | anmaxvsmod0->Draw("AP"); | |
211 | anmaxvsmod0->GetXaxis()->SetTitle("Module Number"); | |
212 | anmaxvsmod0->GetYaxis()->SetTitle("Anode with max. drift speed"); | |
213 | anmaxvsmod0->GetYaxis()->SetTitleOffset(1.4); | |
214 | anmaxvsmod1->SetMarkerStyle(21); | |
215 | anmaxvsmod1->SetMarkerColor(2); | |
216 | anmaxvsmod1->Draw("SAMEP"); | |
217 | tleft->Draw(); | |
218 | tright->Draw(); | |
219 | c3->cd(3); | |
220 | gPad->SetLeftMargin(0.14); | |
221 | dvcevsmod0->SetMarkerStyle(20); | |
222 | dvcevsmod0->Draw("AP"); | |
223 | dvcevsmod0->GetXaxis()->SetTitle("Module Number"); | |
224 | dvcevsmod0->GetYaxis()->SetTitle("vdrift(anode128)-vdrift(anode0)"); | |
225 | dvcevsmod0->GetYaxis()->SetTitleOffset(1.4); | |
226 | dvcevsmod1->SetMarkerStyle(21); | |
227 | dvcevsmod1->SetMarkerColor(2); | |
228 | dvcevsmod1->Draw("SAMEP"); | |
229 | tleft->Draw(); | |
230 | tright->Draw(); | |
231 | c3->cd(4); | |
232 | gPad->SetLeftMargin(0.14); | |
233 | dveevsmod0->SetMarkerStyle(20); | |
234 | dveevsmod0->Draw("AP"); | |
235 | dveevsmod0->GetYaxis()->SetTitleOffset(1.4); | |
236 | dveevsmod0->GetXaxis()->SetTitle("Module Number"); | |
237 | dveevsmod0->GetYaxis()->SetTitle("vdrift(anode256)-vdrift(anode0)"); | |
238 | dveevsmod1->SetMarkerStyle(21); | |
239 | dveevsmod1->SetMarkerColor(2); | |
240 | dveevsmod1->Draw("SAMEP"); | |
241 | tleft->Draw(); | |
242 | tright->Draw(); | |
243 | ||
244 | ||
40b3a8c7 | 245 | } |
246 | ||
247 | ||
248 | ||
551eb942 | 249 | void ShowDriftSpeedSDD(Int_t nrun, Int_t year=2009){ |
40b3a8c7 | 250 | TGrid::Connect("alien:",0,0,"t"); |
551eb942 | 251 | TString cmd=Form("gbbox find \"/alice/data/%d/OCDB/ITS/Calib/DriftSpeedSDD\" \"Run%d*.root\" > run.txt",year,nrun); |
252 | gSystem->Exec(cmd.Data()); | |
253 | ||
254 | Char_t filnam[200],filnamalien[200]; | |
255 | FILE* runtxt=fopen("run.txt","r"); | |
256 | fscanf(runtxt,"%s\n",filnam); | |
257 | if(!strstr(filnam,"/alice/data/")){ | |
258 | printf("Bad run number\n"); | |
259 | gSystem->Exec("rm run.txt"); | |
260 | return; | |
261 | } | |
262 | sprintf(filnamalien,"alien://%s",filnam); | |
263 | ||
264 | printf("Open file: %s\n",filnamalien); | |
b70dd7af | 265 | ShowDriftSpeedSDD(filnamalien,0,260,nrun); |
551eb942 | 266 | fclose(runtxt); |
267 | gSystem->Exec("rm run.txt"); | |
268 | ||
40b3a8c7 | 269 | } |