1c53abe2 |
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 | |
1c53abe2 |
16 | |
17 | //------------------------------------------------------- |
18 | // Implementation of the TPC tracker |
19 | // |
20 | // Origin: Marian Ivanov Marian.Ivanov@cern.ch |
21 | // |
34acb742 |
22 | // AliTPC parallel tracker |
1c53abe2 |
23 | //------------------------------------------------------- |
47966a6d |
24 | |
25 | |
26 | /* $Id$ */ |
27 | |
cc5e9db0 |
28 | #include "Riostream.h" |
6d171107 |
29 | #include <TClonesArray.h> |
30 | #include <TFile.h> |
31 | #include <TObjArray.h> |
32 | #include <TTree.h> |
1c53abe2 |
33 | |
47966a6d |
34 | #include "AliComplexCluster.h" |
91162307 |
35 | #include "AliESD.h" |
9996a03b |
36 | #include "AliESDkink.h" |
91162307 |
37 | #include "AliHelix.h" |
91162307 |
38 | #include "AliRunLoader.h" |
6d171107 |
39 | #include "AliTPCClustersRow.h" |
40 | #include "AliTPCParam.h" |
9996a03b |
41 | #include "AliTPCReconstructor.h" |
6d171107 |
42 | #include "AliTPCclusterMI.h" |
43 | #include "AliTPCpolyTrack.h" |
81e97e0d |
44 | #include "AliTPCreco.h" |
45 | #include "AliTPCseed.h" |
b67e07dc |
46 | #include "AliTPCtrackerMI.h" |
6d171107 |
47 | #include "TStopwatch.h" |
81e97e0d |
48 | #include "AliTPCReconstructor.h" |
49 | #include "AliESDkink.h" |
50 | #include "AliPID.h" |
eea478d3 |
51 | #include "TTreeStream.h" |
5d837844 |
52 | #include "AliAlignObj.h" |
53 | #include "AliTrackPointArray.h" |
54 | |
6d171107 |
55 | // |
c9427e08 |
56 | |
91162307 |
57 | ClassImp(AliTPCtrackerMI) |
c9427e08 |
58 | |
59 | |
b67e07dc |
60 | class AliTPCFastMath { |
91162307 |
61 | public: |
b67e07dc |
62 | AliTPCFastMath(); |
91162307 |
63 | static Double_t FastAsin(Double_t x); |
64 | private: |
b67e07dc |
65 | static Double_t fgFastAsin[20000]; //lookup table for fast asin computation |
91162307 |
66 | }; |
c9427e08 |
67 | |
b67e07dc |
68 | Double_t AliTPCFastMath::fgFastAsin[20000]; |
2274b54b |
69 | AliTPCFastMath gAliTPCFastMath; // needed to fill the LUT |
c9427e08 |
70 | |
b67e07dc |
71 | AliTPCFastMath::AliTPCFastMath(){ |
72 | // |
73 | // initialized lookup table; |
91162307 |
74 | for (Int_t i=0;i<10000;i++){ |
75 | fgFastAsin[2*i] = TMath::ASin(i/10000.); |
76 | fgFastAsin[2*i+1] = (TMath::ASin((i+1)/10000.)-fgFastAsin[2*i]); |
77 | } |
c9427e08 |
78 | } |
79 | |
b67e07dc |
80 | Double_t AliTPCFastMath::FastAsin(Double_t x){ |
81 | // |
82 | // return asin using lookup table |
91162307 |
83 | if (x>0){ |
84 | Int_t index = int(x*10000); |
85 | return fgFastAsin[2*index]+(x*10000.-index)*fgFastAsin[2*index+1]; |
86 | } |
87 | x*=-1; |
88 | Int_t index = int(x*10000); |
89 | return -(fgFastAsin[2*index]+(x*10000.-index)*fgFastAsin[2*index+1]); |
1c53abe2 |
90 | } |
91 | |
92 | |
93 | |
94 | |
91162307 |
95 | Int_t AliTPCtrackerMI::UpdateTrack(AliTPCseed * track, Int_t accept){ |
b67e07dc |
96 | // |
97 | //update track information using current cluster - track->fCurrentCluster |
98 | |
1c53abe2 |
99 | |
91162307 |
100 | AliTPCclusterMI* c =track->fCurrentCluster; |
101 | if (accept>0) track->fCurrentClusterIndex1 |=0x8000; //sign not accepted clusters |
c9427e08 |
102 | |
91162307 |
103 | UInt_t i = track->fCurrentClusterIndex1; |
1c53abe2 |
104 | |
105 | Int_t sec=(i&0xff000000)>>24; |
91162307 |
106 | //Int_t row = (i&0x00ff0000)>>16; |
1c53abe2 |
107 | track->fRow=(i&0x00ff0000)>>16; |
108 | track->fSector = sec; |
109 | // Int_t index = i&0xFFFF; |
110 | if (sec>=fParam->GetNInnerSector()) track->fRow += fParam->GetNRowLow(); |
d26d9159 |
111 | track->SetClusterIndex2(track->fRow, i); |
91162307 |
112 | //track->fFirstPoint = row; |
113 | //if ( track->fLastPoint<row) track->fLastPoint =row; |
114 | // if (track->fRow<0 || track->fRow>160) { |
115 | // printf("problem\n"); |
116 | //} |
117 | if (track->fFirstPoint>track->fRow) |
118 | track->fFirstPoint = track->fRow; |
119 | if (track->fLastPoint<track->fRow) |
120 | track->fLastPoint = track->fRow; |
121 | |
122 | |
123 | track->fClusterPointer[track->fRow] = c; |
1c53abe2 |
124 | // |
125 | |
3f82c4f2 |
126 | Double_t angle2 = track->GetSnp()*track->GetSnp(); |
1c53abe2 |
127 | // |
128 | //SET NEW Track Point |
129 | // |
85e2b57d |
130 | if (angle2<1) //PH sometimes angle2 is very big. To be investigated... |
91162307 |
131 | { |
85e2b57d |
132 | angle2 = TMath::Sqrt(angle2/(1-angle2)); |
91162307 |
133 | AliTPCTrackerPoint &point =*(track->GetTrackPoint(track->fRow)); |
1c53abe2 |
134 | // |
91162307 |
135 | point.SetSigmaY(c->GetSigmaY2()/track->fCurrentSigmaY2); |
136 | point.SetSigmaZ(c->GetSigmaZ2()/track->fCurrentSigmaZ2); |
137 | point.SetErrY(sqrt(track->fErrorY2)); |
138 | point.SetErrZ(sqrt(track->fErrorZ2)); |
1c53abe2 |
139 | // |
91162307 |
140 | point.SetX(track->GetX()); |
141 | point.SetY(track->GetY()); |
142 | point.SetZ(track->GetZ()); |
143 | point.SetAngleY(angle2); |
144 | point.SetAngleZ(track->GetTgl()); |
145 | if (point.fIsShared){ |
146 | track->fErrorY2 *= 4; |
147 | track->fErrorZ2 *= 4; |
148 | } |
149 | } |
150 | |
151 | Double_t chi2 = track->GetPredictedChi2(track->fCurrentCluster); |
152 | // |
153 | track->fErrorY2 *= 1.3; |
154 | track->fErrorY2 += 0.01; |
155 | track->fErrorZ2 *= 1.3; |
156 | track->fErrorZ2 += 0.005; |
157 | //} |
158 | if (accept>0) return 0; |
159 | if (track->GetNumberOfClusters()%20==0){ |
160 | // if (track->fHelixIn){ |
161 | // TClonesArray & larr = *(track->fHelixIn); |
162 | // Int_t ihelix = larr.GetEntriesFast(); |
163 | // new(larr[ihelix]) AliHelix(*track) ; |
164 | //} |
1c53abe2 |
165 | } |
91162307 |
166 | track->fNoCluster =0; |
167 | return track->Update(c,chi2,i); |
168 | } |
169 | |
170 | |
171 | |
172 | Int_t AliTPCtrackerMI::AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster, Float_t factor, |
173 | Float_t cory, Float_t corz) |
174 | { |
1c53abe2 |
175 | // |
91162307 |
176 | // decide according desired precision to accept given |
177 | // cluster for tracking |
178 | Double_t sy2=ErrY2(seed,cluster)*cory; |
179 | Double_t sz2=ErrZ2(seed,cluster)*corz; |
180 | //sy2=ErrY2(seed,cluster)*cory; |
181 | //sz2=ErrZ2(seed,cluster)*cory; |
1c53abe2 |
182 | |
91162307 |
183 | Double_t sdistancey2 = sy2+seed->GetSigmaY2(); |
184 | Double_t sdistancez2 = sz2+seed->GetSigmaZ2(); |
185 | |
186 | Double_t rdistancey2 = (seed->fCurrentCluster->GetY()-seed->GetY())* |
187 | (seed->fCurrentCluster->GetY()-seed->GetY())/sdistancey2; |
188 | Double_t rdistancez2 = (seed->fCurrentCluster->GetZ()-seed->GetZ())* |
189 | (seed->fCurrentCluster->GetZ()-seed->GetZ())/sdistancez2; |
190 | |
191 | Double_t rdistance2 = rdistancey2+rdistancez2; |
192 | //Int_t accept =0; |
1c53abe2 |
193 | |
91162307 |
194 | if (rdistance2>16) return 3; |
195 | |
196 | |
197 | if ((rdistancey2>9.*factor || rdistancez2>9.*factor) && cluster->GetType()==0) |
198 | return 2; //suspisiouce - will be changed |
199 | |
200 | if ((rdistancey2>6.25*factor || rdistancez2>6.25*factor) && cluster->GetType()>0) |
201 | // strict cut on overlaped cluster |
202 | return 2; //suspisiouce - will be changed |
203 | |
204 | if ( (rdistancey2>1.*factor || rdistancez2>6.25*factor ) |
205 | && cluster->GetType()<0){ |
206 | seed->fNFoundable--; |
207 | return 2; |
1c53abe2 |
208 | } |
91162307 |
209 | return 0; |
210 | } |
211 | |
212 | |
1c53abe2 |
213 | |
1c53abe2 |
214 | |
1c53abe2 |
215 | //_____________________________________________________________________________ |
f8aae377 |
216 | AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCParam *par): |
1c53abe2 |
217 | AliTracker(), fkNIS(par->GetNInnerSector()/2), fkNOS(par->GetNOuterSector()/2) |
218 | { |
219 | //--------------------------------------------------------------------- |
220 | // The main TPC tracker constructor |
221 | //--------------------------------------------------------------------- |
222 | fInnerSec=new AliTPCSector[fkNIS]; |
223 | fOuterSec=new AliTPCSector[fkNOS]; |
91162307 |
224 | |
1c53abe2 |
225 | Int_t i; |
226 | for (i=0; i<fkNIS; i++) fInnerSec[i].Setup(par,0); |
227 | for (i=0; i<fkNOS; i++) fOuterSec[i].Setup(par,1); |
228 | |
229 | fN=0; fSectors=0; |
230 | |
1c53abe2 |
231 | fSeeds=0; |
232 | fNtracks = 0; |
91162307 |
233 | fParam = par; |
234 | Int_t nrowlow = par->GetNRowLow(); |
235 | Int_t nrowup = par->GetNRowUp(); |
236 | |
237 | |
238 | for (Int_t i=0;i<nrowlow;i++){ |
239 | fXRow[i] = par->GetPadRowRadiiLow(i); |
240 | fPadLength[i]= par->GetPadPitchLength(0,i); |
241 | fYMax[i] = fXRow[i]*TMath::Tan(0.5*par->GetInnerAngle()); |
242 | } |
243 | |
244 | |
245 | for (Int_t i=0;i<nrowup;i++){ |
246 | fXRow[i+nrowlow] = par->GetPadRowRadiiUp(i); |
247 | fPadLength[i+nrowlow] = par->GetPadPitchLength(60,i); |
248 | fYMax[i+nrowlow] = fXRow[i+nrowlow]*TMath::Tan(0.5*par->GetOuterAngle()); |
249 | } |
250 | fSeeds=0; |
251 | // |
252 | fInput = 0; |
253 | fOutput = 0; |
254 | fSeedTree = 0; |
255 | fTreeDebug =0; |
256 | fNewIO =0; |
257 | fDebug =0; |
258 | fEvent =0; |
81e97e0d |
259 | fDebugStreamer = new TTreeSRedirector("TPCdebug.root"); |
1c53abe2 |
260 | } |
2fc0c115 |
261 | //________________________________________________________________________ |
58251ea0 |
262 | AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCtrackerMI &t): |
263 | AliTracker(t), |
264 | fkNIS(t.fkNIS), |
265 | fkNOS(t.fkNOS) |
266 | { |
2fc0c115 |
267 | //------------------------------------ |
268 | // dummy copy constructor |
269 | //------------------------------------------------------------------ |
270 | } |
271 | AliTPCtrackerMI & AliTPCtrackerMI::operator=(const AliTPCtrackerMI& /*r*/){ |
272 | //------------------------------ |
273 | // dummy |
274 | //-------------------------------------------------------------- |
275 | return *this; |
276 | } |
1c53abe2 |
277 | //_____________________________________________________________________________ |
278 | AliTPCtrackerMI::~AliTPCtrackerMI() { |
279 | //------------------------------------------------------------------ |
280 | // TPC tracker destructor |
281 | //------------------------------------------------------------------ |
282 | delete[] fInnerSec; |
283 | delete[] fOuterSec; |
284 | if (fSeeds) { |
285 | fSeeds->Delete(); |
286 | delete fSeeds; |
287 | } |
81e97e0d |
288 | if (fDebugStreamer) delete fDebugStreamer; |
1c53abe2 |
289 | } |
290 | |
91162307 |
291 | void AliTPCtrackerMI::SetIO() |
292 | { |
1c53abe2 |
293 | // |
91162307 |
294 | fNewIO = kTRUE; |
e191bb57 |
295 | fInput = AliRunLoader::GetTreeR("TPC", kFALSE,AliConfig::GetDefaultEventFolderName()); |
d26d9159 |
296 | |
e191bb57 |
297 | fOutput = AliRunLoader::GetTreeT("TPC", kTRUE,AliConfig::GetDefaultEventFolderName()); |
d26d9159 |
298 | if (fOutput){ |
299 | AliTPCtrack *iotrack= new AliTPCtrack; |
300 | fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100); |
301 | delete iotrack; |
302 | } |
91162307 |
303 | } |
1c53abe2 |
304 | |
d26d9159 |
305 | |
91162307 |
306 | void AliTPCtrackerMI::SetIO(TTree * input, TTree * output, AliESD * event) |
307 | { |
1c53abe2 |
308 | |
91162307 |
309 | // set input |
310 | fNewIO = kFALSE; |
311 | fInput = 0; |
312 | fOutput = 0; |
313 | fSeedTree = 0; |
314 | fTreeDebug =0; |
315 | fInput = input; |
316 | if (input==0){ |
317 | return; |
318 | } |
319 | //set output |
320 | fOutput = output; |
321 | if (output){ |
322 | AliTPCtrack *iotrack= new AliTPCtrack; |
323 | // iotrack->fHelixIn = new TClonesArray("AliHelix"); |
324 | //iotrack->fHelixOut = new TClonesArray("AliHelix"); |
325 | fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100); |
326 | delete iotrack; |
327 | } |
328 | if (output && (fDebug&2)){ |
329 | //write the full seed information if specified in debug mode |
330 | // |
331 | fSeedTree = new TTree("Seeds","Seeds"); |
332 | AliTPCseed * vseed = new AliTPCseed; |
333 | // |
334 | TClonesArray * arrtr = new TClonesArray("AliTPCTrackPoint",160); |
335 | arrtr->ExpandCreateFast(160); |
336 | TClonesArray * arre = new TClonesArray("AliTPCExactPoint",160); |
337 | // |
338 | vseed->fPoints = arrtr; |
339 | vseed->fEPoints = arre; |
340 | // vseed->fClusterPoints = arrcl; |
341 | fSeedTree->Branch("seeds","AliTPCseed",&vseed,32000,99); |
342 | delete arrtr; |
343 | delete arre; |
344 | fTreeDebug = new TTree("trackDebug","trackDebug"); |
345 | TClonesArray * arrd = new TClonesArray("AliTPCTrackPoint2",0); |
346 | fTreeDebug->Branch("debug",&arrd,32000,99); |
1c53abe2 |
347 | } |
1c53abe2 |
348 | |
1c53abe2 |
349 | |
91162307 |
350 | //set ESD event |
351 | fEvent = event; |
352 | } |
1c53abe2 |
353 | |
d26d9159 |
354 | void AliTPCtrackerMI::FillESD(TObjArray* arr) |
91162307 |
355 | { |
47966a6d |
356 | // |
357 | // |
358 | //fill esds using updated tracks |
91162307 |
359 | if (fEvent){ |
360 | // write tracks to the event |
361 | // store index of the track |
d26d9159 |
362 | Int_t nseed=arr->GetEntriesFast(); |
51ad6848 |
363 | //FindKinks(arr,fEvent); |
91162307 |
364 | for (Int_t i=0; i<nseed; i++) { |
d26d9159 |
365 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
91162307 |
366 | if (!pt) continue; |
51ad6848 |
367 | pt->UpdatePoints(); |
eea478d3 |
368 | // pt->PropagateTo(fParam->GetInnerRadiusLow()); |
369 | if (pt->GetKinkIndex(0)<=0){ //don't propagate daughter tracks |
370 | pt->PropagateTo(fParam->GetInnerRadiusLow()); |
371 | } |
51ad6848 |
372 | |
373 | if (( pt->GetPoints()[2]- pt->GetPoints()[0])>5 && pt->GetPoints()[3]>0.8){ |
374 | AliESDtrack iotrack; |
375 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); |
376 | iotrack.SetTPCPoints(pt->GetPoints()); |
377 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); |
81e97e0d |
378 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
379 | // iotrack.SetTPCpid(pt->fTPCr); |
51ad6848 |
380 | //iotrack.SetTPCindex(i); |
381 | fEvent->AddTrack(&iotrack); |
382 | continue; |
383 | } |
384 | |
4d158c36 |
385 | if ( (pt->GetNumberOfClusters()>70)&& (Float_t(pt->GetNumberOfClusters())/Float_t(pt->fNFoundable))>0.55) { |
d26d9159 |
386 | AliESDtrack iotrack; |
51ad6848 |
387 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); |
388 | iotrack.SetTPCPoints(pt->GetPoints()); |
d26d9159 |
389 | //iotrack.SetTPCindex(i); |
51ad6848 |
390 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); |
81e97e0d |
391 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
392 | // iotrack.SetTPCpid(pt->fTPCr); |
d26d9159 |
393 | fEvent->AddTrack(&iotrack); |
a42a6bae |
394 | continue; |
395 | } |
51ad6848 |
396 | // |
397 | // short tracks - maybe decays |
398 | |
a42a6bae |
399 | if ( (pt->GetNumberOfClusters()>30) && (Float_t(pt->GetNumberOfClusters())/Float_t(pt->fNFoundable))>0.70) { |
400 | Int_t found,foundable,shared; |
401 | pt->GetClusterStatistic(0,60,found, foundable,shared,kFALSE); |
402 | if ( (found>20) && (pt->fNShared/float(pt->GetNumberOfClusters())<0.2)){ |
403 | AliESDtrack iotrack; |
404 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); |
405 | //iotrack.SetTPCindex(i); |
51ad6848 |
406 | iotrack.SetTPCPoints(pt->GetPoints()); |
407 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); |
81e97e0d |
408 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
409 | //iotrack.SetTPCpid(pt->fTPCr); |
a42a6bae |
410 | fEvent->AddTrack(&iotrack); |
411 | continue; |
412 | } |
413 | } |
414 | |
415 | if ( (pt->GetNumberOfClusters()>20) && (Float_t(pt->GetNumberOfClusters())/Float_t(pt->fNFoundable))>0.8) { |
416 | Int_t found,foundable,shared; |
417 | pt->GetClusterStatistic(0,60,found, foundable,shared,kFALSE); |
418 | if (found<20) continue; |
419 | if (pt->fNShared/float(pt->GetNumberOfClusters())>0.2) continue; |
420 | // |
421 | AliESDtrack iotrack; |
422 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); |
51ad6848 |
423 | iotrack.SetTPCPoints(pt->GetPoints()); |
424 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); |
81e97e0d |
425 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
426 | //iotrack.SetTPCpid(pt->fTPCr); |
51ad6848 |
427 | //iotrack.SetTPCindex(i); |
428 | fEvent->AddTrack(&iotrack); |
429 | continue; |
430 | } |
431 | // short tracks - secondaties |
432 | // |
433 | if ( (pt->GetNumberOfClusters()>30) ) { |
434 | Int_t found,foundable,shared; |
435 | pt->GetClusterStatistic(128,158,found, foundable,shared,kFALSE); |
436 | if ( (found>20) && (pt->fNShared/float(pt->GetNumberOfClusters())<0.2) &&float(found)/float(foundable)>0.8){ |
437 | AliESDtrack iotrack; |
438 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); |
439 | iotrack.SetTPCPoints(pt->GetPoints()); |
440 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); |
81e97e0d |
441 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
442 | //iotrack.SetTPCpid(pt->fTPCr); |
51ad6848 |
443 | //iotrack.SetTPCindex(i); |
444 | fEvent->AddTrack(&iotrack); |
445 | continue; |
446 | } |
447 | } |
448 | |
449 | if ( (pt->GetNumberOfClusters()>15)) { |
450 | Int_t found,foundable,shared; |
451 | pt->GetClusterStatistic(138,158,found, foundable,shared,kFALSE); |
452 | if (found<15) continue; |
453 | if (pt->fNShared/float(pt->GetNumberOfClusters())>0.2) continue; |
454 | if (float(found)/float(foundable)<0.8) continue; |
455 | // |
456 | AliESDtrack iotrack; |
457 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); |
458 | iotrack.SetTPCPoints(pt->GetPoints()); |
459 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); |
81e97e0d |
460 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
461 | // iotrack.SetTPCpid(pt->fTPCr); |
a42a6bae |
462 | //iotrack.SetTPCindex(i); |
463 | fEvent->AddTrack(&iotrack); |
464 | continue; |
465 | } |
91162307 |
466 | } |
1c53abe2 |
467 | } |
51ad6848 |
468 | printf("Number of filled ESDs-\t%d\n",fEvent->GetNumberOfTracks()); |
d26d9159 |
469 | } |
470 | |
47966a6d |
471 | void AliTPCtrackerMI::WriteTracks(TTree * tree) |
472 | { |
d26d9159 |
473 | // |
47966a6d |
474 | // write tracks from seed array to selected tree |
d26d9159 |
475 | // |
476 | fOutput = tree; |
477 | if (fOutput){ |
478 | AliTPCtrack *iotrack= new AliTPCtrack; |
479 | fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100); |
480 | } |
481 | WriteTracks(); |
482 | } |
483 | |
484 | void AliTPCtrackerMI::WriteTracks() |
485 | { |
486 | // |
487 | // write tracks to the given output tree - |
488 | // output specified with SetIO routine |
489 | if (!fSeeds) return; |
490 | if (!fOutput){ |
491 | SetIO(); |
492 | } |
1c53abe2 |
493 | |
91162307 |
494 | if (fOutput){ |
495 | AliTPCtrack *iotrack= 0; |
496 | Int_t nseed=fSeeds->GetEntriesFast(); |
982aff31 |
497 | //for (Int_t i=0; i<nseed; i++) { |
498 | // iotrack= (AliTPCtrack*)fSeeds->UncheckedAt(i); |
499 | // if (iotrack) break; |
500 | //} |
91162307 |
501 | //TBranch * br = fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100); |
502 | TBranch * br = fOutput->GetBranch("tracks"); |
503 | br->SetAddress(&iotrack); |
504 | // |
505 | for (Int_t i=0; i<nseed; i++) { |
506 | AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i); |
507 | if (!pt) continue; |
982aff31 |
508 | AliTPCtrack * track = new AliTPCtrack(*pt); |
509 | iotrack = track; |
91162307 |
510 | pt->fLab2 =i; |
511 | // br->SetAddress(&iotrack); |
512 | fOutput->Fill(); |
982aff31 |
513 | delete track; |
91162307 |
514 | iotrack =0; |
515 | } |
982aff31 |
516 | //fOutput->GetDirectory()->cd(); |
517 | //fOutput->Write(); |
91162307 |
518 | } |
d26d9159 |
519 | // delete iotrack; |
520 | // |
91162307 |
521 | if (fSeedTree){ |
522 | //write the full seed information if specified in debug mode |
523 | |
524 | AliTPCseed * vseed = new AliTPCseed; |
525 | // |
526 | TClonesArray * arrtr = new TClonesArray("AliTPCTrackPoint",160); |
527 | arrtr->ExpandCreateFast(160); |
528 | //TClonesArray * arrcl = new TClonesArray("AliTPCclusterMI",160); |
529 | //arrcl->ExpandCreateFast(160); |
530 | TClonesArray * arre = new TClonesArray("AliTPCExactPoint",160); |
531 | // |
532 | vseed->fPoints = arrtr; |
533 | vseed->fEPoints = arre; |
534 | // vseed->fClusterPoints = arrcl; |
535 | //TBranch * brseed = seedtree->Branch("seeds","AliTPCseed",&vseed,32000,99); |
536 | TBranch * brseed = fSeedTree->GetBranch("seeds"); |
537 | |
538 | Int_t nseed=fSeeds->GetEntriesFast(); |
539 | |
540 | for (Int_t i=0; i<nseed; i++) { |
541 | AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i); |
542 | if (!pt) continue; |
543 | pt->fPoints = arrtr; |
544 | // pt->fClusterPoints = arrcl; |
545 | pt->fEPoints = arre; |
546 | pt->RebuildSeed(); |
547 | vseed = pt; |
548 | brseed->SetAddress(&vseed); |
549 | fSeedTree->Fill(); |
550 | pt->fPoints = 0; |
551 | pt->fEPoints = 0; |
552 | // pt->fClusterPoints = 0; |
553 | } |
554 | fSeedTree->Write(); |
555 | if (fTreeDebug) fTreeDebug->Write(); |
556 | } |
1c53abe2 |
557 | |
91162307 |
558 | } |
1c53abe2 |
559 | |
1c53abe2 |
560 | |
1c53abe2 |
561 | |
562 | |
91162307 |
563 | Double_t AliTPCtrackerMI::ErrY2(AliTPCseed* seed, AliTPCclusterMI * cl){ |
564 | // |
565 | // |
566 | //seed->SetErrorY2(0.1); |
567 | //return 0.1; |
568 | //calculate look-up table at the beginning |
569 | static Bool_t ginit = kFALSE; |
570 | static Float_t gnoise1,gnoise2,gnoise3; |
571 | static Float_t ggg1[10000]; |
572 | static Float_t ggg2[10000]; |
573 | static Float_t ggg3[10000]; |
574 | static Float_t glandau1[10000]; |
575 | static Float_t glandau2[10000]; |
576 | static Float_t glandau3[10000]; |
577 | // |
578 | static Float_t gcor01[500]; |
579 | static Float_t gcor02[500]; |
580 | static Float_t gcorp[500]; |
581 | // |
1c53abe2 |
582 | |
91162307 |
583 | // |
584 | if (ginit==kFALSE){ |
585 | for (Int_t i=1;i<500;i++){ |
586 | Float_t rsigma = float(i)/100.; |
587 | gcor02[i] = TMath::Max(0.78 +TMath::Exp(7.4*(rsigma-1.2)),0.6); |
588 | gcor01[i] = TMath::Max(0.72 +TMath::Exp(3.36*(rsigma-1.2)),0.6); |
589 | gcorp[i] = TMath::Max(TMath::Power((rsigma+0.5),1.5),1.2); |
590 | } |
1c53abe2 |
591 | |
91162307 |
592 | // |
593 | for (Int_t i=3;i<10000;i++){ |
594 | // |
595 | // |
596 | // inner sector |
597 | Float_t amp = float(i); |
598 | Float_t padlength =0.75; |
599 | gnoise1 = 0.0004/padlength; |
600 | Float_t nel = 0.268*amp; |
601 | Float_t nprim = 0.155*amp; |
602 | ggg1[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.001*nel/(padlength*padlength))/nel; |
603 | glandau1[i] = (2.+0.12*nprim)*0.5* (2.+nprim*nprim*0.001/(padlength*padlength))/nprim; |
604 | if (glandau1[i]>1) glandau1[i]=1; |
605 | glandau1[i]*=padlength*padlength/12.; |
606 | // |
607 | // outer short |
608 | padlength =1.; |
609 | gnoise2 = 0.0004/padlength; |
610 | nel = 0.3*amp; |
611 | nprim = 0.133*amp; |
612 | ggg2[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel; |
613 | glandau2[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; |
614 | if (glandau2[i]>1) glandau2[i]=1; |
615 | glandau2[i]*=padlength*padlength/12.; |
616 | // |
617 | // |
618 | // outer long |
619 | padlength =1.5; |
620 | gnoise3 = 0.0004/padlength; |
621 | nel = 0.3*amp; |
622 | nprim = 0.133*amp; |
623 | ggg3[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel; |
624 | glandau3[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; |
625 | if (glandau3[i]>1) glandau3[i]=1; |
626 | glandau3[i]*=padlength*padlength/12.; |
627 | // |
628 | } |
629 | ginit = kTRUE; |
630 | } |
1c53abe2 |
631 | // |
632 | // |
91162307 |
633 | // |
634 | Int_t amp = int(TMath::Abs(cl->GetQ())); |
635 | if (amp>9999) { |
636 | seed->SetErrorY2(1.); |
637 | return 1.; |
638 | } |
1c53abe2 |
639 | Float_t snoise2; |
c9427e08 |
640 | Float_t z = TMath::Abs(fParam->GetZLength()-TMath::Abs(seed->GetZ())); |
91162307 |
641 | Int_t ctype = cl->GetType(); |
642 | Float_t padlength= GetPadPitchLength(seed->fRow); |
3f82c4f2 |
643 | Double_t angle2 = seed->GetSnp()*seed->GetSnp(); |
91162307 |
644 | angle2 = angle2/(1-angle2); |
645 | // |
646 | //cluster "quality" |
647 | Int_t rsigmay = int(100.*cl->GetSigmaY2()/(seed->fCurrentSigmaY2)); |
648 | Float_t res; |
1c53abe2 |
649 | // |
1c53abe2 |
650 | if (fSectors==fInnerSec){ |
91162307 |
651 | snoise2 = gnoise1; |
652 | res = ggg1[amp]*z+glandau1[amp]*angle2; |
653 | if (ctype==0) res *= gcor01[rsigmay]; |
654 | if ((ctype>0)){ |
655 | res+=0.002; |
656 | res*= gcorp[rsigmay]; |
657 | } |
1c53abe2 |
658 | } |
659 | else { |
91162307 |
660 | if (padlength<1.1){ |
661 | snoise2 = gnoise2; |
662 | res = ggg2[amp]*z+glandau2[amp]*angle2; |
663 | if (ctype==0) res *= gcor02[rsigmay]; |
664 | if ((ctype>0)){ |
665 | res+=0.002; |
666 | res*= gcorp[rsigmay]; |
667 | } |
668 | } |
669 | else{ |
670 | snoise2 = gnoise3; |
671 | res = ggg3[amp]*z+glandau3[amp]*angle2; |
672 | if (ctype==0) res *= gcor02[rsigmay]; |
673 | if ((ctype>0)){ |
674 | res+=0.002; |
675 | res*= gcorp[rsigmay]; |
676 | } |
677 | } |
678 | } |
1c53abe2 |
679 | |
91162307 |
680 | if (ctype<0){ |
681 | res+=0.005; |
682 | res*=2.4; // overestimate error 2 times |
683 | } |
684 | res+= snoise2; |
685 | |
1c53abe2 |
686 | if (res<2*snoise2) |
91162307 |
687 | res = 2*snoise2; |
688 | |
689 | seed->SetErrorY2(res); |
1c53abe2 |
690 | return res; |
1c53abe2 |
691 | |
692 | |
91162307 |
693 | } |
c9427e08 |
694 | |
695 | |
696 | |
91162307 |
697 | Double_t AliTPCtrackerMI::ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl){ |
698 | // |
699 | // |
700 | //seed->SetErrorY2(0.1); |
701 | //return 0.1; |
702 | //calculate look-up table at the beginning |
703 | static Bool_t ginit = kFALSE; |
704 | static Float_t gnoise1,gnoise2,gnoise3; |
705 | static Float_t ggg1[10000]; |
706 | static Float_t ggg2[10000]; |
707 | static Float_t ggg3[10000]; |
708 | static Float_t glandau1[10000]; |
709 | static Float_t glandau2[10000]; |
710 | static Float_t glandau3[10000]; |
711 | // |
712 | static Float_t gcor01[1000]; |
713 | static Float_t gcor02[1000]; |
714 | static Float_t gcorp[1000]; |
1627d1c4 |
715 | // |
1627d1c4 |
716 | |
91162307 |
717 | // |
718 | if (ginit==kFALSE){ |
719 | for (Int_t i=1;i<1000;i++){ |
720 | Float_t rsigma = float(i)/100.; |
721 | gcor02[i] = TMath::Max(0.81 +TMath::Exp(6.8*(rsigma-1.2)),0.6); |
722 | gcor01[i] = TMath::Max(0.72 +TMath::Exp(2.04*(rsigma-1.2)),0.6); |
723 | gcorp[i] = TMath::Max(TMath::Power((rsigma+0.5),1.5),1.2); |
724 | } |
1c53abe2 |
725 | |
91162307 |
726 | // |
727 | for (Int_t i=3;i<10000;i++){ |
728 | // |
729 | // |
730 | // inner sector |
731 | Float_t amp = float(i); |
732 | Float_t padlength =0.75; |
733 | gnoise1 = 0.0004/padlength; |
734 | Float_t nel = 0.268*amp; |
735 | Float_t nprim = 0.155*amp; |
736 | ggg1[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.001*nel/(padlength*padlength))/nel; |
737 | glandau1[i] = (2.+0.12*nprim)*0.5* (2.+nprim*nprim*0.001/(padlength*padlength))/nprim; |
738 | if (glandau1[i]>1) glandau1[i]=1; |
739 | glandau1[i]*=padlength*padlength/12.; |
740 | // |
741 | // outer short |
742 | padlength =1.; |
743 | gnoise2 = 0.0004/padlength; |
744 | nel = 0.3*amp; |
745 | nprim = 0.133*amp; |
746 | ggg2[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel; |
747 | glandau2[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; |
748 | if (glandau2[i]>1) glandau2[i]=1; |
749 | glandau2[i]*=padlength*padlength/12.; |
750 | // |
751 | // |
752 | // outer long |
753 | padlength =1.5; |
754 | gnoise3 = 0.0004/padlength; |
755 | nel = 0.3*amp; |
756 | nprim = 0.133*amp; |
757 | ggg3[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel; |
758 | glandau3[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; |
759 | if (glandau3[i]>1) glandau3[i]=1; |
760 | glandau3[i]*=padlength*padlength/12.; |
761 | // |
762 | } |
763 | ginit = kTRUE; |
764 | } |
765 | // |
766 | // |
767 | // |
768 | Int_t amp = int(TMath::Abs(cl->GetQ())); |
769 | if (amp>9999) { |
770 | seed->SetErrorY2(1.); |
771 | return 1.; |
772 | } |
773 | Float_t snoise2; |
774 | Float_t z = TMath::Abs(fParam->GetZLength()-TMath::Abs(seed->GetZ())); |
775 | Int_t ctype = cl->GetType(); |
776 | Float_t padlength= GetPadPitchLength(seed->fRow); |
777 | // |
3f82c4f2 |
778 | Double_t angle2 = seed->GetSnp()*seed->GetSnp(); |
91162307 |
779 | // if (angle2<0.6) angle2 = 0.6; |
780 | angle2 = seed->GetTgl()*seed->GetTgl()*(1+angle2/(1-angle2)); |
781 | // |
782 | //cluster "quality" |
783 | Int_t rsigmaz = int(100.*cl->GetSigmaZ2()/(seed->fCurrentSigmaZ2)); |
784 | Float_t res; |
785 | // |
786 | if (fSectors==fInnerSec){ |
787 | snoise2 = gnoise1; |
788 | res = ggg1[amp]*z+glandau1[amp]*angle2; |
789 | if (ctype==0) res *= gcor01[rsigmaz]; |
790 | if ((ctype>0)){ |
791 | res+=0.002; |
792 | res*= gcorp[rsigmaz]; |
793 | } |
794 | } |
795 | else { |
796 | if (padlength<1.1){ |
797 | snoise2 = gnoise2; |
798 | res = ggg2[amp]*z+glandau2[amp]*angle2; |
799 | if (ctype==0) res *= gcor02[rsigmaz]; |
800 | if ((ctype>0)){ |
801 | res+=0.002; |
802 | res*= gcorp[rsigmaz]; |
803 | } |
804 | } |
805 | else{ |
806 | snoise2 = gnoise3; |
807 | res = ggg3[amp]*z+glandau3[amp]*angle2; |
808 | if (ctype==0) res *= gcor02[rsigmaz]; |
809 | if ((ctype>0)){ |
810 | res+=0.002; |
811 | res*= gcorp[rsigmaz]; |
812 | } |
813 | } |
814 | } |
815 | |
816 | if (ctype<0){ |
817 | res+=0.002; |
818 | res*=1.3; |
819 | } |
820 | if ((ctype<0) &&<70){ |
821 | res+=0.002; |
822 | res*=1.3; |
823 | } |
824 | res += snoise2; |
825 | if (res<2*snoise2) |
826 | res = 2*snoise2; |
827 | if (res>3) res =3; |
828 | seed->SetErrorZ2(res); |
829 | return res; |
830 | } |
831 | |
832 | |
833 | |
834 | /* |
835 | Double_t AliTPCtrackerMI::ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl){ |
836 | // |
837 | // |
838 | //seed->SetErrorZ2(0.1); |
839 | //return 0.1; |
840 | |
841 | Float_t snoise2; |
842 | Float_t z = TMath::Abs(fParam->GetZLength()-TMath::Abs(seed->GetZ())); |
843 | // |
844 | Float_t rsigmaz = cl->GetSigmaZ2()/(seed->fCurrentSigmaZ2); |
845 | Int_t ctype = cl->GetType(); |
846 | Float_t amp = TMath::Abs(cl->GetQ()); |
847 | |
848 | Float_t nel; |
849 | Float_t nprim; |
850 | // |
851 | Float_t landau=2 ; //landau fluctuation part |
852 | Float_t gg=2; // gg fluctuation part |
853 | Float_t padlength= GetPadPitchLength(seed->GetX()); |
854 | |
855 | if (fSectors==fInnerSec){ |
856 | snoise2 = 0.0004/padlength; |
857 | nel = 0.268*amp; |
858 | nprim = 0.155*amp; |
859 | gg = (2+0.001*nel/(padlength*padlength))/nel; |
860 | landau = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; |
861 | if (landau>1) landau=1; |
862 | } |
863 | else { |
864 | snoise2 = 0.0004/padlength; |
865 | nel = 0.3*amp; |
866 | nprim = 0.133*amp; |
867 | gg = (2+0.0008*nel/(padlength*padlength))/nel; |
868 | landau = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; |
869 | if (landau>1) landau=1; |
870 | } |
871 | Float_t sdiff = gg*fParam->GetDiffT()*fParam->GetDiffT()*z; |
872 | |
873 | // |
874 | Float_t angle2 = seed->GetSnp()*seed->GetSnp(); |
875 | angle2 = TMath::Sqrt((1-angle2)); |
876 | if (angle2<0.6) angle2 = 0.6; |
877 | //angle2 = 1; |
878 | |
879 | Float_t angle = seed->GetTgl()/angle2; |
880 | Float_t angular = landau*angle*angle*padlength*padlength/12.; |
881 | Float_t res = sdiff + angular; |
882 | |
883 | |
884 | if ((ctype==0) && (fSectors ==fOuterSec)) |
885 | res *= 0.81 +TMath::Exp(6.8*(rsigmaz-1.2)); |
886 | |
887 | if ((ctype==0) && (fSectors ==fInnerSec)) |
888 | res *= 0.72 +TMath::Exp(2.04*(rsigmaz-1.2)); |
889 | |
890 | if ((ctype>0)){ |
891 | res+=0.005; |
892 | res*= TMath::Power(rsigmaz+0.5,1.5); //0.31+0.147*ctype; |
893 | } |
894 | if (ctype<0){ |
895 | res+=0.002; |
896 | res*=1.3; |
897 | } |
898 | if ((ctype<0) &&<70){ |
899 | res+=0.002; |
900 | res*=1.3; |
901 | } |
902 | res += snoise2; |
903 | if (res<2*snoise2) |
904 | res = 2*snoise2; |
905 | |
906 | seed->SetErrorZ2(res); |
907 | return res; |
908 | } |
909 | */ |
910 | |
911 | |
912 | |
1c53abe2 |
913 | |
c9427e08 |
914 | void AliTPCtrackerMI::RotateToLocal(AliTPCseed *seed) |
915 | { |
916 | //rotate to track "local coordinata |
917 | Float_t x = seed->GetX(); |
918 | Float_t y = seed->GetY(); |
919 | Float_t ymax = x*TMath::Tan(0.5*fSectors->GetAlpha()); |
91162307 |
920 | |
c9427e08 |
921 | if (y > ymax) { |
922 | seed->fRelativeSector= (seed->fRelativeSector+1) % fN; |
923 | if (!seed->Rotate(fSectors->GetAlpha())) |
924 | return; |
925 | } else if (y <-ymax) { |
926 | seed->fRelativeSector= (seed->fRelativeSector-1+fN) % fN; |
927 | if (!seed->Rotate(-fSectors->GetAlpha())) |
928 | return; |
929 | } |
1c53abe2 |
930 | |
c9427e08 |
931 | } |
1c53abe2 |
932 | |
933 | |
934 | |
1c53abe2 |
935 | //_____________________________________________________________________________ |
b67e07dc |
936 | Double_t AliTPCtrackerMI::F1old(Double_t x1,Double_t y1, |
1c53abe2 |
937 | Double_t x2,Double_t y2, |
938 | Double_t x3,Double_t y3) |
939 | { |
940 | //----------------------------------------------------------------- |
941 | // Initial approximation of the track curvature |
942 | //----------------------------------------------------------------- |
943 | Double_t d=(x2-x1)*(y3-y2)-(x3-x2)*(y2-y1); |
944 | Double_t a=0.5*((y3-y2)*(y2*y2-y1*y1+x2*x2-x1*x1)- |
945 | (y2-y1)*(y3*y3-y2*y2+x3*x3-x2*x2)); |
946 | Double_t b=0.5*((x2-x1)*(y3*y3-y2*y2+x3*x3-x2*x2)- |
947 | (x3-x2)*(y2*y2-y1*y1+x2*x2-x1*x1)); |
948 | |
949 | Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b); |
91162307 |
950 | if ( xr*xr+yr*yr<=0.00000000000001) return 100; |
1c53abe2 |
951 | return -xr*yr/sqrt(xr*xr+yr*yr); |
952 | } |
953 | |
954 | |
91162307 |
955 | |
1c53abe2 |
956 | //_____________________________________________________________________________ |
b67e07dc |
957 | Double_t AliTPCtrackerMI::F1(Double_t x1,Double_t y1, |
91162307 |
958 | Double_t x2,Double_t y2, |
959 | Double_t x3,Double_t y3) |
960 | { |
961 | //----------------------------------------------------------------- |
962 | // Initial approximation of the track curvature |
963 | //----------------------------------------------------------------- |
964 | x3 -=x1; |
965 | x2 -=x1; |
966 | y3 -=y1; |
967 | y2 -=y1; |
968 | // |
969 | Double_t det = x3*y2-x2*y3; |
970 | if (det==0) { |
971 | return 100; |
972 | } |
973 | // |
974 | Double_t u = 0.5* (x2*(x2-x3)+y2*(y2-y3))/det; |
975 | Double_t x0 = x3*0.5-y3*u; |
976 | Double_t y0 = y3*0.5+x3*u; |
977 | Double_t c2 = 1/TMath::Sqrt(x0*x0+y0*y0); |
978 | if (det<0) c2*=-1; |
979 | return c2; |
980 | } |
981 | |
982 | |
b67e07dc |
983 | Double_t AliTPCtrackerMI::F2(Double_t x1,Double_t y1, |
1c53abe2 |
984 | Double_t x2,Double_t y2, |
985 | Double_t x3,Double_t y3) |
91162307 |
986 | { |
987 | //----------------------------------------------------------------- |
988 | // Initial approximation of the track curvature |
989 | //----------------------------------------------------------------- |
990 | x3 -=x1; |
991 | x2 -=x1; |
992 | y3 -=y1; |
993 | y2 -=y1; |
994 | // |
995 | Double_t det = x3*y2-x2*y3; |
996 | if (det==0) { |
997 | return 100; |
998 | } |
999 | // |
1000 | Double_t u = 0.5* (x2*(x2-x3)+y2*(y2-y3))/det; |
1001 | Double_t x0 = x3*0.5-y3*u; |
1002 | Double_t y0 = y3*0.5+x3*u; |
1003 | Double_t c2 = 1/TMath::Sqrt(x0*x0+y0*y0); |
1004 | if (det<0) c2*=-1; |
1005 | x0+=x1; |
1006 | x0*=c2; |
1007 | return x0; |
1008 | } |
1009 | |
1010 | |
1011 | |
1012 | //_____________________________________________________________________________ |
b67e07dc |
1013 | Double_t AliTPCtrackerMI::F2old(Double_t x1,Double_t y1, |
91162307 |
1014 | Double_t x2,Double_t y2, |
1015 | Double_t x3,Double_t y3) |
1c53abe2 |
1016 | { |
1017 | //----------------------------------------------------------------- |
1018 | // Initial approximation of the track curvature times center of curvature |
1019 | //----------------------------------------------------------------- |
1020 | Double_t d=(x2-x1)*(y3-y2)-(x3-x2)*(y2-y1); |
1021 | Double_t a=0.5*((y3-y2)*(y2*y2-y1*y1+x2*x2-x1*x1)- |
1022 | (y2-y1)*(y3*y3-y2*y2+x3*x3-x2*x2)); |
1023 | Double_t b=0.5*((x2-x1)*(y3*y3-y2*y2+x3*x3-x2*x2)- |
1024 | (x3-x2)*(y2*y2-y1*y1+x2*x2-x1*x1)); |
1025 | |
1026 | Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b); |
1027 | |
1028 | return -a/(d*y1-b)*xr/sqrt(xr*xr+yr*yr); |
1029 | } |
1030 | |
1031 | //_____________________________________________________________________________ |
b67e07dc |
1032 | Double_t AliTPCtrackerMI::F3(Double_t x1,Double_t y1, |
1c53abe2 |
1033 | Double_t x2,Double_t y2, |
1034 | Double_t z1,Double_t z2) |
1035 | { |
1036 | //----------------------------------------------------------------- |
1037 | // Initial approximation of the tangent of the track dip angle |
1038 | //----------------------------------------------------------------- |
1039 | return (z1 - z2)/sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); |
1040 | } |
1041 | |
1042 | |
b67e07dc |
1043 | Double_t AliTPCtrackerMI::F3n(Double_t x1,Double_t y1, |
91162307 |
1044 | Double_t x2,Double_t y2, |
1045 | Double_t z1,Double_t z2, Double_t c) |
1c53abe2 |
1046 | { |
91162307 |
1047 | //----------------------------------------------------------------- |
1048 | // Initial approximation of the tangent of the track dip angle |
1049 | //----------------------------------------------------------------- |
1050 | |
1051 | // Double_t angle1; |
1052 | |
1053 | //angle1 = (z1-z2)*c/(TMath::ASin(c*x1-ni)-TMath::ASin(c*x2-ni)); |
1c53abe2 |
1054 | // |
91162307 |
1055 | Double_t d = TMath::Sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); |
1056 | if (TMath::Abs(d*c*0.5)>1) return 0; |
1057 | // Double_t angle2 = TMath::ASin(d*c*0.5); |
b67e07dc |
1058 | // Double_t angle2 = AliTPCFastMath::FastAsin(d*c*0.5); |
1059 | Double_t angle2 = (d*c*0.5>0.1)? TMath::ASin(d*c*0.5): AliTPCFastMath::FastAsin(d*c*0.5); |
91162307 |
1060 | |
1061 | angle2 = (z1-z2)*c/(angle2*2.); |
1062 | return angle2; |
1063 | } |
1064 | |
1065 | Bool_t AliTPCtrackerMI::GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z) |
1066 | {//----------------------------------------------------------------- |
1067 | // This function find proloncation of a track to a reference plane x=x2. |
1068 | //----------------------------------------------------------------- |
1069 | |
1070 | Double_t dx=x2-x1; |
1071 | |
1072 | if (TMath::Abs(x[4]*x1 - x[2]) >= 0.999) { |
1073 | return kFALSE; |
1c53abe2 |
1074 | } |
f8aae377 |
1075 | |
91162307 |
1076 | Double_t c1=x[4]*x1 - x[2], r1=sqrt(1.- c1*c1); |
1077 | Double_t c2=x[4]*x2 - x[2], r2=sqrt(1.- c2*c2); |
1078 | y = x[0]; |
1079 | z = x[1]; |
1080 | |
1081 | Double_t dy = dx*(c1+c2)/(r1+r2); |
1082 | Double_t dz = 0; |
1083 | // |
1084 | Double_t delta = x[4]*dx*(c1+c2)/(c1*r2 + c2*r1); |
1085 | |
1086 | if (TMath::Abs(delta)>0.01){ |
1087 | dz = x[3]*TMath::ASin(delta)/x[4]; |
1088 | }else{ |
b67e07dc |
1089 | dz = x[3]*AliTPCFastMath::FastAsin(delta)/x[4]; |
91162307 |
1090 | } |
1091 | |
b67e07dc |
1092 | //dz = x[3]*AliTPCFastMath::FastAsin(delta)/x[4]; |
f8aae377 |
1093 | |
91162307 |
1094 | y+=dy; |
1095 | z+=dz; |
1096 | |
1097 | return kTRUE; |
1c53abe2 |
1098 | } |
1099 | |
d26d9159 |
1100 | Int_t AliTPCtrackerMI::LoadClusters (TTree *tree) |
1101 | { |
1102 | // |
1103 | // |
1104 | fInput = tree; |
1105 | return LoadClusters(); |
1106 | } |
91162307 |
1107 | |
1108 | Int_t AliTPCtrackerMI::LoadClusters() |
1c53abe2 |
1109 | { |
1110 | // |
1111 | // load clusters to the memory |
91162307 |
1112 | AliTPCClustersRow *clrow= new AliTPCClustersRow; |
1113 | clrow->SetClass("AliTPCclusterMI"); |
1114 | clrow->SetArray(0); |
1115 | clrow->GetArray()->ExpandCreateFast(10000); |
1116 | // |
1117 | // TTree * tree = fClustersArray.GetTree(); |
1118 | |
1119 | TTree * tree = fInput; |
1120 | TBranch * br = tree->GetBranch("Segment"); |
1121 | br->SetAddress(&clrow); |
1122 | // |
1123 | Int_t j=Int_t(tree->GetEntries()); |
1c53abe2 |
1124 | for (Int_t i=0; i<j; i++) { |
91162307 |
1125 | br->GetEntry(i); |
1126 | // |
1127 | Int_t sec,row; |
1128 | fParam->AdjustSectorRow(clrow->GetID(),sec,row); |
0201b65c |
1129 | for (Int_t icl=0; icl<clrow->GetArray()->GetEntriesFast(); icl++){ |
1130 | Transform((AliCluster*)(clrow->GetArray()->At(icl))); |
1131 | } |
91162307 |
1132 | // |
1133 | AliTPCRow * tpcrow=0; |
1134 | Int_t left=0; |
1135 | if (sec<fkNIS*2){ |
1136 | tpcrow = &(fInnerSec[sec%fkNIS][row]); |
1137 | left = sec/fkNIS; |
1138 | } |
1139 | else{ |
1140 | tpcrow = &(fOuterSec[(sec-fkNIS*2)%fkNOS][row]); |
1141 | left = (sec-fkNIS*2)/fkNOS; |
1142 | } |
1143 | if (left ==0){ |
1144 | tpcrow->fN1 = clrow->GetArray()->GetEntriesFast(); |
1145 | tpcrow->fClusters1 = new AliTPCclusterMI[tpcrow->fN1]; |
1146 | for (Int_t i=0;i<tpcrow->fN1;i++) |
1147 | tpcrow->fClusters1[i] = *(AliTPCclusterMI*)(clrow->GetArray()->At(i)); |
1148 | } |
1149 | if (left ==1){ |
1150 | tpcrow->fN2 = clrow->GetArray()->GetEntriesFast(); |
1151 | tpcrow->fClusters2 = new AliTPCclusterMI[tpcrow->fN2]; |
1152 | for (Int_t i=0;i<tpcrow->fN2;i++) |
1153 | tpcrow->fClusters2[i] = *(AliTPCclusterMI*)(clrow->GetArray()->At(i)); |
1154 | } |
1c53abe2 |
1155 | } |
91162307 |
1156 | // |
1157 | delete clrow; |
1158 | LoadOuterSectors(); |
1159 | LoadInnerSectors(); |
1160 | return 0; |
1c53abe2 |
1161 | } |
1162 | |
1163 | |
91162307 |
1164 | void AliTPCtrackerMI::UnloadClusters() |
1165 | { |
1166 | // |
1167 | // unload clusters from the memory |
1168 | // |
1169 | Int_t nrows = fOuterSec->GetNRows(); |
1170 | for (Int_t sec = 0;sec<fkNOS;sec++) |
1171 | for (Int_t row = 0;row<nrows;row++){ |
1172 | AliTPCRow* tpcrow = &(fOuterSec[sec%fkNOS][row]); |
982aff31 |
1173 | // if (tpcrow){ |
1174 | // if (tpcrow->fClusters1) delete []tpcrow->fClusters1; |
1175 | // if (tpcrow->fClusters2) delete []tpcrow->fClusters2; |
1176 | //} |
1177 | tpcrow->ResetClusters(); |
1c53abe2 |
1178 | } |
91162307 |
1179 | // |
1180 | nrows = fInnerSec->GetNRows(); |
1181 | for (Int_t sec = 0;sec<fkNIS;sec++) |
1182 | for (Int_t row = 0;row<nrows;row++){ |
1183 | AliTPCRow* tpcrow = &(fInnerSec[sec%fkNIS][row]); |
982aff31 |
1184 | //if (tpcrow){ |
1185 | // if (tpcrow->fClusters1) delete []tpcrow->fClusters1; |
1186 | //if (tpcrow->fClusters2) delete []tpcrow->fClusters2; |
1187 | //} |
1188 | tpcrow->ResetClusters(); |
91162307 |
1189 | } |
1190 | |
1191 | return ; |
1c53abe2 |
1192 | } |
1193 | |
0201b65c |
1194 | void AliTPCtrackerMI::Transform(AliCluster * cluster){ |
1195 | // |
1196 | // |
1197 | // |
1198 | //if (!fParam->IsGeoRead()) fParam->ReadGeoMatrices(); |
1199 | TGeoHMatrix *mat = fParam->GetClusterMatrix(cluster->GetDetector()); |
1200 | Double_t pos[3]= {cluster->GetX(),cluster->GetY(),cluster->GetZ()}; |
1201 | Double_t posC[3]; |
1202 | mat->LocalToMaster(pos,posC); |
1203 | cluster->SetX(posC[0]); |
1204 | cluster->SetY(posC[1]); |
1205 | cluster->SetZ(posC[2]); |
1206 | } |
1c53abe2 |
1207 | |
1208 | //_____________________________________________________________________________ |
91162307 |
1209 | Int_t AliTPCtrackerMI::LoadOuterSectors() { |
1c53abe2 |
1210 | //----------------------------------------------------------------- |
91162307 |
1211 | // This function fills outer TPC sectors with clusters. |
1c53abe2 |
1212 | //----------------------------------------------------------------- |
91162307 |
1213 | Int_t nrows = fOuterSec->GetNRows(); |
1214 | UInt_t index=0; |
1215 | for (Int_t sec = 0;sec<fkNOS;sec++) |
1216 | for (Int_t row = 0;row<nrows;row++){ |
1217 | AliTPCRow* tpcrow = &(fOuterSec[sec%fkNOS][row]); |
1218 | Int_t sec2 = sec+2*fkNIS; |
1219 | //left |
1220 | Int_t ncl = tpcrow->fN1; |
1221 | while (ncl--) { |
1222 | AliTPCclusterMI *c= &(tpcrow->fClusters1[ncl]); |
1223 | index=(((sec2<<8)+row)<<16)+ncl; |
1224 | tpcrow->InsertCluster(c,index); |
1225 | } |
1226 | //right |
1227 | ncl = tpcrow->fN2; |
1228 | while (ncl--) { |
1229 | AliTPCclusterMI *c= &(tpcrow->fClusters2[ncl]); |
1230 | index=((((sec2+fkNOS)<<8)+row)<<16)+ncl; |
1231 | tpcrow->InsertCluster(c,index); |
1232 | } |
1233 | // |
1234 | // write indexes for fast acces |
1235 | // |
1236 | for (Int_t i=0;i<510;i++) |
1237 | tpcrow->fFastCluster[i]=-1; |
1238 | for (Int_t i=0;i<tpcrow->GetN();i++){ |
1239 | Int_t zi = Int_t((*tpcrow)[i]->GetZ()+255.); |
1240 | tpcrow->fFastCluster[zi]=i; // write index |
1241 | } |
1242 | Int_t last = 0; |
1243 | for (Int_t i=0;i<510;i++){ |
1244 | if (tpcrow->fFastCluster[i]<0) |
1245 | tpcrow->fFastCluster[i] = last; |
1246 | else |
1247 | last = tpcrow->fFastCluster[i]; |
1248 | } |
1249 | } |
1250 | fN=fkNOS; |
1251 | fSectors=fOuterSec; |
1252 | return 0; |
1253 | } |
1254 | |
1255 | |
1256 | //_____________________________________________________________________________ |
1257 | Int_t AliTPCtrackerMI::LoadInnerSectors() { |
1258 | //----------------------------------------------------------------- |
1259 | // This function fills inner TPC sectors with clusters. |
1260 | //----------------------------------------------------------------- |
1261 | Int_t nrows = fInnerSec->GetNRows(); |
1262 | UInt_t index=0; |
1263 | for (Int_t sec = 0;sec<fkNIS;sec++) |
1264 | for (Int_t row = 0;row<nrows;row++){ |
1265 | AliTPCRow* tpcrow = &(fInnerSec[sec%fkNIS][row]); |
1266 | // |
1267 | //left |
1268 | Int_t ncl = tpcrow->fN1; |
1269 | while (ncl--) { |
1270 | AliTPCclusterMI *c= &(tpcrow->fClusters1[ncl]); |
1271 | index=(((sec<<8)+row)<<16)+ncl; |
1272 | tpcrow->InsertCluster(c,index); |
1273 | } |
1274 | //right |
1275 | ncl = tpcrow->fN2; |
1276 | while (ncl--) { |
1277 | AliTPCclusterMI *c= &(tpcrow->fClusters2[ncl]); |
1278 | index=((((sec+fkNIS)<<8)+row)<<16)+ncl; |
1279 | tpcrow->InsertCluster(c,index); |
1280 | } |
1281 | // |
1282 | // write indexes for fast acces |
1283 | // |
1284 | for (Int_t i=0;i<510;i++) |
1285 | tpcrow->fFastCluster[i]=-1; |
1286 | for (Int_t i=0;i<tpcrow->GetN();i++){ |
1287 | Int_t zi = Int_t((*tpcrow)[i]->GetZ()+255.); |
1288 | tpcrow->fFastCluster[zi]=i; // write index |
1289 | } |
1290 | Int_t last = 0; |
1291 | for (Int_t i=0;i<510;i++){ |
1292 | if (tpcrow->fFastCluster[i]<0) |
1293 | tpcrow->fFastCluster[i] = last; |
1294 | else |
1295 | last = tpcrow->fFastCluster[i]; |
1296 | } |
1c53abe2 |
1297 | |
91162307 |
1298 | } |
1299 | |
1c53abe2 |
1300 | fN=fkNIS; |
1301 | fSectors=fInnerSec; |
91162307 |
1302 | return 0; |
1303 | } |
1304 | |
1305 | |
1306 | |
1307 | //_________________________________________________________________________ |
1308 | AliTPCclusterMI *AliTPCtrackerMI::GetClusterMI(Int_t index) const { |
1309 | //-------------------------------------------------------------------- |
1310 | // Return pointer to a given cluster |
1311 | //-------------------------------------------------------------------- |
1312 | Int_t sec=(index&0xff000000)>>24; |
1313 | Int_t row=(index&0x00ff0000)>>16; |
d26d9159 |
1314 | Int_t ncl=(index&0x00007fff)>>00; |
91162307 |
1315 | |
1316 | const AliTPCRow * tpcrow=0; |
1317 | AliTPCclusterMI * clrow =0; |
3da363a1 |
1318 | |
ad23441a |
1319 | if (sec<0 || sec>=fkNIS*4) { |
1320 | AliWarning(Form("Wrong sector %d",sec)); |
1321 | return 0x0; |
1322 | } |
1323 | |
91162307 |
1324 | if (sec<fkNIS*2){ |
1325 | tpcrow = &(fInnerSec[sec%fkNIS][row]); |
3da363a1 |
1326 | if (tpcrow==0) return 0; |
1327 | |
1328 | if (sec<fkNIS) { |
1329 | if (tpcrow->fN1<=ncl) return 0; |
91162307 |
1330 | clrow = tpcrow->fClusters1; |
3da363a1 |
1331 | } |
1332 | else { |
1333 | if (tpcrow->fN2<=ncl) return 0; |
91162307 |
1334 | clrow = tpcrow->fClusters2; |
3da363a1 |
1335 | } |
91162307 |
1336 | } |
3da363a1 |
1337 | else { |
91162307 |
1338 | tpcrow = &(fOuterSec[(sec-fkNIS*2)%fkNOS][row]); |
3da363a1 |
1339 | if (tpcrow==0) return 0; |
1340 | |
1341 | if (sec-2*fkNIS<fkNOS) { |
1342 | if (tpcrow->fN1<=ncl) return 0; |
91162307 |
1343 | clrow = tpcrow->fClusters1; |
3da363a1 |
1344 | } |
1345 | else { |
1346 | if (tpcrow->fN2<=ncl) return 0; |
91162307 |
1347 | clrow = tpcrow->fClusters2; |
3da363a1 |
1348 | } |
91162307 |
1349 | } |
3da363a1 |
1350 | |
91162307 |
1351 | return &(clrow[ncl]); |
1352 | |
1c53abe2 |
1353 | } |
1354 | |
91162307 |
1355 | |
1356 | |
1c53abe2 |
1357 | Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) { |
1358 | //----------------------------------------------------------------- |
1359 | // This function tries to find a track prolongation to next pad row |
1360 | //----------------------------------------------------------------- |
1c53abe2 |
1361 | // |
91162307 |
1362 | Double_t x= GetXrow(nr), ymax=GetMaxY(nr); |
4d158c36 |
1363 | AliTPCclusterMI *cl=0; |
1364 | Int_t tpcindex= t.GetClusterIndex2(nr); |
1365 | // |
1366 | // update current shape info every 5 pad-row |
1367 | // if ( (nr%5==0) || t.GetNumberOfClusters()<2 || (t.fCurrentSigmaY2<0.0001) ){ |
1368 | GetShape(&t,nr); |
1369 | //} |
1370 | // |
1371 | if (fIteration>0 && tpcindex>=-1){ //if we have already clusters |
1372 | // |
1373 | if (tpcindex==-1) return 0; //track in dead zone |
1374 | if (tpcindex>0){ // |
1375 | cl = t.fClusterPointer[nr]; |
e0656451 |
1376 | if ( (cl==0) ) cl = GetClusterMI(tpcindex); |
4d158c36 |
1377 | t.fCurrentClusterIndex1 = tpcindex; |
1378 | } |
1379 | if (cl){ |
1380 | Int_t relativesector = ((tpcindex&0xff000000)>>24)%18; // if previously accepted cluster in different sector |
1381 | Float_t angle = relativesector*fSectors->GetAlpha()+fSectors->GetAlphaShift(); |
1382 | // |
1383 | if (angle<-TMath::Pi()) angle += 2*TMath::Pi(); |
1384 | if (angle>=TMath::Pi()) angle -= 2*TMath::Pi(); |
1385 | |
1386 | if (TMath::Abs(angle-t.GetAlpha())>0.001){ |
1387 | Double_t rotation = angle-t.GetAlpha(); |
1388 | t.fRelativeSector= relativesector; |
3f82c4f2 |
1389 | if (!t.Rotate(rotation)) return 0; |
4d158c36 |
1390 | } |
3f82c4f2 |
1391 | if (!t.PropagateTo(x)) return 0; |
4d158c36 |
1392 | // |
1393 | t.fCurrentCluster = cl; |
1394 | t.fRow = nr; |
1395 | Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.); |
1396 | if ((tpcindex&0x8000)==0) accept =0; |
1397 | if (accept<3) { |
1398 | //if founded cluster is acceptible |
1399 | if (cl->IsUsed(11)) { // id cluster is shared inrease uncertainty |
1400 | t.fErrorY2 += 0.03; |
1401 | t.fErrorZ2 += 0.03; |
1402 | t.fErrorY2 *= 3; |
1403 | t.fErrorZ2 *= 3; |
1404 | } |
1405 | t.fNFoundable++; |
1406 | UpdateTrack(&t,accept); |
1407 | return 1; |
1408 | } |
1409 | } |
1627d1c4 |
1410 | } |
3f82c4f2 |
1411 | if (TMath::Abs(t.GetSnp())>AliTPCReconstructor::GetMaxSnpTracker()) return 0; // cut on angle |
1412 | if (fIteration>1){ |
1413 | // not look for new cluster during refitting |
1414 | t.fNFoundable++; |
1415 | return 0; |
1416 | } |
91162307 |
1417 | // |
4d158c36 |
1418 | UInt_t index=0; |
ca142b1f |
1419 | // if (TMath::Abs(t.GetSnp())>0.95 || TMath::Abs(x*t.GetC()-t.GetEta())>0.95) return 0;// patch 28 fev 06 |
4d158c36 |
1420 | Double_t y=t.GetYat(x); |
91162307 |
1421 | if (TMath::Abs(y)>ymax){ |
1422 | if (y > ymax) { |
1423 | t.fRelativeSector= (t.fRelativeSector+1) % fN; |
1424 | if (!t.Rotate(fSectors->GetAlpha())) |
1425 | return 0; |
1426 | } else if (y <-ymax) { |
1427 | t.fRelativeSector= (t.fRelativeSector-1+fN) % fN; |
1428 | if (!t.Rotate(-fSectors->GetAlpha())) |
1429 | return 0; |
1430 | } |
4d158c36 |
1431 | //return 1; |
91162307 |
1432 | } |
1433 | // |
4d158c36 |
1434 | if (!t.PropagateTo(x)) { |
1435 | if (fIteration==0) t.fRemoval = 10; |
1436 | return 0; |
91162307 |
1437 | } |
4d158c36 |
1438 | y=t.GetY(); |
1439 | Double_t z=t.GetZ(); |
1440 | // |
91162307 |
1441 | const AliTPCRow &krow=GetRow(t.fRelativeSector,nr); |
1442 | if ( (t.GetSigmaY2()<0) || t.GetSigmaZ2()<0) return 0; |
1443 | Double_t roady =1.; |
1444 | Double_t roadz = 1.; |
1445 | // |
1c53abe2 |
1446 | if (TMath::Abs(TMath::Abs(y)-ymax)<krow.fDeadZone){ |
1447 | t.fInDead = kTRUE; |
91162307 |
1448 | t.SetClusterIndex2(nr,-1); |
1c53abe2 |
1449 | return 0; |
1450 | } |
1451 | else |
1452 | { |
3f82c4f2 |
1453 | if (TMath::Abs(z)<(AliTPCReconstructor::GetCtgRange()*x+10) && TMath::Abs(z)<fParam->GetZLength() && (TMath::Abs(t.GetSnp())<AliTPCReconstructor::GetMaxSnpTracker())) |
1454 | t.fNFoundable++; |
1627d1c4 |
1455 | else |
1456 | return 0; |
1c53abe2 |
1457 | } |
1458 | //calculate |
91162307 |
1459 | if (krow) { |
1460 | // cl = krow.FindNearest2(y+10.,z,roady,roadz,index); |
1461 | cl = krow.FindNearest2(y,z,roady,roadz,index); |
1462 | if (cl) t.fCurrentClusterIndex1 = krow.GetIndex(index); |
1463 | } |
91162307 |
1464 | if (cl) { |
1465 | t.fCurrentCluster = cl; |
1466 | t.fRow = nr; |
4d158c36 |
1467 | if (fIteration==2&&cl->IsUsed(10)) return 0; |
91162307 |
1468 | Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.); |
4d158c36 |
1469 | if (fIteration==2&&cl->IsUsed(11)) { |
1470 | t.fErrorY2 += 0.03; |
1471 | t.fErrorZ2 += 0.03; |
1472 | t.fErrorY2 *= 3; |
1473 | t.fErrorZ2 *= 3; |
1474 | } |
d26d9159 |
1475 | /* |
91162307 |
1476 | if (t.fCurrentCluster->IsUsed(10)){ |
1477 | // |
1478 | // |
c9427e08 |
1479 | |
91162307 |
1480 | t.fNShared++; |
1481 | if (t.fNShared>0.7*t.GetNumberOfClusters()) { |
1482 | t.fRemoval =10; |
1483 | return 0; |
1484 | } |
1485 | } |
d26d9159 |
1486 | */ |
91162307 |
1487 | if (accept<3) UpdateTrack(&t,accept); |
c9427e08 |
1488 | |
91162307 |
1489 | } else { |
982aff31 |
1490 | if ( fIteration==0 && t.fNFoundable*0.5 > t.GetNumberOfClusters()) t.fRemoval=10; |
91162307 |
1491 | |
1492 | } |
1493 | return 1; |
1494 | } |
c9427e08 |
1495 | |
91162307 |
1496 | Int_t AliTPCtrackerMI::FollowToNextFast(AliTPCseed& t, Int_t nr) { |
1497 | //----------------------------------------------------------------- |
1498 | // This function tries to find a track prolongation to next pad row |
1499 | //----------------------------------------------------------------- |
1500 | // |
1501 | Double_t x= GetXrow(nr), ymax=GetMaxY(nr); |
1502 | Double_t y,z; |
1503 | if (!t.GetProlongation(x,y,z)) { |
1504 | t.fRemoval = 10; |
1505 | return 0; |
1506 | } |
1507 | // |
1508 | // |
1509 | if (TMath::Abs(y)>ymax){ |
91162307 |
1510 | |
1c53abe2 |
1511 | if (y > ymax) { |
1512 | t.fRelativeSector= (t.fRelativeSector+1) % fN; |
1513 | if (!t.Rotate(fSectors->GetAlpha())) |
1514 | return 0; |
1515 | } else if (y <-ymax) { |
1516 | t.fRelativeSector= (t.fRelativeSector-1+fN) % fN; |
1517 | if (!t.Rotate(-fSectors->GetAlpha())) |
1518 | return 0; |
91162307 |
1519 | } |
1520 | if (!t.PropagateTo(x)) { |
1521 | return 0; |
1522 | } |
1523 | t.GetProlongation(x,y,z); |
1524 | } |
1525 | // |
1526 | // update current shape info every 3 pad-row |
1527 | if ( (nr%6==0) || t.GetNumberOfClusters()<2 || (t.fCurrentSigmaY2<0.0001) ){ |
1528 | // t.fCurrentSigmaY = GetSigmaY(&t); |
1529 | //t.fCurrentSigmaZ = GetSigmaZ(&t); |
1530 | GetShape(&t,nr); |
1531 | } |
1532 | // |
1533 | AliTPCclusterMI *cl=0; |
1534 | UInt_t index=0; |
1535 | |
1536 | |
1537 | //Int_t nr2 = nr; |
1538 | const AliTPCRow &krow=GetRow(t.fRelativeSector,nr); |
1539 | if ( (t.GetSigmaY2()<0) || t.GetSigmaZ2()<0) return 0; |
1540 | Double_t roady =1.; |
1541 | Double_t roadz = 1.; |
1542 | // |
1543 | Int_t row = nr; |
1544 | if (TMath::Abs(TMath::Abs(y)-ymax)<krow.fDeadZone){ |
1545 | t.fInDead = kTRUE; |
1546 | t.SetClusterIndex2(row,-1); |
1547 | return 0; |
1548 | } |
1549 | else |
1550 | { |
d7a11555 |
1551 | if (TMath::Abs(z)>(AliTPCReconstructor::GetCtgRange()*x+10)) t.SetClusterIndex2(row,-1); |
1c53abe2 |
1552 | } |
91162307 |
1553 | //calculate |
1554 | |
1555 | if ((cl==0)&&(krow)) { |
1556 | // cl = krow.FindNearest2(y+10,z,roady,roadz,index); |
1557 | cl = krow.FindNearest2(y,z,roady,roadz,index); |
1558 | |
1559 | if (cl) t.fCurrentClusterIndex1 = krow.GetIndex(index); |
1560 | } |
1561 | |
1562 | if (cl) { |
1563 | t.fCurrentCluster = cl; |
1564 | // Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.); |
1565 | //if (accept<3){ |
1566 | t.SetClusterIndex2(row,index); |
1567 | t.fClusterPointer[row] = cl; |
1568 | //} |
1c53abe2 |
1569 | } |
1570 | return 1; |
1571 | } |
1572 | |
1573 | |
91162307 |
1574 | |
5d837844 |
1575 | //_________________________________________________________________________ |
1576 | Bool_t AliTPCtrackerMI::GetTrackPoint(Int_t index, AliTrackPoint &p ) const |
1577 | { |
1578 | // Get track space point by index |
1579 | // return false in case the cluster doesn't exist |
1580 | AliTPCclusterMI *cl = GetClusterMI(index); |
1581 | if (!cl) return kFALSE; |
1582 | Int_t sector = (index&0xff000000)>>24; |
0201b65c |
1583 | // Int_t row = (index&0x00ff0000)>>16; |
5d837844 |
1584 | Float_t xyz[3]; |
0201b65c |
1585 | // xyz[0] = fParam->GetPadRowRadii(sector,row); |
1586 | xyz[0] = cl->GetX(); |
5d837844 |
1587 | xyz[1] = cl->GetY(); |
1588 | xyz[2] = cl->GetZ(); |
1589 | Float_t sin,cos; |
1590 | fParam->AdjustCosSin(sector,cos,sin); |
1591 | Float_t x = cos*xyz[0]-sin*xyz[1]; |
1592 | Float_t y = cos*xyz[1]+sin*xyz[0]; |
1593 | Float_t cov[6]; |
1594 | Float_t sigmaY2 = 0.027*cl->GetSigmaY2(); |
1595 | if (sector < fParam->GetNInnerSector()) sigmaY2 *= 2.07; |
1596 | Float_t sigmaZ2 = 0.066*cl->GetSigmaZ2(); |
1597 | if (sector < fParam->GetNInnerSector()) sigmaZ2 *= 1.77; |
1598 | cov[0] = sin*sin*sigmaY2; |
1599 | cov[1] = -sin*cos*sigmaY2; |
1600 | cov[2] = 0.; |
1601 | cov[3] = cos*cos*sigmaY2; |
1602 | cov[4] = 0.; |
1603 | cov[5] = sigmaZ2; |
1604 | p.SetXYZ(x,y,xyz[2],cov); |
1605 | AliAlignObj::ELayerID iLayer; |
1606 | Int_t idet; |
1607 | if (sector < fParam->GetNInnerSector()) { |
1608 | iLayer = AliAlignObj::kTPC1; |
1609 | idet = sector; |
1610 | } |
1611 | else { |
1612 | iLayer = AliAlignObj::kTPC2; |
1613 | idet = sector - fParam->GetNInnerSector(); |
1614 | } |
1615 | UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,idet); |
1616 | p.SetVolumeID(volid); |
1617 | return kTRUE; |
1618 | } |
1619 | |
1620 | |
1621 | |
91162307 |
1622 | Int_t AliTPCtrackerMI::UpdateClusters(AliTPCseed& t, Int_t nr) { |
1c53abe2 |
1623 | //----------------------------------------------------------------- |
1624 | // This function tries to find a track prolongation to next pad row |
1625 | //----------------------------------------------------------------- |
1626 | t.fCurrentCluster = 0; |
1627 | t.fCurrentClusterIndex1 = 0; |
1c53abe2 |
1628 | |
1629 | Double_t xt=t.GetX(); |
91162307 |
1630 | Int_t row = GetRowNumber(xt)-1; |
1631 | Double_t ymax= GetMaxY(nr); |
1632 | |
1c53abe2 |
1633 | if (row < nr) return 1; // don't prolongate if not information until now - |
ca142b1f |
1634 | // if (TMath::Abs(t.GetSnp())>0.9 && t.GetNumberOfClusters()>40. && fIteration!=2) { |
1635 | // t.fRemoval =10; |
1636 | // return 0; // not prolongate strongly inclined tracks |
1637 | // } |
1638 | // if (TMath::Abs(t.GetSnp())>0.95) { |
1639 | // t.fRemoval =10; |
1640 | // return 0; // not prolongate strongly inclined tracks |
1641 | // }// patch 28 fev 06 |
91162307 |
1642 | |
1643 | Double_t x= GetXrow(nr); |
1644 | Double_t y,z; |
1645 | //t.PropagateTo(x+0.02); |
1646 | //t.PropagateTo(x+0.01); |
1627d1c4 |
1647 | if (!t.PropagateTo(x)){ |
1627d1c4 |
1648 | return 0; |
1649 | } |
1c53abe2 |
1650 | // |
91162307 |
1651 | y=t.GetY(); |
1652 | z=t.GetZ(); |
1c53abe2 |
1653 | |
91162307 |
1654 | if (TMath::Abs(y)>ymax){ |
1655 | if (y > ymax) { |
1656 | t.fRelativeSector= (t.fRelativeSector+1) % fN; |
1657 | if (!t.Rotate(fSectors->GetAlpha())) |
1658 | return 0; |
1659 | } else if (y <-ymax) { |
1660 | t.fRelativeSector= (t.fRelativeSector-1+fN) % fN; |
1661 | if (!t.Rotate(-fSectors->GetAlpha())) |
1662 | return 0; |
1663 | } |
982aff31 |
1664 | // if (!t.PropagateTo(x)){ |
1665 | // return 0; |
1666 | //} |
1667 | return 1; |
1668 | //y = t.GetY(); |
1c53abe2 |
1669 | } |
91162307 |
1670 | // |
3f82c4f2 |
1671 | if (TMath::Abs(t.GetSnp())>AliTPCReconstructor::GetMaxSnpTracker()) return 0; |
91162307 |
1672 | AliTPCRow &krow=GetRow(t.fRelativeSector,nr); |
1c53abe2 |
1673 | |
1674 | if (TMath::Abs(TMath::Abs(y)-ymax)<krow.fDeadZone){ |
1675 | t.fInDead = kTRUE; |
91162307 |
1676 | t.SetClusterIndex2(nr,-1); |
1c53abe2 |
1677 | return 0; |
1678 | } |
1679 | else |
1680 | { |
3f82c4f2 |
1681 | if (TMath::Abs(t.GetZ())<(AliTPCReconstructor::GetCtgRange()*t.GetX()+10) && (TMath::Abs(t.GetSnp())<AliTPCReconstructor::GetMaxSnpTracker())) t.fNFoundable++; |
1627d1c4 |
1682 | else |
1683 | return 0; |
1c53abe2 |
1684 | } |
1c53abe2 |
1685 | |
91162307 |
1686 | // update current |
1687 | if ( (nr%6==0) || t.GetNumberOfClusters()<2){ |
1688 | // t.fCurrentSigmaY = GetSigmaY(&t); |
1689 | //t.fCurrentSigmaZ = GetSigmaZ(&t); |
1690 | GetShape(&t,nr); |
1691 | } |
1c53abe2 |
1692 | |
91162307 |
1693 | AliTPCclusterMI *cl=0; |
d184f295 |
1694 | Int_t index=0; |
91162307 |
1695 | // |
1696 | Double_t roady = 1.; |
1697 | Double_t roadz = 1.; |
1698 | // |
d26d9159 |
1699 | |
1700 | if (!cl){ |
1701 | index = t.GetClusterIndex2(nr); |
1702 | if ( (index>0) && (index&0x8000)==0){ |
1703 | cl = t.fClusterPointer[nr]; |
1704 | if ( (cl==0) && (index>0)) cl = GetClusterMI(index); |
1705 | t.fCurrentClusterIndex1 = index; |
1706 | if (cl) { |
1707 | t.fCurrentCluster = cl; |
1708 | return 1; |
1709 | } |
1710 | } |
1711 | } |
1712 | |
3d172d79 |
1713 | // if (index<0) return 0; |
1714 | UInt_t uindex = TMath::Abs(index); |
d184f295 |
1715 | |
91162307 |
1716 | if (krow) { |
d184f295 |
1717 | //cl = krow.FindNearest2(y+10,z,roady,roadz,uindex); |
1718 | cl = krow.FindNearest2(y,z,roady,roadz,uindex); |
91162307 |
1719 | } |
d26d9159 |
1720 | |
d184f295 |
1721 | if (cl) t.fCurrentClusterIndex1 = krow.GetIndex(uindex); |
d26d9159 |
1722 | t.fCurrentCluster = cl; |
1723 | |
91162307 |
1724 | return 1; |
1725 | } |
1c53abe2 |
1726 | |
1c53abe2 |
1727 | |
91162307 |
1728 | Int_t AliTPCtrackerMI::FollowToNextCluster(AliTPCseed & t, Int_t nr) { |
1729 | //----------------------------------------------------------------- |
1730 | // This function tries to find a track prolongation to next pad row |
1731 | //----------------------------------------------------------------- |
1c53abe2 |
1732 | |
91162307 |
1733 | //update error according neighborhoud |
1c53abe2 |
1734 | |
91162307 |
1735 | if (t.fCurrentCluster) { |
1736 | t.fRow = nr; |
8c51a605 |
1737 | Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.); |
91162307 |
1738 | |
1739 | if (t.fCurrentCluster->IsUsed(10)){ |
1740 | // |
1741 | // |
1742 | // t.fErrorZ2*=2; |
1743 | // t.fErrorY2*=2; |
1744 | t.fNShared++; |
1745 | if (t.fNShared>0.7*t.GetNumberOfClusters()) { |
1746 | t.fRemoval =10; |
1747 | return 0; |
1748 | } |
b364ca79 |
1749 | } |
d26d9159 |
1750 | if (fIteration>0) accept = 0; |
b364ca79 |
1751 | if (accept<3) UpdateTrack(&t,accept); |
1752 | |
1c53abe2 |
1753 | } else { |
91162307 |
1754 | if (fIteration==0){ |
1755 | if ( ( (t.GetSigmaY2()+t.GetSigmaZ2())>0.16)&& t.GetNumberOfClusters()>18) t.fRemoval=10; |
1756 | if ( t.GetChi2()/t.GetNumberOfClusters()>6 &&t.GetNumberOfClusters()>18) t.fRemoval=10; |
1757 | |
1758 | if (( (t.fNFoundable*0.5 > t.GetNumberOfClusters()) || t.fNoCluster>15)) t.fRemoval=10; |
1c53abe2 |
1759 | } |
1760 | } |
1761 | return 1; |
1762 | } |
1763 | |
1764 | |
1765 | |
91162307 |
1766 | //_____________________________________________________________________________ |
1767 | Int_t AliTPCtrackerMI::FollowProlongation(AliTPCseed& t, Int_t rf, Int_t step) { |
1c53abe2 |
1768 | //----------------------------------------------------------------- |
91162307 |
1769 | // This function tries to find a track prolongation. |
1c53abe2 |
1770 | //----------------------------------------------------------------- |
1771 | Double_t xt=t.GetX(); |
1772 | // |
91162307 |
1773 | Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); |
1c53abe2 |
1774 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); |
1775 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); |
91162307 |
1776 | // |
1777 | t.fRelativeSector = Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN; |
1c53abe2 |
1778 | |
91162307 |
1779 | Int_t first = GetRowNumber(xt)-1; |
51ad6848 |
1780 | for (Int_t nr= first; nr>=rf; nr-=step) { |
1781 | // update kink info |
1782 | if (t.GetKinkIndexes()[0]>0){ |
1783 | for (Int_t i=0;i<3;i++){ |
1784 | Int_t index = t.GetKinkIndexes()[i]; |
1785 | if (index==0) break; |
1786 | if (index<0) continue; |
1787 | // |
1788 | AliESDkink * kink = fEvent->GetKink(index-1); |
1789 | if (!kink){ |
1790 | printf("PROBLEM\n"); |
1791 | } |
1792 | else{ |
eea478d3 |
1793 | Int_t kinkrow = kink->GetTPCRow0()+2+Int_t(0.5/(0.05+kink->GetAngle(2))); |
51ad6848 |
1794 | if (kinkrow==nr){ |
1795 | AliExternalTrackParam paramd(t); |
1796 | kink->SetDaughter(paramd); |
eea478d3 |
1797 | kink->SetStatus(2,5); |
51ad6848 |
1798 | kink->Update(); |
51ad6848 |
1799 | } |
1800 | } |
1801 | } |
1802 | } |
1803 | |
1804 | if (nr==80) t.UpdateReference(); |
982aff31 |
1805 | if (nr<fInnerSec->GetNRows()) |
1806 | fSectors = fInnerSec; |
1807 | else |
1808 | fSectors = fOuterSec; |
91162307 |
1809 | if (FollowToNext(t,nr)==0) |
4d158c36 |
1810 | if (!t.IsActive()) |
1811 | return 0; |
91162307 |
1812 | |
1813 | } |
1814 | return 1; |
1815 | } |
1816 | |
1c53abe2 |
1817 | |
1818 | //_____________________________________________________________________________ |
91162307 |
1819 | Int_t AliTPCtrackerMI::FollowProlongationFast(AliTPCseed& t, Int_t rf, Int_t step) { |
1c53abe2 |
1820 | //----------------------------------------------------------------- |
1821 | // This function tries to find a track prolongation. |
1822 | //----------------------------------------------------------------- |
1823 | Double_t xt=t.GetX(); |
1824 | // |
1825 | Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); |
1826 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); |
1827 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); |
91162307 |
1828 | t.fRelativeSector = Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN; |
1829 | |
1830 | for (Int_t nr=GetRowNumber(xt)-1; nr>=rf; nr-=step) { |
1831 | |
1832 | if (FollowToNextFast(t,nr)==0) |
1833 | if (!t.IsActive()) return 0; |
1c53abe2 |
1834 | |
1c53abe2 |
1835 | } |
1836 | return 1; |
1837 | } |
1838 | |
1839 | |
91162307 |
1840 | |
1841 | |
1842 | |
1c53abe2 |
1843 | Int_t AliTPCtrackerMI::FollowBackProlongation(AliTPCseed& t, Int_t rf) { |
1844 | //----------------------------------------------------------------- |
1845 | // This function tries to find a track prolongation. |
1846 | //----------------------------------------------------------------- |
1c53abe2 |
1847 | // |
eea478d3 |
1848 | Double_t xt=t.GetX(); |
1c53abe2 |
1849 | Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); |
1850 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); |
1851 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); |
91162307 |
1852 | t.fRelativeSector = Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN; |
1c53abe2 |
1853 | |
4d158c36 |
1854 | Int_t first = t.fFirstPoint; |
eea478d3 |
1855 | if (first<GetRowNumber(xt)+1) first = GetRowNumber(xt)+1; |
91162307 |
1856 | // |
1857 | if (first<0) first=0; |
4d158c36 |
1858 | for (Int_t nr=first; nr<=rf; nr++) { |
ca142b1f |
1859 | // if ( (TMath::Abs(t.GetSnp())>0.95)) break;//patch 28 fev 06 |
51ad6848 |
1860 | if (t.GetKinkIndexes()[0]<0){ |
1861 | for (Int_t i=0;i<3;i++){ |
1862 | Int_t index = t.GetKinkIndexes()[i]; |
1863 | if (index==0) break; |
1864 | if (index>0) continue; |
1865 | index = TMath::Abs(index); |
1866 | AliESDkink * kink = fEvent->GetKink(index-1); |
1867 | if (!kink){ |
1868 | printf("PROBLEM\n"); |
1869 | } |
1870 | else{ |
eea478d3 |
1871 | Int_t kinkrow = kink->GetTPCRow0()-2-Int_t(0.5/(0.05+kink->GetAngle(2))); |
51ad6848 |
1872 | if (kinkrow==nr){ |
1873 | AliExternalTrackParam paramm(t); |
1874 | kink->SetMother(paramm); |
eea478d3 |
1875 | kink->SetStatus(2,1); |
51ad6848 |
1876 | kink->Update(); |
51ad6848 |
1877 | } |
1878 | } |
eea478d3 |
1879 | } |
51ad6848 |
1880 | } |
eea478d3 |
1881 | // |
d26d9159 |
1882 | if (nr<fInnerSec->GetNRows()) |
1883 | fSectors = fInnerSec; |
1884 | else |
1885 | fSectors = fOuterSec; |
1886 | FollowToNext(t,nr); |
1c53abe2 |
1887 | } |
1888 | return 1; |
1889 | } |
1890 | |
1891 | |
1892 | |
1893 | |
1894 | |
1895 | Float_t AliTPCtrackerMI::OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t & sum2) |
1896 | { |
1897 | // |
1898 | // |
1899 | sum1=0; |
1900 | sum2=0; |
1901 | Int_t sum=0; |
1c53abe2 |
1902 | // |
1903 | Float_t dz2 =(s1->GetZ() - s2->GetZ()); |
c9427e08 |
1904 | dz2*=dz2; |
91162307 |
1905 | |
c9427e08 |
1906 | Float_t dy2 =TMath::Abs((s1->GetY() - s2->GetY())); |
1c53abe2 |
1907 | dy2*=dy2; |
1908 | Float_t distance = TMath::Sqrt(dz2+dy2); |
c9427e08 |
1909 | if (distance>4.) return 0; // if there are far away - not overlap - to reduce combinatorics |
1c53abe2 |
1910 | |
91162307 |
1911 | // Int_t offset =0; |
c9427e08 |
1912 | Int_t firstpoint = TMath::Min(s1->fFirstPoint,s2->fFirstPoint); |
1913 | Int_t lastpoint = TMath::Max(s1->fLastPoint,s2->fLastPoint); |
c9427e08 |
1914 | if (lastpoint>160) |
1915 | lastpoint =160; |
1916 | if (firstpoint<0) |
1917 | firstpoint = 0; |
91162307 |
1918 | if (firstpoint>lastpoint) { |
1919 | firstpoint =lastpoint; |
1920 | // lastpoint =160; |
c9427e08 |
1921 | } |
1922 | |
1923 | |
91162307 |
1924 | for (Int_t i=firstpoint-1;i<lastpoint+1;i++){ |
1925 | if (s1->GetClusterIndex2(i)>0) sum1++; |
1926 | if (s2->GetClusterIndex2(i)>0) sum2++; |
1927 | if (s1->GetClusterIndex2(i)==s2->GetClusterIndex2(i) && s1->GetClusterIndex2(i)>0) { |
1c53abe2 |
1928 | sum++; |
1929 | } |
1930 | } |
91162307 |
1931 | if (sum<5) return 0; |
1932 | |
1627d1c4 |
1933 | Float_t summin = TMath::Min(sum1+1,sum2+1); |
1934 | Float_t ratio = (sum+1)/Float_t(summin); |
1c53abe2 |
1935 | return ratio; |
1936 | } |
1937 | |
1938 | void AliTPCtrackerMI::SignShared(AliTPCseed * s1, AliTPCseed * s2) |
1939 | { |
1940 | // |
1941 | // |
91162307 |
1942 | if (TMath::Abs(s1->GetC()-s2->GetC())>0.004) return; |
1943 | if (TMath::Abs(s1->GetTgl()-s2->GetTgl())>0.6) return; |
1944 | |
1c53abe2 |
1945 | Float_t dz2 =(s1->GetZ() - s2->GetZ()); |
1946 | dz2*=dz2; |
1947 | Float_t dy2 =(s1->GetY() - s2->GetY()); |
1948 | dy2*=dy2; |
91162307 |
1949 | Float_t distance = dz2+dy2; |
1950 | if (distance>325.) return ; // if there are far away - not overlap - to reduce combinatorics |
1951 | |
1c53abe2 |
1952 | // |
91162307 |
1953 | Int_t sumshared=0; |
1954 | // |
1955 | Int_t firstpoint = TMath::Max(s1->fFirstPoint,s2->fFirstPoint); |
1956 | Int_t lastpoint = TMath::Min(s1->fLastPoint,s2->fLastPoint); |
1957 | // |
1958 | if (firstpoint>=lastpoint-5) return;; |
1c53abe2 |
1959 | |
91162307 |
1960 | for (Int_t i=firstpoint;i<lastpoint;i++){ |
1961 | // if ( (s1->GetClusterIndex2(i)&0xFFFF8FFF)==(s2->GetClusterIndex2(i)&0xFFFF8FFF) && s1->GetClusterIndex2(i)>0) { |
1962 | if ( (s1->GetClusterIndex2(i))==(s2->GetClusterIndex2(i)) && s1->GetClusterIndex2(i)>0) { |
1963 | sumshared++; |
1964 | } |
1965 | } |
1966 | if (sumshared>4){ |
1967 | // sign clusters |
1968 | // |
1969 | for (Int_t i=firstpoint;i<lastpoint;i++){ |
1970 | // if ( (s1->GetClusterIndex2(i)&0xFFFF8FFF)==(s2->GetClusterIndex2(i)&0xFFFF8FFF) && s1->GetClusterIndex2(i)>0) { |
1971 | if ( (s1->GetClusterIndex2(i))==(s2->GetClusterIndex2(i)) && s1->GetClusterIndex2(i)>0) { |
1972 | AliTPCTrackerPoint *p1 = s1->GetTrackPoint(i); |
1973 | AliTPCTrackerPoint *p2 = s2->GetTrackPoint(i);; |
1974 | if (s1->IsActive()&&s2->IsActive()){ |
1975 | p1->fIsShared = kTRUE; |
1976 | p2->fIsShared = kTRUE; |
1977 | } |
1978 | } |
1979 | } |
1980 | } |
1981 | // |
1982 | if (sumshared>10){ |
1983 | for (Int_t i=0;i<4;i++){ |
1984 | if (s1->fOverlapLabels[3*i]==0){ |
1985 | s1->fOverlapLabels[3*i] = s2->GetLabel(); |
1986 | s1->fOverlapLabels[3*i+1] = sumshared; |
1987 | s1->fOverlapLabels[3*i+2] = s2->GetUniqueID(); |
1988 | break; |
1989 | } |
1990 | } |
1991 | for (Int_t i=0;i<4;i++){ |
1992 | if (s2->fOverlapLabels[3*i]==0){ |
1993 | s2->fOverlapLabels[3*i] = s1->GetLabel(); |
1994 | s2->fOverlapLabels[3*i+1] = sumshared; |
1995 | s2->fOverlapLabels[3*i+2] = s1->GetUniqueID(); |
1996 | break; |
1997 | } |
1998 | } |
1999 | } |
1c53abe2 |
2000 | |
91162307 |
2001 | } |
1c53abe2 |
2002 | |
91162307 |
2003 | void AliTPCtrackerMI::SignShared(TObjArray * arr) |
2004 | { |
1c53abe2 |
2005 | // |
91162307 |
2006 | //sort trackss according sectors |
2007 | // |
c9427e08 |
2008 | for (Int_t i=0; i<arr->GetEntriesFast(); i++) { |
2009 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
91162307 |
2010 | if (!pt) continue; |
2011 | //if (pt) RotateToLocal(pt); |
2012 | pt->fSort = 0; |
c9427e08 |
2013 | } |
91162307 |
2014 | arr->UnSort(); |
1c53abe2 |
2015 | arr->Sort(); // sorting according z |
2016 | arr->Expand(arr->GetEntries()); |
91162307 |
2017 | // |
2018 | // |
1c53abe2 |
2019 | Int_t nseed=arr->GetEntriesFast(); |
1c53abe2 |
2020 | for (Int_t i=0; i<nseed; i++) { |
2021 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
91162307 |
2022 | if (!pt) continue; |
2023 | for (Int_t j=0;j<=12;j++){ |
2024 | pt->fOverlapLabels[j] =0; |
1c53abe2 |
2025 | } |
91162307 |
2026 | } |
2027 | for (Int_t i=0; i<nseed; i++) { |
2028 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2029 | if (!pt) continue; |
2030 | if (pt->fRemoval>10) continue; |
1c53abe2 |
2031 | for (Int_t j=i+1; j<nseed; j++){ |
2032 | AliTPCseed *pt2=(AliTPCseed*)arr->UncheckedAt(j); |
91162307 |
2033 | // if (pt2){ |
2034 | if (pt2->fRemoval<=10) { |
2035 | if ( TMath::Abs(pt->fRelativeSector-pt2->fRelativeSector)>0) break; |
2036 | SignShared(pt,pt2); |
c9427e08 |
2037 | } |
91162307 |
2038 | } |
2039 | } |
2040 | } |
2041 | |
2042 | void AliTPCtrackerMI::RemoveDouble(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex) |
2043 | { |
2044 | // |
2045 | //sort trackss according sectors |
2046 | // |
2047 | if (fDebug&1) { |
6bdc18d6 |
2048 | Info("RemoveDouble","Number of tracks before double removal- %d\n",arr->GetEntries()); |
91162307 |
2049 | } |
2050 | // |
2051 | for (Int_t i=0; i<arr->GetEntriesFast(); i++) { |
2052 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2053 | if (!pt) continue; |
2054 | pt->fSort = 0; |
2055 | } |
2056 | arr->UnSort(); |
2057 | arr->Sort(); // sorting according z |
2058 | arr->Expand(arr->GetEntries()); |
2059 | // |
2060 | //reset overlap labels |
2061 | // |
2062 | Int_t nseed=arr->GetEntriesFast(); |
2063 | for (Int_t i=0; i<nseed; i++) { |
2064 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2065 | if (!pt) continue; |
2066 | pt->SetUniqueID(i); |
2067 | for (Int_t j=0;j<=12;j++){ |
2068 | pt->fOverlapLabels[j] =0; |
1c53abe2 |
2069 | } |
2070 | } |
91162307 |
2071 | // |
2072 | //sign shared tracks |
1c53abe2 |
2073 | for (Int_t i=0; i<nseed; i++) { |
2074 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
91162307 |
2075 | if (!pt) continue; |
2076 | if (pt->fRemoval>10) continue; |
2077 | Float_t deltac = pt->GetC()*0.1; |
2078 | for (Int_t j=i+1; j<nseed; j++){ |
2079 | AliTPCseed *pt2=(AliTPCseed*)arr->UncheckedAt(j); |
2080 | // if (pt2){ |
2081 | if (pt2->fRemoval<=10) { |
2082 | if ( TMath::Abs(pt->fRelativeSector-pt2->fRelativeSector)>0) break; |
2083 | if (TMath::Abs(pt->GetC() -pt2->GetC())>deltac) continue; |
2084 | if (TMath::Abs(pt->GetTgl()-pt2->GetTgl())>0.05) continue; |
2085 | // |
2086 | SignShared(pt,pt2); |
2087 | } |
1c53abe2 |
2088 | } |
1c53abe2 |
2089 | } |
91162307 |
2090 | // |
2091 | // remove highly shared tracks |
2092 | for (Int_t i=0; i<nseed; i++) { |
2093 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2094 | if (!pt) continue; |
2095 | if (pt->fRemoval>10) continue; |
2096 | // |
2097 | Int_t sumshared =0; |
2098 | for (Int_t j=0;j<4;j++){ |
2099 | sumshared = pt->fOverlapLabels[j*3+1]; |
2100 | } |
2101 | Float_t factor = factor1; |
2102 | if (pt->fRemoval>0) factor = factor2; |
2103 | if (sumshared/pt->GetNumberOfClusters()>factor){ |
2104 | for (Int_t j=0;j<4;j++){ |
2105 | if (pt->fOverlapLabels[3*j]==0) continue; |
2106 | if (pt->fOverlapLabels[3*j+1]<5) continue; |
2107 | if (pt->fRemoval==removalindex) continue; |
2108 | AliTPCseed * pt2 = (AliTPCseed*)arr->UncheckedAt(pt->fOverlapLabels[3*j+2]); |
2109 | if (!pt2) continue; |
2110 | if (pt2->GetSigma2C()<pt->GetSigma2C()){ |
2111 | // pt->fRemoval = removalindex; |
2112 | delete arr->RemoveAt(i); |
2113 | break; |
1c53abe2 |
2114 | } |
91162307 |
2115 | } |
1c53abe2 |
2116 | } |
91162307 |
2117 | } |
2118 | arr->Compress(); |
2119 | if (fDebug&1) { |
6bdc18d6 |
2120 | Info("RemoveDouble","Number of tracks after double removal- %d\n",arr->GetEntries()); |
91162307 |
2121 | } |
2122 | } |
2123 | |
2124 | |
2125 | |
1c53abe2 |
2126 | |
2127 | |
91162307 |
2128 | |
47966a6d |
2129 | void AliTPCtrackerMI::SortTracks(TObjArray * arr, Int_t mode) const |
91162307 |
2130 | { |
2131 | // |
2132 | //sort tracks in array according mode criteria |
2133 | Int_t nseed = arr->GetEntriesFast(); |
2134 | for (Int_t i=0; i<nseed; i++) { |
2135 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2136 | if (!pt) { |
2137 | continue; |
2138 | } |
2139 | pt->fSort = mode; |
2140 | } |
2141 | arr->UnSort(); |
2142 | arr->Sort(); |
1c53abe2 |
2143 | } |
c9427e08 |
2144 | |
91162307 |
2145 | void AliTPCtrackerMI::RemoveUsed(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex) |
c9427e08 |
2146 | { |
2147 | |
2148 | //Loop over all tracks and remove "overlaps" |
2149 | // |
2150 | // |
2151 | Int_t nseed = arr->GetEntriesFast(); |
2152 | Int_t good =0; |
91162307 |
2153 | |
c9427e08 |
2154 | for (Int_t i=0; i<nseed; i++) { |
2155 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2156 | if (!pt) { |
91162307 |
2157 | delete arr->RemoveAt(i); |
c9427e08 |
2158 | } |
91162307 |
2159 | else{ |
2160 | pt->fSort =1; |
2161 | pt->fBSigned = kFALSE; |
c9427e08 |
2162 | } |
91162307 |
2163 | } |
2164 | arr->Compress(); |
2165 | nseed = arr->GetEntriesFast(); |
2166 | arr->UnSort(); |
2167 | arr->Sort(); |
2168 | // |
2169 | //unsign used |
2170 | UnsignClusters(); |
2171 | // |
2172 | for (Int_t i=0; i<nseed; i++) { |
2173 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2174 | if (!pt) { |
2175 | continue; |
2176 | } |
2177 | Int_t found,foundable,shared; |
2178 | if (pt->IsActive()) |
2179 | pt->GetClusterStatistic(0,160,found, foundable,shared,kFALSE); |
2180 | else |
2181 | pt->GetClusterStatistic(0,160,found, foundable,shared,kTRUE); |
2182 | // |
2183 | Double_t factor = factor2; |
2184 | if (pt->fBConstrain) factor = factor1; |
2185 | |
2186 | if ((Float_t(shared)/Float_t(found))>factor){ |
c9427e08 |
2187 | pt->Desactivate(removalindex); |
91162307 |
2188 | continue; |
2189 | } |
2190 | |
2191 | good++; |
2192 | for (Int_t i=0; i<160; i++) { |
2193 | Int_t index=pt->GetClusterIndex2(i); |
2194 | if (index<0 || index&0x8000 ) continue; |
2195 | AliTPCclusterMI *c= pt->fClusterPointer[i]; |
2196 | if (!c) continue; |
2197 | // if (!c->IsUsed(10)) c->Use(10); |
2198 | //if (pt->IsActive()) |
2199 | c->Use(10); |
2200 | //else |
2201 | // c->Use(5); |
c9427e08 |
2202 | } |
91162307 |
2203 | |
c9427e08 |
2204 | } |
2205 | fNtracks = good; |
6bdc18d6 |
2206 | if (fDebug>0){ |
2207 | Info("RemoveUsed","\n*****\nNumber of good tracks after shared removal\t%d\n",fNtracks); |
2208 | } |
c9427e08 |
2209 | } |
2210 | |
51ad6848 |
2211 | |
2212 | void AliTPCtrackerMI::RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal) |
2213 | { |
2214 | |
2215 | //Loop over all tracks and remove "overlaps" |
2216 | // |
2217 | // |
2218 | UnsignClusters(); |
2219 | // |
2220 | Int_t nseed = arr->GetEntriesFast(); |
2221 | Float_t * quality = new Float_t[nseed]; |
2222 | Int_t * indexes = new Int_t[nseed]; |
2223 | Int_t good =0; |
2224 | // |
2225 | // |
2226 | for (Int_t i=0; i<nseed; i++) { |
2227 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2228 | if (!pt){ |
2229 | quality[i]=-1; |
2230 | continue; |
2231 | } |
2232 | pt->UpdatePoints(); //select first last max dens points |
2233 | Float_t * points = pt->GetPoints(); |
2234 | if (points[3]<0.8) quality[i] =-1; |
2235 | // |
2236 | quality[i] = (points[2]-points[0])+pt->GetNumberOfClusters(); |
2237 | } |
2238 | TMath::Sort(nseed,quality,indexes); |
2239 | // |
2240 | // |
2241 | for (Int_t itrack=0; itrack<nseed; itrack++) { |
2242 | Int_t trackindex = indexes[itrack]; |
2243 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(trackindex); |
2244 | if (quality[trackindex]<0){ |
2245 | if (pt) { |
2246 | delete arr->RemoveAt(trackindex); |
2247 | } |
2248 | else{ |
2249 | arr->RemoveAt(trackindex); |
2250 | } |
2251 | continue; |
2252 | } |
2253 | // |
2254 | Int_t first = Int_t(pt->GetPoints()[0]); |
2255 | Int_t last = Int_t(pt->GetPoints()[2]); |
2256 | Double_t factor = (pt->fBConstrain) ? factor1: factor2; |
2257 | // |
2258 | Int_t found,foundable,shared; |
2259 | pt->GetClusterStatistic(first,last, found, foundable,shared,kFALSE); |
eea478d3 |
2260 | Float_t sharedfactor = Float_t(shared+1)/Float_t(found+1); |
b406fdb0 |
2261 | Bool_t itsgold =kFALSE; |
2262 | if (pt->fEsd){ |
ef7253ac |
2263 | Int_t dummy[12]; |
b406fdb0 |
2264 | if (pt->fEsd->GetITSclusters(dummy)>4) itsgold= kTRUE; |
51ad6848 |
2265 | } |
b406fdb0 |
2266 | if (!itsgold){ |
2267 | // |
2268 | if (Float_t(shared+1)/Float_t(found+1)>factor){ |
2269 | if (pt->GetKinkIndexes()[0]!=0) continue; //don't remove tracks - part of the kinks |
2270 | delete arr->RemoveAt(trackindex); |
2271 | continue; |
2272 | } |
2273 | if (pt->GetNumberOfClusters()<50&&(found-0.5*shared)<minimal){ //remove short tracks |
2274 | if (pt->GetKinkIndexes()[0]!=0) continue; //don't remove tracks - part of the kinks |
2275 | delete arr->RemoveAt(trackindex); |
2276 | continue; |
2277 | } |
51ad6848 |
2278 | } |
2279 | |
2280 | good++; |
2281 | if (sharedfactor>0.4) continue; |
b406fdb0 |
2282 | if (pt->GetKinkIndexes()[0]>0) continue; |
51ad6848 |
2283 | for (Int_t i=first; i<last; i++) { |
2284 | Int_t index=pt->GetClusterIndex2(i); |
2285 | // if (index<0 || index&0x8000 ) continue; |
2286 | if (index<0 || index&0x8000 ) continue; |
2287 | AliTPCclusterMI *c= pt->fClusterPointer[i]; |
2288 | if (!c) continue; |
2289 | c->Use(10); |
2290 | } |
2291 | } |
2292 | fNtracks = good; |
2293 | if (fDebug>0){ |
2294 | Info("RemoveUsed","\n*****\nNumber of good tracks after shared removal\t%d\n",fNtracks); |
2295 | } |
2296 | delete []quality; |
2297 | delete []indexes; |
2298 | } |
2299 | |
91162307 |
2300 | void AliTPCtrackerMI::UnsignClusters() |
1c53abe2 |
2301 | { |
91162307 |
2302 | // |
2303 | // loop over all clusters and unsign them |
2304 | // |
2305 | |
2306 | for (Int_t sec=0;sec<fkNIS;sec++){ |
2307 | for (Int_t row=0;row<fInnerSec->GetNRows();row++){ |
2308 | AliTPCclusterMI *cl = fInnerSec[sec][row].fClusters1; |
2309 | for (Int_t icl =0;icl< fInnerSec[sec][row].fN1;icl++) |
2310 | // if (cl[icl].IsUsed(10)) |
2311 | cl[icl].Use(-1); |
2312 | cl = fInnerSec[sec][row].fClusters2; |
2313 | for (Int_t icl =0;icl< fInnerSec[sec][row].fN2;icl++) |
2314 | //if (cl[icl].IsUsed(10)) |
2315 | cl[icl].Use(-1); |
2316 | } |
2317 | } |
2318 | |
2319 | for (Int_t sec=0;sec<fkNOS;sec++){ |
2320 | for (Int_t row=0;row<fOuterSec->GetNRows();row++){ |
2321 | AliTPCclusterMI *cl = fOuterSec[sec][row].fClusters1; |
2322 | for (Int_t icl =0;icl< fOuterSec[sec][row].fN1;icl++) |
2323 | //if (cl[icl].IsUsed(10)) |
2324 | cl[icl].Use(-1); |
2325 | cl = fOuterSec[sec][row].fClusters2; |
2326 | for (Int_t icl =0;icl< fOuterSec[sec][row].fN2;icl++) |
2327 | //if (cl[icl].IsUsed(10)) |
2328 | cl[icl].Use(-1); |
2329 | } |
2330 | } |
2331 | |
1c53abe2 |
2332 | } |
2333 | |
91162307 |
2334 | |
2335 | |
732b9e78 |
2336 | void AliTPCtrackerMI::SignClusters(TObjArray * arr, Float_t fnumber, Float_t fdensity) |
1c53abe2 |
2337 | { |
2338 | // |
91162307 |
2339 | //sign clusters to be "used" |
2340 | // |
2341 | // snumber and sdensity sign number of sigmas - bellow mean value to be accepted |
2342 | // loop over "primaries" |
2343 | |
2344 | Float_t sumdens=0; |
2345 | Float_t sumdens2=0; |
2346 | Float_t sumn =0; |
2347 | Float_t sumn2 =0; |
2348 | Float_t sumchi =0; |
2349 | Float_t sumchi2 =0; |
2350 | |
2351 | Float_t sum =0; |
2352 | |
1c53abe2 |
2353 | TStopwatch timer; |
91162307 |
2354 | timer.Start(); |
1c53abe2 |
2355 | |
91162307 |
2356 | Int_t nseed = arr->GetEntriesFast(); |
2357 | for (Int_t i=0; i<nseed; i++) { |
2358 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2359 | if (!pt) { |
2360 | continue; |
2361 | } |
2362 | if (!(pt->IsActive())) continue; |
2363 | Float_t dens = pt->GetNumberOfClusters()/Float_t(pt->fNFoundable); |
2364 | if ( (dens>0.7) && (pt->GetNumberOfClusters()>70)){ |
2365 | sumdens += dens; |
2366 | sumdens2+= dens*dens; |
2367 | sumn += pt->GetNumberOfClusters(); |
2368 | sumn2 += pt->GetNumberOfClusters()*pt->GetNumberOfClusters(); |
2369 | Float_t chi2 = pt->GetChi2()/pt->GetNumberOfClusters(); |
2370 | if (chi2>5) chi2=5; |
2371 | sumchi +=chi2; |
2372 | sumchi2 +=chi2*chi2; |
2373 | sum++; |
2374 | } |
1627d1c4 |
2375 | } |
91162307 |
2376 | |
2377 | Float_t mdensity = 0.9; |
2378 | Float_t meann = 130; |
2379 | Float_t meanchi = 1; |
2380 | Float_t sdensity = 0.1; |
2381 | Float_t smeann = 10; |
2382 | Float_t smeanchi =0.4; |
1627d1c4 |
2383 | |
91162307 |
2384 | |
2385 | if (sum>20){ |
2386 | mdensity = sumdens/sum; |
2387 | meann = sumn/sum; |
2388 | meanchi = sumchi/sum; |
2389 | // |
2390 | sdensity = sumdens2/sum-mdensity*mdensity; |
2391 | sdensity = TMath::Sqrt(sdensity); |
2392 | // |
2393 | smeann = sumn2/sum-meann*meann; |
2394 | smeann = TMath::Sqrt(smeann); |
2395 | // |
2396 | smeanchi = sumchi2/sum - meanchi*meanchi; |
2397 | smeanchi = TMath::Sqrt(smeanchi); |
2398 | } |
2399 | |
2400 | |
2401 | //REMOVE SHORT DELTAS or tracks going out of sensitive volume of TPC |
2402 | // |
2403 | for (Int_t i=0; i<nseed; i++) { |
2404 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2405 | if (!pt) { |
2406 | continue; |
1c53abe2 |
2407 | } |
91162307 |
2408 | if (pt->fBSigned) continue; |
2409 | if (pt->fBConstrain) continue; |
2410 | //if (!(pt->IsActive())) continue; |
2411 | /* |
2412 | Int_t found,foundable,shared; |
2413 | pt->GetClusterStatistic(0,160,found, foundable,shared); |
2414 | if (shared/float(found)>0.3) { |
2415 | if (shared/float(found)>0.9 ){ |
2416 | //delete arr->RemoveAt(i); |
2417 | } |
2418 | continue; |
c9427e08 |
2419 | } |
91162307 |
2420 | */ |
2421 | Bool_t isok =kFALSE; |
2422 | if ( (pt->fNShared/pt->GetNumberOfClusters()<0.5) &&pt->GetNumberOfClusters()>60) |
2423 | isok = kTRUE; |
2424 | if ((TMath::Abs(1/pt->GetC())<100.) && (pt->fNShared/pt->GetNumberOfClusters()<0.7)) |
2425 | isok =kTRUE; |
2426 | if (TMath::Abs(pt->GetZ()/pt->GetX())>1.1) |
2427 | isok =kTRUE; |
2428 | if ( (TMath::Abs(pt->GetSnp()>0.7) && pt->GetD(0,0)>60.)) |
2429 | isok =kTRUE; |
2430 | |
2431 | if (isok) |
2432 | for (Int_t i=0; i<160; i++) { |
2433 | Int_t index=pt->GetClusterIndex2(i); |
2434 | if (index<0) continue; |
2435 | AliTPCclusterMI *c= pt->fClusterPointer[i]; |
2436 | if (!c) continue; |
2437 | //if (!(c->IsUsed(10))) c->Use(); |
2438 | c->Use(10); |
2439 | } |
2440 | } |
2441 | |
c9427e08 |
2442 | |
1c53abe2 |
2443 | // |
91162307 |
2444 | Double_t maxchi = meanchi+2.*smeanchi; |
2445 | |
2446 | for (Int_t i=0; i<nseed; i++) { |
2447 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2448 | if (!pt) { |
1c53abe2 |
2449 | continue; |
91162307 |
2450 | } |
2451 | //if (!(pt->IsActive())) continue; |
2452 | if (pt->fBSigned) continue; |
2453 | Double_t chi = pt->GetChi2()/pt->GetNumberOfClusters(); |
2454 | if (chi>maxchi) continue; |
2455 | |
2456 | Float_t bfactor=1; |
2457 | Float_t dens = pt->GetNumberOfClusters()/Float_t(pt->fNFoundable); |
2458 | |
2459 | //sign only tracks with enoug big density at the beginning |
2460 | |
2461 | if ((pt->GetDensityFirst(40)<0.75) && pt->GetNumberOfClusters()<meann) continue; |
2462 | |
2463 | |
3e5d0aa2 |
2464 | Double_t mindens = TMath::Max(double(mdensity-sdensity*fdensity*bfactor),0.65); |
91162307 |
2465 | Double_t minn = TMath::Max(Int_t(meann-fnumber*smeann*bfactor),50); |
2466 | |
2467 | // if (pt->fBConstrain) mindens = TMath::Max(mdensity-sdensity*fdensity*bfactor,0.65); |
2468 | if ( (pt->fRemoval==10) && (pt->GetSnp()>0.8)&&(dens>mindens)) |
2469 | minn=0; |
2470 | |
2471 | if ((dens>mindens && pt->GetNumberOfClusters()>minn) && chi<maxchi ){ |
2472 | //Int_t noc=pt->GetNumberOfClusters(); |
2473 | pt->fBSigned = kTRUE; |
2474 | for (Int_t i=0; i<160; i++) { |
2475 | |
2476 | Int_t index=pt->GetClusterIndex2(i); |
2477 | if (index<0) continue; |
2478 | AliTPCclusterMI *c= pt->fClusterPointer[i]; |
2479 | if (!c) continue; |
2480 | // if (!(c->IsUsed(10))) c->Use(); |
2481 | c->Use(10); |
2482 | } |
1c53abe2 |
2483 | } |
91162307 |
2484 | } |
2485 | // gLastCheck = nseed; |
2486 | // arr->Compress(); |
2487 | if (fDebug>0){ |
2488 | timer.Print(); |
2489 | } |
1c53abe2 |
2490 | } |
2491 | |
2492 | |
47966a6d |
2493 | void AliTPCtrackerMI::StopNotActive(TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const |
91162307 |
2494 | { |
2495 | // stop not active tracks |
2496 | // take th1 as threshold for number of founded to number of foundable on last 10 active rows |
2497 | // take th2 as threshold for number of founded to number of foundable on last 20 active rows |
2498 | Int_t nseed = arr->GetEntriesFast(); |
2499 | // |
2500 | for (Int_t i=0; i<nseed; i++) { |
2501 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
2502 | if (!pt) { |
2503 | continue; |
2504 | } |
2505 | if (!(pt->IsActive())) continue; |
2506 | StopNotActive(pt,row0,th0, th1,th2); |
2507 | } |
2508 | } |
1c53abe2 |
2509 | |
1c53abe2 |
2510 | |
1c53abe2 |
2511 | |
91162307 |
2512 | void AliTPCtrackerMI::StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1, |
47966a6d |
2513 | Float_t th2) const |
91162307 |
2514 | { |
2515 | // stop not active tracks |
2516 | // take th1 as threshold for number of founded to number of foundable on last 10 active rows |
2517 | // take th2 as threshold for number of founded to number of foundable on last 20 active rows |
2518 | Int_t sumgood1 = 0; |
2519 | Int_t sumgood2 = 0; |
2520 | Int_t foundable = 0; |
2521 | Int_t maxindex = seed->fLastPoint; //last foundable row |
2522 | if (seed->fNFoundable*th0 > seed->GetNumberOfClusters()) { |
2523 | seed->Desactivate(10) ; |
2524 | return; |
2525 | } |
1c53abe2 |
2526 | |
3e5d0aa2 |
2527 | for (Int_t i=row0; i<maxindex; i++){ |
91162307 |
2528 | Int_t index = seed->GetClusterIndex2(i); |
2529 | if (index!=-1) foundable++; |
2530 | //if (!c) continue; |
2531 | if (foundable<=30) sumgood1++; |
2532 | if (foundable<=50) { |
2533 | sumgood2++; |
2534 | } |
2535 | else{ |
2536 | break; |
2537 | } |
2538 | } |
2539 | if (foundable>=30.){ |
2540 | if (sumgood1<(th1*30.)) seed->Desactivate(10); |
2541 | } |
2542 | if (foundable>=50) |
2543 | if (sumgood2<(th2*50.)) seed->Desactivate(10); |
2544 | } |
1c53abe2 |
2545 | |
1c53abe2 |
2546 | |
d26d9159 |
2547 | Int_t AliTPCtrackerMI::RefitInward(AliESD *event) |
2548 | { |
2549 | // |
2550 | // back propagation of ESD tracks |
2551 | // |
2552 | //return 0; |
2553 | fEvent = event; |
2554 | ReadSeeds(event,2); |
2555 | fIteration=2; |
982aff31 |
2556 | //PrepareForProlongation(fSeeds,1); |
2557 | PropagateForward2(fSeeds); |
af32720d |
2558 | |
4d158c36 |
2559 | Int_t ntracks=0; |
d26d9159 |
2560 | Int_t nseed = fSeeds->GetEntriesFast(); |
2561 | for (Int_t i=0;i<nseed;i++){ |
2562 | AliTPCseed * seed = (AliTPCseed*) fSeeds->UncheckedAt(i); |
4d158c36 |
2563 | if (!seed) continue; |
eea478d3 |
2564 | if (seed->GetKinkIndex(0)>0) UpdateKinkQualityD(seed); // update quality informations for kinks |
2565 | |
d26d9159 |
2566 | seed->PropagateTo(fParam->GetInnerRadiusLow()); |
51ad6848 |
2567 | seed->UpdatePoints(); |
d26d9159 |
2568 | AliESDtrack *esd=event->GetTrack(i); |
2569 | seed->CookdEdx(0.02,0.6); |
2570 | CookLabel(seed,0.1); //For comparison only |
af32720d |
2571 | // |
34acb742 |
2572 | if (AliTPCReconstructor::StreamLevel()>0 && seed!=0&&esd!=0) { |
af32720d |
2573 | TTreeSRedirector &cstream = *fDebugStreamer; |
2574 | cstream<<"Crefit"<< |
2575 | "Esd.="<<esd<< |
2576 | "Track.="<<seed<< |
2577 | "\n"; |
2578 | } |
51ad6848 |
2579 | if (seed->GetNumberOfClusters()>15){ |
4d158c36 |
2580 | esd->UpdateTrackParams(seed,AliESDtrack::kTPCrefit); |
51ad6848 |
2581 | esd->SetTPCPoints(seed->GetPoints()); |
b406fdb0 |
2582 | esd->SetTPCPointsF(seed->fNFoundable); |
2583 | Int_t ndedx = seed->fNCDEDX[0]+seed->fNCDEDX[1]+seed->fNCDEDX[2]+seed->fNCDEDX[3]; |
2584 | Float_t sdedx = (seed->fSDEDX[0]+seed->fSDEDX[1]+seed->fSDEDX[2]+seed->fSDEDX[3])*0.25; |
2585 | Float_t dedx = seed->GetdEdx(); |
2586 | esd->SetTPCsignal(dedx, sdedx, ndedx); |
4d158c36 |
2587 | ntracks++; |
d26d9159 |
2588 | } |
2589 | else{ |
2590 | //printf("problem\n"); |
2591 | } |
2592 | } |
51ad6848 |
2593 | //FindKinks(fSeeds,event); |
4d158c36 |
2594 | Info("RefitInward","Number of refitted tracks %d",ntracks); |
d26d9159 |
2595 | fEvent =0; |
2596 | //WriteTracks(); |
2597 | return 0; |
2598 | } |
2599 | |
1c53abe2 |
2600 | |
91162307 |
2601 | Int_t AliTPCtrackerMI::PropagateBack(AliESD *event) |
2602 | { |
2603 | // |
2604 | // back propagation of ESD tracks |
2605 | // |
1c53abe2 |
2606 | |
91162307 |
2607 | fEvent = event; |
d26d9159 |
2608 | fIteration = 1; |
5d837844 |
2609 | ReadSeeds(event,1); |
b406fdb0 |
2610 | PropagateBack(fSeeds); |
2611 | RemoveUsed2(fSeeds,0.4,0.4,20); |
2612 | // |
91162307 |
2613 | Int_t nseed = fSeeds->GetEntriesFast(); |
4d158c36 |
2614 | Int_t ntracks=0; |
91162307 |
2615 | for (Int_t i=0;i<nseed;i++){ |
2616 | AliTPCseed * seed = (AliTPCseed*) fSeeds->UncheckedAt(i); |
d9e62e7e |
2617 | if (!seed) continue; |
51ad6848 |
2618 | if (seed->GetKinkIndex(0)<0) UpdateKinkQualityM(seed); // update quality informations for kinks |
2619 | seed->UpdatePoints(); |
91162307 |
2620 | AliESDtrack *esd=event->GetTrack(i); |
d26d9159 |
2621 | seed->CookdEdx(0.02,0.6); |
91162307 |
2622 | CookLabel(seed,0.1); //For comparison only |
51ad6848 |
2623 | if (seed->GetNumberOfClusters()>15){ |
4d158c36 |
2624 | esd->UpdateTrackParams(seed,AliESDtrack::kTPCout); |
51ad6848 |
2625 | esd->SetTPCPoints(seed->GetPoints()); |
167c41ab |
2626 | esd->SetTPCPointsF(seed->fNFoundable); |
2627 | Int_t ndedx = seed->fNCDEDX[0]+seed->fNCDEDX[1]+seed->fNCDEDX[2]+seed->fNCDEDX[3]; |
2628 | Float_t sdedx = (seed->fSDEDX[0]+seed->fSDEDX[1]+seed->fSDEDX[2]+seed->fSDEDX[3])*0.25; |
2629 | Float_t dedx = seed->GetdEdx(); |
2630 | esd->SetTPCsignal(dedx, sdedx, ndedx); |
4d158c36 |
2631 | ntracks++; |
ca142b1f |
2632 | Int_t eventnumber = event->GetEventNumber();// patch 28 fev 06 |
2633 | (*fDebugStreamer)<<"Cback"<< |
2634 | "Tr0.="<<seed<< |
2635 | "EventNr="<<eventnumber<< |
2636 | "\n"; // patch 28 fev 06 |
4d158c36 |
2637 | } |
91162307 |
2638 | } |
51ad6848 |
2639 | //FindKinks(fSeeds,event); |
4d158c36 |
2640 | Info("PropagateBack","Number of back propagated tracks %d",ntracks); |
91162307 |
2641 | fEvent =0; |
d26d9159 |
2642 | //WriteTracks(); |
91162307 |
2643 | return 0; |
2644 | } |
2645 | |
2646 | |
2647 | void AliTPCtrackerMI::DeleteSeeds() |
2648 | { |
b67e07dc |
2649 | // |
2650 | //delete Seeds |
91162307 |
2651 | Int_t nseed = fSeeds->GetEntriesFast(); |
2652 | for (Int_t i=0;i<nseed;i++){ |
2653 | AliTPCseed * seed = (AliTPCseed*)fSeeds->At(i); |
2654 | if (seed) delete fSeeds->RemoveAt(i); |
2655 | } |
2656 | delete fSeeds; |
2657 | fSeeds =0; |
2658 | } |
2659 | |
d26d9159 |
2660 | void AliTPCtrackerMI::ReadSeeds(AliESD *event, Int_t direction) |
91162307 |
2661 | { |
2662 | // |
2663 | //read seeds from the event |
2664 | |
2665 | Int_t nentr=event->GetNumberOfTracks(); |
6bdc18d6 |
2666 | if (fDebug>0){ |
2667 | Info("ReadSeeds", "Number of ESD tracks: %d\n", nentr); |
2668 | } |
91162307 |
2669 | if (fSeeds) |
2670 | DeleteSeeds(); |
2671 | if (!fSeeds){ |
4d158c36 |
2672 | fSeeds = new TObjArray(nentr); |
91162307 |
2673 | } |
4d158c36 |
2674 | UnsignClusters(); |
2675 | // Int_t ntrk=0; |
91162307 |
2676 | for (Int_t i=0; i<nentr; i++) { |
2677 | AliESDtrack *esd=event->GetTrack(i); |
51ad6848 |
2678 | ULong_t status=esd->GetStatus(); |
2679 | if (!(status&AliESDtrack::kTPCin)) continue; |
b67e07dc |
2680 | AliTPCtrack t(*esd); |
5d837844 |
2681 | t.SetNumberOfClusters(0); |
eea478d3 |
2682 | // AliTPCseed *seed = new AliTPCseed(t,t.GetAlpha()); |
2683 | AliTPCseed *seed = new AliTPCseed(t/*,t.GetAlpha()*/); |
2684 | for (Int_t ikink=0;ikink<3;ikink++) { |
2685 | Int_t index = esd->GetKinkIndex(ikink); |
2686 | seed->GetKinkIndexes()[ikink] = index; |
2687 | if (index==0) continue; |
2688 | index = TMath::Abs(index); |
2689 | AliESDkink * kink = fEvent->GetKink(index-1); |
2690 | if (kink&&esd->GetKinkIndex(ikink)<0){ |
2691 | if ((status & AliESDtrack::kTRDrefit) != 0) kink->SetStatus(1,2); |
2692 | if ((status & AliESDtrack::kITSout) != 0) kink->SetStatus(1,0); |
2693 | } |
2694 | if (kink&&esd->GetKinkIndex(ikink)>0){ |
2695 | if ((status & AliESDtrack::kTRDrefit) != 0) kink->SetStatus(1,6); |
2696 | if ((status & AliESDtrack::kITSout) != 0) kink->SetStatus(1,4); |
2697 | } |
2698 | |
2699 | } |
5d837844 |
2700 | if (((status&AliESDtrack::kITSout)==0)&&(direction==1)) seed->ResetCovariance(); |
982aff31 |
2701 | if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) == 0 ) seed->ResetCovariance(); |
4d158c36 |
2702 | if ( direction ==2 && ((status & AliESDtrack::kTPCout) == 0) ) { |
2703 | fSeeds->AddAt(0,i); |
2704 | delete seed; |
2705 | continue; |
2706 | } |
2707 | if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) > 0 ) { |
c0b978f0 |
2708 | Double_t par0[5],par1[5],alpha,x; |
2709 | esd->GetInnerExternalParameters(alpha,x,par0); |
4d158c36 |
2710 | esd->GetExternalParameters(x,par1); |
2711 | Double_t delta1 = TMath::Abs(par0[4]-par1[4])/(0.000000001+TMath::Abs(par0[4]+par1[4])); |
2712 | Double_t delta2 = TMath::Abs(par0[3]-par1[3]); |
51ad6848 |
2713 | Double_t trdchi2=0; |
2714 | if (esd->GetTRDncls()>0) trdchi2 = esd->GetTRDchi2()/esd->GetTRDncls(); |
4d158c36 |
2715 | //reset covariance if suspicious |
51ad6848 |
2716 | if ( (delta1>0.1) || (delta2>0.006) ||trdchi2>7.) |
4d158c36 |
2717 | seed->ResetCovariance(); |
2718 | } |
982aff31 |
2719 | |
91162307 |
2720 | // |
2721 | // |
2722 | // rotate to the local coordinate system |
eea478d3 |
2723 | // |
2724 | fSectors=fInnerSec; fN=fkNIS; |
91162307 |
2725 | Double_t alpha=seed->GetAlpha() - fSectors->GetAlphaShift(); |
2726 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); |
2727 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); |
2728 | Int_t ns=Int_t(alpha/fSectors->GetAlpha())%fN; |
2729 | alpha =ns*fSectors->GetAlpha() + fSectors->GetAlphaShift(); |
4d158c36 |
2730 | if (alpha<-TMath::Pi()) alpha += 2*TMath::Pi(); |
2731 | if (alpha>=TMath::Pi()) alpha -= 2*TMath::Pi(); |
91162307 |
2732 | alpha-=seed->GetAlpha(); |
d9b8978b |
2733 | if (!seed->Rotate(alpha)) { |
2734 | delete seed; |
2735 | continue; |
2736 | } |
d26d9159 |
2737 | seed->fEsd = esd; |
4d158c36 |
2738 | // sign clusters |
b406fdb0 |
2739 | if (esd->GetKinkIndex(0)<=0){ |
2740 | for (Int_t irow=0;irow<160;irow++){ |
2741 | Int_t index = seed->GetClusterIndex2(irow); |
2742 | if (index>0){ |
2743 | // |
2744 | AliTPCclusterMI * cl = GetClusterMI(index); |
2745 | seed->fClusterPointer[irow] = cl; |
2746 | if (cl){ |
2747 | if ((index & 0x8000)==0){ |
2748 | cl->Use(10); // accepted cluster |
2749 | }else{ |
2750 | cl->Use(6); // close cluster not accepted |
2751 | } |
4d158c36 |
2752 | }else{ |
b406fdb0 |
2753 | Info("ReadSeeds","Not found cluster"); |
2754 | } |
4d158c36 |
2755 | } |
2756 | } |
2757 | } |
2758 | fSeeds->AddAt(seed,i); |
91162307 |
2759 | } |
2760 | } |
2761 | |
2762 | |
2763 | |
2764 | //_____________________________________________________________________________ |
2765 | void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], |
2766 | Float_t deltay, Int_t ddsec) { |
2767 | //----------------------------------------------------------------- |
2768 | // This function creates track seeds. |
2769 | // SEEDING WITH VERTEX CONSTRAIN |
2770 | //----------------------------------------------------------------- |
2771 | // cuts[0] - fP4 cut |
2772 | // cuts[1] - tan(phi) cut |
2773 | // cuts[2] - zvertex cut |
2774 | // cuts[3] - fP3 cut |
2775 | Int_t nin0 = 0; |
2776 | Int_t nin1 = 0; |
2777 | Int_t nin2 = 0; |
2778 | Int_t nin = 0; |
2779 | Int_t nout1 = 0; |
2780 | Int_t nout2 = 0; |
2781 | |
2782 | Double_t x[5], c[15]; |
2783 | // Int_t di = i1-i2; |
2784 | // |
2785 | AliTPCseed * seed = new AliTPCseed; |
2786 | Double_t alpha=fSectors->GetAlpha(), shift=fSectors->GetAlphaShift(); |
2787 | Double_t cs=cos(alpha), sn=sin(alpha); |
2788 | // |
2789 | // Double_t x1 =fOuterSec->GetX(i1); |
2790 | //Double_t xx2=fOuterSec->GetX(i2); |
2791 | |
2792 | Double_t x1 =GetXrow(i1); |
2793 | Double_t xx2=GetXrow(i2); |
2794 | |
2795 | Double_t x3=GetX(), y3=GetY(), z3=GetZ(); |
2796 | |
2797 | Int_t imiddle = (i2+i1)/2; //middle pad row index |
2798 | Double_t xm = GetXrow(imiddle); // radius of middle pad-row |
2799 | const AliTPCRow& krm=GetRow(sec,imiddle); //middle pad -row |
2800 | // |
2801 | Int_t ns =sec; |
2802 | |
2803 | const AliTPCRow& kr1=GetRow(ns,i1); |
2804 | Double_t ymax = GetMaxY(i1)-kr1.fDeadZone-1.5; |
2805 | Double_t ymaxm = GetMaxY(imiddle)-kr1.fDeadZone-1.5; |
2806 | |
2807 | // |
2808 | // change cut on curvature if it can't reach this layer |
2809 | // maximal curvature set to reach it |
2810 | Double_t dvertexmax = TMath::Sqrt((x1-x3)*(x1-x3)+(ymax+5-y3)*(ymax+5-y3)); |
2811 | if (dvertexmax*0.5*cuts[0]>0.85){ |
2812 | cuts[0] = 0.85/(dvertexmax*0.5+1.); |
2813 | } |
2814 | Double_t r2min = 1/(cuts[0]*cuts[0]); //minimal square of radius given by cut |
2815 | |
2816 | // Int_t ddsec = 1; |
2817 | if (deltay>0) ddsec = 0; |
2818 | // loop over clusters |
2819 | for (Int_t is=0; is < kr1; is++) { |
2820 | // |
2821 | if (kr1[is]->IsUsed(10)) continue; |
2822 | Double_t y1=kr1[is]->GetY(), z1=kr1[is]->GetZ(); |
2823 | //if (TMath::Abs(y1)>ymax) continue; |
2824 | |
2825 | if (deltay>0 && TMath::Abs(ymax-TMath::Abs(y1))> deltay ) continue; // seed only at the edge |
2826 | |
2827 | // find possible directions |
2828 | Float_t anglez = (z1-z3)/(x1-x3); |
2829 | Float_t extraz = z1 - anglez*(x1-xx2); // extrapolated z |
2830 | // |
2831 | // |
2832 | //find rotation angles relative to line given by vertex and point 1 |
2833 | Double_t dvertex2 = (x1-x3)*(x1-x3)+(y1-y3)*(y1-y3); |
2834 | Double_t dvertex = TMath::Sqrt(dvertex2); |
2835 | Double_t angle13 = TMath::ATan((y1-y3)/(x1-x3)); |
2836 | Double_t cs13 = cos(-angle13), sn13 = sin(-angle13); |
2837 | |
2838 | // |
2839 | // loop over 2 sectors |
2840 | Int_t dsec1=-ddsec; |
2841 | Int_t dsec2= ddsec; |
2842 | if (y1<0) dsec2= 0; |
2843 | if (y1>0) dsec1= 0; |
2844 | |
2845 | Double_t dddz1=0; // direction of delta inclination in z axis |
2846 | Double_t dddz2=0; |
2847 | if ( (z1-z3)>0) |
2848 | dddz1 =1; |
2849 | else |
2850 | dddz2 =1; |
2851 | // |
2852 | for (Int_t dsec = dsec1; dsec<=dsec2;dsec++){ |
2853 | Int_t sec2 = sec + dsec; |
2854 | // |
2855 | // AliTPCRow& kr2 = fOuterSec[(sec2+fkNOS)%fkNOS][i2]; |
2856 | //AliTPCRow& kr2m = fOuterSec[(sec2+fkNOS)%fkNOS][imiddle]; |
2857 | AliTPCRow& kr2 = GetRow((sec2+fkNOS)%fkNOS,i2); |
2858 | AliTPCRow& kr2m = GetRow((sec2+fkNOS)%fkNOS,imiddle); |
2859 | Int_t index1 = TMath::Max(kr2.Find(extraz-0.6-dddz1*TMath::Abs(z1)*0.05)-1,0); |
2860 | Int_t index2 = TMath::Min(kr2.Find(extraz+0.6+dddz2*TMath::Abs(z1)*0.05)+1,kr2); |
2861 | |
2862 | // rotation angles to p1-p3 |
2863 | Double_t cs13r = cos(-angle13+dsec*alpha)/dvertex, sn13r = sin(-angle13+dsec*alpha)/dvertex; |
2864 | Double_t x2, y2, z2; |
2865 | // |
2866 | // Double_t dymax = maxangle*TMath::Abs(x1-xx2); |
2867 | |
2868 | // |
2869 | Double_t dxx0 = (xx2-x3)*cs13r; |
2870 | Double_t dyy0 = (xx2-x3)*sn13r; |
2871 | for (Int_t js=index1; js < index2; js++) { |
2872 | const AliTPCclusterMI *kcl = kr2[js]; |
2873 | if (kcl->IsUsed(10)) continue; |
2874 | // |
2875 | //calcutate parameters |
2876 | // |
2877 | Double_t yy0 = dyy0 +(kcl->GetY()-y3)*cs13r; |
2878 | // stright track |
2879 | if (TMath::Abs(yy0)<0.000001) continue; |
2880 | Double_t xx0 = dxx0 -(kcl->GetY()-y3)*sn13r; |
2881 | Double_t y0 = 0.5*(xx0*xx0+yy0*yy0-xx0)/yy0; |
2882 | Double_t r02 = (0.25+y0*y0)*dvertex2; |
2883 | //curvature (radius) cut |
2884 | if (r02<r2min) continue; |
2885 | |
2886 | nin0++; |
2887 | // |
2888 | Double_t c0 = 1/TMath::Sqrt(r02); |
2889 | if (yy0>0) c0*=-1.; |
2890 | |
2891 | |
2892 | //Double_t dfi0 = 2.*TMath::ASin(dvertex*c0*0.5); |
2893 | //Double_t dfi1 = 2.*TMath::ASin(TMath::Sqrt(yy0*yy0+(1-xx0)*(1-xx0))*dvertex*c0*0.5); |
b67e07dc |
2894 | Double_t dfi0 = 2.*AliTPCFastMath::FastAsin(dvertex*c0*0.5); |
2895 | Double_t dfi1 = 2.*AliTPCFastMath::FastAsin(TMath::Sqrt(yy0*yy0+(1-xx0)*(1-xx0))*dvertex*c0*0.5); |
91162307 |
2896 | // |
2897 | // |
2898 | Double_t z0 = kcl->GetZ(); |
2899 | Double_t zzzz2 = z1-(z1-z3)*dfi1/dfi0; |
2900 | if (TMath::Abs(zzzz2-z0)>0.5) continue; |
2901 | nin1++; |
2902 | // |
2903 | Double_t dip = (z1-z0)*c0/dfi1; |
2904 | Double_t x0 = (0.5*cs13+y0*sn13)*dvertex*c0; |
2905 | // |
2906 | y2 = kcl->GetY(); |
2907 | if (dsec==0){ |
2908 | x2 = xx2; |
2909 | z2 = kcl->GetZ(); |
2910 | } |
2911 | else |
2912 | { |
2913 | // rotation |
2914 | z2 = kcl->GetZ(); |
2915 | x2= xx2*cs-y2*sn*dsec; |
2916 | y2=+xx2*sn*dsec+y2*cs; |
2917 | } |
2918 | |
2919 | x[0] = y1; |
2920 | x[1] = z1; |
2921 | x[2] = x0; |
2922 | x[3] = dip; |
2923 | x[4] = c0; |
2924 | // |
2925 | // |
2926 | // do we have cluster at the middle ? |
2927 | Double_t ym,zm; |
2928 | GetProlongation(x1,xm,x,ym,zm); |
2929 | UInt_t dummy; |
2930 | AliTPCclusterMI * cm=0; |
2931 | if (TMath::Abs(ym)-ymaxm<0){ |
2932 | cm = krm.FindNearest2(ym,zm,1.0,0.6,dummy); |
2933 | if ((!cm) || (cm->IsUsed(10))) { |
2934 | continue; |
2935 | } |
2936 | } |
2937 | else{ |
2938 | // rotate y1 to system 0 |
2939 | // get state vector in rotated system |
2940 | Double_t yr1 = (-0.5*sn13+y0*cs13)*dvertex*c0; |
2941 | Double_t xr2 = x0*cs+yr1*sn*dsec; |
2942 | Double_t xr[5]={kcl->GetY(),kcl->GetZ(), xr2, dip, c0}; |
2943 | // |
2944 | GetProlongation(xx2,xm,xr,ym,zm); |
2945 | if (TMath::Abs(ym)-ymaxm<0){ |
2946 | cm = kr2m.FindNearest2(ym,zm,1.0,0.6,dummy); |
2947 | if ((!cm) || (cm->IsUsed(10))) { |
2948 | continue; |
2949 | } |
2950 | } |
2951 | } |
2952 | |
2953 | |
2954 | Double_t dym = 0; |
2955 | Double_t dzm = 0; |
2956 | if (cm){ |
2957 | dym = ym - cm->GetY(); |
2958 | dzm = zm - cm->GetZ(); |
2959 | } |
2960 | nin2++; |
2961 | |
2962 | |
2963 | // |
2964 | // |
2965 | Double_t sy1=kr1[is]->GetSigmaY2()*2., sz1=kr1[is]->GetSigmaZ2()*2.; |
2966 | Double_t sy2=kcl->GetSigmaY2()*2., sz2=kcl->GetSigmaZ2()*2.; |
2967 | //Double_t sy3=400*3./12., sy=0.1, sz=0.1; |
2968 | Double_t sy3=25000*x[4]*x[4]+0.1, sy=0.1, sz=0.1; |
2969 | //Double_t sy3=25000*x[4]*x[4]*60+0.5, sy=0.1, sz=0.1; |
2970 | |
b67e07dc |
2971 | Double_t f40=(F1(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy; |
2972 | Double_t f42=(F1(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy; |
2973 | Double_t f43=(F1(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy; |
2974 | Double_t f20=(F2(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy; |
2975 | Double_t f22=(F2(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy; |
2976 | Double_t f23=(F2(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy; |
91162307 |
2977 | |
b67e07dc |
2978 | Double_t f30=(F3(x1,y1+sy,x2,y2,z1,z2)-x[3])/sy; |
2979 | Double_t f31=(F3(x1,y1,x2,y2,z1+sz,z2)-x[3])/sz; |
2980 | Double_t f32=(F3(x1,y1,x2,y2+sy,z1,z2)-x[3])/sy; |
2981 | Double_t f34=(F3(x1,y1,x2,y2,z1,z2+sz)-x[3])/sz; |
91162307 |
2982 | |
1c53abe2 |
2983 | c[0]=sy1; |
2984 | c[1]=0.; c[2]=sz1; |
2985 | c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23; |
2986 | c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22; |
2987 | c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34; |
2988 | c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23; |
2989 | c[13]=f30*sy1*f40+f32*sy2*f42; |
2990 | c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; |
91162307 |
2991 | |
2992 | // if (!BuildSeed(kr1[is],kcl,0,x1,x2,x3,x,c)) continue; |
2993 | |
1c53abe2 |
2994 | UInt_t index=kr1.GetIndex(is); |
91162307 |
2995 | AliTPCseed *track=new(seed) AliTPCseed(index, x, c, x1, ns*alpha+shift); |
2996 | |
1c53abe2 |
2997 | track->fIsSeeding = kTRUE; |
91162307 |
2998 | track->fSeed1 = i1; |
2999 | track->fSeed2 = i2; |
3000 | track->fSeedType=3; |
c9427e08 |
3001 | |
91162307 |
3002 | |
3003 | //if (dsec==0) { |
3004 | FollowProlongation(*track, (i1+i2)/2,1); |
3005 | Int_t foundable,found,shared; |
3006 | track->GetClusterStatistic((i1+i2)/2,i1, found, foundable, shared, kTRUE); |
3007 | if ((found<0.55*foundable) || shared>0.5*found || (track->GetSigmaY2()+track->GetSigmaZ2())>0.5){ |
3008 | seed->Reset(); |
3009 | seed->~AliTPCseed(); |
3010 | continue; |
3011 | } |
3012 | //} |
3013 | |
3014 | nin++; |
3015 | FollowProlongation(*track, i2,1); |
3016 | |
3017 | |
3018 | //Int_t rc = 1; |
3019 | track->fBConstrain =1; |
3020 | // track->fLastPoint = i1+fInnerSec->GetNRows(); // first cluster in track position |
3021 | track->fLastPoint = i1; // first cluster in track position |
3022 | track->fFirstPoint = track->fLastPoint; |
3023 | |
3024 | if (track->GetNumberOfClusters()<(i1-i2)*0.5 || |
3025 | track->GetNumberOfClusters() < track->fNFoundable*0.6 || |
3026 | track->fNShared>0.4*track->GetNumberOfClusters() ) { |
3027 | seed->Reset(); |
3028 | seed->~AliTPCseed(); |
c9427e08 |
3029 | continue; |
3030 | } |
91162307 |
3031 | nout1++; |
3032 | // Z VERTEX CONDITION |
3033 | Double_t zv; |
3034 | zv = track->GetZ()+track->GetTgl()/track->GetC()* |
3035 | ( asin(-track->GetEta()) - asin(track->GetX()*track->GetC()-track->GetEta())); |
3036 | if (TMath::Abs(zv-z3)>cuts[2]) { |
3037 | FollowProlongation(*track, TMath::Max(i2-20,0)); |
3038 | zv = track->GetZ()+track->GetTgl()/track->GetC()* |
3039 | ( asin(-track->GetEta()) - asin(track->GetX()*track->GetC()-track->GetEta())); |
3040 | if (TMath::Abs(zv-z3)>cuts[2]){ |
3041 | FollowProlongation(*track, TMath::Max(i2-40,0)); |
3042 | zv = track->GetZ()+track->GetTgl()/track->GetC()* |
3043 | ( asin(-track->GetEta()) - asin(track->GetX()*track->GetC()-track->GetEta())); |
3044 | if (TMath::Abs(zv-z3)>cuts[2] &&(track->GetNumberOfClusters() > track->fNFoundable*0.7)){ |
3045 | // make seed without constrain |
3046 | AliTPCseed * track2 = MakeSeed(track,0.2,0.5,1.); |
3047 | FollowProlongation(*track2, i2,1); |
3048 | track2->fBConstrain = kFALSE; |
3049 | track2->fSeedType = 1; |
3050 | arr->AddLast(track2); |
3051 | seed->Reset(); |
3052 | seed->~AliTPCseed(); |
3053 | continue; |
3054 | } |
3055 | else{ |
3056 | seed->Reset(); |
3057 | seed->~AliTPCseed(); |
3058 | continue; |
3059 | |
3060 | } |
3061 | } |
c9427e08 |
3062 | } |
1c53abe2 |
3063 | |
91162307 |
3064 | track->fSeedType =0; |
3065 | arr->AddLast(track); |
3066 | seed = new AliTPCseed; |
3067 | nout2++; |
3068 | // don't consider other combinations |
3069 | if (track->GetNumberOfClusters() > track->fNFoundable*0.8) |
3070 | break; |
1c53abe2 |
3071 | } |
3072 | } |
3073 | } |
6bdc18d6 |
3074 | if (fDebug>3){ |
3075 | Info("MakeSeeds3","\nSeeding statistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2); |
91162307 |
3076 | } |
3077 | delete seed; |
1c53abe2 |
3078 | } |
3079 | |
1627d1c4 |
3080 | |
91162307 |
3081 | void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], |
3082 | Float_t deltay) { |
3083 | |
3084 | |
3085 | |
1627d1c4 |
3086 | //----------------------------------------------------------------- |
91162307 |
3087 | // This function creates track seeds. |
1627d1c4 |
3088 | //----------------------------------------------------------------- |
91162307 |
3089 | // cuts[0] - fP4 cut |
3090 | // cuts[1] - tan(phi) cut |
3091 | // cuts[2] - zvertex cut |
3092 | // cuts[3] - fP3 cut |
3093 | |
3094 | |
3095 | Int_t nin0 = 0; |
3096 | Int_t nin1 = 0; |
3097 | Int_t nin2 = 0; |
3098 | Int_t nin = 0; |
3099 | Int_t nout1 = 0; |
3100 | Int_t nout2 = 0; |
3101 | Int_t nout3 =0; |
3102 | Double_t x[5], c[15]; |
3103 | // |
3104 | // make temporary seed |
3105 | AliTPCseed * seed = new AliTPCseed; |
1627d1c4 |
3106 | Double_t alpha=fOuterSec->GetAlpha(), shift=fOuterSec->GetAlphaShift(); |
3107 | // Double_t cs=cos(alpha), sn=sin(alpha); |
91162307 |
3108 | // |
3109 | // |
1627d1c4 |
3110 | |
91162307 |
3111 | // first 3 padrows |
3112 | Double_t x1 = GetXrow(i1-1); |
3113 | const AliTPCRow& kr1=GetRow(sec,i1-1); |
3114 | Double_t y1max = GetMaxY(i1-1)-kr1.fDeadZone-1.5; |
3115 | // |
3116 | Double_t x1p = GetXrow(i1); |
3117 | const AliTPCRow& kr1p=GetRow(sec,i1); |
3118 | // |
3119 | Double_t x1m = GetXrow(i1-2); |
3120 | const AliTPCRow& kr1m=GetRow(sec,i1-2); |
1627d1c4 |
3121 | |
91162307 |
3122 | // |
3123 | //last 3 padrow for seeding |
3124 | AliTPCRow& kr3 = GetRow((sec+fkNOS)%fkNOS,i1-7); |
3125 | Double_t x3 = GetXrow(i1-7); |
3126 | // Double_t y3max= GetMaxY(i1-7)-kr3.fDeadZone-1.5; |
3127 | // |
3128 | AliTPCRow& kr3p = GetRow((sec+fkNOS)%fkNOS,i1-6); |
3129 | Double_t x3p = GetXrow(i1-6); |
3130 | // |
3131 | AliTPCRow& kr3m = GetRow((sec+fkNOS)%fkNOS,i1-8); |
3132 | Double_t x3m = GetXrow(i1-8); |
1627d1c4 |
3133 | |
91162307 |
3134 | // |
3135 | // |
3136 | // middle padrow |
3137 | Int_t im = i1-4; //middle pad row index |
3138 | Double_t xm = GetXrow(im); // radius of middle pad-row |
3139 | const AliTPCRow& krm=GetRow(sec,im); //middle pad -row |
3140 | // Double_t ymmax = GetMaxY(im)-kr1.fDeadZone-1.5; |
3141 | // |
3142 | // |
3143 | Double_t deltax = x1-x3; |
3144 | Double_t dymax = deltax*cuts[1]; |
3145 | Double_t dzmax = deltax*cuts[3]; |
3146 | // |
3147 | // loop over clusters |
3148 | for (Int_t is=0; is < kr1; is++) { |
1627d1c4 |
3149 | // |
91162307 |
3150 | if (kr1[is]->IsUsed(10)) continue; |
3151 | Double_t y1=kr1[is]->GetY(), z1=kr1[is]->GetZ(); |
1627d1c4 |
3152 | // |
91162307 |
3153 | if (deltay>0 && TMath::Abs(y1max-TMath::Abs(y1))> deltay ) continue; // seed only at the edge |
3154 | // |
3155 | Int_t index1 = TMath::Max(kr3.Find(z1-dzmax)-1,0); |
3156 | Int_t index2 = TMath::Min(kr3.Find(z1+dzmax)+1,kr3); |
3157 | // |
3158 | Double_t y3, z3; |
1627d1c4 |
3159 | // |
1627d1c4 |
3160 | // |
91162307 |
3161 | UInt_t index; |
3162 | for (Int_t js=index1; js < index2; js++) { |
3163 | const AliTPCclusterMI *kcl = kr3[js]; |
3164 | if (kcl->IsUsed(10)) continue; |
3165 | y3 = kcl->GetY(); |
3166 | // apply angular cuts |
3167 | if (TMath::Abs(y1-y3)>dymax) continue; |
3168 | x3 = x3; |
3169 | z3 = kcl->GetZ(); |
3170 | if (TMath::Abs(z1-z3)>dzmax) continue; |
3171 | // |
3172 | Double_t angley = (y1-y3)/(x1-x3); |
3173 | Double_t anglez = (z1-z3)/(x1-x3); |
3174 | // |
3175 | Double_t erry = TMath::Abs(angley)*(x1-x1m)*0.5+0.5; |
3176 | Double_t errz = TMath::Abs(anglez)*(x1-x1m)*0.5+0.5; |
3177 | // |
3178 | Double_t yyym = angley*(xm-x1)+y1; |
3179 | Double_t zzzm = anglez*(xm-x1)+z1; |
3180 | |
3181 | const AliTPCclusterMI *kcm = krm.FindNearest2(yyym,zzzm,erry,errz,index); |
3182 | if (!kcm) continue; |
3183 | if (kcm->IsUsed(10)) continue; |
3184 | |
3185 | erry = TMath::Abs(angley)*(x1-x1m)*0.4+0.5; |
3186 | errz = TMath::Abs(anglez)*(x1-x1m)*0.4+0.5; |
3187 | // |
3188 | // |
3189 | // |
3190 | Int_t used =0; |
3191 | Int_t found =0; |
3192 | // |
3193 | // look around first |
3194 | const AliTPCclusterMI *kc1m = kr1m.FindNearest2(angley*(x1m-x1)+y1, |
3195 | anglez*(x1m-x1)+z1, |
3196 | erry,errz,index); |
3197 | // |
3198 | if (kc1m){ |
3199 | found++; |
3200 | if (kc1m->IsUsed(10)) used++; |
1627d1c4 |
3201 | } |
91162307 |
3202 | const AliTPCclusterMI *kc1p = kr1p.FindNearest2(angley*(x1p-x1)+y1, |
3203 | anglez*(x1p-x1)+z1, |
3204 | erry,errz,index); |
1627d1c4 |
3205 | // |
91162307 |
3206 | if (kc1p){ |
3207 | found++; |
3208 | if (kc1p->IsUsed(10)) used++; |
1627d1c4 |
3209 | } |
91162307 |
3210 | if (used>1) continue; |
3211 | if (found<1) continue; |
1627d1c4 |
3212 | |
91162307 |
3213 | // |
3214 | // look around last |
3215 | const AliTPCclusterMI *kc3m = kr3m.FindNearest2(angley*(x3m-x3)+y3, |
3216 | anglez*(x3m-x3)+z3, |
3217 | erry,errz,index); |
3218 | // |
3219 | if (kc3m){ |
3220 | found++; |
3221 | if (kc3m->IsUsed(10)) used++; |
3222 | } |
3223 | else |
3224 | continue; |
3225 | const AliTPCclusterMI *kc3p = kr3p.FindNearest2(angley*(x3p-x3)+y3, |
3226 | anglez*(x3p-x3)+z3, |
3227 | erry,errz,index); |
3228 | // |
3229 | if (kc3p){ |
3230 | found++; |
3231 | if (kc3p->IsUsed(10)) used++; |
3232 | } |
3233 | else |
3234 | continue; |
3235 | if (used>1) continue; |
3236 | if (found<3) continue; |
3237 | // |
3238 | Double_t x2,y2,z2; |
3239 | x2 = xm; |
3240 | y2 = kcm->GetY(); |
3241 | z2 = kcm->GetZ(); |
3242 | // |
3243 | |
1627d1c4 |
3244 | x[0]=y1; |
3245 | x[1]=z1; |
b67e07dc |
3246 | x[4]=F1(x1,y1,x2,y2,x3,y3); |
91162307 |
3247 | //if (TMath::Abs(x[4]) >= cuts[0]) continue; |
3248 | nin0++; |
3249 | // |
b67e07dc |
3250 | x[2]=F2(x1,y1,x2,y2,x3,y3); |
91162307 |
3251 | nin1++; |
3252 | // |
b67e07dc |
3253 | x[3]=F3n(x1,y1,x2,y2,z1,z2,x[4]); |
91162307 |
3254 | //if (TMath::Abs(x[3]) > cuts[3]) continue; |
3255 | nin2++; |
3256 | // |
3257 | // |
3258 | Double_t sy1=0.1, sz1=0.1; |
3259 | Double_t sy2=0.1, sz2=0.1; |
3260 | Double_t sy3=0.1, sy=0.1, sz=0.1; |
1627d1c4 |
3261 | |
b67e07dc |
3262 | Double_t f40=(F1(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy; |
3263 | Double_t f42=(F1(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy; |
3264 | Double_t f43=(F1(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy; |
3265 | Double_t f20=(F2(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy; |
3266 | Double_t f22=(F2(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy; |
3267 | Double_t f23=(F2(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy; |
91162307 |
3268 | |
b67e07dc |
3269 | Double_t f30=(F3(x1,y1+sy,x2,y2,z1,z2)-x[3])/sy; |
3270 | Double_t f31=(F3(x1,y1,x2,y2,z1+sz,z2)-x[3])/sz; |
3271 | Double_t f32=(F3(x1,y1,x2,y2+sy,z1,z2)-x[3])/sy; |
3272 | Double_t f34=(F3(x1,y1,x2,y2,z1,z2+sz)-x[3])/sz; |
1627d1c4 |
3273 | |
3274 | c[0]=sy1; |
91162307 |
3275 | c[1]=0.; c[2]=sz1; |
1627d1c4 |
3276 | c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23; |
3277 | c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22; |
3278 | c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34; |
3279 | c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23; |
3280 | c[13]=f30*sy1*f40+f32*sy2*f42; |
3281 | c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; |
3282 | |
91162307 |
3283 | // if (!BuildSeed(kr1[is],kcl,0,x1,x2,x3,x,c)) continue; |
3284 | |
3285 | UInt_t index=kr1.GetIndex(is); |
3286 | AliTPCseed *track=new(seed) AliTPCseed(index, x, c, x1, sec*alpha+shift); |
3287 | |
3288 | track->fIsSeeding = kTRUE; |
3289 | |
3290 | nin++; |
3291 | FollowProlongation(*track, i1-7,1); |
3292 | if (track->GetNumberOfClusters() < track->fNFoundable*0.75 || |
3293 | track->fNShared>0.6*track->GetNumberOfClusters() || ( track->GetSigmaY2()+ track->GetSigmaZ2())>0.6){ |
3294 | seed->Reset(); |
3295 | seed->~AliTPCseed(); |
3296 | continue; |
3297 | } |
3298 | nout1++; |
3299 | nout2++; |
3300 | //Int_t rc = 1; |
3301 | FollowProlongation(*track, i2,1); |
3302 | track->fBConstrain =0; |
3303 | track->fLastPoint = i1+fInnerSec->GetNRows(); // first cluster in track position |
3304 | track->fFirstPoint = track->fLastPoint; |
3305 | |
3306 | if (track->GetNumberOfClusters()<(i1-i2)*0.5 || |
3307 | track->GetNumberOfClusters()<track->fNFoundable*0.7 || |
3308 | track->fNShared>2. || track->GetChi2()/track->GetNumberOfClusters()>6 || ( track->GetSigmaY2()+ track->GetSigmaZ2())>0.5 ) { |
3309 | seed->Reset(); |
3310 | seed->~AliTPCseed(); |
3311 | continue; |
3312 | } |
3313 | |
3314 | { |
3315 | FollowProlongation(*track, TMath::Max(i2-10,0),1); |
3316 | AliTPCseed * track2 = MakeSeed(track,0.2,0.5,0.9); |
3317 | FollowProlongation(*track2, i2,1); |
3318 | track2->fBConstrain = kFALSE; |
3319 | track2->fSeedType = 4; |
3320 | arr->AddLast(track2); |
3321 | seed->Reset(); |
3322 | seed->~AliTPCseed(); |
3323 | } |
3324 | |
3325 | |
3326 | //arr->AddLast(track); |
3327 | //seed = new AliTPCseed; |
3328 | nout3++; |
3329 | } |
3330 | } |
3331 | |
6bdc18d6 |
3332 | if (fDebug>3){ |
3333 | Info("MakeSeeds5","\nSeeding statiistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2,nout3); |
91162307 |
3334 | } |
3335 | delete seed; |
3336 | } |
3337 | |
3338 | |
3339 | //_____________________________________________________________________________ |
176aff27 |
3340 | void AliTPCtrackerMI::MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t */*cuts[4]*/, |
3341 | Float_t deltay, Bool_t /*bconstrain*/) { |
91162307 |
3342 | //----------------------------------------------------------------- |
3343 | // This function creates track seeds - without vertex constraint |
3344 | //----------------------------------------------------------------- |
3345 | // cuts[0] - fP4 cut - not applied |
3346 | // cuts[1] - tan(phi) cut |
3347 | // cuts[2] - zvertex cut - not applied |
3348 | // cuts[3] - fP3 cut |
3349 | Int_t nin0=0; |
3350 | Int_t nin1=0; |
3351 | Int_t nin2=0; |
3352 | Int_t nin3=0; |
3353 | // Int_t nin4=0; |
3354 | //Int_t nin5=0; |
3355 | |
3356 | |
3357 | |
3358 | Double_t alpha=fOuterSec->GetAlpha(), shift=fOuterSec->GetAlphaShift(); |
3359 | // Double_t cs=cos(alpha), sn=sin(alpha); |
3360 | Int_t row0 = (i1+i2)/2; |
3361 | Int_t drow = (i1-i2)/2; |
3362 | const AliTPCRow& kr0=fSectors[sec][row0]; |
3363 | AliTPCRow * kr=0; |
3364 | |
3365 | AliTPCpolyTrack polytrack; |
3366 | Int_t nclusters=fSectors[sec][row0]; |
3367 | AliTPCseed * seed = new AliTPCseed; |
3368 | |
3369 | Int_t sumused=0; |
3370 | Int_t cused=0; |
3371 | Int_t cnused=0; |
3372 | for (Int_t is=0; is < nclusters; is++) { //LOOP over clusters |
3373 | Int_t nfound =0; |
3374 | Int_t nfoundable =0; |
3375 | for (Int_t iter =1; iter<2; iter++){ //iterations |
3376 | const AliTPCRow& krm=fSectors[sec][row0-iter]; |
3377 | const AliTPCRow& krp=fSectors[sec][row0+iter]; |
3378 | const AliTPCclusterMI * cl= kr0[is]; |
3379 | |
3380 | if (cl->IsUsed(10)) { |
3381 | cused++; |
3382 | } |
3383 | else{ |
3384 | cnused++; |
3385 | } |
3386 | Double_t x = kr0.GetX(); |
3387 | // Initialization of the polytrack |
3388 | nfound =0; |
3389 | nfoundable =0; |
3390 | polytrack.Reset(); |
3391 | // |
3392 | Double_t y0= cl->GetY(); |
3393 | Double_t z0= cl->GetZ(); |
3394 | Float_t erry = 0; |
3395 | Float_t errz = 0; |
3396 | |
3397 | Double_t ymax = fSectors->GetMaxY(row0)-kr0.fDeadZone-1.5; |
3398 | if (deltay>0 && TMath::Abs(ymax-TMath::Abs(y0))> deltay ) continue; // seed only at the edge |
3399 | |
3400 | erry = (0.5)*cl->GetSigmaY2()/TMath::Sqrt(cl->GetQ())*6; |
3401 | errz = (0.5)*cl->GetSigmaZ2()/TMath::Sqrt(cl->GetQ())*6; |
3402 | polytrack.AddPoint(x,y0,z0,erry, errz); |
3403 | |
3404 | sumused=0; |
3405 | if (cl->IsUsed(10)) sumused++; |
3406 | |
3407 | |
3408 | Float_t roady = (5*TMath::Sqrt(cl->GetSigmaY2()+0.2)+1.)*iter; |
3409 | Float_t roadz = (5*TMath::Sqrt(cl->GetSigmaZ2()+0.2)+1.)*iter; |
3410 | // |
3411 | x = krm.GetX(); |
3412 | AliTPCclusterMI * cl1 = krm.FindNearest(y0,z0,roady,roadz); |
3413 | if (cl1 && TMath::Abs(ymax-TMath::Abs(y0))) { |
3414 | erry = (0.5)*cl1->GetSigmaY2()/TMath::Sqrt(cl1->GetQ())*3; |
3415 | errz = (0.5)*cl1->GetSigmaZ2()/TMath::Sqrt(cl1->GetQ())*3; |
3416 | if (cl1->IsUsed(10)) sumused++; |
3417 | polytrack.AddPoint(x,cl1->GetY(),cl1->GetZ(),erry,errz); |
3418 | } |
3419 | // |
3420 | x = krp.GetX(); |
3421 | AliTPCclusterMI * cl2 = krp.FindNearest(y0,z0,roady,roadz); |
3422 | if (cl2) { |
3423 | erry = (0.5)*cl2->GetSigmaY2()/TMath::Sqrt(cl2->GetQ())*3; |
3424 | errz = (0.5)*cl2->GetSigmaZ2()/TMath::Sqrt(cl2->GetQ())*3; |
3425 | if (cl2->IsUsed(10)) sumused++; |
3426 | polytrack.AddPoint(x,cl2->GetY(),cl2->GetZ(),erry,errz); |
3427 | } |
3428 | // |
3429 | if (sumused>0) continue; |
3430 | nin0++; |
3431 | polytrack.UpdateParameters(); |
3432 | // follow polytrack |
3433 | roadz = 1.2; |
3434 | roady = 1.2; |
3435 | // |
3436 | Double_t yn,zn; |
3437 | nfoundable = polytrack.GetN(); |
3438 | nfound = nfoundable; |
3439 | // |
|