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