]>
Commit | Line | Data |
---|---|---|
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 | // | |
47966a6d | 22 | // AliTPC parallel tracker - |
23 | // How to use? - | |
24 | // run AliTPCFindClusters.C macro - clusters neccessary for tracker are founded | |
25 | // run AliTPCFindTracksMI.C macro - to find tracks | |
26 | // tracks are written to AliTPCtracks.root file | |
27 | // for comparison also seeds are written to the same file - to special branch | |
1c53abe2 | 28 | //------------------------------------------------------- |
47966a6d | 29 | |
30 | ||
31 | /* $Id$ */ | |
32 | ||
cc5e9db0 | 33 | #include "Riostream.h" |
6d171107 | 34 | #include <TClonesArray.h> |
35 | #include <TFile.h> | |
36 | #include <TObjArray.h> | |
37 | #include <TTree.h> | |
1c53abe2 | 38 | |
47966a6d | 39 | #include "AliComplexCluster.h" |
91162307 | 40 | #include "AliESD.h" |
9996a03b | 41 | #include "AliESDkink.h" |
91162307 | 42 | #include "AliHelix.h" |
91162307 | 43 | #include "AliRunLoader.h" |
6d171107 | 44 | #include "AliTPCClustersRow.h" |
45 | #include "AliTPCParam.h" | |
9996a03b | 46 | #include "AliTPCReconstructor.h" |
6d171107 | 47 | #include "AliTPCclusterMI.h" |
48 | #include "AliTPCpolyTrack.h" | |
81e97e0d | 49 | #include "AliTPCreco.h" |
50 | #include "AliTPCseed.h" | |
b67e07dc | 51 | #include "AliTPCtrackerMI.h" |
6d171107 | 52 | #include "TStopwatch.h" |
81e97e0d | 53 | #include "AliTPCReconstructor.h" |
54 | #include "AliESDkink.h" | |
55 | #include "AliPID.h" | |
eea478d3 | 56 | #include "TTreeStream.h" |
5d837844 | 57 | #include "AliAlignObj.h" |
58 | #include "AliTrackPointArray.h" | |
59 | ||
6d171107 | 60 | // |
c9427e08 | 61 | |
91162307 | 62 | ClassImp(AliTPCtrackerMI) |
c9427e08 | 63 | |
64 | ||
b67e07dc | 65 | class AliTPCFastMath { |
91162307 | 66 | public: |
b67e07dc | 67 | AliTPCFastMath(); |
91162307 | 68 | static Double_t FastAsin(Double_t x); |
69 | private: | |
b67e07dc | 70 | static Double_t fgFastAsin[20000]; //lookup table for fast asin computation |
91162307 | 71 | }; |
c9427e08 | 72 | |
b67e07dc | 73 | Double_t AliTPCFastMath::fgFastAsin[20000]; |
2274b54b | 74 | AliTPCFastMath gAliTPCFastMath; // needed to fill the LUT |
c9427e08 | 75 | |
b67e07dc | 76 | AliTPCFastMath::AliTPCFastMath(){ |
77 | // | |
78 | // initialized lookup table; | |
91162307 | 79 | for (Int_t i=0;i<10000;i++){ |
80 | fgFastAsin[2*i] = TMath::ASin(i/10000.); | |
81 | fgFastAsin[2*i+1] = (TMath::ASin((i+1)/10000.)-fgFastAsin[2*i]); | |
82 | } | |
c9427e08 | 83 | } |
84 | ||
b67e07dc | 85 | Double_t AliTPCFastMath::FastAsin(Double_t x){ |
86 | // | |
87 | // return asin using lookup table | |
91162307 | 88 | if (x>0){ |
89 | Int_t index = int(x*10000); | |
90 | return fgFastAsin[2*index]+(x*10000.-index)*fgFastAsin[2*index+1]; | |
91 | } | |
92 | x*=-1; | |
93 | Int_t index = int(x*10000); | |
94 | return -(fgFastAsin[2*index]+(x*10000.-index)*fgFastAsin[2*index+1]); | |
1c53abe2 | 95 | } |
96 | ||
97 | ||
98 | ||
99 | ||
91162307 | 100 | Int_t AliTPCtrackerMI::UpdateTrack(AliTPCseed * track, Int_t accept){ |
b67e07dc | 101 | // |
102 | //update track information using current cluster - track->fCurrentCluster | |
103 | ||
1c53abe2 | 104 | |
91162307 | 105 | AliTPCclusterMI* c =track->fCurrentCluster; |
106 | if (accept>0) track->fCurrentClusterIndex1 |=0x8000; //sign not accepted clusters | |
c9427e08 | 107 | |
91162307 | 108 | UInt_t i = track->fCurrentClusterIndex1; |
1c53abe2 | 109 | |
110 | Int_t sec=(i&0xff000000)>>24; | |
91162307 | 111 | //Int_t row = (i&0x00ff0000)>>16; |
1c53abe2 | 112 | track->fRow=(i&0x00ff0000)>>16; |
113 | track->fSector = sec; | |
114 | // Int_t index = i&0xFFFF; | |
115 | if (sec>=fParam->GetNInnerSector()) track->fRow += fParam->GetNRowLow(); | |
d26d9159 | 116 | track->SetClusterIndex2(track->fRow, i); |
91162307 | 117 | //track->fFirstPoint = row; |
118 | //if ( track->fLastPoint<row) track->fLastPoint =row; | |
119 | // if (track->fRow<0 || track->fRow>160) { | |
120 | // printf("problem\n"); | |
121 | //} | |
122 | if (track->fFirstPoint>track->fRow) | |
123 | track->fFirstPoint = track->fRow; | |
124 | if (track->fLastPoint<track->fRow) | |
125 | track->fLastPoint = track->fRow; | |
126 | ||
127 | ||
128 | track->fClusterPointer[track->fRow] = c; | |
1c53abe2 | 129 | // |
130 | ||
3f82c4f2 | 131 | Double_t angle2 = track->GetSnp()*track->GetSnp(); |
1c53abe2 | 132 | angle2 = TMath::Sqrt(angle2/(1-angle2)); |
133 | // | |
134 | //SET NEW Track Point | |
135 | // | |
91162307 | 136 | // if (debug) |
137 | { | |
138 | AliTPCTrackerPoint &point =*(track->GetTrackPoint(track->fRow)); | |
1c53abe2 | 139 | // |
91162307 | 140 | point.SetSigmaY(c->GetSigmaY2()/track->fCurrentSigmaY2); |
141 | point.SetSigmaZ(c->GetSigmaZ2()/track->fCurrentSigmaZ2); | |
142 | point.SetErrY(sqrt(track->fErrorY2)); | |
143 | point.SetErrZ(sqrt(track->fErrorZ2)); | |
1c53abe2 | 144 | // |
91162307 | 145 | point.SetX(track->GetX()); |
146 | point.SetY(track->GetY()); | |
147 | point.SetZ(track->GetZ()); | |
148 | point.SetAngleY(angle2); | |
149 | point.SetAngleZ(track->GetTgl()); | |
150 | if (point.fIsShared){ | |
151 | track->fErrorY2 *= 4; | |
152 | track->fErrorZ2 *= 4; | |
153 | } | |
154 | } | |
155 | ||
156 | Double_t chi2 = track->GetPredictedChi2(track->fCurrentCluster); | |
157 | // | |
158 | track->fErrorY2 *= 1.3; | |
159 | track->fErrorY2 += 0.01; | |
160 | track->fErrorZ2 *= 1.3; | |
161 | track->fErrorZ2 += 0.005; | |
162 | //} | |
163 | if (accept>0) return 0; | |
164 | if (track->GetNumberOfClusters()%20==0){ | |
165 | // if (track->fHelixIn){ | |
166 | // TClonesArray & larr = *(track->fHelixIn); | |
167 | // Int_t ihelix = larr.GetEntriesFast(); | |
168 | // new(larr[ihelix]) AliHelix(*track) ; | |
169 | //} | |
1c53abe2 | 170 | } |
91162307 | 171 | track->fNoCluster =0; |
172 | return track->Update(c,chi2,i); | |
173 | } | |
174 | ||
175 | ||
176 | ||
177 | Int_t AliTPCtrackerMI::AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster, Float_t factor, | |
178 | Float_t cory, Float_t corz) | |
179 | { | |
1c53abe2 | 180 | // |
91162307 | 181 | // decide according desired precision to accept given |
182 | // cluster for tracking | |
183 | Double_t sy2=ErrY2(seed,cluster)*cory; | |
184 | Double_t sz2=ErrZ2(seed,cluster)*corz; | |
185 | //sy2=ErrY2(seed,cluster)*cory; | |
186 | //sz2=ErrZ2(seed,cluster)*cory; | |
1c53abe2 | 187 | |
91162307 | 188 | Double_t sdistancey2 = sy2+seed->GetSigmaY2(); |
189 | Double_t sdistancez2 = sz2+seed->GetSigmaZ2(); | |
190 | ||
191 | Double_t rdistancey2 = (seed->fCurrentCluster->GetY()-seed->GetY())* | |
192 | (seed->fCurrentCluster->GetY()-seed->GetY())/sdistancey2; | |
193 | Double_t rdistancez2 = (seed->fCurrentCluster->GetZ()-seed->GetZ())* | |
194 | (seed->fCurrentCluster->GetZ()-seed->GetZ())/sdistancez2; | |
195 | ||
196 | Double_t rdistance2 = rdistancey2+rdistancez2; | |
197 | //Int_t accept =0; | |
1c53abe2 | 198 | |
91162307 | 199 | if (rdistance2>16) return 3; |
200 | ||
201 | ||
202 | if ((rdistancey2>9.*factor || rdistancez2>9.*factor) && cluster->GetType()==0) | |
203 | return 2; //suspisiouce - will be changed | |
204 | ||
205 | if ((rdistancey2>6.25*factor || rdistancez2>6.25*factor) && cluster->GetType()>0) | |
206 | // strict cut on overlaped cluster | |
207 | return 2; //suspisiouce - will be changed | |
208 | ||
209 | if ( (rdistancey2>1.*factor || rdistancez2>6.25*factor ) | |
210 | && cluster->GetType()<0){ | |
211 | seed->fNFoundable--; | |
212 | return 2; | |
1c53abe2 | 213 | } |
91162307 | 214 | return 0; |
215 | } | |
216 | ||
217 | ||
1c53abe2 | 218 | |
1c53abe2 | 219 | |
1c53abe2 | 220 | //_____________________________________________________________________________ |
f8aae377 | 221 | AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCParam *par): |
1c53abe2 | 222 | AliTracker(), fkNIS(par->GetNInnerSector()/2), fkNOS(par->GetNOuterSector()/2) |
223 | { | |
224 | //--------------------------------------------------------------------- | |
225 | // The main TPC tracker constructor | |
226 | //--------------------------------------------------------------------- | |
227 | fInnerSec=new AliTPCSector[fkNIS]; | |
228 | fOuterSec=new AliTPCSector[fkNOS]; | |
91162307 | 229 | |
1c53abe2 | 230 | Int_t i; |
231 | for (i=0; i<fkNIS; i++) fInnerSec[i].Setup(par,0); | |
232 | for (i=0; i<fkNOS; i++) fOuterSec[i].Setup(par,1); | |
233 | ||
234 | fN=0; fSectors=0; | |
235 | ||
1c53abe2 | 236 | fSeeds=0; |
237 | fNtracks = 0; | |
91162307 | 238 | fParam = par; |
239 | Int_t nrowlow = par->GetNRowLow(); | |
240 | Int_t nrowup = par->GetNRowUp(); | |
241 | ||
242 | ||
243 | for (Int_t i=0;i<nrowlow;i++){ | |
244 | fXRow[i] = par->GetPadRowRadiiLow(i); | |
245 | fPadLength[i]= par->GetPadPitchLength(0,i); | |
246 | fYMax[i] = fXRow[i]*TMath::Tan(0.5*par->GetInnerAngle()); | |
247 | } | |
248 | ||
249 | ||
250 | for (Int_t i=0;i<nrowup;i++){ | |
251 | fXRow[i+nrowlow] = par->GetPadRowRadiiUp(i); | |
252 | fPadLength[i+nrowlow] = par->GetPadPitchLength(60,i); | |
253 | fYMax[i+nrowlow] = fXRow[i+nrowlow]*TMath::Tan(0.5*par->GetOuterAngle()); | |
254 | } | |
255 | fSeeds=0; | |
256 | // | |
257 | fInput = 0; | |
258 | fOutput = 0; | |
259 | fSeedTree = 0; | |
260 | fTreeDebug =0; | |
261 | fNewIO =0; | |
262 | fDebug =0; | |
263 | fEvent =0; | |
81e97e0d | 264 | fDebugStreamer = new TTreeSRedirector("TPCdebug.root"); |
1c53abe2 | 265 | } |
2fc0c115 | 266 | //________________________________________________________________________ |
58251ea0 | 267 | AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCtrackerMI &t): |
268 | AliTracker(t), | |
269 | fkNIS(t.fkNIS), | |
270 | fkNOS(t.fkNOS) | |
271 | { | |
2fc0c115 | 272 | //------------------------------------ |
273 | // dummy copy constructor | |
274 | //------------------------------------------------------------------ | |
275 | } | |
276 | AliTPCtrackerMI & AliTPCtrackerMI::operator=(const AliTPCtrackerMI& /*r*/){ | |
277 | //------------------------------ | |
278 | // dummy | |
279 | //-------------------------------------------------------------- | |
280 | return *this; | |
281 | } | |
1c53abe2 | 282 | //_____________________________________________________________________________ |
283 | AliTPCtrackerMI::~AliTPCtrackerMI() { | |
284 | //------------------------------------------------------------------ | |
285 | // TPC tracker destructor | |
286 | //------------------------------------------------------------------ | |
287 | delete[] fInnerSec; | |
288 | delete[] fOuterSec; | |
289 | if (fSeeds) { | |
290 | fSeeds->Delete(); | |
291 | delete fSeeds; | |
292 | } | |
81e97e0d | 293 | if (fDebugStreamer) delete fDebugStreamer; |
1c53abe2 | 294 | } |
295 | ||
91162307 | 296 | void AliTPCtrackerMI::SetIO() |
297 | { | |
1c53abe2 | 298 | // |
91162307 | 299 | fNewIO = kTRUE; |
e191bb57 | 300 | fInput = AliRunLoader::GetTreeR("TPC", kFALSE,AliConfig::GetDefaultEventFolderName()); |
d26d9159 | 301 | |
e191bb57 | 302 | fOutput = AliRunLoader::GetTreeT("TPC", kTRUE,AliConfig::GetDefaultEventFolderName()); |
d26d9159 | 303 | if (fOutput){ |
304 | AliTPCtrack *iotrack= new AliTPCtrack; | |
305 | fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100); | |
306 | delete iotrack; | |
307 | } | |
91162307 | 308 | } |
1c53abe2 | 309 | |
d26d9159 | 310 | |
91162307 | 311 | void AliTPCtrackerMI::SetIO(TTree * input, TTree * output, AliESD * event) |
312 | { | |
1c53abe2 | 313 | |
91162307 | 314 | // set input |
315 | fNewIO = kFALSE; | |
316 | fInput = 0; | |
317 | fOutput = 0; | |
318 | fSeedTree = 0; | |
319 | fTreeDebug =0; | |
320 | fInput = input; | |
321 | if (input==0){ | |
322 | return; | |
323 | } | |
324 | //set output | |
325 | fOutput = output; | |
326 | if (output){ | |
327 | AliTPCtrack *iotrack= new AliTPCtrack; | |
328 | // iotrack->fHelixIn = new TClonesArray("AliHelix"); | |
329 | //iotrack->fHelixOut = new TClonesArray("AliHelix"); | |
330 | fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100); | |
331 | delete iotrack; | |
332 | } | |
333 | if (output && (fDebug&2)){ | |
334 | //write the full seed information if specified in debug mode | |
335 | // | |
336 | fSeedTree = new TTree("Seeds","Seeds"); | |
337 | AliTPCseed * vseed = new AliTPCseed; | |
338 | // | |
339 | TClonesArray * arrtr = new TClonesArray("AliTPCTrackPoint",160); | |
340 | arrtr->ExpandCreateFast(160); | |
341 | TClonesArray * arre = new TClonesArray("AliTPCExactPoint",160); | |
342 | // | |
343 | vseed->fPoints = arrtr; | |
344 | vseed->fEPoints = arre; | |
345 | // vseed->fClusterPoints = arrcl; | |
346 | fSeedTree->Branch("seeds","AliTPCseed",&vseed,32000,99); | |
347 | delete arrtr; | |
348 | delete arre; | |
349 | fTreeDebug = new TTree("trackDebug","trackDebug"); | |
350 | TClonesArray * arrd = new TClonesArray("AliTPCTrackPoint2",0); | |
351 | fTreeDebug->Branch("debug",&arrd,32000,99); | |
1c53abe2 | 352 | } |
1c53abe2 | 353 | |
1c53abe2 | 354 | |
91162307 | 355 | //set ESD event |
356 | fEvent = event; | |
357 | } | |
1c53abe2 | 358 | |
d26d9159 | 359 | void AliTPCtrackerMI::FillESD(TObjArray* arr) |
91162307 | 360 | { |
47966a6d | 361 | // |
362 | // | |
363 | //fill esds using updated tracks | |
91162307 | 364 | if (fEvent){ |
365 | // write tracks to the event | |
366 | // store index of the track | |
d26d9159 | 367 | Int_t nseed=arr->GetEntriesFast(); |
51ad6848 | 368 | //FindKinks(arr,fEvent); |
91162307 | 369 | for (Int_t i=0; i<nseed; i++) { |
d26d9159 | 370 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
91162307 | 371 | if (!pt) continue; |
51ad6848 | 372 | pt->UpdatePoints(); |
eea478d3 | 373 | // pt->PropagateTo(fParam->GetInnerRadiusLow()); |
374 | if (pt->GetKinkIndex(0)<=0){ //don't propagate daughter tracks | |
375 | pt->PropagateTo(fParam->GetInnerRadiusLow()); | |
376 | } | |
51ad6848 | 377 | |
378 | if (( pt->GetPoints()[2]- pt->GetPoints()[0])>5 && pt->GetPoints()[3]>0.8){ | |
379 | AliESDtrack iotrack; | |
380 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); | |
381 | iotrack.SetTPCPoints(pt->GetPoints()); | |
382 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); | |
81e97e0d | 383 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
384 | // iotrack.SetTPCpid(pt->fTPCr); | |
51ad6848 | 385 | //iotrack.SetTPCindex(i); |
386 | fEvent->AddTrack(&iotrack); | |
387 | continue; | |
388 | } | |
389 | ||
4d158c36 | 390 | if ( (pt->GetNumberOfClusters()>70)&& (Float_t(pt->GetNumberOfClusters())/Float_t(pt->fNFoundable))>0.55) { |
d26d9159 | 391 | AliESDtrack iotrack; |
51ad6848 | 392 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); |
393 | iotrack.SetTPCPoints(pt->GetPoints()); | |
d26d9159 | 394 | //iotrack.SetTPCindex(i); |
51ad6848 | 395 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); |
81e97e0d | 396 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
397 | // iotrack.SetTPCpid(pt->fTPCr); | |
d26d9159 | 398 | fEvent->AddTrack(&iotrack); |
a42a6bae | 399 | continue; |
400 | } | |
51ad6848 | 401 | // |
402 | // short tracks - maybe decays | |
403 | ||
a42a6bae | 404 | if ( (pt->GetNumberOfClusters()>30) && (Float_t(pt->GetNumberOfClusters())/Float_t(pt->fNFoundable))>0.70) { |
405 | Int_t found,foundable,shared; | |
406 | pt->GetClusterStatistic(0,60,found, foundable,shared,kFALSE); | |
407 | if ( (found>20) && (pt->fNShared/float(pt->GetNumberOfClusters())<0.2)){ | |
408 | AliESDtrack iotrack; | |
409 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); | |
410 | //iotrack.SetTPCindex(i); | |
51ad6848 | 411 | iotrack.SetTPCPoints(pt->GetPoints()); |
412 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); | |
81e97e0d | 413 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
414 | //iotrack.SetTPCpid(pt->fTPCr); | |
a42a6bae | 415 | fEvent->AddTrack(&iotrack); |
416 | continue; | |
417 | } | |
418 | } | |
419 | ||
420 | if ( (pt->GetNumberOfClusters()>20) && (Float_t(pt->GetNumberOfClusters())/Float_t(pt->fNFoundable))>0.8) { | |
421 | Int_t found,foundable,shared; | |
422 | pt->GetClusterStatistic(0,60,found, foundable,shared,kFALSE); | |
423 | if (found<20) continue; | |
424 | if (pt->fNShared/float(pt->GetNumberOfClusters())>0.2) continue; | |
425 | // | |
426 | AliESDtrack iotrack; | |
427 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); | |
51ad6848 | 428 | iotrack.SetTPCPoints(pt->GetPoints()); |
429 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); | |
81e97e0d | 430 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
431 | //iotrack.SetTPCpid(pt->fTPCr); | |
51ad6848 | 432 | //iotrack.SetTPCindex(i); |
433 | fEvent->AddTrack(&iotrack); | |
434 | continue; | |
435 | } | |
436 | // short tracks - secondaties | |
437 | // | |
438 | if ( (pt->GetNumberOfClusters()>30) ) { | |
439 | Int_t found,foundable,shared; | |
440 | pt->GetClusterStatistic(128,158,found, foundable,shared,kFALSE); | |
441 | if ( (found>20) && (pt->fNShared/float(pt->GetNumberOfClusters())<0.2) &&float(found)/float(foundable)>0.8){ | |
442 | AliESDtrack iotrack; | |
443 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); | |
444 | iotrack.SetTPCPoints(pt->GetPoints()); | |
445 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); | |
81e97e0d | 446 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
447 | //iotrack.SetTPCpid(pt->fTPCr); | |
51ad6848 | 448 | //iotrack.SetTPCindex(i); |
449 | fEvent->AddTrack(&iotrack); | |
450 | continue; | |
451 | } | |
452 | } | |
453 | ||
454 | if ( (pt->GetNumberOfClusters()>15)) { | |
455 | Int_t found,foundable,shared; | |
456 | pt->GetClusterStatistic(138,158,found, foundable,shared,kFALSE); | |
457 | if (found<15) continue; | |
458 | if (pt->fNShared/float(pt->GetNumberOfClusters())>0.2) continue; | |
459 | if (float(found)/float(foundable)<0.8) continue; | |
460 | // | |
461 | AliESDtrack iotrack; | |
462 | iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin); | |
463 | iotrack.SetTPCPoints(pt->GetPoints()); | |
464 | iotrack.SetKinkIndexes(pt->GetKinkIndexes()); | |
81e97e0d | 465 | iotrack.SetV0Indexes(pt->GetV0Indexes()); |
466 | // iotrack.SetTPCpid(pt->fTPCr); | |
a42a6bae | 467 | //iotrack.SetTPCindex(i); |
468 | fEvent->AddTrack(&iotrack); | |
469 | continue; | |
470 | } | |
91162307 | 471 | } |
1c53abe2 | 472 | } |
51ad6848 | 473 | printf("Number of filled ESDs-\t%d\n",fEvent->GetNumberOfTracks()); |
d26d9159 | 474 | } |
475 | ||
47966a6d | 476 | void AliTPCtrackerMI::WriteTracks(TTree * tree) |
477 | { | |
d26d9159 | 478 | // |
47966a6d | 479 | // write tracks from seed array to selected tree |
d26d9159 | 480 | // |
481 | fOutput = tree; | |
482 | if (fOutput){ | |
483 | AliTPCtrack *iotrack= new AliTPCtrack; | |
484 | fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100); | |
485 | } | |
486 | WriteTracks(); | |
487 | } | |
488 | ||
489 | void AliTPCtrackerMI::WriteTracks() | |
490 | { | |
491 | // | |
492 | // write tracks to the given output tree - | |
493 | // output specified with SetIO routine | |
494 | if (!fSeeds) return; | |
495 | if (!fOutput){ | |
496 | SetIO(); | |
497 | } | |
1c53abe2 | 498 | |
91162307 | 499 | if (fOutput){ |
500 | AliTPCtrack *iotrack= 0; | |
501 | Int_t nseed=fSeeds->GetEntriesFast(); | |
982aff31 | 502 | //for (Int_t i=0; i<nseed; i++) { |
503 | // iotrack= (AliTPCtrack*)fSeeds->UncheckedAt(i); | |
504 | // if (iotrack) break; | |
505 | //} | |
91162307 | 506 | //TBranch * br = fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100); |
507 | TBranch * br = fOutput->GetBranch("tracks"); | |
508 | br->SetAddress(&iotrack); | |
509 | // | |
510 | for (Int_t i=0; i<nseed; i++) { | |
511 | AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i); | |
512 | if (!pt) continue; | |
982aff31 | 513 | AliTPCtrack * track = new AliTPCtrack(*pt); |
514 | iotrack = track; | |
91162307 | 515 | pt->fLab2 =i; |
516 | // br->SetAddress(&iotrack); | |
517 | fOutput->Fill(); | |
982aff31 | 518 | delete track; |
91162307 | 519 | iotrack =0; |
520 | } | |
982aff31 | 521 | //fOutput->GetDirectory()->cd(); |
522 | //fOutput->Write(); | |
91162307 | 523 | } |
d26d9159 | 524 | // delete iotrack; |
525 | // | |
91162307 | 526 | if (fSeedTree){ |
527 | //write the full seed information if specified in debug mode | |
528 | ||
529 | AliTPCseed * vseed = new AliTPCseed; | |
530 | // | |
531 | TClonesArray * arrtr = new TClonesArray("AliTPCTrackPoint",160); | |
532 | arrtr->ExpandCreateFast(160); | |
533 | //TClonesArray * arrcl = new TClonesArray("AliTPCclusterMI",160); | |
534 | //arrcl->ExpandCreateFast(160); | |
535 | TClonesArray * arre = new TClonesArray("AliTPCExactPoint",160); | |
536 | // | |
537 | vseed->fPoints = arrtr; | |
538 | vseed->fEPoints = arre; | |
539 | // vseed->fClusterPoints = arrcl; | |
540 | //TBranch * brseed = seedtree->Branch("seeds","AliTPCseed",&vseed,32000,99); | |
541 | TBranch * brseed = fSeedTree->GetBranch("seeds"); | |
542 | ||
543 | Int_t nseed=fSeeds->GetEntriesFast(); | |
544 | ||
545 | for (Int_t i=0; i<nseed; i++) { | |
546 | AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i); | |
547 | if (!pt) continue; | |
548 | pt->fPoints = arrtr; | |
549 | // pt->fClusterPoints = arrcl; | |
550 | pt->fEPoints = arre; | |
551 | pt->RebuildSeed(); | |
552 | vseed = pt; | |
553 | brseed->SetAddress(&vseed); | |
554 | fSeedTree->Fill(); | |
555 | pt->fPoints = 0; | |
556 | pt->fEPoints = 0; | |
557 | // pt->fClusterPoints = 0; | |
558 | } | |
559 | fSeedTree->Write(); | |
560 | if (fTreeDebug) fTreeDebug->Write(); | |
561 | } | |
1c53abe2 | 562 | |
91162307 | 563 | } |
1c53abe2 | 564 | |
1c53abe2 | 565 | |
1c53abe2 | 566 | |
567 | ||
91162307 | 568 | Double_t AliTPCtrackerMI::ErrY2(AliTPCseed* seed, AliTPCclusterMI * cl){ |
569 | // | |
570 | // | |
571 | //seed->SetErrorY2(0.1); | |
572 | //return 0.1; | |
573 | //calculate look-up table at the beginning | |
574 | static Bool_t ginit = kFALSE; | |
575 | static Float_t gnoise1,gnoise2,gnoise3; | |
576 | static Float_t ggg1[10000]; | |
577 | static Float_t ggg2[10000]; | |
578 | static Float_t ggg3[10000]; | |
579 | static Float_t glandau1[10000]; | |
580 | static Float_t glandau2[10000]; | |
581 | static Float_t glandau3[10000]; | |
582 | // | |
583 | static Float_t gcor01[500]; | |
584 | static Float_t gcor02[500]; | |
585 | static Float_t gcorp[500]; | |
586 | // | |
1c53abe2 | 587 | |
91162307 | 588 | // |
589 | if (ginit==kFALSE){ | |
590 | for (Int_t i=1;i<500;i++){ | |
591 | Float_t rsigma = float(i)/100.; | |
592 | gcor02[i] = TMath::Max(0.78 +TMath::Exp(7.4*(rsigma-1.2)),0.6); | |
593 | gcor01[i] = TMath::Max(0.72 +TMath::Exp(3.36*(rsigma-1.2)),0.6); | |
594 | gcorp[i] = TMath::Max(TMath::Power((rsigma+0.5),1.5),1.2); | |
595 | } | |
1c53abe2 | 596 | |
91162307 | 597 | // |
598 | for (Int_t i=3;i<10000;i++){ | |
599 | // | |
600 | // | |
601 | // inner sector | |
602 | Float_t amp = float(i); | |
603 | Float_t padlength =0.75; | |
604 | gnoise1 = 0.0004/padlength; | |
605 | Float_t nel = 0.268*amp; | |
606 | Float_t nprim = 0.155*amp; | |
607 | ggg1[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.001*nel/(padlength*padlength))/nel; | |
608 | glandau1[i] = (2.+0.12*nprim)*0.5* (2.+nprim*nprim*0.001/(padlength*padlength))/nprim; | |
609 | if (glandau1[i]>1) glandau1[i]=1; | |
610 | glandau1[i]*=padlength*padlength/12.; | |
611 | // | |
612 | // outer short | |
613 | padlength =1.; | |
614 | gnoise2 = 0.0004/padlength; | |
615 | nel = 0.3*amp; | |
616 | nprim = 0.133*amp; | |
617 | ggg2[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel; | |
618 | glandau2[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; | |
619 | if (glandau2[i]>1) glandau2[i]=1; | |
620 | glandau2[i]*=padlength*padlength/12.; | |
621 | // | |
622 | // | |
623 | // outer long | |
624 | padlength =1.5; | |
625 | gnoise3 = 0.0004/padlength; | |
626 | nel = 0.3*amp; | |
627 | nprim = 0.133*amp; | |
628 | ggg3[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel; | |
629 | glandau3[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; | |
630 | if (glandau3[i]>1) glandau3[i]=1; | |
631 | glandau3[i]*=padlength*padlength/12.; | |
632 | // | |
633 | } | |
634 | ginit = kTRUE; | |
635 | } | |
1c53abe2 | 636 | // |
637 | // | |
91162307 | 638 | // |
639 | Int_t amp = int(TMath::Abs(cl->GetQ())); | |
640 | if (amp>9999) { | |
641 | seed->SetErrorY2(1.); | |
642 | return 1.; | |
643 | } | |
1c53abe2 | 644 | Float_t snoise2; |
c9427e08 | 645 | Float_t z = TMath::Abs(fParam->GetZLength()-TMath::Abs(seed->GetZ())); |
91162307 | 646 | Int_t ctype = cl->GetType(); |
647 | Float_t padlength= GetPadPitchLength(seed->fRow); | |
3f82c4f2 | 648 | Double_t angle2 = seed->GetSnp()*seed->GetSnp(); |
91162307 | 649 | angle2 = angle2/(1-angle2); |
650 | // | |
651 | //cluster "quality" | |
652 | Int_t rsigmay = int(100.*cl->GetSigmaY2()/(seed->fCurrentSigmaY2)); | |
653 | Float_t res; | |
1c53abe2 | 654 | // |
1c53abe2 | 655 | if (fSectors==fInnerSec){ |
91162307 | 656 | snoise2 = gnoise1; |
657 | res = ggg1[amp]*z+glandau1[amp]*angle2; | |
658 | if (ctype==0) res *= gcor01[rsigmay]; | |
659 | if ((ctype>0)){ | |
660 | res+=0.002; | |
661 | res*= gcorp[rsigmay]; | |
662 | } | |
1c53abe2 | 663 | } |
664 | else { | |
91162307 | 665 | if (padlength<1.1){ |
666 | snoise2 = gnoise2; | |
667 | res = ggg2[amp]*z+glandau2[amp]*angle2; | |
668 | if (ctype==0) res *= gcor02[rsigmay]; | |
669 | if ((ctype>0)){ | |
670 | res+=0.002; | |
671 | res*= gcorp[rsigmay]; | |
672 | } | |
673 | } | |
674 | else{ | |
675 | snoise2 = gnoise3; | |
676 | res = ggg3[amp]*z+glandau3[amp]*angle2; | |
677 | if (ctype==0) res *= gcor02[rsigmay]; | |
678 | if ((ctype>0)){ | |
679 | res+=0.002; | |
680 | res*= gcorp[rsigmay]; | |
681 | } | |
682 | } | |
683 | } | |
1c53abe2 | 684 | |
91162307 | 685 | if (ctype<0){ |
686 | res+=0.005; | |
687 | res*=2.4; // overestimate error 2 times | |
688 | } | |
689 | res+= snoise2; | |
690 | ||
1c53abe2 | 691 | if (res<2*snoise2) |
91162307 | 692 | res = 2*snoise2; |
693 | ||
694 | seed->SetErrorY2(res); | |
1c53abe2 | 695 | return res; |
1c53abe2 | 696 | |
697 | ||
91162307 | 698 | } |
c9427e08 | 699 | |
700 | ||
701 | ||
91162307 | 702 | Double_t AliTPCtrackerMI::ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl){ |
703 | // | |
704 | // | |
705 | //seed->SetErrorY2(0.1); | |
706 | //return 0.1; | |
707 | //calculate look-up table at the beginning | |
708 | static Bool_t ginit = kFALSE; | |
709 | static Float_t gnoise1,gnoise2,gnoise3; | |
710 | static Float_t ggg1[10000]; | |
711 | static Float_t ggg2[10000]; | |
712 | static Float_t ggg3[10000]; | |
713 | static Float_t glandau1[10000]; | |
714 | static Float_t glandau2[10000]; | |
715 | static Float_t glandau3[10000]; | |
716 | // | |
717 | static Float_t gcor01[1000]; | |
718 | static Float_t gcor02[1000]; | |
719 | static Float_t gcorp[1000]; | |
1627d1c4 | 720 | // |
1627d1c4 | 721 | |
91162307 | 722 | // |
723 | if (ginit==kFALSE){ | |
724 | for (Int_t i=1;i<1000;i++){ | |
725 | Float_t rsigma = float(i)/100.; | |
726 | gcor02[i] = TMath::Max(0.81 +TMath::Exp(6.8*(rsigma-1.2)),0.6); | |
727 | gcor01[i] = TMath::Max(0.72 +TMath::Exp(2.04*(rsigma-1.2)),0.6); | |
728 | gcorp[i] = TMath::Max(TMath::Power((rsigma+0.5),1.5),1.2); | |
729 | } | |
1c53abe2 | 730 | |
91162307 | 731 | // |
732 | for (Int_t i=3;i<10000;i++){ | |
733 | // | |
734 | // | |
735 | // inner sector | |
736 | Float_t amp = float(i); | |
737 | Float_t padlength =0.75; | |
738 | gnoise1 = 0.0004/padlength; | |
739 | Float_t nel = 0.268*amp; | |
740 | Float_t nprim = 0.155*amp; | |
741 | ggg1[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.001*nel/(padlength*padlength))/nel; | |
742 | glandau1[i] = (2.+0.12*nprim)*0.5* (2.+nprim*nprim*0.001/(padlength*padlength))/nprim; | |
743 | if (glandau1[i]>1) glandau1[i]=1; | |
744 | glandau1[i]*=padlength*padlength/12.; | |
745 | // | |
746 | // outer short | |
747 | padlength =1.; | |
748 | gnoise2 = 0.0004/padlength; | |
749 | nel = 0.3*amp; | |
750 | nprim = 0.133*amp; | |
751 | ggg2[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel; | |
752 | glandau2[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; | |
753 | if (glandau2[i]>1) glandau2[i]=1; | |
754 | glandau2[i]*=padlength*padlength/12.; | |
755 | // | |
756 | // | |
757 | // outer long | |
758 | padlength =1.5; | |
759 | gnoise3 = 0.0004/padlength; | |
760 | nel = 0.3*amp; | |
761 | nprim = 0.133*amp; | |
762 | ggg3[i] = fParam->GetDiffT()*fParam->GetDiffT()*(2+0.0008*nel/(padlength*padlength))/nel; | |
763 | glandau3[i] = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; | |
764 | if (glandau3[i]>1) glandau3[i]=1; | |
765 | glandau3[i]*=padlength*padlength/12.; | |
766 | // | |
767 | } | |
768 | ginit = kTRUE; | |
769 | } | |
770 | // | |
771 | // | |
772 | // | |
773 | Int_t amp = int(TMath::Abs(cl->GetQ())); | |
774 | if (amp>9999) { | |
775 | seed->SetErrorY2(1.); | |
776 | return 1.; | |
777 | } | |
778 | Float_t snoise2; | |
779 | Float_t z = TMath::Abs(fParam->GetZLength()-TMath::Abs(seed->GetZ())); | |
780 | Int_t ctype = cl->GetType(); | |
781 | Float_t padlength= GetPadPitchLength(seed->fRow); | |
782 | // | |
3f82c4f2 | 783 | Double_t angle2 = seed->GetSnp()*seed->GetSnp(); |
91162307 | 784 | // if (angle2<0.6) angle2 = 0.6; |
785 | angle2 = seed->GetTgl()*seed->GetTgl()*(1+angle2/(1-angle2)); | |
786 | // | |
787 | //cluster "quality" | |
788 | Int_t rsigmaz = int(100.*cl->GetSigmaZ2()/(seed->fCurrentSigmaZ2)); | |
789 | Float_t res; | |
790 | // | |
791 | if (fSectors==fInnerSec){ | |
792 | snoise2 = gnoise1; | |
793 | res = ggg1[amp]*z+glandau1[amp]*angle2; | |
794 | if (ctype==0) res *= gcor01[rsigmaz]; | |
795 | if ((ctype>0)){ | |
796 | res+=0.002; | |
797 | res*= gcorp[rsigmaz]; | |
798 | } | |
799 | } | |
800 | else { | |
801 | if (padlength<1.1){ | |
802 | snoise2 = gnoise2; | |
803 | res = ggg2[amp]*z+glandau2[amp]*angle2; | |
804 | if (ctype==0) res *= gcor02[rsigmaz]; | |
805 | if ((ctype>0)){ | |
806 | res+=0.002; | |
807 | res*= gcorp[rsigmaz]; | |
808 | } | |
809 | } | |
810 | else{ | |
811 | snoise2 = gnoise3; | |
812 | res = ggg3[amp]*z+glandau3[amp]*angle2; | |
813 | if (ctype==0) res *= gcor02[rsigmaz]; | |
814 | if ((ctype>0)){ | |
815 | res+=0.002; | |
816 | res*= gcorp[rsigmaz]; | |
817 | } | |
818 | } | |
819 | } | |
820 | ||
821 | if (ctype<0){ | |
822 | res+=0.002; | |
823 | res*=1.3; | |
824 | } | |
825 | if ((ctype<0) &&<70){ | |
826 | res+=0.002; | |
827 | res*=1.3; | |
828 | } | |
829 | res += snoise2; | |
830 | if (res<2*snoise2) | |
831 | res = 2*snoise2; | |
832 | if (res>3) res =3; | |
833 | seed->SetErrorZ2(res); | |
834 | return res; | |
835 | } | |
836 | ||
837 | ||
838 | ||
839 | /* | |
840 | Double_t AliTPCtrackerMI::ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl){ | |
841 | // | |
842 | // | |
843 | //seed->SetErrorZ2(0.1); | |
844 | //return 0.1; | |
845 | ||
846 | Float_t snoise2; | |
847 | Float_t z = TMath::Abs(fParam->GetZLength()-TMath::Abs(seed->GetZ())); | |
848 | // | |
849 | Float_t rsigmaz = cl->GetSigmaZ2()/(seed->fCurrentSigmaZ2); | |
850 | Int_t ctype = cl->GetType(); | |
851 | Float_t amp = TMath::Abs(cl->GetQ()); | |
852 | ||
853 | Float_t nel; | |
854 | Float_t nprim; | |
855 | // | |
856 | Float_t landau=2 ; //landau fluctuation part | |
857 | Float_t gg=2; // gg fluctuation part | |
858 | Float_t padlength= GetPadPitchLength(seed->GetX()); | |
859 | ||
860 | if (fSectors==fInnerSec){ | |
861 | snoise2 = 0.0004/padlength; | |
862 | nel = 0.268*amp; | |
863 | nprim = 0.155*amp; | |
864 | gg = (2+0.001*nel/(padlength*padlength))/nel; | |
865 | landau = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; | |
866 | if (landau>1) landau=1; | |
867 | } | |
868 | else { | |
869 | snoise2 = 0.0004/padlength; | |
870 | nel = 0.3*amp; | |
871 | nprim = 0.133*amp; | |
872 | gg = (2+0.0008*nel/(padlength*padlength))/nel; | |
873 | landau = (2.+0.12*nprim)*0.5*(2.+nprim*nprim*0.001/(padlength*padlength))/nprim; | |
874 | if (landau>1) landau=1; | |
875 | } | |
876 | Float_t sdiff = gg*fParam->GetDiffT()*fParam->GetDiffT()*z; | |
877 | ||
878 | // | |
879 | Float_t angle2 = seed->GetSnp()*seed->GetSnp(); | |
880 | angle2 = TMath::Sqrt((1-angle2)); | |
881 | if (angle2<0.6) angle2 = 0.6; | |
882 | //angle2 = 1; | |
883 | ||
884 | Float_t angle = seed->GetTgl()/angle2; | |
885 | Float_t angular = landau*angle*angle*padlength*padlength/12.; | |
886 | Float_t res = sdiff + angular; | |
887 | ||
888 | ||
889 | if ((ctype==0) && (fSectors ==fOuterSec)) | |
890 | res *= 0.81 +TMath::Exp(6.8*(rsigmaz-1.2)); | |
891 | ||
892 | if ((ctype==0) && (fSectors ==fInnerSec)) | |
893 | res *= 0.72 +TMath::Exp(2.04*(rsigmaz-1.2)); | |
894 | ||
895 | if ((ctype>0)){ | |
896 | res+=0.005; | |
897 | res*= TMath::Power(rsigmaz+0.5,1.5); //0.31+0.147*ctype; | |
898 | } | |
899 | if (ctype<0){ | |
900 | res+=0.002; | |
901 | res*=1.3; | |
902 | } | |
903 | if ((ctype<0) &&<70){ | |
904 | res+=0.002; | |
905 | res*=1.3; | |
906 | } | |
907 | res += snoise2; | |
908 | if (res<2*snoise2) | |
909 | res = 2*snoise2; | |
910 | ||
911 | seed->SetErrorZ2(res); | |
912 | return res; | |
913 | } | |
914 | */ | |
915 | ||
916 | ||
917 | ||
1c53abe2 | 918 | |
c9427e08 | 919 | void AliTPCtrackerMI::RotateToLocal(AliTPCseed *seed) |
920 | { | |
921 | //rotate to track "local coordinata | |
922 | Float_t x = seed->GetX(); | |
923 | Float_t y = seed->GetY(); | |
924 | Float_t ymax = x*TMath::Tan(0.5*fSectors->GetAlpha()); | |
91162307 | 925 | |
c9427e08 | 926 | if (y > ymax) { |
927 | seed->fRelativeSector= (seed->fRelativeSector+1) % fN; | |
928 | if (!seed->Rotate(fSectors->GetAlpha())) | |
929 | return; | |
930 | } else if (y <-ymax) { | |
931 | seed->fRelativeSector= (seed->fRelativeSector-1+fN) % fN; | |
932 | if (!seed->Rotate(-fSectors->GetAlpha())) | |
933 | return; | |
934 | } | |
1c53abe2 | 935 | |
c9427e08 | 936 | } |
1c53abe2 | 937 | |
938 | ||
939 | ||
1c53abe2 | 940 | //_____________________________________________________________________________ |
b67e07dc | 941 | Double_t AliTPCtrackerMI::F1old(Double_t x1,Double_t y1, |
1c53abe2 | 942 | Double_t x2,Double_t y2, |
943 | Double_t x3,Double_t y3) | |
944 | { | |
945 | //----------------------------------------------------------------- | |
946 | // Initial approximation of the track curvature | |
947 | //----------------------------------------------------------------- | |
948 | Double_t d=(x2-x1)*(y3-y2)-(x3-x2)*(y2-y1); | |
949 | Double_t a=0.5*((y3-y2)*(y2*y2-y1*y1+x2*x2-x1*x1)- | |
950 | (y2-y1)*(y3*y3-y2*y2+x3*x3-x2*x2)); | |
951 | Double_t b=0.5*((x2-x1)*(y3*y3-y2*y2+x3*x3-x2*x2)- | |
952 | (x3-x2)*(y2*y2-y1*y1+x2*x2-x1*x1)); | |
953 | ||
954 | Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b); | |
91162307 | 955 | if ( xr*xr+yr*yr<=0.00000000000001) return 100; |
1c53abe2 | 956 | return -xr*yr/sqrt(xr*xr+yr*yr); |
957 | } | |
958 | ||
959 | ||
91162307 | 960 | |
1c53abe2 | 961 | //_____________________________________________________________________________ |
b67e07dc | 962 | Double_t AliTPCtrackerMI::F1(Double_t x1,Double_t y1, |
91162307 | 963 | Double_t x2,Double_t y2, |
964 | Double_t x3,Double_t y3) | |
965 | { | |
966 | //----------------------------------------------------------------- | |
967 | // Initial approximation of the track curvature | |
968 | //----------------------------------------------------------------- | |
969 | x3 -=x1; | |
970 | x2 -=x1; | |
971 | y3 -=y1; | |
972 | y2 -=y1; | |
973 | // | |
974 | Double_t det = x3*y2-x2*y3; | |
975 | if (det==0) { | |
976 | return 100; | |
977 | } | |
978 | // | |
979 | Double_t u = 0.5* (x2*(x2-x3)+y2*(y2-y3))/det; | |
980 | Double_t x0 = x3*0.5-y3*u; | |
981 | Double_t y0 = y3*0.5+x3*u; | |
982 | Double_t c2 = 1/TMath::Sqrt(x0*x0+y0*y0); | |
983 | if (det<0) c2*=-1; | |
984 | return c2; | |
985 | } | |
986 | ||
987 | ||
b67e07dc | 988 | Double_t AliTPCtrackerMI::F2(Double_t x1,Double_t y1, |
1c53abe2 | 989 | Double_t x2,Double_t y2, |
990 | Double_t x3,Double_t y3) | |
91162307 | 991 | { |
992 | //----------------------------------------------------------------- | |
993 | // Initial approximation of the track curvature | |
994 | //----------------------------------------------------------------- | |
995 | x3 -=x1; | |
996 | x2 -=x1; | |
997 | y3 -=y1; | |
998 | y2 -=y1; | |
999 | // | |
1000 | Double_t det = x3*y2-x2*y3; | |
1001 | if (det==0) { | |
1002 | return 100; | |
1003 | } | |
1004 | // | |
1005 | Double_t u = 0.5* (x2*(x2-x3)+y2*(y2-y3))/det; | |
1006 | Double_t x0 = x3*0.5-y3*u; | |
1007 | Double_t y0 = y3*0.5+x3*u; | |
1008 | Double_t c2 = 1/TMath::Sqrt(x0*x0+y0*y0); | |
1009 | if (det<0) c2*=-1; | |
1010 | x0+=x1; | |
1011 | x0*=c2; | |
1012 | return x0; | |
1013 | } | |
1014 | ||
1015 | ||
1016 | ||
1017 | //_____________________________________________________________________________ | |
b67e07dc | 1018 | Double_t AliTPCtrackerMI::F2old(Double_t x1,Double_t y1, |
91162307 | 1019 | Double_t x2,Double_t y2, |
1020 | Double_t x3,Double_t y3) | |
1c53abe2 | 1021 | { |
1022 | //----------------------------------------------------------------- | |
1023 | // Initial approximation of the track curvature times center of curvature | |
1024 | //----------------------------------------------------------------- | |
1025 | Double_t d=(x2-x1)*(y3-y2)-(x3-x2)*(y2-y1); | |
1026 | Double_t a=0.5*((y3-y2)*(y2*y2-y1*y1+x2*x2-x1*x1)- | |
1027 | (y2-y1)*(y3*y3-y2*y2+x3*x3-x2*x2)); | |
1028 | Double_t b=0.5*((x2-x1)*(y3*y3-y2*y2+x3*x3-x2*x2)- | |
1029 | (x3-x2)*(y2*y2-y1*y1+x2*x2-x1*x1)); | |
1030 | ||
1031 | Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b); | |
1032 | ||
1033 | return -a/(d*y1-b)*xr/sqrt(xr*xr+yr*yr); | |
1034 | } | |
1035 | ||
1036 | //_____________________________________________________________________________ | |
b67e07dc | 1037 | Double_t AliTPCtrackerMI::F3(Double_t x1,Double_t y1, |
1c53abe2 | 1038 | Double_t x2,Double_t y2, |
1039 | Double_t z1,Double_t z2) | |
1040 | { | |
1041 | //----------------------------------------------------------------- | |
1042 | // Initial approximation of the tangent of the track dip angle | |
1043 | //----------------------------------------------------------------- | |
1044 | return (z1 - z2)/sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); | |
1045 | } | |
1046 | ||
1047 | ||
b67e07dc | 1048 | Double_t AliTPCtrackerMI::F3n(Double_t x1,Double_t y1, |
91162307 | 1049 | Double_t x2,Double_t y2, |
1050 | Double_t z1,Double_t z2, Double_t c) | |
1c53abe2 | 1051 | { |
91162307 | 1052 | //----------------------------------------------------------------- |
1053 | // Initial approximation of the tangent of the track dip angle | |
1054 | //----------------------------------------------------------------- | |
1055 | ||
1056 | // Double_t angle1; | |
1057 | ||
1058 | //angle1 = (z1-z2)*c/(TMath::ASin(c*x1-ni)-TMath::ASin(c*x2-ni)); | |
1c53abe2 | 1059 | // |
91162307 | 1060 | Double_t d = TMath::Sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); |
1061 | if (TMath::Abs(d*c*0.5)>1) return 0; | |
1062 | // Double_t angle2 = TMath::ASin(d*c*0.5); | |
b67e07dc | 1063 | // Double_t angle2 = AliTPCFastMath::FastAsin(d*c*0.5); |
1064 | Double_t angle2 = (d*c*0.5>0.1)? TMath::ASin(d*c*0.5): AliTPCFastMath::FastAsin(d*c*0.5); | |
91162307 | 1065 | |
1066 | angle2 = (z1-z2)*c/(angle2*2.); | |
1067 | return angle2; | |
1068 | } | |
1069 | ||
1070 | Bool_t AliTPCtrackerMI::GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z) | |
1071 | {//----------------------------------------------------------------- | |
1072 | // This function find proloncation of a track to a reference plane x=x2. | |
1073 | //----------------------------------------------------------------- | |
1074 | ||
1075 | Double_t dx=x2-x1; | |
1076 | ||
1077 | if (TMath::Abs(x[4]*x1 - x[2]) >= 0.999) { | |
1078 | return kFALSE; | |
1c53abe2 | 1079 | } |
f8aae377 | 1080 | |
91162307 | 1081 | Double_t c1=x[4]*x1 - x[2], r1=sqrt(1.- c1*c1); |
1082 | Double_t c2=x[4]*x2 - x[2], r2=sqrt(1.- c2*c2); | |
1083 | y = x[0]; | |
1084 | z = x[1]; | |
1085 | ||
1086 | Double_t dy = dx*(c1+c2)/(r1+r2); | |
1087 | Double_t dz = 0; | |
1088 | // | |
1089 | Double_t delta = x[4]*dx*(c1+c2)/(c1*r2 + c2*r1); | |
1090 | ||
1091 | if (TMath::Abs(delta)>0.01){ | |
1092 | dz = x[3]*TMath::ASin(delta)/x[4]; | |
1093 | }else{ | |
b67e07dc | 1094 | dz = x[3]*AliTPCFastMath::FastAsin(delta)/x[4]; |
91162307 | 1095 | } |
1096 | ||
b67e07dc | 1097 | //dz = x[3]*AliTPCFastMath::FastAsin(delta)/x[4]; |
f8aae377 | 1098 | |
91162307 | 1099 | y+=dy; |
1100 | z+=dz; | |
1101 | ||
1102 | return kTRUE; | |
1c53abe2 | 1103 | } |
1104 | ||
d26d9159 | 1105 | Int_t AliTPCtrackerMI::LoadClusters (TTree *tree) |
1106 | { | |
1107 | // | |
1108 | // | |
1109 | fInput = tree; | |
1110 | return LoadClusters(); | |
1111 | } | |
91162307 | 1112 | |
1113 | Int_t AliTPCtrackerMI::LoadClusters() | |
1c53abe2 | 1114 | { |
1115 | // | |
1116 | // load clusters to the memory | |
91162307 | 1117 | AliTPCClustersRow *clrow= new AliTPCClustersRow; |
1118 | clrow->SetClass("AliTPCclusterMI"); | |
1119 | clrow->SetArray(0); | |
1120 | clrow->GetArray()->ExpandCreateFast(10000); | |
1121 | // | |
1122 | // TTree * tree = fClustersArray.GetTree(); | |
1123 | ||
1124 | TTree * tree = fInput; | |
1125 | TBranch * br = tree->GetBranch("Segment"); | |
1126 | br->SetAddress(&clrow); | |
1127 | // | |
1128 | Int_t j=Int_t(tree->GetEntries()); | |
1c53abe2 | 1129 | for (Int_t i=0; i<j; i++) { |
91162307 | 1130 | br->GetEntry(i); |
1131 | // | |
1132 | Int_t sec,row; | |
1133 | fParam->AdjustSectorRow(clrow->GetID(),sec,row); | |
1134 | // | |
1135 | AliTPCRow * tpcrow=0; | |
1136 | Int_t left=0; | |
1137 | if (sec<fkNIS*2){ | |
1138 | tpcrow = &(fInnerSec[sec%fkNIS][row]); | |
1139 | left = sec/fkNIS; | |
1140 | } | |
1141 | else{ | |
1142 | tpcrow = &(fOuterSec[(sec-fkNIS*2)%fkNOS][row]); | |
1143 | left = (sec-fkNIS*2)/fkNOS; | |
1144 | } | |
1145 | if (left ==0){ | |
1146 | tpcrow->fN1 = clrow->GetArray()->GetEntriesFast(); | |
1147 | tpcrow->fClusters1 = new AliTPCclusterMI[tpcrow->fN1]; | |
1148 | for (Int_t i=0;i<tpcrow->fN1;i++) | |
1149 | tpcrow->fClusters1[i] = *(AliTPCclusterMI*)(clrow->GetArray()->At(i)); | |
1150 | } | |
1151 | if (left ==1){ | |
1152 | tpcrow->fN2 = clrow->GetArray()->GetEntriesFast(); | |
1153 | tpcrow->fClusters2 = new AliTPCclusterMI[tpcrow->fN2]; | |
1154 | for (Int_t i=0;i<tpcrow->fN2;i++) | |
1155 | tpcrow->fClusters2[i] = *(AliTPCclusterMI*)(clrow->GetArray()->At(i)); | |
1156 | } | |
1c53abe2 | 1157 | } |
91162307 | 1158 | // |
1159 | delete clrow; | |
1160 | LoadOuterSectors(); | |
1161 | LoadInnerSectors(); | |
1162 | return 0; | |
1c53abe2 | 1163 | } |
1164 | ||
1165 | ||
91162307 | 1166 | void AliTPCtrackerMI::UnloadClusters() |
1167 | { | |
1168 | // | |
1169 | // unload clusters from the memory | |
1170 | // | |
1171 | Int_t nrows = fOuterSec->GetNRows(); | |
1172 | for (Int_t sec = 0;sec<fkNOS;sec++) | |
1173 | for (Int_t row = 0;row<nrows;row++){ | |
1174 | AliTPCRow* tpcrow = &(fOuterSec[sec%fkNOS][row]); | |
982aff31 | 1175 | // if (tpcrow){ |
1176 | // if (tpcrow->fClusters1) delete []tpcrow->fClusters1; | |
1177 | // if (tpcrow->fClusters2) delete []tpcrow->fClusters2; | |
1178 | //} | |
1179 | tpcrow->ResetClusters(); | |
1c53abe2 | 1180 | } |
91162307 | 1181 | // |
1182 | nrows = fInnerSec->GetNRows(); | |
1183 | for (Int_t sec = 0;sec<fkNIS;sec++) | |
1184 | for (Int_t row = 0;row<nrows;row++){ | |
1185 | AliTPCRow* tpcrow = &(fInnerSec[sec%fkNIS][row]); | |
982aff31 | 1186 | //if (tpcrow){ |
1187 | // if (tpcrow->fClusters1) delete []tpcrow->fClusters1; | |
1188 | //if (tpcrow->fClusters2) delete []tpcrow->fClusters2; | |
1189 | //} | |
1190 | tpcrow->ResetClusters(); | |
91162307 | 1191 | } |
1192 | ||
1193 | return ; | |
1c53abe2 | 1194 | } |
1195 | ||
1196 | ||
1197 | //_____________________________________________________________________________ | |
91162307 | 1198 | Int_t AliTPCtrackerMI::LoadOuterSectors() { |
1c53abe2 | 1199 | //----------------------------------------------------------------- |
91162307 | 1200 | // This function fills outer TPC sectors with clusters. |
1c53abe2 | 1201 | //----------------------------------------------------------------- |
91162307 | 1202 | Int_t nrows = fOuterSec->GetNRows(); |
1203 | UInt_t index=0; | |
1204 | for (Int_t sec = 0;sec<fkNOS;sec++) | |
1205 | for (Int_t row = 0;row<nrows;row++){ | |
1206 | AliTPCRow* tpcrow = &(fOuterSec[sec%fkNOS][row]); | |
1207 | Int_t sec2 = sec+2*fkNIS; | |
1208 | //left | |
1209 | Int_t ncl = tpcrow->fN1; | |
1210 | while (ncl--) { | |
1211 | AliTPCclusterMI *c= &(tpcrow->fClusters1[ncl]); | |
1212 | index=(((sec2<<8)+row)<<16)+ncl; | |
1213 | tpcrow->InsertCluster(c,index); | |
1214 | } | |
1215 | //right | |
1216 | ncl = tpcrow->fN2; | |
1217 | while (ncl--) { | |
1218 | AliTPCclusterMI *c= &(tpcrow->fClusters2[ncl]); | |
1219 | index=((((sec2+fkNOS)<<8)+row)<<16)+ncl; | |
1220 | tpcrow->InsertCluster(c,index); | |
1221 | } | |
1222 | // | |
1223 | // write indexes for fast acces | |
1224 | // | |
1225 | for (Int_t i=0;i<510;i++) | |
1226 | tpcrow->fFastCluster[i]=-1; | |
1227 | for (Int_t i=0;i<tpcrow->GetN();i++){ | |
1228 | Int_t zi = Int_t((*tpcrow)[i]->GetZ()+255.); | |
1229 | tpcrow->fFastCluster[zi]=i; // write index | |
1230 | } | |
1231 | Int_t last = 0; | |
1232 | for (Int_t i=0;i<510;i++){ | |
1233 | if (tpcrow->fFastCluster[i]<0) | |
1234 | tpcrow->fFastCluster[i] = last; | |
1235 | else | |
1236 | last = tpcrow->fFastCluster[i]; | |
1237 | } | |
1238 | } | |
1239 | fN=fkNOS; | |
1240 | fSectors=fOuterSec; | |
1241 | return 0; | |
1242 | } | |
1243 | ||
1244 | ||
1245 | //_____________________________________________________________________________ | |
1246 | Int_t AliTPCtrackerMI::LoadInnerSectors() { | |
1247 | //----------------------------------------------------------------- | |
1248 | // This function fills inner TPC sectors with clusters. | |
1249 | //----------------------------------------------------------------- | |
1250 | Int_t nrows = fInnerSec->GetNRows(); | |
1251 | UInt_t index=0; | |
1252 | for (Int_t sec = 0;sec<fkNIS;sec++) | |
1253 | for (Int_t row = 0;row<nrows;row++){ | |
1254 | AliTPCRow* tpcrow = &(fInnerSec[sec%fkNIS][row]); | |
1255 | // | |
1256 | //left | |
1257 | Int_t ncl = tpcrow->fN1; | |
1258 | while (ncl--) { | |
1259 | AliTPCclusterMI *c= &(tpcrow->fClusters1[ncl]); | |
1260 | index=(((sec<<8)+row)<<16)+ncl; | |
1261 | tpcrow->InsertCluster(c,index); | |
1262 | } | |
1263 | //right | |
1264 | ncl = tpcrow->fN2; | |
1265 | while (ncl--) { | |
1266 | AliTPCclusterMI *c= &(tpcrow->fClusters2[ncl]); | |
1267 | index=((((sec+fkNIS)<<8)+row)<<16)+ncl; | |
1268 | tpcrow->InsertCluster(c,index); | |
1269 | } | |
1270 | // | |
1271 | // write indexes for fast acces | |
1272 | // | |
1273 | for (Int_t i=0;i<510;i++) | |
1274 | tpcrow->fFastCluster[i]=-1; | |
1275 | for (Int_t i=0;i<tpcrow->GetN();i++){ | |
1276 | Int_t zi = Int_t((*tpcrow)[i]->GetZ()+255.); | |
1277 | tpcrow->fFastCluster[zi]=i; // write index | |
1278 | } | |
1279 | Int_t last = 0; | |
1280 | for (Int_t i=0;i<510;i++){ | |
1281 | if (tpcrow->fFastCluster[i]<0) | |
1282 | tpcrow->fFastCluster[i] = last; | |
1283 | else | |
1284 | last = tpcrow->fFastCluster[i]; | |
1285 | } | |
1c53abe2 | 1286 | |
91162307 | 1287 | } |
1288 | ||
1c53abe2 | 1289 | fN=fkNIS; |
1290 | fSectors=fInnerSec; | |
91162307 | 1291 | return 0; |
1292 | } | |
1293 | ||
1294 | ||
1295 | ||
1296 | //_________________________________________________________________________ | |
1297 | AliTPCclusterMI *AliTPCtrackerMI::GetClusterMI(Int_t index) const { | |
1298 | //-------------------------------------------------------------------- | |
1299 | // Return pointer to a given cluster | |
1300 | //-------------------------------------------------------------------- | |
1301 | Int_t sec=(index&0xff000000)>>24; | |
1302 | Int_t row=(index&0x00ff0000)>>16; | |
d26d9159 | 1303 | Int_t ncl=(index&0x00007fff)>>00; |
91162307 | 1304 | |
1305 | const AliTPCRow * tpcrow=0; | |
1306 | AliTPCclusterMI * clrow =0; | |
3da363a1 | 1307 | |
91162307 | 1308 | if (sec<fkNIS*2){ |
1309 | tpcrow = &(fInnerSec[sec%fkNIS][row]); | |
3da363a1 | 1310 | if (tpcrow==0) return 0; |
1311 | ||
1312 | if (sec<fkNIS) { | |
1313 | if (tpcrow->fN1<=ncl) return 0; | |
91162307 | 1314 | clrow = tpcrow->fClusters1; |
3da363a1 | 1315 | } |
1316 | else { | |
1317 | if (tpcrow->fN2<=ncl) return 0; | |
91162307 | 1318 | clrow = tpcrow->fClusters2; |
3da363a1 | 1319 | } |
91162307 | 1320 | } |
3da363a1 | 1321 | else { |
91162307 | 1322 | tpcrow = &(fOuterSec[(sec-fkNIS*2)%fkNOS][row]); |
3da363a1 | 1323 | if (tpcrow==0) return 0; |
1324 | ||
1325 | if (sec-2*fkNIS<fkNOS) { | |
1326 | if (tpcrow->fN1<=ncl) return 0; | |
91162307 | 1327 | clrow = tpcrow->fClusters1; |
3da363a1 | 1328 | } |
1329 | else { | |
1330 | if (tpcrow->fN2<=ncl) return 0; | |
91162307 | 1331 | clrow = tpcrow->fClusters2; |
3da363a1 | 1332 | } |
91162307 | 1333 | } |
3da363a1 | 1334 | |
91162307 | 1335 | return &(clrow[ncl]); |
1336 | ||
1c53abe2 | 1337 | } |
1338 | ||
91162307 | 1339 | |
1340 | ||
1c53abe2 | 1341 | Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) { |
1342 | //----------------------------------------------------------------- | |
1343 | // This function tries to find a track prolongation to next pad row | |
1344 | //----------------------------------------------------------------- | |
1c53abe2 | 1345 | // |
91162307 | 1346 | Double_t x= GetXrow(nr), ymax=GetMaxY(nr); |
4d158c36 | 1347 | AliTPCclusterMI *cl=0; |
1348 | Int_t tpcindex= t.GetClusterIndex2(nr); | |
1349 | // | |
1350 | // update current shape info every 5 pad-row | |
1351 | // if ( (nr%5==0) || t.GetNumberOfClusters()<2 || (t.fCurrentSigmaY2<0.0001) ){ | |
1352 | GetShape(&t,nr); | |
1353 | //} | |
1354 | // | |
1355 | if (fIteration>0 && tpcindex>=-1){ //if we have already clusters | |
1356 | // | |
1357 | if (tpcindex==-1) return 0; //track in dead zone | |
1358 | if (tpcindex>0){ // | |
1359 | cl = t.fClusterPointer[nr]; | |
e0656451 | 1360 | if ( (cl==0) ) cl = GetClusterMI(tpcindex); |
4d158c36 | 1361 | t.fCurrentClusterIndex1 = tpcindex; |
1362 | } | |
1363 | if (cl){ | |
1364 | Int_t relativesector = ((tpcindex&0xff000000)>>24)%18; // if previously accepted cluster in different sector | |
1365 | Float_t angle = relativesector*fSectors->GetAlpha()+fSectors->GetAlphaShift(); | |
1366 | // | |
1367 | if (angle<-TMath::Pi()) angle += 2*TMath::Pi(); | |
1368 | if (angle>=TMath::Pi()) angle -= 2*TMath::Pi(); | |
1369 | ||
1370 | if (TMath::Abs(angle-t.GetAlpha())>0.001){ | |
1371 | Double_t rotation = angle-t.GetAlpha(); | |
1372 | t.fRelativeSector= relativesector; | |
3f82c4f2 | 1373 | if (!t.Rotate(rotation)) return 0; |
4d158c36 | 1374 | } |
3f82c4f2 | 1375 | if (!t.PropagateTo(x)) return 0; |
4d158c36 | 1376 | // |
1377 | t.fCurrentCluster = cl; | |
1378 | t.fRow = nr; | |
1379 | Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.); | |
1380 | if ((tpcindex&0x8000)==0) accept =0; | |
1381 | if (accept<3) { | |
1382 | //if founded cluster is acceptible | |
1383 | if (cl->IsUsed(11)) { // id cluster is shared inrease uncertainty | |
1384 | t.fErrorY2 += 0.03; | |
1385 | t.fErrorZ2 += 0.03; | |
1386 | t.fErrorY2 *= 3; | |
1387 | t.fErrorZ2 *= 3; | |
1388 | } | |
1389 | t.fNFoundable++; | |
1390 | UpdateTrack(&t,accept); | |
1391 | return 1; | |
1392 | } | |
1393 | } | |
1627d1c4 | 1394 | } |
3f82c4f2 | 1395 | if (TMath::Abs(t.GetSnp())>AliTPCReconstructor::GetMaxSnpTracker()) return 0; // cut on angle |
1396 | if (fIteration>1){ | |
1397 | // not look for new cluster during refitting | |
1398 | t.fNFoundable++; | |
1399 | return 0; | |
1400 | } | |
91162307 | 1401 | // |
4d158c36 | 1402 | UInt_t index=0; |
ca142b1f | 1403 | // if (TMath::Abs(t.GetSnp())>0.95 || TMath::Abs(x*t.GetC()-t.GetEta())>0.95) return 0;// patch 28 fev 06 |
4d158c36 | 1404 | Double_t y=t.GetYat(x); |
91162307 | 1405 | if (TMath::Abs(y)>ymax){ |
1406 | if (y > ymax) { | |
1407 | t.fRelativeSector= (t.fRelativeSector+1) % fN; | |
1408 | if (!t.Rotate(fSectors->GetAlpha())) | |
1409 | return 0; | |
1410 | } else if (y <-ymax) { | |
1411 | t.fRelativeSector= (t.fRelativeSector-1+fN) % fN; | |
1412 | if (!t.Rotate(-fSectors->GetAlpha())) | |
1413 | return 0; | |
1414 | } | |
4d158c36 | 1415 | //return 1; |
91162307 | 1416 | } |
1417 | // | |
4d158c36 | 1418 | if (!t.PropagateTo(x)) { |
1419 | if (fIteration==0) t.fRemoval = 10; | |
1420 | return 0; | |
91162307 | 1421 | } |
4d158c36 | 1422 | y=t.GetY(); |
1423 | Double_t z=t.GetZ(); | |
1424 | // | |
91162307 | 1425 | const AliTPCRow &krow=GetRow(t.fRelativeSector,nr); |
1426 | if ( (t.GetSigmaY2()<0) || t.GetSigmaZ2()<0) return 0; | |
1427 | Double_t roady =1.; | |
1428 | Double_t roadz = 1.; | |
1429 | // | |
1c53abe2 | 1430 | if (TMath::Abs(TMath::Abs(y)-ymax)<krow.fDeadZone){ |
1431 | t.fInDead = kTRUE; | |
91162307 | 1432 | t.SetClusterIndex2(nr,-1); |
1c53abe2 | 1433 | return 0; |
1434 | } | |
1435 | else | |
1436 | { | |
3f82c4f2 | 1437 | if (TMath::Abs(z)<(AliTPCReconstructor::GetCtgRange()*x+10) && TMath::Abs(z)<fParam->GetZLength() && (TMath::Abs(t.GetSnp())<AliTPCReconstructor::GetMaxSnpTracker())) |
1438 | t.fNFoundable++; | |
1627d1c4 | 1439 | else |
1440 | return 0; | |
1c53abe2 | 1441 | } |
1442 | //calculate | |
91162307 | 1443 | if (krow) { |
1444 | // cl = krow.FindNearest2(y+10.,z,roady,roadz,index); | |
1445 | cl = krow.FindNearest2(y,z,roady,roadz,index); | |
1446 | if (cl) t.fCurrentClusterIndex1 = krow.GetIndex(index); | |
1447 | } | |
91162307 | 1448 | if (cl) { |
1449 | t.fCurrentCluster = cl; | |
1450 | t.fRow = nr; | |
4d158c36 | 1451 | if (fIteration==2&&cl->IsUsed(10)) return 0; |
91162307 | 1452 | Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.); |
4d158c36 | 1453 | if (fIteration==2&&cl->IsUsed(11)) { |
1454 | t.fErrorY2 += 0.03; | |
1455 | t.fErrorZ2 += 0.03; | |
1456 | t.fErrorY2 *= 3; | |
1457 | t.fErrorZ2 *= 3; | |
1458 | } | |
d26d9159 | 1459 | /* |
91162307 | 1460 | if (t.fCurrentCluster->IsUsed(10)){ |
1461 | // | |
1462 | // | |
c9427e08 | 1463 | |
91162307 | 1464 | t.fNShared++; |
1465 | if (t.fNShared>0.7*t.GetNumberOfClusters()) { | |
1466 | t.fRemoval =10; | |
1467 | return 0; | |
1468 | } | |
1469 | } | |
d26d9159 | 1470 | */ |
91162307 | 1471 | if (accept<3) UpdateTrack(&t,accept); |
c9427e08 | 1472 | |
91162307 | 1473 | } else { |
982aff31 | 1474 | if ( fIteration==0 && t.fNFoundable*0.5 > t.GetNumberOfClusters()) t.fRemoval=10; |
91162307 | 1475 | |
1476 | } | |
1477 | return 1; | |
1478 | } | |
c9427e08 | 1479 | |
91162307 | 1480 | Int_t AliTPCtrackerMI::FollowToNextFast(AliTPCseed& t, Int_t nr) { |
1481 | //----------------------------------------------------------------- | |
1482 | // This function tries to find a track prolongation to next pad row | |
1483 | //----------------------------------------------------------------- | |
1484 | // | |
1485 | Double_t x= GetXrow(nr), ymax=GetMaxY(nr); | |
1486 | Double_t y,z; | |
1487 | if (!t.GetProlongation(x,y,z)) { | |
1488 | t.fRemoval = 10; | |
1489 | return 0; | |
1490 | } | |
1491 | // | |
1492 | // | |
1493 | if (TMath::Abs(y)>ymax){ | |
91162307 | 1494 | |
1c53abe2 | 1495 | if (y > ymax) { |
1496 | t.fRelativeSector= (t.fRelativeSector+1) % fN; | |
1497 | if (!t.Rotate(fSectors->GetAlpha())) | |
1498 | return 0; | |
1499 | } else if (y <-ymax) { | |
1500 | t.fRelativeSector= (t.fRelativeSector-1+fN) % fN; | |
1501 | if (!t.Rotate(-fSectors->GetAlpha())) | |
1502 | return 0; | |
91162307 | 1503 | } |
1504 | if (!t.PropagateTo(x)) { | |
1505 | return 0; | |
1506 | } | |
1507 | t.GetProlongation(x,y,z); | |
1508 | } | |
1509 | // | |
1510 | // update current shape info every 3 pad-row | |
1511 | if ( (nr%6==0) || t.GetNumberOfClusters()<2 || (t.fCurrentSigmaY2<0.0001) ){ | |
1512 | // t.fCurrentSigmaY = GetSigmaY(&t); | |
1513 | //t.fCurrentSigmaZ = GetSigmaZ(&t); | |
1514 | GetShape(&t,nr); | |
1515 | } | |
1516 | // | |
1517 | AliTPCclusterMI *cl=0; | |
1518 | UInt_t index=0; | |
1519 | ||
1520 | ||
1521 | //Int_t nr2 = nr; | |
1522 | const AliTPCRow &krow=GetRow(t.fRelativeSector,nr); | |
1523 | if ( (t.GetSigmaY2()<0) || t.GetSigmaZ2()<0) return 0; | |
1524 | Double_t roady =1.; | |
1525 | Double_t roadz = 1.; | |
1526 | // | |
1527 | Int_t row = nr; | |
1528 | if (TMath::Abs(TMath::Abs(y)-ymax)<krow.fDeadZone){ | |
1529 | t.fInDead = kTRUE; | |
1530 | t.SetClusterIndex2(row,-1); | |
1531 | return 0; | |
1532 | } | |
1533 | else | |
1534 | { | |
d7a11555 | 1535 | if (TMath::Abs(z)>(AliTPCReconstructor::GetCtgRange()*x+10)) t.SetClusterIndex2(row,-1); |
1c53abe2 | 1536 | } |
91162307 | 1537 | //calculate |
1538 | ||
1539 | if ((cl==0)&&(krow)) { | |
1540 | // cl = krow.FindNearest2(y+10,z,roady,roadz,index); | |
1541 | cl = krow.FindNearest2(y,z,roady,roadz,index); | |
1542 | ||
1543 | if (cl) t.fCurrentClusterIndex1 = krow.GetIndex(index); | |
1544 | } | |
1545 | ||
1546 | if (cl) { | |
1547 | t.fCurrentCluster = cl; | |
1548 | // Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.); | |
1549 | //if (accept<3){ | |
1550 | t.SetClusterIndex2(row,index); | |
1551 | t.fClusterPointer[row] = cl; | |
1552 | //} | |
1c53abe2 | 1553 | } |
1554 | return 1; | |
1555 | } | |
1556 | ||
1557 | ||
91162307 | 1558 | |
5d837844 | 1559 | //_________________________________________________________________________ |
1560 | Bool_t AliTPCtrackerMI::GetTrackPoint(Int_t index, AliTrackPoint &p ) const | |
1561 | { | |
1562 | // Get track space point by index | |
1563 | // return false in case the cluster doesn't exist | |
1564 | AliTPCclusterMI *cl = GetClusterMI(index); | |
1565 | if (!cl) return kFALSE; | |
1566 | Int_t sector = (index&0xff000000)>>24; | |
1567 | Int_t row = (index&0x00ff0000)>>16; | |
1568 | Float_t xyz[3]; | |
1569 | xyz[0] = fParam->GetPadRowRadii(sector,row); | |
1570 | xyz[1] = cl->GetY(); | |
1571 | xyz[2] = cl->GetZ(); | |
1572 | Float_t sin,cos; | |
1573 | fParam->AdjustCosSin(sector,cos,sin); | |
1574 | Float_t x = cos*xyz[0]-sin*xyz[1]; | |
1575 | Float_t y = cos*xyz[1]+sin*xyz[0]; | |
1576 | Float_t cov[6]; | |
1577 | Float_t sigmaY2 = 0.027*cl->GetSigmaY2(); | |
1578 | if (sector < fParam->GetNInnerSector()) sigmaY2 *= 2.07; | |
1579 | Float_t sigmaZ2 = 0.066*cl->GetSigmaZ2(); | |
1580 | if (sector < fParam->GetNInnerSector()) sigmaZ2 *= 1.77; | |
1581 | cov[0] = sin*sin*sigmaY2; | |
1582 | cov[1] = -sin*cos*sigmaY2; | |
1583 | cov[2] = 0.; | |
1584 | cov[3] = cos*cos*sigmaY2; | |
1585 | cov[4] = 0.; | |
1586 | cov[5] = sigmaZ2; | |
1587 | p.SetXYZ(x,y,xyz[2],cov); | |
1588 | AliAlignObj::ELayerID iLayer; | |
1589 | Int_t idet; | |
1590 | if (sector < fParam->GetNInnerSector()) { | |
1591 | iLayer = AliAlignObj::kTPC1; | |
1592 | idet = sector; | |
1593 | } | |
1594 | else { | |
1595 | iLayer = AliAlignObj::kTPC2; | |
1596 | idet = sector - fParam->GetNInnerSector(); | |
1597 | } | |
1598 | UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,idet); | |
1599 | p.SetVolumeID(volid); | |
1600 | return kTRUE; | |
1601 | } | |
1602 | ||
1603 | ||
1604 | ||
91162307 | 1605 | Int_t AliTPCtrackerMI::UpdateClusters(AliTPCseed& t, Int_t nr) { |
1c53abe2 | 1606 | //----------------------------------------------------------------- |
1607 | // This function tries to find a track prolongation to next pad row | |
1608 | //----------------------------------------------------------------- | |
1609 | t.fCurrentCluster = 0; | |
1610 | t.fCurrentClusterIndex1 = 0; | |
1c53abe2 | 1611 | |
1612 | Double_t xt=t.GetX(); | |
91162307 | 1613 | Int_t row = GetRowNumber(xt)-1; |
1614 | Double_t ymax= GetMaxY(nr); | |
1615 | ||
1c53abe2 | 1616 | if (row < nr) return 1; // don't prolongate if not information until now - |
ca142b1f | 1617 | // if (TMath::Abs(t.GetSnp())>0.9 && t.GetNumberOfClusters()>40. && fIteration!=2) { |
1618 | // t.fRemoval =10; | |
1619 | // return 0; // not prolongate strongly inclined tracks | |
1620 | // } | |
1621 | // if (TMath::Abs(t.GetSnp())>0.95) { | |
1622 | // t.fRemoval =10; | |
1623 | // return 0; // not prolongate strongly inclined tracks | |
1624 | // }// patch 28 fev 06 | |
91162307 | 1625 | |
1626 | Double_t x= GetXrow(nr); | |
1627 | Double_t y,z; | |
1628 | //t.PropagateTo(x+0.02); | |
1629 | //t.PropagateTo(x+0.01); | |
1627d1c4 | 1630 | if (!t.PropagateTo(x)){ |
1627d1c4 | 1631 | return 0; |
1632 | } | |
1c53abe2 | 1633 | // |
91162307 | 1634 | y=t.GetY(); |
1635 | z=t.GetZ(); | |
1c53abe2 | 1636 | |
91162307 | 1637 | if (TMath::Abs(y)>ymax){ |
1638 | if (y > ymax) { | |
1639 | t.fRelativeSector= (t.fRelativeSector+1) % fN; | |
1640 | if (!t.Rotate(fSectors->GetAlpha())) | |
1641 | return 0; | |
1642 | } else if (y <-ymax) { | |
1643 | t.fRelativeSector= (t.fRelativeSector-1+fN) % fN; | |
1644 | if (!t.Rotate(-fSectors->GetAlpha())) | |
1645 | return 0; | |
1646 | } | |
982aff31 | 1647 | // if (!t.PropagateTo(x)){ |
1648 | // return 0; | |
1649 | //} | |
1650 | return 1; | |
1651 | //y = t.GetY(); | |
1c53abe2 | 1652 | } |
91162307 | 1653 | // |
3f82c4f2 | 1654 | if (TMath::Abs(t.GetSnp())>AliTPCReconstructor::GetMaxSnpTracker()) return 0; |
91162307 | 1655 | AliTPCRow &krow=GetRow(t.fRelativeSector,nr); |
1c53abe2 | 1656 | |
1657 | if (TMath::Abs(TMath::Abs(y)-ymax)<krow.fDeadZone){ | |
1658 | t.fInDead = kTRUE; | |
91162307 | 1659 | t.SetClusterIndex2(nr,-1); |
1c53abe2 | 1660 | return 0; |
1661 | } | |
1662 | else | |
1663 | { | |
3f82c4f2 | 1664 | if (TMath::Abs(t.GetZ())<(AliTPCReconstructor::GetCtgRange()*t.GetX()+10) && (TMath::Abs(t.GetSnp())<AliTPCReconstructor::GetMaxSnpTracker())) t.fNFoundable++; |
1627d1c4 | 1665 | else |
1666 | return 0; | |
1c53abe2 | 1667 | } |
1c53abe2 | 1668 | |
91162307 | 1669 | // update current |
1670 | if ( (nr%6==0) || t.GetNumberOfClusters()<2){ | |
1671 | // t.fCurrentSigmaY = GetSigmaY(&t); | |
1672 | //t.fCurrentSigmaZ = GetSigmaZ(&t); | |
1673 | GetShape(&t,nr); | |
1674 | } | |
1c53abe2 | 1675 | |
91162307 | 1676 | AliTPCclusterMI *cl=0; |
d184f295 | 1677 | Int_t index=0; |
91162307 | 1678 | // |
1679 | Double_t roady = 1.; | |
1680 | Double_t roadz = 1.; | |
1681 | // | |
d26d9159 | 1682 | |
1683 | if (!cl){ | |
1684 | index = t.GetClusterIndex2(nr); | |
1685 | if ( (index>0) && (index&0x8000)==0){ | |
1686 | cl = t.fClusterPointer[nr]; | |
1687 | if ( (cl==0) && (index>0)) cl = GetClusterMI(index); | |
1688 | t.fCurrentClusterIndex1 = index; | |
1689 | if (cl) { | |
1690 | t.fCurrentCluster = cl; | |
1691 | return 1; | |
1692 | } | |
1693 | } | |
1694 | } | |
1695 | ||
3d172d79 | 1696 | // if (index<0) return 0; |
1697 | UInt_t uindex = TMath::Abs(index); | |
d184f295 | 1698 | |
91162307 | 1699 | if (krow) { |
d184f295 | 1700 | //cl = krow.FindNearest2(y+10,z,roady,roadz,uindex); |
1701 | cl = krow.FindNearest2(y,z,roady,roadz,uindex); | |
91162307 | 1702 | } |
d26d9159 | 1703 | |
d184f295 | 1704 | if (cl) t.fCurrentClusterIndex1 = krow.GetIndex(uindex); |
d26d9159 | 1705 | t.fCurrentCluster = cl; |
1706 | ||
91162307 | 1707 | return 1; |
1708 | } | |
1c53abe2 | 1709 | |
1c53abe2 | 1710 | |
91162307 | 1711 | Int_t AliTPCtrackerMI::FollowToNextCluster(AliTPCseed & t, Int_t nr) { |
1712 | //----------------------------------------------------------------- | |
1713 | // This function tries to find a track prolongation to next pad row | |
1714 | //----------------------------------------------------------------- | |
1c53abe2 | 1715 | |
91162307 | 1716 | //update error according neighborhoud |
1c53abe2 | 1717 | |
91162307 | 1718 | if (t.fCurrentCluster) { |
1719 | t.fRow = nr; | |
8c51a605 | 1720 | Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.); |
91162307 | 1721 | |
1722 | if (t.fCurrentCluster->IsUsed(10)){ | |
1723 | // | |
1724 | // | |
1725 | // t.fErrorZ2*=2; | |
1726 | // t.fErrorY2*=2; | |
1727 | t.fNShared++; | |
1728 | if (t.fNShared>0.7*t.GetNumberOfClusters()) { | |
1729 | t.fRemoval =10; | |
1730 | return 0; | |
1731 | } | |
b364ca79 | 1732 | } |
d26d9159 | 1733 | if (fIteration>0) accept = 0; |
b364ca79 | 1734 | if (accept<3) UpdateTrack(&t,accept); |
1735 | ||
1c53abe2 | 1736 | } else { |
91162307 | 1737 | if (fIteration==0){ |
1738 | if ( ( (t.GetSigmaY2()+t.GetSigmaZ2())>0.16)&& t.GetNumberOfClusters()>18) t.fRemoval=10; | |
1739 | if ( t.GetChi2()/t.GetNumberOfClusters()>6 &&t.GetNumberOfClusters()>18) t.fRemoval=10; | |
1740 | ||
1741 | if (( (t.fNFoundable*0.5 > t.GetNumberOfClusters()) || t.fNoCluster>15)) t.fRemoval=10; | |
1c53abe2 | 1742 | } |
1743 | } | |
1744 | return 1; | |
1745 | } | |
1746 | ||
1747 | ||
1748 | ||
91162307 | 1749 | //_____________________________________________________________________________ |
1750 | Int_t AliTPCtrackerMI::FollowProlongation(AliTPCseed& t, Int_t rf, Int_t step) { | |
1c53abe2 | 1751 | //----------------------------------------------------------------- |
91162307 | 1752 | // This function tries to find a track prolongation. |
1c53abe2 | 1753 | //----------------------------------------------------------------- |
1754 | Double_t xt=t.GetX(); | |
1755 | // | |
91162307 | 1756 | Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); |
1c53abe2 | 1757 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); |
1758 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); | |
91162307 | 1759 | // |
1760 | t.fRelativeSector = Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN; | |
1c53abe2 | 1761 | |
91162307 | 1762 | Int_t first = GetRowNumber(xt)-1; |
51ad6848 | 1763 | for (Int_t nr= first; nr>=rf; nr-=step) { |
1764 | // update kink info | |
1765 | if (t.GetKinkIndexes()[0]>0){ | |
1766 | for (Int_t i=0;i<3;i++){ | |
1767 | Int_t index = t.GetKinkIndexes()[i]; | |
1768 | if (index==0) break; | |
1769 | if (index<0) continue; | |
1770 | // | |
1771 | AliESDkink * kink = fEvent->GetKink(index-1); | |
1772 | if (!kink){ | |
1773 | printf("PROBLEM\n"); | |
1774 | } | |
1775 | else{ | |
eea478d3 | 1776 | Int_t kinkrow = kink->GetTPCRow0()+2+Int_t(0.5/(0.05+kink->GetAngle(2))); |
51ad6848 | 1777 | if (kinkrow==nr){ |
1778 | AliExternalTrackParam paramd(t); | |
1779 | kink->SetDaughter(paramd); | |
eea478d3 | 1780 | kink->SetStatus(2,5); |
51ad6848 | 1781 | kink->Update(); |
51ad6848 | 1782 | } |
1783 | } | |
1784 | } | |
1785 | } | |
1786 | ||
1787 | if (nr==80) t.UpdateReference(); | |
982aff31 | 1788 | if (nr<fInnerSec->GetNRows()) |
1789 | fSectors = fInnerSec; | |
1790 | else | |
1791 | fSectors = fOuterSec; | |
91162307 | 1792 | if (FollowToNext(t,nr)==0) |
4d158c36 | 1793 | if (!t.IsActive()) |
1794 | return 0; | |
91162307 | 1795 | |
1796 | } | |
1797 | return 1; | |
1798 | } | |
1799 | ||
1c53abe2 | 1800 | |
1801 | //_____________________________________________________________________________ | |
91162307 | 1802 | Int_t AliTPCtrackerMI::FollowProlongationFast(AliTPCseed& t, Int_t rf, Int_t step) { |
1c53abe2 | 1803 | //----------------------------------------------------------------- |
1804 | // This function tries to find a track prolongation. | |
1805 | //----------------------------------------------------------------- | |
1806 | Double_t xt=t.GetX(); | |
1807 | // | |
1808 | Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); | |
1809 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); | |
1810 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); | |
91162307 | 1811 | t.fRelativeSector = Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN; |
1812 | ||
1813 | for (Int_t nr=GetRowNumber(xt)-1; nr>=rf; nr-=step) { | |
1814 | ||
1815 | if (FollowToNextFast(t,nr)==0) | |
1816 | if (!t.IsActive()) return 0; | |
1c53abe2 | 1817 | |
1c53abe2 | 1818 | } |
1819 | return 1; | |
1820 | } | |
1821 | ||
1822 | ||
91162307 | 1823 | |
1824 | ||
1825 | ||
1c53abe2 | 1826 | Int_t AliTPCtrackerMI::FollowBackProlongation(AliTPCseed& t, Int_t rf) { |
1827 | //----------------------------------------------------------------- | |
1828 | // This function tries to find a track prolongation. | |
1829 | //----------------------------------------------------------------- | |
1c53abe2 | 1830 | // |
eea478d3 | 1831 | Double_t xt=t.GetX(); |
1c53abe2 | 1832 | Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); |
1833 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); | |
1834 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); | |
91162307 | 1835 | t.fRelativeSector = Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN; |
1c53abe2 | 1836 | |
4d158c36 | 1837 | Int_t first = t.fFirstPoint; |
eea478d3 | 1838 | if (first<GetRowNumber(xt)+1) first = GetRowNumber(xt)+1; |
91162307 | 1839 | // |
1840 | if (first<0) first=0; | |
4d158c36 | 1841 | for (Int_t nr=first; nr<=rf; nr++) { |
ca142b1f | 1842 | // if ( (TMath::Abs(t.GetSnp())>0.95)) break;//patch 28 fev 06 |
51ad6848 | 1843 | if (t.GetKinkIndexes()[0]<0){ |
1844 | for (Int_t i=0;i<3;i++){ | |
1845 | Int_t index = t.GetKinkIndexes()[i]; | |
1846 | if (index==0) break; | |
1847 | if (index>0) continue; | |
1848 | index = TMath::Abs(index); | |
1849 | AliESDkink * kink = fEvent->GetKink(index-1); | |
1850 | if (!kink){ | |
1851 | printf("PROBLEM\n"); | |
1852 | } | |
1853 | else{ | |
eea478d3 | 1854 | Int_t kinkrow = kink->GetTPCRow0()-2-Int_t(0.5/(0.05+kink->GetAngle(2))); |
51ad6848 | 1855 | if (kinkrow==nr){ |
1856 | AliExternalTrackParam paramm(t); | |
1857 | kink->SetMother(paramm); | |
eea478d3 | 1858 | kink->SetStatus(2,1); |
51ad6848 | 1859 | kink->Update(); |
51ad6848 | 1860 | } |
1861 | } | |
eea478d3 | 1862 | } |
51ad6848 | 1863 | } |
eea478d3 | 1864 | // |
d26d9159 | 1865 | if (nr<fInnerSec->GetNRows()) |
1866 | fSectors = fInnerSec; | |
1867 | else | |
1868 | fSectors = fOuterSec; | |
1869 | FollowToNext(t,nr); | |
1c53abe2 | 1870 | } |
1871 | return 1; | |
1872 | } | |
1873 | ||
1874 | ||
1875 | ||
1876 | ||
1877 | ||
1878 | Float_t AliTPCtrackerMI::OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t & sum2) | |
1879 | { | |
1880 | // | |
1881 | // | |
1882 | sum1=0; | |
1883 | sum2=0; | |
1884 | Int_t sum=0; | |
1c53abe2 | 1885 | // |
1886 | Float_t dz2 =(s1->GetZ() - s2->GetZ()); | |
c9427e08 | 1887 | dz2*=dz2; |
91162307 | 1888 | |
c9427e08 | 1889 | Float_t dy2 =TMath::Abs((s1->GetY() - s2->GetY())); |
1c53abe2 | 1890 | dy2*=dy2; |
1891 | Float_t distance = TMath::Sqrt(dz2+dy2); | |
c9427e08 | 1892 | if (distance>4.) return 0; // if there are far away - not overlap - to reduce combinatorics |
1c53abe2 | 1893 | |
91162307 | 1894 | // Int_t offset =0; |
c9427e08 | 1895 | Int_t firstpoint = TMath::Min(s1->fFirstPoint,s2->fFirstPoint); |
1896 | Int_t lastpoint = TMath::Max(s1->fLastPoint,s2->fLastPoint); | |
c9427e08 | 1897 | if (lastpoint>160) |
1898 | lastpoint =160; | |
1899 | if (firstpoint<0) | |
1900 | firstpoint = 0; | |
91162307 | 1901 | if (firstpoint>lastpoint) { |
1902 | firstpoint =lastpoint; | |
1903 | // lastpoint =160; | |
c9427e08 | 1904 | } |
1905 | ||
1906 | ||
91162307 | 1907 | for (Int_t i=firstpoint-1;i<lastpoint+1;i++){ |
1908 | if (s1->GetClusterIndex2(i)>0) sum1++; | |
1909 | if (s2->GetClusterIndex2(i)>0) sum2++; | |
1910 | if (s1->GetClusterIndex2(i)==s2->GetClusterIndex2(i) && s1->GetClusterIndex2(i)>0) { | |
1c53abe2 | 1911 | sum++; |
1912 | } | |
1913 | } | |
91162307 | 1914 | if (sum<5) return 0; |
1915 | ||
1627d1c4 | 1916 | Float_t summin = TMath::Min(sum1+1,sum2+1); |
1917 | Float_t ratio = (sum+1)/Float_t(summin); | |
1c53abe2 | 1918 | return ratio; |
1919 | } | |
1920 | ||
1921 | void AliTPCtrackerMI::SignShared(AliTPCseed * s1, AliTPCseed * s2) | |
1922 | { | |
1923 | // | |
1924 | // | |
91162307 | 1925 | if (TMath::Abs(s1->GetC()-s2->GetC())>0.004) return; |
1926 | if (TMath::Abs(s1->GetTgl()-s2->GetTgl())>0.6) return; | |
1927 | ||
1c53abe2 | 1928 | Float_t dz2 =(s1->GetZ() - s2->GetZ()); |
1929 | dz2*=dz2; | |
1930 | Float_t dy2 =(s1->GetY() - s2->GetY()); | |
1931 | dy2*=dy2; | |
91162307 | 1932 | Float_t distance = dz2+dy2; |
1933 | if (distance>325.) return ; // if there are far away - not overlap - to reduce combinatorics | |
1934 | ||
1c53abe2 | 1935 | // |
91162307 | 1936 | Int_t sumshared=0; |
1937 | // | |
1938 | Int_t firstpoint = TMath::Max(s1->fFirstPoint,s2->fFirstPoint); | |
1939 | Int_t lastpoint = TMath::Min(s1->fLastPoint,s2->fLastPoint); | |
1940 | // | |
1941 | if (firstpoint>=lastpoint-5) return;; | |
1c53abe2 | 1942 | |
91162307 | 1943 | for (Int_t i=firstpoint;i<lastpoint;i++){ |
1944 | // if ( (s1->GetClusterIndex2(i)&0xFFFF8FFF)==(s2->GetClusterIndex2(i)&0xFFFF8FFF) && s1->GetClusterIndex2(i)>0) { | |
1945 | if ( (s1->GetClusterIndex2(i))==(s2->GetClusterIndex2(i)) && s1->GetClusterIndex2(i)>0) { | |
1946 | sumshared++; | |
1947 | } | |
1948 | } | |
1949 | if (sumshared>4){ | |
1950 | // sign clusters | |
1951 | // | |
1952 | for (Int_t i=firstpoint;i<lastpoint;i++){ | |
1953 | // if ( (s1->GetClusterIndex2(i)&0xFFFF8FFF)==(s2->GetClusterIndex2(i)&0xFFFF8FFF) && s1->GetClusterIndex2(i)>0) { | |
1954 | if ( (s1->GetClusterIndex2(i))==(s2->GetClusterIndex2(i)) && s1->GetClusterIndex2(i)>0) { | |
1955 | AliTPCTrackerPoint *p1 = s1->GetTrackPoint(i); | |
1956 | AliTPCTrackerPoint *p2 = s2->GetTrackPoint(i);; | |
1957 | if (s1->IsActive()&&s2->IsActive()){ | |
1958 | p1->fIsShared = kTRUE; | |
1959 | p2->fIsShared = kTRUE; | |
1960 | } | |
1961 | } | |
1962 | } | |
1963 | } | |
1964 | // | |
1965 | if (sumshared>10){ | |
1966 | for (Int_t i=0;i<4;i++){ | |
1967 | if (s1->fOverlapLabels[3*i]==0){ | |
1968 | s1->fOverlapLabels[3*i] = s2->GetLabel(); | |
1969 | s1->fOverlapLabels[3*i+1] = sumshared; | |
1970 | s1->fOverlapLabels[3*i+2] = s2->GetUniqueID(); | |
1971 | break; | |
1972 | } | |
1973 | } | |
1974 | for (Int_t i=0;i<4;i++){ | |
1975 | if (s2->fOverlapLabels[3*i]==0){ | |
1976 | s2->fOverlapLabels[3*i] = s1->GetLabel(); | |
1977 | s2->fOverlapLabels[3*i+1] = sumshared; | |
1978 | s2->fOverlapLabels[3*i+2] = s1->GetUniqueID(); | |
1979 | break; | |
1980 | } | |
1981 | } | |
1982 | } | |
1c53abe2 | 1983 | |
91162307 | 1984 | } |
1c53abe2 | 1985 | |
91162307 | 1986 | void AliTPCtrackerMI::SignShared(TObjArray * arr) |
1987 | { | |
1c53abe2 | 1988 | // |
91162307 | 1989 | //sort trackss according sectors |
1990 | // | |
c9427e08 | 1991 | for (Int_t i=0; i<arr->GetEntriesFast(); i++) { |
1992 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
91162307 | 1993 | if (!pt) continue; |
1994 | //if (pt) RotateToLocal(pt); | |
1995 | pt->fSort = 0; | |
c9427e08 | 1996 | } |
91162307 | 1997 | arr->UnSort(); |
1c53abe2 | 1998 | arr->Sort(); // sorting according z |
1999 | arr->Expand(arr->GetEntries()); | |
91162307 | 2000 | // |
2001 | // | |
1c53abe2 | 2002 | Int_t nseed=arr->GetEntriesFast(); |
1c53abe2 | 2003 | for (Int_t i=0; i<nseed; i++) { |
2004 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
91162307 | 2005 | if (!pt) continue; |
2006 | for (Int_t j=0;j<=12;j++){ | |
2007 | pt->fOverlapLabels[j] =0; | |
1c53abe2 | 2008 | } |
91162307 | 2009 | } |
2010 | for (Int_t i=0; i<nseed; i++) { | |
2011 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2012 | if (!pt) continue; | |
2013 | if (pt->fRemoval>10) continue; | |
1c53abe2 | 2014 | for (Int_t j=i+1; j<nseed; j++){ |
2015 | AliTPCseed *pt2=(AliTPCseed*)arr->UncheckedAt(j); | |
91162307 | 2016 | // if (pt2){ |
2017 | if (pt2->fRemoval<=10) { | |
2018 | if ( TMath::Abs(pt->fRelativeSector-pt2->fRelativeSector)>0) break; | |
2019 | SignShared(pt,pt2); | |
c9427e08 | 2020 | } |
91162307 | 2021 | } |
2022 | } | |
2023 | } | |
2024 | ||
2025 | void AliTPCtrackerMI::RemoveDouble(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex) | |
2026 | { | |
2027 | // | |
2028 | //sort trackss according sectors | |
2029 | // | |
2030 | if (fDebug&1) { | |
6bdc18d6 | 2031 | Info("RemoveDouble","Number of tracks before double removal- %d\n",arr->GetEntries()); |
91162307 | 2032 | } |
2033 | // | |
2034 | for (Int_t i=0; i<arr->GetEntriesFast(); i++) { | |
2035 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2036 | if (!pt) continue; | |
2037 | pt->fSort = 0; | |
2038 | } | |
2039 | arr->UnSort(); | |
2040 | arr->Sort(); // sorting according z | |
2041 | arr->Expand(arr->GetEntries()); | |
2042 | // | |
2043 | //reset overlap labels | |
2044 | // | |
2045 | Int_t nseed=arr->GetEntriesFast(); | |
2046 | for (Int_t i=0; i<nseed; i++) { | |
2047 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2048 | if (!pt) continue; | |
2049 | pt->SetUniqueID(i); | |
2050 | for (Int_t j=0;j<=12;j++){ | |
2051 | pt->fOverlapLabels[j] =0; | |
1c53abe2 | 2052 | } |
2053 | } | |
91162307 | 2054 | // |
2055 | //sign shared tracks | |
1c53abe2 | 2056 | for (Int_t i=0; i<nseed; i++) { |
2057 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
91162307 | 2058 | if (!pt) continue; |
2059 | if (pt->fRemoval>10) continue; | |
2060 | Float_t deltac = pt->GetC()*0.1; | |
2061 | for (Int_t j=i+1; j<nseed; j++){ | |
2062 | AliTPCseed *pt2=(AliTPCseed*)arr->UncheckedAt(j); | |
2063 | // if (pt2){ | |
2064 | if (pt2->fRemoval<=10) { | |
2065 | if ( TMath::Abs(pt->fRelativeSector-pt2->fRelativeSector)>0) break; | |
2066 | if (TMath::Abs(pt->GetC() -pt2->GetC())>deltac) continue; | |
2067 | if (TMath::Abs(pt->GetTgl()-pt2->GetTgl())>0.05) continue; | |
2068 | // | |
2069 | SignShared(pt,pt2); | |
2070 | } | |
1c53abe2 | 2071 | } |
1c53abe2 | 2072 | } |
91162307 | 2073 | // |
2074 | // remove highly shared tracks | |
2075 | for (Int_t i=0; i<nseed; i++) { | |
2076 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2077 | if (!pt) continue; | |
2078 | if (pt->fRemoval>10) continue; | |
2079 | // | |
2080 | Int_t sumshared =0; | |
2081 | for (Int_t j=0;j<4;j++){ | |
2082 | sumshared = pt->fOverlapLabels[j*3+1]; | |
2083 | } | |
2084 | Float_t factor = factor1; | |
2085 | if (pt->fRemoval>0) factor = factor2; | |
2086 | if (sumshared/pt->GetNumberOfClusters()>factor){ | |
2087 | for (Int_t j=0;j<4;j++){ | |
2088 | if (pt->fOverlapLabels[3*j]==0) continue; | |
2089 | if (pt->fOverlapLabels[3*j+1]<5) continue; | |
2090 | if (pt->fRemoval==removalindex) continue; | |
2091 | AliTPCseed * pt2 = (AliTPCseed*)arr->UncheckedAt(pt->fOverlapLabels[3*j+2]); | |
2092 | if (!pt2) continue; | |
2093 | if (pt2->GetSigma2C()<pt->GetSigma2C()){ | |
2094 | // pt->fRemoval = removalindex; | |
2095 | delete arr->RemoveAt(i); | |
2096 | break; | |
1c53abe2 | 2097 | } |
91162307 | 2098 | } |
1c53abe2 | 2099 | } |
91162307 | 2100 | } |
2101 | arr->Compress(); | |
2102 | if (fDebug&1) { | |
6bdc18d6 | 2103 | Info("RemoveDouble","Number of tracks after double removal- %d\n",arr->GetEntries()); |
91162307 | 2104 | } |
2105 | } | |
2106 | ||
2107 | ||
2108 | ||
1c53abe2 | 2109 | |
2110 | ||
91162307 | 2111 | |
47966a6d | 2112 | void AliTPCtrackerMI::SortTracks(TObjArray * arr, Int_t mode) const |
91162307 | 2113 | { |
2114 | // | |
2115 | //sort tracks in array according mode criteria | |
2116 | Int_t nseed = arr->GetEntriesFast(); | |
2117 | for (Int_t i=0; i<nseed; i++) { | |
2118 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2119 | if (!pt) { | |
2120 | continue; | |
2121 | } | |
2122 | pt->fSort = mode; | |
2123 | } | |
2124 | arr->UnSort(); | |
2125 | arr->Sort(); | |
1c53abe2 | 2126 | } |
c9427e08 | 2127 | |
91162307 | 2128 | void AliTPCtrackerMI::RemoveUsed(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex) |
c9427e08 | 2129 | { |
2130 | ||
2131 | //Loop over all tracks and remove "overlaps" | |
2132 | // | |
2133 | // | |
2134 | Int_t nseed = arr->GetEntriesFast(); | |
2135 | Int_t good =0; | |
91162307 | 2136 | |
c9427e08 | 2137 | for (Int_t i=0; i<nseed; i++) { |
2138 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2139 | if (!pt) { | |
91162307 | 2140 | delete arr->RemoveAt(i); |
c9427e08 | 2141 | } |
91162307 | 2142 | else{ |
2143 | pt->fSort =1; | |
2144 | pt->fBSigned = kFALSE; | |
c9427e08 | 2145 | } |
91162307 | 2146 | } |
2147 | arr->Compress(); | |
2148 | nseed = arr->GetEntriesFast(); | |
2149 | arr->UnSort(); | |
2150 | arr->Sort(); | |
2151 | // | |
2152 | //unsign used | |
2153 | UnsignClusters(); | |
2154 | // | |
2155 | for (Int_t i=0; i<nseed; i++) { | |
2156 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2157 | if (!pt) { | |
2158 | continue; | |
2159 | } | |
2160 | Int_t found,foundable,shared; | |
2161 | if (pt->IsActive()) | |
2162 | pt->GetClusterStatistic(0,160,found, foundable,shared,kFALSE); | |
2163 | else | |
2164 | pt->GetClusterStatistic(0,160,found, foundable,shared,kTRUE); | |
2165 | // | |
2166 | Double_t factor = factor2; | |
2167 | if (pt->fBConstrain) factor = factor1; | |
2168 | ||
2169 | if ((Float_t(shared)/Float_t(found))>factor){ | |
c9427e08 | 2170 | pt->Desactivate(removalindex); |
91162307 | 2171 | continue; |
2172 | } | |
2173 | ||
2174 | good++; | |
2175 | for (Int_t i=0; i<160; i++) { | |
2176 | Int_t index=pt->GetClusterIndex2(i); | |
2177 | if (index<0 || index&0x8000 ) continue; | |
2178 | AliTPCclusterMI *c= pt->fClusterPointer[i]; | |
2179 | if (!c) continue; | |
2180 | // if (!c->IsUsed(10)) c->Use(10); | |
2181 | //if (pt->IsActive()) | |
2182 | c->Use(10); | |
2183 | //else | |
2184 | // c->Use(5); | |
c9427e08 | 2185 | } |
91162307 | 2186 | |
c9427e08 | 2187 | } |
2188 | fNtracks = good; | |
6bdc18d6 | 2189 | if (fDebug>0){ |
2190 | Info("RemoveUsed","\n*****\nNumber of good tracks after shared removal\t%d\n",fNtracks); | |
2191 | } | |
c9427e08 | 2192 | } |
2193 | ||
51ad6848 | 2194 | |
2195 | void AliTPCtrackerMI::RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal) | |
2196 | { | |
2197 | ||
2198 | //Loop over all tracks and remove "overlaps" | |
2199 | // | |
2200 | // | |
2201 | UnsignClusters(); | |
2202 | // | |
2203 | Int_t nseed = arr->GetEntriesFast(); | |
2204 | Float_t * quality = new Float_t[nseed]; | |
2205 | Int_t * indexes = new Int_t[nseed]; | |
2206 | Int_t good =0; | |
2207 | // | |
2208 | // | |
2209 | for (Int_t i=0; i<nseed; i++) { | |
2210 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2211 | if (!pt){ | |
2212 | quality[i]=-1; | |
2213 | continue; | |
2214 | } | |
2215 | pt->UpdatePoints(); //select first last max dens points | |
2216 | Float_t * points = pt->GetPoints(); | |
2217 | if (points[3]<0.8) quality[i] =-1; | |
2218 | // | |
2219 | quality[i] = (points[2]-points[0])+pt->GetNumberOfClusters(); | |
2220 | } | |
2221 | TMath::Sort(nseed,quality,indexes); | |
2222 | // | |
2223 | // | |
2224 | for (Int_t itrack=0; itrack<nseed; itrack++) { | |
2225 | Int_t trackindex = indexes[itrack]; | |
2226 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(trackindex); | |
2227 | if (quality[trackindex]<0){ | |
2228 | if (pt) { | |
2229 | delete arr->RemoveAt(trackindex); | |
2230 | } | |
2231 | else{ | |
2232 | arr->RemoveAt(trackindex); | |
2233 | } | |
2234 | continue; | |
2235 | } | |
2236 | // | |
2237 | Int_t first = Int_t(pt->GetPoints()[0]); | |
2238 | Int_t last = Int_t(pt->GetPoints()[2]); | |
2239 | Double_t factor = (pt->fBConstrain) ? factor1: factor2; | |
2240 | // | |
2241 | Int_t found,foundable,shared; | |
2242 | pt->GetClusterStatistic(first,last, found, foundable,shared,kFALSE); | |
eea478d3 | 2243 | Float_t sharedfactor = Float_t(shared+1)/Float_t(found+1); |
b406fdb0 | 2244 | Bool_t itsgold =kFALSE; |
2245 | if (pt->fEsd){ | |
2246 | UInt_t dummy[12]; | |
2247 | if (pt->fEsd->GetITSclusters(dummy)>4) itsgold= kTRUE; | |
51ad6848 | 2248 | } |
b406fdb0 | 2249 | if (!itsgold){ |
2250 | // | |
2251 | if (Float_t(shared+1)/Float_t(found+1)>factor){ | |
2252 | if (pt->GetKinkIndexes()[0]!=0) continue; //don't remove tracks - part of the kinks | |
2253 | delete arr->RemoveAt(trackindex); | |
2254 | continue; | |
2255 | } | |
2256 | if (pt->GetNumberOfClusters()<50&&(found-0.5*shared)<minimal){ //remove short tracks | |
2257 | if (pt->GetKinkIndexes()[0]!=0) continue; //don't remove tracks - part of the kinks | |
2258 | delete arr->RemoveAt(trackindex); | |
2259 | continue; | |
2260 | } | |
51ad6848 | 2261 | } |
2262 | ||
2263 | good++; | |
2264 | if (sharedfactor>0.4) continue; | |
b406fdb0 | 2265 | if (pt->GetKinkIndexes()[0]>0) continue; |
51ad6848 | 2266 | for (Int_t i=first; i<last; i++) { |
2267 | Int_t index=pt->GetClusterIndex2(i); | |
2268 | // if (index<0 || index&0x8000 ) continue; | |
2269 | if (index<0 || index&0x8000 ) continue; | |
2270 | AliTPCclusterMI *c= pt->fClusterPointer[i]; | |
2271 | if (!c) continue; | |
2272 | c->Use(10); | |
2273 | } | |
2274 | } | |
2275 | fNtracks = good; | |
2276 | if (fDebug>0){ | |
2277 | Info("RemoveUsed","\n*****\nNumber of good tracks after shared removal\t%d\n",fNtracks); | |
2278 | } | |
2279 | delete []quality; | |
2280 | delete []indexes; | |
2281 | } | |
2282 | ||
91162307 | 2283 | void AliTPCtrackerMI::UnsignClusters() |
1c53abe2 | 2284 | { |
91162307 | 2285 | // |
2286 | // loop over all clusters and unsign them | |
2287 | // | |
2288 | ||
2289 | for (Int_t sec=0;sec<fkNIS;sec++){ | |
2290 | for (Int_t row=0;row<fInnerSec->GetNRows();row++){ | |
2291 | AliTPCclusterMI *cl = fInnerSec[sec][row].fClusters1; | |
2292 | for (Int_t icl =0;icl< fInnerSec[sec][row].fN1;icl++) | |
2293 | // if (cl[icl].IsUsed(10)) | |
2294 | cl[icl].Use(-1); | |
2295 | cl = fInnerSec[sec][row].fClusters2; | |
2296 | for (Int_t icl =0;icl< fInnerSec[sec][row].fN2;icl++) | |
2297 | //if (cl[icl].IsUsed(10)) | |
2298 | cl[icl].Use(-1); | |
2299 | } | |
2300 | } | |
2301 | ||
2302 | for (Int_t sec=0;sec<fkNOS;sec++){ | |
2303 | for (Int_t row=0;row<fOuterSec->GetNRows();row++){ | |
2304 | AliTPCclusterMI *cl = fOuterSec[sec][row].fClusters1; | |
2305 | for (Int_t icl =0;icl< fOuterSec[sec][row].fN1;icl++) | |
2306 | //if (cl[icl].IsUsed(10)) | |
2307 | cl[icl].Use(-1); | |
2308 | cl = fOuterSec[sec][row].fClusters2; | |
2309 | for (Int_t icl =0;icl< fOuterSec[sec][row].fN2;icl++) | |
2310 | //if (cl[icl].IsUsed(10)) | |
2311 | cl[icl].Use(-1); | |
2312 | } | |
2313 | } | |
2314 | ||
1c53abe2 | 2315 | } |
2316 | ||
91162307 | 2317 | |
2318 | ||
732b9e78 | 2319 | void AliTPCtrackerMI::SignClusters(TObjArray * arr, Float_t fnumber, Float_t fdensity) |
1c53abe2 | 2320 | { |
2321 | // | |
91162307 | 2322 | //sign clusters to be "used" |
2323 | // | |
2324 | // snumber and sdensity sign number of sigmas - bellow mean value to be accepted | |
2325 | // loop over "primaries" | |
2326 | ||
2327 | Float_t sumdens=0; | |
2328 | Float_t sumdens2=0; | |
2329 | Float_t sumn =0; | |
2330 | Float_t sumn2 =0; | |
2331 | Float_t sumchi =0; | |
2332 | Float_t sumchi2 =0; | |
2333 | ||
2334 | Float_t sum =0; | |
2335 | ||
1c53abe2 | 2336 | TStopwatch timer; |
91162307 | 2337 | timer.Start(); |
1c53abe2 | 2338 | |
91162307 | 2339 | Int_t nseed = arr->GetEntriesFast(); |
2340 | for (Int_t i=0; i<nseed; i++) { | |
2341 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2342 | if (!pt) { | |
2343 | continue; | |
2344 | } | |
2345 | if (!(pt->IsActive())) continue; | |
2346 | Float_t dens = pt->GetNumberOfClusters()/Float_t(pt->fNFoundable); | |
2347 | if ( (dens>0.7) && (pt->GetNumberOfClusters()>70)){ | |
2348 | sumdens += dens; | |
2349 | sumdens2+= dens*dens; | |
2350 | sumn += pt->GetNumberOfClusters(); | |
2351 | sumn2 += pt->GetNumberOfClusters()*pt->GetNumberOfClusters(); | |
2352 | Float_t chi2 = pt->GetChi2()/pt->GetNumberOfClusters(); | |
2353 | if (chi2>5) chi2=5; | |
2354 | sumchi +=chi2; | |
2355 | sumchi2 +=chi2*chi2; | |
2356 | sum++; | |
2357 | } | |
1627d1c4 | 2358 | } |
91162307 | 2359 | |
2360 | Float_t mdensity = 0.9; | |
2361 | Float_t meann = 130; | |
2362 | Float_t meanchi = 1; | |
2363 | Float_t sdensity = 0.1; | |
2364 | Float_t smeann = 10; | |
2365 | Float_t smeanchi =0.4; | |
1627d1c4 | 2366 | |
91162307 | 2367 | |
2368 | if (sum>20){ | |
2369 | mdensity = sumdens/sum; | |
2370 | meann = sumn/sum; | |
2371 | meanchi = sumchi/sum; | |
2372 | // | |
2373 | sdensity = sumdens2/sum-mdensity*mdensity; | |
2374 | sdensity = TMath::Sqrt(sdensity); | |
2375 | // | |
2376 | smeann = sumn2/sum-meann*meann; | |
2377 | smeann = TMath::Sqrt(smeann); | |
2378 | // | |
2379 | smeanchi = sumchi2/sum - meanchi*meanchi; | |
2380 | smeanchi = TMath::Sqrt(smeanchi); | |
2381 | } | |
2382 | ||
2383 | ||
2384 | //REMOVE SHORT DELTAS or tracks going out of sensitive volume of TPC | |
2385 | // | |
2386 | for (Int_t i=0; i<nseed; i++) { | |
2387 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2388 | if (!pt) { | |
2389 | continue; | |
1c53abe2 | 2390 | } |
91162307 | 2391 | if (pt->fBSigned) continue; |
2392 | if (pt->fBConstrain) continue; | |
2393 | //if (!(pt->IsActive())) continue; | |
2394 | /* | |
2395 | Int_t found,foundable,shared; | |
2396 | pt->GetClusterStatistic(0,160,found, foundable,shared); | |
2397 | if (shared/float(found)>0.3) { | |
2398 | if (shared/float(found)>0.9 ){ | |
2399 | //delete arr->RemoveAt(i); | |
2400 | } | |
2401 | continue; | |
c9427e08 | 2402 | } |
91162307 | 2403 | */ |
2404 | Bool_t isok =kFALSE; | |
2405 | if ( (pt->fNShared/pt->GetNumberOfClusters()<0.5) &&pt->GetNumberOfClusters()>60) | |
2406 | isok = kTRUE; | |
2407 | if ((TMath::Abs(1/pt->GetC())<100.) && (pt->fNShared/pt->GetNumberOfClusters()<0.7)) | |
2408 | isok =kTRUE; | |
2409 | if (TMath::Abs(pt->GetZ()/pt->GetX())>1.1) | |
2410 | isok =kTRUE; | |
2411 | if ( (TMath::Abs(pt->GetSnp()>0.7) && pt->GetD(0,0)>60.)) | |
2412 | isok =kTRUE; | |
2413 | ||
2414 | if (isok) | |
2415 | for (Int_t i=0; i<160; i++) { | |
2416 | Int_t index=pt->GetClusterIndex2(i); | |
2417 | if (index<0) continue; | |
2418 | AliTPCclusterMI *c= pt->fClusterPointer[i]; | |
2419 | if (!c) continue; | |
2420 | //if (!(c->IsUsed(10))) c->Use(); | |
2421 | c->Use(10); | |
2422 | } | |
2423 | } | |
2424 | ||
c9427e08 | 2425 | |
1c53abe2 | 2426 | // |
91162307 | 2427 | Double_t maxchi = meanchi+2.*smeanchi; |
2428 | ||
2429 | for (Int_t i=0; i<nseed; i++) { | |
2430 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2431 | if (!pt) { | |
1c53abe2 | 2432 | continue; |
91162307 | 2433 | } |
2434 | //if (!(pt->IsActive())) continue; | |
2435 | if (pt->fBSigned) continue; | |
2436 | Double_t chi = pt->GetChi2()/pt->GetNumberOfClusters(); | |
2437 | if (chi>maxchi) continue; | |
2438 | ||
2439 | Float_t bfactor=1; | |
2440 | Float_t dens = pt->GetNumberOfClusters()/Float_t(pt->fNFoundable); | |
2441 | ||
2442 | //sign only tracks with enoug big density at the beginning | |
2443 | ||
2444 | if ((pt->GetDensityFirst(40)<0.75) && pt->GetNumberOfClusters()<meann) continue; | |
2445 | ||
2446 | ||
3e5d0aa2 | 2447 | Double_t mindens = TMath::Max(double(mdensity-sdensity*fdensity*bfactor),0.65); |
91162307 | 2448 | Double_t minn = TMath::Max(Int_t(meann-fnumber*smeann*bfactor),50); |
2449 | ||
2450 | // if (pt->fBConstrain) mindens = TMath::Max(mdensity-sdensity*fdensity*bfactor,0.65); | |
2451 | if ( (pt->fRemoval==10) && (pt->GetSnp()>0.8)&&(dens>mindens)) | |
2452 | minn=0; | |
2453 | ||
2454 | if ((dens>mindens && pt->GetNumberOfClusters()>minn) && chi<maxchi ){ | |
2455 | //Int_t noc=pt->GetNumberOfClusters(); | |
2456 | pt->fBSigned = kTRUE; | |
2457 | for (Int_t i=0; i<160; i++) { | |
2458 | ||
2459 | Int_t index=pt->GetClusterIndex2(i); | |
2460 | if (index<0) continue; | |
2461 | AliTPCclusterMI *c= pt->fClusterPointer[i]; | |
2462 | if (!c) continue; | |
2463 | // if (!(c->IsUsed(10))) c->Use(); | |
2464 | c->Use(10); | |
2465 | } | |
1c53abe2 | 2466 | } |
91162307 | 2467 | } |
2468 | // gLastCheck = nseed; | |
2469 | // arr->Compress(); | |
2470 | if (fDebug>0){ | |
2471 | timer.Print(); | |
2472 | } | |
1c53abe2 | 2473 | } |
2474 | ||
2475 | ||
47966a6d | 2476 | void AliTPCtrackerMI::StopNotActive(TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const |
91162307 | 2477 | { |
2478 | // stop not active tracks | |
2479 | // take th1 as threshold for number of founded to number of foundable on last 10 active rows | |
2480 | // take th2 as threshold for number of founded to number of foundable on last 20 active rows | |
2481 | Int_t nseed = arr->GetEntriesFast(); | |
2482 | // | |
2483 | for (Int_t i=0; i<nseed; i++) { | |
2484 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); | |
2485 | if (!pt) { | |
2486 | continue; | |
2487 | } | |
2488 | if (!(pt->IsActive())) continue; | |
2489 | StopNotActive(pt,row0,th0, th1,th2); | |
2490 | } | |
2491 | } | |
1c53abe2 | 2492 | |
1c53abe2 | 2493 | |
1c53abe2 | 2494 | |
91162307 | 2495 | void AliTPCtrackerMI::StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1, |
47966a6d | 2496 | Float_t th2) const |
91162307 | 2497 | { |
2498 | // stop not active tracks | |
2499 | // take th1 as threshold for number of founded to number of foundable on last 10 active rows | |
2500 | // take th2 as threshold for number of founded to number of foundable on last 20 active rows | |
2501 | Int_t sumgood1 = 0; | |
2502 | Int_t sumgood2 = 0; | |
2503 | Int_t foundable = 0; | |
2504 | Int_t maxindex = seed->fLastPoint; //last foundable row | |
2505 | if (seed->fNFoundable*th0 > seed->GetNumberOfClusters()) { | |
2506 | seed->Desactivate(10) ; | |
2507 | return; | |
2508 | } | |
1c53abe2 | 2509 | |
3e5d0aa2 | 2510 | for (Int_t i=row0; i<maxindex; i++){ |
91162307 | 2511 | Int_t index = seed->GetClusterIndex2(i); |
2512 | if (index!=-1) foundable++; | |
2513 | //if (!c) continue; | |
2514 | if (foundable<=30) sumgood1++; | |
2515 | if (foundable<=50) { | |
2516 | sumgood2++; | |
2517 | } | |
2518 | else{ | |
2519 | break; | |
2520 | } | |
2521 | } | |
2522 | if (foundable>=30.){ | |
2523 | if (sumgood1<(th1*30.)) seed->Desactivate(10); | |
2524 | } | |
2525 | if (foundable>=50) | |
2526 | if (sumgood2<(th2*50.)) seed->Desactivate(10); | |
2527 | } | |
1c53abe2 | 2528 | |
1c53abe2 | 2529 | |
d26d9159 | 2530 | Int_t AliTPCtrackerMI::RefitInward(AliESD *event) |
2531 | { | |
2532 | // | |
2533 | // back propagation of ESD tracks | |
2534 | // | |
2535 | //return 0; | |
2536 | fEvent = event; | |
2537 | ReadSeeds(event,2); | |
2538 | fIteration=2; | |
982aff31 | 2539 | //PrepareForProlongation(fSeeds,1); |
2540 | PropagateForward2(fSeeds); | |
af32720d | 2541 | |
4d158c36 | 2542 | Int_t ntracks=0; |
d26d9159 | 2543 | Int_t nseed = fSeeds->GetEntriesFast(); |
2544 | for (Int_t i=0;i<nseed;i++){ | |
2545 | AliTPCseed * seed = (AliTPCseed*) fSeeds->UncheckedAt(i); | |
4d158c36 | 2546 | if (!seed) continue; |
eea478d3 | 2547 | if (seed->GetKinkIndex(0)>0) UpdateKinkQualityD(seed); // update quality informations for kinks |
2548 | ||
d26d9159 | 2549 | seed->PropagateTo(fParam->GetInnerRadiusLow()); |
51ad6848 | 2550 | seed->UpdatePoints(); |
d26d9159 | 2551 | AliESDtrack *esd=event->GetTrack(i); |
2552 | seed->CookdEdx(0.02,0.6); | |
2553 | CookLabel(seed,0.1); //For comparison only | |
af32720d | 2554 | // |
2555 | if (0 && seed!=0&&esd!=0) { | |
2556 | TTreeSRedirector &cstream = *fDebugStreamer; | |
2557 | cstream<<"Crefit"<< | |
2558 | "Esd.="<<esd<< | |
2559 | "Track.="<<seed<< | |
2560 | "\n"; | |
2561 | } | |
51ad6848 | 2562 | if (seed->GetNumberOfClusters()>15){ |
4d158c36 | 2563 | esd->UpdateTrackParams(seed,AliESDtrack::kTPCrefit); |
51ad6848 | 2564 | esd->SetTPCPoints(seed->GetPoints()); |
b406fdb0 | 2565 | esd->SetTPCPointsF(seed->fNFoundable); |
2566 | Int_t ndedx = seed->fNCDEDX[0]+seed->fNCDEDX[1]+seed->fNCDEDX[2]+seed->fNCDEDX[3]; | |
2567 | Float_t sdedx = (seed->fSDEDX[0]+seed->fSDEDX[1]+seed->fSDEDX[2]+seed->fSDEDX[3])*0.25; | |
2568 | Float_t dedx = seed->GetdEdx(); | |
2569 | esd->SetTPCsignal(dedx, sdedx, ndedx); | |
4d158c36 | 2570 | ntracks++; |
d26d9159 | 2571 | } |
2572 | else{ | |
2573 | //printf("problem\n"); | |
2574 | } | |
2575 | } | |
51ad6848 | 2576 | //FindKinks(fSeeds,event); |
4d158c36 | 2577 | Info("RefitInward","Number of refitted tracks %d",ntracks); |
d26d9159 | 2578 | fEvent =0; |
2579 | //WriteTracks(); | |
2580 | return 0; | |
2581 | } | |
2582 | ||
1c53abe2 | 2583 | |
91162307 | 2584 | Int_t AliTPCtrackerMI::PropagateBack(AliESD *event) |
2585 | { | |
2586 | // | |
2587 | // back propagation of ESD tracks | |
2588 | // | |
1c53abe2 | 2589 | |
91162307 | 2590 | fEvent = event; |
d26d9159 | 2591 | fIteration = 1; |
5d837844 | 2592 | ReadSeeds(event,1); |
b406fdb0 | 2593 | PropagateBack(fSeeds); |
2594 | RemoveUsed2(fSeeds,0.4,0.4,20); | |
2595 | // | |
91162307 | 2596 | Int_t nseed = fSeeds->GetEntriesFast(); |
4d158c36 | 2597 | Int_t ntracks=0; |
91162307 | 2598 | for (Int_t i=0;i<nseed;i++){ |
2599 | AliTPCseed * seed = (AliTPCseed*) fSeeds->UncheckedAt(i); | |
d9e62e7e | 2600 | if (!seed) continue; |
51ad6848 | 2601 | if (seed->GetKinkIndex(0)<0) UpdateKinkQualityM(seed); // update quality informations for kinks |
2602 | seed->UpdatePoints(); | |
91162307 | 2603 | AliESDtrack *esd=event->GetTrack(i); |
d26d9159 | 2604 | seed->CookdEdx(0.02,0.6); |
91162307 | 2605 | CookLabel(seed,0.1); //For comparison only |
51ad6848 | 2606 | if (seed->GetNumberOfClusters()>15){ |
4d158c36 | 2607 | esd->UpdateTrackParams(seed,AliESDtrack::kTPCout); |
51ad6848 | 2608 | esd->SetTPCPoints(seed->GetPoints()); |
167c41ab | 2609 | esd->SetTPCPointsF(seed->fNFoundable); |
2610 | Int_t ndedx = seed->fNCDEDX[0]+seed->fNCDEDX[1]+seed->fNCDEDX[2]+seed->fNCDEDX[3]; | |
2611 | Float_t sdedx = (seed->fSDEDX[0]+seed->fSDEDX[1]+seed->fSDEDX[2]+seed->fSDEDX[3])*0.25; | |
2612 | Float_t dedx = seed->GetdEdx(); | |
2613 | esd->SetTPCsignal(dedx, sdedx, ndedx); | |
4d158c36 | 2614 | ntracks++; |
ca142b1f | 2615 | Int_t eventnumber = event->GetEventNumber();// patch 28 fev 06 |
2616 | (*fDebugStreamer)<<"Cback"<< | |
2617 | "Tr0.="<<seed<< | |
2618 | "EventNr="<<eventnumber<< | |
2619 | "\n"; // patch 28 fev 06 | |
4d158c36 | 2620 | } |
91162307 | 2621 | } |
51ad6848 | 2622 | //FindKinks(fSeeds,event); |
4d158c36 | 2623 | Info("PropagateBack","Number of back propagated tracks %d",ntracks); |
91162307 | 2624 | fEvent =0; |
d26d9159 | 2625 | //WriteTracks(); |
91162307 | 2626 | return 0; |
2627 | } | |
2628 | ||
2629 | ||
2630 | void AliTPCtrackerMI::DeleteSeeds() | |
2631 | { | |
b67e07dc | 2632 | // |
2633 | //delete Seeds | |
91162307 | 2634 | Int_t nseed = fSeeds->GetEntriesFast(); |
2635 | for (Int_t i=0;i<nseed;i++){ | |
2636 | AliTPCseed * seed = (AliTPCseed*)fSeeds->At(i); | |
2637 | if (seed) delete fSeeds->RemoveAt(i); | |
2638 | } | |
2639 | delete fSeeds; | |
2640 | fSeeds =0; | |
2641 | } | |
2642 | ||
d26d9159 | 2643 | void AliTPCtrackerMI::ReadSeeds(AliESD *event, Int_t direction) |
91162307 | 2644 | { |
2645 | // | |
2646 | //read seeds from the event | |
2647 | ||
2648 | Int_t nentr=event->GetNumberOfTracks(); | |
6bdc18d6 | 2649 | if (fDebug>0){ |
2650 | Info("ReadSeeds", "Number of ESD tracks: %d\n", nentr); | |
2651 | } | |
91162307 | 2652 | if (fSeeds) |
2653 | DeleteSeeds(); | |
2654 | if (!fSeeds){ | |
4d158c36 | 2655 | fSeeds = new TObjArray(nentr); |
91162307 | 2656 | } |
4d158c36 | 2657 | UnsignClusters(); |
2658 | // Int_t ntrk=0; | |
91162307 | 2659 | for (Int_t i=0; i<nentr; i++) { |
2660 | AliESDtrack *esd=event->GetTrack(i); | |
51ad6848 | 2661 | ULong_t status=esd->GetStatus(); |
2662 | if (!(status&AliESDtrack::kTPCin)) continue; | |
b67e07dc | 2663 | AliTPCtrack t(*esd); |
5d837844 | 2664 | t.SetNumberOfClusters(0); |
eea478d3 | 2665 | // AliTPCseed *seed = new AliTPCseed(t,t.GetAlpha()); |
2666 | AliTPCseed *seed = new AliTPCseed(t/*,t.GetAlpha()*/); | |
2667 | for (Int_t ikink=0;ikink<3;ikink++) { | |
2668 | Int_t index = esd->GetKinkIndex(ikink); | |
2669 | seed->GetKinkIndexes()[ikink] = index; | |
2670 | if (index==0) continue; | |
2671 | index = TMath::Abs(index); | |
2672 | AliESDkink * kink = fEvent->GetKink(index-1); | |
2673 | if (kink&&esd->GetKinkIndex(ikink)<0){ | |
2674 | if ((status & AliESDtrack::kTRDrefit) != 0) kink->SetStatus(1,2); | |
2675 | if ((status & AliESDtrack::kITSout) != 0) kink->SetStatus(1,0); | |
2676 | } | |
2677 | if (kink&&esd->GetKinkIndex(ikink)>0){ | |
2678 | if ((status & AliESDtrack::kTRDrefit) != 0) kink->SetStatus(1,6); | |
2679 | if ((status & AliESDtrack::kITSout) != 0) kink->SetStatus(1,4); | |
2680 | } | |
2681 | ||
2682 | } | |
5d837844 | 2683 | if (((status&AliESDtrack::kITSout)==0)&&(direction==1)) seed->ResetCovariance(); |
982aff31 | 2684 | if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) == 0 ) seed->ResetCovariance(); |
4d158c36 | 2685 | if ( direction ==2 && ((status & AliESDtrack::kTPCout) == 0) ) { |
2686 | fSeeds->AddAt(0,i); | |
2687 | delete seed; | |
2688 | continue; | |
2689 | } | |
2690 | if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) > 0 ) { | |
c0b978f0 | 2691 | Double_t par0[5],par1[5],alpha,x; |
2692 | esd->GetInnerExternalParameters(alpha,x,par0); | |
4d158c36 | 2693 | esd->GetExternalParameters(x,par1); |
2694 | Double_t delta1 = TMath::Abs(par0[4]-par1[4])/(0.000000001+TMath::Abs(par0[4]+par1[4])); | |
2695 | Double_t delta2 = TMath::Abs(par0[3]-par1[3]); | |
51ad6848 | 2696 | Double_t trdchi2=0; |
2697 | if (esd->GetTRDncls()>0) trdchi2 = esd->GetTRDchi2()/esd->GetTRDncls(); | |
4d158c36 | 2698 | //reset covariance if suspicious |
51ad6848 | 2699 | if ( (delta1>0.1) || (delta2>0.006) ||trdchi2>7.) |
4d158c36 | 2700 | seed->ResetCovariance(); |
2701 | } | |
982aff31 | 2702 | |
91162307 | 2703 | // |
2704 | // | |
2705 | // rotate to the local coordinate system | |
eea478d3 | 2706 | // |
2707 | fSectors=fInnerSec; fN=fkNIS; | |
91162307 | 2708 | Double_t alpha=seed->GetAlpha() - fSectors->GetAlphaShift(); |
2709 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); | |
2710 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); | |
2711 | Int_t ns=Int_t(alpha/fSectors->GetAlpha())%fN; | |
2712 | alpha =ns*fSectors->GetAlpha() + fSectors->GetAlphaShift(); | |
4d158c36 | 2713 | if (alpha<-TMath::Pi()) alpha += 2*TMath::Pi(); |
2714 | if (alpha>=TMath::Pi()) alpha -= 2*TMath::Pi(); | |
91162307 | 2715 | alpha-=seed->GetAlpha(); |
d9b8978b | 2716 | if (!seed->Rotate(alpha)) { |
2717 | delete seed; | |
2718 | continue; | |
2719 | } | |
d26d9159 | 2720 | seed->fEsd = esd; |
4d158c36 | 2721 | // sign clusters |
b406fdb0 | 2722 | if (esd->GetKinkIndex(0)<=0){ |
2723 | for (Int_t irow=0;irow<160;irow++){ | |
2724 | Int_t index = seed->GetClusterIndex2(irow); | |
2725 | if (index>0){ | |
2726 | // | |
2727 | AliTPCclusterMI * cl = GetClusterMI(index); | |
2728 | seed->fClusterPointer[irow] = cl; | |
2729 | if (cl){ | |
2730 | if ((index & 0x8000)==0){ | |
2731 | cl->Use(10); // accepted cluster | |
2732 | }else{ | |
2733 | cl->Use(6); // close cluster not accepted | |
2734 | } | |
4d158c36 | 2735 | }else{ |
b406fdb0 | 2736 | Info("ReadSeeds","Not found cluster"); |
2737 | } | |
4d158c36 | 2738 | } |
2739 | } | |
2740 | } | |
2741 | fSeeds->AddAt(seed,i); | |
91162307 | 2742 | } |
2743 | } | |
2744 | ||
2745 | ||
2746 | ||
2747 | //_____________________________________________________________________________ | |
2748 | void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], | |
2749 | Float_t deltay, Int_t ddsec) { | |
2750 | //----------------------------------------------------------------- | |
2751 | // This function creates track seeds. | |
2752 | // SEEDING WITH VERTEX CONSTRAIN | |
2753 | //----------------------------------------------------------------- | |
2754 | // cuts[0] - fP4 cut | |
2755 | // cuts[1] - tan(phi) cut | |
2756 | // cuts[2] - zvertex cut | |
2757 | // cuts[3] - fP3 cut | |
2758 | Int_t nin0 = 0; | |
2759 | Int_t nin1 = 0; | |
2760 | Int_t nin2 = 0; | |
2761 | Int_t nin = 0; | |
2762 | Int_t nout1 = 0; | |
2763 | Int_t nout2 = 0; | |
2764 | ||
2765 | Double_t x[5], c[15]; | |
2766 | // Int_t di = i1-i2; | |
2767 | // | |
2768 | AliTPCseed * seed = new AliTPCseed; | |
2769 | Double_t alpha=fSectors->GetAlpha(), shift=fSectors->GetAlphaShift(); | |
2770 | Double_t cs=cos(alpha), sn=sin(alpha); | |
2771 | // | |
2772 | // Double_t x1 =fOuterSec->GetX(i1); | |
2773 | //Double_t xx2=fOuterSec->GetX(i2); | |
2774 | ||
2775 | Double_t x1 =GetXrow(i1); | |
2776 | Double_t xx2=GetXrow(i2); | |
2777 | ||
2778 | Double_t x3=GetX(), y3=GetY(), z3=GetZ(); | |
2779 | ||
2780 | Int_t imiddle = (i2+i1)/2; //middle pad row index | |
2781 | Double_t xm = GetXrow(imiddle); // radius of middle pad-row | |
2782 | const AliTPCRow& krm=GetRow(sec,imiddle); //middle pad -row | |
2783 | // | |
2784 | Int_t ns =sec; | |
2785 | ||
2786 | const AliTPCRow& kr1=GetRow(ns,i1); | |
2787 | Double_t ymax = GetMaxY(i1)-kr1.fDeadZone-1.5; | |
2788 | Double_t ymaxm = GetMaxY(imiddle)-kr1.fDeadZone-1.5; | |
2789 | ||
2790 | // | |
2791 | // change cut on curvature if it can't reach this layer | |
2792 | // maximal curvature set to reach it | |
2793 | Double_t dvertexmax = TMath::Sqrt((x1-x3)*(x1-x3)+(ymax+5-y3)*(ymax+5-y3)); | |
2794 | if (dvertexmax*0.5*cuts[0]>0.85){ | |
2795 | cuts[0] = 0.85/(dvertexmax*0.5+1.); | |
2796 | } | |
2797 | Double_t r2min = 1/(cuts[0]*cuts[0]); //minimal square of radius given by cut | |
2798 | ||
2799 | // Int_t ddsec = 1; | |
2800 | if (deltay>0) ddsec = 0; | |
2801 | // loop over clusters | |
2802 | for (Int_t is=0; is < kr1; is++) { | |
2803 | // | |
2804 | if (kr1[is]->IsUsed(10)) continue; | |
2805 | Double_t y1=kr1[is]->GetY(), z1=kr1[is]->GetZ(); | |
2806 | //if (TMath::Abs(y1)>ymax) continue; | |
2807 | ||
2808 | if (deltay>0 && TMath::Abs(ymax-TMath::Abs(y1))> deltay ) continue; // seed only at the edge | |
2809 | ||
2810 | // find possible directions | |
2811 | Float_t anglez = (z1-z3)/(x1-x3); | |
2812 | Float_t extraz = z1 - anglez*(x1-xx2); // extrapolated z | |
2813 | // | |
2814 | // | |
2815 | //find rotation angles relative to line given by vertex and point 1 | |
2816 | Double_t dvertex2 = (x1-x3)*(x1-x3)+(y1-y3)*(y1-y3); | |
2817 | Double_t dvertex = TMath::Sqrt(dvertex2); | |
2818 | Double_t angle13 = TMath::ATan((y1-y3)/(x1-x3)); | |
2819 | Double_t cs13 = cos(-angle13), sn13 = sin(-angle13); | |
2820 | ||
2821 | // | |
2822 | // loop over 2 sectors | |
2823 | Int_t dsec1=-ddsec; | |
2824 | Int_t dsec2= ddsec; | |
2825 | if (y1<0) dsec2= 0; | |
2826 | if (y1>0) dsec1= 0; | |
2827 | ||
2828 | Double_t dddz1=0; // direction of delta inclination in z axis | |
2829 | Double_t dddz2=0; | |
2830 | if ( (z1-z3)>0) | |
2831 | dddz1 =1; | |
2832 | else | |
2833 | dddz2 =1; | |
2834 | // | |
2835 | for (Int_t dsec = dsec1; dsec<=dsec2;dsec++){ | |
2836 | Int_t sec2 = sec + dsec; | |
2837 | // | |
2838 | // AliTPCRow& kr2 = fOuterSec[(sec2+fkNOS)%fkNOS][i2]; | |
2839 | //AliTPCRow& kr2m = fOuterSec[(sec2+fkNOS)%fkNOS][imiddle]; | |
2840 | AliTPCRow& kr2 = GetRow((sec2+fkNOS)%fkNOS,i2); | |
2841 | AliTPCRow& kr2m = GetRow((sec2+fkNOS)%fkNOS,imiddle); | |
2842 | Int_t index1 = TMath::Max(kr2.Find(extraz-0.6-dddz1*TMath::Abs(z1)*0.05)-1,0); | |
2843 | Int_t index2 = TMath::Min(kr2.Find(extraz+0.6+dddz2*TMath::Abs(z1)*0.05)+1,kr2); | |
2844 | ||
2845 | // rotation angles to p1-p3 | |
2846 | Double_t cs13r = cos(-angle13+dsec*alpha)/dvertex, sn13r = sin(-angle13+dsec*alpha)/dvertex; | |
2847 | Double_t x2, y2, z2; | |
2848 | // | |
2849 | // Double_t dymax = maxangle*TMath::Abs(x1-xx2); | |
2850 | ||
2851 | // | |
2852 | Double_t dxx0 = (xx2-x3)*cs13r; | |
2853 | Double_t dyy0 = (xx2-x3)*sn13r; | |
2854 | for (Int_t js=index1; js < index2; js++) { | |
2855 | const AliTPCclusterMI *kcl = kr2[js]; | |
2856 | if (kcl->IsUsed(10)) continue; | |
2857 | // | |
2858 | //calcutate parameters | |
2859 | // | |
2860 | Double_t yy0 = dyy0 +(kcl->GetY()-y3)*cs13r; | |
2861 | // stright track | |
2862 | if (TMath::Abs(yy0)<0.000001) continue; | |
2863 | Double_t xx0 = dxx0 -(kcl->GetY()-y3)*sn13r; | |
2864 | Double_t y0 = 0.5*(xx0*xx0+yy0*yy0-xx0)/yy0; | |
2865 | Double_t r02 = (0.25+y0*y0)*dvertex2; | |
2866 | //curvature (radius) cut | |
2867 | if (r02<r2min) continue; | |
2868 | ||
2869 | nin0++; | |
2870 | // | |
2871 | Double_t c0 = 1/TMath::Sqrt(r02); | |
2872 | if (yy0>0) c0*=-1.; | |
2873 | ||
2874 | ||
2875 | //Double_t dfi0 = 2.*TMath::ASin(dvertex*c0*0.5); | |
2876 | //Double_t dfi1 = 2.*TMath::ASin(TMath::Sqrt(yy0*yy0+(1-xx0)*(1-xx0))*dvertex*c0*0.5); | |
b67e07dc | 2877 | Double_t dfi0 = 2.*AliTPCFastMath::FastAsin(dvertex*c0*0.5); |
2878 | Double_t dfi1 = 2.*AliTPCFastMath::FastAsin(TMath::Sqrt(yy0*yy0+(1-xx0)*(1-xx0))*dvertex*c0*0.5); | |
91162307 | 2879 | // |
2880 | // | |
2881 | Double_t z0 = kcl->GetZ(); | |
2882 | Double_t zzzz2 = z1-(z1-z3)*dfi1/dfi0; | |
2883 | if (TMath::Abs(zzzz2-z0)>0.5) continue; | |
2884 | nin1++; | |
2885 | // | |
2886 | Double_t dip = (z1-z0)*c0/dfi1; | |
2887 | Double_t x0 = (0.5*cs13+y0*sn13)*dvertex*c0; | |
2888 | // | |
2889 | y2 = kcl->GetY(); | |
2890 | if (dsec==0){ | |
2891 | x2 = xx2; | |
2892 | z2 = kcl->GetZ(); | |
2893 | } | |
2894 | else | |
2895 | { | |
2896 | // rotation | |
2897 | z2 = kcl->GetZ(); | |
2898 | x2= xx2*cs-y2*sn*dsec; | |
2899 | y2=+xx2*sn*dsec+y2*cs; | |
2900 | } | |
2901 | ||
2902 | x[0] = y1; | |
2903 | x[1] = z1; | |
2904 | x[2] = x0; | |
2905 | x[3] = dip; | |
2906 | x[4] = c0; | |
2907 | // | |
2908 | // | |
2909 | // do we have cluster at the middle ? | |
2910 | Double_t ym,zm; | |
2911 | GetProlongation(x1,xm,x,ym,zm); | |
2912 | UInt_t dummy; | |
2913 | AliTPCclusterMI * cm=0; | |
2914 | if (TMath::Abs(ym)-ymaxm<0){ | |
2915 | cm = krm.FindNearest2(ym,zm,1.0,0.6,dummy); | |
2916 | if ((!cm) || (cm->IsUsed(10))) { | |
2917 | continue; | |
2918 | } | |
2919 | } | |
2920 | else{ | |
2921 | // rotate y1 to system 0 | |
2922 | // get state vector in rotated system | |
2923 | Double_t yr1 = (-0.5*sn13+y0*cs13)*dvertex*c0; | |
2924 | Double_t xr2 = x0*cs+yr1*sn*dsec; | |
2925 | Double_t xr[5]={kcl->GetY(),kcl->GetZ(), xr2, dip, c0}; | |
2926 | // | |
2927 | GetProlongation(xx2,xm,xr,ym,zm); | |
2928 | if (TMath::Abs(ym)-ymaxm<0){ | |
2929 | cm = kr2m.FindNearest2(ym,zm,1.0,0.6,dummy); | |
2930 | if ((!cm) || (cm->IsUsed(10))) { | |
2931 | continue; | |
2932 | } | |
2933 | } | |
2934 | } | |
2935 | ||
2936 | ||
2937 | Double_t dym = 0; | |
2938 | Double_t dzm = 0; | |
2939 | if (cm){ | |
2940 | dym = ym - cm->GetY(); | |
2941 | dzm = zm - cm->GetZ(); | |
2942 | } | |
2943 | nin2++; | |
2944 | ||
2945 | ||
2946 | // | |
2947 | // | |
2948 | Double_t sy1=kr1[is]->GetSigmaY2()*2., sz1=kr1[is]->GetSigmaZ2()*2.; | |
2949 | Double_t sy2=kcl->GetSigmaY2()*2., sz2=kcl->GetSigmaZ2()*2.; | |
2950 | //Double_t sy3=400*3./12., sy=0.1, sz=0.1; | |
2951 | Double_t sy3=25000*x[4]*x[4]+0.1, sy=0.1, sz=0.1; | |
2952 | //Double_t sy3=25000*x[4]*x[4]*60+0.5, sy=0.1, sz=0.1; | |
2953 | ||
b67e07dc | 2954 | Double_t f40=(F1(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy; |
2955 | Double_t f42=(F1(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy; | |
2956 | Double_t f43=(F1(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy; | |
2957 | Double_t f20=(F2(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy; | |
2958 | Double_t f22=(F2(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy; | |
2959 | Double_t f23=(F2(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy; | |
91162307 | 2960 | |
b67e07dc | 2961 | Double_t f30=(F3(x1,y1+sy,x2,y2,z1,z2)-x[3])/sy; |
2962 | Double_t f31=(F3(x1,y1,x2,y2,z1+sz,z2)-x[3])/sz; | |
2963 | Double_t f32=(F3(x1,y1,x2,y2+sy,z1,z2)-x[3])/sy; | |
2964 | Double_t f34=(F3(x1,y1,x2,y2,z1,z2+sz)-x[3])/sz; | |
91162307 | 2965 | |
1c53abe2 | 2966 | c[0]=sy1; |
2967 | c[1]=0.; c[2]=sz1; | |
2968 | c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23; | |
2969 | c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22; | |
2970 | c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34; | |
2971 | c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23; | |
2972 | c[13]=f30*sy1*f40+f32*sy2*f42; | |
2973 | c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; | |
91162307 | 2974 | |
2975 | // if (!BuildSeed(kr1[is],kcl,0,x1,x2,x3,x,c)) continue; | |
2976 | ||
1c53abe2 | 2977 | UInt_t index=kr1.GetIndex(is); |
91162307 | 2978 | AliTPCseed *track=new(seed) AliTPCseed(index, x, c, x1, ns*alpha+shift); |
2979 | ||
1c53abe2 | 2980 | track->fIsSeeding = kTRUE; |
91162307 | 2981 | track->fSeed1 = i1; |
2982 | track->fSeed2 = i2; | |
2983 | track->fSeedType=3; | |
c9427e08 | 2984 | |
91162307 | 2985 | |
2986 | //if (dsec==0) { | |
2987 | FollowProlongation(*track, (i1+i2)/2,1); | |
2988 | Int_t foundable,found,shared; | |
2989 | track->GetClusterStatistic((i1+i2)/2,i1, found, foundable, shared, kTRUE); | |
2990 | if ((found<0.55*foundable) || shared>0.5*found || (track->GetSigmaY2()+track->GetSigmaZ2())>0.5){ | |
2991 | seed->Reset(); | |
2992 | seed->~AliTPCseed(); | |
2993 | continue; | |
2994 | } | |
2995 | //} | |
2996 | ||
2997 | nin++; | |
2998 | FollowProlongation(*track, i2,1); | |
2999 | ||
3000 | ||
3001 | //Int_t rc = 1; | |
3002 | track->fBConstrain =1; | |
3003 | // track->fLastPoint = i1+fInnerSec->GetNRows(); // first cluster in track position | |
3004 | track->fLastPoint = i1; // first cluster in track position | |
3005 | track->fFirstPoint = track->fLastPoint; | |
3006 | ||
3007 | if (track->GetNumberOfClusters()<(i1-i2)*0.5 || | |
3008 | track->GetNumberOfClusters() < track->fNFoundable*0.6 || | |
3009 | track->fNShared>0.4*track->GetNumberOfClusters() ) { | |
3010 | seed->Reset(); | |
3011 | seed->~AliTPCseed(); | |
c9427e08 | 3012 | continue; |
3013 | } | |
91162307 | 3014 | nout1++; |
3015 | // Z VERTEX CONDITION | |
3016 | Double_t zv; | |
3017 | zv = track->GetZ()+track->GetTgl()/track->GetC()* | |
3018 | ( asin(-track->GetEta()) - asin(track->GetX()*track->GetC()-track->GetEta())); | |
3019 | if (TMath::Abs(zv-z3)>cuts[2]) { | |
3020 | FollowProlongation(*track, TMath::Max(i2-20,0)); | |
3021 | zv = track->GetZ()+track->GetTgl()/track->GetC()* | |
3022 | ( asin(-track->GetEta()) - asin(track->GetX()*track->GetC()-track->GetEta())); | |
3023 | if (TMath::Abs(zv-z3)>cuts[2]){ | |
3024 | FollowProlongation(*track, TMath::Max(i2-40,0)); | |
3025 | zv = track->GetZ()+track->GetTgl()/track->GetC()* | |
3026 | ( asin(-track->GetEta()) - asin(track->GetX()*track->GetC()-track->GetEta())); | |
3027 | if (TMath::Abs(zv-z3)>cuts[2] &&(track->GetNumberOfClusters() > track->fNFoundable*0.7)){ | |
3028 | // make seed without constrain | |
3029 | AliTPCseed * track2 = MakeSeed(track,0.2,0.5,1.); | |
3030 | FollowProlongation(*track2, i2,1); | |
3031 | track2->fBConstrain = kFALSE; | |
3032 | track2->fSeedType = 1; | |
3033 | arr->AddLast(track2); | |
3034 | seed->Reset(); | |
3035 | seed->~AliTPCseed(); | |
3036 | continue; | |
3037 | } | |
3038 | else{ | |
3039 | seed->Reset(); | |
3040 | seed->~AliTPCseed(); | |
3041 | continue; | |
3042 | ||
3043 | } | |
3044 | } | |
c9427e08 | 3045 | } |
1c53abe2 | 3046 | |
91162307 | 3047 | track->fSeedType =0; |
3048 | arr->AddLast(track); | |
3049 | seed = new AliTPCseed; | |
3050 | nout2++; | |
3051 | // don't consider other combinations | |
3052 | if (track->GetNumberOfClusters() > track->fNFoundable*0.8) | |
3053 | break; | |
1c53abe2 | 3054 | } |
3055 | } | |
3056 | } | |
6bdc18d6 | 3057 | if (fDebug>3){ |
3058 | Info("MakeSeeds3","\nSeeding statistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2); | |
91162307 | 3059 | } |
3060 | delete seed; | |
1c53abe2 | 3061 | } |
3062 | ||
1627d1c4 | 3063 | |
91162307 | 3064 | void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], |
3065 | Float_t deltay) { | |
3066 | ||
3067 | ||
3068 | ||
1627d1c4 | 3069 | //----------------------------------------------------------------- |
91162307 | 3070 | // This function creates track seeds. |
1627d1c4 | 3071 | //----------------------------------------------------------------- |
91162307 | 3072 | // cuts[0] - fP4 cut |
3073 | // cuts[1] - tan(phi) cut | |
3074 | // cuts[2] - zvertex cut | |
3075 | // cuts[3] - fP3 cut | |
3076 | ||
3077 | ||
3078 | Int_t nin0 = 0; | |
3079 | Int_t nin1 = 0; | |
3080 | Int_t nin2 = 0; | |
3081 | Int_t nin = 0; | |
3082 | Int_t nout1 = 0; | |
3083 | Int_t nout2 = 0; | |
3084 | Int_t nout3 =0; | |
3085 | Double_t x[5], c[15]; | |
3086 | // | |
3087 | // make temporary seed | |
3088 | AliTPCseed * seed = new AliTPCseed; | |
1627d1c4 | 3089 | Double_t alpha=fOuterSec->GetAlpha(), shift=fOuterSec->GetAlphaShift(); |
3090 | // Double_t cs=cos(alpha), sn=sin(alpha); | |
91162307 | 3091 | // |
3092 | // | |
1627d1c4 | 3093 | |
91162307 | 3094 | // first 3 padrows |
3095 | Double_t x1 = GetXrow(i1-1); | |
3096 | const AliTPCRow& kr1=GetRow(sec,i1-1); | |
3097 | Double_t y1max = GetMaxY(i1-1)-kr1.fDeadZone-1.5; | |
3098 | // | |
3099 | Double_t x1p = GetXrow(i1); | |
3100 | const AliTPCRow& kr1p=GetRow(sec,i1); | |
3101 | // | |
3102 | Double_t x1m = GetXrow(i1-2); | |
3103 | const AliTPCRow& kr1m=GetRow(sec,i1-2); | |
1627d1c4 | 3104 | |
91162307 | 3105 | // |
3106 | //last 3 padrow for seeding | |
3107 | AliTPCRow& kr3 = GetRow((sec+fkNOS)%fkNOS,i1-7); | |
3108 | Double_t x3 = GetXrow(i1-7); | |
3109 | // Double_t y3max= GetMaxY(i1-7)-kr3.fDeadZone-1.5; | |
3110 | // | |
3111 | AliTPCRow& kr3p = GetRow((sec+fkNOS)%fkNOS,i1-6); | |
3112 | Double_t x3p = GetXrow(i1-6); | |
3113 | // | |
3114 | AliTPCRow& kr3m = GetRow((sec+fkNOS)%fkNOS,i1-8); | |
3115 | Double_t x3m = GetXrow(i1-8); | |
1627d1c4 | 3116 | |
91162307 | 3117 | // |
3118 | // | |
3119 | // middle padrow | |
3120 | Int_t im = i1-4; //middle pad row index | |
3121 | Double_t xm = GetXrow(im); // radius of middle pad-row | |
3122 | const AliTPCRow& krm=GetRow(sec,im); //middle pad -row | |
3123 | // Double_t ymmax = GetMaxY(im)-kr1.fDeadZone-1.5; | |
3124 | // | |
3125 | // | |
3126 | Double_t deltax = x1-x3; | |
3127 | Double_t dymax = deltax*cuts[1]; | |
3128 | Double_t dzmax = deltax*cuts[3]; | |
3129 | // | |
3130 | // loop over clusters | |
3131 | for (Int_t is=0; is < kr1; is++) { | |
1627d1c4 | 3132 | // |
91162307 | 3133 | if (kr1[is]->IsUsed(10)) continue; |
3134 | Double_t y1=kr1[is]->GetY(), z1=kr1[is]->GetZ(); | |
1627d1c4 | 3135 | // |
91162307 | 3136 | if (deltay>0 && TMath::Abs(y1max-TMath::Abs(y1))> deltay ) continue; // seed only at the edge |
3137 | // | |
3138 | Int_t index1 = TMath::Max(kr3.Find(z1-dzmax)-1,0); | |
3139 | Int_t index2 = TMath::Min(kr3.Find(z1+dzmax)+1,kr3); | |
3140 | // | |
3141 | Double_t y3, z3; | |
1627d1c4 | 3142 | // |
1627d1c4 | 3143 | // |
91162307 | 3144 | UInt_t index; |
3145 | for (Int_t js=index1; js < index2; js++) { | |
3146 | const AliTPCclusterMI *kcl = kr3[js]; | |
3147 | if (kcl->IsUsed(10)) continue; | |
3148 | y3 = kcl->GetY(); | |
3149 | // apply angular cuts | |
3150 | if (TMath::Abs(y1-y3)>dymax) continue; | |
3151 | x3 = x3; | |
3152 | z3 = kcl->GetZ(); | |
3153 | if (TMath::Abs(z1-z3)>dzmax) continue; | |
3154 | // | |
3155 | Double_t angley = (y1-y3)/(x1-x3); | |
3156 | Double_t anglez = (z1-z3)/(x1-x3); | |
3157 | // | |
3158 | Double_t erry = TMath::Abs(angley)*(x1-x1m)*0.5+0.5; | |
3159 | Double_t errz = TMath::Abs(anglez)*(x1-x1m)*0.5+0.5; | |
3160 | // | |
3161 | Double_t yyym = angley*(xm-x1)+y1; | |
3162 | Double_t zzzm = anglez*(xm-x1)+z1; | |
3163 | ||
3164 | const AliTPCclusterMI *kcm = krm.FindNearest2(yyym,zzzm,erry,errz,index); | |
3165 | if (!kcm) continue; | |
3166 | if (kcm->IsUsed(10)) continue; | |
3167 | ||
3168 | erry = TMath::Abs(angley)*(x1-x1m)*0.4+0.5; | |
3169 | errz = TMath::Abs(anglez)*(x1-x1m)*0.4+0.5; | |
3170 | // | |
3171 | // | |
3172 | // | |
3173 | Int_t used =0; | |
3174 | Int_t found =0; | |
3175 | // | |
3176 | // look around first | |
3177 | const AliTPCclusterMI *kc1m = kr1m.FindNearest2(angley*(x1m-x1)+y1, | |
3178 | anglez*(x1m-x1)+z1, | |
3179 | erry,errz,index); | |
3180 | // | |
3181 | if (kc1m){ | |
3182 | found++; | |
3183 | if (kc1m->IsUsed(10)) used++; | |
1627d1c4 | 3184 | } |
91162307 | 3185 | const AliTPCclusterMI *kc1p = kr1p.FindNearest2(angley*(x1p-x1)+y1, |
3186 | anglez*(x1p-x1)+z1, | |
3187 | erry,errz,index); | |
1627d1c4 | 3188 | // |
91162307 | 3189 | if (kc1p){ |
3190 | found++; | |
3191 | if (kc1p->IsUsed(10)) used++; | |
1627d1c4 | 3192 | } |
91162307 | 3193 | if (used>1) continue; |
3194 | if (found<1) continue; | |
1627d1c4 | 3195 | |
91162307 | 3196 | // |
3197 | // look around last | |
3198 | const AliTPCclusterMI *kc3m = kr3m.FindNearest2(angley*(x3m-x3)+y3, | |
3199 | anglez*(x3m-x3)+z3, | |
3200 | erry,errz,index); | |
3201 | // | |
3202 | if (kc3m){ | |
3203 | found++; | |
3204 | if (kc3m->IsUsed(10)) used++; | |
3205 | } | |
3206 | else | |
3207 | continue; | |
3208 | const AliTPCclusterMI *kc3p = kr3p.FindNearest2(angley*(x3p-x3)+y3, | |
3209 | anglez*(x3p-x3)+z3, | |
3210 | erry,errz,index); | |
3211 | // | |
3212 | if (kc3p){ | |
3213 | found++; | |
3214 | if (kc3p->IsUsed(10)) used++; | |
3215 | } | |
3216 | else | |
3217 | continue; | |
3218 | if (used>1) continue; | |
3219 | if (found<3) continue; | |
3220 | // | |
3221 | Double_t x2,y2,z2; | |
3222 | x2 = xm; | |
3223 | y2 = kcm->GetY(); | |
3224 | z2 = kcm->GetZ(); | |
3225 | // | |
3226 | ||
1627d1c4 | 3227 | x[0]=y1; |
3228 | x[1]=z1; | |
b67e07dc | 3229 | x[4]=F1(x1,y1,x2,y2,x3,y3); |
91162307 | 3230 | //if (TMath::Abs(x[4]) >= cuts[0]) continue; |
3231 | nin0++; | |
3232 | // | |
b67e07dc | 3233 | x[2]=F2(x1,y1,x2,y2,x3,y3); |
91162307 | 3234 | nin1++; |
3235 | // | |
b67e07dc | 3236 | x[3]=F3n(x1,y1,x2,y2,z1,z2,x[4]); |
91162307 | 3237 | //if (TMath::Abs(x[3]) > cuts[3]) continue; |
3238 | nin2++; | |
3239 | // | |
3240 | // | |
3241 | Double_t sy1=0.1, sz1=0.1; | |
3242 | Double_t sy2=0.1, sz2=0.1; | |
3243 | Double_t sy3=0.1, sy=0.1, sz=0.1; | |
1627d1c4 | 3244 | |
b67e07dc | 3245 | Double_t f40=(F1(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy; |
3246 | Double_t f42=(F1(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy; | |
3247 | Double_t f43=(F1(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy; | |
3248 | Double_t f20=(F2(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy; | |
3249 | Double_t f22=(F2(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy; | |
3250 | Double_t f23=(F2(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy; | |
91162307 | 3251 | |
b67e07dc | 3252 | Double_t f30=(F3(x1,y1+sy,x2,y2,z1,z2)-x[3])/sy; |
3253 | Double_t f31=(F3(x1,y1,x2,y2,z1+sz,z2)-x[3])/sz; | |
3254 | Double_t f32=(F3(x1,y1,x2,y2+sy,z1,z2)-x[3])/sy; | |
3255 | Double_t f34=(F3(x1,y1,x2,y2,z1,z2+sz)-x[3])/sz; | |
1627d1c4 | 3256 | |
3257 | c[0]=sy1; | |
91162307 | 3258 | c[1]=0.; c[2]=sz1; |
1627d1c4 | 3259 | c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23; |
3260 | c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22; | |
3261 | c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34; | |
3262 | c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23; | |
3263 | c[13]=f30*sy1*f40+f32*sy2*f42; | |
3264 | c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; | |
3265 | ||
91162307 | 3266 | // if (!BuildSeed(kr1[is],kcl,0,x1,x2,x3,x,c)) continue; |
3267 | ||
3268 | UInt_t index=kr1.GetIndex(is); | |
3269 | AliTPCseed *track=new(seed) AliTPCseed(index, x, c, x1, sec*alpha+shift); | |
3270 | ||
3271 | track->fIsSeeding = kTRUE; | |
3272 | ||
3273 | nin++; | |
3274 | FollowProlongation(*track, i1-7,1); | |
3275 | if (track->GetNumberOfClusters() < track->fNFoundable*0.75 || | |
3276 | track->fNShared>0.6*track->GetNumberOfClusters() || ( track->GetSigmaY2()+ track->GetSigmaZ2())>0.6){ | |
3277 | seed->Reset(); | |
3278 | seed->~AliTPCseed(); | |
3279 | continue; | |
3280 | } | |
3281 | nout1++; | |
3282 | nout2++; | |
3283 | //Int_t rc = 1; | |
3284 | FollowProlongation(*track, i2,1); | |
3285 | track->fBConstrain =0; | |
3286 | track->fLastPoint = i1+fInnerSec->GetNRows(); // first cluster in track position | |
3287 | track->fFirstPoint = track->fLastPoint; | |
3288 | ||
3289 | if (track->GetNumberOfClusters()<(i1-i2)*0.5 || | |
3290 | track->GetNumberOfClusters()<track->fNFoundable*0.7 || | |
3291 | track->fNShared>2. || track->GetChi2()/track->GetNumberOfClusters()>6 || ( track->GetSigmaY2()+ track->GetSigmaZ2())>0.5 ) { | |
3292 | seed->Reset(); | |
3293 | seed->~AliTPCseed(); | |
3294 | continue; | |
3295 | } | |
3296 | ||
3297 | { | |
3298 | FollowProlongation(*track, TMath::Max(i2-10,0),1); | |
3299 | AliTPCseed * track2 = MakeSeed(track,0.2,0.5,0.9); | |
3300 | FollowProlongation(*track2, i2,1); | |
3301 | track2->fBConstrain = kFALSE; | |
3302 | track2->fSeedType = 4; | |
3303 | arr->AddLast(track2); | |
3304 | seed->Reset(); | |
3305 | seed->~AliTPCseed(); | |
3306 | } | |
3307 | ||
3308 | ||
3309 | //arr->AddLast(track); | |
3310 | //seed = new AliTPCseed; | |
3311 | nout3++; | |
3312 | } | |
3313 | } | |
3314 | ||
6bdc18d6 | 3315 | if (fDebug>3){ |
3316 | Info("MakeSeeds5","\nSeeding statiistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2,nout3); | |
91162307 | 3317 | } |
3318 | delete seed; | |
3319 | } | |
3320 | ||
3321 | ||
3322 | //_____________________________________________________________________________ | |
176aff27 | 3323 | void AliTPCtrackerMI::MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t */*cuts[4]*/, |
3324 | Float_t deltay, Bool_t /*bconstrain*/) { | |
91162307 | 3325 | //----------------------------------------------------------------- |
3326 | // This function creates track seeds - without vertex constraint | |
3327 | //----------------------------------------------------------------- | |
3328 | // cuts[0] - fP4 cut - not applied | |
3329 | // cuts[1] - tan(phi) cut | |
3330 | // cuts[2] - zvertex cut - not applied | |
3331 | // cuts[3] - fP3 cut | |
3332 | Int_t nin0=0; | |
3333 | Int_t nin1=0; | |
3334 | Int_t nin2=0; | |
3335 | Int_t nin3=0; | |
3336 | // Int_t nin4=0; | |
3337 | //Int_t nin5=0; | |
3338 | ||
3339 | ||
3340 | ||
3341 | Double_t alpha=fOuterSec->GetAlpha(), shift=fOuterSec->GetAlphaShift(); | |
3342 | // Double_t cs=cos(alpha), sn=sin(alpha); | |
3343 | Int_t row0 = (i1+i2)/2; | |
3344 | Int_t drow = (i1-i2)/2; | |
3345 | const AliTPCRow& kr0=fSectors[sec][row0]; | |
3346 | AliTPCRow * kr=0; | |
3347 | ||
3348 | AliTPCpolyTrack polytrack; | |
3349 | Int_t nclusters=fSectors[sec][row0]; | |
3350 | AliTPCseed * seed = new AliTPCseed; | |
3351 | ||
3352 | Int_t sumused=0; | |
3353 | Int_t cused=0; | |
3354 | Int_t cnused=0; | |
3355 | for (Int_t is=0; is < nclusters; is++) { //LOOP over clusters | |
3356 | Int_t nfound =0; | |
3357 | Int_t nfoundable =0; | |
3358 | for (Int_t iter =1; iter<2; iter++){ //iterations | |
3359 | const AliTPCRow& krm=fSectors[sec][row0-iter]; | |
3360 | const AliTPCRow& krp=fSectors[sec][row0+iter]; | |
3361 | const AliTPCclusterMI * cl= kr0[is]; | |
3362 | ||
3363 | if (cl->IsUsed(10)) { | |
3364 | cused++; | |
3365 | } | |
3366 | else{ | |
3367 | cnused++; | |
3368 | } | |
3369 | Double_t x = kr0.GetX(); | |
3370 | // Initialization of the polytrack | |
3371 | nfound =0; | |
3372 | nfoundable =0; | |
3373 | polytrack.Reset(); | |
3374 | // | |
3375 | Double_t y0= cl->GetY(); | |
3376 | Double_t z0= cl->GetZ(); | |
3377 | Float_t erry = 0; | |
3378 | Float_t errz = 0; | |
3379 | ||
3380 | Double_t ymax = fSectors->GetMaxY(row0)-kr0.fDeadZone-1.5; | |
3381 | if (deltay>0 && TMath::Abs(ymax-TMath::Abs(y0))> deltay ) continue; // seed only at the edge | |
3382 | ||
3383 | erry = (0.5)*cl->GetSigmaY2()/TMath::Sqrt(cl->GetQ())*6; | |
3384 | errz = (0.5)*cl->GetSigmaZ2()/TMath::Sqrt(cl->GetQ())*6; | |
3385 | polytrack.AddPoint(x,y0,z0,erry, errz); | |
3386 | ||
3387 | sumused=0; | |
3388 | if (cl->IsUsed(10)) sumused++; | |
3389 | ||
3390 | ||
3391 | Float_t roady = (5*TMath::Sqrt(cl->GetSigmaY2()+0.2)+1.)*iter; | |
3392 | Float_t roadz = (5*TMath::Sqrt(cl->GetSigmaZ2()+0.2)+1.)*iter; | |
3393 | // | |
3394 | x = krm.GetX(); | |
3395 | AliTPCclusterMI * cl1 = krm.FindNearest(y0,z0,roady,roadz); | |
3396 | if (cl1 && TMath::Abs(ymax-TMath::Abs(y0))) { | |
3397 | erry = (0.5)*cl1->GetSigmaY2()/TMath::Sqrt(cl1->GetQ())*3; | |
3398 | errz = (0.5)*cl1->GetSigmaZ2()/TMath::Sqrt(cl1->GetQ())*3; | |
3399 | if (cl1->IsUsed(10)) sumused++; | |
3400 | polytrack.AddPoint(x,cl1->GetY(),cl1->GetZ(),erry,errz); | |
3401 | } | |
3402 | // | |
3403 | x = krp.GetX(); | |
3404 | AliTPCclusterMI * cl2 = krp.FindNearest(y0,z0,roady,roadz); | |
3405 | if (cl2) { | |
3406 | erry = (0.5)*cl2->GetSigmaY2()/TMath::Sqrt(cl2->GetQ())*3; | |
3407 | errz = (0.5)*cl2->GetSigmaZ2()/TMath::Sqrt(cl2->GetQ())*3; | |
3408 | if (cl2->IsUsed(10)) sumused++; | |
3409 | polytrack.AddPoint(x,cl2->GetY(),cl2->GetZ(),erry,errz); | |
3410 | } | |
3411 | // | |
3412 | if (sumused>0) continue; | |
3413 | nin0++; | |
3414 | polytrack.UpdateParameters(); | |
3415 | // follow polytrack | |
3416 | roadz = 1.2; | |
3417 | roady = 1.2; | |
3418 | // | |
3419 | Double_t yn,zn; | |
3420 | nfoundable = polytrack.GetN(); | |
3421 | nfound = nfoundable; | |
3422 | // | |
3423 | for (Int_t ddrow = iter+1; ddrow<drow;ddrow++){ | |
3424 | Float_t maxdist = 0.8*(1.+3./(ddrow)); | |
3425 | for (Int_t delta = -1;delta<=1;delta+=2){ | |
3426 | Int_t row = row0+ddrow*delta; | |
3427 | kr = &(fSectors[sec][row]); | |
3428 | Double_t xn = kr->GetX(); | |
3429 | Double_t ymax = fSectors->GetMaxY(row)-kr->fDeadZone-1.5; | |
3430 | polytrack.GetFitPoint(xn,yn,zn); | |
3431 | if (TMath::Abs(yn)>ymax) continue; | |
3432 | nfoundable++; | |
3433 | AliTPCclusterMI * cln = kr->FindNearest(yn,zn,roady,roadz); | |
3434 | if (cln) { | |
3435 | Float_t dist = TMath::Sqrt( (yn-cln->GetY())*(yn-cln->GetY())+(zn-cln->GetZ())*(zn-cln->GetZ())); | |
3436 | if (dist<maxdist){ | |
3437 | /* | |
3438 | erry = (dist+0.3)*cln->GetSigmaY2()/TMath::Sqrt(cln->GetQ())*(1.+1./(ddrow)); | |
3439 | errz = (dist+0.3)*cln->GetSigmaZ2()/TMath::Sqrt(cln->GetQ())*(1.+1./(ddrow)); | |
3440 | if (cln->IsUsed(10)) { | |
3441 | // printf("used\n"); | |
3442 | sumused++; | |
3443 | erry*=2; | |
3444 | errz*=2; | |
3445 | } | |
3446 | */ | |
3447 | erry=0.1; | |
3448 | errz=0.1; | |
3449 | polytrack.AddPoint(xn,cln->GetY(),cln->GetZ(),erry, errz); | |
3450 | nfound++; | |
3451 | } | |
3452 | } | |
3453 | } | |
3454 | if ( (sumused>3) || (sumused>0.5*nfound) || (nfound<0.6*nfoundable)) break; | |
3455 | polytrack.UpdateParameters(); | |
3456 | } | |
3457 | } | |
3458 | if ( (sumused>3) || (sumused>0.5*nfound)) { | |
3459 | //printf("sumused %d\n",sumused); | |
3460 | continue; | |
3461 | } | |
3462 | nin1++; | |
3463 | Double_t dy,dz; | |
3464 | polytrack.GetFitDerivation(kr0.GetX(),dy,dz); | |
3465 | AliTPCpolyTrack track2; | |
3466 | ||
3467 | polytrack.Refit(track2,0.5+TMath::Abs(dy)*0.3,0.4+TMath::Abs(dz)*0.3); | |
3468 | if (track2.GetN()<0.5*nfoundable) continue; | |
3469 | nin2++; | |
3470 | ||
3471 | if ((nfound>0.6*nfoundable) &&( nfoundable>0.4*(i1-i2))) { | |
3472 | // | |
3473 | // test seed with and without constrain | |
3474 | for (Int_t constrain=0; constrain<=0;constrain++){ | |
3475 | // add polytrack candidate | |
3476 | ||
3477 | Double_t x[5], c[15]; | |
3478 | Double_t x1,x2,x3,y1,y2,y3,z1,z2,z3; | |
3479 | track2.GetBoundaries(x3,x1); | |
3480 | x2 = (x1+x3)/2.; | |
3481 | track2.GetFitPoint(x1,y1,z1); | |
3482 | track2.GetFitPoint(x2,y2,z2); | |
3483 | track2.GetFitPoint(x3,y3,z3); | |
3484 | // | |
3485 | //is track pointing to the vertex ? | |
3486 | Double_t x0,y0,z0; | |
3487 | x0=0; | |
3488 | polytrack.GetFitPoint(x0,y0,z0); | |
3489 | ||
3490 | if (constrain) { | |
3491 | x2 = x3; | |
3492 | y2 = y3; | |
3493 | z2 = z3; | |
3494 | ||
3495 | x3 = 0; | |
3496 | y3 = 0; | |
3497 | z3 = 0; | |
3498 | } | |
3499 | x[0]=y1; | |
3500 | x[1]=z1; | |
b67e07dc | 3501 | x[4]=F1(x1,y1,x2,y2,x3,y3); |
91162307 | 3502 | |
3503 | // if (TMath::Abs(x[4]) >= cuts[0]) continue; // | |
b67e07dc | 3504 | x[2]=F2(x1,y1,x2,y2,x3,y3); |
91162307 | 3505 | |
3506 | //if (TMath::Abs(x[4]*x1-x[2]) >= cuts[1]) continue; | |
b67e07dc | 3507 | //x[3]=F3(x1,y1,x2,y2,z1,z2); |
3508 | x[3]=F3n(x1,y1,x3,y3,z1,z3,x[4]); | |
91162307 | 3509 | //if (TMath::Abs(x[3]) > cuts[3]) continue; |
3510 | ||
3511 | ||
3512 | Double_t sy =0.1, sz =0.1; | |
3513 | Double_t sy1=0.02, sz1=0.02; | |
3514 | Double_t sy2=0.02, sz2=0.02; | |
3515 | Double_t sy3=0.02; | |
3516 | ||
3517 | if (constrain){ | |
3518 | sy3=25000*x[4]*x[4]+0.1, sy=0.1, sz=0.1; | |
3519 | } | |
3520 | ||
b67e07dc | 3521 | Double_t f40=(F1(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy; |
3522 | Double_t f42=(F1(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy; | |
3523 | Double_t f43=(F1(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy; | |
3524 | Double_t f20=(F2(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy; | |
3525 | Double_t f22=(F2(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy; | |
3526 | Double_t f23=(F2(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy; | |
3527 | ||
3528 | Double_t f30=(F3(x1,y1+sy,x3,y3,z1,z3)-x[3])/sy; | |
3529 | Double_t f31=(F3(x1,y1,x3,y3,z1+sz,z3)-x[3])/sz; | |
3530 | Double_t f32=(F3(x1,y1,x3,y3+sy,z1,z3)-x[3])/sy; | |
3531 | Double_t f34=(F3(x1,y1,x3,y3,z1,z3+sz)-x[3])/sz; | |
91162307 | 3532 | |
3533 | ||
3534 | c[0]=sy1; | |
3535 | c[1]=0.; c[2]=sz1; | |
3536 | c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23; | |
3537 | c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22; | |
3538 | c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34; | |
3539 | c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23; | |
3540 | c[13]=f30*sy1*f40+f32*sy2*f42; | |
3541 | c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; | |
3542 | ||
3543 | //Int_t row1 = fSectors->GetRowNumber(x1); | |
3544 | Int_t row1 = GetRowNumber(x1); | |
3545 | ||
3546 | UInt_t index=0; | |
3547 | //kr0.GetIndex(is); | |
3548 | AliTPCseed *track=new (seed) AliTPCseed(index, x, c, x1, sec*alpha+shift); | |
3549 | track->fIsSeeding = kTRUE; | |
3550 | Int_t rc=FollowProlongation(*track, i2); | |
3551 | if (constrain) track->fBConstrain =1; | |
3552 | else | |
3553 | track->fBConstrain =0; | |
3554 | track->fLastPoint = row1+fInnerSec->GetNRows(); // first cluster in track position | |
3555 | track->fFirstPoint = track->fLastPoint; | |
3556 | ||
3557 | if (rc==0 || track->GetNumberOfClusters()<(i1-i2)*0.5 || | |
3558 | track->GetNumberOfClusters() < track->fNFoundable*0.6 || | |
3559 | track->fNShared>0.4*track->GetNumberOfClusters()) { | |
3560 | //delete track; | |
3561 | seed->Reset(); | |
3562 | seed->~AliTPCseed(); | |
3563 | } | |
3564 | else { | |
3565 | arr->AddLast(track); | |
3566 | seed = new AliTPCseed; | |
3567 | } | |
3568 | nin3++; | |
3569 | } | |
3570 | } // if accepted seed | |
3571 | } | |
6bdc18d6 | 3572 | if (fDebug>3){ |
3573 | Info("MakeSeeds2","\nSeeding statiistic:\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin3); | |
91162307 | 3574 | } |
3575 | delete seed; | |
3576 | } | |
3577 | ||
3578 | ||
3579 | AliTPCseed *AliTPCtrackerMI::MakeSeed(AliTPCseed *track, Float_t r0, Float_t r1, Float_t r2) | |
3580 | { | |
3581 | // | |
3582 | // | |
d26d9159 | 3583 | //reseed using track points |
91162307 | 3584 | Int_t p0 = int(r0*track->GetNumberOfClusters()); // point 0 |
3585 | Int_t p1 = int(r1*track->GetNumberOfClusters()); | |
3586 | Int_t p2 = int(r2*track->GetNumberOfClusters()); // last point | |
176aff27 | 3587 | Int_t pp2=0; |
91162307 | 3588 | Double_t x0[3],x1[3],x2[3]; |
89e09524 | 3589 | for (Int_t i=0;i<3;i++){ |
3590 | x0[i]=-1; | |
3591 | x1[i]=-1; | |
3592 | x2[i]=-1; | |
3593 | } | |
91162307 | 3594 | |
3595 | // find track position at given ratio of the length | |
89e09524 | 3596 | Int_t sec0=0, sec1=0, sec2=0; |
91162307 | 3597 | Int_t index=-1; |
3598 | Int_t clindex; | |
3599 | for (Int_t i=0;i<160;i++){ | |
3600 | if (track->fClusterPointer[i]){ | |
3601 | index++; | |
3602 | AliTPCTrackerPoint *trpoint =track->GetTrackPoint(i); | |
3603 | if ( (index<p0) || x0[0]<0 ){ | |
3604 | if (trpoint->GetX()>1){ | |
3605 | clindex = track->GetClusterIndex2(i); | |
3606 | if (clindex>0){ | |
3607 | x0[0] = trpoint->GetX(); | |
3608 | x0[1] = trpoint->GetY(); | |
3609 | x0[2] = trpoint->GetZ(); | |
3610 | sec0 = ((clindex&0xff000000)>>24)%18; | |
3611 | } | |
3612 | } | |
3613 | } | |
3614 | ||
3615 | if ( (index<p1) &&(trpoint->GetX()>1)){ | |
3616 | clindex = track->GetClusterIndex2(i); | |
3617 | if (clindex>0){ | |
3618 | x1[0] = trpoint->GetX(); | |
3619 | x1[1] = trpoint->GetY(); | |
3620 | x1[2] = trpoint->GetZ(); | |
3621 | sec1 = ((clindex&0xff000000)>>24)%18; | |
3622 | } | |
3623 | } | |
3624 | if ( (index<p2) &&(trpoint->GetX()>1)){ | |
3625 | clindex = track->GetClusterIndex2(i); | |
3626 | if (clindex>0){ | |
3627 | x2[0] = trpoint->GetX(); | |
3628 | x2[1] = trpoint->GetY(); | |
3629 | x2[2] = trpoint->GetZ(); | |
3630 | sec2 = ((clindex&0xff000000)>>24)%18; | |
3631 | pp2 = i; | |
3632 | } | |
3633 | } | |
3634 | } | |
3635 | } | |
3636 | ||
3637 | Double_t alpha, cs,sn, xx2,yy2; | |
3638 | // | |
3639 | alpha = (sec1-sec2)*fSectors->GetAlpha(); | |
3640 | cs = TMath::Cos(alpha); | |
3641 | sn = TMath::Sin(alpha); | |
3642 | xx2= x1[0]*cs-x1[1]*sn; | |
3643 | yy2= x1[0]*sn+x1[1]*cs; | |
3644 | x1[0] = xx2; | |
3645 | x1[1] = yy2; | |
3646 | // | |
3647 | alpha = (sec0-sec2)*fSectors->GetAlpha(); | |
3648 | cs = TMath::Cos(alpha); | |
3649 | sn = TMath::Sin(alpha); | |
3650 | xx2= x0[0]*cs-x0[1]*sn; | |
3651 | yy2= x0[0]*sn+x0[1]*cs; | |
3652 | x0[0] = xx2; | |
3653 | x0[1] = yy2; | |
3654 | // | |
3655 | // | |
3656 | // | |
3657 | Double_t x[5],c[15]; | |
3658 | // | |
3659 | x[0]=x2[1]; | |
3660 | x[1]=x2[2]; | |
b67e07dc | 3661 | x[4]=F1(x2[0],x2[1],x1[0],x1[1],x0[0],x0[1]); |
91162307 | 3662 | // if (x[4]>1) return 0; |
b67e07dc | 3663 | x[2]=F2(x2[0],x2[1],x1[0],x1[1],x0[0],x0[1]); |
3664 | x[3]=F3n(x2[0],x2[1],x0[0],x0[1],x2[2],x0[2],x[4]); | |
91162307 | 3665 | //if (TMath::Abs(x[3]) > 2.2) return 0; |
3666 | //if (TMath::Abs(x[2]) > 1.99) return 0; | |
3667 | // | |
3668 | Double_t sy =0.1, sz =0.1; | |
3669 | // | |
3670 | Double_t sy1=0.02+track->GetSigmaY2(), sz1=0.02+track->GetSigmaZ2(); | |
3671 | Double_t sy2=0.01+track->GetSigmaY2(), sz2=0.01+track->GetSigmaZ2(); | |
3672 | Double_t sy3=0.01+track->GetSigmaY2(); | |
3673 | // | |
b67e07dc | 3674 | Double_t f40=(F1(x2[0],x2[1]+sy,x1[0],x1[1],x0[0],x0[1])-x[4])/sy; |
3675 | Double_t f42=(F1(x2[0],x2[1],x1[0],x1[1]+sy,x0[0],x0[1])-x[4])/sy; | |
3676 | Double_t f43=(F1(x2[0],x2[1],x1[0],x1[1],x0[0],x0[1]+sy)-x[4])/sy; | |
3677 | Double_t f20=(F2(x2[0],x2[1]+sy,x1[0],x1[1],x0[0],x0[1])-x[2])/sy; | |
3678 | Double_t f22=(F2(x2[0],x2[1],x1[0],x1[1]+sy,x0[0],x0[1])-x[2])/sy; | |
3679 | Double_t f23=(F2(x2[0],x2[1],x1[0],x1[1],x0[0],x0[1]+sy)-x[2])/sy; | |
3680 | // | |
3681 | Double_t f30=(F3(x2[0],x2[1]+sy,x0[0],x0[1],x2[2],x0[2])-x[3])/sy; | |
3682 | Double_t f31=(F3(x2[0],x2[1],x0[0],x0[1],x2[2]+sz,x0[2])-x[3])/sz; | |
3683 | Double_t f32=(F3(x2[0],x2[1],x0[0],x0[1]+sy,x2[2],x0[2])-x[3])/sy; | |
3684 | Double_t f34=(F3(x2[0],x2[1],x0[0],x0[1],x2[2],x0[2]+sz)-x[3])/sz; | |
91162307 | 3685 | |
3686 | ||
3687 | c[0]=sy1; | |
3688 | c[1]=0.; c[2]=sz1; | |
3689 | c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23; | |
3690 | c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22; | |
3691 | c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34; | |
3692 | c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23; | |
3693 | c[13]=f30*sy1*f40+f32*sy2*f42; | |
3694 | c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; | |
3695 | ||
3696 | // Int_t row1 = fSectors->GetRowNumber(x2[0]); | |
3697 | AliTPCseed *seed=new AliTPCseed(0, x, c, x2[0], sec2*fSectors->GetAlpha()+fSectors->GetAlphaShift()); | |
3698 | // Double_t y0,z0,y1,z1, y2,z2; | |
3699 | //seed->GetProlongation(x0[0],y0,z0); | |
3700 | // seed->GetProlongation(x1[0],y1,z1); | |
3701 | //seed->GetProlongation(x2[0],y2,z2); | |
3702 | // seed =0; | |
3703 | seed->fLastPoint = pp2; | |
3704 | seed->fFirstPoint = pp2; | |
3705 | ||
3706 | ||
3707 | return seed; | |
3708 | } | |
3709 | ||
d26d9159 | 3710 | |
3711 | AliTPCseed *AliTPCtrackerMI::ReSeed(AliTPCseed *track, Float_t r0, Float_t r1, Float_t r2) | |
3712 | { | |
3713 | // | |
3714 | // | |
3715 | //reseed using founded clusters | |
3716 | // | |
3717 | // Find the number of clusters | |
3718 | Int_t nclusters = 0; | |
3719 | for (Int_t irow=0;irow<160;irow++){ | |
3720 | if (track->GetClusterIndex(irow)>0) nclusters++; | |
3721 | } | |
3722 | // | |
3723 | Int_t ipos[3]; | |
3724 | ipos[0] = TMath::Max(int(r0*nclusters),0); // point 0 cluster | |
3725 | ipos[1] = TMath::Min(int(r1*nclusters),nclusters-1); // | |
3726 | ipos[2] = TMath::Min(int(r2*nclusters),nclusters-1); // last point | |
3727 | // | |
3728 | // | |
3729 | Double_t xyz[3][3]; | |
3730 | Int_t row[3],sec[3]={0,0,0}; | |
3731 | // | |
3732 | // find track row position at given ratio of the length | |
3733 | Int_t index=-1; | |
3734 | for (Int_t irow=0;irow<160;irow++){ | |
3735 | if (track->GetClusterIndex2(irow)<0) continue; | |
3736 | index++; | |
3737 | for (Int_t ipoint=0;ipoint<3;ipoint++){ | |
3738 | if (index<=ipos[ipoint]) row[ipoint] = irow; | |
3739 | } | |
3740 | } | |
3741 | // | |
3742 | //Get cluster and sector position | |
3743 | for (Int_t ipoint=0;ipoint<3;ipoint++){ | |
3744 | Int_t clindex = track->GetClusterIndex2(row[ipoint]); | |
3745 | AliTPCclusterMI * cl = GetClusterMI(clindex); | |
3746 | if (cl==0) { | |
6bdc18d6 | 3747 | //Error("Bug\n"); |
47966a6d | 3748 | // AliTPCclusterMI * cl = GetClusterMI(clindex); |
d26d9159 | 3749 | return 0; |
3750 | } | |
3751 | sec[ipoint] = ((clindex&0xff000000)>>24)%18; | |
3752 | xyz[ipoint][0] = GetXrow(row[ipoint]); | |
3753 | xyz[ipoint][1] = cl->GetY(); | |
3754 | xyz[ipoint][2] = cl->GetZ(); | |
3755 | } | |
3756 | // | |
3757 | // | |
3758 | // Calculate seed state vector and covariance matrix | |
3759 | ||
3760 | Double_t alpha, cs,sn, xx2,yy2; | |
3761 | // | |
3762 | alpha = (sec[1]-sec[2])*fSectors->GetAlpha(); | |
3763 | cs = TMath::Cos(alpha); | |
3764 | sn = TMath::Sin(alpha); | |
3765 | xx2= xyz[1][0]*cs-xyz[1][1]*sn; | |
3766 | yy2= xyz[1][0]*sn+xyz[1][1]*cs; | |
3767 | xyz[1][0] = xx2; | |
3768 | xyz[1][1] = yy2; | |
3769 | // | |
3770 | alpha = (sec[0]-sec[2])*fSectors->GetAlpha(); | |
3771 | cs = TMath::Cos(alpha); | |
3772 | sn = TMath::Sin(alpha); | |
3773 | xx2= xyz[0][0]*cs-xyz[0][1]*sn; | |
3774 | yy2= xyz[0][0]*sn+xyz[0][1]*cs; | |
3775 | xyz[0][0] = xx2; | |
3776 | xyz[0][1] = yy2; | |
3777 | // | |
3778 | // | |
3779 | // | |
3780 | Double_t x[5],c[15]; | |
3781 | // | |
3782 | x[0]=xyz[2][1]; | |
3783 | x[1]=xyz[2][2]; | |
3784 | x[4]=F1(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1]); | |
3785 | x[2]=F2(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1]); | |
3786 | x[3]=F3n(xyz[2][0],xyz[2][1],xyz[0][0],xyz[0][1],xyz[2][2],xyz[0][2],x[4]); | |
3787 | // | |
3788 | Double_t sy =0.1, sz =0.1; | |
3789 | // | |
3790 | Double_t sy1=0.2, sz1=0.2; | |
3791 | Double_t sy2=0.2, sz2=0.2; | |
3792 | Double_t sy3=0.2; | |
3793 | // | |
3794 | Double_t f40=(F1(xyz[2][0],xyz[2][1]+sy,xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1])-x[4])/sy; | |
3795 | Double_t f42=(F1(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1]+sy,xyz[0][0],xyz[0][1])-x[4])/sy; | |
3796 | Double_t f43=(F1(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1]+sy)-x[4])/sy; | |
3797 | Double_t f20=(F2(xyz[2][0],xyz[2][1]+sy,xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1])-x[2])/sy; | |
3798 | Double_t f22=(F2(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1]+sy,xyz[0][0],xyz[0][1])-x[2])/sy; | |
3799 | Double_t f23=(F2(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1]+sy)-x[2])/sy; | |
3800 | // | |
3801 | Double_t f30=(F3(xyz[2][0],xyz[2][1]+sy,xyz[0][0],xyz[0][1],xyz[2][2],xyz[0][2])-x[3])/sy; | |
3802 | Double_t f31=(F3(xyz[2][0],xyz[2][1],xyz[0][0],xyz[0][1],xyz[2][2]+sz,xyz[0][2])-x[3])/sz; | |
3803 | Double_t f32=(F3(xyz[2][0],xyz[2][1],xyz[0][0],xyz[0][1]+sy,xyz[2][2],xyz[0][2])-x[3])/sy; | |
3804 | Double_t f34=(F3(xyz[2][0],xyz[2][1],xyz[0][0],xyz[0][1],xyz[2][2],xyz[0][2]+sz)-x[3])/sz; | |
3805 | ||
3806 | ||
3807 | c[0]=sy1; | |
3808 | c[1]=0.; c[2]=sz1; | |
3809 | c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23; | |
3810 | c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22; | |
3811 | c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34; | |
3812 | c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23; | |
3813 | c[13]=f30*sy1*f40+f32*sy2*f42; | |
3814 | c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; | |
3815 | ||
3816 | // Int_t row1 = fSectors->GetRowNumber(xyz[2][0]); | |
3817 | AliTPCseed *seed=new AliTPCseed(0, x, c, xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift()); | |
3818 | seed->fLastPoint = row[2]; | |
3819 | seed->fFirstPoint = row[2]; | |
3820 | return seed; | |
3821 | } | |
3822 | ||
eea478d3 | 3823 | |
3824 | AliTPCseed *AliTPCtrackerMI::ReSeed(AliTPCseed *track,Int_t r0, Bool_t forward) | |
3825 | { | |
3826 | // | |
3827 | // | |
3828 | //reseed using founded clusters | |
3829 | // | |
3830 | Double_t xyz[3][3]; | |
4a12af72 | 3831 | Int_t row[3]={0,0,0}; |
3832 | Int_t sec[3]={0,0,0}; | |
eea478d3 | 3833 | // |
3834 | // forward direction | |
3835 | if (forward){ | |
3836 | for (Int_t irow=r0;irow<160;irow++){ | |
3837 | if (track->GetClusterIndex(irow)>0){ | |
3838 | row[0] = irow; | |
3839 | break; | |
3840 | } | |
3841 | } | |
3842 | for (Int_t irow=160;irow>r0;irow--){ | |
3843 | if (track->GetClusterIndex(irow)>0){ | |
3844 | row[2] = irow; | |
3845 | break; | |
3846 | } | |
3847 | } | |
3848 | for (Int_t irow=row[2]-15;irow>row[0];irow--){ | |
3849 | if (track->GetClusterIndex(irow)>0){ | |
3850 | row[1] = irow; | |
3851 | break; | |
3852 | } | |
3853 | } | |
3854 | // | |
3855 | } | |
3856 | if (!forward){ | |
3857 | for (Int_t irow=0;irow<r0;irow++){ | |
3858 | if (track->GetClusterIndex(irow)>0){ | |
3859 | row[0] = irow; | |
3860 | break; | |
3861 | } | |
3862 | } | |
3863 | for (Int_t irow=r0;irow>0;irow--){ | |
3864 | if (track->GetClusterIndex(irow)>0){ | |
3865 | row[2] = irow; | |
3866 | break; | |
3867 | } | |
3868 | } | |
3869 | for (Int_t irow=row[2]-15;irow>row[0];irow--){ | |
3870 | if (track->GetClusterIndex(irow)>0){ | |
3871 | row[1] = irow; | |
3872 | break; | |
3873 | } | |
3874 | } | |
3875 | } | |
3876 | // | |
3877 | if ((row[2]-row[0])<20) return 0; | |
3878 | if (row[1]==0) return 0; | |
3879 | // | |
3880 | // | |
3881 | //Get cluster and sector position | |
3882 | for (Int_t ipoint=0;ipoint<3;ipoint++){ | |
3883 | Int_t clindex = track->GetClusterIndex2(row[ipoint]); | |
3884 | AliTPCclusterMI * cl = GetClusterMI(clindex); | |
3885 | if (cl==0) { | |
3886 | //Error("Bug\n"); | |
3887 | // AliTPCclusterMI * cl = GetClusterMI(clindex); | |
3888 | return 0; | |
3889 | } | |
3890 | sec[ipoint] = ((clindex&0xff000000)>>24)%18; | |
3891 | xyz[ipoint][0] = GetXrow(row[ipoint]); | |
3892 | AliTPCTrackerPoint * point = track->GetTrackPoint(row[ipoint]); | |
3893 | if (point&&ipoint<2){ | |
3894 | // | |
3895 | xyz[ipoint][1] = point->GetY(); | |
3896 | xyz[ipoint][2] = point->GetZ(); | |
3897 | } | |
3898 | else{ | |
3899 | xyz[ipoint][1] = cl->GetY(); | |
3900 | xyz[ipoint][2] = cl->GetZ(); | |
3901 | } | |
3902 | } | |
3903 | // | |
3904 | // | |
3905 | // | |
3906 | // | |
3907 | // Calculate seed state vector and covariance matrix | |
3908 | ||
3909 | Double_t alpha, cs,sn, xx2,yy2; | |
3910 | // | |
3911 | alpha = (sec[1]-sec[2])*fSectors->GetAlpha(); | |
3912 | cs = TMath::Cos(alpha); | |
3913 | sn = TMath::Sin(alpha); | |
3914 | xx2= xyz[1][0]*cs-xyz[1][1]*sn; | |
3915 | yy2= xyz[1][0]*sn+xyz[1][1]*cs; | |
3916 | xyz[1][0] = xx2; | |
3917 | xyz[1][1] = yy2; | |
3918 | // | |
3919 | alpha = (sec[0]-sec[2])*fSectors->GetAlpha(); | |
3920 | cs = TMath::Cos(alpha); | |
3921 | sn = TMath::Sin(alpha); | |
3922 | xx2= xyz[0][0]*cs-xyz[0][1]*sn; | |
3923 | yy2= xyz[0][0]*sn+xyz[0][1]*cs; | |
3924 | xyz[0][0] = xx2; | |
3925 | xyz[0][1] = yy2; | |
3926 | // | |
3927 | // | |
3928 | // | |
3929 | Double_t x[5],c[15]; | |
3930 | // | |
3931 | x[0]=xyz[2][1]; | |
3932 | x[1]=xyz[2][2]; | |
3933 | x[4]=F1(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1]); | |
3934 | x[2]=F2(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1]); | |
3935 | x[3]=F3n(xyz[2][0],xyz[2][1],xyz[0][0],xyz[0][1],xyz[2][2],xyz[0][2],x[4]); | |
3936 | // | |
3937 | Double_t sy =0.1, sz =0.1; | |
3938 | // | |
3939 | Double_t sy1=0.2, sz1=0.2; | |
3940 | Double_t sy2=0.2, sz2=0.2; | |
3941 | Double_t sy3=0.2; | |
3942 | // | |
3943 | Double_t f40=(F1(xyz[2][0],xyz[2][1]+sy,xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1])-x[4])/sy; | |
3944 | Double_t f42=(F1(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1]+sy,xyz[0][0],xyz[0][1])-x[4])/sy; | |
3945 | Double_t f43=(F1(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1]+sy)-x[4])/sy; | |
3946 | Double_t f20=(F2(xyz[2][0],xyz[2][1]+sy,xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1])-x[2])/sy; | |
3947 | Double_t f22=(F2(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1]+sy,xyz[0][0],xyz[0][1])-x[2])/sy; | |
3948 | Double_t f23=(F2(xyz[2][0],xyz[2][1],xyz[1][0],xyz[1][1],xyz[0][0],xyz[0][1]+sy)-x[2])/sy; | |
3949 | // | |
3950 | Double_t f30=(F3(xyz[2][0],xyz[2][1]+sy,xyz[0][0],xyz[0][1],xyz[2][2],xyz[0][2])-x[3])/sy; | |
3951 | Double_t f31=(F3(xyz[2][0],xyz[2][1],xyz[0][0],xyz[0][1],xyz[2][2]+sz,xyz[0][2])-x[3])/sz; | |
3952 | Double_t f32=(F3(xyz[2][0],xyz[2][1],xyz[0][0],xyz[0][1]+sy,xyz[2][2],xyz[0][2])-x[3])/sy; | |
3953 | Double_t f34=(F3(xyz[2][0],xyz[2][1],xyz[0][0],xyz[0][1],xyz[2][2],xyz[0][2]+sz)-x[3])/sz; | |
3954 | ||
3955 | ||
3956 | c[0]=sy1; | |
3957 | c[1]=0.; c[2]=sz1; | |
3958 | c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23; | |
3959 | c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22; | |
3960 | c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34; | |
3961 | c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23; | |
3962 | c[13]=f30*sy1*f40+f32*sy2*f42; | |
3963 | c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; | |
3964 | ||
3965 | // Int_t row1 = fSectors->GetRowNumber(xyz[2][0]); | |
3966 | AliTPCseed *seed=new AliTPCseed(0, x, c, xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift()); | |
3967 | seed->fLastPoint = row[2]; | |
3968 | seed->fFirstPoint = row[2]; | |
3969 | for (Int_t i=row[0];i<row[2];i++){ | |
3970 | seed->fIndex[i] = track->fIndex[i]; | |
3971 | } | |
3972 | ||
3973 | return seed; | |
3974 | } | |
3975 | ||
51ad6848 | 3976 | void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESD *esd) |
3977 | { | |
3978 | // | |
3979 | // find kinks | |
3980 | // | |
3981 | // | |
eea478d3 | 3982 | |
51ad6848 | 3983 | TObjArray *kinks= new TObjArray(10000); |
81e97e0d | 3984 | // TObjArray *v0s= new TObjArray(10000); |
51ad6848 | 3985 | Int_t nentries = array->GetEntriesFast(); |
3986 | AliHelix *helixes = new AliHelix[nentries]; | |
3987 | Int_t *sign = new Int_t[nentries]; | |
3988 | Int_t *nclusters = new Int_t[nentries]; | |
3989 | Float_t *alpha = new Float_t[nentries]; | |
3990 | AliESDkink * kink = new AliESDkink(); | |
3991 | Int_t * usage = new Int_t[nentries]; | |
eea478d3 | 3992 | Float_t *zm = new Float_t[nentries]; |
3993 | Float_t *z0 = new Float_t[nentries]; | |
3994 | Float_t *fim = new Float_t[nentries]; | |
3995 | Float_t *shared = new Float_t[nentries]; | |
3996 | Bool_t *circular = new Bool_t[nentries]; | |
81e97e0d | 3997 | Float_t *dca = new Float_t[nentries]; |
3998 | //const AliESDVertex * primvertex = esd->GetVertex(); | |
eea478d3 | 3999 | // |
4000 | // nentries = array->GetEntriesFast(); | |
4001 | // | |
4002 | ||
51ad6848 | 4003 | // |
4004 | // | |
4005 | for (Int_t i=0;i<nentries;i++){ | |
4006 | sign[i]=0; | |
4007 | usage[i]=0; | |
4008 | AliTPCseed* track = (AliTPCseed*)array->At(i); | |
4009 | if (!track) continue; | |
81e97e0d | 4010 | track->fCircular =0; |
eea478d3 | 4011 | shared[i] = kFALSE; |
51ad6848 | 4012 | track->UpdatePoints(); |
4013 | if (( track->GetPoints()[2]- track->GetPoints()[0])>5 && track->GetPoints()[3]>0.8){ | |
51ad6848 | 4014 | } |
eea478d3 | 4015 | nclusters[i]=track->GetNumberOfClusters(); |
4016 | alpha[i] = track->GetAlpha(); | |
4017 | new (&helixes[i]) AliHelix(*track); | |
4018 | Double_t xyz[3]; | |
4019 | helixes[i].Evaluate(0,xyz); | |
4020 | sign[i] = (track->GetC()>0) ? -1:1; | |
4021 | Double_t x,y,z; | |
4022 | x=160; | |
4023 | if (track->GetProlongation(x,y,z)){ | |
4024 | zm[i] = z; | |
4025 | fim[i] = alpha[i]+TMath::ATan2(y,x); | |
4026 | } | |
4027 | else{ | |
4028 | zm[i] = track->GetZ(); | |
4029 | fim[i] = alpha[i]; | |
4030 | } | |
4031 | z0[i]=1000; | |
4032 | circular[i]= kFALSE; | |
81e97e0d | 4033 | if (track->GetProlongation(0,y,z)) z0[i] = z; |
4034 | dca[i] = track->GetD(0,0); | |
51ad6848 | 4035 | } |
4036 | // | |
4037 | // | |
4038 | TStopwatch timer; | |
4039 | timer.Start(); | |
4040 | Int_t ncandidates =0; | |
4041 | Int_t nall =0; | |
4042 | Int_t ntracks=0; | |
4043 | Double_t phase[2][2],radius[2]; | |
eea478d3 | 4044 | |
4045 | // | |
4046 | // Find circling track | |
81e97e0d | 4047 | TTreeSRedirector &cstream = *fDebugStreamer; |
eea478d3 | 4048 | // |
4049 | for (Int_t i0=0;i0<nentries;i0++){ | |
4050 | AliTPCseed * track0 = (AliTPCseed*)array->At(i0); | |
4051 | if (!track0) continue; | |
4052 | if (track0->fN<40) continue; | |
4053 | if (TMath::Abs(1./track0->fP4)>200) continue; | |
4054 | for (Int_t i1=i0+1;i1<nentries;i1++){ | |
4055 | AliTPCseed * track1 = (AliTPCseed*)array->At(i1); | |
4056 | if (!track1) continue; | |
81e97e0d | 4057 | if (track1->fN<40) continue; |
4058 | if ( TMath::Abs(track1->fP3+track0->fP3)>0.1) continue; | |
eea478d3 | 4059 | if (track0->fBConstrain&&track1->fBConstrain) continue; |
81e97e0d | 4060 | if (TMath::Abs(1./track1->fP4)>200) continue; |
4061 | if (track1->fP4*track0->fP4>0) continue; | |
4062 | if (track1->fP3*track0->fP3>0) continue; | |
eea478d3 | 4063 | if (max(TMath::Abs(1./track0->fP4),TMath::Abs(1./track1->fP4))>190) continue; |
4064 | if (track0->fBConstrain&&TMath::Abs(track1->fP4)<TMath::Abs(track0->fP4)) continue; //returning - lower momenta | |
4065 | if (track1->fBConstrain&&TMath::Abs(track0->fP4)<TMath::Abs(track1->fP4)) continue; //returning - lower momenta | |
4066 | // | |
81e97e0d | 4067 | Float_t mindcar = TMath::Min(TMath::Abs(dca[i0]),TMath::Abs(dca[i1])); |
4068 | if (mindcar<5) continue; | |
4069 | Float_t mindcaz = TMath::Min(TMath::Abs(z0[i0]-GetZ()),TMath::Abs(z0[i1]-GetZ())); | |
4070 | if (mindcaz<5) continue; | |
4071 | if (mindcar+mindcaz<20) continue; | |
4072 | // | |
4073 | // | |
eea478d3 | 4074 | Float_t xc0 = helixes[i0].GetHelix(6); |
4075 | Float_t yc0 = helixes[i0].GetHelix(7); | |
4076 | Float_t r0 = helixes[i0].GetHelix(8); | |
4077 | Float_t xc1 = helixes[i1].GetHelix(6); | |
4078 | Float_t yc1 = helixes[i1].GetHelix(7); | |
4079 | Float_t r1 = helixes[i1].GetHelix(8); | |
4080 | ||
4081 | Float_t rmean = (r0+r1)*0.5; | |
4082 | Float_t delta =TMath::Sqrt((xc1-xc0)*(xc1-xc0)+(yc1-yc0)*(yc1-yc0)); | |
81e97e0d | 4083 | //if (delta>30) continue; |
eea478d3 | 4084 | if (delta>rmean*0.25) continue; |
4085 | if (TMath::Abs(r0-r1)/rmean>0.3) continue; | |
4086 | // | |
4087 | Int_t npoints = helixes[i0].GetRPHIintersections(helixes[i1], phase, radius,10); | |
4088 | if (npoints==0) continue; | |
4089 | helixes[i0].GetClosestPhases(helixes[i1], phase); | |
4090 | // | |
4091 | Double_t xyz0[3]; | |
4092 | Double_t xyz1[3]; | |
4093 | Double_t hangles[3]; | |
4094 | helixes[i0].Evaluate(phase[0][0],xyz0); | |
4095 | helixes[i1].Evaluate(phase[0][1],xyz1); | |
4096 | ||
4097 | helixes[i0].GetAngle(phase[0][0],helixes[i1],phase[0][1],hangles); | |
4098 | Double_t deltah[2],deltabest; | |
4099 | if (hangles[2]<2.8) continue; | |
4100 | /* | |
4101 | cstream<<"C"<<track0->fLab<<track1->fLab<< | |
4102 | track0->fP3<<track1->fP3<< | |
4103 | track0->fP4<<track1->fP4<< | |
4104 | delta<<rmean<<npoints<< | |
4105 | hangles[0]<<hangles[2]<< | |
4106 | xyz0[2]<<xyz1[2]<<radius[0]<<"\n"; | |
4107 | */ | |
4108 | if (npoints>0){ | |
4109 | Int_t ibest=0; | |
81e97e0d | 4110 | helixes[i0].ParabolicDCA(helixes[i1],phase[0][0],phase[0][1],radius[0],deltah[0],2); |
eea478d3 | 4111 | if (npoints==2){ |
81e97e0d | 4112 | helixes[i0].ParabolicDCA(helixes[i1],phase[1][0],phase[1][1],radius[1],deltah[1],2); |
eea478d3 | 4113 | if (deltah[1]<deltah[0]) ibest=1; |
4114 | } | |
4115 | deltabest = TMath::Sqrt(deltah[ibest]); | |
4116 | helixes[i0].Evaluate(phase[ibest][0],xyz0); | |
4117 | helixes[i1].Evaluate(phase[ibest][1],xyz1); | |
4118 | helixes[i0].GetAngle(phase[ibest][0],helixes[i1],phase[ibest][1],hangles); | |
81e97e0d | 4119 | Double_t radiusbest = TMath::Sqrt(radius[ibest]); |
eea478d3 | 4120 | // |
81e97e0d | 4121 | if (deltabest>6) continue; |
4122 | if (mindcar+mindcaz<40 && (hangles[2]<3.12||deltabest>3)) continue; | |
eea478d3 | 4123 | Bool_t sign =kFALSE; |
81e97e0d | 4124 | if (hangles[2]>3.06) sign =kTRUE; |
4125 | // | |
eea478d3 | 4126 | if (sign){ |
4127 | circular[i0] = kTRUE; | |
81e97e0d | 4128 | circular[i1] = kTRUE; |
4129 | if (TMath::Abs(track0->fP4)<TMath::Abs(track1->fP4)){ | |
4130 | track0->fCircular += 1; | |
4131 | track1->fCircular += 2; | |
4132 | } | |
4133 | else{ | |
4134 | track1->fCircular += 1; | |
4135 | track0->fCircular += 2; | |
4136 | } | |
4137 | } | |
af32720d | 4138 | if (sign&&0){ |
81e97e0d | 4139 | //debug stream |
4140 | cstream<<"Curling"<< | |
4141 | "lab0="<<track0->fLab<< | |
4142 | "lab1="<<track1->fLab<< | |
4143 | "Tr0.="<<track0<< | |
4144 | "Tr1.="<<track1<< | |
4145 | "dca0="<<dca[i0]<< | |
4146 | "dca1="<<dca[i1]<< | |
4147 | "mindcar="<<mindcar<< | |
4148 | "mindcaz="<<mindcaz<< | |
4149 | "delta="<<delta<< | |
4150 | "rmean="<<rmean<< | |
4151 | "npoints="<<npoints<< | |
4152 | "hangles0="<<hangles[0]<< | |
4153 | "hangles2="<<hangles[2]<< | |
4154 | "xyz0="<<xyz0[2]<< | |
4155 | "xyzz1="<<xyz1[2]<< | |
4156 | "z0="<<z0[i0]<< | |
4157 | "z1="<<z0[i1]<< | |
4158 | "radius="<<radiusbest<< | |
4159 | "deltabest="<<deltabest<< | |
4160 | "phase0="<<phase[ibest][0]<< | |
4161 | "phase1="<<phase[ibest][1]<< | |
4162 | "\n"; | |
eea478d3 | 4163 | } |
4164 | } | |
4165 | } | |
4166 | } | |
4167 | // | |
81e97e0d | 4168 | // Finf kinks loop |
4169 | // | |
51ad6848 | 4170 | // |
4171 | for (Int_t i =0;i<nentries;i++){ | |
4172 | if (sign[i]==0) continue; | |
4173 | AliTPCseed * track0 = (AliTPCseed*)array->At(i); | |
4174 | ntracks++; | |
4175 | // | |
4176 | Double_t cradius0 = 40*40; | |
4177 | Double_t cradius1 = 270*270; | |
4178 | Double_t cdist1=8.; | |
4179 | Double_t cdist2=8.; | |
4180 | Double_t cdist3=0.55; | |
4181 | for (Int_t j =i+1;j<nentries;j++){ | |
4182 | nall++; | |
4183 | if (sign[j]*sign[i]<1) continue; | |
4184 | if ( (nclusters[i]+nclusters[j])>200) continue; | |
4185 | if ( (nclusters[i]+nclusters[j])<80) continue; | |
4186 | if ( TMath::Abs(zm[i]-zm[j])>60.) continue; | |
4187 | if ( TMath::Abs(fim[i]-fim[j])>0.6 && TMath::Abs(fim[i]-fim[j])<5.7 ) continue; | |
4188 | //AliTPCseed * track1 = (AliTPCseed*)array->At(j); Double_t phase[2][2],radius[2]; | |
4189 | Int_t npoints = helixes[i].GetRPHIintersections(helixes[j], phase, radius,20); | |
4190 | if (npoints<1) continue; | |
4191 | // cuts on radius | |
4192 | if (npoints==1){ | |
4193 | if (radius[0]<cradius0||radius[0]>cradius1) continue; | |
4194 | } | |
4195 | else{ | |
4196 | if ( (radius[0]<cradius0||radius[0]>cradius1) && (radius[1]<cradius0||radius[1]>cradius1) ) continue; | |
4197 | } | |
4198 | // | |
4199 | Double_t delta1=10000,delta2=10000; | |
4200 | // cuts on the intersection radius | |
4201 | helixes[i].LinearDCA(helixes[j],phase[0][0],phase[0][1],radius[0],delta1); | |
4202 | if (radius[0]<20&&delta1<1) continue; //intersection at vertex | |
4203 | if (radius[0]<10&&delta1<3) continue; //intersection at vertex | |
4204 | if (npoints==2){ | |
4205 | helixes[i].LinearDCA(helixes[j],phase[1][0],phase[1][1],radius[1],delta2); | |
4206 | if (radius[1]<20&&delta2<1) continue; //intersection at vertex | |
4207 | if (radius[1]<10&&delta2<3) continue; //intersection at vertex | |
4208 | } | |
4209 | // | |
4210 | Double_t distance1 = TMath::Min(delta1,delta2); | |
4211 | if (distance1>cdist1) continue; // cut on DCA linear approximation | |
4212 | // | |
4213 | npoints = helixes[i].GetRPHIintersections(helixes[j], phase, radius,20); | |
4214 | helixes[i].ParabolicDCA(helixes[j],phase[0][0],phase[0][1],radius[0],delta1); | |
4215 | if (radius[0]<20&&delta1<1) continue; //intersection at vertex | |
4216 | if (radius[0]<10&&delta1<3) continue; //intersection at vertex | |
4217 | // | |
4218 | if (npoints==2){ | |
4219 | helixes[i].ParabolicDCA(helixes[j],phase[1][0],phase[1][1],radius[1],delta2); | |
4220 | if (radius[1]<20&&delta2<1) continue; //intersection at vertex | |
4221 | if (radius[1]<10&&delta2<3) continue; //intersection at vertex | |
4222 | } | |
4223 | distance1 = TMath::Min(delta1,delta2); | |
4224 | Float_t rkink =0; | |
4225 | if (delta1<delta2){ | |
4226 | rkink = TMath::Sqrt(radius[0]); | |
4227 | } | |
4228 | else{ | |
4229 | rkink = TMath::Sqrt(radius[1]); | |
4230 | } | |
4231 | if (distance1>cdist2) continue; | |
4232 | // | |
4233 | // | |
4234 | AliTPCseed * track1 = (AliTPCseed*)array->At(j); | |
4235 | // | |
4236 | // | |
4237 | Int_t row0 = GetRowNumber(rkink); | |
4238 | if (row0<10) continue; | |
4239 | if (row0>150) continue; | |
4240 | // | |
4241 | // | |
4242 | Float_t dens00=-1,dens01=-1; | |
4243 | Float_t dens10=-1,dens11=-1; | |
4244 | // | |
4245 | Int_t found,foundable,shared; | |
4246 | track0->GetClusterStatistic(0,row0-5, found, foundable,shared,kFALSE); | |
4247 | if (foundable>5) dens00 = Float_t(found)/Float_t(foundable); | |
4248 | track0->GetClusterStatistic(row0+5,155, found, foundable,shared,kFALSE); | |
4249 | if (foundable>5) dens01 = Float_t(found)/Float_t(foundable); | |
4250 | // | |
4251 | track1->GetClusterStatistic(0,row0-5, found, foundable,shared,kFALSE); | |
4252 | if (foundable>10) dens10 = Float_t(found)/Float_t(foundable); | |
4253 | track1->GetClusterStatistic(row0+5,155, found, foundable,shared,kFALSE); | |
4254 | if (foundable>10) dens11 = Float_t(found)/Float_t(foundable); | |
eea478d3 | 4255 | // |
51ad6848 | 4256 | if (dens00<dens10 && dens01<dens11) continue; |
4257 | if (dens00>dens10 && dens01>dens11) continue; | |
4258 | if (TMath::Max(dens00,dens10)<0.1) continue; | |
4259 | if (TMath::Max(dens01,dens11)<0.3) continue; | |
4260 | // | |
4261 | if (TMath::Min(dens00,dens10)>0.6) continue; | |
4262 | if (TMath::Min(dens01,dens11)>0.6) continue; | |
4263 | ||
4264 | // | |
4265 | AliTPCseed * ktrack0, *ktrack1; | |
4266 | if (dens00>dens10){ | |
4267 | ktrack0 = track0; | |
4268 | ktrack1 = track1; | |
4269 | } | |
4270 | else{ | |
4271 | ktrack0 = track1; | |
4272 | ktrack1 = track0; | |
4273 | } | |
4274 | if (TMath::Abs(ktrack0->GetC())>5) continue; // cut on the curvature for mother particle | |
4275 | AliExternalTrackParam paramm(*ktrack0); | |
4276 | AliExternalTrackParam paramd(*ktrack1); | |
c9ec41e8 | 4277 | if (row0>60&&ktrack1->GetReference().GetX()>90.) new (¶md) AliExternalTrackParam(ktrack1->GetReference()); |
51ad6848 | 4278 | // |
4279 | // | |
4280 | kink->SetMother(paramm); | |
4281 | kink->SetDaughter(paramd); | |
4282 | kink->Update(); | |
4283 | ||
eea478d3 | 4284 | Float_t x[3] = { kink->GetPosition()[0],kink->GetPosition()[1],kink->GetPosition()[2]}; |
51ad6848 | 4285 | Int_t index[4]; |
4286 | fParam->Transform0to1(x,index); | |
4287 | fParam->Transform1to2(x,index); | |
4288 | row0 = GetRowNumber(x[0]); | |
4289 | ||
eea478d3 | 4290 | if (kink->GetR()<100) continue; |
4291 | if (kink->GetR()>240) continue; | |
4292 | if (kink->GetPosition()[2]/kink->GetR()>AliTPCReconstructor::GetCtgRange()) continue; //out of fiducial volume | |
4293 | if (kink->GetDistance()>cdist3) continue; | |
4294 | Float_t dird = kink->GetDaughterP()[0]*kink->GetPosition()[0]+kink->GetDaughterP()[1]*kink->GetPosition()[1]; // rough direction estimate | |
51ad6848 | 4295 | if (dird<0) continue; |
4296 | ||
eea478d3 | 4297 | Float_t dirm = kink->GetMotherP()[0]*kink->GetPosition()[0]+kink->GetMotherP()[1]*kink->GetPosition()[1]; // rough direction estimate |
51ad6848 | 4298 | if (dirm<0) continue; |
eea478d3 | 4299 | Float_t mpt = TMath::Sqrt(kink->GetMotherP()[0]*kink->GetMotherP()[0]+kink->GetMotherP()[1]*kink->GetMotherP()[1]); |
51ad6848 | 4300 | if (mpt<0.2) continue; |
4301 | ||
eea478d3 | 4302 | if (mpt<1){ |
4303 | //for high momenta momentum not defined well in first iteration | |
4304 | Double_t qt = TMath::Sin(kink->GetAngle(2))*ktrack1->P(); | |
4305 | if (qt>0.35) continue; | |
4306 | } | |
51ad6848 | 4307 | |
eea478d3 | 4308 | kink->SetLabel(CookLabel(ktrack0,0.4,0,row0),0); |
4309 | kink->SetLabel(CookLabel(ktrack1,0.4,row0,160),1); | |
51ad6848 | 4310 | if (dens00>dens10){ |
eea478d3 | 4311 | kink->SetTPCDensity(dens00,0,0); |
4312 | kink->SetTPCDensity(dens01,0,1); | |
4313 | kink->SetTPCDensity(dens10,1,0); | |
4314 | kink->SetTPCDensity(dens11,1,1); | |
4315 | kink->SetIndex(i,0); | |
4316 | kink->SetIndex(j,1); | |
51ad6848 | 4317 | } |
4318 | else{ | |
eea478d3 | 4319 | kink->SetTPCDensity(dens10,0,0); |
4320 | kink->SetTPCDensity(dens11,0,1); | |
4321 | kink->SetTPCDensity(dens00,1,0); | |
4322 | kink->SetTPCDensity(dens01,1,1); | |
4323 | kink->SetIndex(j,0); | |
4324 | kink->SetIndex(i,1); | |
51ad6848 | 4325 | } |
51ad6848 | 4326 | |
eea478d3 | 4327 | if (mpt<1||kink->GetAngle(2)>0.1){ |
4328 | // angle and densities not defined yet | |
4329 | if (kink->GetTPCDensityFactor()<0.8) continue; | |
4330 | if ((2-kink->GetTPCDensityFactor())*kink->GetDistance() >0.25) continue; | |
4331 | if (kink->GetAngle(2)*ktrack0->P()<0.003) continue; //too small angle | |
4332 | if (kink->GetAngle(2)>0.2&&kink->GetTPCDensityFactor()<1.15) continue; | |
4333 | if (kink->GetAngle(2)>0.2&&kink->GetTPCDensity(0,1)>0.05) continue; | |
4334 | ||
4335 | Float_t criticalangle = track0->fC22+track0->fC33; | |
4336 | criticalangle+= track1->fC22+track1->fC33; | |
4337 | criticalangle= 3*TMath::Sqrt(criticalangle); | |
4338 | if (criticalangle>0.02) criticalangle=0.02; | |
4339 | if (kink->GetAngle(2)<criticalangle) continue; | |
4340 | } | |
51ad6848 | 4341 | // |
eea478d3 | 4342 | Int_t drow = Int_t(2.+0.5/(0.05+kink->GetAngle(2))); // overlap region defined |
51ad6848 | 4343 | Float_t shapesum =0; |
4344 | Float_t sum = 0; | |
4345 | for ( Int_t row = row0-drow; row<row0+drow;row++){ | |
4346 | if (row<0) continue; | |
4347 | if (row>155) continue; | |
4348 | if (ktrack0->fClusterPointer[row]){ | |
4349 | AliTPCTrackerPoint *point =ktrack0->GetTrackPoint(row); | |
4350 | shapesum+=point->GetSigmaY()+point->GetSigmaZ(); | |
4351 | sum++; | |
4352 | } | |
4353 | if (ktrack1->fClusterPointer[row]){ | |
4354 | AliTPCTrackerPoint *point =ktrack1->GetTrackPoint(row); | |
4355 | shapesum+=point->GetSigmaY()+point->GetSigmaZ(); | |
4356 | sum++; | |
4357 | } | |
4358 | } | |
4359 | if (sum<4){ | |
eea478d3 | 4360 | kink->SetShapeFactor(-1.); |
51ad6848 | 4361 | } |
4362 | else{ | |
eea478d3 | 4363 | kink->SetShapeFactor(shapesum/sum); |
4364 | } | |
51ad6848 | 4365 | // esd->AddKink(kink); |
4366 | kinks->AddLast(kink); | |
4367 | kink = new AliESDkink; | |
4368 | ncandidates++; | |
4369 | } | |
4370 | } | |
eea478d3 | 4371 | // |
4372 | // sort the kinks according quality - and refit them towards vertex | |
4373 | // | |
4374 | Int_t nkinks = kinks->GetEntriesFast(); | |
4375 | Float_t *quality = new Float_t[nkinks]; | |
4376 | Int_t *indexes = new Int_t[nkinks]; | |
4377 | AliTPCseed *mothers = new AliTPCseed[nkinks]; | |
4378 | AliTPCseed *daughters = new AliTPCseed[nkinks]; | |
4379 | // | |
4380 | // | |
51ad6848 | 4381 | for (Int_t i=0;i<nkinks;i++){ |
4382 | quality[i] =100000; | |
4383 | AliESDkink *kink = (AliESDkink*)kinks->At(i); | |
eea478d3 | 4384 | // |
4385 | // refit kinks towards vertex | |
4386 | // | |
4387 | Int_t index0 = kink->GetIndex(0); | |
4388 | Int_t index1 = kink->GetIndex(1); | |
4389 | AliTPCseed * ktrack0 = (AliTPCseed*)array->At(index0); | |
4390 | AliTPCseed * ktrack1 = (AliTPCseed*)array->At(index1); | |
4391 | // | |
4392 | Int_t sumn=ktrack0->fN+ktrack1->fN; | |
4393 | // | |
4394 | // Refit Kink under if too small angle | |
4395 | // | |
4396 | if (kink->GetAngle(2)<0.05){ | |
4397 | kink->SetTPCRow0(GetRowNumber(kink->GetR())); | |
4398 | Int_t row0 = kink->GetTPCRow0(); | |
4399 | Int_t drow = Int_t(2.+0.5/(0.05+kink->GetAngle(2))); | |
4400 | // | |
4401 | // | |
4402 | Int_t last = row0-drow; | |
4403 | if (last<40) last=40; | |
4404 | if (last<ktrack0->fFirstPoint+25) last = ktrack0->fFirstPoint+25; | |
4405 | AliTPCseed* seed0 = ReSeed(ktrack0,last,kFALSE); | |
4406 | // | |
4407 | // | |
4408 | Int_t first = row0+drow; | |
4409 | if (first>130) first=130; | |
4410 | if (first>ktrack1->fLastPoint-25) first = TMath::Max(ktrack1->fLastPoint-25,30); | |
4411 | AliTPCseed* seed1 = ReSeed(ktrack1,first,kTRUE); | |
4412 | // | |
4413 | if (seed0 && seed1){ | |
4414 | kink->SetStatus(1,8); | |
4415 | if (RefitKink(*seed0,*seed1,*kink)) kink->SetStatus(1,9); | |
4416 | row0 = GetRowNumber(kink->GetR()); | |
4417 | sumn = seed0->fN+seed1->fN; | |
4418 | new (&mothers[i]) AliTPCseed(*seed0); | |
4419 | new (&daughters[i]) AliTPCseed(*seed1); | |
4420 | } | |
4421 | else{ | |
4422 | delete kinks->RemoveAt(i); | |
4423 | if (seed0) delete seed0; | |
4424 | if (seed1) delete seed1; | |
4425 | continue; | |
4426 | } | |
4427 | if (kink->GetDistance()>0.5 || kink->GetR()<110 || kink->GetR()>240) { | |
4428 | delete kinks->RemoveAt(i); | |
4429 | if (seed0) delete seed0; | |
4430 | if (seed1) delete seed1; | |
4431 | continue; | |
4432 | } | |
4433 | // | |
4434 | delete seed0; | |
4435 | delete seed1; | |
4436 | } | |
4437 | // | |
4438 | if (kink) quality[i] = 160*((0.1+kink->GetDistance())*(2.-kink->GetTPCDensityFactor()))/(sumn+40.); //the longest -clossest will win | |
51ad6848 | 4439 | } |
4440 | TMath::Sort(nkinks,quality,indexes,kFALSE); | |
eea478d3 | 4441 | // |
4442 | //remove double find kinks | |
4443 | // | |
4444 | for (Int_t ikink0=1;ikink0<nkinks;ikink0++){ | |
4445 | AliESDkink * kink0 = (AliESDkink*) kinks->At(indexes[ikink0]); | |
4446 | if (!kink0) continue; | |
4447 | // | |
4448 | for (Int_t ikink1=0;ikink1<ikink0;ikink1++){ | |
4449 | if (!kink0) continue; | |
4450 | AliESDkink * kink1 = (AliESDkink*) kinks->At(indexes[ikink1]); | |
4451 | if (!kink1) continue; | |
4452 | // if not close kink continue | |
4453 | if (TMath::Abs(kink1->GetPosition()[2]-kink0->GetPosition()[2])>10) continue; | |
4454 | if (TMath::Abs(kink1->GetPosition()[1]-kink0->GetPosition()[1])>10) continue; | |
4455 | if (TMath::Abs(kink1->GetPosition()[0]-kink0->GetPosition()[0])>10) continue; | |
4456 | // | |
4457 | AliTPCseed &mother0 = mothers[indexes[ikink0]]; | |
4458 | AliTPCseed &daughter0 = daughters[indexes[ikink0]]; | |
4459 | AliTPCseed &mother1 = mothers[indexes[ikink1]]; | |
4460 | AliTPCseed &daughter1 = daughters[indexes[ikink1]]; | |
4461 | Int_t row0 = (kink0->GetTPCRow0()+kink1->GetTPCRow0())/2; | |
4462 | // | |
4463 | Int_t same = 0; | |
4464 | Int_t both = 0; | |
4465 | Int_t samem = 0; | |
4466 | Int_t bothm = 0; | |
4467 | Int_t samed = 0; | |
4468 | Int_t bothd = 0; | |
4469 | // | |
4470 | for (Int_t i=0;i<row0;i++){ | |
4471 | if (mother0.fIndex[i]>0 && mother1.fIndex[i]>0){ | |
4472 | both++; | |
4473 | bothm++; | |
4474 | if (mother0.fIndex[i]==mother1.fIndex[i]){ | |
4475 | same++; | |
4476 | samem++; | |
4477 | } | |
4478 | } | |
4479 | } | |
4480 | ||
4481 | for (Int_t i=row0;i<158;i++){ | |
4482 | if (daughter0.fIndex[i]>0 && daughter0.fIndex[i]>0){ | |
4483 | both++; | |
4484 | bothd++; | |
4485 | if (mother0.fIndex[i]==mother1.fIndex[i]){ | |
4486 | same++; | |
4487 | samed++; | |
4488 | } | |
4489 | } | |
4490 | } | |
4491 | Float_t ratio = Float_t(same+1)/Float_t(both+1); | |
4492 | Float_t ratiom = Float_t(samem+1)/Float_t(bothm+1); | |
4493 | Float_t ratiod = Float_t(samed+1)/Float_t(bothd+1); | |
4494 | if (ratio>0.3 && ratiom>0.5 &&ratiod>0.5) { | |
4495 | Int_t sum0 = mother0.fN+daughter0.fN; | |
4496 | Int_t sum1 = mother1.fN+daughter1.fN; | |
4497 | if (sum1>sum0){ | |
4498 | shared[kink0->GetIndex(0)]= kTRUE; | |
4499 | shared[kink0->GetIndex(1)]= kTRUE; | |
4500 | delete kinks->RemoveAt(indexes[ikink0]); | |
4501 | } | |
4502 | else{ | |
4503 | shared[kink1->GetIndex(0)]= kTRUE; | |
4504 | shared[kink1->GetIndex(1)]= kTRUE; | |
4505 | delete kinks->RemoveAt(indexes[ikink1]); | |
4506 | } | |
4507 | } | |
4508 | } | |
4509 | } | |
4510 | ||
4511 | ||
51ad6848 | 4512 | for (Int_t i=0;i<nkinks;i++){ |
4513 | AliESDkink * kink = (AliESDkink*) kinks->At(indexes[i]); | |
eea478d3 | 4514 | if (!kink) continue; |
4515 | kink->SetTPCRow0(GetRowNumber(kink->GetR())); | |
4516 | Int_t index0 = kink->GetIndex(0); | |
4517 | Int_t index1 = kink->GetIndex(1); | |
4518 | if (circular[index0]||circular[index1]&&kink->GetDistance()>0.2) continue; | |
4519 | kink->SetMultiple(usage[index0],0); | |
4520 | kink->SetMultiple(usage[index1],1); | |
4521 | if (kink->GetMultiple()[0]+kink->GetMultiple()[1]>2) continue; | |
4522 | if (kink->GetMultiple()[0]+kink->GetMultiple()[1]>0 && quality[indexes[i]]>0.2) continue; | |
4523 | if (kink->GetMultiple()[0]+kink->GetMultiple()[1]>0 && kink->GetDistance()>0.2) continue; | |
4524 | if (circular[index0]||circular[index1]&&kink->GetDistance()>0.1) continue; | |
51ad6848 | 4525 | |
51ad6848 | 4526 | AliTPCseed * ktrack0 = (AliTPCseed*)array->At(index0); |
4527 | AliTPCseed * ktrack1 = (AliTPCseed*)array->At(index1); | |
eea478d3 | 4528 | if (!ktrack0 || !ktrack1) continue; |
4529 | Int_t index = esd->AddKink(kink); | |
4530 | // | |
4531 | // | |
4532 | if ( ktrack0->fKinkIndexes[0]==0 && ktrack1->fKinkIndexes[0]==0) { //best kink | |
4533 | if (mothers[indexes[i]].fN>20 && daughters[indexes[i]].fN>20 && (mothers[indexes[i]].fN+daughters[indexes[i]].fN)>100){ | |
4534 | new (ktrack0) AliTPCseed(mothers[indexes[i]]); | |
4535 | new (ktrack1) AliTPCseed(daughters[indexes[i]]); | |
4536 | } | |
4537 | } | |
4538 | // | |
51ad6848 | 4539 | ktrack0->fKinkIndexes[usage[index0]] = -(index+1); |
4540 | ktrack1->fKinkIndexes[usage[index1]] = (index+1); | |
4541 | usage[index0]++; | |
4542 | usage[index1]++; | |
4543 | } | |
eea478d3 | 4544 | // |
4545 | // Remove tracks corresponding to shared kink's | |
4546 | // | |
4547 | for (Int_t i=0;i<nentries;i++){ | |
4548 | AliTPCseed * track0 = (AliTPCseed*)array->At(i); | |
4549 | if (!track0) continue; | |
4550 | if (track0->fKinkIndexes[0]!=0) continue; | |
4551 | if (shared[i]) delete array->RemoveAt(i); | |
4552 | } | |
51ad6848 | 4553 | |
eea478d3 | 4554 | // |
4555 | // | |
4556 | RemoveUsed2(array,0.5,0.4,30); | |
4557 | UnsignClusters(); | |
81e97e0d | 4558 | for (Int_t i=0;i<nentries;i++){ |
4559 | AliTPCseed * track0 = (AliTPCseed*)array->At(i); | |
4560 | if (!track0) continue; | |
4561 | track0->CookdEdx(0.02,0.6); | |
4562 | track0->CookPID(); | |
4563 | } | |
eea478d3 | 4564 | // |
4565 | for (Int_t i=0;i<nentries;i++){ | |
4566 | AliTPCseed * track0 = (AliTPCseed*)array->At(i); | |
4567 | if (!track0) continue; | |
4568 | if (track0->Pt()<1.4) continue; | |
4569 | //remove double high momenta tracks - overlapped with kink candidates | |
4570 | Int_t shared=0; | |
4571 | Int_t all =0; | |
4572 | for (Int_t icl=track0->fFirstPoint;icl<track0->fLastPoint; icl++){ | |
4573 | if (track0->fClusterPointer[icl]!=0){ | |
4574 | all++; | |
4575 | if (track0->fClusterPointer[icl]->IsUsed(10)) shared++; | |
4576 | } | |
4577 | } | |
4578 | if (Float_t(shared+1)/Float_t(nall+1)>0.5) { | |
4579 | delete array->RemoveAt(i); | |
4580 | } | |
4581 | // | |
4582 | if (track0->fKinkIndexes[0]!=0) continue; | |
4583 | if (track0->GetNumberOfClusters()<80) continue; | |
4a12af72 | 4584 | |
4585 | AliTPCseed *pmother = new AliTPCseed(); | |
4586 | AliTPCseed *pdaughter = new AliTPCseed(); | |
4587 | AliESDkink *pkink = new AliESDkink; | |
4588 | ||
4589 | AliTPCseed & mother = *pmother; | |
4590 | AliTPCseed & daughter = *pdaughter; | |
4591 | AliESDkink & kink = *pkink; | |
eea478d3 | 4592 | if (CheckKinkPoint(track0,mother,daughter, kink)){ |
4a12af72 | 4593 | if (mother.fN<30||daughter.fN<20) { |
4594 | delete pmother; | |
4595 | delete pdaughter; | |
4596 | delete pkink; | |
4597 | continue; //too short tracks | |
4598 | } | |
4599 | if (mother.Pt()<1.4) { | |
4600 | delete pmother; | |
4601 | delete pdaughter; | |
4602 | delete pkink; | |
4603 | continue; | |
4604 | } | |
eea478d3 | 4605 | Int_t row0= kink.GetTPCRow0(); |
4606 | if (kink.GetDistance()>0.5 || kink.GetR()<110. || kink.GetR()>240.) { | |
4a12af72 | 4607 | delete pmother; |
4608 | delete pdaughter; | |
4609 | delete pkink; | |
eea478d3 | 4610 | continue; |
4611 | } | |
4612 | // | |
4613 | Int_t index = esd->AddKink(&kink); | |
4614 | mother.fKinkIndexes[0] = -(index+1); | |
4615 | daughter.fKinkIndexes[0] = index+1; | |
4616 | if (mother.fN>50) { | |
4617 | delete array->RemoveAt(i); | |
4618 | array->AddAt(new AliTPCseed(mother),i); | |
4619 | } | |
4620 | else{ | |
4621 | array->AddLast(new AliTPCseed(mother)); | |
4622 | } | |
4623 | array->AddLast(new AliTPCseed(daughter)); | |
4624 | for (Int_t icl=0;icl<row0;icl++) { | |
4625 | if (mother.fClusterPointer[icl]) mother.fClusterPointer[icl]->Use(20); | |
4626 | } | |
4627 | // | |
4628 | for (Int_t icl=row0;icl<158;icl++) { | |
4629 | if (daughter.fClusterPointer[icl]) daughter.fClusterPointer[icl]->Use(20); | |
4630 | } | |
4631 | // | |
4632 | } | |
4a12af72 | 4633 | delete pmother; |
4634 | delete pdaughter; | |
4635 | delete pkink; | |
eea478d3 | 4636 | } |
4637 | ||
4638 | delete [] daughters; | |
4639 | delete [] mothers; | |
4640 | // | |
4641 | // | |
81e97e0d | 4642 | delete [] dca; |
eea478d3 | 4643 | delete []circular; |
4644 | delete []shared; | |
4645 | delete []quality; | |
4646 | delete []indexes; | |
4647 | // | |
4648 | delete kink; | |
4649 | delete[]fim; | |
51ad6848 | 4650 | delete[] zm; |
eea478d3 | 4651 | delete[] z0; |
51ad6848 | 4652 | delete [] usage; |
4653 | delete[] alpha; | |
4654 | delete[] nclusters; | |
4655 | delete[] sign; | |
4656 | delete[] helixes; | |
4657 | kinks->Delete(); | |
4658 | delete kinks; | |
4659 | ||
eea478d3 | 4660 | printf("Ncandidates=\t%d\t%d\t%d\t%d\n",esd->GetNumberOfKinks(),ncandidates,ntracks,nall); |
51ad6848 | 4661 | timer.Print(); |
4662 | } | |
4663 | ||
81e97e0d | 4664 | void AliTPCtrackerMI::FindV0s(TObjArray * array, AliESD *esd) |
4665 | { | |
4666 | // | |
4667 | // find V0s | |
4668 | // | |
4669 | // | |
4670 | TObjArray *tpcv0s = new TObjArray(100000); | |
4671 | Int_t nentries = array->GetEntriesFast(); | |
4672 | AliHelix *helixes = new AliHelix[nentries]; | |
4673 | Int_t *sign = new Int_t[nentries]; | |
4674 | Float_t *alpha = new Float_t[nentries]; | |
4675 | Float_t *z0 = new Float_t[nentries]; | |
4676 | Float_t *dca = new Float_t[nentries]; | |
4677 | Float_t *sdcar = new Float_t[nentries]; | |
4678 | Float_t *cdcar = new Float_t[nentries]; | |
4679 | Float_t *pulldcar = new Float_t[nentries]; | |
4680 | Float_t *pulldcaz = new Float_t[nentries]; | |
4681 | Float_t *pulldca = new Float_t[nentries]; | |
4682 | Bool_t *isPrim = new Bool_t[nentries]; | |
4683 | const AliESDVertex * primvertex = esd->GetVertex(); | |
4684 | Double_t zvertex = primvertex->GetZv(); | |
4685 | // | |
4686 | // nentries = array->GetEntriesFast(); | |
4687 | // | |
4688 | for (Int_t i=0;i<nentries;i++){ | |
4689 | sign[i]=0; | |
4690 | isPrim[i]=0; | |
4691 | AliTPCseed* track = (AliTPCseed*)array->At(i); | |
4692 | if (!track) continue; | |
4693 | track->GetV0Indexes()[0] = 0; //rest v0 indexes | |
4694 | track->GetV0Indexes()[1] = 0; //rest v0 indexes | |
4695 | track->GetV0Indexes()[2] = 0; //rest v0 indexes | |
4696 | // | |
4697 | alpha[i] = track->GetAlpha(); | |
4698 | new (&helixes[i]) AliHelix(*track); | |
4699 | Double_t xyz[3]; | |
4700 | helixes[i].Evaluate(0,xyz); | |
4701 | sign[i] = (track->GetC()>0) ? -1:1; | |
4702 | Double_t x,y,z; | |
4703 | x=160; | |
4704 | z0[i]=1000; | |
4705 | if (track->GetProlongation(0,y,z)) z0[i] = z; | |
4706 | dca[i] = track->GetD(0,0); | |
4707 | // | |
4708 | // dca error parrameterezation + pulls | |
4709 | // | |
4710 | sdcar[i] = TMath::Sqrt(0.150*0.150+(100*track->fP4)*(100*track->fP4)); | |
4711 | if (TMath::Abs(track->fP3)>1) sdcar[i]*=2.5; | |
4712 | cdcar[i] = TMath::Exp((TMath::Abs(track->fP4)-0.0106)*525.3); | |
4713 | pulldcar[i] = (dca[i]-cdcar[i])/sdcar[i]; | |
4714 | pulldcaz[i] = (z0[i]-zvertex)/sdcar[i]; | |
4715 | pulldca[i] = TMath::Sqrt(pulldcar[i]*pulldcar[i]+pulldcaz[i]*pulldcaz[i]); | |
4716 | if (track->fTPCr[1]+track->fTPCr[2]+track->fTPCr[3]>0.5) { | |
4717 | if (pulldca[i]<3.) isPrim[i]=kTRUE; //pion, muon and Kaon 3 sigma cut | |
4718 | } | |
4719 | if (track->fTPCr[4]>0.5) { | |
4720 | if (pulldca[i]<0.5) isPrim[i]=kTRUE; //proton 0.5 sigma cut | |
4721 | } | |
4722 | if (track->fTPCr[0]>0.4) { | |
4723 | isPrim[i]=kFALSE; //electron no sigma cut | |
4724 | } | |
4725 | } | |
4726 | // | |
4727 | // | |
4728 | TStopwatch timer; | |
4729 | timer.Start(); | |
4730 | Int_t ncandidates =0; | |
4731 | Int_t nall =0; | |
4732 | Int_t ntracks=0; | |
4733 | Double_t phase[2][2],radius[2]; | |
4734 | // | |
4735 | // Finf V0s loop | |
4736 | // | |
4737 | // | |
4738 | // // | |
4739 | TTreeSRedirector &cstream = *fDebugStreamer; | |
4740 | Float_t fprimvertex[3]={GetX(),GetY(),GetZ()}; | |
4741 | AliESDV0MI vertex; | |
4742 | Double_t cradius0 = 10*10; | |
4743 | Double_t cradius1 = 200*200; | |
4744 | Double_t cdist1=3.; | |
4745 | Double_t cdist2=4.; | |
4746 | Double_t cpointAngle = 0.95; | |
4747 | // | |
4748 | Double_t delta[2]={10000,10000}; | |
4749 | for (Int_t i =0;i<nentries;i++){ | |
4750 | if (sign[i]==0) continue; | |
4751 | AliTPCseed * track0 = (AliTPCseed*)array->At(i); | |
4752 | if (!track0) continue; | |
4753 | cstream<<"Tracks"<< | |
4754 | "Tr0.="<<track0<< | |
4755 | "dca="<<dca[i]<< | |
4756 | "z0="<<z0[i]<< | |
4757 | "zvertex="<<zvertex<< | |
4758 | "sdcar0="<<sdcar[i]<< | |
4759 | "cdcar0="<<cdcar[i]<< | |
4760 | "pulldcar0="<<pulldcar[i]<< | |
4761 | "pulldcaz0="<<pulldcaz[i]<< | |
4762 | "pulldca0="<<pulldca[i]<< | |
4763 | "isPrim="<<isPrim[i]<< | |
4764 | "\n"; | |
4765 | // | |
4766 | if (track0->fP4<0) continue; | |
4767 | if (track0->GetKinkIndex(0)>0||isPrim[i]) continue; //daughter kink | |
4768 | // | |
4769 | if (TMath::Abs(helixes[i].GetHelix(4))<0.000000001) continue; | |
4770 | ntracks++; | |
4771 | // debug output | |
4772 | ||
4773 | ||
4774 | for (Int_t j =0;j<nentries;j++){ | |
4775 | AliTPCseed * track1 = (AliTPCseed*)array->At(j); | |
4776 | if (!track1) continue; | |
4777 | if (track1->GetKinkIndex(0)>0 || isPrim[j]) continue; //daughter kink | |
4778 | if (sign[j]*sign[i]>0) continue; | |
4779 | if (TMath::Abs(helixes[j].GetHelix(4))<0.000001) continue; | |
4780 | if (track0->fCircular+track1->fCircular>1) continue; //circling -returning track | |
4781 | nall++; | |
4782 | // | |
4783 | // DCA to prim vertex cut | |
4784 | // | |
4785 | // | |
4786 | delta[0]=10000; | |
4787 | delta[1]=10000; | |
4788 | ||
4789 | Int_t npoints = helixes[i].GetRPHIintersections(helixes[j], phase, radius,cdist2); | |
4790 | if (npoints<1) continue; | |
4791 | Int_t iclosest=0; | |
4792 | // cuts on radius | |
4793 | if (npoints==1){ | |
4794 | if (radius[0]<cradius0||radius[0]>cradius1) continue; | |
4795 | helixes[i].LinearDCA(helixes[j],phase[0][0],phase[0][1],radius[0],delta[0]); | |
4796 | if (delta[0]>cdist1) continue; | |
4797 | } | |
4798 | else{ | |
4799 | if (TMath::Max(radius[0],radius[1])<cradius0|| TMath::Min(radius[0],radius[1])>cradius1) continue; | |
4800 | helixes[i].LinearDCA(helixes[j],phase[0][0],phase[0][1],radius[0],delta[0]); | |
4801 | helixes[i].LinearDCA(helixes[j],phase[1][0],phase[1][1],radius[1],delta[1]); | |
4802 | if (delta[1]<delta[0]) iclosest=1; | |
4803 | if (delta[iclosest]>cdist1) continue; | |
4804 | } | |
4805 | helixes[i].ParabolicDCA(helixes[j],phase[iclosest][0],phase[iclosest][1],radius[iclosest],delta[iclosest]); | |
4806 | if (radius[iclosest]<cradius0 || radius[iclosest]>cradius1 || delta[iclosest]>cdist1) continue; | |
4807 | // | |
4808 | Double_t pointAngle = helixes[i].GetPointAngle(helixes[j],phase[iclosest],fprimvertex); | |
4809 | if (pointAngle<cpointAngle) continue; | |
4810 | // | |
4811 | Bool_t isGamma = kFALSE; | |
4812 | vertex.SetP(*track0); //track0 - plus | |
4813 | vertex.SetM(*track1); //track1 - minus | |
4814 | vertex.Update(fprimvertex); | |
4815 | if (track0->fTPCr[0]>0.3&&track1->fTPCr[0]>0.3&&vertex.GetAnglep()[2]<0.15) isGamma=kTRUE; // gamma conversion candidate | |
4816 | Double_t pointAngle2 = vertex.GetPointAngle(); | |
4817 | //continue; | |
4818 | if (vertex.GetPointAngle()<cpointAngle && (!isGamma)) continue; // point angle cut | |
4819 | if (vertex.GetDist2()>2&&(!isGamma)) continue; // point angle cut | |
4820 | Float_t sigmae = 0.15*0.15; | |
4821 | if (vertex.GetRr()<80) | |
4822 | sigmae += (sdcar[i]*sdcar[i]+sdcar[j]*sdcar[j])*(1.-vertex.GetRr()/80.)*(1.-vertex.GetRr()/80.); | |
4823 | sigmae+= TMath::Sqrt(sigmae); | |
4824 | if (vertex.GetDist2()/sigmae>3.&&(!isGamma)) continue; | |
4825 | Float_t densb0=0,densb1=0,densa0=0,densa1=0; | |
4826 | Int_t row0 = GetRowNumber(vertex.GetRr()); | |
4827 | if (row0>15){ | |
4828 | if (vertex.GetDist2()>0.2) continue; | |
4829 | densb0 = track0->Density2(0,row0-5); | |
4830 | densb1 = track1->Density2(0,row0-5); | |
4831 | if (densb0>0.3|| densb1>0.3) continue; //clusters before vertex | |
4832 | densa0 = track0->Density2(row0+5,row0+40); | |
4833 | densa1 = track1->Density2(row0+5,row0+40); | |
4834 | if ((densa0<0.4|| densa1<0.4)&&(!isGamma)) continue; //missing clusters after vertex | |
4835 | } | |
4836 | else{ | |
4837 | densa0 = track0->Density2(0,40); //cluster density | |
4838 | densa1 = track1->Density2(0,40); //cluster density | |
4839 | if ((vertex.GetRr()<80&&densa0+densa1<1.)&&(!isGamma)) continue; | |
4840 | } | |
4841 | vertex.SetLab(0,track0->GetLabel()); | |
4842 | vertex.SetLab(1,track1->GetLabel()); | |
4843 | vertex.SetChi2After((densa0+densa1)*0.5); | |
4844 | vertex.SetChi2Before((densb0+densb1)*0.5); | |
4845 | vertex.SetIndex(0,i); | |
4846 | vertex.SetIndex(1,j); | |
4847 | vertex.SetStatus(1); // TPC v0 candidate | |
4848 | vertex.SetRp(track0->fTPCr); | |
4849 | vertex.SetRm(track1->fTPCr); | |
4850 | tpcv0s->AddLast(new AliESDV0MI(vertex)); | |
4851 | ncandidates++; | |
4852 | { | |
4853 | Int_t eventNr = esd->GetEventNumber(); | |
4854 | Double_t radiusm= (delta[0]<delta[1])? TMath::Sqrt(radius[0]):TMath::Sqrt(radius[1]); | |
4855 | Double_t deltam= (delta[0]<delta[1])? TMath::Sqrt(delta[0]):TMath::Sqrt(delta[1]); | |
4856 | cstream<<"V0"<< | |
4857 | "Event="<<eventNr<< | |
4858 | "vertex.="<<&vertex<< | |
4859 | "Tr0.="<<track0<< | |
4860 | "lab0="<<track0->fLab<< | |
4861 | "Helix0.="<<&helixes[i]<< | |
4862 | "Tr1.="<<track1<< | |
4863 | "lab1="<<track1->fLab<< | |
4864 | "Helix1.="<<&helixes[j]<< | |
4865 | "pointAngle="<<pointAngle<< | |
4866 | "pointAngle2="<<pointAngle2<< | |
4867 | "dca0="<<dca[i]<< | |
4868 | "dca1="<<dca[j]<< | |
4869 | "z0="<<z0[i]<< | |
4870 | "z1="<<z0[j]<< | |
4871 | "zvertex="<<zvertex<< | |
4872 | "circular0="<<track0->fCircular<< | |
4873 | "circular1="<<track1->fCircular<< | |
4874 | "npoints="<<npoints<< | |
4875 | "radius0="<<radius[0]<< | |
4876 | "delta0="<<delta[0]<< | |
4877 | "radius1="<<radius[1]<< | |
4878 | "delta1="<<delta[1]<< | |
4879 | "radiusm="<<radiusm<< | |
4880 | "deltam="<<deltam<< | |
4881 | "sdcar0="<<sdcar[i]<< | |
4882 | "sdcar1="<<sdcar[j]<< | |
4883 | "cdcar0="<<cdcar[i]<< | |
4884 | "cdcar1="<<cdcar[j]<< | |
4885 | "pulldcar0="<<pulldcar[i]<< | |
4886 | "pulldcar1="<<pulldcar[j]<< | |
4887 | "pulldcaz0="<<pulldcaz[i]<< | |
4888 | "pulldcaz1="<<pulldcaz[j]<< | |
4889 | "pulldca0="<<pulldca[i]<< | |
4890 | "pulldca1="<<pulldca[j]<< | |
4891 | "densb0="<<densb0<< | |
4892 | "densb1="<<densb1<< | |
4893 | "densa0="<<densa0<< | |
4894 | "densa1="<<densa1<< | |
4895 | "sigmae="<<sigmae<< | |
4896 | "\n"; | |
4897 | } | |
4898 | } | |
4899 | } | |
4900 | Float_t *quality = new Float_t[ncandidates]; | |
4901 | Int_t *indexes = new Int_t[ncandidates]; | |
4902 | Int_t naccepted =0; | |
4903 | for (Int_t i=0;i<ncandidates;i++){ | |
4904 | quality[i] = 0; | |
4905 | AliESDV0MI *v0 = (AliESDV0MI*)tpcv0s->At(i); | |
4906 | quality[i] = 1./(1.00001-v0->GetPointAngle()); //base point angle | |
4907 | // quality[i] /= (0.5+v0->GetDist2()); | |
4908 | // quality[i] *= v0->GetChi2After(); //density factor | |
4909 | Double_t minpulldca = TMath::Min(2.+pulldca[v0->GetIndex(0)],(2.+pulldca[v0->GetIndex(1)]) ); //pull | |
4910 | Int_t index0 = v0->GetIndex(0); | |
4911 | Int_t index1 = v0->GetIndex(1); | |
4912 | AliTPCseed * track0 = (AliTPCseed*)array->At(index0); | |
4913 | AliTPCseed * track1 = (AliTPCseed*)array->At(index1); | |
4914 | if (track0->fTPCr[0]>0.3&&track1->fTPCr[0]>0.3&&v0->GetAnglep()[2]<0.15) quality[i]+=1000000; // gamma conversion candidate | |
4915 | if (track0->fTPCr[4]>0.9||track1->fTPCr[4]>0.9&&minpulldca>4) quality[i]*=10; // lambda candidate candidate | |
4916 | } | |
4917 | ||
4918 | TMath::Sort(ncandidates,quality,indexes,kTRUE); | |
4919 | // | |
4920 | // | |
4921 | for (Int_t i=0;i<ncandidates;i++){ | |
4922 | AliESDV0MI * v0 = (AliESDV0MI*)tpcv0s->At(indexes[i]); | |
4923 | if (!v0) continue; | |
4924 | Int_t index0 = v0->GetIndex(0); | |
4925 | Int_t index1 = v0->GetIndex(1); | |
4926 | AliTPCseed * track0 = (AliTPCseed*)array->At(index0); | |
4927 | AliTPCseed * track1 = (AliTPCseed*)array->At(index1); | |
4928 | if (!track0||!track1) { | |
4929 | printf("Bug\n"); | |
4930 | continue; | |
4931 | } | |
4932 | Bool_t accept =kTRUE; //default accept | |
4933 | Int_t *v0indexes0 = track0->GetV0Indexes(); | |
4934 | Int_t *v0indexes1 = track1->GetV0Indexes(); | |
4935 | // | |
4936 | Int_t order0 = (v0indexes0[0]!=0) ? 1:0; | |
4937 | Int_t order1 = (v0indexes1[0]!=0) ? 1:0; | |
4938 | if (v0indexes0[1]!=0) order0 =2; | |
4939 | if (v0indexes1[1]!=0) order1 =2; | |
4940 | // | |
4941 | if (v0indexes0[2]!=0) {order0=3; accept=kFALSE;} | |
4942 | if (v0indexes0[2]!=0) {order1=3; accept=kFALSE;} | |
4943 | // | |
4944 | AliESDV0MI * v02 = v0; | |
4945 | if (accept){ | |
4946 | v0->SetOrder(0,order0); | |
4947 | v0->SetOrder(1,order1); | |
4948 | v0->SetOrder(1,order0+order1); | |
4949 | Int_t index = esd->AddV0MI(v0); | |
4950 | v02 = esd->GetV0MI(index); | |
4951 | v0indexes0[order0]=index; | |
4952 | v0indexes1[order1]=index; | |
4953 | naccepted++; | |
4954 | } | |
4955 | { | |
4956 | Int_t eventNr = esd->GetEventNumber(); | |
4957 | cstream<<"V02"<< | |
4958 | "Event="<<eventNr<< | |
4959 | "vertex.="<<v0<< | |
4960 | "vertex2.="<<v02<< | |
4961 | "Tr0.="<<track0<< | |
4962 | "lab0="<<track0->fLab<< | |
4963 | "Tr1.="<<track1<< | |
4964 | "lab1="<<track1->fLab<< | |
4965 | "dca0="<<dca[index0]<< | |
4966 | "dca1="<<dca[index1]<< | |
4967 | "order0="<<order0<< | |
4968 | "order1="<<order1<< | |
4969 | "accept="<<accept<< | |
4970 | "quality="<<quality[i]<< | |
4971 | "pulldca0="<<pulldca[index0]<< | |
4972 | "pulldca1="<<pulldca[index1]<< | |
4973 | "index="<<i<< | |
4974 | "\n"; | |
4975 | } | |
4976 | } | |
4977 | ||
4978 | ||
4979 | // | |
4980 | // | |
4981 | delete []quality; | |
4982 | delete []indexes; | |
4983 | // | |
4984 | delete [] isPrim; | |
4985 | delete [] pulldca; | |
4986 | delete [] pulldcaz; | |
4987 | delete [] pulldcar; | |
4988 | delete [] cdcar; | |
4989 | delete [] sdcar; | |
4990 | delete [] dca; | |
4991 | // | |
4992 | delete[] z0; | |
4993 | delete[] alpha; | |
4994 | delete[] sign; | |
4995 | delete[] helixes; | |
4996 | printf("TPC V0 finder : naccepted\t%d\tncandidates\t%d\tntracks\t%d\tnall\t%d\n",naccepted,ncandidates,ntracks,nall); | |
4997 | timer.Print(); | |
4998 | } | |
4999 | ||
eea478d3 | 5000 | Int_t AliTPCtrackerMI::RefitKink(AliTPCseed &mother, AliTPCseed &daughter, AliESDkink &kink) |
5001 | { | |
5002 | // | |
5003 | // refit kink towards to the vertex | |
5004 | // | |
5005 | // | |
5006 | Int_t row0 = GetRowNumber(kink.GetR()); | |
5007 | FollowProlongation(mother,0); | |
5008 | mother.Reset(kFALSE); | |
5009 | // | |
5010 | FollowProlongation(daughter,row0); | |
5011 | daughter.Reset(kFALSE); | |
5012 | FollowBackProlongation(daughter,158); | |
5013 | daughter.Reset(kFALSE); | |
5014 | Int_t first = TMath::Max(row0-20,30); | |
5015 | Int_t last = TMath::Min(row0+20,140); | |
5016 | // | |
5017 | const Int_t kNdiv =5; | |
5018 | AliTPCseed param0[kNdiv]; // parameters along the track | |
5019 | AliTPCseed param1[kNdiv]; // parameters along the track | |
5020 | AliESDkink kinks[kNdiv]; // corresponding kink parameters | |
5021 | // | |
5022 | Int_t rows[kNdiv]; | |
5023 | for (Int_t irow=0; irow<kNdiv;irow++){ | |
5024 | rows[irow] = first +((last-first)*irow)/(kNdiv-1); | |
5025 | } | |
5026 | // store parameters along the track | |
5027 | // | |
5028 | for (Int_t irow=0;irow<kNdiv;irow++){ | |
5029 | FollowBackProlongation(mother, rows[irow]); | |
5030 | FollowProlongation(daughter,rows[kNdiv-1-irow]); | |
5031 | new(¶m0[irow]) AliTPCseed(mother); | |
5032 | new(¶m1[kNdiv-1-irow]) AliTPCseed(daughter); | |
5033 | } | |
5034 | // | |
5035 | // define kinks | |
5036 | for (Int_t irow=0; irow<kNdiv-1;irow++){ | |
5037 | if (param0[irow].fN<kNdiv||param1[irow].fN<kNdiv) continue; | |
5038 | kinks[irow].SetMother(param0[irow]); | |
5039 | kinks[irow].SetDaughter(param1[irow]); | |
5040 | kinks[irow].Update(); | |
5041 | } | |
5042 | // | |
5043 | // choose kink with best "quality" | |
5044 | Int_t index =-1; | |
5045 | Double_t mindist = 10000; | |
5046 | for (Int_t irow=0;irow<kNdiv;irow++){ | |
5047 | if (param0[irow].fN<20||param1[irow].fN<20) continue; | |
5048 | if (TMath::Abs(kinks[irow].GetR())>240.) continue; | |
5049 | if (TMath::Abs(kinks[irow].GetR())<100.) continue; | |
5050 | // | |
5051 | Float_t normdist = TMath::Abs(param0[irow].fX-kinks[irow].GetR())*(0.1+kink.GetDistance()); | |
5052 | normdist/= (param0[irow].fN+param1[irow].fN+40.); | |
5053 | if (normdist < mindist){ | |
5054 | mindist = normdist; | |
5055 | index = irow; | |
5056 | } | |
5057 | } | |
5058 | // | |
5059 | if (index==-1) return 0; | |
5060 | // | |
5061 | // | |
5062 | param0[index].Reset(kTRUE); | |
5063 | FollowProlongation(param0[index],0); | |
5064 | // | |
5065 | new (&mother) AliTPCseed(param0[index]); | |
5066 | new (&daughter) AliTPCseed(param1[index]); // daughter in vertex | |
5067 | // | |
5068 | kink.SetMother(mother); | |
5069 | kink.SetDaughter(daughter); | |
5070 | kink.Update(); | |
5071 | kink.SetTPCRow0(GetRowNumber(kink.GetR())); | |
5072 | kink.SetTPCncls(param0[index].fN,0); | |
5073 | kink.SetTPCncls(param1[index].fN,1); | |
5074 | kink.SetLabel(CookLabel(&mother,0.4, 0,kink.GetTPCRow0()),0); | |
5075 | kink.SetLabel(CookLabel(&daughter,0.4, kink.GetTPCRow0(),160),1); | |
5076 | mother.SetLabel(kink.GetLabel(0)); | |
5077 | daughter.SetLabel(kink.GetLabel(1)); | |
5078 | ||
5079 | return 1; | |
5080 | } | |
51ad6848 | 5081 | |
5082 | ||
5083 | void AliTPCtrackerMI::UpdateKinkQualityM(AliTPCseed * seed){ | |
5084 | // | |
5085 | // update Kink quality information for mother after back propagation | |
5086 | // | |
5087 | if (seed->GetKinkIndex(0)>=0) return; | |
5088 | for (Int_t ikink=0;ikink<3;ikink++){ | |
5089 | Int_t index = seed->GetKinkIndex(ikink); | |
5090 | if (index>=0) break; | |
5091 | index = TMath::Abs(index)-1; | |
5092 | AliESDkink * kink = fEvent->GetKink(index); | |
eea478d3 | 5093 | //kink->fTPCdensity2[0][0]=-1; |
5094 | //kink->fTPCdensity2[0][1]=-1; | |
5095 | kink->SetTPCDensity2(-1,0,0); | |
5096 | kink->SetTPCDensity2(1,0,1); | |
51ad6848 | 5097 | // |
eea478d3 | 5098 | Int_t row0 = kink->GetTPCRow0() - 2 - Int_t( 0.5/ (0.05+kink->GetAngle(2))); |
51ad6848 | 5099 | if (row0<15) row0=15; |
5100 | // | |
eea478d3 | 5101 | Int_t row1 = kink->GetTPCRow0() + 2 + Int_t( 0.5/ (0.05+kink->GetAngle(2))); |
51ad6848 | 5102 | if (row1>145) row1=145; |
5103 | // | |
5104 | Int_t found,foundable,shared; | |
5105 | seed->GetClusterStatistic(0,row0, found, foundable,shared,kFALSE); | |
eea478d3 | 5106 | if (foundable>5) kink->SetTPCDensity2(Float_t(found)/Float_t(foundable),0,0); |
51ad6848 | 5107 | seed->GetClusterStatistic(row1,155, found, foundable,shared,kFALSE); |
eea478d3 | 5108 | if (foundable>5) kink->SetTPCDensity2(Float_t(found)/Float_t(foundable),0,1); |
51ad6848 | 5109 | } |
5110 | ||
5111 | } | |
5112 | ||
eea478d3 | 5113 | void AliTPCtrackerMI::UpdateKinkQualityD(AliTPCseed * seed){ |
91162307 | 5114 | // |
eea478d3 | 5115 | // update Kink quality information for daughter after refit |
91162307 | 5116 | // |
eea478d3 | 5117 | if (seed->GetKinkIndex(0)<=0) return; |
5118 | for (Int_t ikink=0;ikink<3;ikink++){ | |
5119 | Int_t index = seed->GetKinkIndex(ikink); | |
5120 | if (index<=0) break; | |
5121 | index = TMath::Abs(index)-1; | |
5122 | AliESDkink * kink = fEvent->GetKink(index); | |
5123 | kink->SetTPCDensity2(-1,1,0); | |
5124 | kink->SetTPCDensity2(-1,1,1); | |
91162307 | 5125 | // |
eea478d3 | 5126 | Int_t row0 = kink->GetTPCRow0() -2 - Int_t( 0.5/ (0.05+kink->GetAngle(2))); |
5127 | if (row0<15) row0=15; | |
5128 | // | |
5129 | Int_t row1 = kink->GetTPCRow0() +2 + Int_t( 0.5/ (0.05+kink->GetAngle(2))); | |
5130 | if (row1>145) row1=145; | |
5131 | // | |
5132 | Int_t found,foundable,shared; | |
5133 | seed->GetClusterStatistic(0,row0, found, foundable,shared,kFALSE); | |
5134 | if (foundable>5) kink->SetTPCDensity2(Float_t(found)/Float_t(foundable),1,0); | |
5135 | seed->GetClusterStatistic(row1,155, found, foundable,shared,kFALSE); | |
5136 | if (foundable>5) kink->SetTPCDensity2(Float_t(found)/Float_t(foundable),1,1); | |
91162307 | 5137 | } |
eea478d3 | 5138 | |
5139 | } | |
5140 | ||
5141 | ||
5142 | Int_t AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed,AliTPCseed &mother, AliTPCseed &daughter, AliESDkink &kink) | |
5143 | { | |
91162307 | 5144 | // |
eea478d3 | 5145 | // check kink point for given track |
5146 | // if return value=0 kink point not found | |
5147 | // otherwise seed0 correspond to mother particle | |
5148 | // seed1 correspond to daughter particle | |
5149 | // kink parameter of kink point | |
91162307 | 5150 | |
eea478d3 | 5151 | Int_t middlerow = (seed->fFirstPoint+seed->fLastPoint)/2; |
5152 | Int_t first = seed->fFirstPoint; | |
5153 | Int_t last = seed->fLastPoint; | |
5154 | if (last-first<20) return 0; // shortest length - 2*30 = 60 pad-rows | |
91162307 | 5155 | |
eea478d3 | 5156 | |
5157 | AliTPCseed *seed1 = ReSeed(seed,middlerow+20, kTRUE); //middle of chamber | |
5158 | if (!seed1) return 0; | |
5159 | FollowProlongation(*seed1,seed->fLastPoint-20); | |
5160 | seed1->Reset(kTRUE); | |
5161 | FollowProlongation(*seed1,158); | |
5162 | seed1->Reset(kTRUE); | |
5163 | last = seed1->fLastPoint; | |
5164 | // | |
5165 | AliTPCseed *seed0 = new AliTPCseed(*seed); | |
5166 | seed0->Reset(kFALSE); | |
5167 | seed0->Reset(); | |
5168 | // | |
5169 | AliTPCseed param0[20]; // parameters along the track | |
5170 | AliTPCseed param1[20]; // parameters along the track | |
5171 | AliESDkink kinks[20]; // corresponding kink parameters | |
5172 | Int_t rows[20]; | |
5173 | for (Int_t irow=0; irow<20;irow++){ | |
5174 | rows[irow] = first +((last-first)*irow)/19; | |
5175 | } | |
5176 | // store parameters along the track | |
5177 | // | |
5178 | for (Int_t irow=0;irow<20;irow++){ | |
5179 | FollowBackProlongation(*seed0, rows[irow]); | |
5180 | FollowProlongation(*seed1,rows[19-irow]); | |
5181 | new(¶m0[irow]) AliTPCseed(*seed0); | |
5182 | new(¶m1[19-irow]) AliTPCseed(*seed1); | |
5183 | } | |
5184 | // | |
5185 | // define kinks | |
5186 | for (Int_t irow=0; irow<19;irow++){ | |
5187 | kinks[irow].SetMother(param0[irow]); | |
5188 | kinks[irow].SetDaughter(param1[irow]); | |
5189 | kinks[irow].Update(); | |
5190 | } | |
5191 | // | |
5192 | // choose kink with biggest change of angle | |
5193 | Int_t index =-1; | |
5194 | Double_t maxchange= 0; | |
5195 | for (Int_t irow=1;irow<19;irow++){ | |
5196 | if (TMath::Abs(kinks[irow].GetR())>240.) continue; | |
5197 | if (TMath::Abs(kinks[irow].GetR())<110.) continue; | |
5198 | Float_t quality = TMath::Abs(kinks[irow].GetAngle(2))/(3.+TMath::Abs(kinks[irow].GetR()-param0[irow].fX)); | |
5199 | if ( quality > maxchange){ | |
5200 | maxchange = quality; | |
5201 | index = irow; | |
5202 | // | |
91162307 | 5203 | } |
5204 | } | |
eea478d3 | 5205 | delete seed0; |
5206 | delete seed1; | |
5207 | if (index<0) return 0; | |
5208 | // | |
5209 | Int_t row0 = GetRowNumber(kinks[index].GetR()); //row 0 estimate | |
5210 | seed0 = new AliTPCseed(param0[index]); | |
5211 | seed1 = new AliTPCseed(param1[index]); | |
5212 | seed0->Reset(kFALSE); | |
5213 | seed1->Reset(kFALSE); | |
5214 | seed0->ResetCovariance(); | |
5215 | seed1->ResetCovariance(); | |
5216 | FollowProlongation(*seed0,0); | |
5217 | FollowBackProlongation(*seed1,158); | |
5218 | new (&mother) AliTPCseed(*seed0); // backup mother at position 0 | |
5219 | seed0->Reset(kFALSE); | |
5220 | seed1->Reset(kFALSE); | |
5221 | seed0->ResetCovariance(); | |
5222 | seed1->ResetCovariance(); | |
5223 | // | |
5224 | first = TMath::Max(row0-20,0); | |
5225 | last = TMath::Min(row0+20,158); | |
5226 | // | |
5227 | for (Int_t irow=0; irow<20;irow++){ | |
5228 | rows[irow] = first +((last-first)*irow)/19; | |
5229 | } | |
5230 | // store parameters along the track | |
5231 | // | |
5232 | for (Int_t irow=0;irow<20;irow++){ | |
5233 | FollowBackProlongation(*seed0, rows[irow]); | |
5234 | FollowProlongation(*seed1,rows[19-irow]); | |
5235 | new(¶m0[irow]) AliTPCseed(*seed0); | |
5236 | new(¶m1[19-irow]) AliTPCseed(*seed1); | |
5237 | } | |
5238 | // | |
5239 | // define kinks | |
5240 | for (Int_t irow=0; irow<19;irow++){ | |
5241 | kinks[irow].SetMother(param0[irow]); | |
5242 | kinks[irow].SetDaughter(param1[irow]); | |
5243 | // param0[irow].Dump(); | |
5244 | //param1[irow].Dump(); | |
5245 | kinks[irow].Update(); | |
5246 | } | |
5247 | // | |
5248 | // choose kink with biggest change of angle | |
5249 | index =-1; | |
5250 | maxchange= 0; | |
5251 | for (Int_t irow=0;irow<20;irow++){ | |
5252 | if (TMath::Abs(kinks[irow].GetR())>250.) continue; | |
5253 | if (TMath::Abs(kinks[irow].GetR())<90.) continue; | |
5254 | Float_t quality = TMath::Abs(kinks[irow].GetAngle(2))/(3.+TMath::Abs(kinks[irow].GetR()-param0[irow].fX)); | |
5255 | if ( quality > maxchange){ | |
5256 | maxchange = quality; | |
5257 | index = irow; | |
5258 | // | |
91162307 | 5259 | } |
5260 | } | |
5261 | // | |
5262 | // | |
eea478d3 | 5263 | if (index==-1 || param0[index].fN+param1[index].fN<100){ |
5264 | delete seed0; | |
5265 | delete seed1; | |
5266 | return 0; | |
1627d1c4 | 5267 | } |
eea478d3 | 5268 | // Float_t anglesigma = TMath::Sqrt(param0[index].fC22+param0[index].fC33+param1[index].fC22+param1[index].fC33); |
1627d1c4 | 5269 | |
eea478d3 | 5270 | kink.SetMother(param0[index]); |
5271 | kink.SetDaughter(param1[index]); | |
5272 | kink.Update(); | |
5273 | row0 = GetRowNumber(kink.GetR()); | |
5274 | kink.SetTPCRow0(row0); | |
5275 | kink.SetLabel(CookLabel(seed0,0.5,0,row0),0); | |
5276 | kink.SetLabel(CookLabel(seed1,0.5,row0,158),1); | |
5277 | kink.SetIndex(-10,0); | |
5278 | kink.SetIndex(int(param0[index].fN+param1[index].fN),1); | |
5279 | kink.SetTPCncls(param0[index].fN,0); | |
5280 | kink.SetTPCncls(param1[index].fN,1); | |
5281 | // | |
5282 | // | |
5283 | // new (&mother) AliTPCseed(param0[index]); | |
5284 | new (&daughter) AliTPCseed(param1[index]); | |
5285 | daughter.SetLabel(kink.GetLabel(1)); | |
5286 | param0[index].Reset(kTRUE); | |
5287 | FollowProlongation(param0[index],0); | |
5288 | new (&mother) AliTPCseed(param0[index]); | |
5289 | mother.SetLabel(kink.GetLabel(0)); | |
5290 | delete seed0; | |
5291 | delete seed1; | |
5292 | // | |
5293 | return 1; | |
1627d1c4 | 5294 | } |
5295 | ||
5296 | ||
5297 | ||
5298 | ||
91162307 | 5299 | AliTPCseed* AliTPCtrackerMI::ReSeed(AliTPCseed *t) |
5300 | { | |
5301 | // | |
5302 | // reseed - refit - track | |
5303 | // | |
5304 | Int_t first = 0; | |
5305 | // Int_t last = fSectors->GetNRows()-1; | |
5306 | // | |
5307 | if (fSectors == fOuterSec){ | |
5308 | first = TMath::Max(first, t->fFirstPoint-fInnerSec->GetNRows()); | |
5309 | //last = | |
5310 | } | |
5311 | else | |
5312 | first = t->fFirstPoint; | |
5313 | // | |
5314 | AliTPCseed * seed = MakeSeed(t,0.1,0.5,0.9); | |
5315 | FollowBackProlongation(*t,fSectors->GetNRows()-1); | |
5316 | t->Reset(kFALSE); | |
5317 | FollowProlongation(*t,first); | |
5318 | return seed; | |
5319 | } | |
5320 | ||
5321 | ||
5322 | ||
5323 | ||
5324 | ||
5325 | ||
5326 | ||
1c53abe2 | 5327 | //_____________________________________________________________________________ |
5328 | Int_t AliTPCtrackerMI::ReadSeeds(const TFile *inp) { | |
5329 | //----------------------------------------------------------------- | |
5330 | // This function reades track seeds. | |
5331 | //----------------------------------------------------------------- | |
5332 | TDirectory *savedir=gDirectory; | |
5333 | ||
5334 | TFile *in=(TFile*)inp; | |
5335 | if (!in->IsOpen()) { | |
5336 | cerr<<"AliTPCtrackerMI::ReadSeeds(): input file is not open !\n"; | |
5337 | return 1; | |
5338 | } | |
5339 | ||
5340 | in->cd(); | |
5341 | TTree *seedTree=(TTree*)in->Get("Seeds"); | |
5342 | if (!seedTree) { | |
5343 | cerr<<"AliTPCtrackerMI::ReadSeeds(): "; | |
5344 | cerr<<"can't get a tree with track seeds !\n"; | |
5345 | return 2; | |
5346 | } | |
5347 | AliTPCtrack *seed=new AliTPCtrack; | |
5348 | seedTree->SetBranchAddress("tracks",&seed); | |
5349 | ||
5350 | if (fSeeds==0) fSeeds=new TObjArray(15000); | |
5351 | ||
5352 | Int_t n=(Int_t)seedTree->GetEntries(); | |
5353 | for (Int_t i=0; i<n; i++) { | |
5354 | seedTree->GetEvent(i); | |
bbc6cd2c | 5355 | fSeeds->AddLast(new AliTPCseed(*seed/*,seed->GetAlpha()*/)); |
1c53abe2 | 5356 | } |
5357 | ||
5358 | delete seed; | |
5359 | delete seedTree; | |
5360 | savedir->cd(); | |
5361 | return 0; | |
5362 | } | |
5363 | ||
d26d9159 | 5364 | Int_t AliTPCtrackerMI::Clusters2Tracks (AliESD *esd) |
5365 | { | |
5366 | // | |
d9b8978b | 5367 | if (fSeeds) DeleteSeeds(); |
d26d9159 | 5368 | fEvent = esd; |
5369 | Clusters2Tracks(); | |
5370 | if (!fSeeds) return 1; | |
5371 | FillESD(fSeeds); | |
5372 | return 0; | |
5373 | // | |
5374 | } | |
5375 | ||
5376 | ||
1c53abe2 | 5377 | //_____________________________________________________________________________ |
f8aae377 | 5378 | Int_t AliTPCtrackerMI::Clusters2Tracks() { |
1c53abe2 | 5379 | //----------------------------------------------------------------- |
5380 | // This is a track finder. | |
5381 | //----------------------------------------------------------------- | |
91162307 | 5382 | TDirectory *savedir=gDirectory; |
1c53abe2 | 5383 | TStopwatch timer; |
d26d9159 | 5384 | |
91162307 | 5385 | fIteration = 0; |
5386 | fSeeds = Tracking(); | |
1c53abe2 | 5387 | |
6bdc18d6 | 5388 | if (fDebug>0){ |
5389 | Info("Clusters2Tracks","Time for tracking: \t");timer.Print();timer.Start(); | |
5390 | } | |
91162307 | 5391 | //activate again some tracks |
5392 | for (Int_t i=0; i<fSeeds->GetEntriesFast(); i++) { | |
5393 | AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t=*pt; | |
5394 | if (!pt) continue; | |
5395 | Int_t nc=t.GetNumberOfClusters(); | |
5396 | if (nc<20) { | |
5397 | delete fSeeds->RemoveAt(i); | |
5398 | continue; | |
eea478d3 | 5399 | } |
5400 | CookLabel(pt,0.1); | |
91162307 | 5401 | if (pt->fRemoval==10) { |
5402 | if (pt->GetDensityFirst(20)>0.8 || pt->GetDensityFirst(30)>0.8 || pt->GetDensityFirst(40)>0.7) | |
5403 | pt->Desactivate(10); // make track again active | |
5404 | else{ | |
5405 | pt->Desactivate(20); | |
5406 | delete fSeeds->RemoveAt(i); | |
5407 | } | |
5408 | } | |
5409 | } | |
51ad6848 | 5410 | // |
5411 | RemoveUsed2(fSeeds,0.85,0.85,0); | |
5412 | FindKinks(fSeeds,fEvent); | |
81e97e0d | 5413 | RemoveUsed2(fSeeds,0.5,0.4,20); |
5414 | // // | |
5415 | // // refit short tracks | |
5416 | // // | |
5417 | Int_t nseed=fSeeds->GetEntriesFast(); | |
5418 | // for (Int_t i=0; i<nseed; i++) { | |
5419 | // AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t=*pt; | |
5420 | // if (!pt) continue; | |
5421 | // Int_t nc=t.GetNumberOfClusters(); | |
5422 | // if (nc<15) { | |
5423 | // delete fSeeds->RemoveAt(i); | |
5424 | // continue; | |
5425 | // } | |
5426 | // if (pt->GetKinkIndexes()[0]!=0) continue; // ignore kink candidates | |
5427 | // if (nc>100) continue; // hopefully, enough for ITS | |
5428 | // AliTPCseed *seed2 = new AliTPCseed(*pt); | |
5429 | // //seed2->Reset(kFALSE); | |
5430 | // //pt->ResetCovariance(); | |
5431 | // seed2->Modify(1); | |
5432 | // FollowBackProlongation(*seed2,158); | |
5433 | // //seed2->Reset(kFALSE); | |
5434 | // seed2->Modify(10); | |
5435 | // FollowProlongation(*seed2,0); | |
5436 | // TTreeSRedirector &cstream = *fDebugStreamer; | |
5437 | // cstream<<"Crefit"<< | |
5438 | // "Tr0.="<<pt<< | |
5439 | // "Tr1.="<<seed2<< | |
5440 | // "\n"; | |
5441 | // if (seed2->fN>pt->fN){ | |
5442 | // delete fSeeds->RemoveAt(i); | |
5443 | // fSeeds->AddAt(seed2,i); | |
5444 | // }else{ | |
5445 | // delete seed2; | |
5446 | // } | |
5447 | // } | |
5448 | // RemoveUsed2(fSeeds,0.6,0.6,50); | |
5449 | ||
5450 | // FindV0s(fSeeds,fEvent); | |
51ad6848 | 5451 | //RemoveDouble(fSeeds,0.2,0.6,11); |
c9427e08 | 5452 | |
1c53abe2 | 5453 | // |
91162307 | 5454 | Int_t found = 0; |
5455 | for (Int_t i=0; i<nseed; i++) { | |
5456 | AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t=*pt; | |
5457 | if (!pt) continue; | |
5458 | Int_t nc=t.GetNumberOfClusters(); | |
5459 | if (nc<15) { | |
5460 | delete fSeeds->RemoveAt(i); | |
5461 | continue; | |
5462 | } | |
5463 | CookLabel(pt,0.1); //For comparison only | |
5464 | //if ((pt->IsActive() || (pt->fRemoval==10) )&& nc>50 &&pt->GetNumberOfClusters()>0.4*pt->fNFoundable){ | |
5465 | if ((pt->IsActive() || (pt->fRemoval==10) )){ | |
d9b8978b | 5466 | found++; |
5467 | if (fDebug>0) cerr<<found<<'\r'; | |
d26d9159 | 5468 | pt->fLab2 = i; |
91162307 | 5469 | } |
5470 | else | |
5471 | delete fSeeds->RemoveAt(i); | |
91162307 | 5472 | } |
5473 | ||
5474 | ||
5475 | //RemoveOverlap(fSeeds,0.99,7,kTRUE); | |
5476 | SignShared(fSeeds); | |
5477 | //RemoveUsed(fSeeds,0.9,0.9,6); | |
1c53abe2 | 5478 | // |
91162307 | 5479 | nseed=fSeeds->GetEntriesFast(); |
5480 | found = 0; | |
5481 | for (Int_t i=0; i<nseed; i++) { | |
5482 | AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t=*pt; | |
5483 | if (!pt) continue; | |
5484 | Int_t nc=t.GetNumberOfClusters(); | |
5485 | if (nc<15) { | |
5486 | delete fSeeds->RemoveAt(i); | |
5487 | continue; | |
5488 | } | |
5489 | t.SetUniqueID(i); | |
5490 | t.CookdEdx(0.02,0.6); | |
5491 | // CheckKinkPoint(&t,0.05); | |
5492 | //if ((pt->IsActive() || (pt->fRemoval==10) )&& nc>50 &&pt->GetNumberOfClusters()>0.4*pt->fNFoundable){ | |
5493 | if ((pt->IsActive() || (pt->fRemoval==10) )){ | |
6bdc18d6 | 5494 | found++; |
5495 | if (fDebug>0){ | |
5496 | cerr<<found<<'\r'; | |
5497 | } | |
d26d9159 | 5498 | pt->fLab2 = i; |
91162307 | 5499 | } |
5500 | else | |
5501 | delete fSeeds->RemoveAt(i); | |
d26d9159 | 5502 | //AliTPCseed * seed1 = ReSeed(pt,0.05,0.5,1); |
5503 | //if (seed1){ | |
5504 | // FollowProlongation(*seed1,0); | |
5505 | // Int_t n = seed1->GetNumberOfClusters(); | |
5506 | // printf("fP4\t%f\t%f\n",seed1->GetC(),pt->GetC()); | |
5507 | // printf("fN\t%d\t%d\n", seed1->GetNumberOfClusters(),pt->GetNumberOfClusters()); | |
5508 | // | |
5509 | //} | |
5510 | //AliTPCseed * seed2 = ReSeed(pt,0.95,0.5,0.05); | |
5511 | ||
91162307 | 5512 | } |
5513 | ||
5514 | SortTracks(fSeeds, 1); | |
1c53abe2 | 5515 | |
982aff31 | 5516 | /* |
91162307 | 5517 | fIteration = 1; |
982aff31 | 5518 | PrepareForBackProlongation(fSeeds,5.); |
91162307 | 5519 | PropagateBack(fSeeds); |
5520 | printf("Time for back propagation: \t");timer.Print();timer.Start(); | |
5521 | ||
5522 | fIteration = 2; | |
1c53abe2 | 5523 | |
982aff31 | 5524 | PrepareForProlongation(fSeeds,5.); |
5525 | PropagateForward2(fSeeds); | |
d26d9159 | 5526 | |
91162307 | 5527 | printf("Time for FORWARD propagation: \t");timer.Print();timer.Start(); |
5528 | // RemoveUsed(fSeeds,0.7,0.7,6); | |
5529 | //RemoveOverlap(fSeeds,0.9,7,kTRUE); | |
d26d9159 | 5530 | |
1c53abe2 | 5531 | nseed=fSeeds->GetEntriesFast(); |
91162307 | 5532 | found = 0; |
5533 | for (Int_t i=0; i<nseed; i++) { | |
1c53abe2 | 5534 | AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t=*pt; |
5535 | if (!pt) continue; | |
5536 | Int_t nc=t.GetNumberOfClusters(); | |
91162307 | 5537 | if (nc<15) { |
5538 | delete fSeeds->RemoveAt(i); | |
5539 | continue; | |
5540 | } | |
1c53abe2 | 5541 | t.CookdEdx(0.02,0.6); |
91162307 | 5542 | // CookLabel(pt,0.1); //For comparison only |
5543 | //if ((pt->IsActive() || (pt->fRemoval==10) )&& nc>50 &&pt->GetNumberOfClusters()>0.4*pt->fNFoundable){ | |
5544 | if ((pt->IsActive() || (pt->fRemoval==10) )){ | |
5545 | cerr<<found++<<'\r'; | |
5546 | } | |
5547 | else | |
5548 | delete fSeeds->RemoveAt(i); | |
5549 | pt->fLab2 = i; | |
1c53abe2 | 5550 | } |
91162307 | 5551 | */ |
5552 | ||
c9427e08 | 5553 | // fNTracks = found; |
6bdc18d6 | 5554 | if (fDebug>0){ |
5555 | Info("Clusters2Tracks","Time for overlap removal, track writing and dedx cooking: \t"); timer.Print();timer.Start(); | |
5556 | } | |
91162307 | 5557 | // |
6bdc18d6 | 5558 | // cerr<<"Number of found tracks : "<<"\t"<<found<<endl; |
5559 | Info("Clusters2Tracks","Number of found tracks %d",found); | |
91162307 | 5560 | savedir->cd(); |
91162307 | 5561 | // UnloadClusters(); |
d26d9159 | 5562 | // |
1c53abe2 | 5563 | return 0; |
5564 | } | |
5565 | ||
91162307 | 5566 | void AliTPCtrackerMI::Tracking(TObjArray * arr) |
5567 | { | |
5568 | // | |
5569 | // tracking of the seeds | |
5570 | // | |
5571 | ||
5572 | fSectors = fOuterSec; | |
5573 | ParallelTracking(arr,150,63); | |
5574 | fSectors = fOuterSec; | |
5575 | ParallelTracking(arr,63,0); | |
5576 | } | |
5577 | ||
5578 | TObjArray * AliTPCtrackerMI::Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_t cuts[4], Float_t dy, Int_t dsec) | |
5579 | { | |
5580 | // | |
5581 | // | |
5582 | //tracking routine | |
5583 | TObjArray * arr = new TObjArray; | |
5584 | // | |
5585 | fSectors = fOuterSec; | |
5586 | TStopwatch timer; | |
5587 | timer.Start(); | |
5588 | for (Int_t sec=0;sec<fkNOS;sec++){ | |
5589 | if (seedtype==3) MakeSeeds3(arr,sec,i1,i2,cuts,dy, dsec); | |
5590 | if (seedtype==4) MakeSeeds5(arr,sec,i1,i2,cuts,dy); | |
5591 | if (seedtype==2) MakeSeeds2(arr,sec,i1,i2,cuts,dy); | |
5592 | } | |
5593 | if (fDebug>0){ | |
6bdc18d6 | 5594 | Info("Tracking","\nSeeding - %d\t%d\t%d\t%d\n",seedtype,i1,i2,arr->GetEntriesFast()); |
91162307 | 5595 | timer.Print(); |
5596 | timer.Start(); | |
5597 | } | |
5598 | Tracking(arr); | |
5599 | if (fDebug>0){ | |
5600 | timer.Print(); | |
5601 | } | |
5602 | ||
5603 | return arr; | |
5604 | } | |
5605 | ||
5606 | TObjArray * AliTPCtrackerMI::Tracking() | |
5607 | { | |
5608 | // | |
5609 | // | |
5610 | TStopwatch timer; | |
5611 | timer.Start(); | |
5612 | Int_t nup=fOuterSec->GetNRows()+fInnerSec->GetNRows(); | |
5613 | ||
5614 | TObjArray * seeds = new TObjArray; | |
5615 | TObjArray * arr=0; | |
5616 | ||
5617 | Int_t gap =20; | |
5618 | Float_t cuts[4]; | |
5619 | cuts[0] = 0.002; | |
5620 | cuts[1] = 1.5; | |
5621 | cuts[2] = 3.; | |
5622 | cuts[3] = 3.; | |
5623 | Float_t fnumber = 3.0; | |
5624 | Float_t fdensity = 3.0; | |
5625 | ||
5626 | // | |
5627 | //find primaries | |
5628 | cuts[0]=0.0066; | |
5629 | for (Int_t delta = 0; delta<18; delta+=6){ | |
5630 | // | |
5631 | cuts[0]=0.0070; | |
5632 | cuts[1] = 1.5; | |
5633 | arr = Tracking(3,nup-1-delta,nup-1-delta-gap,cuts,-1,1); | |
5634 | SumTracks(seeds,arr); | |
5635 | SignClusters(seeds,fnumber,fdensity); | |
5636 | // | |
5637 | for (Int_t i=2;i<6;i+=2){ | |
5638 | // seed high pt tracks | |
5639 | cuts[0]=0.0022; | |
5640 | cuts[1]=0.3; | |
5641 | arr = Tracking(3,nup-i-delta,nup-i-delta-gap,cuts,-1,0); | |
5642 | SumTracks(seeds,arr); | |
5643 | SignClusters(seeds,fnumber,fdensity); | |
5644 | } | |
5645 | } | |
5646 | fnumber = 4; | |
5647 | fdensity = 4.; | |
5648 | // RemoveUsed(seeds,0.9,0.9,1); | |
5649 | // UnsignClusters(); | |
5650 | // SignClusters(seeds,fnumber,fdensity); | |
5651 | ||
5652 | //find primaries | |
5653 | cuts[0]=0.0077; | |
5654 | for (Int_t delta = 20; delta<120; delta+=10){ | |
5655 | // | |
5656 | // seed high pt tracks | |
5657 | cuts[0]=0.0060; | |
5658 | cuts[1]=0.3; | |
5659 | cuts[2]=6.; | |
5660 | arr = Tracking(3,nup-delta,nup-delta-gap,cuts,-1); | |
5661 | SumTracks(seeds,arr); | |
5662 | SignClusters(seeds,fnumber,fdensity); | |
5663 | ||
5664 | cuts[0]=0.003; | |
5665 | cuts[1]=0.3; | |
5666 | cuts[2]=6.; | |
5667 | arr = Tracking(3,nup-delta-5,nup-delta-5-gap,cuts,-1); | |
5668 | SumTracks(seeds,arr); | |
5669 | SignClusters(seeds,fnumber,fdensity); | |
5670 | } | |
5671 | ||
5672 | cuts[0] = 0.01; | |
5673 | cuts[1] = 2.0; | |
5674 | cuts[2] = 3.; | |
5675 | cuts[3] = 2.0; | |
5676 | fnumber = 2.; | |
5677 | fdensity = 2.; | |
5678 | ||
5679 | if (fDebug>0){ | |
6bdc18d6 | 5680 | Info("Tracking()","\n\nPrimary seeding\t%d\n\n",seeds->GetEntriesFast()); |
91162307 | 5681 | timer.Print(); |
5682 | timer.Start(); | |
5683 | } | |
5684 | // RemoveUsed(seeds,0.75,0.75,1); | |
5685 | //UnsignClusters(); | |
5686 | //SignClusters(seeds,fnumber,fdensity); | |
5687 | ||
5688 | // find secondaries | |
5689 | ||
5690 | cuts[0] = 0.3; | |
5691 | cuts[1] = 1.5; | |
5692 | cuts[2] = 3.; | |
5693 | cuts[3] = 1.5; | |
5694 | ||
5695 | arr = Tracking(4,nup-1,nup-1-gap,cuts,-1); | |
5696 | SumTracks(seeds,arr); | |
5697 | SignClusters(seeds,fnumber,fdensity); | |
5698 | // | |
5699 | arr = Tracking(4,nup-2,nup-2-gap,cuts,-1); | |
5700 | SumTracks(seeds,arr); | |
5701 | SignClusters(seeds,fnumber,fdensity); | |
5702 | // | |
5703 | arr = Tracking(4,nup-3,nup-3-gap,cuts,-1); | |
5704 | SumTracks(seeds,arr); | |
5705 | SignClusters(seeds,fnumber,fdensity); | |
5706 | // | |
5707 | ||
5708 | ||
5709 | for (Int_t delta = 3; delta<30; delta+=5){ | |
5710 | // | |
5711 | cuts[0] = 0.3; | |
5712 | cuts[1] = 1.5; | |
5713 | cuts[2] = 3.; | |
5714 | cuts[3] = 1.5; | |
5715 | arr = Tracking(4,nup-1-delta,nup-1-delta-gap,cuts,-1); | |
5716 | SumTracks(seeds,arr); | |
5717 | SignClusters(seeds,fnumber,fdensity); | |
5718 | // | |
5719 | arr = Tracking(4,nup-3-delta,nup-5-delta-gap,cuts,4); | |
5720 | SumTracks(seeds,arr); | |
5721 | SignClusters(seeds,fnumber,fdensity); | |
5722 | // | |
5723 | } | |
5724 | fnumber = 1; | |
5725 | fdensity = 1; | |
5726 | // | |
5727 | // change cuts | |
5728 | fnumber = 2.; | |
5729 | fdensity = 2.; | |
5730 | cuts[0]=0.0080; | |
5731 | ||
5732 | // find secondaries | |
2bd61959 | 5733 | for (Int_t delta = 30; delta<90; delta+=10){ |
91162307 | 5734 | // |
5735 | cuts[0] = 0.3; | |
2bd61959 | 5736 | cuts[1] = 3.5; |
91162307 | 5737 | cuts[2] = 3.; |
2bd61959 | 5738 | cuts[3] = 3.5; |
91162307 | 5739 | arr = Tracking(4,nup-1-delta,nup-1-delta-gap,cuts,-1); |
5740 | SumTracks(seeds,arr); | |
5741 | SignClusters(seeds,fnumber,fdensity); | |
5742 | // | |
5743 | arr = Tracking(4,nup-5-delta,nup-5-delta-gap,cuts,5 ); | |
5744 | SumTracks(seeds,arr); | |
5745 | SignClusters(seeds,fnumber,fdensity); | |
5746 | } | |
5747 | ||
5748 | if (fDebug>0){ | |
6bdc18d6 | 5749 | Info("Tracking()","\n\nSecondary seeding\t%d\n\n",seeds->GetEntriesFast()); |
91162307 | 5750 | timer.Print(); |
5751 | timer.Start(); | |
5752 | } | |
5753 | ||
5754 | return seeds; | |
5755 | // | |
5756 | ||
5757 | } | |
5758 | ||
5759 | ||
47966a6d | 5760 | void AliTPCtrackerMI::SumTracks(TObjArray *arr1,TObjArray *arr2) const |
91162307 | 5761 | { |
5762 | // | |
5763 | //sum tracks to common container | |
5764 | //remove suspicious tracks | |
5765 | Int_t nseed = arr2->GetEntriesFast(); | |
5766 | for (Int_t i=0;i<nseed;i++){ | |
5767 | AliTPCseed *pt=(AliTPCseed*)arr2->UncheckedAt(i); | |
5768 | if (pt){ | |
ca142b1f | 5769 | // REMOVE VERY SHORT TRACKS |
5770 | if (pt->GetNumberOfClusters()<20){ | |
5771 | delete arr2->RemoveAt(i); | |
5772 | continue; | |
5773 | }// patch 28 fev06 | |
91162307 | 5774 | // NORMAL ACTIVE TRACK |
5775 | if (pt->IsActive()){ | |
5776 | arr1->AddLast(arr2->RemoveAt(i)); | |
5777 | continue; | |
5778 | } | |
5779 | //remove not usable tracks | |
5780 | if (pt->fRemoval!=10){ | |
5781 | delete arr2->RemoveAt(i); | |
5782 | continue; | |
5783 | } | |
ca142b1f | 5784 | |
91162307 | 5785 | // ENABLE ONLY ENOUGH GOOD STOPPED TRACKS |
5786 | if (pt->GetDensityFirst(20)>0.8 || pt->GetDensityFirst(30)>0.8 || pt->GetDensityFirst(40)>0.7) | |
5787 | arr1->AddLast(arr2->RemoveAt(i)); | |
5788 | else{ | |
5789 | delete arr2->RemoveAt(i); | |
5790 | } | |
5791 | } | |
5792 | } | |
5793 | delete arr2; | |
5794 | } | |
5795 | ||
5796 | ||
1c53abe2 | 5797 | |
91162307 | 5798 | void AliTPCtrackerMI::ParallelTracking(TObjArray * arr, Int_t rfirst, Int_t rlast) |
1c53abe2 | 5799 | { |
5800 | // | |
5801 | // try to track in parralel | |
5802 | ||
91162307 | 5803 | Int_t nseed=arr->GetEntriesFast(); |
1c53abe2 | 5804 | //prepare seeds for tracking |
5805 | for (Int_t i=0; i<nseed; i++) { | |
91162307 | 5806 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i), &t=*pt; |
1c53abe2 | 5807 | if (!pt) continue; |
5808 | if (!t.IsActive()) continue; | |
5809 | // follow prolongation to the first layer | |
91162307 | 5810 | if ( (fSectors ==fInnerSec) || (t.fFirstPoint-fParam->GetNRowLow()>rfirst+1) ) |
c9427e08 | 5811 | FollowProlongation(t, rfirst+1); |
1c53abe2 | 5812 | } |
5813 | ||
5814 | ||
5815 | // | |
982aff31 | 5816 | for (Int_t nr=rfirst; nr>=rlast; nr--){ |
5817 | if (nr<fInnerSec->GetNRows()) | |
5818 | fSectors = fInnerSec; | |
5819 | else | |
5820 | fSectors = fOuterSec; | |
1c53abe2 | 5821 | // make indexes with the cluster tracks for given |
1c53abe2 | 5822 | |
5823 | // find nearest cluster | |
5824 | for (Int_t i=0; i<nseed; i++) { | |
91162307 | 5825 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i), &t=*pt; |
1c53abe2 | 5826 | if (!pt) continue; |
51ad6848 | 5827 | if (nr==80) pt->UpdateReference(); |
1c53abe2 | 5828 | if (!pt->IsActive()) continue; |
91162307 | 5829 | // if ( (fSectors ==fOuterSec) && (pt->fFirstPoint-fParam->GetNRowLow())<nr) continue; |
1627d1c4 | 5830 | if (pt->fRelativeSector>17) { |
5831 | continue; | |
5832 | } | |
91162307 | 5833 | UpdateClusters(t,nr); |
1c53abe2 | 5834 | } |
5835 | // prolonagate to the nearest cluster - if founded | |
5836 | for (Int_t i=0; i<nseed; i++) { | |
91162307 | 5837 | AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i); |
1c53abe2 | 5838 | if (!pt) continue; |
1627d1c4 | 5839 | if (!pt->IsActive()) continue; |
91162307 | 5840 | // if ((fSectors ==fOuterSec) && (pt->fFirstPoint-fParam->GetNRowLow())<nr) continue; |
1627d1c4 | 5841 | if (pt->fRelativeSector>17) { |
5842 | continue; | |
5843 | } | |
91162307 | 5844 | FollowToNextCluster(*pt,nr); |
1c53abe2 | 5845 | } |
91162307 | 5846 | } |
5847 | } | |
5848 | ||
47966a6d | 5849 | void AliTPCtrackerMI::PrepareForBackProlongation(TObjArray * arr,Float_t fac) const |
91162307 | 5850 | { |
5851 | // | |
5852 | // | |
5853 | // if we use TPC track itself we have to "update" covariance | |
5854 | // | |
5855 | Int_t nseed= arr->GetEntriesFast(); | |
5856 | for (Int_t i=0;i<nseed;i++){ | |
5857 | AliTPCseed *pt = (AliTPCseed*)arr->UncheckedAt(i); | |
5858 | if (pt) { | |
5859 | pt->Modify(fac); | |
5860 | // | |
5861 | //rotate to current local system at first accepted point | |
5862 | Int_t index = pt->GetClusterIndex2(pt->fFirstPoint); | |
5863 | Int_t sec = (index&0xff000000)>>24; | |
5864 | sec = sec%18; | |
5865 | Float_t angle1 = fInnerSec->GetAlpha()*sec+fInnerSec->GetAlphaShift(); | |
5866 | if (angle1>TMath::Pi()) | |
5867 | angle1-=2.*TMath::Pi(); | |
5868 | Float_t angle2 = pt->GetAlpha(); | |
5869 | ||
5870 | if (TMath::Abs(angle1-angle2)>0.001){ | |
5871 | pt->Rotate(angle1-angle2); | |
5872 | //angle2 = pt->GetAlpha(); | |
5873 | //pt->fRelativeSector = pt->GetAlpha()/fInnerSec->GetAlpha(); | |
5874 | //if (pt->GetAlpha()<0) | |
5875 | // pt->fRelativeSector+=18; | |
5876 | //sec = pt->fRelativeSector; | |
5877 | } | |
5878 | ||
5879 | } | |
5880 | ||
5881 | } | |
5882 | ||
5883 | ||
5884 | } | |
47966a6d | 5885 | void AliTPCtrackerMI::PrepareForProlongation(TObjArray * arr, Float_t fac) const |
91162307 | 5886 | { |
5887 | // | |
5888 | // | |
5889 | // if we use TPC track itself we have to "update" covariance | |
5890 | // | |
5891 | Int_t nseed= arr->GetEntriesFast(); | |
5892 | for (Int_t i=0;i<nseed;i++){ | |
5893 | AliTPCseed *pt = (AliTPCseed*)arr->UncheckedAt(i); | |
5894 | if (pt) { | |
5895 | pt->Modify(fac); | |
5896 | pt->fFirstPoint = pt->fLastPoint; | |
5897 | } | |
5898 | ||
5899 | } | |
5900 | ||
5901 | ||
5902 | } | |
5903 | ||
5904 | Int_t AliTPCtrackerMI::PropagateBack(TObjArray * arr) | |
5905 | { | |
5906 | // | |
5907 | // make back propagation | |
5908 | // | |
5909 | Int_t nseed= arr->GetEntriesFast(); | |
5910 | for (Int_t i=0;i<nseed;i++){ | |
5911 | AliTPCseed *pt = (AliTPCseed*)arr->UncheckedAt(i); | |
51ad6848 | 5912 | if (pt&& pt->GetKinkIndex(0)<=0) { |
d9b8978b | 5913 | //AliTPCseed *pt2 = new AliTPCseed(*pt); |
91162307 | 5914 | fSectors = fInnerSec; |
d26d9159 | 5915 | //FollowBackProlongation(*pt,fInnerSec->GetNRows()-1); |
5916 | //fSectors = fOuterSec; | |
4d158c36 | 5917 | FollowBackProlongation(*pt,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1); |
5918 | //if (pt->GetNumberOfClusters()<(pt->fEsd->GetTPCclusters(0)) ){ | |
d9b8978b | 5919 | // Error("PropagateBack","Not prolonged track %d",pt->GetLabel()); |
4d158c36 | 5920 | // FollowBackProlongation(*pt2,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1); |
d9b8978b | 5921 | //} |
51ad6848 | 5922 | } |
5923 | if (pt&& pt->GetKinkIndex(0)>0) { | |
5924 | AliESDkink * kink = fEvent->GetKink(pt->GetKinkIndex(0)-1); | |
eea478d3 | 5925 | pt->fFirstPoint = kink->GetTPCRow0(); |
51ad6848 | 5926 | fSectors = fInnerSec; |
5927 | FollowBackProlongation(*pt,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1); | |
5928 | } | |
5929 | ||
91162307 | 5930 | } |
5931 | return 0; | |
5932 | } | |
5933 | ||
5934 | ||
5935 | Int_t AliTPCtrackerMI::PropagateForward2(TObjArray * arr) | |
5936 | { | |
5937 | // | |
5938 | // make forward propagation | |
5939 | // | |
5940 | Int_t nseed= arr->GetEntriesFast(); | |
4d158c36 | 5941 | // |
91162307 | 5942 | for (Int_t i=0;i<nseed;i++){ |
5943 | AliTPCseed *pt = (AliTPCseed*)arr->UncheckedAt(i); | |
5944 | if (pt) { | |
91162307 | 5945 | FollowProlongation(*pt,0); |
4d158c36 | 5946 | } |
91162307 | 5947 | } |
5948 | return 0; | |
5949 | } | |
5950 | ||
5951 | ||
5952 | Int_t AliTPCtrackerMI::PropagateForward() | |
5953 | { | |
b67e07dc | 5954 | // |
5955 | // propagate track forward | |
4d158c36 | 5956 | //UnsignClusters(); |
d26d9159 | 5957 | Int_t nseed = fSeeds->GetEntriesFast(); |
5958 | for (Int_t i=0;i<nseed;i++){ | |
5959 | AliTPCseed *pt = (AliTPCseed*)fSeeds->UncheckedAt(i); | |
5960 | if (pt){ | |
5961 | AliTPCseed &t = *pt; | |
5962 | Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); | |
5963 | if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); | |
5964 | if (alpha < 0. ) alpha += 2.*TMath::Pi(); | |
5965 | t.fRelativeSector = Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN; | |
5966 | } | |
5967 | } | |
5968 | ||
91162307 | 5969 | fSectors = fOuterSec; |
d26d9159 | 5970 | ParallelTracking(fSeeds,fOuterSec->GetNRows()+fInnerSec->GetNRows()-1,fInnerSec->GetNRows()); |
91162307 | 5971 | fSectors = fInnerSec; |
d26d9159 | 5972 | ParallelTracking(fSeeds,fInnerSec->GetNRows()-1,0); |
91162307 | 5973 | //WriteTracks(); |
5974 | return 1; | |
5975 | } | |
5976 | ||
5977 | ||
5978 | ||
5979 | ||
5980 | ||
5981 | ||
5982 | Int_t AliTPCtrackerMI::PropagateBack(AliTPCseed * pt, Int_t row0, Int_t row1) | |
5983 | { | |
5984 | // | |
5985 | // make back propagation, in between row0 and row1 | |
5986 | // | |
1c53abe2 | 5987 | |
91162307 | 5988 | if (pt) { |
5989 | fSectors = fInnerSec; | |
5990 | Int_t r1; | |
5991 | // | |
5992 | if (row1<fSectors->GetNRows()) | |
5993 | r1 = row1; | |
5994 | else | |
5995 | r1 = fSectors->GetNRows()-1; | |
5996 | ||
5997 | if (row0<fSectors->GetNRows()&& r1>0 ) | |
5998 | FollowBackProlongation(*pt,r1); | |
5999 | if (row1<=fSectors->GetNRows()) | |
6000 | return 0; | |
6001 | // | |
6002 | r1 = row1 - fSectors->GetNRows(); | |
6003 | if (r1<=0) return 0; | |
6004 | if (r1>=fOuterSec->GetNRows()) return 0; | |
6005 | fSectors = fOuterSec; | |
6006 | return FollowBackProlongation(*pt,r1); | |
6007 | } | |
6008 | return 0; | |
6009 | } | |
6010 | ||
6011 | ||
6012 | ||
6013 | ||
6014 | void AliTPCtrackerMI::GetShape(AliTPCseed * seed, Int_t row) | |
6015 | { | |
6016 | // | |
6017 | // | |
6018 | Float_t sd2 = TMath::Abs((fParam->GetZLength()-TMath::Abs(seed->GetZ())))*fParam->GetDiffL()*fParam->GetDiffL(); | |
6019 | // Float_t padlength = fParam->GetPadPitchLength(seed->fSector); | |
6020 | Float_t padlength = GetPadPitchLength(row); | |
6021 | // | |
6022 | Float_t sresy = (seed->fSector < fParam->GetNSector()/2) ? 0.2 :0.3; | |
3f82c4f2 | 6023 | Double_t angulary = seed->GetSnp(); |
91162307 | 6024 | angulary = angulary*angulary/(1-angulary*angulary); |
6025 | seed->fCurrentSigmaY2 = sd2+padlength*padlength*angulary/12.+sresy*sresy; | |
6026 | // | |
6027 | Float_t sresz = fParam->GetZSigma(); | |
6028 | Float_t angularz = seed->GetTgl(); | |
6029 | seed->fCurrentSigmaZ2 = sd2+padlength*padlength*angularz*angularz*(1+angulary)/12.+sresz*sresz; | |
6030 | /* | |
6031 | Float_t wy = GetSigmaY(seed); | |
6032 | Float_t wz = GetSigmaZ(seed); | |
6033 | wy*=wy; | |
6034 | wz*=wz; | |
6035 | if (TMath::Abs(wy/seed->fCurrentSigmaY2-1)>0.0001 || TMath::Abs(wz/seed->fCurrentSigmaZ2-1)>0.0001 ){ | |
6036 | printf("problem\n"); | |
6037 | } | |
6038 | */ | |
1c53abe2 | 6039 | } |
6040 | ||
91162307 | 6041 | |
1c53abe2 | 6042 | Float_t AliTPCtrackerMI::GetSigmaY(AliTPCseed * seed) |
6043 | { | |
6044 | // | |
6045 | // | |
c9427e08 | 6046 | Float_t sd2 = TMath::Abs((fParam->GetZLength()-TMath::Abs(seed->GetZ())))*fParam->GetDiffL()*fParam->GetDiffL(); |
1c53abe2 | 6047 | Float_t padlength = fParam->GetPadPitchLength(seed->fSector); |
6048 | Float_t sres = (seed->fSector < fParam->GetNSector()/2) ? 0.2 :0.3; | |
6049 | Float_t angular = seed->GetSnp(); | |
6050 | angular = angular*angular/(1-angular*angular); | |
6051 | // angular*=angular; | |
6052 | //angular = TMath::Sqrt(angular/(1-angular)); | |
6053 | Float_t res = TMath::Sqrt(sd2+padlength*padlength*angular/12.+sres*sres); | |
6054 | return res; | |
6055 | } | |
6056 | Float_t AliTPCtrackerMI::GetSigmaZ(AliTPCseed * seed) | |
6057 | { | |
6058 | // | |
6059 | // | |
c9427e08 | 6060 | Float_t sd2 = TMath::Abs((fParam->GetZLength()-TMath::Abs(seed->GetZ())))*fParam->GetDiffL()*fParam->GetDiffL(); |
1c53abe2 | 6061 | Float_t padlength = fParam->GetPadPitchLength(seed->fSector); |
6062 | Float_t sres = fParam->GetZSigma(); | |
6063 | Float_t angular = seed->GetTgl(); | |
6064 | Float_t res = TMath::Sqrt(sd2+padlength*padlength*angular*angular/12.+sres*sres); | |
6065 | return res; | |
6066 | } | |
6067 | ||
6068 | ||
1c53abe2 | 6069 | //__________________________________________________________________________ |
af32720d | 6070 | void AliTPCtrackerMI::CookLabel(AliKalmanTrack *tk, Float_t wrong) const { |
1c53abe2 | 6071 | //-------------------------------------------------------------------- |
6072 | //This function "cooks" a track label. If label<0, this track is fake. | |
6073 | //-------------------------------------------------------------------- | |
af32720d | 6074 | AliTPCseed * t = (AliTPCseed*)tk; |
1c53abe2 | 6075 | Int_t noc=t->GetNumberOfClusters(); |
91162307 | 6076 | if (noc<10){ |
d26d9159 | 6077 | //printf("\nnot founded prolongation\n\n\n"); |
6078 | //t->Dump(); | |
91162307 | 6079 | return ; |
6080 | } | |
6081 | Int_t lb[160]; | |
6082 | Int_t mx[160]; | |
6083 | AliTPCclusterMI *clusters[160]; | |
6084 | // | |
6085 | for (Int_t i=0;i<160;i++) { | |
6086 | clusters[i]=0; | |
6087 | lb[i]=mx[i]=0; | |
6088 | } | |
1c53abe2 | 6089 | |
6090 | Int_t i; | |
91162307 | 6091 | Int_t current=0; |
6092 | for (i=0; i<160 && current<noc; i++) { | |
6093 | ||
6094 | Int_t index=t->GetClusterIndex2(i); | |
6095 | if (index<=0) continue; | |
6096 | if (index&0x8000) continue; | |
6097 | // | |
6098 | //clusters[current]=GetClusterMI(index); | |
6099 | if (t->fClusterPointer[i]){ | |
6100 | clusters[current]=t->fClusterPointer[i]; | |
6101 | current++; | |
6102 | } | |
1c53abe2 | 6103 | } |
91162307 | 6104 | noc = current; |
1c53abe2 | 6105 | |
6106 | Int_t lab=123456789; | |
6107 | for (i=0; i<noc; i++) { | |
6108 | AliTPCclusterMI *c=clusters[i]; | |
91162307 | 6109 | if (!c) continue; |
1c53abe2 | 6110 | lab=TMath::Abs(c->GetLabel(0)); |
6111 | Int_t j; | |
6112 | for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break; | |
6113 | lb[j]=lab; | |
6114 | (mx[j])++; | |
6115 | } | |
6116 | ||
6117 | Int_t max=0; | |
6118 | for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];} | |
6119 | ||
6120 | for (i=0; i<noc; i++) { | |
9918f10a | 6121 | AliTPCclusterMI *c=clusters[i]; |
91162307 | 6122 | if (!c) continue; |
1c53abe2 | 6123 | if (TMath::Abs(c->GetLabel(1)) == lab || |
6124 | TMath::Abs(c->GetLabel(2)) == lab ) max++; | |
6125 | } | |
6126 | ||
6127 | if ((1.- Float_t(max)/noc) > wrong) lab=-lab; | |
6128 | ||
6129 | else { | |
6130 | Int_t tail=Int_t(0.10*noc); | |
6131 | max=0; | |
91162307 | 6132 | Int_t ind=0; |
6133 | for (i=1; i<=160&&ind<tail; i++) { | |
6134 | // AliTPCclusterMI *c=clusters[noc-i]; | |
6135 | AliTPCclusterMI *c=clusters[i]; | |
6136 | if (!c) continue; | |
1c53abe2 | 6137 | if (lab == TMath::Abs(c->GetLabel(0)) || |
6138 | lab == TMath::Abs(c->GetLabel(1)) || | |
6139 | lab == TMath::Abs(c->GetLabel(2))) max++; | |
91162307 | 6140 | ind++; |
1c53abe2 | 6141 | } |
6142 | if (max < Int_t(0.5*tail)) lab=-lab; | |
6143 | } | |
6144 | ||
6145 | t->SetLabel(lab); | |
6146 | ||
91162307 | 6147 | // delete[] lb; |
6148 | //delete[] mx; | |
6149 | //delete[] clusters; | |
1c53abe2 | 6150 | } |
6151 | ||
47966a6d | 6152 | |
51ad6848 | 6153 | //__________________________________________________________________________ |
6154 | Int_t AliTPCtrackerMI::CookLabel(AliTPCseed *t, Float_t wrong,Int_t first, Int_t last) const { | |
6155 | //-------------------------------------------------------------------- | |
6156 | //This function "cooks" a track label. If label<0, this track is fake. | |
6157 | //-------------------------------------------------------------------- | |
6158 | Int_t noc=t->GetNumberOfClusters(); | |
6159 | if (noc<10){ | |
6160 | //printf("\nnot founded prolongation\n\n\n"); | |
6161 | //t->Dump(); | |
6162 | return -1; | |
6163 | } | |
6164 | Int_t lb[160]; | |
6165 | Int_t mx[160]; | |
6166 | AliTPCclusterMI *clusters[160]; | |
6167 | // | |
6168 | for (Int_t i=0;i<160;i++) { | |
6169 | clusters[i]=0; | |
6170 | lb[i]=mx[i]=0; | |
6171 | } | |
6172 | ||
6173 | Int_t i; | |
6174 | Int_t current=0; | |
6175 | for (i=0; i<160 && current<noc; i++) { | |
6176 | if (i<first) continue; | |
6177 | if (i>last) continue; | |
6178 | Int_t index=t->GetClusterIndex2(i); | |
6179 | if (index<=0) continue; | |
6180 | if (index&0x8000) continue; | |
6181 | // | |
6182 | //clusters[current]=GetClusterMI(index); | |
6183 | if (t->fClusterPointer[i]){ | |
6184 | clusters[current]=t->fClusterPointer[i]; | |
6185 | current++; | |
6186 | } | |
6187 | } | |
6188 | noc = current; | |
6189 | if (noc<5) return -1; | |
6190 | Int_t lab=123456789; | |
6191 | for (i=0; i<noc; i++) { | |
6192 | AliTPCclusterMI *c=clusters[i]; | |
6193 | if (!c) continue; | |
6194 | lab=TMath::Abs(c->GetLabel(0)); | |
6195 | Int_t j; | |
6196 | for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break; | |
6197 | lb[j]=lab; | |
6198 | (mx[j])++; | |
6199 | } | |
6200 | ||
6201 | Int_t max=0; | |
6202 | for (i=0; i<noc; i++) if (mx[i]>max) {max=mx[i]; lab=lb[i];} | |
6203 | ||
6204 | for (i=0; i<noc; i++) { | |
6205 | AliTPCclusterMI *c=clusters[i]; | |
6206 | if (!c) continue; | |
6207 | if (TMath::Abs(c->GetLabel(1)) == lab || | |
6208 | TMath::Abs(c->GetLabel(2)) == lab ) max++; | |
6209 | } | |
6210 | ||
6211 | if ((1.- Float_t(max)/noc) > wrong) lab=-lab; | |
6212 | ||
6213 | else { | |
6214 | Int_t tail=Int_t(0.10*noc); | |
6215 | max=0; | |
6216 | Int_t ind=0; | |
6217 | for (i=1; i<=160&&ind<tail; i++) { | |
6218 | // AliTPCclusterMI *c=clusters[noc-i]; | |
6219 | AliTPCclusterMI *c=clusters[i]; | |
6220 | if (!c) continue; | |
6221 | if (lab == TMath::Abs(c->GetLabel(0)) || | |
6222 | lab == TMath::Abs(c->GetLabel(1)) || | |
6223 | lab == TMath::Abs(c->GetLabel(2))) max++; | |
6224 | ind++; | |
6225 | } | |
6226 | if (max < Int_t(0.5*tail)) lab=-lab; | |
6227 | } | |
6228 | ||
6229 | // t->SetLabel(lab); | |
6230 | return lab; | |
6231 | // delete[] lb; | |
6232 | //delete[] mx; | |
6233 | //delete[] clusters; | |
6234 | } | |
6235 | ||
6236 | ||
47966a6d | 6237 | Int_t AliTPCtrackerMI::AliTPCSector::GetRowNumber(Double_t x) const |
6238 | { | |
6239 | //return pad row number for this x | |
6240 | Double_t r; | |
6241 | if (fN < 64){ | |
6242 | r=fRow[fN-1].GetX(); | |
6243 | if (x > r) return fN; | |
6244 | r=fRow[0].GetX(); | |
6245 | if (x < r) return -1; | |
6246 | return Int_t((x-r)/fPadPitchLength + 0.5);} | |
6247 | else{ | |
6248 | r=fRow[fN-1].GetX(); | |
6249 | if (x > r) return fN; | |
6250 | r=fRow[0].GetX(); | |
6251 | if (x < r) return -1; | |
6252 | Double_t r1=fRow[64].GetX(); | |
6253 | if(x<r1){ | |
6254 | return Int_t((x-r)/f1PadPitchLength + 0.5);} | |
6255 | else{ | |
6256 | return (Int_t((x-r1)/f2PadPitchLength + 0.5)+64);} | |
6257 | } | |
6258 | } | |
6259 | ||
eea478d3 | 6260 | Int_t AliTPCtrackerMI::GetRowNumber(Double_t x[3]) const |
6261 | { | |
6262 | //return pad row number for given x vector | |
6263 | Float_t phi = TMath::ATan2(x[1],x[0]); | |
6264 | if(phi<0) phi=2.*TMath::Pi()+phi; | |
6265 | // Get the local angle in the sector philoc | |
6266 | const Float_t kRaddeg = 180/3.14159265358979312; | |
6267 | Float_t phiangle = (Int_t (phi*kRaddeg/20.) + 0.5)*20./kRaddeg; | |
6268 | Double_t localx = x[0]*TMath::Cos(phiangle)-x[1]*TMath::Sin(phiangle); | |
6269 | return GetRowNumber(localx); | |
6270 | } | |
6271 | ||
1c53abe2 | 6272 | //_________________________________________________________________________ |
6273 | void AliTPCtrackerMI::AliTPCSector::Setup(const AliTPCParam *par, Int_t f) { | |
6274 | //----------------------------------------------------------------------- | |
6275 | // Setup inner sector | |
6276 | //----------------------------------------------------------------------- | |
6277 | if (f==0) { | |
6278 | fAlpha=par->GetInnerAngle(); | |
6279 | fAlphaShift=par->GetInnerAngleShift(); | |
6280 | fPadPitchWidth=par->GetInnerPadPitchWidth(); | |
6281 | fPadPitchLength=par->GetInnerPadPitchLength(); | |
6282 | fN=par->GetNRowLow(); | |
6283 | fRow=new AliTPCRow[fN]; | |
6284 | for (Int_t i=0; i<fN; i++) { | |
6285 | fRow[i].SetX(par->GetPadRowRadiiLow(i)); | |
6286 | fRow[i].fDeadZone =1.5; //1.5 cm of dead zone | |
6287 | } | |
6288 | } else { | |
6289 | fAlpha=par->GetOuterAngle(); | |
6290 | fAlphaShift=par->GetOuterAngleShift(); | |
6291 | fPadPitchWidth = par->GetOuterPadPitchWidth(); | |
6292 | fPadPitchLength = par->GetOuter1PadPitchLength(); | |
6293 | f1PadPitchLength = par->GetOuter1PadPitchLength(); | |
6294 | f2PadPitchLength = par->GetOuter2PadPitchLength(); | |
6295 | ||
6296 | fN=par->GetNRowUp(); | |
6297 | fRow=new AliTPCRow[fN]; | |
6298 | for (Int_t i=0; i<fN; i++) { | |
6299 | fRow[i].SetX(par->GetPadRowRadiiUp(i)); | |
6300 | fRow[i].fDeadZone =1.5; // 1.5 cm of dead zone | |
6301 | } | |
6302 | } | |
6303 | } | |
6304 | ||
b67e07dc | 6305 | AliTPCtrackerMI::AliTPCRow::AliTPCRow() { |
6306 | // | |
6307 | // default constructor | |
6308 | fN=0; | |
6309 | fN1=0; | |
6310 | fN2=0; | |
6311 | fClusters1=0; | |
6312 | fClusters2=0; | |
6313 | } | |
1c53abe2 | 6314 | |
6315 | AliTPCtrackerMI::AliTPCRow::~AliTPCRow(){ | |
6316 | // | |
b67e07dc | 6317 | |
1c53abe2 | 6318 | } |
6319 | ||
6320 | ||
6321 | ||
1c53abe2 | 6322 | //_________________________________________________________________________ |
6323 | void | |
6324 | AliTPCtrackerMI::AliTPCRow::InsertCluster(const AliTPCclusterMI* c, UInt_t index) { | |
6325 | //----------------------------------------------------------------------- | |
6326 | // Insert a cluster into this pad row in accordence with its y-coordinate | |
6327 | //----------------------------------------------------------------------- | |
6328 | if (fN==kMaxClusterPerRow) { | |
6329 | cerr<<"AliTPCRow::InsertCluster(): Too many clusters !\n"; return; | |
6330 | } | |
6331 | if (fN==0) {fIndex[0]=index; fClusters[fN++]=c; return;} | |
6332 | Int_t i=Find(c->GetZ()); | |
6333 | memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTPCclusterMI*)); | |
6334 | memmove(fIndex +i+1 ,fIndex +i,(fN-i)*sizeof(UInt_t)); | |
6335 | fIndex[i]=index; fClusters[i]=c; fN++; | |
6336 | } | |
6337 | ||
982aff31 | 6338 | void AliTPCtrackerMI::AliTPCRow::ResetClusters() { |
6339 | // | |
6340 | // reset clusters | |
6341 | fN = 0; | |
6342 | fN1 = 0; | |
6343 | fN2 = 0; | |
6344 | //delete[] fClusterArray; | |
6345 | if (fClusters1) delete []fClusters1; | |
6346 | if (fClusters2) delete []fClusters2; | |
6347 | //fClusterArray=0; | |
6348 | fClusters1 = 0; | |
6349 | fClusters2 = 0; | |
6350 | } | |
6351 | ||
91162307 | 6352 | |
1c53abe2 | 6353 | //___________________________________________________________________ |
6354 | Int_t AliTPCtrackerMI::AliTPCRow::Find(Double_t z) const { | |
6355 | //----------------------------------------------------------------------- | |
6356 | // Return the index of the nearest cluster | |
6357 | //----------------------------------------------------------------------- | |
6358 | if (fN==0) return 0; | |
6359 | if (z <= fClusters[0]->GetZ()) return 0; | |
6360 | if (z > fClusters[fN-1]->GetZ()) return fN; | |
6361 | Int_t b=0, e=fN-1, m=(b+e)/2; | |
6362 | for (; b<e; m=(b+e)/2) { | |
6363 | if (z > fClusters[m]->GetZ()) b=m+1; | |
6364 | else e=m; | |
6365 | } | |
6366 | return m; | |
6367 | } | |
6368 | ||
6369 | ||
6370 | ||
1627d1c4 | 6371 | //___________________________________________________________________ |
6372 | AliTPCclusterMI * AliTPCtrackerMI::AliTPCRow::FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const { | |
6373 | //----------------------------------------------------------------------- | |
6374 | // Return the index of the nearest cluster in z y | |
6375 | //----------------------------------------------------------------------- | |
6376 | Float_t maxdistance = roady*roady + roadz*roadz; | |
6377 | ||
6378 | AliTPCclusterMI *cl =0; | |
6379 | for (Int_t i=Find(z-roadz); i<fN; i++) { | |
6380 | AliTPCclusterMI *c=(AliTPCclusterMI*)(fClusters[i]); | |
6381 | if (c->GetZ() > z+roadz) break; | |
6382 | if ( (c->GetY()-y) > roady ) continue; | |
6383 | Float_t distance = (c->GetZ()-z)*(c->GetZ()-z)+(c->GetY()-y)*(c->GetY()-y); | |
6384 | if (maxdistance>distance) { | |
6385 | maxdistance = distance; | |
6386 | cl=c; | |
6387 | } | |
6388 | } | |
6389 | return cl; | |
6390 | } | |
6391 | ||
91162307 | 6392 | AliTPCclusterMI * AliTPCtrackerMI::AliTPCRow::FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz,UInt_t & index) const |
6393 | { | |
6394 | //----------------------------------------------------------------------- | |
6395 | // Return the index of the nearest cluster in z y | |
6396 | //----------------------------------------------------------------------- | |
6397 | Float_t maxdistance = roady*roady + roadz*roadz; | |
91162307 | 6398 | AliTPCclusterMI *cl =0; |
3381b665 | 6399 | |
6400 | //PH Check boundaries. 510 is the size of fFastCluster | |
6401 | Int_t iz1 = Int_t(z-roadz+254.5); | |
6402 | if (iz1<0 || iz1>=510) return cl; | |
6403 | iz1 = TMath::Max(fFastCluster[iz1]-1,0); | |
6404 | Int_t iz2 = Int_t(z+roadz+255.5); | |
6405 | if (iz2<0 || iz2>=510) return cl; | |
6406 | iz2 = TMath::Min(fFastCluster[iz2]+1,fN); | |
6407 | ||
91162307 | 6408 | //FindNearest3(y,z,roady,roadz,index); |
6409 | // for (Int_t i=Find(z-roadz); i<fN; i++) { | |
6410 | for (Int_t i=iz1; i<iz2; i++) { | |
6411 | AliTPCclusterMI *c=(AliTPCclusterMI*)(fClusters[i]); | |
6412 | if (c->GetZ() > z+roadz) break; | |
6413 | if ( c->GetY()-y > roady ) continue; | |
6414 | if ( y-c->GetY() > roady ) continue; | |
6415 | Float_t distance = (c->GetZ()-z)*(c->GetZ()-z)+(c->GetY()-y)*(c->GetY()-y); | |
6416 | if (maxdistance>distance) { | |
6417 | maxdistance = distance; | |
6418 | cl=c; | |
6419 | index =i; | |
6420 | //roady = TMath::Sqrt(maxdistance); | |
6421 | } | |
6422 | } | |
6423 | return cl; | |
6424 | } | |
6425 | ||
6426 | ||
6427 | ||
6428 | AliTPCclusterMI * AliTPCtrackerMI::AliTPCRow::FindNearest3(Double_t y, Double_t z, Double_t roady, Double_t roadz,UInt_t & index) const | |
6429 | { | |
6430 | //----------------------------------------------------------------------- | |
6431 | // Return the index of the nearest cluster in z y | |
6432 | //----------------------------------------------------------------------- | |
6433 | Float_t maxdistance = roady*roady + roadz*roadz; | |
6434 | // Int_t iz = Int_t(z+255.); | |
6435 | AliTPCclusterMI *cl =0; | |
6436 | for (Int_t i=Find(z-roadz); i<fN; i++) { | |
6437 | //for (Int_t i=fFastCluster[iz-2]; i<fFastCluster[iz+2]; i++) { | |
6438 | AliTPCclusterMI *c=(AliTPCclusterMI*)(fClusters[i]); | |
6439 | if (c->GetZ() > z+roadz) break; | |
6440 | if ( c->GetY()-y > roady ) continue; | |
6441 | if ( y-c->GetY() > roady ) continue; | |
6442 | Float_t distance = (c->GetZ()-z)*(c->GetZ()-z)+(c->GetY()-y)*(c->GetY()-y); | |
6443 | if (maxdistance>distance) { | |
6444 | maxdistance = distance; | |
6445 | cl=c; | |
6446 | index =i; | |
6447 | //roady = TMath::Sqrt(maxdistance); | |
6448 | } | |
6449 | } | |
6450 | return cl; | |
6451 | } | |
1627d1c4 | 6452 | |
6453 | ||
6454 | ||
6455 | ||
91162307 | 6456 | |
81e97e0d | 6457 | // AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i) |
6458 | // { | |
6459 | // // | |
6460 | // // | |
6461 | // return &fTrackPoints[i]; | |
6462 | // } | |
91162307 | 6463 | |
91162307 | 6464 |