]>
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 | //----------------------------------------------------------------- | |
28273e26 | 20 | // |
81e97e0d | 21 | // Implementation of the TPC seed class |
22 | // This class is used by the AliTPCtrackerMI class | |
23 | // Origin: Marian Ivanov, CERN, Marian.Ivanov@cern.ch | |
24 | //----------------------------------------------------------------- | |
25 | #include "TClonesArray.h" | |
2efc897f | 26 | #include "TGraphErrors.h" |
81e97e0d | 27 | #include "AliTPCseed.h" |
3f82c4f2 | 28 | #include "AliTPCReconstructor.h" |
0a65832b | 29 | #include "AliTPCClusterParam.h" |
7cd8ac3f | 30 | #include "AliTPCCalPad.h" |
31 | #include "AliTPCCalROC.h" | |
37540068 | 32 | #include "AliTPCcalibDB.h" |
d080e4a4 | 33 | #include "AliTPCParam.h" |
5731b051 | 34 | #include "AliMathBase.h" |
3af3fbc4 | 35 | #include "AliTPCTransform.h" |
36 | #include "AliSplineFit.h" | |
37 | #include "AliCDBManager.h" | |
108a67db | 38 | #include "AliTPCcalibDButil.h" |
7cd8ac3f | 39 | |
81e97e0d | 40 | |
41 | ClassImp(AliTPCseed) | |
42 | ||
43 | ||
44 | ||
32fab534 | 45 | AliTPCseed::AliTPCseed(): |
46 | AliTPCtrack(), | |
47 | fEsd(0x0), | |
2928bdf0 | 48 | fClusterOwner(kFALSE), |
32fab534 | 49 | fRow(0), |
50 | fSector(-1), | |
51 | fRelativeSector(-1), | |
52 | fCurrentSigmaY2(1e10), | |
53 | fCurrentSigmaZ2(1e10), | |
e0e13b88 | 54 | fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30% |
55 | fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30% | |
c07cb486 | 56 | fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2% |
57 | fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2% | |
e0e13b88 | 58 | // |
32fab534 | 59 | fErrorY2(1e10), |
60 | fErrorZ2(1e10), | |
61 | fCurrentCluster(0x0), | |
62 | fCurrentClusterIndex1(-1), | |
63 | fInDead(kFALSE), | |
64 | fIsSeeding(kFALSE), | |
65 | fNoCluster(0), | |
66 | fSort(0), | |
67 | fBSigned(kFALSE), | |
68 | fSeedType(0), | |
69 | fSeed1(-1), | |
70 | fSeed2(-1), | |
71 | fMAngular(0), | |
bad6eb00 | 72 | fCircular(0) |
32fab534 | 73 | { |
81e97e0d | 74 | // |
5c09947e | 75 | for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3); |
81e97e0d | 76 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; |
77 | for (Int_t i=0;i<3;i++) fKinkIndexes[i]=0; | |
32fab534 | 78 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0.2; |
79 | for (Int_t i=0;i<4;i++) { | |
80 | fDEDX[i] = 0.; | |
81 | fSDEDX[i] = 1e10; | |
82 | fNCDEDX[i] = 0; | |
83 | } | |
84 | for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1; | |
81e97e0d | 85 | } |
32fab534 | 86 | |
2928bdf0 | 87 | AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner): |
32fab534 | 88 | AliTPCtrack(s), |
89 | fEsd(0x0), | |
2928bdf0 | 90 | fClusterOwner(clusterOwner), |
32fab534 | 91 | fRow(0), |
92 | fSector(-1), | |
93 | fRelativeSector(-1), | |
c07cb486 | 94 | fCurrentSigmaY2(-1), |
95 | fCurrentSigmaZ2(-1), | |
e0e13b88 | 96 | fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30% |
97 | fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30% | |
c07cb486 | 98 | fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2% |
99 | fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2% | |
32fab534 | 100 | fErrorY2(1e10), |
101 | fErrorZ2(1e10), | |
102 | fCurrentCluster(0x0), | |
103 | fCurrentClusterIndex1(-1), | |
104 | fInDead(kFALSE), | |
105 | fIsSeeding(kFALSE), | |
106 | fNoCluster(0), | |
107 | fSort(0), | |
108 | fBSigned(kFALSE), | |
109 | fSeedType(0), | |
110 | fSeed1(-1), | |
111 | fSeed2(-1), | |
112 | fMAngular(0), | |
bad6eb00 | 113 | fCircular(0) |
32fab534 | 114 | { |
81e97e0d | 115 | //--------------------- |
116 | // dummy copy constructor | |
117 | //------------------------- | |
2928bdf0 | 118 | for (Int_t i=0;i<160;i++) { |
119 | fClusterPointer[i]=0; | |
120 | if (fClusterOwner){ | |
121 | if (s.fClusterPointer[i]) | |
122 | fClusterPointer[i] = new AliTPCclusterMI(*(s.fClusterPointer[i])); | |
123 | }else{ | |
124 | fClusterPointer[i] = s.fClusterPointer[i]; | |
125 | } | |
126 | fTrackPoints[i] = s.fTrackPoints[i]; | |
127 | } | |
81e97e0d | 128 | for (Int_t i=0;i<160;i++) fIndex[i] = s.fIndex[i]; |
5c09947e | 129 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=s.fTPCr[i]; |
130 | for (Int_t i=0;i<4;i++) { | |
131 | fDEDX[i] = s.fDEDX[i]; | |
132 | fSDEDX[i] = s.fSDEDX[i]; | |
133 | fNCDEDX[i] = s.fNCDEDX[i]; | |
134 | } | |
135 | for (Int_t i=0;i<12;i++) fOverlapLabels[i] = s.fOverlapLabels[i]; | |
19b00333 | 136 | |
81e97e0d | 137 | } |
5c09947e | 138 | |
139 | ||
32fab534 | 140 | AliTPCseed::AliTPCseed(const AliTPCtrack &t): |
141 | AliTPCtrack(t), | |
142 | fEsd(0x0), | |
2928bdf0 | 143 | fClusterOwner(kFALSE), |
32fab534 | 144 | fRow(0), |
145 | fSector(-1), | |
146 | fRelativeSector(-1), | |
c07cb486 | 147 | fCurrentSigmaY2(-1), |
148 | fCurrentSigmaZ2(-1), | |
e0e13b88 | 149 | fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30% |
150 | fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30% | |
c07cb486 | 151 | fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2% |
152 | fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2% | |
32fab534 | 153 | fErrorY2(1e10), |
154 | fErrorZ2(1e10), | |
155 | fCurrentCluster(0x0), | |
156 | fCurrentClusterIndex1(-1), | |
157 | fInDead(kFALSE), | |
158 | fIsSeeding(kFALSE), | |
159 | fNoCluster(0), | |
160 | fSort(0), | |
161 | fBSigned(kFALSE), | |
162 | fSeedType(0), | |
163 | fSeed1(-1), | |
164 | fSeed2(-1), | |
165 | fMAngular(0), | |
bad6eb00 | 166 | fCircular(0) |
32fab534 | 167 | { |
81e97e0d | 168 | // |
32fab534 | 169 | // Constructor from AliTPCtrack |
170 | // | |
171 | fFirstPoint =0; | |
105b1b81 | 172 | for (Int_t i=0;i<5;i++) fTPCr[i]=0.2; |
81e97e0d | 173 | for (Int_t i=0;i<160;i++) { |
174 | fClusterPointer[i] = 0; | |
175 | Int_t index = t.GetClusterIndex(i); | |
176 | if (index>=-1){ | |
177 | SetClusterIndex2(i,index); | |
178 | } | |
179 | else{ | |
180 | SetClusterIndex2(i,-3); | |
181 | } | |
182 | } | |
32fab534 | 183 | for (Int_t i=0;i<4;i++) { |
184 | fDEDX[i] = 0.; | |
185 | fSDEDX[i] = 1e10; | |
186 | fNCDEDX[i] = 0; | |
187 | } | |
188 | for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1; | |
81e97e0d | 189 | } |
190 | ||
6c94f330 | 191 | AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5], |
192 | const Double_t cc[15], Int_t index): | |
193 | AliTPCtrack(xr, alpha, xx, cc, index), | |
32fab534 | 194 | fEsd(0x0), |
2928bdf0 | 195 | fClusterOwner(kFALSE), |
32fab534 | 196 | fRow(0), |
197 | fSector(-1), | |
198 | fRelativeSector(-1), | |
c07cb486 | 199 | fCurrentSigmaY2(-1), |
200 | fCurrentSigmaZ2(-1), | |
e0e13b88 | 201 | fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30% |
202 | fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30% | |
c07cb486 | 203 | fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2% |
204 | fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2% | |
32fab534 | 205 | fErrorY2(1e10), |
206 | fErrorZ2(1e10), | |
207 | fCurrentCluster(0x0), | |
208 | fCurrentClusterIndex1(-1), | |
209 | fInDead(kFALSE), | |
210 | fIsSeeding(kFALSE), | |
211 | fNoCluster(0), | |
212 | fSort(0), | |
213 | fBSigned(kFALSE), | |
214 | fSeedType(0), | |
215 | fSeed1(-1), | |
216 | fSeed2(-1), | |
217 | fMAngular(0), | |
bad6eb00 | 218 | fCircular(0) |
32fab534 | 219 | { |
220 | // | |
221 | // Constructor | |
81e97e0d | 222 | // |
32fab534 | 223 | fFirstPoint =0; |
5c09947e | 224 | for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3); |
81e97e0d | 225 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; |
81e97e0d | 226 | for (Int_t i=0;i<5;i++) fTPCr[i]=0.2; |
32fab534 | 227 | for (Int_t i=0;i<4;i++) { |
228 | fDEDX[i] = 0.; | |
229 | fSDEDX[i] = 1e10; | |
230 | fNCDEDX[i] = 0; | |
231 | } | |
232 | for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1; | |
81e97e0d | 233 | } |
234 | ||
235 | AliTPCseed::~AliTPCseed(){ | |
236 | // | |
237 | // destructor | |
81e97e0d | 238 | fNoCluster =0; |
2928bdf0 | 239 | if (fClusterOwner){ |
240 | for (Int_t icluster=0; icluster<160; icluster++){ | |
241 | delete fClusterPointer[icluster]; | |
242 | } | |
243 | } | |
bfb57b6c | 244 | |
81e97e0d | 245 | } |
179c6296 | 246 | //_________________________________________________ |
316c6cd9 | 247 | AliTPCseed & AliTPCseed::operator=(const AliTPCseed ¶m) |
179c6296 | 248 | { |
249 | // | |
316c6cd9 | 250 | // assignment operator |
179c6296 | 251 | // |
316c6cd9 | 252 | if(this!=¶m){ |
253 | AliTPCtrack::operator=(param); | |
254 | fEsd =param.fEsd; | |
255 | for(Int_t i = 0;i<160;++i)fClusterPointer[i] = param.fClusterPointer[i]; // this is not allocated by AliTPCSeed | |
256 | fClusterOwner = param.fClusterOwner; | |
257 | // leave out fPoint, they are also not copied in the copy ctor... | |
258 | // but deleted in the dtor... strange... | |
316c6cd9 | 259 | fRow = param.fRow; |
260 | fSector = param.fSector; | |
261 | fRelativeSector = param.fRelativeSector; | |
262 | fCurrentSigmaY2 = param.fCurrentSigmaY2; | |
263 | fCurrentSigmaZ2 = param.fCurrentSigmaZ2; | |
264 | fErrorY2 = param.fErrorY2; | |
265 | fErrorZ2 = param.fErrorZ2; | |
266 | fCurrentCluster = param.fCurrentCluster; // this is not allocated by AliTPCSeed | |
267 | fCurrentClusterIndex1 = param.fCurrentClusterIndex1; | |
268 | fInDead = param.fInDead; | |
269 | fIsSeeding = param.fIsSeeding; | |
270 | fNoCluster = param.fNoCluster; | |
271 | fSort = param.fSort; | |
272 | fBSigned = param.fBSigned; | |
273 | for(Int_t i = 0;i<4;++i){ | |
274 | fDEDX[i] = param.fDEDX[i]; | |
275 | fSDEDX[i] = param.fSDEDX[i]; | |
276 | fNCDEDX[i] = param.fNCDEDX[i]; | |
277 | } | |
278 | for(Int_t i = 0;i<AliPID::kSPECIES;++i)fTPCr[i] = param.fTPCr[i]; | |
279 | ||
280 | fSeedType = param.fSeedType; | |
281 | fSeed1 = param.fSeed1; | |
282 | fSeed2 = param.fSeed2; | |
283 | for(Int_t i = 0;i<12;++i)fOverlapLabels[i] = param.fOverlapLabels[i]; | |
284 | fMAngular = param.fMAngular; | |
285 | fCircular = param.fCircular; | |
286 | for(int i = 0;i<160;++i)fTrackPoints[i] = param.fTrackPoints[i]; | |
316c6cd9 | 287 | } |
179c6296 | 288 | return (*this); |
289 | } | |
290 | //____________________________________________________ | |
81e97e0d | 291 | AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i) |
292 | { | |
293 | // | |
294 | // | |
295 | return &fTrackPoints[i]; | |
296 | } | |
297 | ||
81e97e0d | 298 | |
299 | ||
300 | Double_t AliTPCseed::GetDensityFirst(Int_t n) | |
301 | { | |
302 | // | |
303 | // | |
304 | // return cluster for n rows bellow first point | |
305 | Int_t nfoundable = 1; | |
306 | Int_t nfound = 1; | |
307 | for (Int_t i=fLastPoint-1;i>0&&nfoundable<n; i--){ | |
308 | Int_t index = GetClusterIndex2(i); | |
309 | if (index!=-1) nfoundable++; | |
310 | if (index>0) nfound++; | |
311 | } | |
312 | if (nfoundable<n) return 0; | |
313 | return Double_t(nfound)/Double_t(nfoundable); | |
314 | ||
315 | } | |
316 | ||
317 | ||
318 | void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2) | |
319 | { | |
320 | // get cluster stat. on given region | |
321 | // | |
322 | found = 0; | |
323 | foundable = 0; | |
324 | shared =0; | |
325 | for (Int_t i=first;i<last; i++){ | |
326 | Int_t index = GetClusterIndex2(i); | |
327 | if (index!=-1) foundable++; | |
6d493ea0 | 328 | if (index&0x8000) continue; |
81e97e0d | 329 | if (fClusterPointer[i]) { |
330 | found++; | |
331 | } | |
332 | else | |
333 | continue; | |
334 | ||
335 | if (fClusterPointer[i]->IsUsed(10)) { | |
336 | shared++; | |
337 | continue; | |
338 | } | |
339 | if (!plus2) continue; //take also neighborhoud | |
340 | // | |
341 | if ( (i>0) && fClusterPointer[i-1]){ | |
342 | if (fClusterPointer[i-1]->IsUsed(10)) { | |
343 | shared++; | |
344 | continue; | |
345 | } | |
346 | } | |
347 | if ( fClusterPointer[i+1]){ | |
348 | if (fClusterPointer[i+1]->IsUsed(10)) { | |
349 | shared++; | |
350 | continue; | |
351 | } | |
352 | } | |
353 | ||
354 | } | |
355 | //if (shared>found){ | |
356 | //Error("AliTPCseed::GetClusterStatistic","problem\n"); | |
357 | //} | |
358 | } | |
359 | ||
360 | ||
361 | ||
362 | ||
363 | ||
364 | void AliTPCseed::Reset(Bool_t all) | |
365 | { | |
366 | // | |
367 | // | |
368 | SetNumberOfClusters(0); | |
369 | fNFoundable = 0; | |
370 | SetChi2(0); | |
6c94f330 | 371 | ResetCovariance(10.); |
81e97e0d | 372 | /* |
373 | if (fTrackPoints){ | |
374 | for (Int_t i=0;i<8;i++){ | |
375 | delete [] fTrackPoints[i]; | |
376 | } | |
377 | delete fTrackPoints; | |
378 | fTrackPoints =0; | |
379 | } | |
380 | */ | |
381 | ||
382 | if (all){ | |
383 | for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3); | |
384 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; | |
385 | } | |
386 | ||
387 | } | |
388 | ||
389 | ||
390 | void AliTPCseed::Modify(Double_t factor) | |
391 | { | |
392 | ||
393 | //------------------------------------------------------------------ | |
394 | //This function makes a track forget its history :) | |
395 | //------------------------------------------------------------------ | |
396 | if (factor<=0) { | |
6c94f330 | 397 | ResetCovariance(10.); |
81e97e0d | 398 | return; |
399 | } | |
6c94f330 | 400 | ResetCovariance(factor); |
401 | ||
81e97e0d | 402 | SetNumberOfClusters(0); |
403 | fNFoundable =0; | |
404 | SetChi2(0); | |
405 | fRemoval = 0; | |
406 | fCurrentSigmaY2 = 0.000005; | |
407 | fCurrentSigmaZ2 = 0.000005; | |
408 | fNoCluster = 0; | |
409 | //fFirstPoint = 160; | |
410 | //fLastPoint = 0; | |
411 | } | |
412 | ||
413 | ||
414 | ||
415 | ||
416 | Int_t AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const | |
417 | { | |
418 | //----------------------------------------------------------------- | |
419 | // This function find proloncation of a track to a reference plane x=xk. | |
420 | // doesn't change internal state of the track | |
421 | //----------------------------------------------------------------- | |
422 | ||
6c94f330 | 423 | Double_t x1=GetX(), x2=x1+(xk-x1), dx=x2-x1; |
81e97e0d | 424 | |
6c94f330 | 425 | if (TMath::Abs(GetSnp()+GetC()*dx) >= AliTPCReconstructor::GetMaxSnpTrack()) { |
81e97e0d | 426 | return 0; |
427 | } | |
428 | ||
429 | // Double_t y1=fP0, z1=fP1; | |
60e55aee | 430 | Double_t c1=GetSnp(), r1=sqrt((1.-c1)*(1.+c1)); |
431 | Double_t c2=c1 + GetC()*dx, r2=sqrt((1.-c2)*(1.+c2)); | |
81e97e0d | 432 | |
6c94f330 | 433 | y = GetY(); |
434 | z = GetZ(); | |
81e97e0d | 435 | //y += dx*(c1+c2)/(r1+r2); |
436 | //z += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3; | |
437 | ||
438 | Double_t dy = dx*(c1+c2)/(r1+r2); | |
439 | Double_t dz = 0; | |
440 | // | |
6c94f330 | 441 | Double_t delta = GetC()*dx*(c1+c2)/(c1*r2 + c2*r1); |
81e97e0d | 442 | /* |
443 | if (TMath::Abs(delta)>0.0001){ | |
444 | dz = fP3*TMath::ASin(delta)/fP4; | |
445 | }else{ | |
446 | dz = dx*fP3*(c1+c2)/(c1*r2 + c2*r1); | |
447 | } | |
448 | */ | |
449 | // dz = fP3*AliTPCFastMath::FastAsin(delta)/fP4; | |
6c94f330 | 450 | dz = GetTgl()*TMath::ASin(delta)/GetC(); |
81e97e0d | 451 | // |
452 | y+=dy; | |
453 | z+=dz; | |
454 | ||
455 | ||
456 | return 1; | |
457 | } | |
458 | ||
459 | ||
460 | //_____________________________________________________________________________ | |
af32720d | 461 | Double_t AliTPCseed::GetPredictedChi2(const AliCluster *c) const |
81e97e0d | 462 | { |
463 | //----------------------------------------------------------------- | |
464 | // This function calculates a predicted chi2 increment. | |
465 | //----------------------------------------------------------------- | |
6c94f330 | 466 | Double_t p[2]={c->GetY(), c->GetZ()}; |
467 | Double_t cov[3]={fErrorY2, 0., fErrorZ2}; | |
9c7b8249 | 468 | |
469 | Float_t dx = ((AliTPCclusterMI*)c)->GetX()-GetX(); | |
470 | if (TMath::Abs(dx)>0){ | |
471 | Float_t ty = TMath::Tan(TMath::ASin(GetSnp())); | |
472 | Float_t dy = dx*ty; | |
473 | Float_t dz = dx*TMath::Sqrt(1.+ty*ty)*GetTgl(); | |
474 | p[0] = c->GetY()-dy; | |
475 | p[1] = c->GetZ()-dz; | |
476 | } | |
6c94f330 | 477 | return AliExternalTrackParam::GetPredictedChi2(p,cov); |
81e97e0d | 478 | } |
479 | ||
81e97e0d | 480 | //_________________________________________________________________________________________ |
481 | ||
482 | ||
483 | Int_t AliTPCseed::Compare(const TObject *o) const { | |
484 | //----------------------------------------------------------------- | |
485 | // This function compares tracks according to the sector - for given sector according z | |
486 | //----------------------------------------------------------------- | |
487 | AliTPCseed *t=(AliTPCseed*)o; | |
6c94f330 | 488 | |
81e97e0d | 489 | if (fSort == 0){ |
490 | if (t->fRelativeSector>fRelativeSector) return -1; | |
491 | if (t->fRelativeSector<fRelativeSector) return 1; | |
492 | Double_t z2 = t->GetZ(); | |
493 | Double_t z1 = GetZ(); | |
494 | if (z2>z1) return 1; | |
495 | if (z2<z1) return -1; | |
496 | return 0; | |
497 | } | |
498 | else { | |
499 | Float_t f2 =1; | |
6c23ffed | 500 | f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(t->OneOverPt()+0.0066); |
81e97e0d | 501 | if (t->fBConstrain) f2=1.2; |
502 | ||
503 | Float_t f1 =1; | |
6c23ffed | 504 | f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(OneOverPt()+0.0066); |
81e97e0d | 505 | |
506 | if (fBConstrain) f1=1.2; | |
507 | ||
508 | if (t->GetNumberOfClusters()*f2 <GetNumberOfClusters()*f1) return -1; | |
509 | else return +1; | |
510 | } | |
511 | } | |
512 | ||
513 | ||
514 | ||
515 | ||
516 | //_____________________________________________________________________________ | |
70e20dcf | 517 | Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t index) |
6c94f330 | 518 | { |
81e97e0d | 519 | //----------------------------------------------------------------- |
520 | // This function associates a cluster with this track. | |
521 | //----------------------------------------------------------------- | |
81e97e0d | 522 | Int_t n=GetNumberOfClusters(); |
70e20dcf | 523 | Int_t idx=GetClusterIndex(n); // save the current cluster index |
524 | ||
525 | AliCluster cl(*c); cl.SetSigmaY2(fErrorY2); cl.SetSigmaZ2(fErrorZ2); | |
ca521f6c | 526 | Float_t dx = ((AliTPCclusterMI*)c)->GetX()-GetX(); |
527 | if (TMath::Abs(dx)>0){ | |
528 | Float_t ty = TMath::Tan(TMath::ASin(GetSnp())); | |
529 | Float_t dy = dx*ty; | |
530 | Float_t dz = dx*TMath::Sqrt(1.+ty*ty)*GetTgl(); | |
531 | cl.SetY(c->GetY()-dy); | |
532 | cl.SetZ(c->GetZ()-dz); | |
533 | } | |
534 | ||
70e20dcf | 535 | if (!AliTPCtrack::Update(&cl,chisq,index)) return kFALSE; |
e0e13b88 | 536 | |
537 | if (fCMeanSigmaY2p30<0){ | |
538 | fCMeanSigmaY2p30= c->GetSigmaY2(); //! current mean sigma Y2 - mean30% | |
c07cb486 | 539 | fCMeanSigmaZ2p30= c->GetSigmaZ2(); //! current mean sigma Z2 - mean30% |
540 | fCMeanSigmaY2p30R = 1; //! current mean sigma Y2 - mean5% | |
541 | fCMeanSigmaZ2p30R = 1; //! current mean sigma Z2 - mean5% | |
e0e13b88 | 542 | } |
543 | // | |
544 | fCMeanSigmaY2p30= 0.70*fCMeanSigmaY2p30 +0.30*c->GetSigmaY2(); | |
c07cb486 | 545 | fCMeanSigmaZ2p30= 0.70*fCMeanSigmaZ2p30 +0.30*c->GetSigmaZ2(); |
546 | if (fCurrentSigmaY2>0){ | |
547 | fCMeanSigmaY2p30R = 0.7*fCMeanSigmaY2p30R +0.3*c->GetSigmaY2()/fCurrentSigmaY2; | |
548 | fCMeanSigmaZ2p30R = 0.7*fCMeanSigmaZ2p30R +0.3*c->GetSigmaZ2()/fCurrentSigmaZ2; | |
549 | } | |
e0e13b88 | 550 | |
81e97e0d | 551 | |
70e20dcf | 552 | SetClusterIndex(n,idx); // restore the current cluster index |
6c94f330 | 553 | return kTRUE; |
81e97e0d | 554 | } |
555 | ||
556 | ||
557 | ||
558 | //_____________________________________________________________________________ | |
dc5cd41c | 559 | Float_t AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t /* onlyused */) { |
81e97e0d | 560 | //----------------------------------------------------------------- |
561 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
562 | //----------------------------------------------------------------- | |
2cadb5d1 | 563 | // CookdEdxAnalytical(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2, Int_t returnVal) |
83afd539 | 564 | AliTPCParam *param = AliTPCcalibDB::Instance()->GetParameters(); |
44a6a09e | 565 | |
83afd539 | 566 | Int_t row0 = param->GetNRowLow(); |
567 | Int_t row1 = row0+param->GetNRowUp1(); | |
568 | Int_t row2 = row1+param->GetNRowUp2(); | |
44a6a09e | 569 | const AliTPCRecoParam * recoParam = AliTPCcalibDB::Instance()->GetTransform()->GetCurrentRecoParam(); |
570 | Int_t useTot = 0; | |
571 | if (recoParam) useTot = (recoParam->GetUseTotCharge())? 0:1; | |
83afd539 | 572 | // |
573 | // | |
574 | // | |
2cadb5d1 | 575 | fDEDX[0] = CookdEdxAnalytical(low,up,useTot ,i1 ,i2, 0); |
576 | fDEDX[1] = CookdEdxAnalytical(low,up,useTot ,0 ,row0, 0); | |
577 | fDEDX[2] = CookdEdxAnalytical(low,up,useTot ,row0,row1, 0); | |
578 | fDEDX[3] = CookdEdxAnalytical(low,up,useTot ,row1,row2, 0); | |
64bf5ca0 | 579 | fDEDX[4] = CookdEdxAnalytical(low,up,useTot ,row0,row2, 0); // full OROC truncated mean |
83afd539 | 580 | // |
2cadb5d1 | 581 | fSDEDX[0] = CookdEdxAnalytical(low,up,useTot ,i1 ,i2, 1); |
582 | fSDEDX[1] = CookdEdxAnalytical(low,up,useTot ,0 ,row0, 1); | |
583 | fSDEDX[2] = CookdEdxAnalytical(low,up,useTot ,row0,row1, 1); | |
584 | fSDEDX[3] = CookdEdxAnalytical(low,up,useTot ,row1,row2, 1); | |
83afd539 | 585 | // |
64bf5ca0 | 586 | fNCDEDX[0] = TMath::Nint(GetTPCClustInfo(2, 1, i1 , i2)); |
587 | fNCDEDX[1] = TMath::Nint(GetTPCClustInfo(2, 1, 0 , row0)); | |
588 | fNCDEDX[2] = TMath::Nint(GetTPCClustInfo(2, 1, row0, row1)); | |
589 | fNCDEDX[3] = TMath::Nint(GetTPCClustInfo(2, 1, row1, row2)); | |
590 | // | |
591 | fNCDEDXInclThres[0] = TMath::Nint(GetTPCClustInfo(2, 2, i1 , i2)); | |
592 | fNCDEDXInclThres[1] = TMath::Nint(GetTPCClustInfo(2, 2, 0 , row0)); | |
593 | fNCDEDXInclThres[2] = TMath::Nint(GetTPCClustInfo(2, 2, row0, row1)); | |
594 | fNCDEDXInclThres[3] = TMath::Nint(GetTPCClustInfo(2, 2, row1, row2)); | |
595 | // | |
83afd539 | 596 | SetdEdx(fDEDX[0]); |
597 | return fDEDX[0]; | |
81e97e0d | 598 | |
ba5e52fb | 599 | // return CookdEdxNorm(low,up,0,i1,i2,1,0,2); |
4cc7ba77 | 600 | |
601 | ||
ba5e52fb | 602 | // Float_t amp[200]; |
603 | // Float_t angular[200]; | |
604 | // Float_t weight[200]; | |
605 | // Int_t index[200]; | |
606 | // //Int_t nc = 0; | |
607 | // Float_t meanlog = 100.; | |
608 | ||
609 | // Float_t mean[4] = {0,0,0,0}; | |
610 | // Float_t sigma[4] = {1000,1000,1000,1000}; | |
611 | // Int_t nc[4] = {0,0,0,0}; | |
612 | // Float_t norm[4] = {1000,1000,1000,1000}; | |
613 | // // | |
614 | // // | |
615 | // fNShared =0; | |
616 | ||
617 | // Float_t gainGG = 1; | |
618 | // if (AliTPCcalibDB::Instance()->GetParameters()){ | |
619 | // gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000.; //relative gas gain | |
620 | // } | |
621 | ||
622 | ||
623 | // for (Int_t of =0; of<4; of++){ | |
624 | // for (Int_t i=of+i1;i<i2;i+=4) | |
625 | // { | |
626 | // Int_t clindex = fIndex[i]; | |
627 | // if (clindex<0||clindex&0x8000) continue; | |
628 | ||
629 | // //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i); | |
630 | // AliTPCTrackerPoint * point = GetTrackPoint(i); | |
631 | // //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1); | |
632 | // //AliTPCTrackerPoint * pointp = 0; | |
633 | // //if (i<159) pointp = GetTrackPoint(i+1); | |
634 | ||
635 | // if (point==0) continue; | |
636 | // AliTPCclusterMI * cl = fClusterPointer[i]; | |
637 | // if (cl==0) continue; | |
638 | // if (onlyused && (!cl->IsUsed(10))) continue; | |
639 | // if (cl->IsUsed(11)) { | |
640 | // fNShared++; | |
641 | // continue; | |
642 | // } | |
643 | // Int_t type = cl->GetType(); | |
644 | // //if (point->fIsShared){ | |
645 | // // fNShared++; | |
646 | // // continue; | |
647 | // //} | |
648 | // //if (pointm) | |
649 | // // if (pointm->fIsShared) continue; | |
650 | // //if (pointp) | |
651 | // // if (pointp->fIsShared) continue; | |
652 | ||
653 | // if (type<0) continue; | |
654 | // //if (type>10) continue; | |
655 | // //if (point->GetErrY()==0) continue; | |
656 | // //if (point->GetErrZ()==0) continue; | |
657 | ||
658 | // //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY(); | |
659 | // //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ(); | |
660 | // //if ((ddy*ddy+ddz*ddz)>10) continue; | |
661 | ||
662 | ||
663 | // // if (point->GetCPoint().GetMax()<5) continue; | |
664 | // if (cl->GetMax()<5) continue; | |
665 | // Float_t angley = point->GetAngleY(); | |
666 | // Float_t anglez = point->GetAngleZ(); | |
667 | ||
668 | // Float_t rsigmay2 = point->GetSigmaY(); | |
669 | // Float_t rsigmaz2 = point->GetSigmaZ(); | |
670 | // /* | |
671 | // Float_t ns = 1.; | |
672 | // if (pointm){ | |
673 | // rsigmay += pointm->GetTPoint().GetSigmaY(); | |
674 | // rsigmaz += pointm->GetTPoint().GetSigmaZ(); | |
675 | // ns+=1.; | |
676 | // } | |
677 | // if (pointp){ | |
678 | // rsigmay += pointp->GetTPoint().GetSigmaY(); | |
679 | // rsigmaz += pointp->GetTPoint().GetSigmaZ(); | |
680 | // ns+=1.; | |
681 | // } | |
682 | // rsigmay/=ns; | |
683 | // rsigmaz/=ns; | |
684 | // */ | |
685 | ||
686 | // Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2); | |
687 | ||
688 | // Float_t ampc = 0; // normalization to the number of electrons | |
689 | // if (i>64){ | |
690 | // // ampc = 1.*point->GetCPoint().GetMax(); | |
691 | // ampc = 1.*cl->GetMax(); | |
692 | // //ampc = 1.*point->GetCPoint().GetQ(); | |
693 | // // AliTPCClusterPoint & p = point->GetCPoint(); | |
694 | // // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5); | |
695 | // // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
696 | // //Float_t dz = | |
697 | // // TMath::Abs( Int_t(iz) - iz + 0.5); | |
698 | // //ampc *= 1.15*(1-0.3*dy); | |
699 | // //ampc *= 1.15*(1-0.3*dz); | |
700 | // // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ())); | |
701 | // //ampc *=zfactor; | |
702 | // } | |
703 | // else{ | |
704 | // //ampc = 1.0*point->GetCPoint().GetMax(); | |
705 | // ampc = 1.0*cl->GetMax(); | |
706 | // //ampc = 1.0*point->GetCPoint().GetQ(); | |
707 | // //AliTPCClusterPoint & p = point->GetCPoint(); | |
708 | // // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5); | |
709 | // //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
710 | // //Float_t dz = | |
711 | // // TMath::Abs( Int_t(iz) - iz + 0.5); | |
712 | ||
713 | // //ampc *= 1.15*(1-0.3*dy); | |
714 | // //ampc *= 1.15*(1-0.3*dz); | |
715 | // // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ())); | |
716 | // //ampc *=zfactor; | |
717 | ||
718 | // } | |
719 | // ampc *= 2.0; // put mean value to channel 50 | |
720 | // //ampc *= 0.58; // put mean value to channel 50 | |
721 | // Float_t w = 1.; | |
722 | // // if (type>0) w = 1./(type/2.-0.5); | |
723 | // // Float_t z = TMath::Abs(cl->GetZ()); | |
724 | // if (i<64) { | |
725 | // ampc /= 0.6; | |
726 | // //ampc /= (1+0.0008*z); | |
727 | // } else | |
728 | // if (i>128){ | |
729 | // ampc /=1.5; | |
730 | // //ampc /= (1+0.0008*z); | |
731 | // }else{ | |
732 | // //ampc /= (1+0.0008*z); | |
733 | // } | |
81e97e0d | 734 | |
ba5e52fb | 735 | // if (type<0) { //amp at the border - lower weight |
736 | // // w*= 2.; | |
81e97e0d | 737 | |
ba5e52fb | 738 | // continue; |
739 | // } | |
740 | // if (rsigma>1.5) ampc/=1.3; // if big backround | |
741 | // amp[nc[of]] = ampc; | |
742 | // amp[nc[of]] /=gainGG; | |
743 | // angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez); | |
744 | // weight[nc[of]] = w; | |
745 | // nc[of]++; | |
746 | // } | |
81e97e0d | 747 | |
ba5e52fb | 748 | // TMath::Sort(nc[of],amp,index,kFALSE); |
749 | // Float_t sumamp=0; | |
750 | // Float_t sumamp2=0; | |
751 | // Float_t sumw=0; | |
752 | // //meanlog = amp[index[Int_t(nc[of]*0.33)]]; | |
753 | // meanlog = 50; | |
754 | // for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){ | |
755 | // Float_t ampl = amp[index[i]]/angular[index[i]]; | |
756 | // ampl = meanlog*TMath::Log(1.+ampl/meanlog); | |
757 | // // | |
758 | // sumw += weight[index[i]]; | |
759 | // sumamp += weight[index[i]]*ampl; | |
760 | // sumamp2 += weight[index[i]]*ampl*ampl; | |
761 | // norm[of] += angular[index[i]]*weight[index[i]]; | |
762 | // } | |
763 | // if (sumw<1){ | |
764 | // SetdEdx(0); | |
765 | // } | |
766 | // else { | |
767 | // norm[of] /= sumw; | |
768 | // mean[of] = sumamp/sumw; | |
769 | // sigma[of] = sumamp2/sumw-mean[of]*mean[of]; | |
770 | // if (sigma[of]>0.1) | |
771 | // sigma[of] = TMath::Sqrt(sigma[of]); | |
772 | // else | |
773 | // sigma[of] = 1000; | |
81e97e0d | 774 | |
ba5e52fb | 775 | // mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog; |
776 | // //mean *=(1-0.02*(sigma/(mean*0.17)-1.)); | |
777 | // //mean *=(1-0.1*(norm-1.)); | |
778 | // } | |
779 | // } | |
780 | ||
781 | // Float_t dedx =0; | |
782 | // fSdEdx =0; | |
783 | // fMAngular =0; | |
784 | // // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1)); | |
785 | // // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1)); | |
81e97e0d | 786 | |
787 | ||
ba5e52fb | 788 | // // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/ |
789 | // // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1]))); | |
790 | ||
791 | // Int_t norm2 = 0; | |
792 | // Int_t norm3 = 0; | |
793 | // for (Int_t i =0;i<4;i++){ | |
794 | // if (nc[i]>2&&nc[i]<1000){ | |
795 | // dedx += mean[i] *nc[i]; | |
796 | // fSdEdx += sigma[i]*(nc[i]-2); | |
797 | // fMAngular += norm[i] *nc[i]; | |
798 | // norm2 += nc[i]; | |
799 | // norm3 += nc[i]-2; | |
800 | // } | |
801 | // fDEDX[i] = mean[i]; | |
802 | // fSDEDX[i] = sigma[i]; | |
803 | // fNCDEDX[i]= nc[i]; | |
804 | // } | |
805 | ||
806 | // if (norm3>0){ | |
807 | // dedx /=norm2; | |
808 | // fSdEdx /=norm3; | |
809 | // fMAngular/=norm2; | |
810 | // } | |
811 | // else{ | |
812 | // SetdEdx(0); | |
813 | // return 0; | |
814 | // } | |
815 | // // Float_t dedx1 =dedx; | |
816 | // /* | |
817 | // dedx =0; | |
818 | // for (Int_t i =0;i<4;i++){ | |
819 | // if (nc[i]>2&&nc[i]<1000){ | |
820 | // mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.)); | |
821 | // dedx += mean[i] *nc[i]; | |
822 | // } | |
823 | // fDEDX[i] = mean[i]; | |
824 | // } | |
825 | // dedx /= norm2; | |
826 | // */ | |
81e97e0d | 827 | |
828 | ||
ba5e52fb | 829 | // SetdEdx(dedx); |
830 | // return dedx; | |
81e97e0d | 831 | } |
81e97e0d | 832 | |
833 | void AliTPCseed::CookPID() | |
834 | { | |
835 | // | |
836 | // cook PID information according dEdx | |
837 | // | |
838 | Double_t fRange = 10.; | |
839 | Double_t fRes = 0.1; | |
840 | Double_t fMIP = 47.; | |
841 | // | |
842 | Int_t ns=AliPID::kSPECIES; | |
843 | Double_t sumr =0; | |
844 | for (Int_t j=0; j<ns; j++) { | |
845 | Double_t mass=AliPID::ParticleMass(j); | |
6c94f330 | 846 | Double_t mom=GetP(); |
81e97e0d | 847 | Double_t dedx=fdEdx/fMIP; |
5731b051 | 848 | Double_t bethe=AliMathBase::BetheBlochAleph(mom/mass); |
81e97e0d | 849 | Double_t sigma=fRes*bethe; |
850 | if (sigma>0.001){ | |
851 | if (TMath::Abs(dedx-bethe) > fRange*sigma) { | |
852 | fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma; | |
853 | sumr+=fTPCr[j]; | |
854 | continue; | |
855 | } | |
856 | fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma; | |
857 | sumr+=fTPCr[j]; | |
858 | } | |
859 | else{ | |
860 | fTPCr[j]=1.; | |
861 | sumr+=fTPCr[j]; | |
862 | } | |
863 | } | |
864 | for (Int_t j=0; j<ns; j++) { | |
865 | fTPCr[j]/=sumr; //normalize | |
866 | } | |
867 | } | |
868 | ||
6c94f330 | 869 | Double_t AliTPCseed::GetYat(Double_t xk) const { |
870 | //----------------------------------------------------------------- | |
871 | // This function calculates the Y-coordinate of a track at the plane x=xk. | |
872 | //----------------------------------------------------------------- | |
873 | if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06 | |
60e55aee | 874 | Double_t c1=GetSnp(), r1=TMath::Sqrt((1.-c1)*(1.+c1)); |
6c94f330 | 875 | Double_t c2=c1+GetC()*(xk-GetX()); |
876 | if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0; | |
60e55aee | 877 | Double_t r2=TMath::Sqrt((1.-c2)*(1.+c2)); |
6c94f330 | 878 | return GetY() + (xk-GetX())*(c1+c2)/(r1+r2); |
879 | } | |
880 | ||
0a65832b | 881 | |
882 | ||
8a92e133 | 883 | Float_t AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2, Bool_t shapeNorm,Int_t posNorm, Int_t padNorm, Int_t returnVal){ |
0a65832b | 884 | |
885 | // | |
886 | // calculates dedx using the cluster | |
887 | // low - up specify trunc mean range - default form 0-0.7 | |
8076baa0 | 888 | // type - 1 - max charge or 0- total charge in cluster |
889 | // //2- max no corr 3- total+ correction | |
0a65832b | 890 | // i1-i2 - the pad-row range used for calculation |
ba5e52fb | 891 | // shapeNorm - kTRUE -taken from OCDB |
892 | // | |
893 | // posNorm - usage of pos normalization | |
83afd539 | 894 | // padNorm - pad type normalization |
895 | // returnVal - 0 return mean | |
896 | // - 1 return RMS | |
897 | // - 2 return number of clusters | |
898 | // | |
0a65832b | 899 | // normalization parametrization taken from AliTPCClusterParam |
900 | // | |
ba5e52fb | 901 | AliTPCClusterParam * parcl = AliTPCcalibDB::Instance()->GetClusterParam(); |
902 | AliTPCParam * param = AliTPCcalibDB::Instance()->GetParameters(); | |
903 | if (!parcl) return 0; | |
904 | if (!param) return 0; | |
83afd539 | 905 | Int_t row0 = param->GetNRowLow(); |
906 | Int_t row1 = row0+param->GetNRowUp1(); | |
907 | ||
0a65832b | 908 | Float_t amp[160]; |
909 | Int_t indexes[160]; | |
910 | Int_t ncl=0; | |
911 | // | |
912 | // | |
ba5e52fb | 913 | Float_t gainGG = 1; // gas gain factor -always enabled |
914 | Float_t gainPad = 1; // gain map - used always | |
83afd539 | 915 | Float_t corrShape = 1; // correction due angular effect, diffusion and electron attachment |
ba5e52fb | 916 | Float_t corrPos = 1; // local position correction - if posNorm enabled |
917 | Float_t corrPadType = 1; // pad type correction - if padNorm enabled | |
918 | Float_t corrNorm = 1; // normalization factor - set Q to channel 50 | |
919 | // | |
920 | // | |
921 | // | |
4cc7ba77 | 922 | if (AliTPCcalibDB::Instance()->GetParameters()){ |
ba5e52fb | 923 | gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000; //relative gas gain |
4cc7ba77 | 924 | } |
925 | ||
0a65832b | 926 | const Float_t ktany = TMath::Tan(TMath::DegToRad()*10); |
4cc7ba77 | 927 | const Float_t kedgey =3.; |
0a65832b | 928 | // |
7cd8ac3f | 929 | // |
0a65832b | 930 | for (Int_t irow=i1; irow<i2; irow++){ |
931 | AliTPCclusterMI* cluster = GetClusterPointer(irow); | |
932 | if (!cluster) continue; | |
933 | if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster | |
8076baa0 | 934 | Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ(); |
ba5e52fb | 935 | Int_t ipad= 0; |
83afd539 | 936 | if (irow>=row0) ipad=1; |
937 | if (irow>=row1) ipad=2; | |
ba5e52fb | 938 | // |
939 | // | |
940 | // | |
941 | AliTPCCalPad * gainMap = AliTPCcalibDB::Instance()->GetDedxGainFactor(); | |
942 | if (gainMap) { | |
943 | // | |
944 | // Get gainPad - pad by pad calibration | |
945 | // | |
d6920632 | 946 | Float_t factor = 1; |
947 | AliTPCCalROC * roc = gainMap->GetCalROC(cluster->GetDetector()); | |
83afd539 | 948 | if (irow < row0) { // IROC |
ba5e52fb | 949 | factor = roc->GetValue(irow, TMath::Nint(cluster->GetPad())); |
d6920632 | 950 | } else { // OROC |
83afd539 | 951 | factor = roc->GetValue(irow - row0, TMath::Nint(cluster->GetPad())); |
d6920632 | 952 | } |
ba5e52fb | 953 | if (factor>0.5) gainPad=factor; |
7cd8ac3f | 954 | } |
ba5e52fb | 955 | // |
956 | //do position and angular normalization | |
957 | // | |
958 | if (shapeNorm){ | |
959 | if (type<=1){ | |
960 | // | |
961 | AliTPCTrackerPoint * point = GetTrackPoint(irow); | |
962 | Float_t ty = TMath::Abs(point->GetAngleY()); | |
83afd539 | 963 | Float_t tz = TMath::Abs(point->GetAngleZ()*TMath::Sqrt(1+ty*ty)); |
ba5e52fb | 964 | |
965 | Float_t dr = (250.-TMath::Abs(cluster->GetZ()))/250.; | |
966 | corrShape = parcl->Qnorm(ipad,type,dr,ty,tz); | |
967 | } | |
0a65832b | 968 | } |
ba5e52fb | 969 | |
8a92e133 | 970 | if (posNorm>0){ |
8e1dcdda | 971 | // |
ba5e52fb | 972 | // Do position normalization - relative distance to |
973 | // center of pad- time bin | |
974 | // Work in progress | |
022a2383 | 975 | // corrPos = parcl->QnormPos(ipad,type, cluster->GetPad(), |
976 | // cluster->GetTimeBin(), cluster->GetZ(), | |
977 | // cluster->GetSigmaY2(),cluster->GetSigmaZ2(), | |
978 | // cluster->GetMax(),cluster->GetQ()); | |
8a92e133 | 979 | // scaled response function |
980 | Float_t yres0 = parcl->GetRMS0(0,ipad,0,0)/param->GetPadPitchWidth(cluster->GetDetector()); | |
981 | Float_t zres0 = parcl->GetRMS0(1,ipad,0,0)/param->GetZWidth(); | |
982 | // | |
983 | ||
022a2383 | 984 | AliTPCTrackerPoint * point = GetTrackPoint(irow); |
985 | Float_t ty = TMath::Abs(point->GetAngleY()); | |
986 | Float_t tz = TMath::Abs(point->GetAngleZ()*TMath::Sqrt(1+ty*ty)); | |
987 | ||
988 | if (type==1) corrPos = | |
989 | parcl->QmaxCorrection(cluster->GetDetector(), cluster->GetRow(),cluster->GetPad(), | |
8a92e133 | 990 | cluster->GetTimeBin(),ty,tz,yres0,zres0,0.4); |
022a2383 | 991 | if (type==0) corrPos = |
992 | parcl->QtotCorrection(cluster->GetDetector(), cluster->GetRow(),cluster->GetPad(), | |
8a92e133 | 993 | cluster->GetTimeBin(),ty,tz,yres0,zres0,cluster->GetQ(),2.5,0.4); |
994 | if (posNorm==3){ | |
995 | Float_t dr = (250.-TMath::Abs(cluster->GetZ()))/250.; | |
996 | Double_t signtgl = (cluster->GetZ()*point->GetAngleZ()>0)? 1:-1; | |
997 | Double_t p2 = TMath::Abs(TMath::Sin(TMath::ATan(ty))); | |
998 | Float_t corrHis = parcl->QnormHis(ipad,type,dr,p2,TMath::Abs(point->GetAngleZ())*signtgl); | |
999 | if (corrHis>0) corrPos*=corrHis; | |
1000 | } | |
1001 | ||
8e1dcdda | 1002 | } |
1003 | ||
ba5e52fb | 1004 | if (padNorm==1){ |
1005 | //taken from OCDB | |
798017c7 | 1006 | if (type==0 && parcl->QpadTnorm()) corrPadType = (*parcl->QpadTnorm())[ipad]; |
1007 | if (type==1 && parcl->QpadMnorm()) corrPadType = (*parcl->QpadMnorm())[ipad]; | |
022a2383 | 1008 | |
2fc9608f | 1009 | } |
ba5e52fb | 1010 | if (padNorm==2){ |
1011 | corrPadType =param->GetPadPitchLength(cluster->GetDetector(),cluster->GetRow()); | |
1012 | //use hardwired - temp fix | |
1013 | if (type==0) corrNorm=3.; | |
1014 | if (type==1) corrNorm=1.; | |
1015 | } | |
1016 | // | |
1017 | amp[ncl]=charge; | |
1018 | amp[ncl]/=gainGG; | |
1019 | amp[ncl]/=gainPad; | |
1020 | amp[ncl]/=corrShape; | |
1021 | amp[ncl]/=corrPadType; | |
1022 | amp[ncl]/=corrPos; | |
1023 | amp[ncl]/=corrNorm; | |
1024 | // | |
0a65832b | 1025 | ncl++; |
1026 | } | |
8076baa0 | 1027 | |
0a65832b | 1028 | if (type>3) return ncl; |
1029 | TMath::Sort(ncl,amp, indexes, kFALSE); | |
1030 | ||
8076baa0 | 1031 | if (ncl<10) return 0; |
0a65832b | 1032 | |
1033 | Float_t suma=0; | |
83afd539 | 1034 | Float_t suma2=0; |
0a65832b | 1035 | Float_t sumn=0; |
1036 | Int_t icl0=TMath::Nint(ncl*low); | |
1037 | Int_t icl1=TMath::Nint(ncl*up); | |
1038 | for (Int_t icl=icl0; icl<icl1;icl++){ | |
1039 | suma+=amp[indexes[icl]]; | |
83afd539 | 1040 | suma2+=amp[indexes[icl]]*amp[indexes[icl]]; |
0a65832b | 1041 | sumn++; |
1042 | } | |
83afd539 | 1043 | Float_t mean =suma/sumn; |
1044 | Float_t rms =TMath::Sqrt(TMath::Abs(suma2/sumn-mean*mean)); | |
3af3fbc4 | 1045 | // |
1046 | // do time-dependent correction for pressure and temperature variations | |
1047 | UInt_t runNumber = 1; | |
1048 | Float_t corrTimeGain = 1; | |
1049 | AliTPCTransform * trans = AliTPCcalibDB::Instance()->GetTransform(); | |
e5e80ff9 | 1050 | const AliTPCRecoParam * recoParam = AliTPCcalibDB::Instance()->GetTransform()->GetCurrentRecoParam(); |
1051 | if (trans && recoParam->GetUseGainCorrectionTime()>0) { | |
3af3fbc4 | 1052 | runNumber = trans->GetCurrentRunNumber(); |
e5e80ff9 | 1053 | //AliTPCcalibDB::Instance()->SetRun(runNumber); |
a2c3785e | 1054 | TObjArray * timeGainSplines = AliTPCcalibDB::Instance()->GetTimeGainSplinesRun(runNumber); |
3af3fbc4 | 1055 | if (timeGainSplines) { |
1056 | UInt_t time = trans->GetCurrentTimeStamp(); | |
1057 | AliSplineFit * fitMIP = (AliSplineFit *) timeGainSplines->At(0); | |
1058 | AliSplineFit * fitFPcosmic = (AliSplineFit *) timeGainSplines->At(1); | |
1059 | if (fitMIP) { | |
108a67db | 1060 | corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitMIP, time);/*fitMIP->Eval(time);*/ |
3af3fbc4 | 1061 | } else { |
108a67db | 1062 | if (fitFPcosmic) corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitFPcosmic, time);/*fitFPcosmic->Eval(time);*/ |
3af3fbc4 | 1063 | } |
1064 | } | |
1065 | } | |
1066 | mean /= corrTimeGain; | |
1067 | rms /= corrTimeGain; | |
1068 | // | |
83afd539 | 1069 | if (returnVal==1) return rms; |
8a92e133 | 1070 | if (returnVal==2) return ncl; |
1071 | return mean; | |
1072 | } | |
1073 | ||
6feb400f | 1074 | Float_t AliTPCseed::CookdEdxAnalytical(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2, Int_t returnVal, Int_t rowThres, Int_t mode){ |
8a92e133 | 1075 | |
1076 | // | |
1077 | // calculates dedx using the cluster | |
1078 | // low - up specify trunc mean range - default form 0-0.7 | |
1079 | // type - 1 - max charge or 0- total charge in cluster | |
1080 | // //2- max no corr 3- total+ correction | |
1081 | // i1-i2 - the pad-row range used for calculation | |
1082 | // | |
1083 | // posNorm - usage of pos normalization | |
6feb400f | 1084 | // returnVal - 0 return mean |
1085 | // - 1 return RMS | |
1086 | // - 2 return number of clusters | |
1087 | // - 3 ratio | |
1088 | // - 4 mean upper half | |
1089 | // - 5 mean - lower half | |
1090 | // - 6 third moment | |
1091 | // mode - 0 - linear | |
1092 | // - 1 - logatithmic | |
2efc897f | 1093 | // rowThres - number of rows before and after given pad row to check for clusters below threshold |
8a92e133 | 1094 | // |
1095 | // normalization parametrization taken from AliTPCClusterParam | |
1096 | // | |
1097 | AliTPCClusterParam * parcl = AliTPCcalibDB::Instance()->GetClusterParam(); | |
1098 | AliTPCParam * param = AliTPCcalibDB::Instance()->GetParameters(); | |
1099 | if (!parcl) return 0; | |
1100 | if (!param) return 0; | |
1101 | Int_t row0 = param->GetNRowLow(); | |
1102 | Int_t row1 = row0+param->GetNRowUp1(); | |
1103 | ||
1104 | Float_t amp[160]; | |
1105 | Int_t indexes[160]; | |
1106 | Int_t ncl=0; | |
2efc897f | 1107 | Int_t nclBelowThr = 0; // counts number of clusters below threshold |
8a92e133 | 1108 | // |
1109 | // | |
1110 | Float_t gainGG = 1; // gas gain factor -always enabled | |
1111 | Float_t gainPad = 1; // gain map - used always | |
1112 | Float_t corrPos = 1; // local position correction - if posNorm enabled | |
8a92e133 | 1113 | // |
1114 | // | |
1115 | // | |
1116 | if (AliTPCcalibDB::Instance()->GetParameters()){ | |
1117 | gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000; //relative gas gain | |
1118 | } | |
649fcc43 | 1119 | // |
1120 | // extract time-dependent correction for pressure and temperature variations | |
1121 | // | |
1122 | UInt_t runNumber = 1; | |
1123 | Float_t corrTimeGain = 1; | |
1124 | TObjArray * timeGainSplines = 0x0; | |
1125 | TGraphErrors * grPadEqual = 0x0; | |
1126 | // | |
1127 | AliTPCTransform * trans = AliTPCcalibDB::Instance()->GetTransform(); | |
1128 | const AliTPCRecoParam * recoParam = AliTPCcalibDB::Instance()->GetTransform()->GetCurrentRecoParam(); | |
6d64657a | 1129 | // |
1130 | if (recoParam->GetNeighborRowsDedx() == 0) rowThres = 0; | |
1131 | // | |
649fcc43 | 1132 | if (trans) { |
2efc897f | 1133 | runNumber = trans->GetCurrentRunNumber(); |
1134 | //AliTPCcalibDB::Instance()->SetRun(runNumber); | |
1135 | timeGainSplines = AliTPCcalibDB::Instance()->GetTimeGainSplinesRun(runNumber); | |
1136 | if (timeGainSplines && recoParam->GetUseGainCorrectionTime()>0) { | |
1137 | UInt_t time = trans->GetCurrentTimeStamp(); | |
1138 | AliSplineFit * fitMIP = (AliSplineFit *) timeGainSplines->At(0); | |
1139 | AliSplineFit * fitFPcosmic = (AliSplineFit *) timeGainSplines->At(1); | |
1140 | if (fitMIP) { | |
1141 | corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitMIP, time); /*fitMIP->Eval(time);*/ | |
649fcc43 | 1142 | } else { |
2efc897f | 1143 | if (fitFPcosmic) corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitFPcosmic, time); /*fitFPcosmic->Eval(time); */ |
1144 | } | |
649fcc43 | 1145 | // |
1146 | if (type==1) grPadEqual = (TGraphErrors * ) timeGainSplines->FindObject("TGRAPHERRORS_MEANQMAX_PADREGIONGAIN_BEAM_ALL"); | |
1147 | if (type==0) grPadEqual = (TGraphErrors * ) timeGainSplines->FindObject("TGRAPHERRORS_MEANQTOT_PADREGIONGAIN_BEAM_ALL"); | |
2efc897f | 1148 | } |
649fcc43 | 1149 | } |
2efc897f | 1150 | |
1151 | const Float_t kClusterShapeCut = 1.5; // IMPPRTANT TO DO: move value to AliTPCRecoParam | |
8a92e133 | 1152 | const Float_t ktany = TMath::Tan(TMath::DegToRad()*10); |
1153 | const Float_t kedgey =3.; | |
1154 | // | |
1155 | // | |
1156 | for (Int_t irow=i1; irow<i2; irow++){ | |
1157 | AliTPCclusterMI* cluster = GetClusterPointer(irow); | |
736a5826 | 1158 | if (!cluster && irow > 1 && irow < 157) { |
2efc897f | 1159 | Bool_t isClBefore = kFALSE; |
1160 | Bool_t isClAfter = kFALSE; | |
1161 | for(Int_t ithres = 1; ithres <= rowThres; ithres++) { | |
1162 | AliTPCclusterMI * clusterBefore = GetClusterPointer(irow - ithres); | |
1163 | if (clusterBefore) isClBefore = kTRUE; | |
1164 | AliTPCclusterMI * clusterAfter = GetClusterPointer(irow + ithres); | |
1165 | if (clusterAfter) isClAfter = kTRUE; | |
1166 | } | |
1167 | if (isClBefore && isClAfter) nclBelowThr++; | |
2efc897f | 1168 | } |
736a5826 | 1169 | if (!cluster) continue; |
2efc897f | 1170 | // |
1171 | // | |
8a92e133 | 1172 | if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster |
2efc897f | 1173 | // |
1174 | AliTPCTrackerPoint * point = GetTrackPoint(irow); | |
1175 | if (point==0) continue; | |
1176 | Float_t rsigmay = TMath::Sqrt(point->GetSigmaY()); | |
1177 | if (rsigmay > kClusterShapeCut) continue; | |
1178 | // | |
1179 | if (cluster->IsUsed(11)) continue; // remove shared clusters for PbPb | |
1180 | // | |
8a92e133 | 1181 | Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ(); |
1182 | Int_t ipad= 0; | |
1183 | if (irow>=row0) ipad=1; | |
1184 | if (irow>=row1) ipad=2; | |
1185 | // | |
1186 | // | |
1187 | // | |
1188 | AliTPCCalPad * gainMap = AliTPCcalibDB::Instance()->GetDedxGainFactor(); | |
1189 | if (gainMap) { | |
1190 | // | |
1191 | // Get gainPad - pad by pad calibration | |
1192 | // | |
1193 | Float_t factor = 1; | |
1194 | AliTPCCalROC * roc = gainMap->GetCalROC(cluster->GetDetector()); | |
1195 | if (irow < row0) { // IROC | |
1196 | factor = roc->GetValue(irow, TMath::Nint(cluster->GetPad())); | |
1197 | } else { // OROC | |
1198 | factor = roc->GetValue(irow - row0, TMath::Nint(cluster->GetPad())); | |
1199 | } | |
2efc897f | 1200 | if (factor>0.3) gainPad=factor; |
8a92e133 | 1201 | } |
8a92e133 | 1202 | // |
1203 | // Do position normalization - relative distance to | |
1204 | // center of pad- time bin | |
1205 | ||
8a92e133 | 1206 | Float_t ty = TMath::Abs(point->GetAngleY()); |
1207 | Float_t tz = TMath::Abs(point->GetAngleZ()*TMath::Sqrt(1+ty*ty)); | |
1208 | Float_t yres0 = parcl->GetRMS0(0,ipad,0,0)/param->GetPadPitchWidth(cluster->GetDetector()); | |
1209 | Float_t zres0 = parcl->GetRMS0(1,ipad,0,0)/param->GetZWidth(); | |
1210 | ||
1211 | yres0 *=parcl->GetQnormCorr(ipad, type,0); | |
1212 | zres0 *=parcl->GetQnormCorr(ipad, type,1); | |
1213 | Float_t effLength=parcl->GetQnormCorr(ipad, type,4)*0.5; | |
1214 | Float_t effDiff =(parcl->GetQnormCorr(ipad, type,2)+parcl->GetQnormCorr(ipad, type,3))*0.5; | |
1215 | // | |
1216 | if (type==1) { | |
1217 | corrPos = parcl->GetQnormCorr(ipad, type,5)* | |
1218 | parcl->QmaxCorrection(cluster->GetDetector(), cluster->GetRow(),cluster->GetPad(), | |
1219 | cluster->GetTimeBin(),ty,tz,yres0,zres0,effLength,effDiff); | |
1220 | Float_t drm = 0.5-TMath::Abs(cluster->GetZ()/250.); | |
1221 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,0)*drm); | |
1222 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,1)*ty*ty); | |
1223 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,2)*tz*tz); | |
1224 | // | |
1225 | } | |
1226 | if (type==0) { | |
1227 | corrPos = parcl->GetQnormCorr(ipad, type,5)* | |
1228 | parcl->QtotCorrection(cluster->GetDetector(), cluster->GetRow(),cluster->GetPad(), | |
1229 | cluster->GetTimeBin(),ty,tz,yres0,zres0,cluster->GetQ(),2.5,effLength,effDiff); | |
1230 | ||
1231 | Float_t drm = 0.5-TMath::Abs(cluster->GetZ()/250.); | |
1232 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,0)*drm); | |
1233 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,1)*ty*ty); | |
1234 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,2)*tz*tz); | |
1235 | // | |
1236 | } | |
2efc897f | 1237 | // |
1238 | // pad region equalization outside of cluster param | |
1239 | // | |
1240 | Float_t gainEqualPadRegion = 1; | |
649fcc43 | 1241 | if (grPadEqual) gainEqualPadRegion = grPadEqual->Eval(ipad); |
8a92e133 | 1242 | // |
1243 | amp[ncl]=charge; | |
1244 | amp[ncl]/=gainGG; | |
1245 | amp[ncl]/=gainPad; | |
1246 | amp[ncl]/=corrPos; | |
2efc897f | 1247 | amp[ncl]/=gainEqualPadRegion; |
8a92e133 | 1248 | // |
1249 | ncl++; | |
1250 | } | |
1251 | ||
6feb400f | 1252 | if (type==2) return ncl; |
8a92e133 | 1253 | TMath::Sort(ncl,amp, indexes, kFALSE); |
2efc897f | 1254 | // |
8a92e133 | 1255 | if (ncl<10) return 0; |
2efc897f | 1256 | // |
1257 | Double_t * ampWithBelow = new Double_t[ncl + nclBelowThr]; | |
1258 | for(Int_t iCl = 0; iCl < ncl + nclBelowThr; iCl++) { | |
1259 | if (iCl < nclBelowThr) { | |
1260 | ampWithBelow[iCl] = amp[indexes[0]]; | |
1261 | } else { | |
1262 | ampWithBelow[iCl] = amp[indexes[iCl - nclBelowThr]]; | |
1263 | } | |
1264 | } | |
1265 | //printf("DEBUG: %i shit %f", nclBelowThr, amp[indexes[0]]); | |
1266 | // | |
8a92e133 | 1267 | Float_t suma=0; |
1268 | Float_t suma2=0; | |
6feb400f | 1269 | Float_t suma3=0; |
1270 | Float_t sumaS=0; | |
8a92e133 | 1271 | Float_t sumn=0; |
6feb400f | 1272 | // upper,and lower part statistic |
1273 | Float_t sumL=0, sumL2=0, sumLN=0; | |
1274 | Float_t sumD=0, sumD2=0, sumDN=0; | |
1275 | ||
2efc897f | 1276 | Int_t icl0=TMath::Nint((ncl + nclBelowThr)*low); |
1277 | Int_t icl1=TMath::Nint((ncl + nclBelowThr)*up); | |
6feb400f | 1278 | Int_t iclm=TMath::Nint((ncl + nclBelowThr)*(low +(up+low)*0.5)); |
1279 | // | |
8a92e133 | 1280 | for (Int_t icl=icl0; icl<icl1;icl++){ |
6feb400f | 1281 | if (ampWithBelow[icl]<0.1) continue; |
504dd8df | 1282 | Double_t camp=ampWithBelow[icl]/corrTimeGain; |
1283 | if (mode==1) camp= TMath::Log(camp); | |
6feb400f | 1284 | if (icl<icl1){ |
504dd8df | 1285 | suma+=camp; |
1286 | suma2+=camp*camp; | |
1287 | suma3+=camp*camp*camp; | |
1288 | sumaS+=TMath::Power(TMath::Abs(camp),1./3.); | |
6feb400f | 1289 | sumn++; |
1290 | } | |
1291 | if (icl>iclm){ | |
504dd8df | 1292 | sumL+=camp; |
1293 | sumL2+=camp*camp; | |
6feb400f | 1294 | sumLN++; |
1295 | } | |
1296 | if (icl<=iclm){ | |
504dd8df | 1297 | sumD+=camp; |
1298 | sumD2+=camp*camp; | |
6feb400f | 1299 | sumDN++; |
1300 | } | |
8a92e133 | 1301 | } |
0f7547f1 | 1302 | // |
1303 | Float_t mean = 0; | |
1304 | Float_t meanL = 0; | |
1305 | Float_t meanD = 0; // lower half mean | |
1306 | if (sumn > 1e-30) mean =suma/sumn; | |
1307 | if (sumLN > 1e-30) meanL =sumL/sumLN; | |
1308 | if (sumDN > 1e-30) meanD =(sumD/sumDN); | |
1309 | /* | |
8a92e133 | 1310 | Float_t mean =suma/sumn; |
6feb400f | 1311 | Float_t meanL = sumL/sumLN; |
1312 | Float_t meanD =(sumD/sumDN); // lower half mean | |
0f7547f1 | 1313 | */ |
28273e26 | 1314 | |
1315 | Float_t rms = 0; | |
1316 | Float_t mean2=0; | |
1317 | Float_t mean3=0; | |
1318 | Float_t meanS=0; | |
1319 | ||
1320 | if(sumn>0){ | |
1321 | rms = TMath::Sqrt(TMath::Abs(suma2/sumn-mean*mean)); | |
1322 | mean2=suma2/sumn; | |
1323 | mean3=suma3/sumn; | |
1324 | meanS=sumaS/sumn; | |
1325 | } | |
1326 | ||
6feb400f | 1327 | if (mean2>0) mean2=TMath::Power(TMath::Abs(mean2),1./2.); |
1328 | if (mean3>0) mean3=TMath::Power(TMath::Abs(mean3),1./3.); | |
1329 | if (meanS>0) meanS=TMath::Power(TMath::Abs(meanS),3.); | |
3af3fbc4 | 1330 | // |
6feb400f | 1331 | if (mode==1) mean=TMath::Exp(mean); |
1332 | if (mode==1) meanL=TMath::Exp(meanL); // upper truncation | |
1333 | if (mode==1) meanD=TMath::Exp(meanD); // lower truncation | |
1334 | // | |
1335 | delete [] ampWithBelow; | |
1336 | ||
1337 | ||
3af3fbc4 | 1338 | // |
8a92e133 | 1339 | if (returnVal==1) return rms; |
83afd539 | 1340 | if (returnVal==2) return ncl; |
6feb400f | 1341 | if (returnVal==3) return Double_t(nclBelowThr)/Double_t(nclBelowThr+ncl); |
1342 | if (returnVal==4) return meanL; | |
1343 | if (returnVal==5) return meanD; | |
1344 | if (returnVal==6) return mean2; | |
1345 | if (returnVal==7) return mean3; | |
1346 | if (returnVal==8) return meanS; | |
83afd539 | 1347 | return mean; |
0a65832b | 1348 | } |
1349 | ||
83afd539 | 1350 | |
0a65832b | 1351 | |
1352 | ||
eb02f63a | 1353 | Float_t AliTPCseed::CookShape(Int_t type){ |
1354 | // | |
1355 | // | |
1356 | // | |
1357 | //----------------------------------------------------------------- | |
1358 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
1359 | //----------------------------------------------------------------- | |
1360 | Float_t means=0; | |
1361 | Float_t meanc=0; | |
1362 | for (Int_t i =0; i<160;i++) { | |
1363 | AliTPCTrackerPoint * point = GetTrackPoint(i); | |
1364 | if (point==0) continue; | |
1365 | ||
1366 | AliTPCclusterMI * cl = fClusterPointer[i]; | |
1367 | if (cl==0) continue; | |
1368 | ||
1369 | Float_t rsigmay = TMath::Sqrt(point->GetSigmaY()); | |
1370 | Float_t rsigmaz = TMath::Sqrt(point->GetSigmaZ()); | |
1371 | Float_t rsigma = (rsigmay+rsigmaz)*0.5; | |
1372 | if (type==0) means+=rsigma; | |
1373 | if (type==1) means+=rsigmay; | |
1374 | if (type==2) means+=rsigmaz; | |
1375 | meanc++; | |
1376 | } | |
1377 | Float_t mean = (meanc>0)? means/meanc:0; | |
1378 | return mean; | |
1379 | } | |
87e92a27 | 1380 | |
1381 | ||
1382 | ||
1383 | Int_t AliTPCseed::RefitTrack(AliTPCseed *seed, AliExternalTrackParam * parin, AliExternalTrackParam * parout){ | |
1384 | // | |
1385 | // Refit the track | |
1386 | // return value - number of used clusters | |
1387 | // | |
1388 | // | |
1389 | const Int_t kMinNcl =10; | |
1390 | AliTPCseed *track=new AliTPCseed(*seed); | |
1391 | Int_t sector=-1; | |
1392 | // reset covariance | |
1393 | // | |
1394 | Double_t covar[15]; | |
1395 | for (Int_t i=0;i<15;i++) covar[i]=0; | |
1396 | covar[0]=10.*10.; | |
1397 | covar[2]=10.*10.; | |
1398 | covar[5]=10.*10./(64.*64.); | |
1399 | covar[9]=10.*10./(64.*64.); | |
1400 | covar[14]=1*1; | |
1401 | // | |
1402 | ||
1403 | Float_t xmin=1000, xmax=-10000; | |
1404 | Int_t imin=158, imax=0; | |
1405 | for (Int_t i=0;i<160;i++) { | |
1406 | AliTPCclusterMI *c=track->GetClusterPointer(i); | |
1407 | if (!c) continue; | |
1408 | if (sector<0) sector = c->GetDetector(); | |
1409 | if (c->GetX()<xmin) xmin=c->GetX(); | |
1410 | if (c->GetX()>xmax) xmax=c->GetX(); | |
1411 | if (i<imin) imin=i; | |
1412 | if (i>imax) imax=i; | |
1413 | } | |
1414 | if(imax-imin<kMinNcl) { | |
1415 | delete track; | |
1416 | return 0 ; | |
1417 | } | |
1418 | // Not succes to rotate | |
1419 | if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) { | |
1420 | delete track; | |
1421 | return 0; | |
1422 | } | |
1423 | // | |
1424 | // | |
1425 | // fit from inner to outer row | |
1426 | // | |
1427 | AliExternalTrackParam paramIn; | |
1428 | AliExternalTrackParam paramOut; | |
1429 | Bool_t isOK=kTRUE; | |
be34cb88 | 1430 | Int_t ncl=0; |
87e92a27 | 1431 | // |
1432 | // | |
1433 | // | |
1434 | for (Int_t i=imin; i<=imax; i++){ | |
1435 | AliTPCclusterMI *c=track->GetClusterPointer(i); | |
1436 | if (!c) continue; | |
1437 | // if (RejectCluster(c,track)) continue; | |
be34cb88 | 1438 | sector = (c->GetDetector()%18); |
1439 | if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) { | |
1440 | //continue; | |
1441 | } | |
87e92a27 | 1442 | Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()}; |
1443 | Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation | |
1444 | if (!track->PropagateTo(r[0])) { | |
1445 | isOK=kFALSE; | |
87e92a27 | 1446 | } |
1447 | if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE; | |
1448 | } | |
1449 | if (!isOK) { delete track; return 0;} | |
1450 | track->AddCovariance(covar); | |
1451 | // | |
1452 | // | |
1453 | // | |
1454 | for (Int_t i=imax; i>=imin; i--){ | |
1455 | AliTPCclusterMI *c=track->GetClusterPointer(i); | |
1456 | if (!c) continue; | |
1457 | //if (RejectCluster(c,track)) continue; | |
be34cb88 | 1458 | sector = (c->GetDetector()%18); |
1459 | if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) { | |
1460 | //continue; | |
1461 | } | |
87e92a27 | 1462 | Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()}; |
1463 | Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation | |
1464 | if (!track->PropagateTo(r[0])) { | |
1465 | isOK=kFALSE; | |
87e92a27 | 1466 | } |
1467 | if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE; | |
1468 | } | |
be34cb88 | 1469 | //if (!isOK) { delete track; return 0;} |
87e92a27 | 1470 | paramIn = *track; |
1471 | track->AddCovariance(covar); | |
1472 | // | |
1473 | // | |
1474 | for (Int_t i=imin; i<=imax; i++){ | |
1475 | AliTPCclusterMI *c=track->GetClusterPointer(i); | |
1476 | if (!c) continue; | |
be34cb88 | 1477 | sector = (c->GetDetector()%18); |
1478 | if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) { | |
1479 | //continue; | |
1480 | } | |
1481 | ncl++; | |
87e92a27 | 1482 | //if (RejectCluster(c,track)) continue; |
1483 | Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()}; | |
1484 | Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation | |
1485 | if (!track->PropagateTo(r[0])) { | |
1486 | isOK=kFALSE; | |
87e92a27 | 1487 | } |
1488 | if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE; | |
1489 | } | |
be34cb88 | 1490 | //if (!isOK) { delete track; return 0;} |
87e92a27 | 1491 | paramOut=*track; |
87e92a27 | 1492 | // |
1493 | // | |
1494 | // | |
1495 | if (parin) (*parin)=paramIn; | |
1496 | if (parout) (*parout)=paramOut; | |
6e23caff | 1497 | delete track; |
be34cb88 | 1498 | return ncl; |
87e92a27 | 1499 | } |
1500 | ||
1501 | ||
1502 | ||
1503 | Bool_t AliTPCseed::RefitTrack(AliTPCseed* /*seed*/, Bool_t /*out*/){ | |
1504 | // | |
1505 | // | |
1506 | // | |
1507 | return kFALSE; | |
1508 | } | |
3247d397 | 1509 | |
1510 | ||
1511 | ||
1512 | ||
1513 | ||
1514 | ||
1515 | void AliTPCseed::GetError(AliTPCclusterMI* cluster, AliExternalTrackParam * param, | |
1516 | Double_t& erry, Double_t &errz) | |
1517 | { | |
1518 | // | |
1519 | // Get cluster error at given position | |
1520 | // | |
1521 | AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam(); | |
1522 | Double_t tany,tanz; | |
1523 | Double_t snp1=param->GetSnp(); | |
60e55aee | 1524 | tany=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1)); |
3247d397 | 1525 | // |
1526 | Double_t tgl1=param->GetTgl(); | |
60e55aee | 1527 | tanz=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1)); |
3247d397 | 1528 | // |
1529 | Int_t padSize = 0; // short pads | |
1530 | if (cluster->GetDetector() >= 36) { | |
1531 | padSize = 1; // medium pads | |
1532 | if (cluster->GetRow() > 63) padSize = 2; // long pads | |
1533 | } | |
1534 | ||
1535 | erry = clusterParam->GetError0Par( 0, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tany) ); | |
1536 | errz = clusterParam->GetError0Par( 1, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tanz) ); | |
1537 | } | |
1538 | ||
1539 | ||
1540 | void AliTPCseed::GetShape(AliTPCclusterMI* cluster, AliExternalTrackParam * param, | |
1541 | Double_t& rmsy, Double_t &rmsz) | |
1542 | { | |
1543 | // | |
1544 | // Get cluster error at given position | |
1545 | // | |
1546 | AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam(); | |
1547 | Double_t tany,tanz; | |
1548 | Double_t snp1=param->GetSnp(); | |
60e55aee | 1549 | tany=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1)); |
3247d397 | 1550 | // |
1551 | Double_t tgl1=param->GetTgl(); | |
60e55aee | 1552 | tanz=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1)); |
3247d397 | 1553 | // |
1554 | Int_t padSize = 0; // short pads | |
1555 | if (cluster->GetDetector() >= 36) { | |
1556 | padSize = 1; // medium pads | |
1557 | if (cluster->GetRow() > 63) padSize = 2; // long pads | |
1558 | } | |
1559 | ||
1560 | rmsy = clusterParam->GetRMSQ( 0, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tany), TMath::Abs(cluster->GetMax()) ); | |
1561 | rmsz = clusterParam->GetRMSQ( 1, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tanz) ,TMath::Abs(cluster->GetMax())); | |
1562 | } | |
ba5e52fb | 1563 | |
1564 | ||
1565 | ||
1566 | Double_t AliTPCseed::GetQCorrGeom(Float_t ty, Float_t tz){ | |
1567 | //Geoetrical | |
1568 | //ty - tangent in local y direction | |
1569 | //tz - tangent | |
1570 | // | |
1571 | Float_t norm=TMath::Sqrt(1+ty*ty+tz*tz); | |
1572 | return norm; | |
1573 | } | |
1574 | ||
83afd539 | 1575 | Double_t AliTPCseed::GetQCorrShape(Int_t ipad, Int_t type,Float_t z, Float_t ty, Float_t tz, Float_t /*q*/, Float_t /*thr*/){ |
ba5e52fb | 1576 | // |
1577 | // Q normalization | |
1578 | // | |
1579 | // return value = Q Normalization factor | |
1580 | // Normalization - 1 - shape factor part for full drift | |
1581 | // 1 - electron attachment for 0 drift | |
1582 | ||
1583 | // Input parameters: | |
1584 | // | |
1585 | // ipad - 0 short pad | |
1586 | // 1 medium pad | |
1587 | // 2 long pad | |
1588 | // | |
1589 | // type - 0 qmax | |
1590 | // - 1 qtot | |
1591 | // | |
1592 | //z - z position (-250,250 cm) | |
1593 | //ty - tangent in local y direction | |
1594 | //tz - tangent | |
1595 | // | |
1596 | ||
1597 | AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam(); | |
1598 | AliTPCParam * paramTPC = AliTPCcalibDB::Instance()->GetParameters(); | |
1599 | ||
1600 | if (!paramCl) return 1; | |
1601 | // | |
1602 | Double_t dr = 250.-TMath::Abs(z); | |
1603 | Double_t sy = paramCl->GetRMS0( 0,ipad, dr, TMath::Abs(ty)); | |
1604 | Double_t sy0= paramCl->GetRMS0(0,ipad, 250, 0); | |
1605 | Double_t sz = paramCl->GetRMS0( 1,ipad, dr, TMath::Abs(tz)); | |
1606 | Double_t sz0= paramCl->GetRMS0(1,ipad, 250, 0); | |
1607 | ||
1608 | Double_t sfactorMax = TMath::Sqrt(sy0*sz0/(sy*sz)); | |
1609 | ||
1610 | ||
1611 | Double_t dt = 1000000*(dr/paramTPC->GetDriftV()); //time in microsecond | |
1612 | Double_t attProb = TMath::Exp(-paramTPC->GetAttCoef()*paramTPC->GetOxyCont()*dt); | |
1613 | // | |
1614 | // | |
1615 | if (type==0) return sfactorMax*attProb; | |
1616 | ||
1617 | return attProb; | |
1618 | ||
1619 | ||
1620 | } | |
1621 | ||
64bf5ca0 | 1622 | |
1623 | //_______________________________________________________________________ | |
1624 | Float_t AliTPCseed::GetTPCClustInfo(Int_t nNeighbours, Int_t type, Int_t row0, Int_t row1) | |
1625 | { | |
1626 | // | |
1627 | // TPC cluster information | |
1628 | // type 0: get fraction of found/findable clusters with neighbourhood definition | |
1629 | // 1: found clusters | |
1630 | // 2: findable (number of clusters above and below threshold) | |
1631 | // | |
1632 | // definition of findable clusters: | |
1633 | // a cluster is defined as findable if there is another cluster | |
1634 | // within +- nNeighbours pad rows. The idea is to overcome threshold | |
1635 | // effects with a very simple algorithm. | |
1636 | // | |
1637 | ||
1638 | const Float_t kClusterShapeCut = 1.5; // IMPPRTANT TO DO: move value to AliTPCRecoParam | |
1639 | const Float_t ktany = TMath::Tan(TMath::DegToRad()*10); | |
1640 | const Float_t kedgey =3.; | |
1641 | ||
1642 | Float_t ncl = 0; | |
1643 | Float_t nclBelowThr = 0; // counts number of clusters below threshold | |
1644 | ||
1645 | for (Int_t irow=row0; irow<row1; irow++){ | |
1646 | AliTPCclusterMI* cluster = GetClusterPointer(irow); | |
1647 | ||
1648 | if (!cluster && irow > 1 && irow < 157) { | |
1649 | Bool_t isClBefore = kFALSE; | |
1650 | Bool_t isClAfter = kFALSE; | |
1651 | for(Int_t ithres = 1; ithres <= nNeighbours; ithres++) { | |
1652 | AliTPCclusterMI * clusterBefore = GetClusterPointer(irow - ithres); | |
1653 | if (clusterBefore) isClBefore = kTRUE; | |
1654 | AliTPCclusterMI * clusterAfter = GetClusterPointer(irow + ithres); | |
1655 | if (clusterAfter) isClAfter = kTRUE; | |
1656 | } | |
1657 | if (isClBefore && isClAfter) nclBelowThr++; | |
1658 | } | |
1659 | if (!cluster) continue; | |
1660 | // | |
1661 | // | |
1662 | if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster | |
1663 | // | |
1664 | AliTPCTrackerPoint * point = GetTrackPoint(irow); | |
1665 | if (point==0) continue; | |
1666 | Float_t rsigmay = TMath::Sqrt(point->GetSigmaY()); | |
1667 | if (rsigmay > kClusterShapeCut) continue; | |
1668 | // | |
1669 | if (cluster->IsUsed(11)) continue; // remove shared clusters for PbPb | |
1670 | ncl++; | |
1671 | } | |
1672 | ||
1673 | if(ncl<10) | |
1674 | return 0; | |
1675 | if(type==0) | |
1676 | if(nclBelowThr+ncl>0) | |
1677 | return ncl/(nclBelowThr+ncl); | |
1678 | if(type==1) | |
1679 | return ncl; | |
1680 | if(type==2) | |
1681 | return ncl+nclBelowThr; | |
1682 | return 0; | |
1683 | } |