]>
Commit | Line | Data |
---|---|---|
77203477 | 1 | /************************************************************************** |
d2381af5 | 2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercialf purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
77203477 | 15 | |
16 | /* $Id: AliTRDtrackingResolution.cxx 27496 2008-07-22 08:35:45Z cblume $ */ | |
17 | ||
18 | //////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
017bd6af | 20 | // TRD tracking resolution // |
21 | // | |
22 | // The class performs resolution and residual studies | |
23 | // of the TRD tracks for the following quantities : | |
24 | // - spatial position (y, [z]) | |
25 | // - angular (phi) tracklet | |
26 | // - momentum at the track level | |
27 | // | |
28 | // The class has to be used for regular detector performance checks using the official macros: | |
29 | // - $ALICE_ROOT/TRD/qaRec/run.C | |
30 | // - $ALICE_ROOT/TRD/qaRec/makeResults.C | |
31 | // | |
32 | // For stand alone usage please refer to the following example: | |
33 | // { | |
34 | // gSystem->Load("libANALYSIS.so"); | |
35 | // gSystem->Load("libTRDqaRec.so"); | |
36 | // AliTRDtrackingResolution *res = new AliTRDtrackingResolution(); | |
37 | // //res->SetMCdata(); | |
38 | // //res->SetVerbose(); | |
39 | // //res->SetVisual(); | |
40 | // res->Load("TRD.TaskResolution.root"); | |
41 | // if(!res->PostProcess()) return; | |
42 | // res->GetRefFigure(0); | |
43 | // } | |
44 | // | |
77203477 | 45 | // Authors: // |
017bd6af | 46 | // Alexandru Bercuci <A.Bercuci@gsi.de> // |
77203477 | 47 | // Markus Fasel <M.Fasel@gsi.de> // |
48 | // // | |
49 | //////////////////////////////////////////////////////////////////////////// | |
50 | ||
aaf47b30 | 51 | #include <cstring> |
52 | ||
124d488a | 53 | #include <TROOT.h> |
017bd6af | 54 | #include <TSystem.h> |
77203477 | 55 | #include <TObjArray.h> |
7102d1b1 | 56 | #include <TH2.h> |
57 | #include <TH1.h> | |
58 | #include <TF1.h> | |
017bd6af | 59 | #include <TCanvas.h> |
b2dc316d | 60 | #include <TBox.h> |
77203477 | 61 | #include <TProfile.h> |
7102d1b1 | 62 | #include <TGraphErrors.h> |
77203477 | 63 | #include <TMath.h> |
aaf47b30 | 64 | #include "TTreeStream.h" |
65 | #include "TGeoManager.h" | |
77203477 | 66 | |
67 | #include "AliAnalysisManager.h" | |
77203477 | 68 | #include "AliTrackReference.h" |
aaf47b30 | 69 | #include "AliTrackPointArray.h" |
70 | #include "AliCDBManager.h" | |
71 | ||
9605ce80 | 72 | #include "AliTRDSimParam.h" |
73 | #include "AliTRDgeometry.h" | |
74 | #include "AliTRDpadPlane.h" | |
aaf47b30 | 75 | #include "AliTRDcluster.h" |
76 | #include "AliTRDseedV1.h" | |
77 | #include "AliTRDtrackV1.h" | |
78 | #include "AliTRDtrackerV1.h" | |
79 | #include "AliTRDReconstructor.h" | |
80 | #include "AliTRDrecoParam.h" | |
77203477 | 81 | |
b2dc316d | 82 | #include "AliTRDtrackInfo/AliTRDclusterInfo.h" |
77203477 | 83 | #include "AliTRDtrackInfo/AliTRDtrackInfo.h" |
84 | #include "AliTRDtrackingResolution.h" | |
85 | ||
77203477 | 86 | ClassImp(AliTRDtrackingResolution) |
87 | ||
88 | //________________________________________________________ | |
3d86166d | 89 | AliTRDtrackingResolution::AliTRDtrackingResolution() |
90 | :AliTRDrecoTask("Resolution", "Tracking Resolution") | |
017bd6af | 91 | ,fStatus(0) |
aaf47b30 | 92 | ,fReconstructor(0x0) |
9605ce80 | 93 | ,fGeo(0x0) |
b718144c | 94 | ,fGraphS(0x0) |
95 | ,fGraphM(0x0) | |
b2dc316d | 96 | ,fClResiduals(0x0) |
251a1ae6 | 97 | ,fTrkltResiduals(0x0) |
98 | ,fTrkltPhiResiduals(0x0) | |
b2dc316d | 99 | ,fClResolution(0x0) |
100 | ,fTrkltResolution(0x0) | |
77203477 | 101 | { |
aaf47b30 | 102 | fReconstructor = new AliTRDReconstructor(); |
103 | fReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam()); | |
9605ce80 | 104 | fGeo = new AliTRDgeometry(); |
b2dc316d | 105 | |
de520d8f | 106 | InitFunctorList(); |
b2dc316d | 107 | |
108 | DefineOutput(1+kClusterResidual, TObjArray::Class()); | |
251a1ae6 | 109 | DefineOutput(1+kTrackletYResidual, TObjArray::Class()); |
110 | DefineOutput(1+kTrackletPhiResidual, TObjArray::Class()); | |
b2dc316d | 111 | DefineOutput(1+kClusterResolution, TObjArray::Class()); |
112 | DefineOutput(1+kTrackletYResolution, TObjArray::Class()); | |
77203477 | 113 | } |
114 | ||
ed383798 | 115 | //________________________________________________________ |
116 | AliTRDtrackingResolution::~AliTRDtrackingResolution() | |
117 | { | |
b718144c | 118 | if(fGraphS){fGraphS->Delete(); delete fGraphS;} |
119 | if(fGraphM){fGraphM->Delete(); delete fGraphM;} | |
9605ce80 | 120 | delete fGeo; |
ed383798 | 121 | delete fReconstructor; |
2c0cf367 | 122 | if(gGeoManager) delete gGeoManager; |
b2dc316d | 123 | if(fClResiduals){fClResiduals->Delete(); delete fClResiduals;} |
251a1ae6 | 124 | if(fTrkltResiduals){fTrkltResiduals->Delete(); delete fTrkltResiduals;} |
125 | if(fTrkltPhiResiduals){fTrkltPhiResiduals->Delete(); delete fTrkltPhiResiduals;} | |
94f34623 | 126 | if(fClResolution){ |
127 | fClResolution->Delete(); | |
128 | delete fClResolution; | |
129 | } | |
b2dc316d | 130 | if(fTrkltResolution){fTrkltResolution->Delete(); delete fTrkltResolution;} |
ed383798 | 131 | } |
132 | ||
77203477 | 133 | |
134 | //________________________________________________________ | |
135 | void AliTRDtrackingResolution::CreateOutputObjects() | |
136 | { | |
137 | // spatial resolution | |
77203477 | 138 | OpenFile(0, "RECREATE"); |
39779ce6 | 139 | |
3d86166d | 140 | fContainer = Histos(); |
b2dc316d | 141 | |
142 | fClResiduals = new TObjArray(); | |
143 | fClResiduals->SetOwner(kTRUE); | |
251a1ae6 | 144 | fTrkltResiduals = new TObjArray(); |
145 | fTrkltResiduals->SetOwner(kTRUE); | |
146 | fTrkltPhiResiduals = new TObjArray(); | |
147 | fTrkltPhiResiduals->SetOwner(kTRUE); | |
b2dc316d | 148 | fClResolution = new TObjArray(); |
149 | fClResolution->SetOwner(kTRUE); | |
150 | fTrkltResolution = new TObjArray(); | |
151 | fTrkltResolution->SetOwner(kTRUE); | |
77203477 | 152 | } |
153 | ||
b2dc316d | 154 | //________________________________________________________ |
155 | void AliTRDtrackingResolution::Exec(Option_t *opt) | |
156 | { | |
157 | fClResiduals->Delete(); | |
251a1ae6 | 158 | fTrkltResiduals->Delete(); |
159 | fTrkltPhiResiduals->Delete(); | |
b2dc316d | 160 | fClResolution->Delete(); |
161 | fTrkltResolution->Delete(); | |
162 | ||
163 | AliTRDrecoTask::Exec(opt); | |
164 | ||
165 | PostData(1+kClusterResidual, fClResiduals); | |
251a1ae6 | 166 | PostData(1+kTrackletYResidual, fTrkltResiduals); |
167 | PostData(1+kTrackletPhiResidual, fTrkltPhiResiduals); | |
b2dc316d | 168 | PostData(1+kClusterResolution, fClResolution); |
169 | PostData(1+kTrackletYResolution, fTrkltResolution); | |
170 | } | |
aaf47b30 | 171 | |
de520d8f | 172 | //________________________________________________________ |
173 | TH1* AliTRDtrackingResolution::PlotClusterResiduals(const AliTRDtrackV1 *track) | |
174 | { | |
74b2e03d | 175 | if(track) fTrack = track; |
176 | if(!fTrack){ | |
177 | AliWarning("No Track defined."); | |
178 | return 0x0; | |
de520d8f | 179 | } |
180 | TH1 *h = 0x0; | |
181 | if(!(h = ((TH2I*)fContainer->At(kClusterResidual)))){ | |
182 | AliWarning("No output histogram defined."); | |
183 | return 0x0; | |
184 | } | |
185 | ||
de520d8f | 186 | Float_t x0, y0, z0, dy, dydx, dzdx; |
187 | AliTRDseedV1 *fTracklet = 0x0; | |
188 | for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){ | |
189 | if(!(fTracklet = fTrack->GetTracklet(ily))) continue; | |
190 | if(!fTracklet->IsOK()) continue; | |
de520d8f | 191 | x0 = fTracklet->GetX0(); |
192 | ||
193 | // retrive the track angle with the chamber | |
0b8bcca4 | 194 | y0 = fTracklet->GetYref(0); |
195 | z0 = fTracklet->GetZref(0); | |
196 | dydx = fTracklet->GetYref(1); | |
197 | dzdx = fTracklet->GetZref(1); | |
251a1ae6 | 198 | Float_t tilt = fTracklet->GetTilt(); |
de520d8f | 199 | AliTRDcluster *c = 0x0; |
200 | fTracklet->ResetClusterIter(kFALSE); | |
201 | while((c = fTracklet->PrevCluster())){ | |
0b8bcca4 | 202 | Float_t xc = c->GetX(); |
203 | Float_t yc = c->GetY(); | |
204 | Float_t zc = c->GetZ(); | |
205 | Float_t dx = x0 - xc; | |
206 | Float_t yt = y0 - dx*dydx; | |
207 | Float_t zt = z0 - dx*dzdx; | |
208 | dy = yt - (yc - tilt*(zc-zt)); | |
209 | ||
210 | //dy = trklt.GetYat(c->GetX()) - c->GetY(); | |
de520d8f | 211 | h->Fill(dydx, dy); |
212 | ||
213 | if(fDebugLevel>=1){ | |
de520d8f | 214 | // Get z-position with respect to anode wire |
215 | AliTRDSimParam *simParam = AliTRDSimParam::Instance(); | |
0b8bcca4 | 216 | Int_t istk = fGeo->GetStack(c->GetDetector()); |
de520d8f | 217 | AliTRDpadPlane *pp = fGeo->GetPadPlane(ily, istk); |
218 | Float_t row0 = pp->GetRow0(); | |
0b8bcca4 | 219 | Float_t d = row0 - zt + simParam->GetAnodeWireOffset(); |
de520d8f | 220 | d -= ((Int_t)(2 * d)) / 2.0; |
221 | if (d > 0.25) d = 0.5 - d; | |
b2dc316d | 222 | |
94f34623 | 223 | /* AliTRDclusterInfo *clInfo = new AliTRDclusterInfo; |
0b8bcca4 | 224 | fClResiduals->Add(clInfo); |
225 | clInfo->SetCluster(c); | |
226 | clInfo->SetGlobalPosition(yt, zt, dydx, dzdx); | |
227 | clInfo->SetResolution(dy); | |
228 | clInfo->SetAnisochronity(d); | |
229 | clInfo->SetDriftLength(dx); | |
230 | (*fDebugStream) << "ClusterResiduals" | |
231 | <<"clInfo.=" << clInfo | |
94f34623 | 232 | << "\n";*/ |
de520d8f | 233 | } |
234 | } | |
235 | } | |
236 | return h; | |
237 | } | |
238 | ||
251a1ae6 | 239 | |
240 | //________________________________________________________ | |
241 | TH1* AliTRDtrackingResolution::PlotTrackletResiduals(const AliTRDtrackV1 *track) | |
242 | { | |
243 | if(track) fTrack = track; | |
244 | if(!fTrack){ | |
245 | AliWarning("No Track defined."); | |
246 | return 0x0; | |
247 | } | |
248 | TH1 *h = 0x0; | |
249 | if(!(h = ((TH2I*)fContainer->At(kTrackletYResidual)))){ | |
250 | AliWarning("No output histogram defined."); | |
251 | return 0x0; | |
252 | } | |
253 | ||
67d88516 | 254 | AliTRDseedV1 *tracklet = 0x0; |
255 | for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ | |
256 | if(!(tracklet = fTrack->GetTracklet(il))) continue; | |
257 | if(!tracklet->IsOK()) continue; | |
bcdbe5e5 | 258 | h->Fill(tracklet->GetYref(1), tracklet->GetYref(0)-tracklet->GetYfit(0)); |
251a1ae6 | 259 | } |
260 | return h; | |
bcdbe5e5 | 261 | |
262 | // refit the track | |
263 | // AliRieman fRim(fTrack->GetNumberOfClusters()); | |
264 | // Float_t x[AliTRDgeometry::kNlayer] = {-1., -1., -1., -1., -1., -1.}, y[AliTRDgeometry::kNlayer], dydx[AliTRDgeometry::kNlayer]; | |
265 | ||
266 | // AliTRDcluster *c = 0x0; | |
267 | // tracklet->ResetClusterIter(kFALSE); | |
268 | // while((c = tracklet->PrevCluster())){ | |
269 | // Float_t xc = c->GetX(); | |
270 | // Float_t yc = c->GetY(); | |
271 | // Float_t zc = c->GetZ(); | |
272 | // Float_t zt = tracklet->GetZref(0) - (tracklet->GetX0()-xc)*tracklet->GetZref(1); | |
273 | // yc -= tracklet->GetTilt()*(zc-zt); | |
274 | // fRim.AddPoint(xc, yc, zc, 1, 10); | |
275 | // } | |
276 | // tracklet->Fit(kTRUE); | |
277 | // | |
278 | // x[il] = tracklet->GetX0(); | |
279 | // y[il] = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x[il]); | |
280 | // dydx[il] = tracklet->GetYref(1); | |
281 | ||
282 | ||
283 | // fRim.Update(); | |
284 | ||
285 | // for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ | |
286 | // if(x[il] < 0.) continue; | |
287 | // Float_t dy = y[il]-fRim.GetYat(x[il])/*/sigma_track*/; | |
288 | // h->Fill(dydx[il], dy); | |
289 | // | |
290 | // if(fDebugLevel>=1){ | |
291 | // Double_t sigmay = fRim.GetErrY(x[il]); | |
292 | // Float_t yt = fRim.GetYat(x[il]); | |
293 | // (*fDebugStream) << "TrkltResiduals" | |
294 | // << "layer=" << il | |
295 | // << "x=" << x[il] | |
296 | // << "y=" << y[il] | |
297 | // << "yt=" << yt | |
298 | // << "dydx=" << dydx[il] | |
299 | // << "dy=" << dy | |
300 | // << "sigmay=" << sigmay | |
301 | // << "\n"; | |
302 | // } | |
303 | // } | |
251a1ae6 | 304 | } |
305 | ||
306 | //________________________________________________________ | |
307 | TH1* AliTRDtrackingResolution::PlotTrackletPhiResiduals(const AliTRDtrackV1 *track) | |
308 | { | |
309 | if(track) fTrack = track; | |
310 | if(!fTrack){ | |
311 | AliWarning("No Track defined."); | |
312 | return 0x0; | |
313 | } | |
314 | TH1 *h = 0x0; | |
315 | if(!(h = ((TH2I*)fContainer->At(kTrackletPhiResidual)))){ | |
316 | AliWarning("No output histogram defined."); | |
317 | return 0x0; | |
318 | } | |
a37c3c70 | 319 | |
bcdbe5e5 | 320 | AliTRDseedV1 *tracklet = 0x0; |
a37c3c70 | 321 | for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ |
a37c3c70 | 322 | if(!(tracklet = fTrack->GetTracklet(il))) continue; |
323 | if(!tracklet->IsOK()) continue; | |
bcdbe5e5 | 324 | h->Fill(tracklet->GetYref(1), TMath::ATan(tracklet->GetYref(1))-TMath::ATan(tracklet->GetYfit(1))); |
251a1ae6 | 325 | } |
326 | return h; | |
bcdbe5e5 | 327 | |
328 | // // refit the track | |
329 | // AliRieman fRim(fTrack->GetNumberOfClusters()); | |
330 | // Float_t x[AliTRDgeometry::kNlayer] = {-1., -1., -1., -1., -1., -1.}, y[AliTRDgeometry::kNlayer], dydx[AliTRDgeometry::kNlayer]; | |
331 | // Float_t dydx_ref=0, dydx_fit=0, phiref=0, phifit=0, phidiff=0; | |
332 | // AliTRDseedV1 *tracklet = 0x0; | |
333 | // for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ | |
334 | // if(!(tracklet = fTrack->GetTracklet(il))) continue; | |
335 | // if(!tracklet->IsOK()) continue; | |
336 | // AliTRDcluster *c = 0x0; | |
337 | // tracklet->ResetClusterIter(kFALSE); | |
338 | // while((c = tracklet->PrevCluster())){ | |
339 | // Float_t xc = c->GetX(); | |
340 | // Float_t yc = c->GetY(); | |
341 | // Float_t zc = c->GetZ(); | |
342 | // Float_t zt = tracklet->GetZref(0) - (tracklet->GetX0()-xc)*tracklet->GetZref(1); | |
343 | // yc -= tracklet->GetTilt()*(zc-zt); | |
344 | // fRim.AddPoint(xc, yc, zc, 1, 10); | |
345 | // } | |
346 | // tracklet->Fit(kTRUE); | |
347 | // | |
348 | // x[il] = tracklet->GetX0(); | |
349 | // y[il] = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x[il]); | |
350 | // dydx[il] = tracklet->GetYref(1); | |
351 | // } | |
352 | // fRim.Update(); | |
353 | // | |
354 | // for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ | |
355 | // if(x[il] < 0.) continue; | |
356 | // if(!(tracklet = fTrack->GetTracklet(il))) continue; | |
357 | // if(!tracklet->IsOK()) continue; | |
358 | // | |
359 | // dydx_ref = fRim.GetDYat(x[il]); | |
360 | // dydx_fit = tracklet->GetYfit(1); | |
361 | // | |
362 | // phiref = TMath::ATan(dydx_ref);//*TMath::RadToDeg(); | |
363 | // phifit = TMath::ATan(dydx_fit);//*TMath::RadToDeg(); | |
364 | // | |
365 | // phidiff = phiref-phifit; /*/sigma_phi*/; | |
366 | // | |
367 | // h->Fill(dydx_ref, phidiff); | |
368 | // | |
369 | // | |
370 | // if(fDebugLevel>=1){ | |
371 | // (*fDebugStream) << "TrkltPhiResiduals" | |
372 | // << "layer=" << il | |
373 | // << "dydx_fit=" << dydx_fit | |
374 | // << "dydx_ref=" << dydx_ref | |
375 | // << "phiref=" << phiref | |
376 | // << "phifit=" << phifit | |
377 | // << "phidiff=" << phidiff | |
378 | // << "\n"; | |
379 | // } | |
380 | // } | |
251a1ae6 | 381 | } |
382 | ||
383 | ||
de520d8f | 384 | //________________________________________________________ |
385 | TH1* AliTRDtrackingResolution::PlotResolution(const AliTRDtrackV1 *track) | |
386 | { | |
c0811145 | 387 | if(!HasMCdata()){ |
74b2e03d | 388 | AliWarning("No MC defined. Results will not be available."); |
de520d8f | 389 | return 0x0; |
390 | } | |
74b2e03d | 391 | if(track) fTrack = track; |
392 | if(!fTrack){ | |
393 | AliWarning("No Track defined."); | |
394 | return 0x0; | |
de520d8f | 395 | } |
396 | TH1 *h = 0x0; | |
397 | if(!(h = ((TH2I*)fContainer->At(kClusterResolution)))){ | |
398 | AliWarning("No output histogram defined."); | |
399 | return 0x0; | |
400 | } | |
401 | if(!(h = ((TH2I*)fContainer->At(kTrackletYResolution)))){ | |
402 | AliWarning("No output histogram defined."); | |
403 | return 0x0; | |
404 | } | |
405 | if(!(h = ((TH2I*)fContainer->At(kTrackletZResolution)))){ | |
406 | AliWarning("No output histogram defined."); | |
407 | return 0x0; | |
408 | } | |
409 | if(!(h = ((TH2I*)fContainer->At(kTrackletAngleResolution)))){ | |
410 | AliWarning("No output histogram defined."); | |
411 | return 0x0; | |
412 | } | |
413 | //printf("called for %d tracklets ... \n", fTrack->GetNumberOfTracklets()); | |
612ae7ed | 414 | UChar_t s; |
de520d8f | 415 | Int_t pdg = fMC->GetPDG(), det=-1; |
0b8bcca4 | 416 | Int_t label = fMC->GetLabel(); |
a37c3c70 | 417 | Float_t x0, y0, z0, dx, dy, dydx, dzdx; |
de520d8f | 418 | AliTRDseedV1 *fTracklet = 0x0; |
419 | for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){ | |
420 | if(!(fTracklet = fTrack->GetTracklet(ily))) continue; | |
421 | if(!fTracklet->IsOK()) continue; | |
422 | //printf("process layer[%d]\n", ily); | |
423 | // retrive the track position and direction within the chamber | |
424 | det = fTracklet->GetDetector(); | |
425 | x0 = fTracklet->GetX0(); | |
612ae7ed | 426 | if(!fMC->GetDirections(x0, y0, z0, dydx, dzdx, s)) continue; |
de520d8f | 427 | |
428 | // recalculate tracklet based on the MC info | |
429 | AliTRDseedV1 tt(*fTracklet); | |
430 | tt.SetZref(0, z0); | |
431 | tt.SetZref(1, dzdx); | |
9d439952 | 432 | if(!tt.Fit(kTRUE)) continue; |
612ae7ed | 433 | //tt.Update(); |
a37c3c70 | 434 | |
435 | dx = 0.;//x0 - tt.GetXref(); | |
436 | Float_t yt = y0 - dx*dydx; | |
94f34623 | 437 | Float_t yf = tt.GetYfit(0) - (fTracklet->GetX0() - x0)*tt.GetYfit(1); |
a37c3c70 | 438 | dy = yf-yt; |
de520d8f | 439 | Float_t dphi = TMath::ATan(tt.GetYfit(1)) - TMath::ATan(dydx); |
440 | Float_t dz = 100.; | |
441 | Bool_t cross = fTracklet->GetNChange(); | |
442 | if(cross){ | |
443 | Double_t *xyz = tt.GetCrossXYZ(); | |
444 | dz = xyz[2] - (z0 - (x0 - xyz[0])*dzdx) ; | |
612ae7ed | 445 | ((TH2I*)fContainer->At(kTrackletZResolution))->Fill(dzdx, dz); |
de520d8f | 446 | } |
447 | ||
448 | // Fill Histograms | |
449 | ((TH2I*)fContainer->At(kTrackletYResolution))->Fill(dydx, dy); | |
450 | ((TH2I*)fContainer->At(kTrackletAngleResolution))->Fill(dydx, dphi*TMath::RadToDeg()); | |
39779ce6 | 451 | |
de520d8f | 452 | // Fill Debug stream |
453 | if(fDebugLevel>=1){ | |
06b2847e | 454 | Float_t p = fMC->GetTrackRef() ? fMC->GetTrackRef()->P() : -1.; |
de520d8f | 455 | (*fDebugStream) << "TrkltResolution" |
456 | << "det=" << det | |
457 | << "pdg=" << pdg | |
458 | << "p=" << p | |
459 | << "ymc=" << y0 | |
460 | << "zmc=" << z0 | |
461 | << "dydx=" << dydx | |
462 | << "dzdx=" << dzdx | |
463 | << "cross=" << cross | |
464 | << "dy=" << dy | |
465 | << "dz=" << dz | |
466 | << "dphi=" << dphi | |
467 | << "\n"; | |
468 | } | |
39779ce6 | 469 | |
de520d8f | 470 | Int_t istk = AliTRDgeometry::GetStack(det); |
471 | AliTRDpadPlane *pp = fGeo->GetPadPlane(ily, istk); | |
cf194b94 | 472 | Float_t zr0 = pp->GetRow0() + AliTRDSimParam::Instance()->GetAnodeWireOffset(); |
de520d8f | 473 | Float_t tilt = fTracklet->GetTilt(); |
474 | ||
475 | AliTRDcluster *c = 0x0; | |
476 | fTracklet->ResetClusterIter(kFALSE); | |
477 | while((c = fTracklet->PrevCluster())){ | |
478 | Float_t q = TMath::Abs(c->GetQ()); | |
479 | Float_t xc = c->GetX(); | |
480 | Float_t yc = c->GetY(); | |
481 | Float_t zc = c->GetZ(); | |
a37c3c70 | 482 | dx = x0 - xc; |
de520d8f | 483 | Float_t yt = y0 - dx*dydx; |
484 | Float_t zt = z0 - dx*dzdx; | |
485 | dy = yt - (yc - tilt*(zc-zt)); | |
486 | ||
487 | // Fill Histograms | |
94f34623 | 488 | if(q>20. && q<250.) ((TH2I*)fContainer->At(kClusterResolution))->Fill(dydx, dy); |
de520d8f | 489 | |
490 | // Fill Debug Tree | |
491 | if(fDebugLevel>=1){ | |
cf194b94 | 492 | Float_t d = zr0 - zt; |
de520d8f | 493 | d -= ((Int_t)(2 * d)) / 2.0; |
494 | if (d > 0.25) d = 0.5 - d; | |
b2dc316d | 495 | |
496 | AliTRDclusterInfo *clInfo = new AliTRDclusterInfo; | |
497 | fClResolution->Add(clInfo); | |
498 | clInfo->SetCluster(c); | |
499 | clInfo->SetMC(pdg, label); | |
500 | clInfo->SetGlobalPosition(yt, zt, dydx, dzdx); | |
501 | clInfo->SetResolution(dy); | |
502 | clInfo->SetAnisochronity(d); | |
94f34623 | 503 | clInfo->SetDriftLength(dx); |
504 | clInfo->SetTilt(tilt); | |
b2dc316d | 505 | //clInfo->Print(); |
de520d8f | 506 | (*fDebugStream) << "ClusterResolution" |
b2dc316d | 507 | <<"clInfo.=" << clInfo |
de520d8f | 508 | << "\n"; |
509 | } | |
510 | } | |
77203477 | 511 | } |
de520d8f | 512 | return h; |
77203477 | 513 | } |
514 | ||
de520d8f | 515 | |
d85cd79c | 516 | //________________________________________________________ |
e15179be | 517 | Bool_t AliTRDtrackingResolution::GetRefFigure(Int_t ifig) |
d85cd79c | 518 | { |
b2dc316d | 519 | TBox *b = 0x0; |
a391a274 | 520 | TAxis *ax = 0x0; |
521 | TGraphErrors *g = 0x0; | |
d85cd79c | 522 | switch(ifig){ |
de520d8f | 523 | case kClusterResidual: |
524 | if(!(g = (TGraphErrors*)fGraphS->At(ifig))) break; | |
a391a274 | 525 | g->Draw("apl"); |
526 | ax = g->GetHistogram()->GetYaxis(); | |
a37c3c70 | 527 | ax->SetRangeUser(-.5, 2.5); |
a391a274 | 528 | ax->SetTitle("Clusters Y Residuals #sigma/#mu [mm]"); |
529 | ax = g->GetHistogram()->GetXaxis(); | |
017bd6af | 530 | ax->SetTitle("tg(#phi)"); |
de520d8f | 531 | if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; |
017bd6af | 532 | g->Draw("pl"); |
b2dc316d | 533 | b = new TBox(-.15, -.5, .15, 1.); |
534 | b->SetFillStyle(3002);b->SetFillColor(kGreen); | |
535 | b->SetLineColor(0); b->Draw(); | |
e15179be | 536 | return kTRUE; |
251a1ae6 | 537 | case kTrackletYResidual: |
538 | if(!(g = (TGraphErrors*)fGraphS->At(ifig))) break; | |
539 | g->Draw("apl"); | |
540 | ax = g->GetHistogram()->GetYaxis(); | |
a37c3c70 | 541 | ax->SetRangeUser(-.5, 3.); |
251a1ae6 | 542 | ax->SetTitle("Tracklet Y Residuals #sigma/#mu [mm]"); |
543 | ax = g->GetHistogram()->GetXaxis(); | |
544 | ax->SetTitle("tg(#phi)"); | |
545 | if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; | |
546 | g->Draw("pl"); | |
547 | b = new TBox(-.15, -.5, .15, 1.); | |
548 | b->SetFillStyle(3002);b->SetFillColor(kGreen); | |
549 | b->SetLineColor(0); b->Draw(); | |
e15179be | 550 | return kTRUE; |
251a1ae6 | 551 | case kTrackletPhiResidual: |
552 | if(!(g = (TGraphErrors*)fGraphS->At(ifig))) break; | |
553 | g->Draw("apl"); | |
554 | ax = g->GetHistogram()->GetYaxis(); | |
a37c3c70 | 555 | ax->SetRangeUser(-.5, 2.); |
556 | ax->SetTitle("Tracklet Phi Residuals #sigma/#mu [rad]"); | |
251a1ae6 | 557 | ax = g->GetHistogram()->GetXaxis(); |
558 | ax->SetTitle("tg(#phi)"); | |
559 | if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; | |
560 | g->Draw("pl"); | |
561 | b = new TBox(-.15, -.5, .15, 1.); | |
562 | b->SetFillStyle(3002);b->SetFillColor(kGreen); | |
563 | b->SetLineColor(0); b->Draw(); | |
e15179be | 564 | return kTRUE; |
de520d8f | 565 | case kClusterResolution: |
566 | if(!(g = (TGraphErrors*)fGraphS->At(ifig))) break; | |
a391a274 | 567 | ax = g->GetHistogram()->GetYaxis(); |
b718144c | 568 | ax->SetRangeUser(-.5, 1.); |
569 | ax->SetTitle("Cluster Y Resolution #sigma/#mu [mm]"); | |
570 | ax = g->GetHistogram()->GetXaxis(); | |
017bd6af | 571 | ax->SetTitle("tg(#phi)"); |
b718144c | 572 | g->Draw("apl"); |
de520d8f | 573 | if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; |
017bd6af | 574 | g->Draw("pl"); |
b2dc316d | 575 | b = new TBox(-.15, -.5, .15, 1.); |
576 | b->SetFillStyle(3002);b->SetFillColor(kGreen); | |
577 | b->SetLineColor(0); b->Draw(); | |
e15179be | 578 | return kTRUE; |
b718144c | 579 | case kTrackletYResolution: |
de520d8f | 580 | if(!(g = (TGraphErrors*)fGraphS->At(ifig))) break; |
b718144c | 581 | ax = g->GetHistogram()->GetYaxis(); |
582 | ax->SetRangeUser(-.5, 1.); | |
a391a274 | 583 | ax->SetTitle("Tracklet Y Resolution #sigma/#mu [mm]"); |
584 | ax = g->GetHistogram()->GetXaxis(); | |
612ae7ed | 585 | ax->SetTitle("tg(#phi)"); |
de520d8f | 586 | g->Draw("apl"); |
587 | if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; | |
588 | g->Draw("pl"); | |
e15179be | 589 | return kTRUE; |
de520d8f | 590 | case kTrackletZResolution: |
591 | if(!(g = (TGraphErrors*)fGraphS->At(ifig))) break; | |
592 | ax = g->GetHistogram()->GetYaxis(); | |
593 | ax->SetRangeUser(-.5, 1.); | |
594 | ax->SetTitle("Tracklet Z Resolution #sigma/#mu [mm]"); | |
595 | ax = g->GetHistogram()->GetXaxis(); | |
612ae7ed | 596 | ax->SetTitle("tg(#theta)"); |
a391a274 | 597 | g->Draw("apl"); |
de520d8f | 598 | if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; |
017bd6af | 599 | g->Draw("pl"); |
e15179be | 600 | return kTRUE; |
b718144c | 601 | case kTrackletAngleResolution: |
de520d8f | 602 | if(!(g = (TGraphErrors*)fGraphS->At(ifig))) break; |
a391a274 | 603 | ax = g->GetHistogram()->GetYaxis(); |
017bd6af | 604 | ax->SetRangeUser(-.05, .2); |
605 | ax->SetTitle("Tracklet Angular Resolution #sigma/#mu [deg]"); | |
a391a274 | 606 | ax = g->GetHistogram()->GetXaxis(); |
de520d8f | 607 | ax->SetTitle("tg(#phi)"); |
a391a274 | 608 | g->Draw("apl"); |
de520d8f | 609 | if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; |
017bd6af | 610 | g->Draw("pl"); |
e15179be | 611 | return kTRUE; |
b718144c | 612 | default: |
613 | AliInfo(Form("Reference plot [%d] not implemented yet", ifig)); | |
e15179be | 614 | return kFALSE; |
d85cd79c | 615 | } |
017bd6af | 616 | AliInfo(Form("Reference plot [%d] missing result", ifig)); |
e15179be | 617 | return kFALSE; |
d85cd79c | 618 | } |
619 | ||
39779ce6 | 620 | |
77203477 | 621 | //________________________________________________________ |
d85cd79c | 622 | Bool_t AliTRDtrackingResolution::PostProcess() |
7102d1b1 | 623 | { |
d85cd79c | 624 | //fContainer = dynamic_cast<TObjArray*>(GetOutputData(0)); |
625 | if (!fContainer) { | |
626 | Printf("ERROR: list not available"); | |
627 | return kFALSE; | |
3d86166d | 628 | } |
b718144c | 629 | fNRefFigures = fContainer->GetEntriesFast(); |
630 | if(!fGraphS){ | |
631 | fGraphS = new TObjArray(fNRefFigures); | |
632 | fGraphS->SetOwner(); | |
633 | } | |
634 | if(!fGraphM){ | |
635 | fGraphM = new TObjArray(fNRefFigures); | |
636 | fGraphM->SetOwner(); | |
637 | } | |
7102d1b1 | 638 | |
d2381af5 | 639 | TH2I *h2 = 0x0; |
640 | TH1D *h = 0x0; | |
d85cd79c | 641 | TGraphErrors *gm = 0x0, *gs = 0x0; |
b718144c | 642 | |
643 | // define models | |
d2381af5 | 644 | TF1 f("f1", "gaus", -.5, .5); |
b718144c | 645 | |
017bd6af | 646 | TF1 fb("fb", "[0]*exp(-0.5*((x-[1])/[2])**2)+[3]", -.5, .5); |
647 | ||
b718144c | 648 | TF1 fc("fc", "[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)", -.5, .5); |
874acced | 649 | |
017bd6af | 650 | TCanvas *c = 0x0; |
651 | if(IsVisual()) c = new TCanvas("c", Form("%s Visual", GetName()), 500, 500); | |
652 | char opt[5]; | |
653 | sprintf(opt, "%c%c", IsVerbose() ? ' ' : 'Q', IsVisual() ? ' ': 'N'); | |
654 | ||
655 | ||
874acced | 656 | //PROCESS RESIDUAL DISTRIBUTIONS |
657 | ||
658 | // Clusters residuals | |
de520d8f | 659 | h2 = (TH2I *)(fContainer->At(kClusterResidual)); |
b2dc316d | 660 | gm = new TGraphErrors(); |
017bd6af | 661 | gm->SetLineColor(kBlue); |
662 | gm->SetMarkerStyle(7); | |
663 | gm->SetMarkerColor(kBlue); | |
b718144c | 664 | gm->SetNameTitle("clm", ""); |
de520d8f | 665 | fGraphM->AddAt(gm, kClusterResidual); |
b2dc316d | 666 | gs = new TGraphErrors(); |
b718144c | 667 | gs->SetLineColor(kRed); |
668 | gs->SetMarkerStyle(23); | |
669 | gs->SetMarkerColor(kRed); | |
670 | gs->SetNameTitle("cls", ""); | |
de520d8f | 671 | fGraphS->AddAt(gs, kClusterResidual); |
874acced | 672 | for(Int_t ibin = 1; ibin <= h2->GetNbinsX(); ibin++){ |
673 | Double_t phi = h2->GetXaxis()->GetBinCenter(ibin); | |
874acced | 674 | h = h2->ProjectionY("py", ibin, ibin); |
b2dc316d | 675 | if(h->GetEntries()<100) continue; |
8d61815d | 676 | AdjustF1(h, &f); |
017bd6af | 677 | |
678 | if(IsVisual()){c->cd(); c->SetLogy();} | |
8d61815d | 679 | h->Fit(&f, opt, "", -0.5, 0.5); |
017bd6af | 680 | if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} |
681 | ||
b2dc316d | 682 | Int_t ip = gm->GetN(); |
683 | gm->SetPoint(ip, phi, 10.*f.GetParameter(1)); | |
684 | gm->SetPointError(ip, 0., 10.*f.GetParError(1)); | |
685 | gs->SetPoint(ip, phi, 10.*f.GetParameter(2)); | |
686 | gs->SetPointError(ip, 0., 10.*f.GetParError(2)); | |
874acced | 687 | } |
d2381af5 | 688 | |
251a1ae6 | 689 | // Tracklet y residuals |
690 | h2 = (TH2I *)(fContainer->At(kTrackletYResidual)); | |
691 | gm = new TGraphErrors(); | |
692 | gm->SetLineColor(kBlue); | |
693 | gm->SetMarkerStyle(7); | |
694 | gm->SetMarkerColor(kBlue); | |
695 | gm->SetNameTitle("tktm", ""); | |
696 | fGraphM->AddAt(gm, kTrackletYResidual); | |
697 | gs = new TGraphErrors(); | |
698 | gs->SetLineColor(kRed); | |
699 | gs->SetMarkerStyle(23); | |
700 | gs->SetMarkerColor(kRed); | |
701 | gs->SetNameTitle("tkts", ""); | |
702 | fGraphS->AddAt(gs, kTrackletYResidual); | |
703 | for(Int_t ibin = 1; ibin <= h2->GetNbinsX(); ibin++){ | |
704 | Double_t phi = h2->GetXaxis()->GetBinCenter(ibin); | |
705 | h = h2->ProjectionY("py", ibin, ibin); | |
706 | if(h->GetEntries()<100) continue; | |
707 | AdjustF1(h, &f); | |
708 | ||
709 | if(IsVisual()){c->cd(); c->SetLogy();} | |
710 | h->Fit(&f, opt, "", -0.5, 0.5); | |
711 | if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} | |
712 | ||
713 | Int_t ip = gm->GetN(); | |
714 | gm->SetPoint(ip, phi, 10.*f.GetParameter(1)); | |
715 | gm->SetPointError(ip, 0., 10.*f.GetParError(1)); | |
716 | gs->SetPoint(ip, phi, 10.*f.GetParameter(2)); | |
717 | gs->SetPointError(ip, 0., 10.*f.GetParError(2)); | |
718 | } | |
719 | ||
720 | // Tracklet phi residuals | |
721 | h2 = (TH2I *)(fContainer->At(kTrackletPhiResidual)); | |
722 | gm = new TGraphErrors(); | |
723 | gm->SetLineColor(kBlue); | |
724 | gm->SetMarkerStyle(7); | |
725 | gm->SetMarkerColor(kBlue); | |
726 | gm->SetNameTitle("tktphim", ""); | |
727 | fGraphM->AddAt(gm, kTrackletPhiResidual); | |
728 | gs = new TGraphErrors(); | |
729 | gs->SetLineColor(kRed); | |
730 | gs->SetMarkerStyle(23); | |
731 | gs->SetMarkerColor(kRed); | |
732 | gs->SetNameTitle("tktphis", ""); | |
733 | fGraphS->AddAt(gs, kTrackletPhiResidual); | |
734 | for(Int_t ibin = 1; ibin <= h2->GetNbinsX(); ibin++){ | |
735 | Double_t phi = h2->GetXaxis()->GetBinCenter(ibin); | |
736 | h = h2->ProjectionY("py", ibin, ibin); | |
737 | if(h->GetEntries()<100) continue; | |
738 | AdjustF1(h, &f); | |
739 | ||
740 | if(IsVisual()){c->cd(); c->SetLogy();} | |
741 | h->Fit(&f, opt, "", -0.5, 0.5); | |
742 | if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} | |
743 | ||
744 | Int_t ip = gm->GetN(); | |
745 | gm->SetPoint(ip, phi, 10.*f.GetParameter(1)); | |
746 | gm->SetPointError(ip, 0., 10.*f.GetParError(1)); | |
747 | gs->SetPoint(ip, phi, 10.*f.GetParameter(2)); | |
748 | gs->SetPointError(ip, 0., 10.*f.GetParError(2)); | |
749 | } | |
750 | ||
874acced | 751 | |
752 | //PROCESS RESOLUTION DISTRIBUTIONS | |
b718144c | 753 | |
874acced | 754 | if(HasMCdata()){ |
b718144c | 755 | // cluster y resolution |
de520d8f | 756 | h2 = (TH2I*)fContainer->At(kClusterResolution); |
b2dc316d | 757 | gm = new TGraphErrors(); |
017bd6af | 758 | gm->SetLineColor(kBlue); |
759 | gm->SetMarkerStyle(7); | |
760 | gm->SetMarkerColor(kBlue); | |
b718144c | 761 | gm->SetNameTitle("clym", ""); |
de520d8f | 762 | fGraphM->AddAt(gm, kClusterResolution); |
b2dc316d | 763 | gs = new TGraphErrors(); |
b718144c | 764 | gs->SetLineColor(kRed); |
765 | gs->SetMarkerStyle(23); | |
766 | gs->SetMarkerColor(kRed); | |
767 | gs->SetNameTitle("clys", ""); | |
de520d8f | 768 | fGraphS->AddAt(gs, kClusterResolution); |
b718144c | 769 | for(Int_t iphi=1; iphi<=h2->GetNbinsX(); iphi++){ |
770 | h = h2->ProjectionY("py", iphi, iphi); | |
b2dc316d | 771 | if(h->GetEntries()<100) continue; |
612ae7ed | 772 | AdjustF1(h, &f); |
017bd6af | 773 | |
774 | if(IsVisual()){c->cd(); c->SetLogy();} | |
612ae7ed | 775 | h->Fit(&f, opt, "", -0.5, 0.5); |
776 | if(IsVerbose()){ | |
777 | printf("phi[%d] mean[%e] sigma[%e]\n\n", iphi, 10.*f.GetParameter(1), 10.*f.GetParameter(2)); | |
778 | } | |
017bd6af | 779 | if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} |
780 | ||
b718144c | 781 | Double_t phi = h2->GetXaxis()->GetBinCenter(iphi); |
b2dc316d | 782 | Int_t ip = gm->GetN(); |
783 | gm->SetPoint(ip, phi, 10.*f.GetParameter(1)); | |
784 | gm->SetPointError(ip, 0., 10.*f.GetParError(1)); | |
785 | gs->SetPoint(ip, phi, 10.*f.GetParameter(2)); | |
786 | gs->SetPointError(ip, 0., 10.*f.GetParError(2)); | |
b718144c | 787 | } |
788 | ||
874acced | 789 | // tracklet y resolution |
3d86166d | 790 | h2 = (TH2I*)fContainer->At(kTrackletYResolution); |
b2dc316d | 791 | gm = new TGraphErrors(); |
017bd6af | 792 | gm->SetLineColor(kBlue); |
793 | gm->SetMarkerStyle(7); | |
794 | gm->SetMarkerColor(kBlue); | |
b718144c | 795 | gm->SetNameTitle("trkltym", ""); |
796 | fGraphM->AddAt(gm, kTrackletYResolution); | |
b2dc316d | 797 | gs = new TGraphErrors(); |
b718144c | 798 | gs->SetLineColor(kRed); |
799 | gs->SetMarkerStyle(23); | |
800 | gs->SetMarkerColor(kRed); | |
801 | gs->SetNameTitle("trkltys", ""); | |
802 | fGraphS->AddAt(gs, kTrackletYResolution); | |
d2381af5 | 803 | for(Int_t iphi=1; iphi<=h2->GetNbinsX(); iphi++){ |
d2381af5 | 804 | h = h2->ProjectionY("py", iphi, iphi); |
b2dc316d | 805 | if(h->GetEntries()<100) continue; |
94f34623 | 806 | AdjustF1(h, &f); |
017bd6af | 807 | |
808 | if(IsVisual()){c->cd(); c->SetLogy();} | |
94f34623 | 809 | h->Fit(&f, opt, "", -0.5, 0.5); |
017bd6af | 810 | if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} |
811 | ||
b718144c | 812 | Double_t phi = h2->GetXaxis()->GetBinCenter(iphi); |
b2dc316d | 813 | Int_t ip = gm->GetN(); |
94f34623 | 814 | gm->SetPoint(ip, phi, 10.*f.GetParameter(1)); |
815 | gm->SetPointError(ip, 0., 10.*f.GetParError(1)); | |
816 | gs->SetPoint(ip, phi, 10.*f.GetParameter(2)); | |
817 | gs->SetPointError(ip, 0., 10.*f.GetParError(2)); | |
d2381af5 | 818 | } |
d2381af5 | 819 | |
612ae7ed | 820 | // tracklet z resolution |
821 | h2 = (TH2I*)fContainer->At(kTrackletZResolution); | |
b2dc316d | 822 | gm = new TGraphErrors(); |
612ae7ed | 823 | gm->SetLineColor(kBlue); |
824 | gm->SetMarkerStyle(7); | |
825 | gm->SetMarkerColor(kBlue); | |
826 | gm->SetNameTitle("trkltzm", ""); | |
827 | fGraphM->AddAt(gm, kTrackletZResolution); | |
b2dc316d | 828 | gs = new TGraphErrors(); |
612ae7ed | 829 | gs->SetLineColor(kRed); |
830 | gs->SetMarkerStyle(23); | |
831 | gs->SetMarkerColor(kRed); | |
832 | gs->SetNameTitle("trkltzs", ""); | |
833 | fGraphS->AddAt(gs, kTrackletZResolution); | |
834 | for(Int_t iphi=1; iphi<=h2->GetNbinsX(); iphi++){ | |
835 | h = h2->ProjectionY("py", iphi, iphi); | |
b2dc316d | 836 | if(h->GetEntries()<100) continue; |
612ae7ed | 837 | AdjustF1(h, &fb); |
838 | ||
839 | if(IsVisual()){c->cd(); c->SetLogy();} | |
840 | h->Fit(&fb, opt, "", -0.5, 0.5); | |
841 | if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} | |
842 | ||
843 | Double_t phi = h2->GetXaxis()->GetBinCenter(iphi); | |
b2dc316d | 844 | Int_t ip = gm->GetN(); |
845 | gm->SetPoint(ip, phi, 10.*fb.GetParameter(1)); | |
846 | gm->SetPointError(ip, 0., 10.*fb.GetParError(1)); | |
847 | gs->SetPoint(ip, phi, 10.*fb.GetParameter(2)); | |
848 | gs->SetPointError(ip, 0., 10.*fb.GetParError(2)); | |
612ae7ed | 849 | } |
850 | ||
94f34623 | 851 | //tracklet phi resolution |
3d86166d | 852 | h2 = (TH2I*)fContainer->At(kTrackletAngleResolution); |
b2dc316d | 853 | gm = new TGraphErrors(); |
017bd6af | 854 | gm->SetLineColor(kBlue); |
855 | gm->SetMarkerStyle(7); | |
856 | gm->SetMarkerColor(kBlue); | |
b718144c | 857 | gm->SetNameTitle("trkltym", ""); |
858 | fGraphM->AddAt(gm, kTrackletAngleResolution); | |
b2dc316d | 859 | gs = new TGraphErrors(); |
b718144c | 860 | gs->SetLineColor(kRed); |
861 | gs->SetMarkerStyle(23); | |
862 | gs->SetMarkerColor(kRed); | |
863 | gs->SetNameTitle("trkltys", ""); | |
864 | fGraphS->AddAt(gs, kTrackletAngleResolution); | |
d2381af5 | 865 | for(Int_t iphi=1; iphi<=h2->GetNbinsX(); iphi++){ |
d2381af5 | 866 | h = h2->ProjectionY("py", iphi, iphi); |
b2dc316d | 867 | if(h->GetEntries()<100) continue; |
017bd6af | 868 | |
869 | if(IsVisual()){c->cd(); c->SetLogy();} | |
870 | h->Fit(&f, opt, "", -0.5, 0.5); | |
871 | if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} | |
872 | ||
b718144c | 873 | Double_t phi = h2->GetXaxis()->GetBinCenter(iphi); |
b2dc316d | 874 | Int_t ip = gm->GetN(); |
875 | gm->SetPoint(ip, phi, f.GetParameter(1)); | |
876 | gm->SetPointError(ip, 0., f.GetParError(1)); | |
877 | gs->SetPoint(ip, phi, f.GetParameter(2)); | |
878 | gs->SetPointError(ip, 0., f.GetParError(2)); | |
d2381af5 | 879 | } |
d2381af5 | 880 | } |
017bd6af | 881 | if(c) delete c; |
765bd0ab | 882 | |
d85cd79c | 883 | return kTRUE; |
884 | } | |
885 | ||
886 | ||
887 | //________________________________________________________ | |
888 | void AliTRDtrackingResolution::Terminate(Option_t *) | |
889 | { | |
890 | if(fDebugStream){ | |
891 | delete fDebugStream; | |
892 | fDebugStream = 0x0; | |
893 | fDebugLevel = 0; | |
894 | } | |
895 | if(HasPostProcess()) PostProcess(); | |
874acced | 896 | } |
d2381af5 | 897 | |
3c3d9ff1 | 898 | //________________________________________________________ |
017bd6af | 899 | void AliTRDtrackingResolution::AdjustF1(TH1 *h, TF1 *f) |
3c3d9ff1 | 900 | { |
901 | // Helper function to avoid duplication of code | |
902 | // Make first guesses on the fit parameters | |
903 | ||
904 | // find the intial parameters of the fit !! (thanks George) | |
905 | Int_t nbinsy = Int_t(.5*h->GetNbinsX()); | |
906 | Double_t sum = 0.; | |
907 | for(Int_t jbin=nbinsy-4; jbin<=nbinsy+4; jbin++) sum+=h->GetBinContent(jbin); sum/=9.; | |
908 | f->SetParLimits(0, 0., 3.*sum); | |
909 | f->SetParameter(0, .9*sum); | |
910 | ||
017bd6af | 911 | f->SetParLimits(1, -.2, .2); |
612ae7ed | 912 | f->SetParameter(1, -0.1); |
3c3d9ff1 | 913 | |
017bd6af | 914 | f->SetParLimits(2, 0., 4.e-1); |
3c3d9ff1 | 915 | f->SetParameter(2, 2.e-2); |
017bd6af | 916 | if(f->GetNpar() <= 4) return; |
3c3d9ff1 | 917 | |
918 | f->SetParLimits(3, 0., sum); | |
919 | f->SetParameter(3, .1*sum); | |
920 | ||
921 | f->SetParLimits(4, -.3, .3); | |
922 | f->SetParameter(4, 0.); | |
923 | ||
924 | f->SetParLimits(5, 0., 1.e2); | |
925 | f->SetParameter(5, 2.e-1); | |
3c3d9ff1 | 926 | } |
927 | ||
874acced | 928 | //________________________________________________________ |
3d86166d | 929 | TObjArray* AliTRDtrackingResolution::Histos() |
874acced | 930 | { |
cf194b94 | 931 | if(fContainer) return fContainer; |
932 | ||
124d488a | 933 | fContainer = new TObjArray(7); |
94f34623 | 934 | //fContainer->SetOwner(kTRUE); |
cf194b94 | 935 | |
b11eae29 | 936 | TH1 *h = 0x0; |
cf194b94 | 937 | // cluster to tracklet residuals [2] |
124d488a | 938 | if(!(h = (TH2I*)gROOT->FindObject("fYCl"))){ |
939 | h = new TH2I("fYCl", "Clusters Residuals", 21, -.33, .33, 100, -.5, .5); | |
940 | h->GetXaxis()->SetTitle("tg(#phi)"); | |
941 | h->GetYaxis()->SetTitle("#Delta y [cm]"); | |
942 | h->GetZaxis()->SetTitle("entries"); | |
943 | } else h->Reset(); | |
944 | fContainer->AddAt(h, kClusterResidual); | |
945 | ||
251a1ae6 | 946 | // tracklet to track residuals [2] |
124d488a | 947 | if(!(h = (TH2I*)gROOT->FindObject("hTrkltYRez"))){ |
948 | h = new TH2I("hTrkltYRez", "Tracklets", 21, -.33, .33, 100, -.5, .5); | |
949 | h->GetXaxis()->SetTitle("tg(#phi)"); | |
950 | h->GetYaxis()->SetTitle("#Delta y [cm]"); | |
951 | h->GetZaxis()->SetTitle("entries"); | |
952 | } else h->Reset(); | |
953 | fContainer->AddAt(h, kTrackletYResidual); | |
954 | ||
251a1ae6 | 955 | // tracklet to track residuals angular [2] |
124d488a | 956 | if(!(h = (TH2I*)gROOT->FindObject("hTrkltPhiRez"))){ |
957 | h = new TH2I("hTrkltPhiRez", "Tracklets", 21, -.33, .33, 100, -.5, .5); | |
958 | h->GetXaxis()->SetTitle("tg(#phi)"); | |
959 | h->GetYaxis()->SetTitle("#Delta phi [#circ]"); | |
960 | h->GetZaxis()->SetTitle("entries"); | |
961 | } else h->Reset(); | |
962 | fContainer->AddAt(h, kTrackletPhiResidual); | |
251a1ae6 | 963 | |
cf194b94 | 964 | |
965 | // Resolution histos | |
966 | if(HasMCdata()){ | |
967 | // cluster y resolution [0] | |
124d488a | 968 | if(!(h = (TH2I*)gROOT->FindObject("fYClMC"))){ |
969 | h = new TH2I("fYClMC", "Cluster Resolution", 31, -.48, .48, 100, -.5, .5); | |
970 | h->GetXaxis()->SetTitle("tg(#phi)"); | |
971 | h->GetYaxis()->SetTitle("#Delta y [cm]"); | |
972 | h->GetZaxis()->SetTitle("entries"); | |
973 | } else h->Reset(); | |
974 | fContainer->AddAt(h, kClusterResolution); | |
975 | ||
cf194b94 | 976 | // tracklet y resolution [0] |
124d488a | 977 | if(!(h = (TH2I*)gROOT->FindObject("fYTrkltMC"))){ |
978 | h = new TH2I("fYTrkltMC", "Tracklet Resolution (Y)", 31, -.48, .48, 100, -.5, .5); | |
979 | h->GetXaxis()->SetTitle("tg(#phi)"); | |
980 | h->GetYaxis()->SetTitle("#Delta y [cm]"); | |
981 | h->GetZaxis()->SetTitle("entries"); | |
982 | } else h->Reset(); | |
983 | fContainer->AddAt(h, kTrackletYResolution); | |
984 | ||
cf194b94 | 985 | // tracklet y resolution [0] |
124d488a | 986 | if(!(h = (TH2I*)gROOT->FindObject("fZTrkltMC"))){ |
987 | h = new TH2I("fZTrkltMC", "Tracklet Resolution (Z)", 31, -.48, .48, 100, -.5, .5); | |
988 | h->GetXaxis()->SetTitle("tg(#theta)"); | |
989 | h->GetYaxis()->SetTitle("#Delta z [cm]"); | |
990 | h->GetZaxis()->SetTitle("entries"); | |
991 | } else h->Reset(); | |
992 | fContainer->AddAt(h, kTrackletZResolution); | |
cf194b94 | 993 | |
124d488a | 994 | // tracklet angular resolution [1] |
995 | if(!(h = (TH2I*)gROOT->FindObject("fPhiTrkltMC"))){ | |
996 | h = new TH2I("fPhiTrkltMC", "Tracklet Resolution (Angular)", 31, -.48, .48, 100, -10., 10.); | |
997 | h->GetXaxis()->SetTitle("tg(#phi)"); | |
998 | h->GetYaxis()->SetTitle("#Delta #phi [deg]"); | |
999 | h->GetZaxis()->SetTitle("entries"); | |
1000 | } else h->Reset(); | |
1001 | fContainer->AddAt(h, kTrackletAngleResolution); | |
cf194b94 | 1002 | } |
3d86166d | 1003 | return fContainer; |
77203477 | 1004 | } |
1005 | ||
aaf47b30 | 1006 | |
1007 | //________________________________________________________ | |
1008 | void AliTRDtrackingResolution::SetRecoParam(AliTRDrecoParam *r) | |
1009 | { | |
3d86166d | 1010 | |
aaf47b30 | 1011 | fReconstructor->SetRecoParam(r); |
1012 | } |