]>
Commit | Line | Data |
---|---|---|
35d81915 | 1 | /// \file CalibCosmic.C |
2 | /// | |
3 | /// Draw result of perfomance test: | |
4 | /// | |
5 | /// ~~~ | |
6 | /// aliroot -b -q $ALICE_ROOT/TPC/scripts/loadTPCcalib.C $ALICE_ROOT/TPC/CalibMacros/CalibCosmic.C | |
7 | /// ~~~ | |
8 | /// | |
9 | /// ~~~{.cpp} | |
10 | /// // gROOT->Macro("~/NimStyle.C"); | |
11 | /// gSystem->AddIncludePath("-I$ALICE_ROOT/STAT") | |
12 | /// gSystem->AddIncludePath("-I$ALICE_ROOT/TPC") | |
13 | /// gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros") | |
14 | /// | |
15 | /// gSystem->Load("libANALYSIS"); | |
16 | /// gSystem->Load("libTPCcalib"); | |
17 | /// .L $ALICE_ROOT/TPC/CalibMacros/CalibCosmic.C | |
18 | /// // init | |
19 | /// Init(); | |
20 | /// SetDefaultCut(); // check defualt cut | |
21 | /// // | |
22 | /// MakeDefaultPlots(); | |
23 | /// | |
24 | /// gROOT->Macro("~/NimStyle.C"); | |
25 | /// TFile f("cosmicPlots.root"); | |
26 | /// TBrowser b | |
27 | /// b.Add(CosmicPlots,"CosmicPlot"); | |
28 | /// ~~~ | |
35a255d8 | 29 | |
ed56a3fa | 30 | #if !defined(__CINT__) || defined(__MAKECINT__) |
31 | #include "THnSparse.h" | |
32 | #include "TLatex.h" | |
33 | #include "TCanvas.h" | |
34 | #include "TLegend.h" | |
35 | #include "TSystem.h" | |
36 | #include "TFile.h" | |
37 | #include "TChain.h" | |
38 | #include "TCut.h" | |
39 | #include "TH3.h" | |
40 | #include "TH2F.h" | |
41 | #include "TProfile3D.h" | |
42 | #include "TMath.h" | |
43 | #include "TVectorD.h" | |
44 | #include "TMatrixD.h" | |
45 | #include "TTreeStream.h" | |
46 | #include "AliExternalTrackParam.h" | |
47 | #include "AliESDfriend.h" | |
48 | #include "AliTPCcalibCosmic.h" | |
49 | #include "TROOT.h" | |
50 | #include "TPostScript.h" | |
51 | #include "TStyle.h" | |
52 | #include "AliTrackerBase.h" | |
53 | #include "AliTPCExBEffective.h" | |
54 | #include "TEntryList.h" | |
55 | #include "TLegend.h" | |
56 | #endif | |
57 | ||
58 | ||
59 | class AliTPCcalibCosmic; | |
60 | AliTPCcalibCosmic * cosmicScan =0; | |
91fd44c9 | 61 | TObjArray fitArr; |
ed56a3fa | 62 | Int_t colors[3]={1,2,4}; |
63 | TObjArray *picArray = new TObjArray(); | |
64 | const char * chsign[3]={"all", "Positive","Negative"}; | |
65 | void Init(); | |
66 | void SetRangeAll(Int_t axis, Float_t xmin, Float_t xmax); | |
67 | void SetDefaultCut(); | |
68 | void MakeDefaultPlots(); | |
69 | ||
70 | ||
91fd44c9 | 71 | |
712f2cab | 72 | void CalibCosmic(){ |
35d81915 | 73 | /// init |
74 | ||
712f2cab | 75 | Init(); |
76 | SetDefaultCut(); | |
77 | // | |
78 | MakeDefaultPlots(); | |
79 | } | |
80 | ||
91fd44c9 | 81 | void Init(){ |
35d81915 | 82 | /// |
83 | ||
ed56a3fa | 84 | TH1::AddDirectory(0); |
85 | TFile fcalib("TPCCosmicObjects.root"); | |
86 | cosmicScan = ( AliTPCcalibCosmic *)fcalib.Get("cosmicTPC"); | |
91fd44c9 | 87 | TString axisName[9]; |
88 | axisName[0] ="#Delta"; axisName[1] ="N_{cl}"; | |
35a255d8 | 89 | axisName[2] ="DCA_{r}(cm)"; |
91fd44c9 | 90 | axisName[3] ="z (cm)"; axisName[4] ="sin(#phi)"; |
35a255d8 | 91 | axisName[5] ="tan(#theta)"; axisName[6] ="1/p_{t} (1/GeV)"; |
92 | axisName[7] ="p_{t} (GeV)"; axisName[8] ="alpha"; | |
91fd44c9 | 93 | |
94 | { | |
95 | for (Int_t ivar=0;ivar<6;ivar++){ | |
96 | for (Int_t ivar2=0;ivar2<9;ivar2++){ | |
ed56a3fa | 97 | cosmicScan->fHistoDelta[ivar]->GetAxis(ivar2)->SetName(axisName[ivar2].Data()); |
98 | cosmicScan->fHistoDelta[ivar]->GetAxis(ivar2)->SetTitle(axisName[ivar2].Data()); | |
99 | cosmicScan->fHistoPull[ivar]->GetAxis(ivar2)->SetName(axisName[ivar2].Data()); | |
100 | cosmicScan->fHistoPull[ivar]->GetAxis(ivar2)->SetTitle(axisName[ivar2].Data()); | |
91fd44c9 | 101 | } |
102 | } | |
103 | } | |
104 | } | |
105 | ||
35a255d8 | 106 | void SetRangeAll(Int_t axis, Float_t xmin, Float_t xmax){ |
107 | ||
91fd44c9 | 108 | for (Int_t i=0;i<6;i++){ |
109 | // | |
ed56a3fa | 110 | cosmicScan->fHistoDelta[i]->GetAxis(axis)->SetRangeUser(xmin,xmax); |
111 | cosmicScan->fHistoPull[i]->GetAxis(axis)->SetRangeUser(xmin,xmax); | |
35a255d8 | 112 | } |
113 | } | |
114 | ||
91fd44c9 | 115 | |
35a255d8 | 116 | void SetDefaultCut(){ |
117 | for (Int_t i=0;i<6;i++){ | |
118 | // | |
712f2cab | 119 | //cut on number of clusters |
ed56a3fa | 120 | cosmicScan->fHistoDelta[i]->GetAxis(1)->SetRangeUser(130,200); |
121 | cosmicScan->fHistoPull[i]->GetAxis(1)->SetRangeUser(130,200); | |
712f2cab | 122 | //cut on DCA r |
ed56a3fa | 123 | cosmicScan->fHistoDelta[i]->GetAxis(2)->SetRangeUser(0,15); |
124 | cosmicScan->fHistoPull[i]->GetAxis(2)->SetRangeUser(0,15); | |
712f2cab | 125 | //cut on z at |
ed56a3fa | 126 | cosmicScan->fHistoDelta[i]->GetAxis(3)->SetRangeUser(-20,20); |
127 | cosmicScan->fHistoPull[i]->GetAxis(3)->SetRangeUser(-20,20); | |
91fd44c9 | 128 | } |
ed56a3fa | 129 | cosmicScan->fHistoDelta[0]->GetAxis(0)->SetRangeUser(-1,1); |
130 | cosmicScan->fHistoDelta[1]->GetAxis(0)->SetRangeUser(-1,1); | |
131 | cosmicScan->fHistoDelta[4]->GetAxis(0)->SetRangeUser(-0.1,0.1); | |
91fd44c9 | 132 | } |
133 | ||
134 | TH2 * GetDelta2D(Int_t type, Int_t var){ | |
ed56a3fa | 135 | TH2 * his = cosmicScan->fHistoDelta[type]->Projection(0,var); |
136 | his->SetXTitle(cosmicScan->fHistoDelta[type]->GetAxis(var)->GetName()); | |
137 | his->SetYTitle(cosmicScan->fHistoDelta[type]->GetAxis(0)->GetName()); | |
91fd44c9 | 138 | return his; |
139 | } | |
140 | ||
141 | ||
712f2cab | 142 | TH1* GetFit2D(Int_t type, Int_t var, Bool_t resol){ |
91fd44c9 | 143 | |
ed56a3fa | 144 | TH2 * his = cosmicScan->fHistoDelta[type]->Projection(0,var); |
145 | his->SetXTitle(cosmicScan->fHistoDelta[type]->GetAxis(var)->GetName()); | |
146 | his->SetYTitle(cosmicScan->fHistoDelta[type]->GetAxis(0)->GetName()); | |
91fd44c9 | 147 | his->FitSlicesY(0,0,-1,0,"QNR",&fitArr); |
712f2cab | 148 | TH1 * hres = 0; |
149 | if (resol) hres = (TH1*)(fitArr.At(2)->Clone()); | |
150 | if (!resol) hres = (TH1*)(fitArr.At(1)->Clone()); | |
151 | hres->SetMarkerStyle(20); | |
152 | hres->SetMarkerColor(2); | |
5813554a | 153 | hres->GetYaxis()->SetTitleOffset(1.8); |
154 | hres->GetYaxis()->SetDecimals(kTRUE); | |
91fd44c9 | 155 | return hres; |
156 | } | |
157 | ||
158 | ||
159 | TH1 * GetDelta(Int_t type){ | |
ed56a3fa | 160 | TH1 * his = cosmicScan->fHistoDelta[type]->Projection(0); |
161 | his->SetXTitle(cosmicScan->fHistoDelta[type]->GetAxis(0)->GetName()); | |
91fd44c9 | 162 | return his; |
163 | } | |
164 | ||
165 | TH2 * GetPull2D(Int_t type, Int_t var){ | |
ed56a3fa | 166 | TH2 * his = cosmicScan->fHistoPull[type]->Projection(0,var); |
167 | his->SetXTitle(cosmicScan->fHistoPull[type]->GetAxis(var)->GetName()); | |
168 | his->SetYTitle(cosmicScan->fHistoPull[type]->GetAxis(0)->GetName()); | |
91fd44c9 | 169 | return his; |
170 | } | |
171 | ||
172 | TH1* GetPull2DSigma(Int_t type, Int_t var){ | |
173 | ||
ed56a3fa | 174 | TH2 * his = cosmicScan->fHistoPull[type]->Projection(0,var); |
175 | his->SetXTitle(cosmicScan->fHistoPull[type]->GetAxis(var)->GetName()); | |
176 | his->SetYTitle(cosmicScan->fHistoPull[type]->GetAxis(0)->GetName()); | |
91fd44c9 | 177 | his->FitSlicesY(0,0,-1,0,"QNR",&fitArr); |
178 | TH1 * hres = (TH1*)(fitArr.At(2)->Clone()); | |
179 | return hres; | |
180 | } | |
181 | ||
182 | ||
183 | ||
184 | TH1 * GetPull(Int_t type){ | |
ed56a3fa | 185 | TH1 * his = cosmicScan->fHistoPull[type]->Projection(0); |
186 | his->SetXTitle(cosmicScan->fHistoPull[type]->GetAxis(0)->GetName()); | |
91fd44c9 | 187 | return his; |
188 | } | |
35a255d8 | 189 | |
190 | ||
ed56a3fa | 191 | void DrawResoldEdx(){ |
35d81915 | 192 | /// |
193 | ||
35a255d8 | 194 | Int_t kmicolors[10]={1,2,3,6,7,8,9,10,11,12}; |
195 | Int_t kmimarkers[10]={21,22,23,24,25,26,27,28,29,30}; | |
196 | TH2 *htemp; | |
197 | TObjArray arr; | |
198 | TH1 * hResolMax[4]; | |
199 | TH1 * hResolTot[4]; | |
200 | // | |
201 | for (Int_t ipad=0;ipad<4;ipad++){ | |
ed56a3fa | 202 | cosmicScan->fHistodEdxTot[ipad]->GetAxis(4)->SetRangeUser(-0.6,0.6); |
203 | cosmicScan->fHistodEdxMax[ipad]->GetAxis(4)->SetRangeUser(-0.6,0.6); | |
35a255d8 | 204 | } |
ed56a3fa | 205 | cosmicScan->fHistodEdxTot[0]->GetAxis(1)->SetRangeUser(30,62); |
206 | cosmicScan->fHistodEdxTot[1]->GetAxis(1)->SetRangeUser(30,62); | |
207 | cosmicScan->fHistodEdxTot[2]->GetAxis(1)->SetRangeUser(10,35); | |
208 | cosmicScan->fHistodEdxTot[3]->GetAxis(1)->SetRangeUser(10,150); | |
209 | cosmicScan->fHistodEdxMax[0]->GetAxis(1)->SetRangeUser(30,62); | |
210 | cosmicScan->fHistodEdxMax[1]->GetAxis(1)->SetRangeUser(30,62); | |
211 | cosmicScan->fHistodEdxMax[2]->GetAxis(1)->SetRangeUser(10,35); | |
212 | cosmicScan->fHistodEdxMax[3]->GetAxis(1)->SetRangeUser(10,150); | |
35a255d8 | 213 | // |
214 | ||
215 | for (Int_t ipad=0;ipad<4;ipad++){ | |
ed56a3fa | 216 | htemp = cosmicScan->fHistodEdxTot[ipad]->Projection(0,1); |
35a255d8 | 217 | htemp->FitSlicesY(0,0,-1,0,"QNR",&arr); |
218 | hResolTot[ipad] = (TH1*)(arr.At(2)->Clone()); | |
219 | delete htemp; | |
220 | arr.SetOwner(kTRUE); | |
221 | arr.Delete(); | |
222 | hResolTot[ipad]->Scale(1./TMath::Sqrt(2.)); | |
223 | // | |
ed56a3fa | 224 | htemp = cosmicScan->fHistodEdxMax[ipad]->Projection(0,1); |
35a255d8 | 225 | htemp->FitSlicesY(0,0,-1,0,"QNR",&arr); |
226 | hResolMax[ipad] = (TH1*)(arr.At(2)->Clone()); | |
227 | delete htemp; | |
228 | arr.SetOwner(kTRUE); | |
229 | arr.Delete(); | |
230 | hResolMax[ipad]->Scale(1./TMath::Sqrt(2.)); | |
231 | } | |
232 | hResolTot[3]->GetXaxis()->SetRangeUser(0,160); | |
233 | hResolTot[3]->SetXTitle("N_{cl}"); | |
234 | hResolTot[3]->SetYTitle("#sigma(dEdx/dEdx_{d})/#sqrt{2.}"); | |
235 | hResolTot[3]->SetTitle("Relative dEdx resolution"); | |
236 | for (Int_t ipad=3;ipad>=0;ipad--){ | |
237 | hResolTot[ipad]->SetMaximum(0.1); | |
238 | hResolTot[ipad]->SetMinimum(0.); | |
239 | hResolTot[ipad]->SetMarkerColor(kmicolors[ipad]+0); | |
240 | hResolTot[ipad]->SetMarkerStyle(kmimarkers[ipad]+1); | |
241 | if (ipad==3) hResolTot[ipad]->Draw(); | |
242 | hResolTot[ipad]->Draw("same"); | |
243 | // | |
244 | hResolMax[ipad]->SetMaximum(0.1); | |
245 | hResolMax[ipad]->SetMinimum(0.); | |
246 | hResolMax[ipad]->SetMarkerColor(kmicolors[ipad]+0); | |
247 | hResolMax[ipad]->SetMarkerStyle(kmimarkers[ipad]+4); | |
248 | hResolMax[ipad]->Draw("same"); | |
249 | } | |
250 | ||
251 | } | |
712f2cab | 252 | |
253 | void DrawStat(Int_t coord, TObjArray *array=0){ | |
35d81915 | 254 | /// |
255 | ||
ed56a3fa | 256 | TCanvas *cStat = new TCanvas(Form("Cosmic stat%d",coord), Form("CosmicStat%d",coord),1000,800); |
5813554a | 257 | Float_t mx0=0.2, mx1=0.05, my0=0.15, my1=0.1; |
ed56a3fa | 258 | cStat->SetMargin(mx0,mx1,my0,my1); |
712f2cab | 259 | cStat->Divide(3,3); |
ed56a3fa | 260 | for (Int_t i=1; i<8; i++){ |
712f2cab | 261 | cStat->cd(i+1); |
ed56a3fa | 262 | cosmicScan->fHistoDelta[0]->Projection(i)->Draw(); |
712f2cab | 263 | } |
264 | if (array) array->AddLast(cStat); | |
265 | } | |
266 | ||
267 | void SetStylePad(TVirtualPad *pad){ | |
5813554a | 268 | Float_t mx0=0.2, mx1=0.05, my0=0.15, my1=0.1; |
712f2cab | 269 | pad->SetMargin(mx0,mx1,my0,my1); |
270 | pad->SetTicks(1,1); | |
271 | pad->SetGrid(1,1); | |
ed56a3fa | 272 | |
712f2cab | 273 | } |
274 | ||
275 | void MakePlotPt(TObjArray * array){ | |
35d81915 | 276 | /// |
277 | ||
ed56a3fa | 278 | TCanvas *cptRes = new TCanvas("TPCPtResol","TPCPtResol",900,600); |
712f2cab | 279 | cptRes->Divide(2,1); |
280 | SetStylePad(cptRes->cd(1)); | |
ed56a3fa | 281 | SetStylePad(cptRes->cd(2)); |
282 | cptRes->cd(1); | |
283 | TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,""); | |
284 | ||
712f2cab | 285 | // |
286 | TH1 * hisRes=0; | |
287 | TH1 * hisMean=0; | |
5813554a | 288 | for (Int_t i=0; i<3; i++){ |
ed56a3fa | 289 | if (i==0) cosmicScan->fHistoDelta[5]->GetAxis(6)->SetRangeUser(-1,1); |
290 | if (i==1) cosmicScan->fHistoDelta[5]->GetAxis(6)->SetRangeUser(0.001,1); | |
291 | if (i==2) cosmicScan->fHistoDelta[5]->GetAxis(6)->SetRangeUser(-1,-0.001); | |
292 | hisRes = (TH1*)GetFit2D(5,7,kTRUE)->Clone(); | |
293 | hisMean = (TH1*)GetFit2D(5,7,kFALSE)->Clone(); | |
294 | hisMean->SetName(Form("#Deltap_{t}/p_{t} %s",chsign[i])); | |
295 | hisRes->SetName(Form("#sigma_{p_{t}}/p_{t} %s",chsign[i])); | |
296 | hisMean->SetTitle(Form("#Delta_{p_{t}}/p_{t} %s",chsign[i])); | |
297 | hisRes->SetTitle(Form("#sigma_{p_{t}}/p_{t} %s",chsign[i])); | |
298 | ||
5813554a | 299 | hisRes->SetMarkerStyle(20); |
300 | hisMean->SetMarkerStyle(20); | |
301 | hisRes->SetMarkerColor(colors[i]); | |
302 | hisMean->SetMarkerColor(colors[i]); | |
303 | hisRes->Scale(100); | |
304 | hisMean->Scale(100); | |
305 | hisRes->SetMaximum(30); | |
306 | hisRes->SetMinimum(0); | |
307 | hisMean->SetMaximum(20); | |
308 | hisMean->SetMinimum(-20); | |
5813554a | 309 | hisRes->SetYTitle("#sigma_{p_{t}}/p_{t} (%)"); |
310 | hisMean->SetYTitle("#Delta_{p_{t}}/p_{t} (%)"); | |
ed56a3fa | 311 | hisRes->GetXaxis()->SetRangeUser(0,50); |
312 | hisMean->GetXaxis()->SetRangeUser(0,50); | |
5813554a | 313 | cptRes->cd(2); |
314 | hisRes->Draw("same"); | |
315 | if (i==0) hisRes->Draw(""); | |
316 | cptRes->cd(1); | |
317 | hisMean->Draw("same"); | |
318 | if (i==0) hisMean->Draw(""); | |
ed56a3fa | 319 | legend->AddEntry(hisMean); |
5813554a | 320 | } |
ed56a3fa | 321 | legend->Draw(); |
712f2cab | 322 | if (array) array->AddLast(cptRes); |
323 | } | |
324 | ||
325 | ||
5813554a | 326 | void MakePlotP4(TObjArray * array){ |
35d81915 | 327 | /// |
328 | ||
ed56a3fa | 329 | TCanvas *cptRes = new TCanvas("TPCP4Resol","TPCP4Resol",900,600); |
5813554a | 330 | cptRes->Divide(2,1); |
331 | SetStylePad(cptRes->cd(1)); | |
332 | SetStylePad(cptRes->cd(2)); | |
ed56a3fa | 333 | cptRes->cd(1); |
334 | TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,""); | |
335 | ||
5813554a | 336 | // |
337 | TH1 * hisRes =0; | |
ed56a3fa | 338 | TH1 * hisMean=0; |
339 | ||
5813554a | 340 | for (Int_t i=0; i<3; i++){ |
ed56a3fa | 341 | if (i==0) cosmicScan->fHistoDelta[4]->GetAxis(6)->SetRangeUser(-1,1); |
342 | if (i==1) cosmicScan->fHistoDelta[4]->GetAxis(6)->SetRangeUser(0.001,1); | |
343 | if (i==2) cosmicScan->fHistoDelta[4]->GetAxis(6)->SetRangeUser(-1,-0.001); | |
344 | hisRes = (TH1*)GetFit2D(4,7,kTRUE)->Clone(); | |
345 | hisMean = (TH1*)GetFit2D(4,7,kFALSE)->Clone(); | |
346 | hisMean->SetName(Form("#Delta_{1/p_{t}} %s",chsign[i])); | |
347 | hisRes->SetName(Form("#sigma_{1/p_{t}} %s",chsign[i])); | |
348 | hisMean->SetTitle(Form("#Delta_{1/p_{t}} %s",chsign[i])); | |
349 | hisRes->SetTitle(Form("#sigma_{1/p_{t}} %s",chsign[i])); | |
350 | ||
5813554a | 351 | hisRes->SetMarkerStyle(20+i); |
352 | hisMean->SetMarkerStyle(20+i); | |
353 | hisMean->SetMarkerColor(colors[i]); | |
354 | hisRes->SetMarkerColor(colors[i]); | |
ed56a3fa | 355 | hisRes->SetMaximum(0.02); |
5813554a | 356 | hisRes->SetMinimum(-0.0); |
357 | hisMean->SetMaximum(0.02); | |
358 | hisMean->SetMinimum(-0.02); | |
ed56a3fa | 359 | hisRes->SetYTitle("#sigma_{1/pt} (1/GeV)"); |
360 | hisMean->SetYTitle("#Delta_{1/pt} (1/GeV)"); | |
5813554a | 361 | hisMean->SetXTitle("p_{t} (GeV)"); |
362 | hisRes->SetXTitle("p_{t} (GeV)"); | |
ed56a3fa | 363 | hisRes->GetXaxis()->SetRangeUser(0,50); |
364 | hisMean->GetXaxis()->SetRangeUser(0,50); | |
5813554a | 365 | cptRes->cd(2); |
366 | hisRes->Draw("same"); | |
367 | if (i==0) hisRes->Draw(""); | |
368 | cptRes->cd(1); | |
369 | hisMean->Draw("same"); | |
370 | if (i==0) hisMean->Draw(""); | |
ed56a3fa | 371 | legend->AddEntry(hisMean); |
5813554a | 372 | } |
ed56a3fa | 373 | legend->Draw(); |
5813554a | 374 | if (array) array->AddLast(cptRes); |
375 | } | |
376 | ||
377 | ||
378 | ||
379 | ||
380 | ||
381 | ||
712f2cab | 382 | void MakePlotPosY(TObjArray * array){ |
35d81915 | 383 | /// |
384 | ||
ed56a3fa | 385 | TCanvas *cptRes = new TCanvas("TPCPosResolY","TPCPosResolY",900,600); |
712f2cab | 386 | cptRes->Divide(2,1); |
387 | SetStylePad(cptRes->cd(1)); | |
388 | SetStylePad(cptRes->cd(2)); | |
ed56a3fa | 389 | cptRes->cd(1); |
390 | TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,""); | |
391 | ||
712f2cab | 392 | // |
393 | TH1 * hisRes=0; | |
394 | TH1 * hisMean=0; | |
5813554a | 395 | for (Int_t i=0; i<3; i++){ |
ed56a3fa | 396 | if (i==1) cosmicScan->fHistoDelta[0]->GetAxis(6)->SetRangeUser(0.0001,1); |
397 | if (i==2) cosmicScan->fHistoDelta[0]->GetAxis(6)->SetRangeUser(-1,-0.0001); | |
398 | if (i==0) cosmicScan->fHistoDelta[0]->GetAxis(6)->SetRangeUser(-1,1); | |
399 | hisRes = (TH1*)GetFit2D(0,7,kTRUE)->Clone(); | |
400 | hisMean = (TH1*)GetFit2D(0,7,kFALSE)->Clone(); | |
401 | hisMean->SetName(Form("#Delta_{r#phi} %s",chsign[i])); | |
402 | hisRes->SetName(Form("#sigma_{r#phi} %s",chsign[i])); | |
403 | hisMean->SetTitle(Form("#Delta_{r#phi} %s",chsign[i])); | |
404 | hisRes->SetTitle(Form("#sigma_{r#phi} %s",chsign[i])); | |
405 | ||
5813554a | 406 | hisRes->SetMarkerStyle(20+i); |
407 | hisMean->SetMarkerStyle(20+i); | |
408 | hisMean->SetMarkerColor(colors[i]); | |
409 | hisRes->SetMarkerColor(colors[i]); | |
410 | ||
411 | // | |
412 | hisRes->SetMaximum(0.4); | |
413 | hisRes->SetMinimum(0.0); | |
414 | hisMean->SetMaximum(0.4); | |
415 | hisMean->SetMinimum(-0.4); | |
416 | hisRes->SetName("Y resol"); | |
417 | hisRes->SetName("Y resolution"); | |
418 | hisRes->SetYTitle("#sigma_{y} (cm)"); | |
419 | hisMean->SetYTitle("#Delta_{y} (cm)"); | |
ed56a3fa | 420 | hisRes->GetXaxis()->SetRangeUser(0,50); |
421 | hisMean->GetXaxis()->SetRangeUser(0,50); | |
422 | cptRes->cd(2); | |
423 | hisRes->Draw("same"); | |
424 | if (i==0) hisRes->Draw(""); | |
425 | cptRes->cd(1); | |
426 | hisMean->Draw("same"); | |
427 | if (i==0) hisMean->Draw(""); | |
428 | legend->AddEntry(hisMean); | |
429 | } | |
430 | legend->Draw(); | |
431 | if (array) array->AddLast(cptRes); | |
432 | } | |
433 | ||
434 | void MakePlotSnp(TObjArray * array){ | |
35d81915 | 435 | /// |
436 | ||
ed56a3fa | 437 | TCanvas *cptRes = new TCanvas("TPCSnp","TPCSnp",900,600); |
438 | cptRes->Divide(2,1); | |
439 | SetStylePad(cptRes->cd(1)); | |
440 | SetStylePad(cptRes->cd(2)); | |
441 | cptRes->cd(1); | |
442 | TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,""); | |
443 | ||
444 | // | |
445 | TH1 * hisRes=0; | |
446 | TH1 * hisMean=0; | |
447 | for (Int_t i=0; i<3; i++){ | |
448 | if (i==1) cosmicScan->fHistoDelta[2]->GetAxis(6)->SetRangeUser(0.0001,1); | |
449 | if (i==2) cosmicScan->fHistoDelta[2]->GetAxis(6)->SetRangeUser(-1,-0.0001); | |
450 | if (i==0) cosmicScan->fHistoDelta[2]->GetAxis(6)->SetRangeUser(-1,1); | |
451 | hisRes = (TH1*)GetFit2D(2,7,kTRUE)->Clone(); | |
452 | hisMean = (TH1*)GetFit2D(2,7,kFALSE)->Clone(); | |
453 | hisMean->SetName(Form("#Delta_{#phi} %s",chsign[i])); | |
454 | hisRes->SetName(Form("#sigma_{#phi} %s",chsign[i])); | |
455 | hisMean->SetTitle(Form("#Delta_{#phi} %s",chsign[i])); | |
456 | hisRes->SetTitle(Form("#sigma_{#phi} %s",chsign[i])); | |
457 | ||
458 | hisRes->SetMarkerStyle(20+i); | |
459 | hisMean->SetMarkerStyle(20+i); | |
460 | hisMean->SetMarkerColor(colors[i]); | |
461 | hisRes->SetMarkerColor(colors[i]); | |
462 | ||
463 | // | |
464 | hisRes->SetMaximum(4); | |
465 | hisRes->SetMinimum(4); | |
466 | hisMean->SetMaximum(4); | |
467 | hisMean->SetMinimum(-4); | |
468 | hisRes->SetYTitle("#sigma_{#phi} (mrad)"); | |
469 | hisMean->SetYTitle("#Delta_{#phi} (mrad)"); | |
470 | hisRes->GetXaxis()->SetRangeUser(0,50); | |
471 | hisMean->GetXaxis()->SetRangeUser(0,50); | |
472 | cptRes->cd(2); | |
473 | hisRes->Draw("same"); | |
474 | if (i==0) hisRes->Draw(""); | |
475 | cptRes->cd(1); | |
476 | hisMean->Draw("same"); | |
477 | if (i==0) hisMean->Draw(""); | |
478 | legend->AddEntry(hisMean); | |
479 | } | |
480 | legend->Draw(); | |
481 | if (array) array->AddLast(cptRes); | |
482 | } | |
483 | void MakePlotTgl(TObjArray * array){ | |
35d81915 | 484 | /// |
485 | ||
ed56a3fa | 486 | TCanvas *cptRes = new TCanvas("TPCtgl","TPCtgl",900,600); |
487 | cptRes->Divide(2,1); | |
488 | SetStylePad(cptRes->cd(1)); | |
489 | SetStylePad(cptRes->cd(2)); | |
490 | cptRes->cd(1); | |
491 | TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,""); | |
492 | ||
493 | // | |
494 | TH1 * hisRes=0; | |
495 | TH1 * hisMean=0; | |
496 | for (Int_t i=0; i<3; i++){ | |
497 | if (i==1) cosmicScan->fHistoDelta[3]->GetAxis(6)->SetRangeUser(0.0001,1); | |
498 | if (i==2) cosmicScan->fHistoDelta[3]->GetAxis(6)->SetRangeUser(-1,-0.0001); | |
499 | if (i==0) cosmicScan->fHistoDelta[3]->GetAxis(6)->SetRangeUser(-1,1); | |
500 | hisRes = (TH1*)GetFit2D(3,7,kTRUE)->Clone(); | |
501 | hisMean = (TH1*)GetFit2D(3,7,kFALSE)->Clone(); | |
502 | hisMean->SetName(Form("#Delta_{#theta} %s",chsign[i])); | |
503 | hisRes->SetName(Form("#sigma_{#theta} %s",chsign[i])); | |
504 | hisMean->SetTitle(Form("#Delta_{#theta} %s",chsign[i])); | |
505 | hisRes->SetTitle(Form("#sigma_{#theta} %s",chsign[i])); | |
506 | ||
507 | hisRes->SetMarkerStyle(20+i); | |
508 | hisMean->SetMarkerStyle(20+i); | |
509 | hisMean->SetMarkerColor(colors[i]); | |
510 | hisRes->SetMarkerColor(colors[i]); | |
511 | ||
512 | // | |
513 | hisRes->SetMaximum(4); | |
514 | hisRes->SetMinimum(4); | |
515 | hisMean->SetMaximum(4); | |
516 | hisMean->SetMinimum(-4); | |
517 | hisRes->SetYTitle("#sigma_{#theta} (mrad)"); | |
518 | hisMean->SetYTitle("#Delta_{#theta} (mrad)"); | |
519 | hisRes->GetXaxis()->SetRangeUser(0,50); | |
520 | hisMean->GetXaxis()->SetRangeUser(0,50); | |
5813554a | 521 | cptRes->cd(2); |
522 | hisRes->Draw("same"); | |
523 | if (i==0) hisRes->Draw(""); | |
524 | cptRes->cd(1); | |
525 | hisMean->Draw("same"); | |
526 | if (i==0) hisMean->Draw(""); | |
ed56a3fa | 527 | legend->AddEntry(hisMean); |
5813554a | 528 | } |
ed56a3fa | 529 | legend->Draw(); |
712f2cab | 530 | if (array) array->AddLast(cptRes); |
531 | } | |
532 | ||
533 | void MakePlotPosZ(TObjArray * array){ | |
35d81915 | 534 | /// |
535 | ||
ed56a3fa | 536 | TCanvas *cptRes = new TCanvas("TPCPosResolZ","TPCPosResolZ",900,600); |
712f2cab | 537 | cptRes->Divide(2,1); |
538 | SetStylePad(cptRes->cd(1)); | |
539 | SetStylePad(cptRes->cd(2)); | |
ed56a3fa | 540 | cptRes->cd(1); |
541 | TLegend *legend = new TLegend(0.2,0.7,0.6,0.9,""); | |
542 | ||
712f2cab | 543 | // |
544 | TH1 * hisRes=0; | |
545 | TH1 * hisMean=0; | |
5813554a | 546 | for (Int_t i=0; i<3; i++){ |
ed56a3fa | 547 | if (i==1) cosmicScan->fHistoDelta[1]->GetAxis(6)->SetRangeUser(0.001,1.); |
548 | if (i==2) cosmicScan->fHistoDelta[1]->GetAxis(6)->SetRangeUser(-1,-0.001); | |
549 | if (i==0) cosmicScan->fHistoDelta[1]->GetAxis(6)->SetRangeUser(-1,1); | |
5813554a | 550 | |
ed56a3fa | 551 | hisRes = (TH1*)GetFit2D(1,7,kTRUE)->Clone(); |
552 | hisMean = (TH1*)GetFit2D(1,7,kFALSE)->Clone(); | |
553 | hisMean->SetName(Form("#Delta_{z} %s",chsign[i])); | |
554 | hisRes->SetName(Form("#sigma_{z} %s",chsign[i])); | |
555 | hisMean->SetTitle(Form("#Delta_{z} %s",chsign[i])); | |
556 | hisRes->SetTitle(Form("#sigma_{z} %s",chsign[i])); | |
557 | ||
558 | ||
5813554a | 559 | hisRes->SetMaximum(0.4); |
560 | hisRes->SetMinimum(0.0); | |
561 | hisMean->SetMaximum(0.2); | |
562 | hisMean->SetMinimum(-0.2); | |
563 | hisRes->SetMarkerStyle(20); | |
564 | hisMean->SetMarkerStyle(20); | |
565 | hisRes->SetMarkerColor(colors[i]); | |
566 | hisMean->SetMarkerColor(colors[i]); | |
567 | ||
568 | hisRes->SetName("Z resol"); | |
569 | hisRes->SetName("Z resolution"); | |
570 | hisRes->SetYTitle("#sigma_{z} (cm)"); | |
571 | hisMean->SetYTitle("#Delta_{z} (cm)"); | |
ed56a3fa | 572 | hisRes->GetXaxis()->SetRangeUser(0,50); |
573 | hisMean->GetXaxis()->SetRangeUser(0,50); | |
5813554a | 574 | cptRes->cd(2); |
575 | hisRes->Draw("same"); | |
576 | if (i==0) hisRes->Draw(); | |
577 | cptRes->cd(1); | |
578 | hisMean->Draw("same"); | |
579 | if (i==0) hisMean->Draw(); | |
ed56a3fa | 580 | legend->AddEntry(hisMean); |
5813554a | 581 | } |
ed56a3fa | 582 | legend->Draw(); |
712f2cab | 583 | if (array) array->AddLast(cptRes); |
584 | } | |
585 | ||
586 | ||
587 | void MakeDefaultPlots(){ | |
35d81915 | 588 | /// |
589 | ||
ed56a3fa | 590 | gStyle->SetOptStat(1100); |
712f2cab | 591 | DrawStat(0,picArray); |
ed56a3fa | 592 | gStyle->SetOptStat(0); |
712f2cab | 593 | MakePlotPosY(picArray); |
594 | MakePlotPosZ(picArray); | |
ed56a3fa | 595 | MakePlotSnp(picArray); |
596 | MakePlotTgl(picArray); | |
5813554a | 597 | MakePlotP4(picArray); |
ed56a3fa | 598 | MakePlotPt(picArray); |
599 | // | |
600 | ||
712f2cab | 601 | TFile f("cosmicPlots.root","recreate"); |
602 | picArray->Write("CosmicPlots",TObject::kSingleKey); | |
603 | f.Close(); | |
5813554a | 604 | TPostScript *ps=new TPostScript("cosmicPerformance.ps", 112); |
ed56a3fa | 605 | ps->NewPage(); |
5813554a | 606 | for (Int_t ipad=0;ipad<picArray->GetEntries();ipad++){ |
ed56a3fa | 607 | TCanvas *c =dynamic_cast<TCanvas*> (picArray->At(ipad)); |
5813554a | 608 | if (c) { |
5813554a | 609 | c->Draw(); |
610 | c->Update(); | |
ed56a3fa | 611 | ps->NewPage(); |
5813554a | 612 | } |
613 | } | |
614 | ps->Close(); | |
615 | delete ps; | |
712f2cab | 616 | } |