]>
Commit | Line | Data |
---|---|---|
1ee39b3a | 1 | /************************************************************************** |
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 | **************************************************************************/ | |
15 | ||
16 | /* $Id: AliTRDclusterResolution.cxx */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // TRD cluster error parameterization // | |
21 | // // | |
22 | // This class is designed to produce the reference plots for a detailed study// | |
23 | // and parameterization of TRD cluster errors. The following effects are taken// | |
24 | // into account : // | |
25 | // - dependence with the total charge of the cluster // | |
26 | // - dependence with the distance from the center pad. This is monitored | |
27 | // for each layer individually since the pad size varies with layer | |
28 | // - dependence with the drift length - here the influence of anisochronity | |
29 | // and diffusion are searched | |
30 | // - dependence with the distance to the anode wire - anisochronity effects | |
31 | // - dependence with track angle (for y resolution) | |
32 | // The correlation between effects is taken into account. | |
33 | // | |
34 | // Since magnetic field plays a very important role in the TRD measurement | |
35 | // the ExB correction is forced by the setter function SetExB(Int_t). The | |
36 | // argument is the detector index, if none is specified all will be | |
37 | // considered. | |
38 | // | |
39 | // Two cases are of big importance. | |
40 | // - comparison with MC | |
41 | // - comparison with Kalman fit. In this case the covariance matrix of the | |
42 | // Kalman fit are needed. | |
43 | // | |
44 | // The functionalities implemented in this class are based on the storage | |
45 | // class AliTRDclusterInfo. | |
46 | // | |
47 | // The Method | |
48 | // ---------- | |
49 | // | |
50 | // The method to disentangle s_y and s_x is based on the relation (see also fig.) | |
51 | // BEGIN_LATEX | |
52 | // #sigma^{2} = #sigma^{2}_{y} + tg^{2}(#alpha_{L})*#sigma^{2}_{x_{d}} + tg^{2}(#phi-#alpha_{L})*(#sigma^{2}_{x_{d}}+#sigma^{2}_{x_{c}}) | |
53 | // END_LATEX | |
54 | // with | |
55 | // BEGIN_LATEX | |
56 | // #sigma^{2}_{x_{c}} #approx 0 | |
57 | // END_LATEX | |
58 | // we suppose the chamber is well calibrated for t_{0} and aligned in | |
59 | // radial direction. | |
60 | // | |
61 | // Clusters can be radially shifted due to three causes: | |
62 | // - globally shifted - due to residual misalignment/miscalibration(t0) | |
63 | // - locally shifted - due to different local drift velocity from the mean | |
64 | // - randomly shifted - due to neighboring (radial direction) clusters | |
65 | // charge induced by asymmetry of the TRF. | |
66 | // | |
67 | // We estimate this effects by the relations: | |
68 | // BEGIN_LATEX | |
69 | // #mu_{y} = tg(#alpha_{L})*#Delta x_{d}(...) + tg(#phi-#alpha_{L})*(#Delta x_{c}(...) + #Delta x_{d}(...)) | |
70 | // END_LATEX | |
71 | // where | |
72 | // BEGIN_LATEX | |
73 | // #Delta x_{d}(...) = (<v_{d}> + #delta v_{d}(x_{d}, d)) * (t + t^{*}(Q)) | |
74 | // END_LATEX | |
75 | // and we specified explicitely the variation of drift velocity parallel | |
76 | // with the track (x_{d}) and perpendicular to it due to anisochronity (d). | |
77 | // | |
78 | // For estimating the contribution from asymmetry of TRF the following | |
79 | // parameterization is being used | |
80 | // BEGIN_LATEX | |
81 | // t^{*}(Q) = #delta_{0} * #frac{Q_{t+1} - Q_{t-1}}{Q_{t-1} + Q_{t} + Q_{t+1}} | |
82 | // END_LATEX | |
83 | // | |
84 | // | |
85 | // Clusters can also be r-phi shifted due to: | |
86 | // - wrong PRF or wrong cuts at digits level | |
87 | //The following correction is applied : | |
88 | // BEGIN_LATEX | |
89 | // <#Delta y> = a + b * sin(c*y_{pw}) | |
90 | // END_LATEX | |
91 | ||
92 | // The Models | |
93 | // | |
94 | // Parameterization against total charge | |
95 | // | |
96 | // Obtained for B=0T at phi=0. All other effects integrated out. | |
97 | // BEGIN_LATEX | |
98 | // #sigma^{2}_{y}(Q) = #sigma^{2}_{y}(...) + b(#frac{1}{Q} - #frac{1}{Q_{0}}) | |
99 | // END_LATEX | |
100 | // For B diff 0T the error of the average ExB correction error has to be subtracted !! | |
101 | // | |
102 | // Parameterization Sx | |
103 | // | |
104 | // The parameterization of the error in the x direction can be written as | |
105 | // BEGIN_LATEX | |
106 | // #sigma_{x} = #sigma_{x}^{||} + #sigma_{x}^{#perp} | |
107 | // END_LATEX | |
108 | // | |
109 | // where the parallel component is given mainly by the TRF width while | |
110 | // the perpendicular component by the anisochronity. The model employed for | |
111 | // the parallel is gaus(0)+expo(3) with the following parameters | |
112 | // 1 C 5.49018e-01 1.23854e+00 3.84540e-04 -8.21084e-06 | |
113 | // 2 M 7.82999e-01 6.22531e-01 2.71272e-04 -6.88485e-05 | |
114 | // 3 S 2.74451e-01 1.13815e+00 2.90667e-04 1.13493e-05 | |
115 | // 4 E1 2.53596e-01 1.08646e+00 9.95591e-05 -2.11625e-05 | |
116 | // 5 E2 -2.40078e-02 4.26520e-01 4.67153e-05 -2.35392e-04 | |
117 | // | |
118 | // and perpendicular to the track is pol2 with the parameters | |
119 | // | |
120 | // Par_0 = 0.190676 +/- 0.41785 | |
121 | // Par_1 = -3.9269 +/- 7.49862 | |
122 | // Par_2 = 14.7851 +/- 27.8012 | |
123 | // | |
124 | // Parameterization Sy | |
125 | // | |
126 | // The parameterization of the error in the y direction along track uses | |
127 | // BEGIN_LATEX | |
128 | // #sigma_{y}^{||} = #sigma_{y}^{0} -a*exp(1/(x-b)) | |
129 | // END_LATEX | |
130 | // | |
131 | // with following values for the parameters: | |
132 | // 1 sy0 2.60967e-01 2.99652e-03 7.82902e-06 -1.89636e-04 | |
133 | // 2 a -7.68941e+00 1.87883e+00 3.84539e-04 9.38268e-07 | |
134 | // 3 b -3.41160e-01 7.72850e-02 1.63231e-05 2.51602e-05 | |
135 | // | |
136 | //========================================================================== | |
137 | // Example how to retrive reference plots from the task | |
138 | // void steerClErrParam(Int_t fig=0) | |
139 | // { | |
140 | // gSystem->Load("libANALYSIS.so"); | |
141 | // gSystem->Load("libTRDqaRec.so"); | |
142 | // | |
143 | // // initialize DB manager | |
144 | // AliCDBManager *cdb = AliCDBManager::Instance(); | |
145 | // cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
146 | // cdb->SetRun(0); | |
147 | // // initialize magnetic field. | |
148 | // AliMagFCheb *field=new AliMagFCheb("Maps","Maps", 2, 1., 10., AliMagFCheb::k5kG); | |
149 | // AliTracker::SetFieldMap(field, kTRUE); | |
150 | // | |
151 | // AliTRDclusterResolution *res = new AliTRDclusterResolution(); | |
152 | // res->SetMCdata(); | |
153 | // res->Load("TRD.TaskClErrParam.root"); | |
154 | // res->SetExB(); | |
155 | // res->SetVisual(); | |
156 | // //res->SetSaveAs(); | |
157 | // res->SetProcessCharge(kFALSE); | |
158 | // res->SetProcessCenterPad(kFALSE); | |
159 | // //res->SetProcessMean(kFALSE); | |
160 | // res->SetProcessSigma(kFALSE); | |
161 | // if(!res->PostProcess()) return; | |
162 | // new TCanvas; | |
163 | // res->GetRefFigure(fig); | |
164 | // } | |
165 | // | |
166 | // Authors: // | |
167 | // Alexandru Bercuci <A.Bercuci@gsi.de> // | |
168 | //////////////////////////////////////////////////////////////////////////// | |
169 | ||
170 | #include "AliTRDclusterResolution.h" | |
171 | #include "info/AliTRDclusterInfo.h" | |
172 | #include "AliTRDgeometry.h" | |
801d4d50 | 173 | #include "AliTRDpadPlane.h" |
1ee39b3a | 174 | #include "AliTRDcluster.h" |
5935a6da | 175 | #include "AliTRDseedV1.h" |
1ee39b3a | 176 | #include "AliTRDcalibDB.h" |
177 | #include "AliTRDCommonParam.h" | |
178 | #include "Cal/AliTRDCalROC.h" | |
179 | #include "Cal/AliTRDCalDet.h" | |
180 | ||
801d4d50 | 181 | #include "AliESDEvent.h" |
1ee39b3a | 182 | #include "AliCDBManager.h" |
183 | ||
184 | #include "TROOT.h" | |
185 | #include "TObjArray.h" | |
186 | #include "TAxis.h" | |
187 | #include "TF1.h" | |
188 | #include "TLegend.h" | |
189 | #include "TGraphErrors.h" | |
190 | #include "TLine.h" | |
191 | #include "TH2I.h" | |
192 | #include "TH3S.h" | |
193 | #include "TTree.h" | |
194 | #include "TMath.h" | |
195 | #include "TLinearFitter.h" | |
196 | ||
197 | #include "TCanvas.h" | |
198 | #include "TSystem.h" | |
199 | ||
200 | ClassImp(AliTRDclusterResolution) | |
201 | ||
202 | const Float_t AliTRDclusterResolution::fgkTimeBinLength = 1./ AliTRDCommonParam::Instance()->GetSamplingFrequency(); | |
203 | //_______________________________________________________ | |
f8f46e4d | 204 | AliTRDclusterResolution::AliTRDclusterResolution() |
205 | : AliTRDrecoTask() | |
705f8b0a | 206 | ,fCanvas(NULL) |
207 | ,fInfo(NULL) | |
208 | ,fResults(NULL) | |
f8f46e4d | 209 | ,fStatus(0) |
210 | ,fDet(-1) | |
801d4d50 | 211 | ,fCol(-1) |
212 | ,fRow(-1) | |
f8f46e4d | 213 | ,fExB(0.) |
e3147647 | 214 | ,fVdrift(1.5) |
5935a6da | 215 | ,fT0(0.) |
e3147647 | 216 | ,fGain(1.) |
563d1b38 | 217 | ,fDyRange(1.3) |
f8f46e4d | 218 | ,fLy(0) |
5935a6da | 219 | ,fT(0.) |
f8f46e4d | 220 | ,fX(0.) |
221 | ,fY(0.) | |
222 | ,fZ(0.) | |
223 | { | |
224 | // Constructor | |
705f8b0a | 225 | SetNameTitle("ClErrCalib", "Cluster Error Parameterization"); |
563d1b38 | 226 | memset(fR, 0, 4*sizeof(Float_t)); |
227 | memset(fP, 0, 4*sizeof(Float_t)); | |
f8f46e4d | 228 | } |
229 | ||
705f8b0a | 230 | //_______________________________________________________ |
231 | AliTRDclusterResolution::AliTRDclusterResolution(const char *name) | |
232 | : AliTRDrecoTask(name, "Cluster Error Parameterization") | |
4226db3e | 233 | ,fCanvas(NULL) |
234 | ,fInfo(NULL) | |
235 | ,fResults(NULL) | |
1ee39b3a | 236 | ,fStatus(0) |
237 | ,fDet(-1) | |
801d4d50 | 238 | ,fCol(-1) |
239 | ,fRow(-1) | |
1ee39b3a | 240 | ,fExB(0.) |
e3147647 | 241 | ,fVdrift(1.5) |
5935a6da | 242 | ,fT0(0.) |
e3147647 | 243 | ,fGain(1.) |
563d1b38 | 244 | ,fDyRange(1.3) |
1ee39b3a | 245 | ,fLy(0) |
5935a6da | 246 | ,fT(0.) |
1ee39b3a | 247 | ,fX(0.) |
248 | ,fY(0.) | |
249 | ,fZ(0.) | |
250 | { | |
251 | // Constructor | |
252 | ||
253 | memset(fR, 0, 4*sizeof(Float_t)); | |
254 | memset(fP, 0, 4*sizeof(Float_t)); | |
1ee39b3a | 255 | |
256 | // By default register all analysis | |
257 | // The user can switch them off in his steering macro | |
258 | SetProcess(kQRes); | |
259 | SetProcess(kCenter); | |
260 | SetProcess(kMean); | |
261 | SetProcess(kSigm); | |
262 | } | |
263 | ||
264 | //_______________________________________________________ | |
265 | AliTRDclusterResolution::~AliTRDclusterResolution() | |
266 | { | |
267 | // Destructor | |
268 | ||
269 | if(fCanvas) delete fCanvas; | |
1ee39b3a | 270 | if(fResults){ |
271 | fResults->Delete(); | |
272 | delete fResults; | |
273 | } | |
274 | } | |
275 | ||
1ee39b3a | 276 | //_______________________________________________________ |
f8f46e4d | 277 | void AliTRDclusterResolution::UserCreateOutputObjects() |
1ee39b3a | 278 | { |
1ee39b3a | 279 | fContainer = Histos(); |
068e2c00 | 280 | PostData(1, fContainer); |
1ee39b3a | 281 | } |
282 | ||
283 | //_______________________________________________________ | |
284 | Bool_t AliTRDclusterResolution::GetRefFigure(Int_t ifig) | |
285 | { | |
286 | // Steering function to retrieve performance plots | |
287 | ||
288 | if(!fResults) return kFALSE; | |
4226db3e | 289 | TLegend *leg = NULL; |
290 | TList *l = NULL; | |
291 | TObjArray *arr = NULL; | |
292 | TTree *t = NULL; | |
293 | TH2 *h2 = NULL;TH1 *h1 = NULL; | |
294 | TGraphErrors *gm(NULL), *gs(NULL), *gp(NULL); | |
1ee39b3a | 295 | switch(ifig){ |
296 | case kQRes: | |
297 | if(!(arr = (TObjArray*)fResults->At(kQRes))) break; | |
298 | if(!(gm = (TGraphErrors*)arr->At(0))) break; | |
299 | if(!(gs = (TGraphErrors*)arr->At(1))) break; | |
300 | if(!(gp = (TGraphErrors*)arr->At(2))) break; | |
5935a6da | 301 | leg= new TLegend(.7, .7, .9, .95); |
302 | leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetFillStyle(0); | |
303 | gs->Draw("apl"); leg->AddEntry(gs, "Sigma / Resolution", "pl"); | |
1ee39b3a | 304 | gs->GetHistogram()->GetYaxis()->SetRangeUser(-50., 700.); |
305 | gs->GetHistogram()->SetXTitle("Q [a.u.]"); | |
5935a6da | 306 | gs->GetHistogram()->SetYTitle("y - x tg(#alpha_{L}) [#mum]"); |
307 | gm->Draw("pl");leg->AddEntry(gm, "Mean / Systematics", "pl"); | |
308 | gp->Draw("pl");leg->AddEntry(gp, "Abundance / Probability", "pl"); | |
309 | leg->Draw(); | |
1ee39b3a | 310 | return kTRUE; |
311 | case kCenter: | |
312 | if(!(arr = (TObjArray*)fResults->At(kCenter))) break; | |
313 | gPad->Divide(2, 1); l = gPad->GetListOfPrimitives(); | |
314 | ((TVirtualPad*)l->At(0))->cd(); | |
5935a6da | 315 | ((TTree*)arr->At(0))->Draw(Form("y:t>>h(%d, -0.5, %f, 51, -.51, .51)",AliTRDseedV1::kNtb, AliTRDseedV1::kNtb-0.5), |
1ee39b3a | 316 | "m[0]*(ly==0&&abs(m[0])<1.e-1)", "colz"); |
317 | ((TVirtualPad*)l->At(1))->cd(); | |
318 | leg= new TLegend(.7, .7, .9, .95); | |
319 | leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetFillStyle(0); | |
320 | leg->SetHeader("TRD Plane"); | |
321 | for(Int_t il = 1; il<=AliTRDgeometry::kNlayer; il++){ | |
322 | if(!(gm = (TGraphErrors*)arr->At(il))) return kFALSE; | |
323 | gm->Draw(il>1?"pc":"apc"); leg->AddEntry(gm, Form("%d", il-1), "pl"); | |
324 | if(il>1) continue; | |
5935a6da | 325 | gm->GetHistogram()->SetXTitle("t_{drift} [tb]"); |
1ee39b3a | 326 | gm->GetHistogram()->SetYTitle("#sigma_{y}(x|cen=0) [#mum]"); |
327 | gm->GetHistogram()->GetYaxis()->SetRangeUser(150., 500.); | |
328 | } | |
329 | leg->Draw(); | |
330 | return kTRUE; | |
331 | case kSigm: | |
332 | if(!(t = (TTree*)fResults->At(kSigm))) break; | |
333 | t->Draw("z:t>>h2x(23, 0.1, 2.4, 25, 0., 2.5)","sx*(1)", "lego2fb"); | |
334 | h2 = (TH2F*)gROOT->FindObject("h2x"); | |
335 | printf(" const Double_t sx[24][25]={\n"); | |
336 | for(Int_t ix=1; ix<=h2->GetNbinsX(); ix++){ | |
337 | printf(" {"); | |
338 | for(Int_t iy=1; iy<h2->GetNbinsY(); iy++){ | |
339 | printf("%6.4f ", h2->GetBinContent(ix, iy)); | |
340 | } | |
341 | printf("%6.4f},\n", h2->GetBinContent(ix, h2->GetNbinsY())); | |
342 | } | |
343 | printf(" };\n"); | |
344 | gPad->Divide(2, 1, 1.e-5, 1.e-5); l = gPad->GetListOfPrimitives(); | |
345 | ((TVirtualPad*)l->At(0))->cd(); | |
346 | h1 = h2->ProjectionX("hsx_pxx"); h1->Scale(1.e4/kND); h1->SetMarkerStyle(24); | |
347 | h1->SetYTitle("<#sigma_{x}> [#mum]"); | |
348 | h1->SetXTitle("t_{drift} [#mus]"); | |
5935a6da | 349 | h1->GetXaxis()->SetRange(2, AliTRDseedV1::kNtb-1); h1->Draw("pc"); |
1ee39b3a | 350 | |
351 | t->Draw("z:t>>h2y(23, 0.1, 2.4, 25, 0., 2.5)","sy*(1)", "lego2fb"); | |
352 | h2 = (TH2F*)gROOT->FindObject("h2y"); | |
353 | printf(" const Double_t sy[24][25]={\n"); | |
354 | for(Int_t ix=1; ix<=h2->GetNbinsX(); ix++){ | |
355 | printf(" {"); | |
356 | for(Int_t iy=1; iy<h2->GetNbinsY(); iy++){ | |
357 | printf("%6.4f ", h2->GetBinContent(ix, iy)); | |
358 | } | |
359 | printf("%6.4f},\n", h2->GetBinContent(ix, h2->GetNbinsY())); | |
360 | } | |
361 | printf(" };\n"); | |
362 | ((TVirtualPad*)l->At(1))->cd(); | |
363 | h1 = h2->ProjectionX("hsy_pxx"); h1->Scale(1.e4/kND); h1->SetMarkerStyle(24); | |
364 | h1->SetYTitle("<#sigma_{y}> [#mum]"); | |
365 | h1->SetXTitle("t_{drift} [#mus]"); | |
5935a6da | 366 | h1->GetXaxis()->SetRange(2, AliTRDseedV1::kNtb-1); h1->Draw("pc"); |
1ee39b3a | 367 | return kTRUE; |
368 | case kMean: | |
369 | if(!(t = (TTree*)fResults->At(kMean))) break; | |
2ba7720d | 370 | if(!t->Draw(Form("z:t>>h2x(%d, -0.5, %3.1f, %d, 0., 2.5)", |
5935a6da | 371 | AliTRDseedV1::kNtb, AliTRDseedV1::kNtb-0.5, kND), |
2ba7720d | 372 | "dx*(1)", "goff")) break; |
1ee39b3a | 373 | h2 = (TH2F*)gROOT->FindObject("h2x"); |
5935a6da | 374 | printf(" const Double_t dx[%d][%d]={\n", AliTRDseedV1::kNtb, kND); |
1ee39b3a | 375 | for(Int_t ix=1; ix<=h2->GetNbinsX(); ix++){ |
376 | printf(" {"); | |
377 | for(Int_t iy=1; iy<h2->GetNbinsY(); iy++){ | |
5935a6da | 378 | printf("%+6.4e, ", h2->GetBinContent(ix, iy)); |
1ee39b3a | 379 | } |
5935a6da | 380 | printf("%+6.4e},\n", h2->GetBinContent(ix, h2->GetNbinsY())); |
1ee39b3a | 381 | } |
382 | printf(" };\n"); | |
5935a6da | 383 | gPad->Divide(2, 2, 1.e-5, 1.e-5); l = gPad->GetListOfPrimitives(); |
1ee39b3a | 384 | ((TVirtualPad*)l->At(0))->cd(); |
5935a6da | 385 | h2->Draw("lego2fb"); |
386 | ((TVirtualPad*)l->At(2))->cd(); | |
1ee39b3a | 387 | h1 = h2->ProjectionX("hdx_pxx"); h1->Scale(1.e4/kND); h1->SetMarkerStyle(24); |
5935a6da | 388 | h1->SetYTitle("<#deltax> [#mum]"); |
b9ddd472 | 389 | h1->SetXTitle("t_{drift} [tb]"); |
5935a6da | 390 | //h1->GetXaxis()->SetRange(2, AliTRDseedV1::kNtb-1); |
391 | h1->Draw("pc"); | |
1ee39b3a | 392 | |
2ba7720d | 393 | if(!t->Draw(Form("z:t>>h2y(%d, -0.5, %3.1f, %d, 0., 2.5)", |
5935a6da | 394 | AliTRDseedV1::kNtb, AliTRDseedV1::kNtb-0.5, kND), |
2ba7720d | 395 | "dy*(1)", "goff")) break; |
1ee39b3a | 396 | h2 = (TH2F*)gROOT->FindObject("h2y"); |
5935a6da | 397 | printf(" const Double_t dy[%d][%d]={\n", AliTRDseedV1::kNtb, kND); |
1ee39b3a | 398 | for(Int_t ix=1; ix<=h2->GetNbinsX(); ix++){ |
399 | printf(" {"); | |
400 | for(Int_t iy=1; iy<h2->GetNbinsY(); iy++){ | |
5935a6da | 401 | printf("%+6.4e ", h2->GetBinContent(ix, iy)); |
1ee39b3a | 402 | } |
5935a6da | 403 | printf("%+6.4e},\n", h2->GetBinContent(ix, h2->GetNbinsY())); |
1ee39b3a | 404 | } |
405 | printf(" };\n"); | |
406 | ((TVirtualPad*)l->At(1))->cd(); | |
5935a6da | 407 | h2->Draw("lego2fb"); |
408 | ((TVirtualPad*)l->At(3))->cd(); | |
1ee39b3a | 409 | h1 = h2->ProjectionX("hdy_pxx"); h1->Scale(1.e4/kND); h1->SetMarkerStyle(24); |
5935a6da | 410 | h1->SetYTitle("<#deltay> [#mum]"); |
b9ddd472 | 411 | h1->SetXTitle("t_{drift} [tb]"); |
5935a6da | 412 | //h1->GetXaxis()->SetRange(2, AliTRDseedV1::kNtb-1); |
413 | h1->Draw("pc"); | |
1ee39b3a | 414 | |
415 | return kTRUE; | |
416 | default: | |
417 | break; | |
418 | } | |
419 | AliWarning("No container/data found."); | |
420 | return kFALSE; | |
421 | } | |
422 | ||
423 | //_______________________________________________________ | |
424 | TObjArray* AliTRDclusterResolution::Histos() | |
425 | { | |
426 | // Retrieve histograms array if already build or build it | |
427 | ||
428 | if(fContainer) return fContainer; | |
429 | fContainer = new TObjArray(kNtasks); | |
430 | //fContainer->SetOwner(kTRUE); | |
431 | ||
4226db3e | 432 | TH3S *h3 = NULL; |
433 | TObjArray *arr = NULL; | |
1ee39b3a | 434 | |
435 | fContainer->AddAt(arr = new TObjArray(2*AliTRDgeometry::kNlayer), kCenter); | |
436 | arr->SetName("Center"); | |
437 | for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ | |
438 | // add resolution plot for each layer | |
439 | if(!(h3=(TH3S*)gROOT->FindObject(Form("hCenResLy%d", il)))){ | |
440 | h3 = new TH3S( | |
441 | Form("hCenResLy%d", il), | |
5935a6da | 442 | Form(" ly [%d];t [bin];y [pw];#Delta y[cm]", il), |
443 | AliTRDseedV1::kNtb, -.5, AliTRDseedV1::kNtb-0.5, // x | |
e3147647 | 444 | 51, -.51, .51, // y |
563d1b38 | 445 | 60, -fDyRange, fDyRange); // dy |
1ee39b3a | 446 | } h3->Reset(); |
447 | arr->AddAt(h3, il); | |
448 | // add Pull plot for each layer | |
449 | if(!(h3=(TH3S*)gROOT->FindObject(Form("hCenPullLy%d", il)))){ | |
450 | h3 = new TH3S( | |
451 | Form("hCenPullLy%d", il), | |
5935a6da | 452 | Form(" ly [%d];t [bin];y [pw];#Delta y[cm]/#sigma_{y}", il), |
453 | AliTRDseedV1::kNtb, -0.5, AliTRDseedV1::kNtb-0.5, // x | |
1ee39b3a | 454 | 51, -.51, .51, // y |
563d1b38 | 455 | 60, -4., 4.); // dy/sy |
1ee39b3a | 456 | } h3->Reset(); |
457 | arr->AddAt(h3, AliTRDgeometry::kNlayer+il); | |
458 | } | |
459 | ||
460 | if(!(h3 = (TH3S*)gROOT->FindObject("Charge"))){ | |
563d1b38 | 461 | h3 = new TH3S("Charge", "dy=f(q)", 50, 2.2, 7.5, 60, -fDyRange, fDyRange, 60, -4., 4.); |
1ee39b3a | 462 | h3->SetXTitle("log(q) [a.u.]"); |
463 | h3->SetYTitle("#Delta y[cm]"); | |
464 | h3->SetZTitle("#Delta y/#sigma_{y}"); | |
465 | } | |
466 | fContainer->AddAt(h3, kQRes); | |
467 | ||
5935a6da | 468 | fContainer->AddAt(arr = new TObjArray(AliTRDseedV1::kNtb), kSigm); |
1ee39b3a | 469 | arr->SetName("Resolution"); |
5935a6da | 470 | for(Int_t ix=0; ix<AliTRDseedV1::kNtb; ix++){ |
1ee39b3a | 471 | if(!(h3=(TH3S*)gROOT->FindObject(Form("hr_x%02d", ix)))){ |
472 | h3 = new TH3S( | |
473 | Form("hr_x%02d", ix), | |
5935a6da | 474 | Form(" t_{drift}(%2d)[bin];z [mm];tg#phi;#Delta y[cm]", ix), |
1ee39b3a | 475 | kND, 0., 2.5, // z |
476 | 35, -.35, .35, // tgp | |
563d1b38 | 477 | 60, -fDyRange, fDyRange); // dy |
1ee39b3a | 478 | } |
479 | arr->AddAt(h3, ix); | |
480 | } | |
481 | ||
5935a6da | 482 | fContainer->AddAt(arr = new TObjArray(AliTRDseedV1::kNtb), kMean); |
1ee39b3a | 483 | arr->SetName("Systematics"); |
5935a6da | 484 | for(Int_t ix=0; ix<AliTRDseedV1::kNtb; ix++){ |
1ee39b3a | 485 | if(!(h3=(TH3S*)gROOT->FindObject(Form("hs_x%02d", ix)))){ |
486 | h3 = new TH3S( | |
487 | Form("hs_x%02d", ix), | |
5935a6da | 488 | Form(" t_{drift}(%2d)[bin];z [mm];tg#phi - h*tg(#theta);#Delta y[cm]", ix), |
1ee39b3a | 489 | kND, 0., 2.5, // z |
490 | 35, -.35, .35, // tgp-h tgt | |
563d1b38 | 491 | 60, -fDyRange, fDyRange); // dy |
1ee39b3a | 492 | } |
493 | arr->AddAt(h3, ix); | |
494 | } | |
495 | ||
496 | return fContainer; | |
497 | } | |
498 | ||
499 | //_______________________________________________________ | |
f8f46e4d | 500 | void AliTRDclusterResolution::UserExec(Option_t *) |
1ee39b3a | 501 | { |
502 | // Fill container histograms | |
503 | ||
e3147647 | 504 | |
5935a6da | 505 | fInfo = dynamic_cast<TObjArray *>(GetInputData(1)); |
e3147647 | 506 | AliDebug(2, Form("Clusters[%d]", fInfo->GetEntriesFast(), fDet, fCol, fRow)); |
507 | if(!IsCalibrated()){ | |
508 | LoadCalibration(); | |
509 | if(!IsCalibrated()){ | |
510 | AliWarning("Loading the calibration settings failed. Check OCDB access."); | |
801d4d50 | 511 | return; |
512 | } | |
513 | } | |
1ee39b3a | 514 | |
515 | Int_t det, t; | |
516 | Float_t x, y, z, q, dy, dydx, dzdx, cov[3], covcl[3]; | |
4226db3e | 517 | TH3S *h3 = NULL; |
1ee39b3a | 518 | |
519 | // define limits around ExB for which x contribution is negligible | |
520 | const Float_t kDtgPhi = 3.5e-2; //(+- 2 deg) | |
521 | ||
522 | TObjArray *arr0 = (TObjArray*)fContainer->At(kCenter); | |
523 | TObjArray *arr1 = (TObjArray*)fContainer->At(kSigm); | |
524 | TObjArray *arr2 = (TObjArray*)fContainer->At(kMean); | |
525 | ||
4226db3e | 526 | const AliTRDclusterInfo *cli = NULL; |
1ee39b3a | 527 | TIterator *iter=fInfo->MakeIterator(); |
528 | while((cli=dynamic_cast<AliTRDclusterInfo*>((*iter)()))){ | |
529 | cli->GetCluster(det, x, y, z, q, t, covcl); | |
5935a6da | 530 | |
801d4d50 | 531 | // select cluster according to detector region if specified |
1ee39b3a | 532 | if(fDet>=0 && fDet!=det) continue; |
801d4d50 | 533 | if(fCol>=0 && fRow>=0){ |
534 | Int_t c,r; | |
535 | cli->GetCenterPad(c, r); | |
536 | if(TMath::Abs(fCol-c) > 5) continue; | |
537 | if(TMath::Abs(fRow-r) > 2) continue; | |
538 | } | |
801d4d50 | 539 | dy = cli->GetResolution(); |
540 | AliDebug(4, Form("det[%d] tb[%2d] q[%4.0f Log[%6.4f]] dy[%7.2f][um] ypull[%5.2f]", det, t, q, TMath::Log(q), 1.e4*dy, dy/TMath::Sqrt(covcl[0]))); | |
1ee39b3a | 541 | |
1ee39b3a | 542 | cli->GetGlobalPosition(y, z, dydx, dzdx, &cov[0]); |
543 | ||
544 | // resolution as a function of cluster charge | |
545 | // only for phi equal exB | |
546 | if(TMath::Abs(dydx-fExB) < kDtgPhi){ | |
547 | h3 = (TH3S*)fContainer->At(kQRes); | |
548 | h3->Fill(TMath::Log(q), dy, dy/TMath::Sqrt(covcl[0])); | |
1ee39b3a | 549 | } |
550 | ||
551 | // do not use problematic clusters in resolution analysis | |
552 | // TODO define limits as calibration aware (gain) !! | |
e3147647 | 553 | if(q<20.*fGain || q>250.*fGain) continue; |
1ee39b3a | 554 | |
5935a6da | 555 | //x = (t+.5)*fgkTimeBinLength; // conservative approach !! |
1ee39b3a | 556 | |
557 | // resolution as a function of y displacement from pad center | |
558 | // only for phi equal exB | |
5935a6da | 559 | if(TMath::Abs(dydx-fExB) < kDtgPhi){ |
1ee39b3a | 560 | Int_t ly(AliTRDgeometry::GetLayer(det)); |
561 | h3 = (TH3S*)arr0->At(ly); | |
5935a6da | 562 | h3->Fill(t, cli->GetYDisplacement(), dy); |
1ee39b3a | 563 | h3 = (TH3S*)arr0->At(AliTRDgeometry::kNlayer+ly); |
5935a6da | 564 | h3->Fill(t, cli->GetYDisplacement(), dy/TMath::Sqrt(covcl[0])); |
1ee39b3a | 565 | } |
566 | ||
5935a6da | 567 | Int_t it(((TH3S*)arr0->At(0))->GetXaxis()->FindBin(t)); |
1ee39b3a | 568 | |
569 | // fill histo for resolution (sigma) | |
5935a6da | 570 | ((TH3S*)arr1->At(it-1))->Fill(10.*cli->GetAnisochronity(), dydx, dy); |
1ee39b3a | 571 | |
572 | // fill histo for systematic (mean) | |
5935a6da | 573 | ((TH3S*)arr2->At(it-1))->Fill(10.*cli->GetAnisochronity(), dydx-cli->GetTilt()*dzdx, dy); |
1ee39b3a | 574 | } |
1ee39b3a | 575 | } |
576 | ||
577 | ||
578 | //_______________________________________________________ | |
579 | Bool_t AliTRDclusterResolution::PostProcess() | |
580 | { | |
581 | if(!fContainer) return kFALSE; | |
e3147647 | 582 | if(!IsCalibrated()){ |
583 | AliWarning("Not calibrated."); | |
584 | return kFALSE; | |
585 | } | |
4226db3e | 586 | TObjArray *arr = NULL; |
587 | TTree *t=NULL; | |
1ee39b3a | 588 | if(!fResults){ |
4226db3e | 589 | TGraphErrors *g = NULL; |
1ee39b3a | 590 | fResults = new TObjArray(kNtasks); |
591 | fResults->SetOwner(); | |
592 | fResults->AddAt(arr = new TObjArray(3), kQRes); | |
593 | arr->SetOwner(); | |
594 | arr->AddAt(g = new TGraphErrors(), 0); | |
595 | g->SetLineColor(kBlue); g->SetMarkerColor(kBlue); | |
596 | g->SetMarkerStyle(7); | |
597 | arr->AddAt(g = new TGraphErrors(), 1); | |
598 | g->SetLineColor(kRed); g->SetMarkerColor(kRed); | |
599 | g->SetMarkerStyle(23); | |
600 | arr->AddAt(g = new TGraphErrors(), 2); | |
601 | g->SetLineColor(kGreen); g->SetMarkerColor(kGreen); | |
602 | g->SetMarkerStyle(7); | |
603 | ||
604 | // pad center dependence | |
605 | fResults->AddAt(arr = new TObjArray(AliTRDgeometry::kNlayer+1), kCenter); | |
606 | arr->SetOwner(); | |
607 | arr->AddAt( | |
608 | t = new TTree("cent", "dy=f(y,x,ly)"), 0); | |
609 | t->Branch("ly", &fLy, "ly/B"); | |
5935a6da | 610 | t->Branch("t", &fT, "t/F"); |
1ee39b3a | 611 | t->Branch("y", &fY, "y/F"); |
612 | t->Branch("m", &fR[0], "m[2]/F"); | |
613 | t->Branch("s", &fR[2], "s[2]/F"); | |
614 | t->Branch("pm", &fP[0], "pm[2]/F"); | |
615 | t->Branch("ps", &fP[2], "ps[2]/F"); | |
616 | for(Int_t il=1; il<=AliTRDgeometry::kNlayer; il++){ | |
617 | arr->AddAt(g = new TGraphErrors(), il); | |
618 | g->SetLineColor(il); g->SetLineStyle(il); | |
619 | g->SetMarkerColor(il);g->SetMarkerStyle(4); | |
620 | } | |
621 | ||
622 | ||
623 | fResults->AddAt(t = new TTree("sigm", "dy=f(dw,x,dydx)"), kSigm); | |
5935a6da | 624 | t->Branch("t", &fT, "t/F"); |
625 | t->Branch("x", &fX, "x/F"); | |
1ee39b3a | 626 | t->Branch("z", &fZ, "z/F"); |
627 | t->Branch("sx", &fR[0], "sx[2]/F"); | |
628 | t->Branch("sy", &fR[2], "sy[2]/F"); | |
629 | ||
630 | ||
631 | fResults->AddAt(t = new TTree("mean", "dy=f(dw,x,dydx - h dzdx)"), kMean); | |
5935a6da | 632 | t->Branch("t", &fT, "t/F"); |
633 | t->Branch("x", &fX, "x/F"); | |
1ee39b3a | 634 | t->Branch("z", &fZ, "z/F"); |
635 | t->Branch("dx", &fR[0], "dx[2]/F"); | |
636 | t->Branch("dy", &fR[2], "dy[2]/F"); | |
637 | } else { | |
4226db3e | 638 | TObject *o = NULL; |
1ee39b3a | 639 | TIterator *iter=fResults->MakeIterator(); |
640 | while((o=((*iter)()))) o->Clear(); // maybe it is wrong but we should never reach this point | |
641 | } | |
642 | ||
1ee39b3a | 643 | // process resolution dependency on charge |
644 | if(HasProcess(kQRes)) ProcessCharge(); | |
645 | ||
646 | // process resolution dependency on y displacement | |
647 | if(HasProcess(kCenter)) ProcessCenterPad(); | |
648 | ||
649 | // process resolution dependency on drift legth and drift cell width | |
650 | if(HasProcess(kSigm)) ProcessSigma(); | |
651 | ||
652 | // process systematic shift on drift legth and drift cell width | |
653 | if(HasProcess(kMean)) ProcessMean(); | |
654 | ||
655 | return kTRUE; | |
656 | } | |
657 | ||
658 | //_______________________________________________________ | |
e3147647 | 659 | Bool_t AliTRDclusterResolution::LoadCalibration() |
1ee39b3a | 660 | { |
801d4d50 | 661 | // Retrieve calibration parameters from OCDB, drift velocity and t0 for the detector region specified by |
662 | // a previous call to AliTRDclusterResolution::SetCalibrationRegion(). | |
663 | ||
664 | AliCDBManager *cdb = AliCDBManager::Instance(); // init OCDB | |
1ee39b3a | 665 | if(cdb->GetRun() < 0){ |
666 | AliError("OCDB manager not properly initialized"); | |
667 | return kFALSE; | |
668 | } | |
669 | ||
670 | // check magnetic field | |
801d4d50 | 671 | AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent()); |
672 | if(!esd){ | |
673 | AliError("Failed retrieving ESD event"); | |
674 | return kFALSE; | |
675 | } | |
e3147647 | 676 | if(!esd->InitMagneticField()){ |
801d4d50 | 677 | AliError("Magnetic field failed initialization."); |
678 | return kFALSE; | |
1ee39b3a | 679 | } |
680 | ||
801d4d50 | 681 | // check pad for detector |
682 | if(fCol>=0 && fRow>=0){ | |
683 | AliTRDgeometry geo; | |
684 | AliTRDpadPlane *pp(geo.GetPadPlane(fDet)); | |
685 | if(fCol>=pp->GetNcols() || | |
686 | fRow>=pp->GetNrows()){ | |
687 | AliWarning(Form("Pad coordinates col[%d] or row[%d] incorrect for det[%d].\nLimits are max col[%d] max row[%d]. Reset to default", fCol, fRow, fDet, pp->GetNcols(), pp->GetNrows())); | |
688 | fCol = -1; fRow=-1; | |
689 | } | |
690 | } | |
1ee39b3a | 691 | |
692 | AliTRDcalibDB *fCalibration = AliTRDcalibDB::Instance(); | |
801d4d50 | 693 | AliTRDCalROC *fCalVdriftROC(fCalibration->GetVdriftROC(fDet>=0?fDet:0)) |
694 | ,*fCalT0ROC(fCalibration->GetT0ROC(fDet>=0?fDet:0)); | |
1ee39b3a | 695 | const AliTRDCalDet *fCalVdriftDet = fCalibration->GetVdriftDet(); |
5935a6da | 696 | const AliTRDCalDet *fCalT0Det = fCalibration->GetT0Det(); |
1ee39b3a | 697 | |
801d4d50 | 698 | fVdrift = fCalVdriftDet->GetValue(fDet>=0?fDet:0); |
699 | if(fCol>=0 && fRow>=0) fVdrift*= fCalVdriftROC->GetValue(fCol, fRow); | |
5935a6da | 700 | fExB = AliTRDCommonParam::Instance()->GetOmegaTau(fVdrift); |
801d4d50 | 701 | fT0 = fCalT0Det->GetValue(fDet>=0?fDet:0); |
702 | if(fCol>=0 && fRow>=0) fT0 *= fCalT0ROC->GetValue(fCol, fRow); | |
e3147647 | 703 | fGain = (fCol>=0 && fRow>=0)?fCalibration-> GetGainFactor(fDet, fCol, fRow):fCalibration-> GetGainFactorAverage(fDet); |
704 | SetBit(kCalibrated); | |
5935a6da | 705 | |
e3147647 | 706 | AliDebug(1, Form("Calibrate for Det[%3d] Col[%3d] Row[%2d] : \n t0[%5.3f] vd[%5.3f] gain[%5.3f] ExB[%f]", fDet, fCol, fRow, fT0, fVdrift, fGain, fExB)); |
5935a6da | 707 | |
1ee39b3a | 708 | return kTRUE; |
709 | } | |
710 | ||
801d4d50 | 711 | //_______________________________________________________ |
712 | void AliTRDclusterResolution::SetCalibrationRegion(Int_t det, Int_t col, Int_t row) | |
713 | { | |
714 | // Set calibration region in terms of detector and pad. | |
715 | // By default detector 0 mean values are considered. | |
716 | ||
717 | if(det>=0 && det<AliTRDgeometry::kNdet){ | |
718 | fDet = det; | |
719 | if(col>=0 && row>=0){ | |
720 | fCol = col; | |
721 | fRow = row; | |
722 | } | |
723 | return; | |
724 | } | |
725 | AliError(Form("Detector index outside range [0 %d].", AliTRDgeometry::kNdet)); | |
726 | } | |
727 | ||
1ee39b3a | 728 | //_______________________________________________________ |
729 | void AliTRDclusterResolution::SetVisual() | |
730 | { | |
731 | if(fCanvas) return; | |
732 | fCanvas = new TCanvas("clResCanvas", "Cluster Resolution Visualization", 10, 10, 600, 600); | |
733 | } | |
734 | ||
735 | //_______________________________________________________ | |
736 | void AliTRDclusterResolution::ProcessCharge() | |
737 | { | |
738 | // Resolution as a function of cluster charge. | |
739 | // | |
740 | // As described in the function ProcessCenterPad() the error parameterization for clusters for phi = a_L can be | |
741 | // written as: | |
742 | // BEGIN_LATEX | |
743 | // #sigma_{y}^{2} = #sigma_{y}^{2}|_{B=0} + tg^{2}(#alpha_{L})*#sigma_{x}^{2} | |
744 | // END_LATEX | |
745 | // with the contribution in case of B=0 given by: | |
746 | // BEGIN_LATEX | |
747 | // #sigma_{y}|_{B=0} = #sigma_{diff}*Gauss(0, s_{ly}) + #delta_{#sigma}(q) | |
748 | // END_LATEX | |
749 | // which further can be simplified to: | |
750 | // BEGIN_LATEX | |
751 | // <#sigma_{y}|_{B=0}>(q) = <#sigma_{y}> + #delta_{#sigma}(q) | |
752 | // <#sigma_{y}> = #int{f(q)#sigma_{y}dq} | |
753 | // END_LATEX | |
754 | // The results for s_y and f(q) are displayed below: | |
755 | //Begin_Html | |
756 | //<img src="TRD/clusterQerror.gif"> | |
757 | //End_Html | |
758 | // The function has to extended to accomodate gain calibration scalling and errors. | |
759 | // | |
760 | // Author | |
761 | // Alexandru Bercuci <A.Bercuci@gsi.de> | |
762 | ||
5935a6da | 763 | TH3S *h3(NULL); |
764 | if(!(h3 = (TH3S*)fContainer->At(kQRes))) { | |
1ee39b3a | 765 | AliWarning("Missing dy=f(Q) histo"); |
766 | return; | |
767 | } | |
768 | TF1 f("f", "gaus", -.5, .5); | |
5935a6da | 769 | TAxis *ax(NULL); |
770 | TH1 *h1(NULL); | |
1ee39b3a | 771 | |
772 | // compute mean error on x | |
773 | Double_t s2x = 0.; | |
5935a6da | 774 | for(Int_t ix=5; ix<AliTRDseedV1::kNtb; ix++){ |
1ee39b3a | 775 | // retrieve error on the drift length |
776 | s2x += AliTRDcluster::GetSX(ix); | |
777 | } | |
5935a6da | 778 | s2x /= (AliTRDseedV1::kNtb-5); s2x *= s2x; |
76d976d2 | 779 | //Double_t exb2 = fExB*fExB; |
1ee39b3a | 780 | |
781 | TObjArray *arr = (TObjArray*)fResults->At(kQRes); | |
782 | TGraphErrors *gqm = (TGraphErrors*)arr->At(0); | |
783 | TGraphErrors *gqs = (TGraphErrors*)arr->At(1); | |
784 | TGraphErrors *gqp = (TGraphErrors*)arr->At(2); | |
785 | Double_t q, n = 0., entries; | |
5935a6da | 786 | ax = h3->GetXaxis(); |
1ee39b3a | 787 | for(Int_t ix=1; ix<=ax->GetNbins(); ix++){ |
788 | q = TMath::Exp(ax->GetBinCenter(ix)); | |
5935a6da | 789 | ax->SetRange(ix, ix); |
790 | h1 = h3->Project3D("y"); | |
1ee39b3a | 791 | entries = h1->GetEntries(); |
5935a6da | 792 | if(entries < 150) continue; |
1ee39b3a | 793 | h1->Fit(&f, "Q"); |
794 | ||
795 | // Fill sy^2 = f(q) | |
796 | Int_t ip = gqm->GetN(); | |
797 | gqm->SetPoint(ip, q, 1.e4*f.GetParameter(1)); | |
798 | gqm->SetPointError(ip, 0., 1.e4*f.GetParError(1)); | |
799 | ||
800 | // correct sigma for ExB effect | |
5935a6da | 801 | gqs->SetPoint(ip, q, 1.e4*f.GetParameter(2)/**f.GetParameter(2)-exb2*s2x)*/); |
802 | gqs->SetPointError(ip, 0., 1.e4*f.GetParError(2)/**f.GetParameter(2)*/); | |
1ee39b3a | 803 | |
804 | // save probability | |
805 | n += entries; | |
806 | gqp->SetPoint(ip, q, entries); | |
807 | gqp->SetPointError(ip, 0., 0./*TMath::Sqrt(entries)*/); | |
808 | } | |
809 | ||
810 | // normalize probability and get mean sy | |
811 | Double_t sm = 0., sy; | |
812 | for(Int_t ip=gqp->GetN(); ip--;){ | |
813 | gqp->GetPoint(ip, q, entries); | |
814 | entries/=n; | |
5935a6da | 815 | gqp->SetPoint(ip, q, 1.e4*entries); |
1ee39b3a | 816 | gqs->GetPoint(ip, q, sy); |
817 | sm += entries*sy; | |
818 | } | |
819 | ||
820 | // error parametrization s(q) = <sy> + b(1/q-1/q0) | |
821 | TF1 fq("fq", "[0] + [1]/x", 20., 250.); | |
822 | gqs->Fit(&fq/*, "W"*/); | |
823 | printf("sm=%f [0]=%f [1]=%f\n", 1.e-4*sm, fq.GetParameter(0), fq.GetParameter(1)); | |
824 | printf(" const Float_t sq0inv = %f; // [1/q0]\n", (sm-fq.GetParameter(0))/fq.GetParameter(1)); | |
825 | printf(" const Float_t sqb = %f; // [cm]\n", 1.e-4*fq.GetParameter(1)); | |
826 | } | |
827 | ||
828 | //_______________________________________________________ | |
829 | void AliTRDclusterResolution::ProcessCenterPad() | |
830 | { | |
831 | // Resolution as a function of y displacement from pad center and drift length. | |
832 | // | |
833 | // Since the error parameterization of cluster r-phi position can be written as (see AliTRDcluster::SetSigmaY2()): | |
834 | // BEGIN_LATEX | |
835 | // #sigma_{y}^{2} = (#sigma_{diff}*Gauss(0, s_{ly}) + #delta_{#sigma}(q))^{2} + tg^{2}(#alpha_{L})*#sigma_{x}^{2} + tg^{2}(#phi-#alpha_{L})*#sigma_{x}^{2}+[tg(#phi-#alpha_{L})*tg(#alpha_{L})*x]^{2}/12 | |
836 | // END_LATEX | |
837 | // one can see that for phi = a_L one gets the following expression: | |
838 | // BEGIN_LATEX | |
839 | // #sigma_{y}^{2} = #sigma_{y}^{2}|_{B=0} + tg^{2}(#alpha_{L})*#sigma_{x}^{2} | |
840 | // END_LATEX | |
841 | // where we have explicitely marked the remaining term in case of absence of magnetic field. Thus one can use the | |
842 | // previous equation to estimate s_y for B=0 and than by comparing in magnetic field conditions one can get the s_x. | |
843 | // This is a simplified method to determine the error parameterization for s_x and s_y as compared to the one | |
844 | // implemented in ProcessSigma(). For more details on cluster error parameterization please see also | |
845 | // AliTRDcluster::SetSigmaY2() | |
846 | // | |
847 | // The representation of dy=f(y_cen, x_drift| layer) can be also used to estimate the systematic shift in the r-phi | |
848 | // coordinate resulting from imperfection in the cluster shape parameterization. From the expresion of the shift derived | |
849 | // in ProcessMean() with phi=exb one gets: | |
850 | // BEGIN_LATEX | |
851 | // <#Delta y>= <#delta x> * (tg(#alpha_{L})-h*dz/dx) + <#delta y - #delta x * tg(#alpha_{L})> | |
852 | // <#Delta y>(y_{cen})= -h*<#delta x>(x_{drift}, q_{cl}) * dz/dx + #delta y(y_{cen}, ...) | |
853 | // END_LATEX | |
854 | // where all dependences are made explicit. This last expression can be used in two ways: | |
855 | // - by average on the dz/dx we can determine directly dy (the method implemented here) | |
856 | // - by plotting as a function of dzdx one can determine both dx and dy components in an independent method. | |
857 | //Begin_Html | |
858 | //<img src="TRD/clusterYcorr.gif"> | |
859 | //End_Html | |
860 | // Author | |
861 | // Alexandru Bercuci <A.Bercuci@gsi.de> | |
862 | ||
863 | TObjArray *arr = (TObjArray*)fContainer->At(kCenter); | |
864 | if(!arr) { | |
865 | AliWarning("Missing dy=f(y | x, ly) container"); | |
866 | return; | |
867 | } | |
868 | Double_t exb2 = fExB*fExB; | |
869 | Float_t s[AliTRDgeometry::kNlayer]; | |
870 | TF1 f("f", "gaus", -.5, .5); | |
871 | TF1 fp("fp", "gaus", -3.5, 3.5); | |
872 | ||
4226db3e | 873 | TH1D *h1 = NULL; TH2F *h2 = NULL; TH3S *h3r=NULL, *h3p=NULL; |
1ee39b3a | 874 | TObjArray *arrRes = (TObjArray*)fResults->At(kCenter); |
875 | TTree *t = (TTree*)arrRes->At(0); | |
4226db3e | 876 | TGraphErrors *gs = NULL; |
877 | TAxis *ax = NULL; | |
1ee39b3a | 878 | |
5935a6da | 879 | AliDebug(1, Form("Calibrate for Det[%3d] t0[%5.3f] vd[%5.3f]", fDet, fT0, fVdrift)); |
880 | ||
1ee39b3a | 881 | const Int_t nl = AliTRDgeometry::kNlayer; |
5935a6da | 882 | printf(" const Float_t lSy[%d][%d] = {\n {", nl, AliTRDseedV1::kNtb); |
1ee39b3a | 883 | for(Int_t il=0; il<nl; il++){ |
884 | if(!(h3r = (TH3S*)arr->At(il))) continue; | |
885 | if(!(h3p = (TH3S*)arr->At(nl+il))) continue; | |
886 | gs = (TGraphErrors*)arrRes->At(il+1); | |
887 | fLy = il; | |
1ee39b3a | 888 | for(Int_t ix=1; ix<=h3r->GetXaxis()->GetNbins(); ix++){ |
889 | ax = h3r->GetXaxis(); ax->SetRange(ix, ix); | |
890 | ax = h3p->GetXaxis(); ax->SetRange(ix, ix); | |
5935a6da | 891 | fT = ax->GetBinCenter(ix); |
1ee39b3a | 892 | for(Int_t iy=1; iy<=h3r->GetYaxis()->GetNbins(); iy++){ |
893 | ax = h3r->GetYaxis(); ax->SetRange(iy, iy); | |
894 | ax = h3p->GetYaxis(); ax->SetRange(iy, iy); | |
895 | fY = ax->GetBinCenter(iy); | |
1ee39b3a | 896 | // finish navigation in the HnSparse |
897 | ||
898 | h1 = (TH1D*)h3r->Project3D("z"); | |
899 | Int_t entries = (Int_t)h1->Integral(); | |
900 | if(entries < 50) continue; | |
901 | //Adjust(&f, h1); | |
902 | h1->Fit(&f, "QN"); | |
903 | ||
904 | // Fill sy,my=f(y_w,x,ly) | |
905 | fR[0] = f.GetParameter(1); fR[1] = f.GetParError(1); | |
906 | fR[2] = f.GetParameter(2); fR[3] = f.GetParError(2); | |
907 | ||
908 | h1 = (TH1D*)h3p->Project3D("z"); | |
909 | h1->Fit(&fp, "QN"); | |
910 | fP[0] = fp.GetParameter(1); fP[1] = fp.GetParError(1); | |
911 | fP[2] = fp.GetParameter(2); fP[3] = fp.GetParError(2); | |
912 | ||
ca50a37e | 913 | AliDebug(4, Form("ly[%d] tb[%2d] y[%+5.2f] m[%5.3f] s[%5.3f] pm[%5.3f] ps[%5.3f]", fLy, (Int_t)fT, fY, fR[0], fR[2], fP[0], fP[2])); |
1ee39b3a | 914 | t->Fill(); |
1ee39b3a | 915 | } |
916 | } | |
5935a6da | 917 | t->Draw(Form("y:t>>h(%d, -0.5, %f, 51, -.51, .51)", AliTRDseedV1::kNtb, AliTRDseedV1::kNtb-0.5), |
1ee39b3a | 918 | Form("s[0]*(ly==%d&&abs(m[0])<1.e-1)", fLy), |
919 | "goff"); | |
920 | h2=(TH2F*)gROOT->FindObject("h"); | |
921 | f.FixParameter(1, 0.); | |
922 | Int_t n = h2->GetXaxis()->GetNbins(), nn(0); s[il]=0.; | |
923 | printf(" {"); | |
924 | for(Int_t ix=1; ix<=n; ix++){ | |
925 | ax = h2->GetXaxis(); | |
5935a6da | 926 | fT = ax->GetBinCenter(ix); |
1ee39b3a | 927 | h1 = h2->ProjectionY("hCenPy", ix, ix); |
928 | //if((Int_t)h1->Integral() < 1.e-10) continue; | |
929 | ||
930 | // Apply lorentz angle correction | |
931 | // retrieve error on the drift length | |
932 | Double_t s2x = AliTRDcluster::GetSX(ix-1); s2x *= s2x; | |
933 | Int_t nnn = 0; | |
934 | for(Int_t iy=1; iy<=h1->GetNbinsX(); iy++){ | |
935 | Double_t s2 = h1->GetBinContent(iy); s2*= s2; | |
936 | // sigma square corrected for Lorentz angle | |
937 | // s2 = s2_y(y_w,x)+exb2*s2_x | |
938 | Double_t sy = TMath::Sqrt(TMath::Max(s2 - exb2*s2x, Double_t(0.))); | |
939 | if(sy<1.e-20) continue; | |
940 | h1->SetBinContent(iy, sy); nnn++; | |
5935a6da | 941 | AliDebug(4, Form("s[%6.2f] sx[%6.2f] sy[%6.2f]\n", |
1ee39b3a | 942 | 1.e4*TMath::Sqrt(s2), 1.e4*TMath::Abs(fExB*AliTRDcluster::GetSX(ix-1)), |
5935a6da | 943 | 1.e4*h1->GetBinContent(iy))); |
1ee39b3a | 944 | } |
945 | // do fit only if enough data | |
946 | Double_t sPRF = 0.; | |
947 | if(nnn>5){ | |
948 | h1->Fit(&f, "QN"); | |
5935a6da | 949 | sPRF = f.GetParameter(2); nn++; |
1ee39b3a | 950 | } |
951 | s[il]+=sPRF; | |
952 | printf("%6.4f,%s", sPRF, ix%6?" ":"\n "); | |
953 | Int_t jx = gs->GetN(); | |
5935a6da | 954 | gs->SetPoint(jx, fT, 1.e4*sPRF); |
1ee39b3a | 955 | gs->SetPointError(jx, 0., 0./*f.GetParError(0)*/); |
956 | } | |
957 | printf("\b},\n"); | |
958 | s[il]/=nn; | |
959 | ||
5935a6da | 960 | f.ReleaseParameter(1); |
1ee39b3a | 961 | |
962 | ||
963 | if(!fCanvas) continue; | |
964 | h2->Draw("lego2fb"); | |
965 | fCanvas->Modified(); fCanvas->Update(); | |
966 | if(IsSaveAs()) fCanvas->SaveAs(Form("Figures/ProcessCenter_ly[%d].gif", fLy)); | |
967 | else gSystem->Sleep(100); | |
968 | } | |
969 | printf(" };\n"); | |
970 | printf(" const Float_t lPRF[] = {" | |
971 | "%5.3f, %5.3f, %5.3f, %5.3f, %5.3f, %5.3f};\n", | |
972 | s[0], s[1], s[2], s[3], s[4], s[5]); | |
973 | } | |
974 | ||
975 | //_______________________________________________________ | |
976 | void AliTRDclusterResolution::ProcessSigma() | |
977 | { | |
978 | // As the r-phi coordinate is the only one which is measured by the TRD detector we have to rely on it to | |
979 | // estimate both the radial (x) and r-phi (y) errors. This method is based on the following assumptions. | |
980 | // The measured error in the y direction is the sum of the intrinsic contribution of the r-phi measurement | |
981 | // with the contribution of the radial measurement - because x is not a parameter of Alice track model (Kalman). | |
982 | // BEGIN_LATEX | |
983 | // #sigma^{2}|_{y} = #sigma^{2}_{y*} + #sigma^{2}_{x*} | |
984 | // END_LATEX | |
985 | // In the general case | |
986 | // BEGIN_LATEX | |
987 | // #sigma^{2}_{y*} = #sigma^{2}_{y} + tg^{2}(#alpha_{L})#sigma^{2}_{x_{drift}} | |
988 | // #sigma^{2}_{x*} = tg^{2}(#phi - #alpha_{L})*(#sigma^{2}_{x_{drift}} + #sigma^{2}_{x_{0}} + tg^{2}(#alpha_{L})*x^{2}/12) | |
989 | // END_LATEX | |
990 | // where we have explicitely show the lorentz angle correction on y and the projection of radial component on the y | |
991 | // direction through the track angle in the bending plane (phi). Also we have shown that the radial component in the | |
992 | // last equation has twp terms, the drift and the misalignment (x_0). For ideal geometry or known misalignment one | |
993 | // can solve the equation | |
994 | // BEGIN_LATEX | |
995 | // #sigma^{2}|_{y} = tg^{2}(#phi - #alpha_{L})*(#sigma^{2}_{x} + tg^{2}(#alpha_{L})*x^{2}/12)+ [#sigma^{2}_{y} + tg^{2}(#alpha_{L})#sigma^{2}_{x}] | |
996 | // END_LATEX | |
997 | // by fitting a straight line: | |
998 | // BEGIN_LATEX | |
999 | // #sigma^{2}|_{y} = a(x_{cl}, z_{cl}) * tg^{2}(#phi - #alpha_{L}) + b(x_{cl}, z_{cl}) | |
1000 | // END_LATEX | |
1001 | // the error parameterization will be given by: | |
1002 | // BEGIN_LATEX | |
1003 | // #sigma_{x} (x_{cl}, z_{cl}) = #sqrt{a(x_{cl}, z_{cl}) - tg^{2}(#alpha_{L})*x^{2}/12} | |
1004 | // #sigma_{y} (x_{cl}, z_{cl}) = #sqrt{b(x_{cl}, z_{cl}) - #sigma^{2}_{x} (x_{cl}, z_{cl}) * tg^{2}(#alpha_{L})} | |
1005 | // END_LATEX | |
1006 | // Below there is an example of such dependency. | |
1007 | //Begin_Html | |
1008 | //<img src="TRD/clusterSigmaMethod.gif"> | |
1009 | //End_Html | |
1010 | // | |
1011 | // The error parameterization obtained by this method are implemented in the functions AliTRDcluster::GetSX() and | |
1012 | // AliTRDcluster::GetSYdrift(). For an independent method to determine s_y as a function of drift length check the | |
1013 | // function ProcessCenterPad(). One has to keep in mind that while this method return the mean s_y over the distance | |
1014 | // to pad center distribution the other method returns the *STANDARD* value at center=0 (maximum). To recover the | |
1015 | // standard value one has to solve the obvious equation: | |
1016 | // BEGIN_LATEX | |
1017 | // #sigma_{y}^{STANDARD} = #frac{<#sigma_{y}>}{#int{s exp(s^{2}/#sigma) ds}} | |
1018 | // END_LATEX | |
1019 | // with "<s_y>" being the value calculated here and "sigma" the width of the s_y distribution calculated in | |
1020 | // ProcessCenterPad(). | |
1021 | // | |
1022 | // Author | |
1023 | // Alexandru Bercuci <A.Bercuci@gsi.de> | |
1024 | ||
1025 | TObjArray *arr = (TObjArray*)fContainer->At(kSigm); | |
1026 | if(!arr){ | |
1027 | AliWarning("Missing dy=f(x_d, d_w) container"); | |
1028 | return; | |
1029 | } | |
1030 | ||
1031 | // init visualization | |
4226db3e | 1032 | TGraphErrors *ggs = NULL; |
1033 | TGraph *line = NULL; | |
1ee39b3a | 1034 | if(fCanvas){ |
1035 | ggs = new TGraphErrors(); | |
1036 | line = new TGraph(); | |
1037 | line->SetLineColor(kRed);line->SetLineWidth(2); | |
1038 | } | |
1039 | ||
1040 | // init logistic support | |
1041 | TF1 f("f", "gaus", -.5, .5); | |
1042 | TLinearFitter gs(1,"pol1"); | |
4226db3e | 1043 | TH1 *hFrame=NULL; |
1044 | TH1D *h1 = NULL; TH3S *h3=NULL; | |
1045 | TAxis *ax = NULL; | |
5935a6da | 1046 | Double_t exb2 = fExB*fExB; |
1ee39b3a | 1047 | AliTRDcluster c; |
1048 | TTree *t = (TTree*)fResults->At(kSigm); | |
5935a6da | 1049 | for(Int_t ix=0; ix<AliTRDseedV1::kNtb; ix++){ |
1ee39b3a | 1050 | if(!(h3=(TH3S*)arr->At(ix))) continue; |
1051 | c.SetPadTime(ix); | |
5935a6da | 1052 | fX = c.GetXloc(fT0, fVdrift); |
1053 | fT = c.GetLocalTimeBin(); // ideal | |
1054 | printf(" pad time[%d] local[%f]\n", ix, fT); | |
1ee39b3a | 1055 | for(Int_t iz=1; iz<=h3->GetXaxis()->GetNbins(); iz++){ |
1056 | ax = h3->GetXaxis(); | |
1057 | ax->SetRange(iz, iz); | |
1058 | fZ = ax->GetBinCenter(iz); | |
1059 | ||
1060 | // reset visualization | |
1061 | if(fCanvas){ | |
1062 | new(ggs) TGraphErrors(); | |
1063 | ggs->SetMarkerStyle(7); | |
1064 | } | |
1065 | gs.ClearPoints(); | |
1066 | ||
1067 | for(Int_t ip=1; ip<=h3->GetYaxis()->GetNbins(); ip++){ | |
1068 | ax = h3->GetYaxis(); | |
1069 | ax->SetRange(ip, ip); | |
1070 | Double_t tgl = ax->GetBinCenter(ip); | |
1071 | // finish navigation in the HnSparse | |
1072 | ||
1073 | //if(TMath::Abs(dydx)>0.18) continue; | |
1074 | Double_t tgg = (tgl-fExB)/(1.+tgl*fExB); | |
1075 | Double_t tgg2 = tgg*tgg; | |
1076 | ||
1077 | h1 = (TH1D*)h3->Project3D("z"); | |
1078 | Int_t entries = (Int_t)h1->Integral(); | |
1079 | if(entries < 50) continue; | |
1080 | //Adjust(&f, h1); | |
1081 | h1->Fit(&f, "QN"); | |
1082 | ||
1083 | Double_t s2 = f.GetParameter(2)*f.GetParameter(2); | |
1084 | Double_t s2e = 2.*f.GetParameter(2)*f.GetParError(2); | |
1085 | // Fill sy^2 = f(tg^2(phi-a_L)) | |
1086 | gs.AddPoint(&tgg2, s2, s2e); | |
1087 | ||
1088 | if(!ggs) continue; | |
1089 | Int_t jp = ggs->GetN(); | |
1090 | ggs->SetPoint(jp, tgg2, s2); | |
1091 | ggs->SetPointError(jp, 0., s2e); | |
1092 | } | |
1093 | // TODO here a more robust fit method has to be provided | |
1094 | // for which lower boundaries on the parameters have to | |
1095 | // be imposed. Unfortunately the Minuit fit does not work | |
1096 | // for the TGraph in the case of B not 0. | |
1097 | if(gs.Eval()) continue; | |
1098 | ||
5935a6da | 1099 | fR[0] = gs.GetParameter(1) - fX*fX*exb2/12.; |
1100 | AliDebug(3, Form(" s2x+x2=%f ang=%f s2x=%f", gs.GetParameter(1), fX*fX*exb2/12., fR[0])); | |
1ee39b3a | 1101 | fR[0] = TMath::Max(fR[0], Float_t(4.e-4)); |
1102 | ||
1103 | // s^2_y = s0^2_y + tg^2(a_L) * s^2_x | |
1104 | // s0^2_y = f(D_L)*x + s_PRF^2 | |
1105 | fR[2]= gs.GetParameter(0)-exb2*fR[0]; | |
5935a6da | 1106 | AliDebug(3, Form(" s2y+s2x=%f s2y=%f", fR[0], fR[2])); |
1ee39b3a | 1107 | fR[2] = TMath::Max(fR[2], Float_t(2.5e-5)); |
1108 | fR[0] = TMath::Sqrt(fR[0]); | |
1109 | fR[1] = .5*gs.GetParError(1)/fR[0]; | |
1110 | fR[2] = TMath::Sqrt(fR[2]); | |
1111 | fR[3] = gs.GetParError(0)+exb2*exb2*gs.GetParError(1); | |
1112 | t->Fill(); | |
5935a6da | 1113 | AliDebug(2, Form("xd=%4.2f[cm] sx=%6.1f[um] sy=%5.1f[um]", fX, 1.e4*fR[0], 1.e4*fR[2])); |
1ee39b3a | 1114 | |
1115 | if(!fCanvas) continue; | |
1116 | fCanvas->cd(); fCanvas->SetLogx(); //fCanvas->SetLogy(); | |
1117 | if(!hFrame){ | |
1118 | fCanvas->SetMargin(0.15, 0.01, 0.1, 0.01); | |
1119 | hFrame=new TH1I("hFrame", "", 100, 0., .3); | |
1120 | hFrame->SetMinimum(0.);hFrame->SetMaximum(.005); | |
1121 | hFrame->SetXTitle("tg^{2}(#phi-#alpha_{L})"); | |
1122 | hFrame->SetYTitle("#sigma^{2}y[cm^{2}]"); | |
1123 | hFrame->GetYaxis()->SetTitleOffset(2.); | |
1124 | hFrame->SetLineColor(1);hFrame->SetLineWidth(1); | |
1125 | hFrame->Draw(); | |
1126 | } else hFrame->Reset(); | |
1127 | Double_t xx = 0., dxx=.2/50; | |
1128 | for(Int_t ip=0;ip<50;ip++){ | |
1129 | line->SetPoint(ip, xx, gs.GetParameter(0)+xx*gs.GetParameter(1)); | |
1130 | xx+=dxx; | |
1131 | } | |
1132 | ggs->Draw("pl"); line->Draw("l"); | |
1133 | fCanvas->Modified(); fCanvas->Update(); | |
1134 | if(IsSaveAs()) fCanvas->SaveAs(Form("Figures/ProcessSigma_z[%5.3f]_x[%5.3f].gif", fZ, fX)); | |
1135 | else gSystem->Sleep(100); | |
1136 | } | |
1137 | } | |
1138 | return; | |
1139 | } | |
1140 | ||
1141 | //_______________________________________________________ | |
1142 | void AliTRDclusterResolution::ProcessMean() | |
1143 | { | |
1144 | // By this method the cluster shift in r-phi and radial directions can be estimated by comparing with the MC. | |
1145 | // The resolution of the cluster corrected for pad tilt with respect to MC in the r-phi (measuring) plane can be | |
1146 | // expressed by: | |
1147 | // BEGIN_LATEX | |
1148 | // #Delta y=w - y_{MC}(x_{cl}) | |
1149 | // w = y_{cl}^{'} + h*(z_{MC}(x_{cl})-z_{cl}) | |
1150 | // y_{MC}(x_{cl}) = y_{0} - dy/dx*x_{cl} | |
1151 | // z_{MC}(x_{cl}) = z_{0} - dz/dx*x_{cl} | |
1152 | // y_{cl}^{'} = y_{cl}-x_{cl}*tg(#alpha_{L}) | |
1153 | // END_LATEX | |
1154 | // where x_cl is the drift length attached to a cluster, y_cl is the r-phi coordinate of the cluster measured by | |
1155 | // charge sharing on adjacent pads and y_0 and z_0 are MC reference points (as example the track references at | |
1156 | // entrance/exit of a chamber). If we suppose that both r-phi (y) and radial (x) coordinate of the clusters are | |
1157 | // affected by errors we can write | |
1158 | // BEGIN_LATEX | |
1159 | // x_{cl} = x_{cl}^{*} + #delta x | |
1160 | // y_{cl} = y_{cl}^{*} + #delta y | |
1161 | // END_LATEX | |
1162 | // where the starred components are the corrected values. Thus by definition the following quantity | |
1163 | // BEGIN_LATEX | |
1164 | // #Delta y^{*}= w^{*} - y_{MC}(x_{cl}^{*}) | |
1165 | // END_LATEX | |
1166 | // has 0 average over all dependency. Using this decomposition we can write: | |
1167 | // BEGIN_LATEX | |
1168 | // <#Delta y>=<#Delta y^{*}> + <#delta x * (dy/dx-h*dz/dx) + #delta y - #delta x * tg(#alpha_{L})> | |
1169 | // END_LATEX | |
1170 | // which can be transformed to the following linear dependence: | |
1171 | // BEGIN_LATEX | |
1172 | // <#Delta y>= <#delta x> * (dy/dx-h*dz/dx) + <#delta y - #delta x * tg(#alpha_{L})> | |
1173 | // END_LATEX | |
1174 | // if expressed as function of dy/dx-h*dz/dx. Furtheremore this expression can be plotted for various clusters | |
1175 | // i.e. we can explicitely introduce the diffusion (x_cl) and drift cell - anisochronity (z_cl) dependences. From | |
1176 | // plotting this dependence and linear fitting it with: | |
1177 | // BEGIN_LATEX | |
1178 | // <#Delta y>= a(x_{cl}, z_{cl}) * (dy/dx-h*dz/dx) + b(x_{cl}, z_{cl}) | |
1179 | // END_LATEX | |
1180 | // the systematic shifts will be given by: | |
1181 | // BEGIN_LATEX | |
1182 | // #delta x (x_{cl}, z_{cl}) = a(x_{cl}, z_{cl}) | |
1183 | // #delta y (x_{cl}, z_{cl}) = b(x_{cl}, z_{cl}) + a(x_{cl}, z_{cl}) * tg(#alpha_{L}) | |
1184 | // END_LATEX | |
1185 | // Below there is an example of such dependency. | |
1186 | //Begin_Html | |
1187 | //<img src="TRD/clusterShiftMethod.gif"> | |
1188 | //End_Html | |
1189 | // | |
1190 | // The occurance of the radial shift is due to the following conditions | |
1191 | // - the approximation of a constant drift velocity over the drift length (larger drift velocities close to | |
1192 | // cathode wire plane) | |
1193 | // - the superposition of charge tails in the amplification region (first clusters appear to be located at the | |
1194 | // anode wire) | |
1195 | // - the superposition of charge tails in the drift region (shift towards anode wire) | |
1196 | // - diffusion effects which convolute with the TRF thus enlarging it | |
1197 | // - approximate knowledge of the TRF (approximate measuring in test beam conditions) | |
1198 | // | |
1199 | // The occurance of the r-phi shift is due to the following conditions | |
1200 | // - approximate model for cluster shape (LUT) | |
1201 | // - rounding-up problems | |
1202 | // | |
1203 | // The numerical results for ideal simulations for the radial and r-phi shifts are displayed below and used | |
1204 | // for the cluster reconstruction (see the functions AliTRDcluster::GetXcorr() and AliTRDcluster::GetYcorr()). | |
1205 | //Begin_Html | |
1206 | //<img src="TRD/clusterShiftX.gif"> | |
1207 | //<img src="TRD/clusterShiftY.gif"> | |
1208 | //End_Html | |
1209 | // More details can be found in the presentation given during the TRD | |
1210 | // software meeting at the end of 2008 and beginning of year 2009, published on indico.cern.ch. | |
1211 | // | |
1212 | // Author | |
1213 | // Alexandru Bercuci <A.Bercuci@gsi.de> | |
1214 | ||
1215 | ||
1216 | ||
1217 | TObjArray *arr = (TObjArray*)fContainer->At(kMean); | |
1218 | if(!arr){ | |
1219 | AliWarning("Missing dy=f(x_d, d_w) container"); | |
1220 | return; | |
1221 | } | |
1222 | ||
1223 | // init logistic support | |
1224 | TF1 f("f", "gaus", -.5, .5); | |
1225 | TF1 line("l", "[0]+[1]*x", -.15, .15); | |
1226 | TGraphErrors *gm = new TGraphErrors(); | |
4226db3e | 1227 | TH1 *hFrame=NULL; |
1228 | TH1D *h1 = NULL; TH3S *h3 =NULL; | |
1229 | TAxis *ax = NULL; | |
5935a6da | 1230 | |
1231 | AliDebug(1, Form("Calibrate for Det[%3d] t0[%5.3f] vd[%5.3f]", fDet, fT0, fVdrift)); | |
1ee39b3a | 1232 | |
1233 | AliTRDcluster c; | |
1234 | TTree *t = (TTree*)fResults->At(kMean); | |
5935a6da | 1235 | for(Int_t ix=0; ix<AliTRDseedV1::kNtb; ix++){ |
1ee39b3a | 1236 | if(!(h3=(TH3S*)arr->At(ix))) continue; |
1237 | c.SetPadTime(ix); | |
5935a6da | 1238 | fX = c.GetXloc(fT0, fVdrift); |
1239 | fT = c.GetLocalTimeBin(); | |
1ee39b3a | 1240 | for(Int_t iz=1; iz<=h3->GetXaxis()->GetNbins(); iz++){ |
1241 | ax = h3->GetXaxis(); | |
1242 | ax->SetRange(iz, iz); | |
1243 | fZ = ax->GetBinCenter(iz); | |
1244 | ||
1245 | // reset fitter | |
1246 | new(gm) TGraphErrors(); | |
1247 | gm->SetMarkerStyle(7); | |
1248 | ||
1249 | for(Int_t ip=1; ip<=h3->GetYaxis()->GetNbins(); ip++){ | |
1250 | ax = h3->GetYaxis(); | |
1251 | ax->SetRange(ip, ip); | |
1252 | Double_t tgl = ax->GetBinCenter(ip); | |
1253 | // finish navigation in the HnSparse | |
1254 | ||
1255 | h1 = (TH1D*)h3->Project3D("z"); | |
1256 | Int_t entries = (Int_t)h1->Integral(); | |
b9ddd472 | 1257 | if(entries < 50) continue; |
1ee39b3a | 1258 | //Adjust(&f, h1); |
1259 | h1->Fit(&f, "QN"); | |
1260 | ||
1261 | // Fill <Dy> = f(dydx - h*dzdx) | |
1262 | Int_t jp = gm->GetN(); | |
1263 | gm->SetPoint(jp, tgl, f.GetParameter(1)); | |
1264 | gm->SetPointError(jp, 0., f.GetParError(1)); | |
1265 | } | |
5935a6da | 1266 | if(gm->GetN()<10) continue; |
1ee39b3a | 1267 | |
1268 | gm->Fit(&line, "QN"); | |
1269 | fR[0] = line.GetParameter(1); // dx | |
1270 | fR[1] = line.GetParError(1); | |
1271 | fR[2] = line.GetParameter(0) + fExB*fR[0]; // xs = dy - tg(a_L)*dx | |
1272 | t->Fill(); | |
5935a6da | 1273 | AliDebug(2, Form("tb[%02d] xd=%4.2f[cm] dx=%6.2f[um] dy=%6.2f[um]", ix, fX, 1.e4*fR[0], 1.e4*fR[2])); |
1ee39b3a | 1274 | if(!fCanvas) continue; |
5935a6da | 1275 | |
1ee39b3a | 1276 | fCanvas->cd(); |
1277 | if(!hFrame){ | |
1278 | fCanvas->SetMargin(0.1, 0.02, 0.1, 0.01); | |
1279 | hFrame=new TH1I("hFrame", "", 100, -.3, .3); | |
1280 | hFrame->SetMinimum(-.1);hFrame->SetMaximum(.1); | |
1281 | hFrame->SetXTitle("tg#phi-htg#theta"); | |
1282 | hFrame->SetYTitle("#Delta y[cm]"); | |
1283 | hFrame->GetYaxis()->SetTitleOffset(1.5); | |
1284 | hFrame->SetLineColor(1);hFrame->SetLineWidth(1); | |
1285 | hFrame->Draw(); | |
1286 | } else hFrame->Reset(); | |
1287 | gm->Draw("pl"); line.Draw("same"); | |
1288 | fCanvas->Modified(); fCanvas->Update(); | |
5935a6da | 1289 | if(IsSaveAs()) fCanvas->SaveAs(Form("Figures/ProcessMean_Z[%5.3f]_TB[%02d].gif", fZ, ix)); |
1ee39b3a | 1290 | else gSystem->Sleep(100); |
1291 | } | |
1292 | } | |
1293 | } |