]>
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); | |
83afd539 | 579 | // |
2cadb5d1 | 580 | fSDEDX[0] = CookdEdxAnalytical(low,up,useTot ,i1 ,i2, 1); |
581 | fSDEDX[1] = CookdEdxAnalytical(low,up,useTot ,0 ,row0, 1); | |
582 | fSDEDX[2] = CookdEdxAnalytical(low,up,useTot ,row0,row1, 1); | |
583 | fSDEDX[3] = CookdEdxAnalytical(low,up,useTot ,row1,row2, 1); | |
83afd539 | 584 | // |
2cadb5d1 | 585 | fNCDEDX[0] = TMath::Nint(CookdEdxAnalytical(low,up,useTot ,i1 ,i2, 2)); |
586 | fNCDEDX[1] = TMath::Nint(CookdEdxAnalytical(low,up,useTot ,0 ,row0, 2)); | |
587 | fNCDEDX[2] = TMath::Nint(CookdEdxAnalytical(low,up,useTot ,row0,row1, 2)); | |
588 | fNCDEDX[3] = TMath::Nint(CookdEdxAnalytical(low,up,useTot ,row1,row2, 2)); | |
81e97e0d | 589 | |
83afd539 | 590 | SetdEdx(fDEDX[0]); |
591 | return fDEDX[0]; | |
81e97e0d | 592 | |
ba5e52fb | 593 | // return CookdEdxNorm(low,up,0,i1,i2,1,0,2); |
4cc7ba77 | 594 | |
595 | ||
ba5e52fb | 596 | // Float_t amp[200]; |
597 | // Float_t angular[200]; | |
598 | // Float_t weight[200]; | |
599 | // Int_t index[200]; | |
600 | // //Int_t nc = 0; | |
601 | // Float_t meanlog = 100.; | |
602 | ||
603 | // Float_t mean[4] = {0,0,0,0}; | |
604 | // Float_t sigma[4] = {1000,1000,1000,1000}; | |
605 | // Int_t nc[4] = {0,0,0,0}; | |
606 | // Float_t norm[4] = {1000,1000,1000,1000}; | |
607 | // // | |
608 | // // | |
609 | // fNShared =0; | |
610 | ||
611 | // Float_t gainGG = 1; | |
612 | // if (AliTPCcalibDB::Instance()->GetParameters()){ | |
613 | // gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000.; //relative gas gain | |
614 | // } | |
615 | ||
616 | ||
617 | // for (Int_t of =0; of<4; of++){ | |
618 | // for (Int_t i=of+i1;i<i2;i+=4) | |
619 | // { | |
620 | // Int_t clindex = fIndex[i]; | |
621 | // if (clindex<0||clindex&0x8000) continue; | |
622 | ||
623 | // //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i); | |
624 | // AliTPCTrackerPoint * point = GetTrackPoint(i); | |
625 | // //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1); | |
626 | // //AliTPCTrackerPoint * pointp = 0; | |
627 | // //if (i<159) pointp = GetTrackPoint(i+1); | |
628 | ||
629 | // if (point==0) continue; | |
630 | // AliTPCclusterMI * cl = fClusterPointer[i]; | |
631 | // if (cl==0) continue; | |
632 | // if (onlyused && (!cl->IsUsed(10))) continue; | |
633 | // if (cl->IsUsed(11)) { | |
634 | // fNShared++; | |
635 | // continue; | |
636 | // } | |
637 | // Int_t type = cl->GetType(); | |
638 | // //if (point->fIsShared){ | |
639 | // // fNShared++; | |
640 | // // continue; | |
641 | // //} | |
642 | // //if (pointm) | |
643 | // // if (pointm->fIsShared) continue; | |
644 | // //if (pointp) | |
645 | // // if (pointp->fIsShared) continue; | |
646 | ||
647 | // if (type<0) continue; | |
648 | // //if (type>10) continue; | |
649 | // //if (point->GetErrY()==0) continue; | |
650 | // //if (point->GetErrZ()==0) continue; | |
651 | ||
652 | // //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY(); | |
653 | // //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ(); | |
654 | // //if ((ddy*ddy+ddz*ddz)>10) continue; | |
655 | ||
656 | ||
657 | // // if (point->GetCPoint().GetMax()<5) continue; | |
658 | // if (cl->GetMax()<5) continue; | |
659 | // Float_t angley = point->GetAngleY(); | |
660 | // Float_t anglez = point->GetAngleZ(); | |
661 | ||
662 | // Float_t rsigmay2 = point->GetSigmaY(); | |
663 | // Float_t rsigmaz2 = point->GetSigmaZ(); | |
664 | // /* | |
665 | // Float_t ns = 1.; | |
666 | // if (pointm){ | |
667 | // rsigmay += pointm->GetTPoint().GetSigmaY(); | |
668 | // rsigmaz += pointm->GetTPoint().GetSigmaZ(); | |
669 | // ns+=1.; | |
670 | // } | |
671 | // if (pointp){ | |
672 | // rsigmay += pointp->GetTPoint().GetSigmaY(); | |
673 | // rsigmaz += pointp->GetTPoint().GetSigmaZ(); | |
674 | // ns+=1.; | |
675 | // } | |
676 | // rsigmay/=ns; | |
677 | // rsigmaz/=ns; | |
678 | // */ | |
679 | ||
680 | // Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2); | |
681 | ||
682 | // Float_t ampc = 0; // normalization to the number of electrons | |
683 | // if (i>64){ | |
684 | // // ampc = 1.*point->GetCPoint().GetMax(); | |
685 | // ampc = 1.*cl->GetMax(); | |
686 | // //ampc = 1.*point->GetCPoint().GetQ(); | |
687 | // // AliTPCClusterPoint & p = point->GetCPoint(); | |
688 | // // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5); | |
689 | // // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
690 | // //Float_t dz = | |
691 | // // TMath::Abs( Int_t(iz) - iz + 0.5); | |
692 | // //ampc *= 1.15*(1-0.3*dy); | |
693 | // //ampc *= 1.15*(1-0.3*dz); | |
694 | // // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ())); | |
695 | // //ampc *=zfactor; | |
696 | // } | |
697 | // else{ | |
698 | // //ampc = 1.0*point->GetCPoint().GetMax(); | |
699 | // ampc = 1.0*cl->GetMax(); | |
700 | // //ampc = 1.0*point->GetCPoint().GetQ(); | |
701 | // //AliTPCClusterPoint & p = point->GetCPoint(); | |
702 | // // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5); | |
703 | // //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
704 | // //Float_t dz = | |
705 | // // TMath::Abs( Int_t(iz) - iz + 0.5); | |
706 | ||
707 | // //ampc *= 1.15*(1-0.3*dy); | |
708 | // //ampc *= 1.15*(1-0.3*dz); | |
709 | // // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ())); | |
710 | // //ampc *=zfactor; | |
711 | ||
712 | // } | |
713 | // ampc *= 2.0; // put mean value to channel 50 | |
714 | // //ampc *= 0.58; // put mean value to channel 50 | |
715 | // Float_t w = 1.; | |
716 | // // if (type>0) w = 1./(type/2.-0.5); | |
717 | // // Float_t z = TMath::Abs(cl->GetZ()); | |
718 | // if (i<64) { | |
719 | // ampc /= 0.6; | |
720 | // //ampc /= (1+0.0008*z); | |
721 | // } else | |
722 | // if (i>128){ | |
723 | // ampc /=1.5; | |
724 | // //ampc /= (1+0.0008*z); | |
725 | // }else{ | |
726 | // //ampc /= (1+0.0008*z); | |
727 | // } | |
81e97e0d | 728 | |
ba5e52fb | 729 | // if (type<0) { //amp at the border - lower weight |
730 | // // w*= 2.; | |
81e97e0d | 731 | |
ba5e52fb | 732 | // continue; |
733 | // } | |
734 | // if (rsigma>1.5) ampc/=1.3; // if big backround | |
735 | // amp[nc[of]] = ampc; | |
736 | // amp[nc[of]] /=gainGG; | |
737 | // angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez); | |
738 | // weight[nc[of]] = w; | |
739 | // nc[of]++; | |
740 | // } | |
81e97e0d | 741 | |
ba5e52fb | 742 | // TMath::Sort(nc[of],amp,index,kFALSE); |
743 | // Float_t sumamp=0; | |
744 | // Float_t sumamp2=0; | |
745 | // Float_t sumw=0; | |
746 | // //meanlog = amp[index[Int_t(nc[of]*0.33)]]; | |
747 | // meanlog = 50; | |
748 | // for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){ | |
749 | // Float_t ampl = amp[index[i]]/angular[index[i]]; | |
750 | // ampl = meanlog*TMath::Log(1.+ampl/meanlog); | |
751 | // // | |
752 | // sumw += weight[index[i]]; | |
753 | // sumamp += weight[index[i]]*ampl; | |
754 | // sumamp2 += weight[index[i]]*ampl*ampl; | |
755 | // norm[of] += angular[index[i]]*weight[index[i]]; | |
756 | // } | |
757 | // if (sumw<1){ | |
758 | // SetdEdx(0); | |
759 | // } | |
760 | // else { | |
761 | // norm[of] /= sumw; | |
762 | // mean[of] = sumamp/sumw; | |
763 | // sigma[of] = sumamp2/sumw-mean[of]*mean[of]; | |
764 | // if (sigma[of]>0.1) | |
765 | // sigma[of] = TMath::Sqrt(sigma[of]); | |
766 | // else | |
767 | // sigma[of] = 1000; | |
81e97e0d | 768 | |
ba5e52fb | 769 | // mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog; |
770 | // //mean *=(1-0.02*(sigma/(mean*0.17)-1.)); | |
771 | // //mean *=(1-0.1*(norm-1.)); | |
772 | // } | |
773 | // } | |
774 | ||
775 | // Float_t dedx =0; | |
776 | // fSdEdx =0; | |
777 | // fMAngular =0; | |
778 | // // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1)); | |
779 | // // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1)); | |
81e97e0d | 780 | |
781 | ||
ba5e52fb | 782 | // // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/ |
783 | // // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1]))); | |
784 | ||
785 | // Int_t norm2 = 0; | |
786 | // Int_t norm3 = 0; | |
787 | // for (Int_t i =0;i<4;i++){ | |
788 | // if (nc[i]>2&&nc[i]<1000){ | |
789 | // dedx += mean[i] *nc[i]; | |
790 | // fSdEdx += sigma[i]*(nc[i]-2); | |
791 | // fMAngular += norm[i] *nc[i]; | |
792 | // norm2 += nc[i]; | |
793 | // norm3 += nc[i]-2; | |
794 | // } | |
795 | // fDEDX[i] = mean[i]; | |
796 | // fSDEDX[i] = sigma[i]; | |
797 | // fNCDEDX[i]= nc[i]; | |
798 | // } | |
799 | ||
800 | // if (norm3>0){ | |
801 | // dedx /=norm2; | |
802 | // fSdEdx /=norm3; | |
803 | // fMAngular/=norm2; | |
804 | // } | |
805 | // else{ | |
806 | // SetdEdx(0); | |
807 | // return 0; | |
808 | // } | |
809 | // // Float_t dedx1 =dedx; | |
810 | // /* | |
811 | // dedx =0; | |
812 | // for (Int_t i =0;i<4;i++){ | |
813 | // if (nc[i]>2&&nc[i]<1000){ | |
814 | // mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.)); | |
815 | // dedx += mean[i] *nc[i]; | |
816 | // } | |
817 | // fDEDX[i] = mean[i]; | |
818 | // } | |
819 | // dedx /= norm2; | |
820 | // */ | |
81e97e0d | 821 | |
822 | ||
ba5e52fb | 823 | // SetdEdx(dedx); |
824 | // return dedx; | |
81e97e0d | 825 | } |
81e97e0d | 826 | |
827 | void AliTPCseed::CookPID() | |
828 | { | |
829 | // | |
830 | // cook PID information according dEdx | |
831 | // | |
832 | Double_t fRange = 10.; | |
833 | Double_t fRes = 0.1; | |
834 | Double_t fMIP = 47.; | |
835 | // | |
836 | Int_t ns=AliPID::kSPECIES; | |
837 | Double_t sumr =0; | |
838 | for (Int_t j=0; j<ns; j++) { | |
839 | Double_t mass=AliPID::ParticleMass(j); | |
6c94f330 | 840 | Double_t mom=GetP(); |
81e97e0d | 841 | Double_t dedx=fdEdx/fMIP; |
5731b051 | 842 | Double_t bethe=AliMathBase::BetheBlochAleph(mom/mass); |
81e97e0d | 843 | Double_t sigma=fRes*bethe; |
844 | if (sigma>0.001){ | |
845 | if (TMath::Abs(dedx-bethe) > fRange*sigma) { | |
846 | fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma; | |
847 | sumr+=fTPCr[j]; | |
848 | continue; | |
849 | } | |
850 | fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma; | |
851 | sumr+=fTPCr[j]; | |
852 | } | |
853 | else{ | |
854 | fTPCr[j]=1.; | |
855 | sumr+=fTPCr[j]; | |
856 | } | |
857 | } | |
858 | for (Int_t j=0; j<ns; j++) { | |
859 | fTPCr[j]/=sumr; //normalize | |
860 | } | |
861 | } | |
862 | ||
6c94f330 | 863 | Double_t AliTPCseed::GetYat(Double_t xk) const { |
864 | //----------------------------------------------------------------- | |
865 | // This function calculates the Y-coordinate of a track at the plane x=xk. | |
866 | //----------------------------------------------------------------- | |
867 | if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06 | |
60e55aee | 868 | Double_t c1=GetSnp(), r1=TMath::Sqrt((1.-c1)*(1.+c1)); |
6c94f330 | 869 | Double_t c2=c1+GetC()*(xk-GetX()); |
870 | if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0; | |
60e55aee | 871 | Double_t r2=TMath::Sqrt((1.-c2)*(1.+c2)); |
6c94f330 | 872 | return GetY() + (xk-GetX())*(c1+c2)/(r1+r2); |
873 | } | |
874 | ||
0a65832b | 875 | |
876 | ||
8a92e133 | 877 | 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 | 878 | |
879 | // | |
880 | // calculates dedx using the cluster | |
881 | // low - up specify trunc mean range - default form 0-0.7 | |
8076baa0 | 882 | // type - 1 - max charge or 0- total charge in cluster |
883 | // //2- max no corr 3- total+ correction | |
0a65832b | 884 | // i1-i2 - the pad-row range used for calculation |
ba5e52fb | 885 | // shapeNorm - kTRUE -taken from OCDB |
886 | // | |
887 | // posNorm - usage of pos normalization | |
83afd539 | 888 | // padNorm - pad type normalization |
889 | // returnVal - 0 return mean | |
890 | // - 1 return RMS | |
891 | // - 2 return number of clusters | |
892 | // | |
0a65832b | 893 | // normalization parametrization taken from AliTPCClusterParam |
894 | // | |
ba5e52fb | 895 | AliTPCClusterParam * parcl = AliTPCcalibDB::Instance()->GetClusterParam(); |
896 | AliTPCParam * param = AliTPCcalibDB::Instance()->GetParameters(); | |
897 | if (!parcl) return 0; | |
898 | if (!param) return 0; | |
83afd539 | 899 | Int_t row0 = param->GetNRowLow(); |
900 | Int_t row1 = row0+param->GetNRowUp1(); | |
901 | ||
0a65832b | 902 | Float_t amp[160]; |
903 | Int_t indexes[160]; | |
904 | Int_t ncl=0; | |
905 | // | |
906 | // | |
ba5e52fb | 907 | Float_t gainGG = 1; // gas gain factor -always enabled |
908 | Float_t gainPad = 1; // gain map - used always | |
83afd539 | 909 | Float_t corrShape = 1; // correction due angular effect, diffusion and electron attachment |
ba5e52fb | 910 | Float_t corrPos = 1; // local position correction - if posNorm enabled |
911 | Float_t corrPadType = 1; // pad type correction - if padNorm enabled | |
912 | Float_t corrNorm = 1; // normalization factor - set Q to channel 50 | |
913 | // | |
914 | // | |
915 | // | |
4cc7ba77 | 916 | if (AliTPCcalibDB::Instance()->GetParameters()){ |
ba5e52fb | 917 | gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000; //relative gas gain |
4cc7ba77 | 918 | } |
919 | ||
0a65832b | 920 | const Float_t ktany = TMath::Tan(TMath::DegToRad()*10); |
4cc7ba77 | 921 | const Float_t kedgey =3.; |
0a65832b | 922 | // |
7cd8ac3f | 923 | // |
0a65832b | 924 | for (Int_t irow=i1; irow<i2; irow++){ |
925 | AliTPCclusterMI* cluster = GetClusterPointer(irow); | |
926 | if (!cluster) continue; | |
927 | if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster | |
8076baa0 | 928 | Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ(); |
ba5e52fb | 929 | Int_t ipad= 0; |
83afd539 | 930 | if (irow>=row0) ipad=1; |
931 | if (irow>=row1) ipad=2; | |
ba5e52fb | 932 | // |
933 | // | |
934 | // | |
935 | AliTPCCalPad * gainMap = AliTPCcalibDB::Instance()->GetDedxGainFactor(); | |
936 | if (gainMap) { | |
937 | // | |
938 | // Get gainPad - pad by pad calibration | |
939 | // | |
d6920632 | 940 | Float_t factor = 1; |
941 | AliTPCCalROC * roc = gainMap->GetCalROC(cluster->GetDetector()); | |
83afd539 | 942 | if (irow < row0) { // IROC |
ba5e52fb | 943 | factor = roc->GetValue(irow, TMath::Nint(cluster->GetPad())); |
d6920632 | 944 | } else { // OROC |
83afd539 | 945 | factor = roc->GetValue(irow - row0, TMath::Nint(cluster->GetPad())); |
d6920632 | 946 | } |
ba5e52fb | 947 | if (factor>0.5) gainPad=factor; |
7cd8ac3f | 948 | } |
ba5e52fb | 949 | // |
950 | //do position and angular normalization | |
951 | // | |
952 | if (shapeNorm){ | |
953 | if (type<=1){ | |
954 | // | |
955 | AliTPCTrackerPoint * point = GetTrackPoint(irow); | |
956 | Float_t ty = TMath::Abs(point->GetAngleY()); | |
83afd539 | 957 | Float_t tz = TMath::Abs(point->GetAngleZ()*TMath::Sqrt(1+ty*ty)); |
ba5e52fb | 958 | |
959 | Float_t dr = (250.-TMath::Abs(cluster->GetZ()))/250.; | |
960 | corrShape = parcl->Qnorm(ipad,type,dr,ty,tz); | |
961 | } | |
0a65832b | 962 | } |
ba5e52fb | 963 | |
8a92e133 | 964 | if (posNorm>0){ |
8e1dcdda | 965 | // |
ba5e52fb | 966 | // Do position normalization - relative distance to |
967 | // center of pad- time bin | |
968 | // Work in progress | |
022a2383 | 969 | // corrPos = parcl->QnormPos(ipad,type, cluster->GetPad(), |
970 | // cluster->GetTimeBin(), cluster->GetZ(), | |
971 | // cluster->GetSigmaY2(),cluster->GetSigmaZ2(), | |
972 | // cluster->GetMax(),cluster->GetQ()); | |
8a92e133 | 973 | // scaled response function |
974 | Float_t yres0 = parcl->GetRMS0(0,ipad,0,0)/param->GetPadPitchWidth(cluster->GetDetector()); | |
975 | Float_t zres0 = parcl->GetRMS0(1,ipad,0,0)/param->GetZWidth(); | |
976 | // | |
977 | ||
022a2383 | 978 | AliTPCTrackerPoint * point = GetTrackPoint(irow); |
979 | Float_t ty = TMath::Abs(point->GetAngleY()); | |
980 | Float_t tz = TMath::Abs(point->GetAngleZ()*TMath::Sqrt(1+ty*ty)); | |
981 | ||
982 | if (type==1) corrPos = | |
983 | parcl->QmaxCorrection(cluster->GetDetector(), cluster->GetRow(),cluster->GetPad(), | |
8a92e133 | 984 | cluster->GetTimeBin(),ty,tz,yres0,zres0,0.4); |
022a2383 | 985 | if (type==0) corrPos = |
986 | parcl->QtotCorrection(cluster->GetDetector(), cluster->GetRow(),cluster->GetPad(), | |
8a92e133 | 987 | cluster->GetTimeBin(),ty,tz,yres0,zres0,cluster->GetQ(),2.5,0.4); |
988 | if (posNorm==3){ | |
989 | Float_t dr = (250.-TMath::Abs(cluster->GetZ()))/250.; | |
990 | Double_t signtgl = (cluster->GetZ()*point->GetAngleZ()>0)? 1:-1; | |
991 | Double_t p2 = TMath::Abs(TMath::Sin(TMath::ATan(ty))); | |
992 | Float_t corrHis = parcl->QnormHis(ipad,type,dr,p2,TMath::Abs(point->GetAngleZ())*signtgl); | |
993 | if (corrHis>0) corrPos*=corrHis; | |
994 | } | |
995 | ||
8e1dcdda | 996 | } |
997 | ||
ba5e52fb | 998 | if (padNorm==1){ |
999 | //taken from OCDB | |
798017c7 | 1000 | if (type==0 && parcl->QpadTnorm()) corrPadType = (*parcl->QpadTnorm())[ipad]; |
1001 | if (type==1 && parcl->QpadMnorm()) corrPadType = (*parcl->QpadMnorm())[ipad]; | |
022a2383 | 1002 | |
2fc9608f | 1003 | } |
ba5e52fb | 1004 | if (padNorm==2){ |
1005 | corrPadType =param->GetPadPitchLength(cluster->GetDetector(),cluster->GetRow()); | |
1006 | //use hardwired - temp fix | |
1007 | if (type==0) corrNorm=3.; | |
1008 | if (type==1) corrNorm=1.; | |
1009 | } | |
1010 | // | |
1011 | amp[ncl]=charge; | |
1012 | amp[ncl]/=gainGG; | |
1013 | amp[ncl]/=gainPad; | |
1014 | amp[ncl]/=corrShape; | |
1015 | amp[ncl]/=corrPadType; | |
1016 | amp[ncl]/=corrPos; | |
1017 | amp[ncl]/=corrNorm; | |
1018 | // | |
0a65832b | 1019 | ncl++; |
1020 | } | |
8076baa0 | 1021 | |
0a65832b | 1022 | if (type>3) return ncl; |
1023 | TMath::Sort(ncl,amp, indexes, kFALSE); | |
1024 | ||
8076baa0 | 1025 | if (ncl<10) return 0; |
0a65832b | 1026 | |
1027 | Float_t suma=0; | |
83afd539 | 1028 | Float_t suma2=0; |
0a65832b | 1029 | Float_t sumn=0; |
1030 | Int_t icl0=TMath::Nint(ncl*low); | |
1031 | Int_t icl1=TMath::Nint(ncl*up); | |
1032 | for (Int_t icl=icl0; icl<icl1;icl++){ | |
1033 | suma+=amp[indexes[icl]]; | |
83afd539 | 1034 | suma2+=amp[indexes[icl]]*amp[indexes[icl]]; |
0a65832b | 1035 | sumn++; |
1036 | } | |
83afd539 | 1037 | Float_t mean =suma/sumn; |
1038 | Float_t rms =TMath::Sqrt(TMath::Abs(suma2/sumn-mean*mean)); | |
3af3fbc4 | 1039 | // |
1040 | // do time-dependent correction for pressure and temperature variations | |
1041 | UInt_t runNumber = 1; | |
1042 | Float_t corrTimeGain = 1; | |
1043 | AliTPCTransform * trans = AliTPCcalibDB::Instance()->GetTransform(); | |
e5e80ff9 | 1044 | const AliTPCRecoParam * recoParam = AliTPCcalibDB::Instance()->GetTransform()->GetCurrentRecoParam(); |
1045 | if (trans && recoParam->GetUseGainCorrectionTime()>0) { | |
3af3fbc4 | 1046 | runNumber = trans->GetCurrentRunNumber(); |
e5e80ff9 | 1047 | //AliTPCcalibDB::Instance()->SetRun(runNumber); |
a2c3785e | 1048 | TObjArray * timeGainSplines = AliTPCcalibDB::Instance()->GetTimeGainSplinesRun(runNumber); |
3af3fbc4 | 1049 | if (timeGainSplines) { |
1050 | UInt_t time = trans->GetCurrentTimeStamp(); | |
1051 | AliSplineFit * fitMIP = (AliSplineFit *) timeGainSplines->At(0); | |
1052 | AliSplineFit * fitFPcosmic = (AliSplineFit *) timeGainSplines->At(1); | |
1053 | if (fitMIP) { | |
108a67db | 1054 | corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitMIP, time);/*fitMIP->Eval(time);*/ |
3af3fbc4 | 1055 | } else { |
108a67db | 1056 | if (fitFPcosmic) corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitFPcosmic, time);/*fitFPcosmic->Eval(time);*/ |
3af3fbc4 | 1057 | } |
1058 | } | |
1059 | } | |
1060 | mean /= corrTimeGain; | |
1061 | rms /= corrTimeGain; | |
1062 | // | |
83afd539 | 1063 | if (returnVal==1) return rms; |
8a92e133 | 1064 | if (returnVal==2) return ncl; |
1065 | return mean; | |
1066 | } | |
1067 | ||
6feb400f | 1068 | 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 | 1069 | |
1070 | // | |
1071 | // calculates dedx using the cluster | |
1072 | // low - up specify trunc mean range - default form 0-0.7 | |
1073 | // type - 1 - max charge or 0- total charge in cluster | |
1074 | // //2- max no corr 3- total+ correction | |
1075 | // i1-i2 - the pad-row range used for calculation | |
1076 | // | |
1077 | // posNorm - usage of pos normalization | |
6feb400f | 1078 | // returnVal - 0 return mean |
1079 | // - 1 return RMS | |
1080 | // - 2 return number of clusters | |
1081 | // - 3 ratio | |
1082 | // - 4 mean upper half | |
1083 | // - 5 mean - lower half | |
1084 | // - 6 third moment | |
1085 | // mode - 0 - linear | |
1086 | // - 1 - logatithmic | |
2efc897f | 1087 | // rowThres - number of rows before and after given pad row to check for clusters below threshold |
8a92e133 | 1088 | // |
1089 | // normalization parametrization taken from AliTPCClusterParam | |
1090 | // | |
1091 | AliTPCClusterParam * parcl = AliTPCcalibDB::Instance()->GetClusterParam(); | |
1092 | AliTPCParam * param = AliTPCcalibDB::Instance()->GetParameters(); | |
1093 | if (!parcl) return 0; | |
1094 | if (!param) return 0; | |
1095 | Int_t row0 = param->GetNRowLow(); | |
1096 | Int_t row1 = row0+param->GetNRowUp1(); | |
1097 | ||
1098 | Float_t amp[160]; | |
1099 | Int_t indexes[160]; | |
1100 | Int_t ncl=0; | |
2efc897f | 1101 | Int_t nclBelowThr = 0; // counts number of clusters below threshold |
8a92e133 | 1102 | // |
1103 | // | |
1104 | Float_t gainGG = 1; // gas gain factor -always enabled | |
1105 | Float_t gainPad = 1; // gain map - used always | |
1106 | Float_t corrPos = 1; // local position correction - if posNorm enabled | |
8a92e133 | 1107 | // |
1108 | // | |
1109 | // | |
1110 | if (AliTPCcalibDB::Instance()->GetParameters()){ | |
1111 | gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000; //relative gas gain | |
1112 | } | |
649fcc43 | 1113 | // |
1114 | // extract time-dependent correction for pressure and temperature variations | |
1115 | // | |
1116 | UInt_t runNumber = 1; | |
1117 | Float_t corrTimeGain = 1; | |
1118 | TObjArray * timeGainSplines = 0x0; | |
1119 | TGraphErrors * grPadEqual = 0x0; | |
1120 | // | |
1121 | AliTPCTransform * trans = AliTPCcalibDB::Instance()->GetTransform(); | |
1122 | const AliTPCRecoParam * recoParam = AliTPCcalibDB::Instance()->GetTransform()->GetCurrentRecoParam(); | |
6d64657a | 1123 | // |
1124 | if (recoParam->GetNeighborRowsDedx() == 0) rowThres = 0; | |
1125 | // | |
649fcc43 | 1126 | if (trans) { |
2efc897f | 1127 | runNumber = trans->GetCurrentRunNumber(); |
1128 | //AliTPCcalibDB::Instance()->SetRun(runNumber); | |
1129 | timeGainSplines = AliTPCcalibDB::Instance()->GetTimeGainSplinesRun(runNumber); | |
1130 | if (timeGainSplines && recoParam->GetUseGainCorrectionTime()>0) { | |
1131 | UInt_t time = trans->GetCurrentTimeStamp(); | |
1132 | AliSplineFit * fitMIP = (AliSplineFit *) timeGainSplines->At(0); | |
1133 | AliSplineFit * fitFPcosmic = (AliSplineFit *) timeGainSplines->At(1); | |
1134 | if (fitMIP) { | |
1135 | corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitMIP, time); /*fitMIP->Eval(time);*/ | |
649fcc43 | 1136 | } else { |
2efc897f | 1137 | if (fitFPcosmic) corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitFPcosmic, time); /*fitFPcosmic->Eval(time); */ |
1138 | } | |
649fcc43 | 1139 | // |
1140 | if (type==1) grPadEqual = (TGraphErrors * ) timeGainSplines->FindObject("TGRAPHERRORS_MEANQMAX_PADREGIONGAIN_BEAM_ALL"); | |
1141 | if (type==0) grPadEqual = (TGraphErrors * ) timeGainSplines->FindObject("TGRAPHERRORS_MEANQTOT_PADREGIONGAIN_BEAM_ALL"); | |
2efc897f | 1142 | } |
649fcc43 | 1143 | } |
2efc897f | 1144 | |
1145 | const Float_t kClusterShapeCut = 1.5; // IMPPRTANT TO DO: move value to AliTPCRecoParam | |
8a92e133 | 1146 | const Float_t ktany = TMath::Tan(TMath::DegToRad()*10); |
1147 | const Float_t kedgey =3.; | |
1148 | // | |
1149 | // | |
1150 | for (Int_t irow=i1; irow<i2; irow++){ | |
1151 | AliTPCclusterMI* cluster = GetClusterPointer(irow); | |
736a5826 | 1152 | if (!cluster && irow > 1 && irow < 157) { |
2efc897f | 1153 | Bool_t isClBefore = kFALSE; |
1154 | Bool_t isClAfter = kFALSE; | |
1155 | for(Int_t ithres = 1; ithres <= rowThres; ithres++) { | |
1156 | AliTPCclusterMI * clusterBefore = GetClusterPointer(irow - ithres); | |
1157 | if (clusterBefore) isClBefore = kTRUE; | |
1158 | AliTPCclusterMI * clusterAfter = GetClusterPointer(irow + ithres); | |
1159 | if (clusterAfter) isClAfter = kTRUE; | |
1160 | } | |
1161 | if (isClBefore && isClAfter) nclBelowThr++; | |
2efc897f | 1162 | } |
736a5826 | 1163 | if (!cluster) continue; |
2efc897f | 1164 | // |
1165 | // | |
8a92e133 | 1166 | if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster |
2efc897f | 1167 | // |
1168 | AliTPCTrackerPoint * point = GetTrackPoint(irow); | |
1169 | if (point==0) continue; | |
1170 | Float_t rsigmay = TMath::Sqrt(point->GetSigmaY()); | |
1171 | if (rsigmay > kClusterShapeCut) continue; | |
1172 | // | |
1173 | if (cluster->IsUsed(11)) continue; // remove shared clusters for PbPb | |
1174 | // | |
8a92e133 | 1175 | Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ(); |
1176 | Int_t ipad= 0; | |
1177 | if (irow>=row0) ipad=1; | |
1178 | if (irow>=row1) ipad=2; | |
1179 | // | |
1180 | // | |
1181 | // | |
1182 | AliTPCCalPad * gainMap = AliTPCcalibDB::Instance()->GetDedxGainFactor(); | |
1183 | if (gainMap) { | |
1184 | // | |
1185 | // Get gainPad - pad by pad calibration | |
1186 | // | |
1187 | Float_t factor = 1; | |
1188 | AliTPCCalROC * roc = gainMap->GetCalROC(cluster->GetDetector()); | |
1189 | if (irow < row0) { // IROC | |
1190 | factor = roc->GetValue(irow, TMath::Nint(cluster->GetPad())); | |
1191 | } else { // OROC | |
1192 | factor = roc->GetValue(irow - row0, TMath::Nint(cluster->GetPad())); | |
1193 | } | |
2efc897f | 1194 | if (factor>0.3) gainPad=factor; |
8a92e133 | 1195 | } |
8a92e133 | 1196 | // |
1197 | // Do position normalization - relative distance to | |
1198 | // center of pad- time bin | |
1199 | ||
8a92e133 | 1200 | Float_t ty = TMath::Abs(point->GetAngleY()); |
1201 | Float_t tz = TMath::Abs(point->GetAngleZ()*TMath::Sqrt(1+ty*ty)); | |
1202 | Float_t yres0 = parcl->GetRMS0(0,ipad,0,0)/param->GetPadPitchWidth(cluster->GetDetector()); | |
1203 | Float_t zres0 = parcl->GetRMS0(1,ipad,0,0)/param->GetZWidth(); | |
1204 | ||
1205 | yres0 *=parcl->GetQnormCorr(ipad, type,0); | |
1206 | zres0 *=parcl->GetQnormCorr(ipad, type,1); | |
1207 | Float_t effLength=parcl->GetQnormCorr(ipad, type,4)*0.5; | |
1208 | Float_t effDiff =(parcl->GetQnormCorr(ipad, type,2)+parcl->GetQnormCorr(ipad, type,3))*0.5; | |
1209 | // | |
1210 | if (type==1) { | |
1211 | corrPos = parcl->GetQnormCorr(ipad, type,5)* | |
1212 | parcl->QmaxCorrection(cluster->GetDetector(), cluster->GetRow(),cluster->GetPad(), | |
1213 | cluster->GetTimeBin(),ty,tz,yres0,zres0,effLength,effDiff); | |
1214 | Float_t drm = 0.5-TMath::Abs(cluster->GetZ()/250.); | |
1215 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,0)*drm); | |
1216 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,1)*ty*ty); | |
1217 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,2)*tz*tz); | |
1218 | // | |
1219 | } | |
1220 | if (type==0) { | |
1221 | corrPos = parcl->GetQnormCorr(ipad, type,5)* | |
1222 | parcl->QtotCorrection(cluster->GetDetector(), cluster->GetRow(),cluster->GetPad(), | |
1223 | cluster->GetTimeBin(),ty,tz,yres0,zres0,cluster->GetQ(),2.5,effLength,effDiff); | |
1224 | ||
1225 | Float_t drm = 0.5-TMath::Abs(cluster->GetZ()/250.); | |
1226 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,0)*drm); | |
1227 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,1)*ty*ty); | |
1228 | corrPos*=(1+parcl->GetQnormCorr(ipad, type+2,2)*tz*tz); | |
1229 | // | |
1230 | } | |
2efc897f | 1231 | // |
1232 | // pad region equalization outside of cluster param | |
1233 | // | |
1234 | Float_t gainEqualPadRegion = 1; | |
649fcc43 | 1235 | if (grPadEqual) gainEqualPadRegion = grPadEqual->Eval(ipad); |
8a92e133 | 1236 | // |
1237 | amp[ncl]=charge; | |
1238 | amp[ncl]/=gainGG; | |
1239 | amp[ncl]/=gainPad; | |
1240 | amp[ncl]/=corrPos; | |
2efc897f | 1241 | amp[ncl]/=gainEqualPadRegion; |
8a92e133 | 1242 | // |
1243 | ncl++; | |
1244 | } | |
1245 | ||
6feb400f | 1246 | if (type==2) return ncl; |
8a92e133 | 1247 | TMath::Sort(ncl,amp, indexes, kFALSE); |
2efc897f | 1248 | // |
8a92e133 | 1249 | if (ncl<10) return 0; |
2efc897f | 1250 | // |
1251 | Double_t * ampWithBelow = new Double_t[ncl + nclBelowThr]; | |
1252 | for(Int_t iCl = 0; iCl < ncl + nclBelowThr; iCl++) { | |
1253 | if (iCl < nclBelowThr) { | |
1254 | ampWithBelow[iCl] = amp[indexes[0]]; | |
1255 | } else { | |
1256 | ampWithBelow[iCl] = amp[indexes[iCl - nclBelowThr]]; | |
1257 | } | |
1258 | } | |
1259 | //printf("DEBUG: %i shit %f", nclBelowThr, amp[indexes[0]]); | |
1260 | // | |
8a92e133 | 1261 | Float_t suma=0; |
1262 | Float_t suma2=0; | |
6feb400f | 1263 | Float_t suma3=0; |
1264 | Float_t sumaS=0; | |
8a92e133 | 1265 | Float_t sumn=0; |
6feb400f | 1266 | // upper,and lower part statistic |
1267 | Float_t sumL=0, sumL2=0, sumLN=0; | |
1268 | Float_t sumD=0, sumD2=0, sumDN=0; | |
1269 | ||
2efc897f | 1270 | Int_t icl0=TMath::Nint((ncl + nclBelowThr)*low); |
1271 | Int_t icl1=TMath::Nint((ncl + nclBelowThr)*up); | |
6feb400f | 1272 | Int_t iclm=TMath::Nint((ncl + nclBelowThr)*(low +(up+low)*0.5)); |
1273 | // | |
8a92e133 | 1274 | for (Int_t icl=icl0; icl<icl1;icl++){ |
6feb400f | 1275 | if (ampWithBelow[icl]<0.1) continue; |
504dd8df | 1276 | Double_t camp=ampWithBelow[icl]/corrTimeGain; |
1277 | if (mode==1) camp= TMath::Log(camp); | |
6feb400f | 1278 | if (icl<icl1){ |
504dd8df | 1279 | suma+=camp; |
1280 | suma2+=camp*camp; | |
1281 | suma3+=camp*camp*camp; | |
1282 | sumaS+=TMath::Power(TMath::Abs(camp),1./3.); | |
6feb400f | 1283 | sumn++; |
1284 | } | |
1285 | if (icl>iclm){ | |
504dd8df | 1286 | sumL+=camp; |
1287 | sumL2+=camp*camp; | |
6feb400f | 1288 | sumLN++; |
1289 | } | |
1290 | if (icl<=iclm){ | |
504dd8df | 1291 | sumD+=camp; |
1292 | sumD2+=camp*camp; | |
6feb400f | 1293 | sumDN++; |
1294 | } | |
8a92e133 | 1295 | } |
0f7547f1 | 1296 | // |
1297 | Float_t mean = 0; | |
1298 | Float_t meanL = 0; | |
1299 | Float_t meanD = 0; // lower half mean | |
1300 | if (sumn > 1e-30) mean =suma/sumn; | |
1301 | if (sumLN > 1e-30) meanL =sumL/sumLN; | |
1302 | if (sumDN > 1e-30) meanD =(sumD/sumDN); | |
1303 | /* | |
8a92e133 | 1304 | Float_t mean =suma/sumn; |
6feb400f | 1305 | Float_t meanL = sumL/sumLN; |
1306 | Float_t meanD =(sumD/sumDN); // lower half mean | |
0f7547f1 | 1307 | */ |
28273e26 | 1308 | |
1309 | Float_t rms = 0; | |
1310 | Float_t mean2=0; | |
1311 | Float_t mean3=0; | |
1312 | Float_t meanS=0; | |
1313 | ||
1314 | if(sumn>0){ | |
1315 | rms = TMath::Sqrt(TMath::Abs(suma2/sumn-mean*mean)); | |
1316 | mean2=suma2/sumn; | |
1317 | mean3=suma3/sumn; | |
1318 | meanS=sumaS/sumn; | |
1319 | } | |
1320 | ||
6feb400f | 1321 | if (mean2>0) mean2=TMath::Power(TMath::Abs(mean2),1./2.); |
1322 | if (mean3>0) mean3=TMath::Power(TMath::Abs(mean3),1./3.); | |
1323 | if (meanS>0) meanS=TMath::Power(TMath::Abs(meanS),3.); | |
3af3fbc4 | 1324 | // |
6feb400f | 1325 | if (mode==1) mean=TMath::Exp(mean); |
1326 | if (mode==1) meanL=TMath::Exp(meanL); // upper truncation | |
1327 | if (mode==1) meanD=TMath::Exp(meanD); // lower truncation | |
1328 | // | |
1329 | delete [] ampWithBelow; | |
1330 | ||
1331 | ||
3af3fbc4 | 1332 | // |
8a92e133 | 1333 | if (returnVal==1) return rms; |
83afd539 | 1334 | if (returnVal==2) return ncl; |
6feb400f | 1335 | if (returnVal==3) return Double_t(nclBelowThr)/Double_t(nclBelowThr+ncl); |
1336 | if (returnVal==4) return meanL; | |
1337 | if (returnVal==5) return meanD; | |
1338 | if (returnVal==6) return mean2; | |
1339 | if (returnVal==7) return mean3; | |
1340 | if (returnVal==8) return meanS; | |
83afd539 | 1341 | return mean; |
0a65832b | 1342 | } |
1343 | ||
83afd539 | 1344 | |
0a65832b | 1345 | |
1346 | ||
eb02f63a | 1347 | Float_t AliTPCseed::CookShape(Int_t type){ |
1348 | // | |
1349 | // | |
1350 | // | |
1351 | //----------------------------------------------------------------- | |
1352 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
1353 | //----------------------------------------------------------------- | |
1354 | Float_t means=0; | |
1355 | Float_t meanc=0; | |
1356 | for (Int_t i =0; i<160;i++) { | |
1357 | AliTPCTrackerPoint * point = GetTrackPoint(i); | |
1358 | if (point==0) continue; | |
1359 | ||
1360 | AliTPCclusterMI * cl = fClusterPointer[i]; | |
1361 | if (cl==0) continue; | |
1362 | ||
1363 | Float_t rsigmay = TMath::Sqrt(point->GetSigmaY()); | |
1364 | Float_t rsigmaz = TMath::Sqrt(point->GetSigmaZ()); | |
1365 | Float_t rsigma = (rsigmay+rsigmaz)*0.5; | |
1366 | if (type==0) means+=rsigma; | |
1367 | if (type==1) means+=rsigmay; | |
1368 | if (type==2) means+=rsigmaz; | |
1369 | meanc++; | |
1370 | } | |
1371 | Float_t mean = (meanc>0)? means/meanc:0; | |
1372 | return mean; | |
1373 | } | |
87e92a27 | 1374 | |
1375 | ||
1376 | ||
1377 | Int_t AliTPCseed::RefitTrack(AliTPCseed *seed, AliExternalTrackParam * parin, AliExternalTrackParam * parout){ | |
1378 | // | |
1379 | // Refit the track | |
1380 | // return value - number of used clusters | |
1381 | // | |
1382 | // | |
1383 | const Int_t kMinNcl =10; | |
1384 | AliTPCseed *track=new AliTPCseed(*seed); | |
1385 | Int_t sector=-1; | |
1386 | // reset covariance | |
1387 | // | |
1388 | Double_t covar[15]; | |
1389 | for (Int_t i=0;i<15;i++) covar[i]=0; | |
1390 | covar[0]=10.*10.; | |
1391 | covar[2]=10.*10.; | |
1392 | covar[5]=10.*10./(64.*64.); | |
1393 | covar[9]=10.*10./(64.*64.); | |
1394 | covar[14]=1*1; | |
1395 | // | |
1396 | ||
1397 | Float_t xmin=1000, xmax=-10000; | |
1398 | Int_t imin=158, imax=0; | |
1399 | for (Int_t i=0;i<160;i++) { | |
1400 | AliTPCclusterMI *c=track->GetClusterPointer(i); | |
1401 | if (!c) continue; | |
1402 | if (sector<0) sector = c->GetDetector(); | |
1403 | if (c->GetX()<xmin) xmin=c->GetX(); | |
1404 | if (c->GetX()>xmax) xmax=c->GetX(); | |
1405 | if (i<imin) imin=i; | |
1406 | if (i>imax) imax=i; | |
1407 | } | |
1408 | if(imax-imin<kMinNcl) { | |
1409 | delete track; | |
1410 | return 0 ; | |
1411 | } | |
1412 | // Not succes to rotate | |
1413 | if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) { | |
1414 | delete track; | |
1415 | return 0; | |
1416 | } | |
1417 | // | |
1418 | // | |
1419 | // fit from inner to outer row | |
1420 | // | |
1421 | AliExternalTrackParam paramIn; | |
1422 | AliExternalTrackParam paramOut; | |
1423 | Bool_t isOK=kTRUE; | |
be34cb88 | 1424 | Int_t ncl=0; |
87e92a27 | 1425 | // |
1426 | // | |
1427 | // | |
1428 | for (Int_t i=imin; i<=imax; i++){ | |
1429 | AliTPCclusterMI *c=track->GetClusterPointer(i); | |
1430 | if (!c) continue; | |
1431 | // if (RejectCluster(c,track)) continue; | |
be34cb88 | 1432 | sector = (c->GetDetector()%18); |
1433 | if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) { | |
1434 | //continue; | |
1435 | } | |
87e92a27 | 1436 | Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()}; |
1437 | Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation | |
1438 | if (!track->PropagateTo(r[0])) { | |
1439 | isOK=kFALSE; | |
87e92a27 | 1440 | } |
1441 | if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE; | |
1442 | } | |
1443 | if (!isOK) { delete track; return 0;} | |
1444 | track->AddCovariance(covar); | |
1445 | // | |
1446 | // | |
1447 | // | |
1448 | for (Int_t i=imax; i>=imin; i--){ | |
1449 | AliTPCclusterMI *c=track->GetClusterPointer(i); | |
1450 | if (!c) continue; | |
1451 | //if (RejectCluster(c,track)) continue; | |
be34cb88 | 1452 | sector = (c->GetDetector()%18); |
1453 | if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) { | |
1454 | //continue; | |
1455 | } | |
87e92a27 | 1456 | Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()}; |
1457 | Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation | |
1458 | if (!track->PropagateTo(r[0])) { | |
1459 | isOK=kFALSE; | |
87e92a27 | 1460 | } |
1461 | if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE; | |
1462 | } | |
be34cb88 | 1463 | //if (!isOK) { delete track; return 0;} |
87e92a27 | 1464 | paramIn = *track; |
1465 | track->AddCovariance(covar); | |
1466 | // | |
1467 | // | |
1468 | for (Int_t i=imin; i<=imax; i++){ | |
1469 | AliTPCclusterMI *c=track->GetClusterPointer(i); | |
1470 | if (!c) continue; | |
be34cb88 | 1471 | sector = (c->GetDetector()%18); |
1472 | if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) { | |
1473 | //continue; | |
1474 | } | |
1475 | ncl++; | |
87e92a27 | 1476 | //if (RejectCluster(c,track)) continue; |
1477 | Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()}; | |
1478 | Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation | |
1479 | if (!track->PropagateTo(r[0])) { | |
1480 | isOK=kFALSE; | |
87e92a27 | 1481 | } |
1482 | if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE; | |
1483 | } | |
be34cb88 | 1484 | //if (!isOK) { delete track; return 0;} |
87e92a27 | 1485 | paramOut=*track; |
87e92a27 | 1486 | // |
1487 | // | |
1488 | // | |
1489 | if (parin) (*parin)=paramIn; | |
1490 | if (parout) (*parout)=paramOut; | |
6e23caff | 1491 | delete track; |
be34cb88 | 1492 | return ncl; |
87e92a27 | 1493 | } |
1494 | ||
1495 | ||
1496 | ||
1497 | Bool_t AliTPCseed::RefitTrack(AliTPCseed* /*seed*/, Bool_t /*out*/){ | |
1498 | // | |
1499 | // | |
1500 | // | |
1501 | return kFALSE; | |
1502 | } | |
3247d397 | 1503 | |
1504 | ||
1505 | ||
1506 | ||
1507 | ||
1508 | ||
1509 | void AliTPCseed::GetError(AliTPCclusterMI* cluster, AliExternalTrackParam * param, | |
1510 | Double_t& erry, Double_t &errz) | |
1511 | { | |
1512 | // | |
1513 | // Get cluster error at given position | |
1514 | // | |
1515 | AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam(); | |
1516 | Double_t tany,tanz; | |
1517 | Double_t snp1=param->GetSnp(); | |
60e55aee | 1518 | tany=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1)); |
3247d397 | 1519 | // |
1520 | Double_t tgl1=param->GetTgl(); | |
60e55aee | 1521 | tanz=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1)); |
3247d397 | 1522 | // |
1523 | Int_t padSize = 0; // short pads | |
1524 | if (cluster->GetDetector() >= 36) { | |
1525 | padSize = 1; // medium pads | |
1526 | if (cluster->GetRow() > 63) padSize = 2; // long pads | |
1527 | } | |
1528 | ||
1529 | erry = clusterParam->GetError0Par( 0, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tany) ); | |
1530 | errz = clusterParam->GetError0Par( 1, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tanz) ); | |
1531 | } | |
1532 | ||
1533 | ||
1534 | void AliTPCseed::GetShape(AliTPCclusterMI* cluster, AliExternalTrackParam * param, | |
1535 | Double_t& rmsy, Double_t &rmsz) | |
1536 | { | |
1537 | // | |
1538 | // Get cluster error at given position | |
1539 | // | |
1540 | AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam(); | |
1541 | Double_t tany,tanz; | |
1542 | Double_t snp1=param->GetSnp(); | |
60e55aee | 1543 | tany=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1)); |
3247d397 | 1544 | // |
1545 | Double_t tgl1=param->GetTgl(); | |
60e55aee | 1546 | tanz=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1)); |
3247d397 | 1547 | // |
1548 | Int_t padSize = 0; // short pads | |
1549 | if (cluster->GetDetector() >= 36) { | |
1550 | padSize = 1; // medium pads | |
1551 | if (cluster->GetRow() > 63) padSize = 2; // long pads | |
1552 | } | |
1553 | ||
1554 | rmsy = clusterParam->GetRMSQ( 0, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tany), TMath::Abs(cluster->GetMax()) ); | |
1555 | rmsz = clusterParam->GetRMSQ( 1, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tanz) ,TMath::Abs(cluster->GetMax())); | |
1556 | } | |
ba5e52fb | 1557 | |
1558 | ||
1559 | ||
1560 | Double_t AliTPCseed::GetQCorrGeom(Float_t ty, Float_t tz){ | |
1561 | //Geoetrical | |
1562 | //ty - tangent in local y direction | |
1563 | //tz - tangent | |
1564 | // | |
1565 | Float_t norm=TMath::Sqrt(1+ty*ty+tz*tz); | |
1566 | return norm; | |
1567 | } | |
1568 | ||
83afd539 | 1569 | 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 | 1570 | // |
1571 | // Q normalization | |
1572 | // | |
1573 | // return value = Q Normalization factor | |
1574 | // Normalization - 1 - shape factor part for full drift | |
1575 | // 1 - electron attachment for 0 drift | |
1576 | ||
1577 | // Input parameters: | |
1578 | // | |
1579 | // ipad - 0 short pad | |
1580 | // 1 medium pad | |
1581 | // 2 long pad | |
1582 | // | |
1583 | // type - 0 qmax | |
1584 | // - 1 qtot | |
1585 | // | |
1586 | //z - z position (-250,250 cm) | |
1587 | //ty - tangent in local y direction | |
1588 | //tz - tangent | |
1589 | // | |
1590 | ||
1591 | AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam(); | |
1592 | AliTPCParam * paramTPC = AliTPCcalibDB::Instance()->GetParameters(); | |
1593 | ||
1594 | if (!paramCl) return 1; | |
1595 | // | |
1596 | Double_t dr = 250.-TMath::Abs(z); | |
1597 | Double_t sy = paramCl->GetRMS0( 0,ipad, dr, TMath::Abs(ty)); | |
1598 | Double_t sy0= paramCl->GetRMS0(0,ipad, 250, 0); | |
1599 | Double_t sz = paramCl->GetRMS0( 1,ipad, dr, TMath::Abs(tz)); | |
1600 | Double_t sz0= paramCl->GetRMS0(1,ipad, 250, 0); | |
1601 | ||
1602 | Double_t sfactorMax = TMath::Sqrt(sy0*sz0/(sy*sz)); | |
1603 | ||
1604 | ||
1605 | Double_t dt = 1000000*(dr/paramTPC->GetDriftV()); //time in microsecond | |
1606 | Double_t attProb = TMath::Exp(-paramTPC->GetAttCoef()*paramTPC->GetOxyCont()*dt); | |
1607 | // | |
1608 | // | |
1609 | if (type==0) return sfactorMax*attProb; | |
1610 | ||
1611 | return attProb; | |
1612 | ||
1613 | ||
1614 | } | |
1615 |