Change of module numbers for display purposes
[u/mrichter/AliRoot.git] / ITS / macrosSDD / PlotDriftSpeedSDDVsTime.C
CommitLineData
8d024204 1#if !defined(__CINT__) || defined(__MAKECINT__)
78018435 2#include <Riostream.h>
8d024204 3#include <TFile.h>
4#include <TH1F.h>
de18f32b 5#include <TH2F.h>
8d024204 6#include <TGraph.h>
7#include <TStyle.h>
8#include <TLegend.h>
9#include <TLegendEntry.h>
de18f32b 10#include <TLine.h>
8d024204 11#include <TSystem.h>
12#include <TGrid.h>
13#include <TMath.h>
14#include <TGraphErrors.h>
15#include <TCanvas.h>
16#include <TLatex.h>
17#include <TObjArray.h>
18#include "AliCDBEntry.h"
19#include "AliITSDriftSpeedArraySDD.h"
20#include "AliITSgeomTGeo.h"
21#endif
22
e8eba358 23/* $Id: PlotDriftSpeedSDDVsTime.C 41510 2010-06-01 09:21:24Z prino $ */
8d024204 24
25
26// Macro to plot the drift speed vs. time from the OCDB files
27// created from INJECTOR runs (OCDB/ITS/Calib/DriftSpeedSDD)
28// Origin: F. Prino (prino@to.infn.it)
29
30void FillErrors(Float_t errSpeed[260]);
31
4d8feb56 32void PlotDriftSpeedSDDVsTime(Int_t year=2011, Int_t firstRun=142600,
78018435 33 Int_t lastRun=999999999,
8d024204 34 Int_t anode=128){
8d024204 35 TGrid::Connect("alien:",0,0,"t");
8d024204 36 Float_t errSpeed[260];
37 FillErrors(errSpeed);
63c8701c 38 Int_t iAn=anode;
39 if(anode>256) iAn=anode-256;
40
78018435 41 TString cmd=Form("gbbox find \"/alice/data/%d/OCDB/ITS/Calib/DriftSpeedSDD\" \"Run*.root\" > runSpeedAlien.txt",year);
42 gSystem->Exec(cmd.Data());
8d024204 43 FILE* listruns=fopen("runSpeedAlien.txt","r");
44 Char_t filnam[200],filnamalien[200];
45 TGraphErrors** gvdrvstime=new TGraphErrors*[520];
46 TGraphErrors** gvdrvsrun=new TGraphErrors*[520];
63c8701c 47 TGraphErrors** gstatusinjvstime=new TGraphErrors*[520];
48 TGraphErrors** gstatusinjvsrun=new TGraphErrors*[520];
49
50
55d5b638 51 TGraph* gGoodInjVsRun=new TGraph(0);
52 gGoodInjVsRun->SetName("gGoodInjVsRun");
53 TGraph* gAverSpeedVsRun=new TGraph(0);
54 gAverSpeedVsRun->SetName("gAverSpeedVsRun");
55 TGraph* gGoodInjVsTime=new TGraph(0);
56 gGoodInjVsTime->SetName("gGoodInjVsTime");
57 TGraph* gAverSpeedVsTime=new TGraph(0);
58 gAverSpeedVsTime->SetName("gAverSpeedVsIime");
e9ef0fc2 59
60 TGraph* gGoodInjVsRunL3=new TGraph(0);
61 gGoodInjVsRunL3->SetName("gGoodInjVsRunL3");
62 TGraph* gAverSpeedVsRunL3=new TGraph(0);
63 gAverSpeedVsRunL3->SetName("gAverSpeedVsRunL3");
64 TGraph* gGoodInjVsTimeL3=new TGraph(0);
65 gGoodInjVsTimeL3->SetName("gGoodInjVsTimeL3");
66 TGraph* gAverSpeedVsTimeL3=new TGraph(0);
67 gAverSpeedVsTimeL3->SetName("gAverSpeedVsIimeL3");
68
69 TGraph* gGoodInjVsRunL4=new TGraph(0);
70 gGoodInjVsRunL4->SetName("gGoodInjVsRunL4");
71 TGraph* gAverSpeedVsRunL4=new TGraph(0);
72 gAverSpeedVsRunL4->SetName("gAverSpeedVsRunL4");
73 TGraph* gGoodInjVsTimeL4=new TGraph(0);
74 gGoodInjVsTimeL4->SetName("gGoodInjVsTimeL4");
75 TGraph* gAverSpeedVsTimeL4=new TGraph(0);
76 gAverSpeedVsTimeL4->SetName("gAverSpeedVsIimeL4");
77
78 TGraph* gFracGoodInjVsRun=new TGraph(0);
79 gFracGoodInjVsRun->SetName("gFracGoodInjVsRun");
80 TGraph* gFracAverSpeedVsRun=new TGraph(0);
81 gFracAverSpeedVsRun->SetName("gFracAverSpeedVsRun");
82 TGraph* gFracGoodInjVsTime=new TGraph(0);
83 gFracGoodInjVsTime->SetName("gFracGoodInjVsTime");
84 TGraph* gFracAverSpeedVsTime=new TGraph(0);
85 gFracAverSpeedVsTime->SetName("gAverSpeedVsIime");
86
87 TGraph* gFracGoodInjVsRunL3=new TGraph(0);
88 gFracGoodInjVsRunL3->SetName("gFracGoodInjVsRunL3");
89 TGraph* gFracAverSpeedVsRunL3=new TGraph(0);
90 gFracAverSpeedVsRunL3->SetName("gFracAverSpeedVsRunL3");
91 TGraph* gFracGoodInjVsTimeL3=new TGraph(0);
92 gFracGoodInjVsTimeL3->SetName("gFracGoodInjVsTimeL3");
93 TGraph* gFracAverSpeedVsTimeL3=new TGraph(0);
94 gFracAverSpeedVsTimeL3->SetName("gFracAverSpeedVsIimeL3");
95
96 TGraph* gFracGoodInjVsRunL4=new TGraph(0);
97 gFracGoodInjVsRunL4->SetName("gFracGoodInjVsRunL4");
98 TGraph* gFracAverSpeedVsRunL4=new TGraph(0);
99 gFracAverSpeedVsRunL4->SetName("gFracAverSpeedVsRunL4");
100 TGraph* gFracGoodInjVsTimeL4=new TGraph(0);
101 gFracGoodInjVsTimeL4->SetName("gFracGoodInjVsTimeL4");
102 TGraph* gFracAverSpeedVsTimeL4=new TGraph(0);
103 gFracAverSpeedVsTimeL4->SetName("gFracAverSpeedVsIimeL4");
55d5b638 104
8d024204 105 for(Int_t iMod=0; iMod<260;iMod++){
63c8701c 106 for(Int_t iSide=0; iSide<2; iSide++){
107 Int_t index=2*iMod+iSide;
108 gvdrvstime[index]=new TGraphErrors(0);
109 gvdrvstime[index]->SetTitle(Form("Module %d Side %d",iMod+240,iSide));
110 gvdrvstime[index]->SetName(Form("gspmod%ds%dt",iMod+240,iSide));
111 gvdrvsrun[index]=new TGraphErrors(0);
112 gvdrvsrun[index]->SetTitle(Form("Module %d Side %d",iMod+240,iSide));
113 gvdrvsrun[index]->SetName(Form("gspmod%ds%dr",iMod+240,iSide));
114 gstatusinjvstime[index]=new TGraphErrors(0);
115 gstatusinjvstime[index]->SetTitle(Form("Module %d Side %d",iMod+240,iSide));
116 gstatusinjvstime[index]->SetName(Form("gstinmod%ds%dt",iMod+240,iSide));
117 gstatusinjvsrun[index]=new TGraphErrors(0);
118 gstatusinjvsrun[index]->SetTitle(Form("Module %d Side %d",iMod+240,iSide));
119 gstatusinjvsrun[index]->SetName(Form("gstinmod%ds%dr",iMod+240,iSide));
120 }
8d024204 121 }
63c8701c 122
123 Float_t driftField=(1800-45)/291/0.012;
9c3758ab 124 Int_t nrun,nrun2,nv,ns;
dfd1761f 125 UInt_t timeZero;
4d8feb56 126 if(year==2009) timeZero=1247762992;
127 else if(year==2010) timeZero=1262300400;
dfd1761f 128 else timeZero=1293836400; // 1/1/2011 at 0:00 CEST
4d8feb56 129
8d024204 130 while(!feof(listruns)){
131 fscanf(listruns,"%s\n",filnam);
78018435 132 Char_t directory[100];
133 sprintf(directory,"/alice/data/%d",year);
134 if(!strstr(filnam,directory)) continue;
135 sscanf(filnam,"/alice/data/%d/OCDB/ITS/Calib/DriftSpeedSDD/Run%d_%d_v%d_s%d.root",&year,&nrun,&nrun2,&nv,&ns);
136
137 if(year==2009 && (nrun<85639 && nrun2> 85639)) continue;// protection for files with swapped ladders 4-5 of layer 3
2420973e 138 if(year==2009 && (nrun>100000 && nv< 325)) continue; // protection for files with swapped ladder 0-1 of layer 4
78018435 139
8d024204 140 if(nrun<firstRun) continue;
141 if(nrun>lastRun) continue;
142 sprintf(filnamalien,"alien://%s",filnam);
143 printf("Open file: %s\n",filnam);
144 TFile *f= TFile::Open(filnamalien);
e9ef0fc2 145 if(f==0x0)continue;
8d024204 146 AliCDBEntry *ent=(AliCDBEntry*)f->Get("AliCDBEntry");
147 TObjArray *drspSDD = (TObjArray *)ent->GetObject();
148
55d5b638 149 Int_t iGoodInj=0;
150 Int_t iAverSpeed=0;
e9ef0fc2 151
152 Int_t iGoodInjL3=0;
153 Int_t iAverSpeedL3=0;
154
155 Int_t iGoodInjL4=0;
156 Int_t iAverSpeedL4=0;
157
158 Int_t totalgoodinj=520;
159 Int_t totalgoodinjL3=168;
160 Int_t totalgoodinjL4=352;
161
162 Float_t fracGoodInj=0.;
163 Float_t fracGoodInjL3=0.;
164 Float_t fracGoodInjL4=0.;
165
166 Float_t fracAverSpeed=0.;
167 Float_t fracAverSpeedL3=0.;
168 Float_t fracAverSpeedL4=0.;
55d5b638 169
8d024204 170 AliITSDriftSpeedArraySDD *vdriftarr;
55d5b638 171 AliITSDriftSpeedArraySDD *vdriftarr0;
172 AliITSDriftSpeedArraySDD *vdriftarr1;
173
63c8701c 174 UInt_t timest=0;
175 Float_t timeday=0;
176 Bool_t goodTime=kFALSE;
177
178 for(Int_t iHyb=0; iHyb<520;iHyb++){
179 if(!goodTime){
180 vdriftarr=(AliITSDriftSpeedArraySDD*)drspSDD->At(iHyb);
181 Int_t statusInj=vdriftarr->GetInjectorStatus();
182 if(statusInj>0){
183 timest=vdriftarr->GetTimestamp(0);
184 if(timest>0 && timest>timeZero){
185 timeday=float(timest-timeZero)/60./60./24.;
186 goodTime=kTRUE;
187 }
188 }
189 }
190 }
191
8d024204 192 for(Int_t iMod=0; iMod<260;iMod++){
63c8701c 193
55d5b638 194 Int_t i0=2*iMod;
195 Int_t i1=1+2*iMod;
196 vdriftarr0=(AliITSDriftSpeedArraySDD*)drspSDD->At(i0);
197 vdriftarr1=(AliITSDriftSpeedArraySDD*)drspSDD->At(i1);
63c8701c 198
199
55d5b638 200 Int_t statusInj0=vdriftarr0->GetInjectorStatus();
201 Int_t statusInj1=vdriftarr1->GetInjectorStatus();
63c8701c 202 Int_t npt=gstatusinjvsrun[i0]->GetN();
203 gstatusinjvsrun[i0]->SetPoint(npt,(Float_t)nrun,statusInj0);
204 gstatusinjvsrun[i1]->SetPoint(npt,(Float_t)nrun,statusInj1);
205 gstatusinjvsrun[i0]->SetPointError(npt,0,0);
206 gstatusinjvsrun[i1]->SetPointError(npt,0,0);
207 if(goodTime){
208 Int_t npt=gstatusinjvstime[i0]->GetN();
209 gstatusinjvstime[i0]->SetPoint(npt,timeday,statusInj0);
210 gstatusinjvstime[i1]->SetPoint(npt,timeday,statusInj1);
211 gstatusinjvstime[i0]->SetPointError(npt,0,0);
212 gstatusinjvstime[i1]->SetPointError(npt,0,0);
213 }
214
215 Float_t vdrift0=vdriftarr0->GetDriftSpeed(0,iAn);
216 Float_t vdrift1=vdriftarr1->GetDriftSpeed(0,iAn);
217 Float_t mob=vdrift0*1.E5/driftField;
218 Float_t temper=293.15*TMath::Power((mob/1350.),-1/2.4);
219 if(iMod==497-240) printf("Run %s Time %d Day %f Speed=%f Temp=%f\n",filnam,timest,timeday,vdrift0,temper);
220
e9ef0fc2 221 if(statusInj0>0){
222 iGoodInj++;
223 if(iMod<84)iGoodInjL3++;
224 else iGoodInjL4++;
63c8701c 225 Int_t npt=gvdrvsrun[i0]->GetN();
226 gvdrvsrun[i0]->SetPoint(npt,(Float_t)nrun,vdrift0);
227 gvdrvsrun[i0]->SetPointError(npt,0,errSpeed[iMod]);
228 if(goodTime){
229 npt=gvdrvstime[i0]->GetN();
230 gvdrvstime[i0]->SetPoint(npt,timeday,vdrift0);
231 gvdrvstime[i0]->SetPointError(npt,0,errSpeed[iMod]);
232 }
e9ef0fc2 233 }
234 else{
235 iAverSpeed++;
236 if(iMod<84)iAverSpeedL3++;
237 else iAverSpeedL4++;
238 }
239 if(statusInj1>0){
240 iGoodInj++;
241 if(iMod<84)iGoodInjL3++;
242 else iGoodInjL4++;
63c8701c 243 Int_t npt=gvdrvsrun[i1]->GetN();
244 gvdrvsrun[i1]->SetPoint(npt,(Float_t)nrun,vdrift1);
245 gvdrvsrun[i1]->SetPointError(npt,0,errSpeed[iMod]);
246 if(goodTime){
247 npt=gvdrvstime[i1]->GetN();
248 gvdrvstime[i1]->SetPoint(npt,timeday,vdrift1);
249 gvdrvstime[i1]->SetPointError(npt,0,errSpeed[iMod]);
250 }
e9ef0fc2 251 }else{
252 iAverSpeed++;
253 if(iMod<84)iAverSpeedL3++;
254 else iAverSpeedL4++;
255 }
8d024204 256 }
63c8701c 257
55d5b638 258 Int_t npt=gGoodInjVsRun->GetN();
e9ef0fc2 259 fracGoodInj=(Float_t)iGoodInj/(Float_t)totalgoodinj;
260 fracGoodInjL3=(Float_t)iGoodInjL3/(Float_t)totalgoodinjL3;
261 fracGoodInjL4=(Float_t)iGoodInjL4/(Float_t)totalgoodinjL4;
262
263 fracAverSpeed = (Float_t)iAverSpeed/(Float_t)totalgoodinj;
264 fracAverSpeedL3 = (Float_t)iAverSpeedL3/(Float_t)totalgoodinjL3;
265 fracAverSpeedL4 = (Float_t)iAverSpeedL4/(Float_t)totalgoodinjL4;
266
55d5b638 267 gGoodInjVsRun->SetPoint(npt,(Float_t)nrun,iGoodInj);
268 gAverSpeedVsRun->SetPoint(npt,(Float_t)nrun,iAverSpeed);
269
e9ef0fc2 270 gGoodInjVsRunL3->SetPoint(npt,(Float_t)nrun,iGoodInjL3);
271 gAverSpeedVsRunL3->SetPoint(npt,(Float_t)nrun,iAverSpeedL3);
272
273 gGoodInjVsRunL4->SetPoint(npt,(Float_t)nrun,iGoodInjL4);
274 gAverSpeedVsRunL4->SetPoint(npt,(Float_t)nrun,iAverSpeedL4);
275
276
277 gFracGoodInjVsRun->SetPoint(npt,(Float_t)nrun,(Double_t)fracGoodInj);
278 gFracAverSpeedVsRun->SetPoint(npt,(Float_t)nrun,(Double_t)fracAverSpeed);
279
280 gFracGoodInjVsRunL3->SetPoint(npt,(Float_t)nrun,(Double_t)fracGoodInjL3);
281 gFracAverSpeedVsRunL3->SetPoint(npt,(Float_t)nrun,(Double_t)fracAverSpeedL3);
282
283 gFracGoodInjVsRunL4->SetPoint(npt,(Float_t)nrun,(Double_t)fracGoodInjL4);
284 gFracAverSpeedVsRunL4->SetPoint(npt,(Float_t)nrun,(Double_t)fracAverSpeedL4);
285
55d5b638 286 npt=gGoodInjVsTime->GetN();
e9ef0fc2 287
55d5b638 288 gGoodInjVsTime->SetPoint(npt,timeday,iGoodInj);
289 gAverSpeedVsTime->SetPoint(npt,timeday,iAverSpeed);
e9ef0fc2 290
291 gGoodInjVsTimeL3->SetPoint(npt,timeday,iGoodInjL3);
292 gAverSpeedVsTimeL3->SetPoint(npt,timeday,iAverSpeedL3);
293
294 gGoodInjVsTimeL4->SetPoint(npt,timeday,iGoodInjL4);
295 gAverSpeedVsTimeL4->SetPoint(npt,timeday,iAverSpeedL4);
296
297
298 gFracGoodInjVsTime->SetPoint(npt,timeday,(Double_t)fracGoodInj);
299 gFracAverSpeedVsTime->SetPoint(npt,timeday,(Double_t)fracAverSpeed);
300
301 gFracGoodInjVsTimeL3->SetPoint(npt,timeday,(Double_t)fracGoodInjL3);
302 gFracAverSpeedVsTimeL3->SetPoint(npt,timeday,(Double_t)fracAverSpeedL3);
303
304 gFracGoodInjVsTimeL4->SetPoint(npt,timeday,(Double_t)fracGoodInjL4);
305 gFracAverSpeedVsTimeL4->SetPoint(npt,timeday,(Double_t)fracAverSpeedL4);
306
55d5b638 307 printf("Number of half-modules with drift speed from injectors = %d\n",iGoodInj);
308 printf("Number of half-modules with average drift speed = %d\n",iAverSpeed);
e9ef0fc2 309 printf("Number of half-modules with drift speed from injectors L3 = %d\n",iGoodInjL3);
310 printf("Number of half-modules with drift speed from injectors L4 = %d\n",iGoodInjL4);
311
f6b78d45 312 f->Close();
8d024204 313 }
314
63c8701c 315 Char_t filout[100];
316 sprintf(filout,"DriftSpVsTime_%d.root",year);
317 TFile *ofil=new TFile(filout,"recreate");
318 for(Int_t iHyb=0; iHyb<520;iHyb++){
319 gvdrvstime[iHyb]->Write();
320 gvdrvsrun[iHyb]->Write();
321 gstatusinjvstime[iHyb]->Write();
322 gstatusinjvsrun[iHyb]->Write();
323 }
324 gGoodInjVsRun->Write();
325 gGoodInjVsTime->Write();
326 gAverSpeedVsRun->Write();
327 gAverSpeedVsTime->Write();
328 ofil->Close();
329
fc179f17 330 // Int_t mod1=244-240;
331 Int_t mod1 = 243-240;
8d024204 332 Int_t mod2=277-240;
f6b78d45 333 // Int_t mod2=259-240;
78018435 334// Int_t mod2=274-240;
8d024204 335 Int_t mod3=327-240;
fc179f17 336 // Int_t mod4=453-240;
337 Int_t mod4=422-240;
78018435 338 // Int_t mod4=497-240;
8d024204 339 Int_t lay1,lad1,det1;
340 Int_t lay2,lad2,det2;
341 Int_t lay3,lad3,det3;
342 Int_t lay4,lad4,det4;
343 AliITSgeomTGeo::GetModuleId(mod1+240,lay1,lad1,det1);
344 AliITSgeomTGeo::GetModuleId(mod2+240,lay2,lad2,det2);
345 AliITSgeomTGeo::GetModuleId(mod3+240,lay3,lad3,det3);
346 AliITSgeomTGeo::GetModuleId(mod4+240,lay4,lad4,det4);
8d024204 347
348 gStyle->SetOptTitle(0);
55d5b638 349 TCanvas* c0=new TCanvas("c0","Vdrift vs. time");
8d024204 350 c0->SetGridx();
351 c0->SetGridy();
63c8701c 352 gvdrvstime[2*mod1]->SetMarkerStyle(20);
353 gvdrvstime[2*mod2]->SetMarkerStyle(22);
354 gvdrvstime[2*mod2]->SetMarkerColor(2);
355 gvdrvstime[2*mod2]->SetLineColor(2);
356 gvdrvstime[2*mod3]->SetMarkerStyle(29);
357 gvdrvstime[2*mod3]->SetMarkerColor(3);
358 gvdrvstime[2*mod3]->SetLineColor(3);
359 gvdrvstime[2*mod4]->SetMarkerStyle(27);
360 gvdrvstime[2*mod4]->SetMarkerColor(4);
361 gvdrvstime[2*mod4]->SetLineColor(4);
362 gvdrvstime[2*mod1]->Draw("AP");
363 gvdrvstime[2*mod1]->SetMinimum(6.3);
364 gvdrvstime[2*mod1]->SetMaximum(6.75);
78018435 365 Char_t title[100];
366 if(year==2009){
4d8feb56 367 sprintf(title,"Time (days since July 16th 2009)");
78018435 368 }else if (year==2010){
4d8feb56 369 sprintf(title,"Time (days since January 1st 2010)");
370 }else{
371 sprintf(title,"Time (days since January 1st 2011)");
78018435 372 }
63c8701c 373 gvdrvstime[2*mod1]->GetXaxis()->SetTitle(title);
374 gvdrvstime[2*mod1]->GetYaxis()->SetTitle("Drift speed (#mum/ns)");
375 gvdrvstime[2*mod2]->Draw("PSAME");
376 gvdrvstime[2*mod3]->Draw("PSAME");
377 gvdrvstime[2*mod4]->Draw("PSAME");
8d024204 378 TLegend* leg=new TLegend(0.6,0.7,0.89,0.89);
379 leg->SetBorderSize(0);
380 leg->SetFillColor(0);
381 leg->SetFillStyle(0);
63c8701c 382 TLegendEntry* lent=leg->AddEntry(gvdrvstime[2*mod1],Form("Lay %d Lad %d Det %d",lay1,lad1,det1),"P");
383 lent=leg->AddEntry(gvdrvstime[2*mod2],Form("Lay %d Lad %d Det %d",lay2,lad2,det2),"P");
8d024204 384 lent->SetTextColor(2);
63c8701c 385 lent=leg->AddEntry(gvdrvstime[2*mod3],Form("Lay %d Lad %d Det %d",lay3,lad3,det3),"P");
8d024204 386 lent->SetTextColor(3);
63c8701c 387 lent=leg->AddEntry(gvdrvstime[2*mod4],Form("Lay %d Lad %d Det %d",lay4,lad4,det4),"P");
8d024204 388 lent->SetTextColor(4);
389 leg->Draw();
390
55d5b638 391 TCanvas* c1=new TCanvas("c1","Vdrift vs. run");
8d024204 392 c1->SetGridx();
393 c1->SetGridy();
63c8701c 394 gvdrvsrun[2*mod1]->SetMarkerStyle(20);
395 gvdrvsrun[2*mod2]->SetMarkerStyle(22);
396 gvdrvsrun[2*mod2]->SetMarkerColor(2);
397 gvdrvsrun[2*mod2]->SetLineColor(2);
398 gvdrvsrun[2*mod3]->SetMarkerStyle(29);
399 gvdrvsrun[2*mod3]->SetMarkerColor(3);
400 gvdrvsrun[2*mod3]->SetLineColor(3);
401 gvdrvsrun[2*mod4]->SetMarkerStyle(27);
402 gvdrvsrun[2*mod4]->SetMarkerColor(4);
403 gvdrvsrun[2*mod4]->SetLineColor(4);
404 gvdrvsrun[2*mod1]->Draw("AP");
405 gvdrvsrun[2*mod1]->SetMinimum(6.3);
406 gvdrvsrun[2*mod1]->SetMaximum(6.75);
407
408 gvdrvsrun[2*mod1]->GetXaxis()->SetTitle("Run number");
409 gvdrvsrun[2*mod1]->GetYaxis()->SetTitle("Drift speed (#mum/ns)");
410 gvdrvsrun[2*mod2]->Draw("PSAME");
411 gvdrvsrun[2*mod3]->Draw("PSAME");
412 gvdrvsrun[2*mod4]->Draw("PSAME");
8d024204 413 leg->Draw();
194bd524 414
415
416 TH2F* hlay3=new TH2F("hlay3","Variation of the drift speed (%) Layer 3",6,-0.5,5.5,14,-0.5,13.5);
417 hlay3->GetXaxis()->SetTitle("Detector");
418 hlay3->GetYaxis()->SetTitle("Ladder");
419 hlay3->GetXaxis()->SetTickLength(0);
420 hlay3->GetYaxis()->SetTickLength(0);
421 hlay3->SetStats(0);
422
423 TH2F* hlay4=new TH2F("hlay4","Variation of the drift speed (%) Layer 4",8,-0.5,7.5,22,-0.5,21.5);
424 hlay4->GetXaxis()->SetTitle("Detector");
425 hlay4->GetYaxis()->SetTitle("Ladder");
426 hlay4->GetXaxis()->SetTickLength(0);
427 hlay4->GetYaxis()->SetTickLength(0);
428 hlay4->GetYaxis()->SetTitle("Ladder");
429 hlay4->SetStats(0);
430
431 Double_t run1,run2,vdr1,vdr2;
432 Int_t lay,lad,det;
433 for(Int_t iMod=0; iMod<260; iMod++){
63c8701c 434 Int_t lastPoint=gvdrvsrun[2*iMod]->GetN()-1;
435 gvdrvsrun[2*iMod]->GetPoint(lastPoint,run2,vdr2);
436 gvdrvsrun[2*iMod]->GetPoint(lastPoint-1,run1,vdr1);
194bd524 437 Float_t diff=0.;
438 if(vdr1>0.) diff=100*(vdr2-vdr1)/vdr1;
439 AliITSgeomTGeo::GetModuleId(iMod+240,lay,lad,det);
440 if(lay==3) hlay3->SetBinContent(det,lad,diff);
441 if(lay==4) hlay4->SetBinContent(det,lad,diff);
442 }
443 TLine* lin=new TLine(0,0,0,23);
444 gStyle->SetPalette(1);
445
446 TCanvas *c0b=new TCanvas("c0b","Percent difference Last Run - Previous Run",900,600);
447 c0b->Divide(2,1);
448 c0b->cd(1);
449 hlay3->DrawCopy("colz");
450 for(Int_t i=0;i<6;i++){
451 lin->SetY1(-0.5);
452 lin->SetY2(13.5);
453 lin->SetX1(i+0.5);
454 lin->SetX2(i+0.5);
455 lin->DrawClone();
456 }
457 for(Int_t i=0;i<14;i++){
458 lin->SetX1(-0.5);
459 lin->SetX2(5.5);
460 lin->SetY1(i+0.5);
461 lin->SetY2(i+0.5);
462 lin->DrawClone();
463 }
464 c0b->cd(2);
465 hlay4->DrawCopy("colz");
466 for(Int_t i=0;i<8;i++){
467 lin->SetY1(-0.5);
468 lin->SetY2(21.5);
469 lin->SetX1(i+0.5);
470 lin->SetX2(i+0.5);
471 lin->DrawClone();
472 }
473 for(Int_t i=0;i<22;i++){
474 lin->SetX1(-0.5);
475 lin->SetX2(7.5);
476 lin->SetY1(i+0.5);
477 lin->SetY2(i+0.5);
478 lin->DrawClone();
479 }
55d5b638 480
481 TCanvas* c4=new TCanvas("c4","GoodMod vs. run");
482 c4->SetGridx();
483 c4->SetGridy();
484 gGoodInjVsRun->SetMarkerStyle(20);
e9ef0fc2 485 gGoodInjVsRun->SetMinimum(50.);
486 gGoodInjVsRun->SetMaximum(370.);
487 gGoodInjVsRunL3->SetMarkerStyle(22);
488 gGoodInjVsRunL3->SetMarkerColor(2);
489 gGoodInjVsRunL3->SetLineColor(2);
490 gGoodInjVsRunL4->SetMarkerStyle(23);
491 gGoodInjVsRunL4->SetMarkerColor(4);
492 gGoodInjVsRunL4->SetLineColor(4);
493 gGoodInjVsRun->Draw("AP");
494 gGoodInjVsRunL3->Draw("PSAME");
495 gGoodInjVsRunL4->Draw("PSAME");
55d5b638 496 gGoodInjVsRun->GetXaxis()->SetTitle("Run number");
497 gGoodInjVsRun->GetYaxis()->SetTitle("Half-modules with drift speed from injectors");
e9ef0fc2 498 TLegend* leg2=new TLegend(0.6,0.3,0.89,0.5);
499 leg2->SetBorderSize(0);
500 leg2->SetFillColor(0);
501 leg2->SetFillStyle(0);
502 TLegendEntry* lent2=leg2->AddEntry(gGoodInjVsRun,"All","P");
503 lent2->SetTextColor(1);
504 lent2=leg2->AddEntry(gGoodInjVsRunL3,"Layer 3 ","P");
505 lent2->SetTextColor(2);
506 lent2=leg2->AddEntry(gGoodInjVsRunL4,"Layer 4","P");
507 lent2->SetTextColor(4);
508 leg2->Draw();
509
510
511 TCanvas* c4bis=new TCanvas("c4bis"," Frac GoodMod vs. run");
512 c4bis->SetGridx();
513 c4bis->SetGridy();
514 gFracGoodInjVsRun->SetMarkerStyle(20);
515 gFracGoodInjVsRun->SetMinimum(0.);
516 gFracGoodInjVsRun->SetMaximum(0.9);
517 gFracGoodInjVsRunL3->SetMarkerStyle(22);
518 gFracGoodInjVsRunL3->SetMarkerColor(2);
519 gFracGoodInjVsRunL3->SetLineColor(2);
520 gFracGoodInjVsRunL4->SetMarkerStyle(23);
521 gFracGoodInjVsRunL4->SetMarkerColor(4);
522 gFracGoodInjVsRunL4->SetLineColor(4);
523 gFracGoodInjVsRun->Draw("AP");
524 gFracGoodInjVsRunL3->Draw("PSAME");
525 gFracGoodInjVsRunL4->Draw("PSAME");
526 gFracGoodInjVsRun->GetXaxis()->SetTitle("Run number");
527 gFracGoodInjVsRun->GetYaxis()->SetTitle("Fraction of Half-modules with drift speed from injectors");
528 gFracGoodInjVsRun->GetYaxis()->SetTitleSize(0.03);
529 gFracGoodInjVsRun->GetYaxis()->SetTitleOffset(1.5);
530 leg2->Draw();
194bd524 531
55d5b638 532 TCanvas* c5=new TCanvas("c5","GoodMod vs. time");
533 c5->SetGridx();
534 c5->SetGridy();
535 gGoodInjVsTime->SetMarkerStyle(20);
e9ef0fc2 536 gGoodInjVsTime->SetMinimum(50.);
537 gGoodInjVsTime->SetMaximum(370.);
538 gGoodInjVsTimeL3->SetMarkerStyle(22);
539 gGoodInjVsTimeL3->SetMarkerColor(2);
540 gGoodInjVsTimeL3->SetLineColor(2);
541 gGoodInjVsTimeL4->SetMarkerStyle(23);
542 gGoodInjVsTimeL4->SetMarkerColor(4);
543 gGoodInjVsTimeL4->SetLineColor(4);
544 gGoodInjVsTime->Draw("AP");
545 gGoodInjVsTimeL3->Draw("PSAME");
546 gGoodInjVsTimeL4->Draw("PSAME");
55d5b638 547 gGoodInjVsTime->GetXaxis()->SetTitle(title);
548 gGoodInjVsTime->GetYaxis()->SetTitle("Half-modules with drift speed from injectors");
e9ef0fc2 549 leg2->Draw();
550
551 TCanvas* c5bis=new TCanvas("c5bis","Frac GoodMod vs. time");
552 c5bis->SetGridx();
553 c5bis->SetGridy();
554 gFracGoodInjVsTime->SetMarkerStyle(20);
555 gFracGoodInjVsTime->SetMinimum(0.);
556 gFracGoodInjVsTime->SetMaximum(0.9);
557 gFracGoodInjVsTimeL3->SetMarkerStyle(22);
558 gFracGoodInjVsTimeL3->SetMarkerColor(2);
559 gFracGoodInjVsTimeL3->SetLineColor(2);
560 gFracGoodInjVsTimeL4->SetMarkerStyle(23);
561 gFracGoodInjVsTimeL4->SetMarkerColor(4);
562 gFracGoodInjVsTimeL4->SetLineColor(4);
563 gFracGoodInjVsTime->Draw("AP");
564 gFracGoodInjVsTimeL3->Draw("PSAME");
565 gFracGoodInjVsTimeL4->Draw("PSAME");
566 gFracGoodInjVsTime->GetXaxis()->SetTitle(title);
567 gFracGoodInjVsTime->GetYaxis()->SetTitleSize(0.03);
568 gFracGoodInjVsTime->GetYaxis()->SetTitleOffset(1.5);
569 gFracGoodInjVsTime->GetYaxis()->SetTitle("Fraction of Half-modules with drift speed from injectors");
570 leg2->Draw();
571
8d024204 572}
573
574void FillErrors(Float_t errSpeed[260]){
575 Float_t err[260]={
576 0.002308,0.005120,0.004632,0.001000,0.001735,
577 0.001000,0.001000,0.002667,0.004237,0.005297,
578 0.001000,0.005460,0.005149,0.003921,0.001000,
579 0.003906,0.001000,0.004871,0.001000,0.001000,
580 0.001000,0.001000,0.002261,0.002986,0.002056,
581 0.002848,0.001000,0.001777,0.002822,0.004651,
582 0.001000,0.003551,0.006466,0.001000,0.002083,
583 0.004531,0.001000,0.002213,0.001000,0.001000,
584 0.001000,0.001000,0.001000,0.003223,0.002800,
585 0.002147,0.001000,0.003364,0.001000,0.001000,
586 0.002515,0.003229,0.002552,0.005765,0.002368,
587 0.003473,0.002363,0.001000,0.003413,0.001000,
588 0.004906,0.001000,0.004346,0.004887,0.007138,
589 0.007242,0.004289,0.003970,0.002914,0.002199,
590 0.001000,0.003483,0.002154,0.002914,0.003097,
591 0.006034,0.003101,0.001000,0.002425,0.002651,
592 0.002771,0.002409,0.002260,0.003109,0.001000,
593 0.003384,0.003374,0.002212,0.004441,0.001000,
594 0.001000,0.001000,0.003578,0.001000,0.001000,
595 0.003517,0.003590,0.001787,0.003329,0.001000,
596 0.002770,0.001000,0.004032,0.003059,0.001000,
597 0.001000,0.001000,0.001000,0.001000,0.001000,
598 0.001000,0.004556,0.001000,0.001000,0.001000,
599 0.001000,0.001000,0.001000,0.004819,0.002100,
600 0.002624,0.003784,0.003772,0.002483,0.002792,
601 0.001000,0.004713,0.003214,0.003180,0.002145,
602 0.002470,0.003078,0.001000,0.007131,0.002770,
603 0.002533,0.001000,0.004362,0.002819,0.001000,
604 0.003630,0.004215,0.002975,0.001000,0.003790,
605 0.002345,0.001000,0.003999,0.004555,0.003989,
606 0.001000,0.001000,0.001000,0.003136,0.002426,
607 0.005144,0.002844,0.002310,0.002467,0.002503,
608 0.003811,0.003440,0.004773,0.003114,0.001000,
609 0.000583,0.001000,0.001000,0.003385,0.001000,
610 0.001000,0.001000,0.001000,0.003108,0.002109,
611 0.005325,0.003750,0.002810,0.003559,0.001000,
612 0.001000,0.003262,0.003903,0.001000,0.003622,
613 0.002533,0.002121,0.003733,0.005353,0.002221,
614 0.004767,0.003267,0.004892,0.002152,0.003398,
615 0.001000,0.003146,0.001000,0.002952,0.003310,
616 0.002644,0.002573,0.001000,0.003989,0.001000,
617 0.005294,0.003095,0.003479,0.002250,0.001000,
618 0.001000,0.005221,0.001000,0.001653,0.004330,
619 0.013188,0.007375,0.003226,0.003875,0.001000,
620 0.003653,0.001000,0.002655,0.001000,0.001000,
621 0.001000,0.001000,0.004718,0.001000,0.001000,
622 0.001000,0.002780,0.003680,0.001000,0.002787,
623 0.001000,0.004617,0.001000,0.001000,0.003231,
624 0.001887,0.002090,0.003326,0.129970,0.004907,
625 0.004334,0.001000,0.001000,0.003489,0.002573,
626 0.002566,0.002982,0.001000,0.001000,0.003436,
627 0.004016,0.003736,0.001784,0.004775,0.008090};
628 for(Int_t i=0;i<260;i++) errSpeed[i]=err[i];
629
630
631}