]>
Commit | Line | Data |
---|---|---|
81e97e0d | 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-commercial 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 | ||
17 | ||
18 | ||
19 | //----------------------------------------------------------------- | |
20 | // Implementation of the TPC seed class | |
21 | // This class is used by the AliTPCtrackerMI class | |
22 | // Origin: Marian Ivanov, CERN, Marian.Ivanov@cern.ch | |
23 | //----------------------------------------------------------------- | |
24 | #include "TClonesArray.h" | |
25 | #include "AliTPCseed.h" | |
26 | ||
27 | ClassImp(AliTPCseed) | |
28 | ||
29 | ||
30 | ||
31 | AliTPCseed::AliTPCseed():AliTPCtrack(){ | |
32 | // | |
33 | fRow=0; | |
34 | fRemoval =0; | |
35 | for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3); | |
36 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; | |
37 | for (Int_t i=0;i<3;i++) fKinkIndexes[i]=0; | |
38 | for (Int_t i=0;i<5;i++) fTPCr[i]=0.2; | |
39 | fPoints = 0; | |
40 | fEPoints = 0; | |
41 | fNFoundable =0; | |
42 | fNShared =0; | |
43 | fRemoval = 0; | |
44 | fSort =0; | |
45 | fFirstPoint =0; | |
46 | fNoCluster =0; | |
47 | fBSigned = kFALSE; | |
48 | fSeed1 =-1; | |
49 | fSeed2 =-1; | |
50 | fCurrentCluster =0; | |
51 | fCurrentSigmaY2=0; | |
52 | fCurrentSigmaZ2=0; | |
53 | fCircular = 0; // not curling track | |
54 | } | |
55 | AliTPCseed::AliTPCseed(const AliTPCseed &s):AliTPCtrack(s){ | |
56 | //--------------------- | |
57 | // dummy copy constructor | |
58 | //------------------------- | |
59 | for (Int_t i=0;i<160;i++) fClusterPointer[i] = s.fClusterPointer[i]; | |
60 | for (Int_t i=0;i<160;i++) fIndex[i] = s.fIndex[i]; | |
61 | ||
62 | fPoints = 0; | |
63 | fEPoints = 0; | |
64 | fCircular =0; | |
65 | } | |
66 | AliTPCseed::AliTPCseed(const AliTPCtrack &t):AliTPCtrack(t){ | |
67 | // | |
68 | //copy constructor | |
69 | fPoints = 0; | |
70 | fEPoints = 0; | |
71 | fNShared =0; | |
72 | // fTrackPoints =0; | |
73 | fRemoval =0; | |
74 | fSort =0; | |
75 | for (Int_t i=0;i<3;i++) fKinkIndexes[i]=t.GetKinkIndex(i); | |
76 | ||
77 | for (Int_t i=0;i<160;i++) { | |
78 | fClusterPointer[i] = 0; | |
79 | Int_t index = t.GetClusterIndex(i); | |
80 | if (index>=-1){ | |
81 | SetClusterIndex2(i,index); | |
82 | } | |
83 | else{ | |
84 | SetClusterIndex2(i,-3); | |
85 | } | |
86 | } | |
87 | fFirstPoint =0; | |
88 | fNoCluster =0; | |
89 | fBSigned = kFALSE; | |
90 | fSeed1 =-1; | |
91 | fSeed2 =-1; | |
92 | fCurrentCluster =0; | |
93 | fCurrentSigmaY2=0; | |
94 | fCurrentSigmaZ2=0; | |
95 | fCircular =0; | |
96 | } | |
97 | ||
98 | AliTPCseed::AliTPCseed(UInt_t index, const Double_t xx[5], const Double_t cc[15], | |
99 | Double_t xr, Double_t alpha): | |
100 | AliTPCtrack(index, xx, cc, xr, alpha) { | |
101 | // | |
102 | // | |
103 | //constructor | |
104 | fRow =0; | |
105 | for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3); | |
106 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; | |
107 | for (Int_t i=0;i<3;i++) fKinkIndexes[i]=0; | |
108 | for (Int_t i=0;i<5;i++) fTPCr[i]=0.2; | |
109 | ||
110 | fPoints = 0; | |
111 | fEPoints = 0; | |
112 | fNFoundable =0; | |
113 | fNShared = 0; | |
114 | // fTrackPoints =0; | |
115 | fRemoval =0; | |
116 | fSort =0; | |
117 | fFirstPoint =0; | |
118 | // fHelixIn = new TClonesArray("AliHelix",0); | |
119 | //fHelixOut = new TClonesArray("AliHelix",0); | |
120 | fNoCluster =0; | |
121 | fBSigned = kFALSE; | |
122 | fSeed1 =-1; | |
123 | fSeed2 =-1; | |
124 | fCurrentCluster =0; | |
125 | fCurrentSigmaY2=0; | |
126 | fCurrentSigmaZ2=0; | |
127 | } | |
128 | ||
129 | AliTPCseed::~AliTPCseed(){ | |
130 | // | |
131 | // destructor | |
132 | if (fPoints) delete fPoints; | |
133 | fPoints =0; | |
134 | if (fEPoints) delete fEPoints; | |
135 | fEPoints = 0; | |
136 | fNoCluster =0; | |
137 | } | |
138 | ||
139 | AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i) | |
140 | { | |
141 | // | |
142 | // | |
143 | return &fTrackPoints[i]; | |
144 | } | |
145 | ||
146 | void AliTPCseed::RebuildSeed() | |
147 | { | |
148 | // | |
149 | // rebuild seed to be ready for storing | |
150 | AliTPCclusterMI cldummy; | |
151 | cldummy.SetQ(0); | |
152 | AliTPCTrackPoint pdummy; | |
153 | pdummy.GetTPoint().fIsShared = 10; | |
154 | for (Int_t i=0;i<160;i++){ | |
155 | AliTPCclusterMI * cl0 = fClusterPointer[i]; | |
156 | AliTPCTrackPoint *trpoint = (AliTPCTrackPoint*)fPoints->UncheckedAt(i); | |
157 | if (cl0){ | |
158 | trpoint->GetTPoint() = *(GetTrackPoint(i)); | |
159 | trpoint->GetCPoint() = *cl0; | |
160 | trpoint->GetCPoint().SetQ(TMath::Abs(cl0->GetQ())); | |
161 | } | |
162 | else{ | |
163 | *trpoint = pdummy; | |
164 | trpoint->GetCPoint()= cldummy; | |
165 | } | |
166 | ||
167 | } | |
168 | ||
169 | } | |
170 | ||
171 | ||
172 | Double_t AliTPCseed::GetDensityFirst(Int_t n) | |
173 | { | |
174 | // | |
175 | // | |
176 | // return cluster for n rows bellow first point | |
177 | Int_t nfoundable = 1; | |
178 | Int_t nfound = 1; | |
179 | for (Int_t i=fLastPoint-1;i>0&&nfoundable<n; i--){ | |
180 | Int_t index = GetClusterIndex2(i); | |
181 | if (index!=-1) nfoundable++; | |
182 | if (index>0) nfound++; | |
183 | } | |
184 | if (nfoundable<n) return 0; | |
185 | return Double_t(nfound)/Double_t(nfoundable); | |
186 | ||
187 | } | |
188 | ||
189 | ||
190 | void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2) | |
191 | { | |
192 | // get cluster stat. on given region | |
193 | // | |
194 | found = 0; | |
195 | foundable = 0; | |
196 | shared =0; | |
197 | for (Int_t i=first;i<last; i++){ | |
198 | Int_t index = GetClusterIndex2(i); | |
199 | if (index!=-1) foundable++; | |
200 | if (fClusterPointer[i]) { | |
201 | found++; | |
202 | } | |
203 | else | |
204 | continue; | |
205 | ||
206 | if (fClusterPointer[i]->IsUsed(10)) { | |
207 | shared++; | |
208 | continue; | |
209 | } | |
210 | if (!plus2) continue; //take also neighborhoud | |
211 | // | |
212 | if ( (i>0) && fClusterPointer[i-1]){ | |
213 | if (fClusterPointer[i-1]->IsUsed(10)) { | |
214 | shared++; | |
215 | continue; | |
216 | } | |
217 | } | |
218 | if ( fClusterPointer[i+1]){ | |
219 | if (fClusterPointer[i+1]->IsUsed(10)) { | |
220 | shared++; | |
221 | continue; | |
222 | } | |
223 | } | |
224 | ||
225 | } | |
226 | //if (shared>found){ | |
227 | //Error("AliTPCseed::GetClusterStatistic","problem\n"); | |
228 | //} | |
229 | } | |
230 | ||
231 | ||
232 | ||
233 | ||
234 | ||
235 | void AliTPCseed::Reset(Bool_t all) | |
236 | { | |
237 | // | |
238 | // | |
239 | SetNumberOfClusters(0); | |
240 | fNFoundable = 0; | |
241 | SetChi2(0); | |
242 | ResetCovariance(); | |
243 | /* | |
244 | if (fTrackPoints){ | |
245 | for (Int_t i=0;i<8;i++){ | |
246 | delete [] fTrackPoints[i]; | |
247 | } | |
248 | delete fTrackPoints; | |
249 | fTrackPoints =0; | |
250 | } | |
251 | */ | |
252 | ||
253 | if (all){ | |
254 | for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3); | |
255 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; | |
256 | } | |
257 | ||
258 | } | |
259 | ||
260 | ||
261 | void AliTPCseed::Modify(Double_t factor) | |
262 | { | |
263 | ||
264 | //------------------------------------------------------------------ | |
265 | //This function makes a track forget its history :) | |
266 | //------------------------------------------------------------------ | |
267 | if (factor<=0) { | |
268 | ResetCovariance(); | |
269 | return; | |
270 | } | |
271 | fC00*=factor; | |
272 | fC10*=0; fC11*=factor; | |
273 | fC20*=0; fC21*=0; fC22*=factor; | |
274 | fC30*=0; fC31*=0; fC32*=0; fC33*=factor; | |
275 | fC40*=0; fC41*=0; fC42*=0; fC43*=0; fC44*=factor; | |
276 | SetNumberOfClusters(0); | |
277 | fNFoundable =0; | |
278 | SetChi2(0); | |
279 | fRemoval = 0; | |
280 | fCurrentSigmaY2 = 0.000005; | |
281 | fCurrentSigmaZ2 = 0.000005; | |
282 | fNoCluster = 0; | |
283 | //fFirstPoint = 160; | |
284 | //fLastPoint = 0; | |
285 | } | |
286 | ||
287 | ||
288 | ||
289 | ||
290 | Int_t AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const | |
291 | { | |
292 | //----------------------------------------------------------------- | |
293 | // This function find proloncation of a track to a reference plane x=xk. | |
294 | // doesn't change internal state of the track | |
295 | //----------------------------------------------------------------- | |
296 | ||
297 | Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1; | |
298 | ||
299 | if (TMath::Abs(fP4*xk - fP2) >= 0.999) { | |
300 | return 0; | |
301 | } | |
302 | ||
303 | // Double_t y1=fP0, z1=fP1; | |
304 | Double_t c1=fP4*x1 - fP2, r1=sqrt(1.- c1*c1); | |
305 | Double_t c2=fP4*x2 - fP2, r2=sqrt(1.- c2*c2); | |
306 | ||
307 | y = fP0; | |
308 | z = fP1; | |
309 | //y += dx*(c1+c2)/(r1+r2); | |
310 | //z += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3; | |
311 | ||
312 | Double_t dy = dx*(c1+c2)/(r1+r2); | |
313 | Double_t dz = 0; | |
314 | // | |
315 | Double_t delta = fP4*dx*(c1+c2)/(c1*r2 + c2*r1); | |
316 | /* | |
317 | if (TMath::Abs(delta)>0.0001){ | |
318 | dz = fP3*TMath::ASin(delta)/fP4; | |
319 | }else{ | |
320 | dz = dx*fP3*(c1+c2)/(c1*r2 + c2*r1); | |
321 | } | |
322 | */ | |
323 | // dz = fP3*AliTPCFastMath::FastAsin(delta)/fP4; | |
324 | dz = fP3*TMath::ASin(delta)/fP4; | |
325 | // | |
326 | y+=dy; | |
327 | z+=dz; | |
328 | ||
329 | ||
330 | return 1; | |
331 | } | |
332 | ||
333 | ||
334 | //_____________________________________________________________________________ | |
335 | Double_t AliTPCseed::GetPredictedChi2(const AliTPCclusterMI *c) const | |
336 | { | |
337 | //----------------------------------------------------------------- | |
338 | // This function calculates a predicted chi2 increment. | |
339 | //----------------------------------------------------------------- | |
340 | //Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); | |
341 | Double_t r00=fErrorY2, r01=0., r11=fErrorZ2; | |
342 | r00+=fC00; r01+=fC10; r11+=fC11; | |
343 | ||
344 | Double_t det=r00*r11 - r01*r01; | |
345 | if (TMath::Abs(det) < 1.e-10) { | |
346 | //Int_t n=GetNumberOfClusters(); | |
347 | //if (n>4) cerr<<n<<" AliKalmanTrack warning: Singular matrix !\n"; | |
348 | return 1e10; | |
349 | } | |
350 | Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01; | |
351 | ||
352 | Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1; | |
353 | ||
354 | return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det; | |
355 | } | |
356 | ||
357 | ||
358 | //_________________________________________________________________________________________ | |
359 | ||
360 | ||
361 | Int_t AliTPCseed::Compare(const TObject *o) const { | |
362 | //----------------------------------------------------------------- | |
363 | // This function compares tracks according to the sector - for given sector according z | |
364 | //----------------------------------------------------------------- | |
365 | AliTPCseed *t=(AliTPCseed*)o; | |
366 | ||
367 | if (fSort == 0){ | |
368 | if (t->fRelativeSector>fRelativeSector) return -1; | |
369 | if (t->fRelativeSector<fRelativeSector) return 1; | |
370 | Double_t z2 = t->GetZ(); | |
371 | Double_t z1 = GetZ(); | |
372 | if (z2>z1) return 1; | |
373 | if (z2<z1) return -1; | |
374 | return 0; | |
375 | } | |
376 | else { | |
377 | Float_t f2 =1; | |
378 | f2 = 1-20*TMath::Sqrt(t->fC44)/(TMath::Abs(t->GetC())+0.0066); | |
379 | if (t->fBConstrain) f2=1.2; | |
380 | ||
381 | Float_t f1 =1; | |
382 | f1 = 1-20*TMath::Sqrt(fC44)/(TMath::Abs(GetC())+0.0066); | |
383 | ||
384 | if (fBConstrain) f1=1.2; | |
385 | ||
386 | if (t->GetNumberOfClusters()*f2 <GetNumberOfClusters()*f1) return -1; | |
387 | else return +1; | |
388 | } | |
389 | } | |
390 | ||
391 | ||
392 | ||
393 | ||
394 | //_____________________________________________________________________________ | |
395 | Int_t AliTPCseed::Update(const AliTPCclusterMI *c, Double_t chisq, UInt_t /*index*/) { | |
396 | //----------------------------------------------------------------- | |
397 | // This function associates a cluster with this track. | |
398 | //----------------------------------------------------------------- | |
399 | Double_t r00=fErrorY2, r01=0., r11=fErrorZ2; | |
400 | ||
401 | r00+=fC00; r01+=fC10; r11+=fC11; | |
402 | Double_t det=r00*r11 - r01*r01; | |
403 | Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det; | |
404 | ||
405 | Double_t k00=fC00*r00+fC10*r01, k01=fC00*r01+fC10*r11; | |
406 | Double_t k10=fC10*r00+fC11*r01, k11=fC10*r01+fC11*r11; | |
407 | Double_t k20=fC20*r00+fC21*r01, k21=fC20*r01+fC21*r11; | |
408 | Double_t k30=fC30*r00+fC31*r01, k31=fC30*r01+fC31*r11; | |
409 | Double_t k40=fC40*r00+fC41*r01, k41=fC40*r01+fC41*r11; | |
410 | ||
411 | Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1; | |
412 | Double_t cur=fP4 + k40*dy + k41*dz, eta=fP2 + k20*dy + k21*dz; | |
413 | if (TMath::Abs(cur*fX-eta) >= 0.9) { | |
414 | return 0; | |
415 | } | |
416 | ||
417 | fP0 += k00*dy + k01*dz; | |
418 | fP1 += k10*dy + k11*dz; | |
419 | fP2 = eta; | |
420 | fP3 += k30*dy + k31*dz; | |
421 | fP4 = cur; | |
422 | ||
423 | Double_t c01=fC10, c02=fC20, c03=fC30, c04=fC40; | |
424 | Double_t c12=fC21, c13=fC31, c14=fC41; | |
425 | ||
426 | fC00-=k00*fC00+k01*fC10; fC10-=k00*c01+k01*fC11; | |
427 | fC20-=k00*c02+k01*c12; fC30-=k00*c03+k01*c13; | |
428 | fC40-=k00*c04+k01*c14; | |
429 | ||
430 | fC11-=k10*c01+k11*fC11; | |
431 | fC21-=k10*c02+k11*c12; fC31-=k10*c03+k11*c13; | |
432 | fC41-=k10*c04+k11*c14; | |
433 | ||
434 | fC22-=k20*c02+k21*c12; fC32-=k20*c03+k21*c13; | |
435 | fC42-=k20*c04+k21*c14; | |
436 | ||
437 | fC33-=k30*c03+k31*c13; | |
438 | fC43-=k40*c03+k41*c13; | |
439 | ||
440 | fC44-=k40*c04+k41*c14; | |
441 | ||
442 | Int_t n=GetNumberOfClusters(); | |
443 | // fIndex[n]=index; | |
444 | SetNumberOfClusters(n+1); | |
445 | SetChi2(GetChi2()+chisq); | |
446 | ||
447 | return 1; | |
448 | } | |
449 | ||
450 | ||
451 | ||
452 | //_____________________________________________________________________________ | |
453 | void AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t onlyused) { | |
454 | //----------------------------------------------------------------- | |
455 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
456 | //----------------------------------------------------------------- | |
457 | ||
458 | Float_t amp[200]; | |
459 | Float_t angular[200]; | |
460 | Float_t weight[200]; | |
461 | Int_t index[200]; | |
462 | //Int_t nc = 0; | |
463 | // TClonesArray & arr = *fPoints; | |
464 | Float_t meanlog = 100.; | |
465 | ||
466 | Float_t mean[4] = {0,0,0,0}; | |
467 | Float_t sigma[4] = {1000,1000,1000,1000}; | |
468 | Int_t nc[4] = {0,0,0,0}; | |
469 | Float_t norm[4] = {1000,1000,1000,1000}; | |
470 | // | |
471 | // | |
472 | fNShared =0; | |
473 | ||
474 | for (Int_t of =0; of<4; of++){ | |
475 | for (Int_t i=of+i1;i<i2;i+=4) | |
476 | { | |
477 | Int_t index = fIndex[i]; | |
478 | if (index<0||index&0x8000) continue; | |
479 | ||
480 | //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i); | |
481 | AliTPCTrackerPoint * point = GetTrackPoint(i); | |
482 | //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1); | |
483 | //AliTPCTrackerPoint * pointp = 0; | |
484 | //if (i<159) pointp = GetTrackPoint(i+1); | |
485 | ||
486 | if (point==0) continue; | |
487 | AliTPCclusterMI * cl = fClusterPointer[i]; | |
488 | if (cl==0) continue; | |
489 | if (onlyused && (!cl->IsUsed(10))) continue; | |
490 | if (cl->IsUsed(11)) { | |
491 | fNShared++; | |
492 | continue; | |
493 | } | |
494 | Int_t type = cl->GetType(); | |
495 | //if (point->fIsShared){ | |
496 | // fNShared++; | |
497 | // continue; | |
498 | //} | |
499 | //if (pointm) | |
500 | // if (pointm->fIsShared) continue; | |
501 | //if (pointp) | |
502 | // if (pointp->fIsShared) continue; | |
503 | ||
504 | if (type<0) continue; | |
505 | //if (type>10) continue; | |
506 | //if (point->GetErrY()==0) continue; | |
507 | //if (point->GetErrZ()==0) continue; | |
508 | ||
509 | //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY(); | |
510 | //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ(); | |
511 | //if ((ddy*ddy+ddz*ddz)>10) continue; | |
512 | ||
513 | ||
514 | // if (point->GetCPoint().GetMax()<5) continue; | |
515 | if (cl->GetMax()<5) continue; | |
516 | Float_t angley = point->GetAngleY(); | |
517 | Float_t anglez = point->GetAngleZ(); | |
518 | ||
519 | Float_t rsigmay2 = point->GetSigmaY(); | |
520 | Float_t rsigmaz2 = point->GetSigmaZ(); | |
521 | /* | |
522 | Float_t ns = 1.; | |
523 | if (pointm){ | |
524 | rsigmay += pointm->GetTPoint().GetSigmaY(); | |
525 | rsigmaz += pointm->GetTPoint().GetSigmaZ(); | |
526 | ns+=1.; | |
527 | } | |
528 | if (pointp){ | |
529 | rsigmay += pointp->GetTPoint().GetSigmaY(); | |
530 | rsigmaz += pointp->GetTPoint().GetSigmaZ(); | |
531 | ns+=1.; | |
532 | } | |
533 | rsigmay/=ns; | |
534 | rsigmaz/=ns; | |
535 | */ | |
536 | ||
537 | Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2); | |
538 | ||
539 | Float_t ampc = 0; // normalization to the number of electrons | |
540 | if (i>64){ | |
541 | // ampc = 1.*point->GetCPoint().GetMax(); | |
542 | ampc = 1.*cl->GetMax(); | |
543 | //ampc = 1.*point->GetCPoint().GetQ(); | |
544 | // AliTPCClusterPoint & p = point->GetCPoint(); | |
545 | // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5); | |
546 | // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
547 | //Float_t dz = | |
548 | // TMath::Abs( Int_t(iz) - iz + 0.5); | |
549 | //ampc *= 1.15*(1-0.3*dy); | |
550 | //ampc *= 1.15*(1-0.3*dz); | |
551 | // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ())); | |
552 | //ampc *=zfactor; | |
553 | } | |
554 | else{ | |
555 | //ampc = 1.0*point->GetCPoint().GetMax(); | |
556 | ampc = 1.0*cl->GetMax(); | |
557 | //ampc = 1.0*point->GetCPoint().GetQ(); | |
558 | //AliTPCClusterPoint & p = point->GetCPoint(); | |
559 | // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5); | |
560 | //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
561 | //Float_t dz = | |
562 | // TMath::Abs( Int_t(iz) - iz + 0.5); | |
563 | ||
564 | //ampc *= 1.15*(1-0.3*dy); | |
565 | //ampc *= 1.15*(1-0.3*dz); | |
566 | // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ())); | |
567 | //ampc *=zfactor; | |
568 | ||
569 | } | |
570 | ampc *= 2.0; // put mean value to channel 50 | |
571 | //ampc *= 0.58; // put mean value to channel 50 | |
572 | Float_t w = 1.; | |
573 | // if (type>0) w = 1./(type/2.-0.5); | |
574 | // Float_t z = TMath::Abs(cl->GetZ()); | |
575 | if (i<64) { | |
576 | ampc /= 0.6; | |
577 | //ampc /= (1+0.0008*z); | |
578 | } else | |
579 | if (i>128){ | |
580 | ampc /=1.5; | |
581 | //ampc /= (1+0.0008*z); | |
582 | }else{ | |
583 | //ampc /= (1+0.0008*z); | |
584 | } | |
585 | ||
586 | if (type<0) { //amp at the border - lower weight | |
587 | // w*= 2.; | |
588 | ||
589 | continue; | |
590 | } | |
591 | if (rsigma>1.5) ampc/=1.3; // if big backround | |
592 | amp[nc[of]] = ampc; | |
593 | angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez); | |
594 | weight[nc[of]] = w; | |
595 | nc[of]++; | |
596 | } | |
597 | ||
598 | TMath::Sort(nc[of],amp,index,kFALSE); | |
599 | Float_t sumamp=0; | |
600 | Float_t sumamp2=0; | |
601 | Float_t sumw=0; | |
602 | //meanlog = amp[index[Int_t(nc[of]*0.33)]]; | |
603 | meanlog = 50; | |
604 | for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){ | |
605 | Float_t ampl = amp[index[i]]/angular[index[i]]; | |
606 | ampl = meanlog*TMath::Log(1.+ampl/meanlog); | |
607 | // | |
608 | sumw += weight[index[i]]; | |
609 | sumamp += weight[index[i]]*ampl; | |
610 | sumamp2 += weight[index[i]]*ampl*ampl; | |
611 | norm[of] += angular[index[i]]*weight[index[i]]; | |
612 | } | |
613 | if (sumw<1){ | |
614 | SetdEdx(0); | |
615 | } | |
616 | else { | |
617 | norm[of] /= sumw; | |
618 | mean[of] = sumamp/sumw; | |
619 | sigma[of] = sumamp2/sumw-mean[of]*mean[of]; | |
620 | if (sigma[of]>0.1) | |
621 | sigma[of] = TMath::Sqrt(sigma[of]); | |
622 | else | |
623 | sigma[of] = 1000; | |
624 | ||
625 | mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog; | |
626 | //mean *=(1-0.02*(sigma/(mean*0.17)-1.)); | |
627 | //mean *=(1-0.1*(norm-1.)); | |
628 | } | |
629 | } | |
630 | ||
631 | Float_t dedx =0; | |
632 | fSdEdx =0; | |
633 | fMAngular =0; | |
634 | // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1)); | |
635 | // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1)); | |
636 | ||
637 | ||
638 | // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/ | |
639 | // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1]))); | |
640 | ||
641 | Int_t norm2 = 0; | |
642 | Int_t norm3 = 0; | |
643 | for (Int_t i =0;i<4;i++){ | |
644 | if (nc[i]>2&&nc[i]<1000){ | |
645 | dedx += mean[i] *nc[i]; | |
646 | fSdEdx += sigma[i]*(nc[i]-2); | |
647 | fMAngular += norm[i] *nc[i]; | |
648 | norm2 += nc[i]; | |
649 | norm3 += nc[i]-2; | |
650 | } | |
651 | fDEDX[i] = mean[i]; | |
652 | fSDEDX[i] = sigma[i]; | |
653 | fNCDEDX[i]= nc[i]; | |
654 | } | |
655 | ||
656 | if (norm3>0){ | |
657 | dedx /=norm2; | |
658 | fSdEdx /=norm3; | |
659 | fMAngular/=norm2; | |
660 | } | |
661 | else{ | |
662 | SetdEdx(0); | |
663 | return; | |
664 | } | |
665 | // Float_t dedx1 =dedx; | |
666 | /* | |
667 | dedx =0; | |
668 | for (Int_t i =0;i<4;i++){ | |
669 | if (nc[i]>2&&nc[i]<1000){ | |
670 | mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.)); | |
671 | dedx += mean[i] *nc[i]; | |
672 | } | |
673 | fDEDX[i] = mean[i]; | |
674 | } | |
675 | dedx /= norm2; | |
676 | */ | |
677 | ||
678 | ||
679 | SetdEdx(dedx); | |
680 | ||
681 | //mi deDX | |
682 | ||
683 | ||
684 | ||
685 | //Very rough PID | |
686 | Double_t p=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt())); | |
687 | ||
688 | if (p<0.6) { | |
689 | if (dedx < 39.+ 12./(p+0.25)/(p+0.25)) { SetMass(0.13957); return;} | |
690 | if (dedx < 39.+ 12./p/p) { SetMass(0.49368); return;} | |
691 | SetMass(0.93827); return; | |
692 | } | |
693 | ||
694 | if (p<1.2) { | |
695 | if (dedx < 39.+ 12./(p+0.25)/(p+0.25)) { SetMass(0.13957); return;} | |
696 | SetMass(0.93827); return; | |
697 | } | |
698 | ||
699 | SetMass(0.13957); return; | |
700 | ||
701 | } | |
702 | Double_t AliTPCseed::Bethe(Double_t bg){ | |
703 | // | |
704 | // This is the Bethe-Bloch function normalised to 1 at the minimum | |
705 | // | |
706 | Double_t bg2=bg*bg; | |
707 | Double_t bethe; | |
708 | if (bg<3.5e1) | |
709 | bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2)); | |
710 | else // Density effect ( approximately :) | |
711 | bethe=1.15*(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2)); | |
712 | return bethe/11.091; | |
713 | } | |
714 | ||
715 | void AliTPCseed::CookPID() | |
716 | { | |
717 | // | |
718 | // cook PID information according dEdx | |
719 | // | |
720 | Double_t fRange = 10.; | |
721 | Double_t fRes = 0.1; | |
722 | Double_t fMIP = 47.; | |
723 | // | |
724 | Int_t ns=AliPID::kSPECIES; | |
725 | Double_t sumr =0; | |
726 | for (Int_t j=0; j<ns; j++) { | |
727 | Double_t mass=AliPID::ParticleMass(j); | |
728 | Double_t mom=P(); | |
729 | Double_t dedx=fdEdx/fMIP; | |
730 | Double_t bethe=Bethe(mom/mass); | |
731 | Double_t sigma=fRes*bethe; | |
732 | if (sigma>0.001){ | |
733 | if (TMath::Abs(dedx-bethe) > fRange*sigma) { | |
734 | fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma; | |
735 | sumr+=fTPCr[j]; | |
736 | continue; | |
737 | } | |
738 | fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma; | |
739 | sumr+=fTPCr[j]; | |
740 | } | |
741 | else{ | |
742 | fTPCr[j]=1.; | |
743 | sumr+=fTPCr[j]; | |
744 | } | |
745 | } | |
746 | for (Int_t j=0; j<ns; j++) { | |
747 | fTPCr[j]/=sumr; //normalize | |
748 | } | |
749 | } | |
750 | ||
751 | /* | |
752 | void AliTPCseed::CookdEdx2(Double_t low, Double_t up) { | |
753 | //----------------------------------------------------------------- | |
754 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
755 | //----------------------------------------------------------------- | |
756 | ||
757 | Float_t amp[200]; | |
758 | Float_t angular[200]; | |
759 | Float_t weight[200]; | |
760 | Int_t index[200]; | |
761 | Bool_t inlimit[200]; | |
762 | for (Int_t i=0;i<200;i++) inlimit[i]=kFALSE; | |
763 | for (Int_t i=0;i<200;i++) amp[i]=10000; | |
764 | for (Int_t i=0;i<200;i++) angular[i]= 1;; | |
765 | ||
766 | ||
767 | // | |
768 | Float_t meanlog = 100.; | |
769 | Int_t indexde[4]={0,64,128,160}; | |
770 | ||
771 | Float_t amean =0; | |
772 | Float_t asigma =0; | |
773 | Float_t anc =0; | |
774 | Float_t anorm =0; | |
775 | ||
776 | Float_t mean[4] = {0,0,0,0}; | |
777 | Float_t sigma[4] = {1000,1000,1000,1000}; | |
778 | Int_t nc[4] = {0,0,0,0}; | |
779 | Float_t norm[4] = {1000,1000,1000,1000}; | |
780 | // | |
781 | // | |
782 | fNShared =0; | |
783 | ||
784 | // for (Int_t of =0; of<3; of++){ | |
785 | // for (Int_t i=indexde[of];i<indexde[of+1];i++) | |
786 | for (Int_t i =0; i<160;i++) | |
787 | { | |
788 | AliTPCTrackPoint * point = GetTrackPoint(i); | |
789 | if (point==0) continue; | |
790 | if (point->fIsShared){ | |
791 | fNShared++; | |
792 | continue; | |
793 | } | |
794 | Int_t type = point->GetCPoint().GetType(); | |
795 | if (type<0) continue; | |
796 | if (point->GetCPoint().GetMax()<5) continue; | |
797 | Float_t angley = point->GetTPoint().GetAngleY(); | |
798 | Float_t anglez = point->GetTPoint().GetAngleZ(); | |
799 | Float_t rsigmay = point->GetCPoint().GetSigmaY(); | |
800 | Float_t rsigmaz = point->GetCPoint().GetSigmaZ(); | |
801 | Float_t rsigma = TMath::Sqrt(rsigmay*rsigmaz); | |
802 | ||
803 | Float_t ampc = 0; // normalization to the number of electrons | |
804 | if (i>64){ | |
805 | ampc = point->GetCPoint().GetMax(); | |
806 | } | |
807 | else{ | |
808 | ampc = point->GetCPoint().GetMax(); | |
809 | } | |
810 | ampc *= 2.0; // put mean value to channel 50 | |
811 | // ampc *= 0.565; // put mean value to channel 50 | |
812 | ||
813 | Float_t w = 1.; | |
814 | Float_t z = TMath::Abs(point->GetCPoint().GetZ()); | |
815 | if (i<64) { | |
816 | ampc /= 0.63; | |
817 | } else | |
818 | if (i>128){ | |
819 | ampc /=1.51; | |
820 | } | |
821 | if (type<0) { //amp at the border - lower weight | |
822 | continue; | |
823 | } | |
824 | if (rsigma>1.5) ampc/=1.3; // if big backround | |
825 | angular[i] = TMath::Sqrt(1.+angley*angley+anglez*anglez); | |
826 | amp[i] = ampc/angular[i]; | |
827 | weight[i] = w; | |
828 | anc++; | |
829 | } | |
830 | ||
831 | TMath::Sort(159,amp,index,kFALSE); | |
832 | for (Int_t i=int(anc*low+0.5);i<int(anc*up+0.5);i++){ | |
833 | inlimit[index[i]] = kTRUE; // take all clusters | |
834 | } | |
835 | ||
836 | // meanlog = amp[index[Int_t(anc*0.3)]]; | |
837 | meanlog =10000.; | |
838 | for (Int_t of =0; of<3; of++){ | |
839 | Float_t sumamp=0; | |
840 | Float_t sumamp2=0; | |
841 | Float_t sumw=0; | |
842 | for (Int_t i=indexde[of];i<indexde[of+1];i++) | |
843 | { | |
844 | if (inlimit[i]==kFALSE) continue; | |
845 | Float_t ampl = amp[i]; | |
846 | ///angular[i]; | |
847 | ampl = meanlog*TMath::Log(1.+ampl/meanlog); | |
848 | // | |
849 | sumw += weight[i]; | |
850 | sumamp += weight[i]*ampl; | |
851 | sumamp2 += weight[i]*ampl*ampl; | |
852 | norm[of] += angular[i]*weight[i]; | |
853 | nc[of]++; | |
854 | } | |
855 | if (sumw<1){ | |
856 | SetdEdx(0); | |
857 | } | |
858 | else { | |
859 | norm[of] /= sumw; | |
860 | mean[of] = sumamp/sumw; | |
861 | sigma[of] = sumamp2/sumw-mean[of]*mean[of]; | |
862 | if (sigma[of]>0.1) | |
863 | sigma[of] = TMath::Sqrt(sigma[of]); | |
864 | else | |
865 | sigma[of] = 1000; | |
866 | mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog; | |
867 | } | |
868 | } | |
869 | ||
870 | Float_t dedx =0; | |
871 | fSdEdx =0; | |
872 | fMAngular =0; | |
873 | // | |
874 | Int_t norm2 = 0; | |
875 | Int_t norm3 = 0; | |
876 | Float_t www[3] = {12.,14.,17.}; | |
877 | //Float_t www[3] = {1.,1.,1.}; | |
878 | ||
879 | for (Int_t i =0;i<3;i++){ | |
880 | if (nc[i]>2&&nc[i]<1000){ | |
881 | dedx += mean[i] *nc[i]*www[i]/sigma[i]; | |
882 | fSdEdx += sigma[i]*(nc[i]-2)*www[i]/sigma[i]; | |
883 | fMAngular += norm[i] *nc[i]; | |
884 | norm2 += nc[i]*www[i]/sigma[i]; | |
885 | norm3 += (nc[i]-2)*www[i]/sigma[i]; | |
886 | } | |
887 | fDEDX[i] = mean[i]; | |
888 | fSDEDX[i] = sigma[i]; | |
889 | fNCDEDX[i]= nc[i]; | |
890 | } | |
891 | ||
892 | if (norm3>0){ | |
893 | dedx /=norm2; | |
894 | fSdEdx /=norm3; | |
895 | fMAngular/=norm2; | |
896 | } | |
897 | else{ | |
898 | SetdEdx(0); | |
899 | return; | |
900 | } | |
901 | // Float_t dedx1 =dedx; | |
902 | ||
903 | dedx =0; | |
904 | Float_t norm4 = 0; | |
905 | for (Int_t i =0;i<3;i++){ | |
906 | if (nc[i]>2&&nc[i]<1000&&sigma[i]>3){ | |
907 | //mean[i] = mean[i]*(1+0.08*(sigma[i]/(fSdEdx)-1.)); | |
908 | dedx += mean[i] *(nc[i])/(sigma[i]); | |
909 | norm4 += (nc[i])/(sigma[i]); | |
910 | } | |
911 | fDEDX[i] = mean[i]; | |
912 | } | |
913 | if (norm4>0) dedx /= norm4; | |
914 | ||
915 | ||
916 | ||
917 | SetdEdx(dedx); | |
918 | ||
919 | //mi deDX | |
920 | ||
921 | } | |
922 | */ |