1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
22 //-------------------------------------------------------------------------
23 // Implementation of the ITS Upgrade tracker mother class.
24 //-------------------------------------------------------------------------
26 #include <Riostream.h>
29 #include "AliITSUTrackerGlo.h"
30 #include "AliESDEvent.h"
31 #include "AliESDtrack.h"
32 #include "AliITSURecoDet.h"
33 #include "AliITSURecoSens.h"
34 #include "AliITSUReconstructor.h"
35 #include "AliITSReconstructor.h"
36 #include "AliITSUSeed.h"
37 #include "AliITSUAux.h"
38 #include "AliITSUClusterPix.h"
39 using namespace AliITSUAux;
40 using namespace TMath;
43 //----------------- tmp stuff -----------------
45 ClassImp(AliITSUTrackerGlo)
46 //_________________________________________________________________________
47 AliITSUTrackerGlo::AliITSUTrackerGlo(AliITSUReconstructor* rec)
54 ,fSeedsPool("AliITSUSeed",0)
57 // Default constructor
61 //_________________________________________________________________________
62 AliITSUTrackerGlo::~AliITSUTrackerGlo()
70 //_________________________________________________________________________
71 void AliITSUTrackerGlo::Init(AliITSUReconstructor* rec)
73 // init with external reconstructor
75 fITS = new AliITSURecoDet(rec->GetGeom(),"ITSURecoInterface");
76 for (int ilr=fITS->GetNLayersActive();ilr--;) {
77 fITS->GetLayerActive(ilr)->SetClusters(rec->GetClusters(ilr));
80 fSeedsPool.ExpandCreateFast(1000); // RS TOCHECK
82 fTrCond.SetNLayers(fITS->GetNLayersActive());
83 fTrCond.AddNewCondition(5);
84 fTrCond.AddGroupPattern( (0x1<<0)|(0x1<<1) );
85 fTrCond.AddGroupPattern( (0x1<<3)|(0x1<<4) );
86 fTrCond.AddGroupPattern( (0x1<<5)|(0x1<<6) );
88 fTrCond.AddNewCondition(5);
89 fTrCond.AddGroupPattern( (0x1<<0)|(0x1<<2) );
90 fTrCond.AddGroupPattern( (0x1<<3)|(0x1<<4) );
91 fTrCond.AddGroupPattern( (0x1<<5)|(0x1<<6) );
93 fTrCond.AddNewCondition(5);
94 fTrCond.AddGroupPattern( (0x1<<1)|(0x1<<2) );
95 fTrCond.AddGroupPattern( (0x1<<3)|(0x1<<4) );
96 fTrCond.AddGroupPattern( (0x1<<5)|(0x1<<6) );
98 printf("Tracking Conditions: ");
102 //_________________________________________________________________________
103 Int_t AliITSUTrackerGlo::Clusters2Tracks(AliESDEvent *esdEv)
107 AliITSUReconstructor::GetRecoParam()->Print();
108 int nTrESD = esdEv->GetNumberOfTracks();
110 if (fHypStore.GetSize()<nTrESD) fHypStore.Expand(nTrESD+100);
112 fITS->ProcessClusters();
113 // select ESD tracks to propagate
114 for (int itr=0;itr<nTrESD;itr++) {
115 AliESDtrack *esdTr = esdEv->GetTrack(itr);
116 AliInfo(Form("Processing track %d | MCLabel: %d",itr,esdTr->GetTPCLabel()));
117 FindTrack(esdTr, itr);
120 printf("Hypotheses for current event (N seeds in pool: %d, size: %d)\n",fSeedsPool.GetEntriesFast(),fSeedsPool.GetSize());
122 FinalizeHypotheses();
127 //_________________________________________________________________________
128 Int_t AliITSUTrackerGlo::PropagateBack(AliESDEvent * /*event*/)
134 Info("PropagateBack","To be implemented");
138 //_________________________________________________________________________
139 Int_t AliITSUTrackerGlo::RefitInward(AliESDEvent * /*event*/)
145 Info("RefitInward","To be implemented");
149 //_________________________________________________________________________
150 Int_t AliITSUTrackerGlo::LoadClusters(TTree * treeRP)
152 // read from tree (if pointer provided) or directly from the ITS reco interface
154 return fReconstructor->LoadClusters(treeRP);
157 //_________________________________________________________________________
158 void AliITSUTrackerGlo::UnloadClusters()
164 Info("UnloadClusters","To be implemented");
166 //_________________________________________________________________________
167 AliCluster * AliITSUTrackerGlo::GetCluster(Int_t /*index*/) const
173 Info("GetCluster","To be implemented");
177 //_________________________________________________________________________
178 Bool_t AliITSUTrackerGlo::NeedToProlong(AliESDtrack* esdTr)
180 // do we need to match this track to ITS?
182 static double bz = GetBz();
183 if (!esdTr->IsOn(AliESDtrack::kTPCin) ||
184 esdTr->IsOn(AliESDtrack::kTPCout) ||
185 esdTr->IsOn(AliESDtrack::kITSin) ||
186 esdTr->GetKinkIndex(0)>0) return kFALSE;
188 if (esdTr->Pt()<AliITSUReconstructor::GetRecoParam()->GetMinPtForProlongation()) return kFALSE;
191 esdTr->GetDZ(GetX(),GetY(),GetZ(),bz,dtz);
192 // if track is not V0 candidata but has large offset wrt IP, reject it. RS TOCHECK
193 if ( !(esdTr->GetV0Index(0)>0 && dtz[0]>AliITSUReconstructor::GetRecoParam()->GetMaxDforV0dghtrForProlongation())
194 && (Abs(dtz[0])>AliITSUReconstructor::GetRecoParam()->GetMaxDForProlongation() ||
195 Abs(dtz[1])>AliITSUReconstructor::GetRecoParam()->GetMaxDZForProlongation())) return kFALSE;
200 //_________________________________________________________________________
201 void AliITSUTrackerGlo::FindTrack(AliESDtrack* esdTr, Int_t esdID)
203 // find prolongaion candidates finding for single seed
205 AliITSUSeed seedUC; // copy of the seed from the upper layer
206 AliITSUSeed seedT; // transient seed between the seedUC and new prolongation hypothesis
208 if (!NeedToProlong(esdTr)) return; // are we interested in this track?
209 if (!InitHypothesis(esdTr,esdID)) return; // initialize prolongations hypotheses tree
211 AliITSURecoSens *hitSens[AliITSURecoSens::kNNeighbors+1];
213 TObjArray clArr; // container for transfer of clusters matching to seed
215 int nLrActive = fITS->GetNLayersActive();
216 for (int ila=nLrActive;ila--;) {
217 int ilaUp = ila+1; // prolong seeds from layer above
219 // for the outermost layer the seed is created from the ESD track
220 int nSeedsUp = (ilaUp==nLrActive) ? 1 : fCurrHyp->GetNSeeds(ilaUp);
222 for (int isd=0;isd<nSeedsUp;isd++) {
224 if (ilaUp==nLrActive) {
226 seedUC.InitFromESDTrack(esdTr);
229 seedU = fCurrHyp->GetSeed(ilaUp,isd); // seed on prev.active layer to prolong
230 seedUC = *seedU; // its copy will be prolonged
231 seedUC.SetParent(seedU);
233 seedUC.ResetFMatrix(); // reset the matrix for propagation to next layer
234 // go till next active layer
235 AliInfo(Form("working on Lr:%d Seed:%d of %d",ila,isd,nSeedsUp));
236 if (!TransportToLayer(&seedUC, fITS->GetLrIDActive(ilaUp), fITS->GetLrIDActive(ila)) ) {
238 AliInfo("Transport failed");
239 // Check if the seed satisfies to track definition
240 if (NeedToKill(&seedUC,kTransportFailed) && seedU) seedU->Kill();
241 continue; // RS TODO: decide what to do with tracks stopped on higher layers w/o killing
243 AliITSURecoLayer* lrA = fITS->GetLayerActive(ila);
244 if (!GetRoadWidth(&seedUC, ila)) { // failed to find road width on the layer
245 if (NeedToKill(&seedUC,kRWCheckFailed) && seedU) seedU->Kill();
248 int nsens = lrA->FindSensors(&fTrImpData[kTrPhi0], hitSens); // find detectors which may be hit by the track
249 AliInfo(Form("Will check %d sensors on lr:%d ",nsens,ila));
252 for (int isn=nsens;isn--;) {
254 AliITSURecoSens* sens = hitSens[isn];
256 // We need to propagate the seed to sensor on lrA staying the frame of the sensor from prev.layer,
257 // since the transport matrix should be defined in this frame.
258 double xs; // X in the TF of current seed, corresponding to intersection with sensor plane
259 if (!seedT.GetTrackingXAtXAlpha(sens->GetXTF(),sens->GetPhiTF(),bz, xs)) continue;
260 if (!seedT.PropagateToX(xs,bz)) continue;
261 // if (!seedT.Rotate(sens->GetPhiTF())) continue;
262 if (!seedT.RotateToAlpha(sens->GetPhiTF())) continue;
264 int clID0 = sens->GetFirstClusterId();
265 for (int icl=sens->GetNClusters();icl--;) {
266 int res = CheckCluster(&seedT,ila,clID0+icl);
268 if (res==kStopSearchOnSensor) break; // stop looking on this sensor
269 if (res==kClusterNotMatching) continue; // cluster does not match
270 // cluster is matching and it was added to the hypotheses tree
273 // cluster search is done. Do we need ta have a version of this seed skipping current layer
275 if (!NeedToKill(&seedT,kMissingCluster)) {
276 AliITSUSeed* seedSkp = NewSeedFromPool(&seedT);
277 double penalty = -AliITSUReconstructor::GetRecoParam()->GetMissPenalty(ila);
278 // to do: make penalty to account for probability to miss the cluster for good reason
279 seedSkp->SetChi2Cl(penalty);
280 AddProlongationHypothesis(seedSkp,ila);
283 ((TObjArray*)fCurrHyp->GetLayerSeeds(ila))->Sort();
284 printf(">>> All hypotheses on lr %d: \n",ila);
285 for (int ih=0;ih<fCurrHyp->GetNSeeds(ila);ih++) {
286 printf(" #%3d ",ih); fCurrHyp->GetSeed(ila,ih)->Print();
289 if (ila!=0) continue;
290 double vecL[5] = {0};
291 double matL[15] = {0};
292 AliITSUSeed* sp = fCurrHyp->GetSeed(ila,ih);
293 while(sp->GetParent()) {
294 sp->Smooth(vecL,matL);
295 if (sp->GetLayerID()>=fITS->GetNLayersActive()-1) break;
296 sp = (AliITSUSeed*)sp->GetParent();
302 SaveCurrentTrackHypotheses();
306 //_________________________________________________________________________
307 Bool_t AliITSUTrackerGlo::InitHypothesis(AliESDtrack *esdTr, Int_t esdID)
309 // init prolongaion candidates finding for single seed
310 fCurrHyp = GetTrackHyp(esdID);
311 if (fCurrHyp) return kTRUE;
313 fCurrMass = esdTr->GetMass();
314 fCurrESDtrack = esdTr;
315 if (fCurrMass<kPionMass*0.9) fCurrMass = kPionMass; // don't trust to mu, e identification from TPCin
317 fCurrHyp = new AliITSUTrackHyp(fITS->GetNLayersActive());
318 fCurrHyp->SetESDTrack(esdTr);
319 fCurrHyp->SetUniqueID(esdID);
320 SetTrackHyp(fCurrHyp,esdID);
326 //_________________________________________________________________________
327 Bool_t AliITSUTrackerGlo::TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo)
329 // transport seed from layerFrom to the entrance of layerTo
331 const double kToler = 1e-6; // tolerance for layer on-surface check
333 int dir = lTo > lFrom ? 1:-1;
334 AliITSURecoLayer* lrFr = fITS->GetLayer(lFrom); // this can be 0 when extrapolation from TPC to ITS is requested
335 Bool_t checkFirst = kTRUE;
337 double curR2 = seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY(); // current radius
339 Bool_t doLayer = kTRUE;
340 double xToGo = dir>0 ? lrFr->GetRMax() : lrFr->GetRMin();
341 if (checkFirst) { // do we need to track till the surface of the current layer ?
343 if (dir>0) { if (curR2-xToGo*xToGo>kToler) doLayer = kFALSE; } // on the surface or outside of the layer
344 else if (dir<0) { if (xToGo*xToGo-curR2>kToler) doLayer = kFALSE; } // on the surface or outside of the layer
347 if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
348 // go via layer to its boundary, applying material correction.
349 if (!PropagateSeed(seed,xToGo,fCurrMass, lrFr->GetMaxStep())) return kFALSE;
352 AliITSURecoLayer* lrTo = fITS->GetLayer( (lFrom+=dir) );
353 if (!lrTo) AliFatal(Form("Layer %d does not exist",lFrom));
355 // go the entrance of the layer, assuming no materials in between
356 double xToGo = dir>0 ? lrTo->GetRMin() : lrTo->GetRMax();
357 if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
358 if (!PropagateSeed(seed,xToGo,fCurrMass,100, kFALSE )) return kFALSE;
365 //_________________________________________________________________________
366 Bool_t AliITSUTrackerGlo::TransportToLayer(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo)
368 // transport track from layerFrom to the entrance of layerTo
370 const double kToler = 1e-6; // tolerance for layer on-surface check
372 int dir = lTo > lFrom ? 1:-1;
373 AliITSURecoLayer* lrFr = fITS->GetLayer(lFrom); // this can be 0 when extrapolation from TPC to ITS is requested
374 Bool_t checkFirst = kTRUE;
376 double curR2 = seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY(); // current radius
378 Bool_t doLayer = kTRUE;
379 double xToGo = dir>0 ? lrFr->GetRMax() : lrFr->GetRMin();
380 if (checkFirst) { // do we need to track till the surface of the current layer ?
382 if (dir>0) { if (curR2-xToGo*xToGo>kToler) doLayer = kFALSE; } // on the surface or outside of the layer
383 else if (dir<0) { if (xToGo*xToGo-curR2>kToler) doLayer = kFALSE; } // on the surface or outside of the layer
386 if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
387 // go via layer to its boundary, applying material correction.
388 if (!PropagateSeed(seed,xToGo,fCurrMass, lrFr->GetMaxStep())) return kFALSE;
391 AliITSURecoLayer* lrTo = fITS->GetLayer( (lFrom+=dir) );
392 if (!lrTo) AliFatal(Form("Layer %d does not exist",lFrom));
394 // go the entrance of the layer, assuming no materials in between
395 double xToGo = dir>0 ? lrTo->GetRMin() : lrTo->GetRMax();
396 if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
397 if (!PropagateSeed(seed,xToGo,fCurrMass,100, kFALSE )) return kFALSE;
404 //_________________________________________________________________________
405 Bool_t AliITSUTrackerGlo::GetRoadWidth(AliITSUSeed* seed, int ilrA)
407 // calculate road width in terms of phi and z for the track which MUST be on the external radius of the layer
408 // as well as some aux info
410 AliITSURecoLayer* lrA = fITS->GetLayerActive(ilrA);
411 seed->GetXYZ(&fTrImpData[kTrXIn]); // lab position at the entrance from above
412 static AliExternalTrackParam sc; // seed copy for manipalitions
415 fTrImpData[kTrPhiIn] = ATan2(fTrImpData[kTrYIn],fTrImpData[kTrXIn]);
416 if (!sc.Rotate(fTrImpData[kTrPhiIn])) return kFALSE; // go to the frame of the entry point into the layer
417 double dr = lrA->GetDR(); // approximate X dist at the inner radius
418 if (!sc.GetXYZAt(sc.GetX()-dr, bz, fTrImpData + kTrXOut)) {
419 // special case: track does not reach inner radius, might be tangential
420 double r = sc.GetD(0,0,bz);
422 if (!sc.GetXatLabR(r,x,bz,-1)) {
424 AliFatal(Form("This should not happen: r=%f",r));
426 dr = Abs(sc.GetX() - x);
427 if (!sc.GetXYZAt(x, bz, fTrImpData + kTrXOut)) {
429 AliFatal(Form("This should not happen: x=%f",x));
433 fTrImpData[kTrPhiOut] = ATan2(fTrImpData[kTrYOut],fTrImpData[kTrXOut]);
434 double sgy = sc.GetSigmaY2() + dr*dr*sc.GetSigmaSnp2() + AliITSUReconstructor::GetRecoParam()->GetSigmaY2(ilrA);
435 double sgz = sc.GetSigmaZ2() + dr*dr*sc.GetSigmaTgl2() + AliITSUReconstructor::GetRecoParam()->GetSigmaZ2(ilrA);
436 sgy = Sqrt(sgy)*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadY();
437 sgz = Sqrt(sgz)*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadZ();
438 fTrImpData[kTrPhi0] = 0.5*(fTrImpData[kTrPhiOut]+fTrImpData[kTrPhiIn]);
439 fTrImpData[kTrZ0] = 0.5*(fTrImpData[kTrZOut]+fTrImpData[kTrZIn]);
440 fTrImpData[kTrDPhi] = 0.5*Abs(fTrImpData[kTrPhiOut]-fTrImpData[kTrPhiIn]) + sgy/lrA->GetR();
441 fTrImpData[kTrDZ] = 0.5*Abs(fTrImpData[kTrZOut]-fTrImpData[kTrZIn]) + sgz;
446 //_________________________________________________________________________
447 AliITSUSeed* AliITSUTrackerGlo::NewSeedFromPool(const AliITSUSeed* src)
449 // create new seed, optionally copying from the source
451 new(fSeedsPool[fSeedsPool.GetEntriesFast()]) AliITSUSeed(*src) :
452 new(fSeedsPool[fSeedsPool.GetEntriesFast()]) AliITSUSeed();
455 //_________________________________________________________________________
456 Int_t AliITSUTrackerGlo::CheckCluster(AliITSUSeed* track, Int_t lr, Int_t clID)
458 // Check if the cluster (in tracking frame!) is matching to track.
459 // The track must be already propagated to sensor tracking frame.
460 // Returns: kStopSearchOnSensor if the search on given sensor should be stopped,
461 // kClusterMatching if the cluster is matching
462 // kClusterMatching otherwise
464 const double kTolerX = 5e-4;
465 AliCluster *cl = fITS->GetLayerActive(lr)->GetCluster(clID);
467 Bool_t goodCl = kFALSE;
468 int currLabel = Abs(fCurrESDtrack->GetTPCLabel());
470 if (cl->GetLabel(0)>=0) {for (int i=0;i<3;i++) if (cl->GetLabel(i)>=0 && cl->GetLabel(i)==currLabel) {goodCl = kTRUE; break;}}
473 if (TMath::Abs(cl->GetX())>kTolerX) { // if due to the misalingment X is large, propagate track only
474 if (!track->PropagateParamOnlyTo(track->GetX()+cl->GetX(),GetBz())) {
475 if (goodCl) {printf("Loose good cl: Failed propagation. |"); cl->Print();}
476 return kStopSearchOnSensor; // propagation failed, seedT is intact
479 double dy = cl->GetY()-track->GetY();
480 double dz = cl->GetZ()-track->GetZ();
483 double tol2 = (track->GetSigmaY2() + AliITSUReconstructor::GetRecoParam()->GetSigmaY2(lr))*
484 AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadY()*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadY(); // RS TOOPTIMIZE
485 if (dy2>tol2) { // the clusters are sorted in Z(col) then in Y(row).
486 if (goodCl) {printf("Loose good cl: dy2=%e > tol2=%e |",dy2,tol2); cl->Print();}
487 if (dy>0) return kStopSearchOnSensor; // No chance that other cluster of this sensor will match (all Y's will be even larger)
488 else return kClusterNotMatching; // Other clusters may match
491 tol2 = (track->GetSigmaZ2() + AliITSUReconstructor::GetRecoParam()->GetSigmaZ2(lr))*
492 AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadZ()*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadZ(); // RS TOOPTIMIZE
494 if (goodCl) {printf("Loose good cl: dz2=%e > tol2=%e |",dz2,tol2); cl->Print();}
495 return kClusterNotMatching; // Other clusters may match
499 Double_t p[2]={cl->GetY(), cl->GetZ()};
500 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
501 double chi2 = track->GetPredictedChi2(p,cov);
502 if (chi2>AliITSUReconstructor::GetRecoParam()->GetMaxTr2ClChi2(lr)) {
504 printf("Loose good cl: Chi2=%e > Chi2Max=%e |dy: %+.3e dz: %+.3e\n",
505 chi2,AliITSUReconstructor::GetRecoParam()->GetMaxTr2ClChi2(lr),dy,dz);
509 return kClusterNotMatching;
512 track = NewSeedFromPool(track); // input track will be reused, use its clone for updates
513 if (!track->Update()) {
514 if (goodCl) {printf("Loose good cl: Failed update |"); cl->Print();}
515 return kClusterNotMatching;
517 track->SetChi2Cl(chi2);
518 track->SetLrClusterID(lr,clID);
519 cl->IncreaseClusterUsage();
521 track->SetFake(!goodCl);
523 AliInfo(Form("AddCl(%d) Cl%d lr:%d: dY:%+8.4f dZ:%+8.4f (MC: %5d %5d %5d) |Chi2=%f(%c)",
524 goodCl,clID,lr,dy,dz2,cl->GetLabel(0),cl->GetLabel(1),cl->GetLabel(2), chi2, track->IsFake() ? '-':'+'));
526 AddProlongationHypothesis(track,lr);
528 return kClusterMatching;
531 //_________________________________________________________________________
532 Bool_t AliITSUTrackerGlo::NeedToKill(AliITSUSeed *seed, Int_t flag)
534 // check if the seed should not be discarded
535 const UShort_t kMask = 0xffff;
536 if (flag==kMissingCluster) {
537 int lastChecked = seed->GetLayerID();
538 UShort_t patt = seed->GetHitsPattern();
539 if (lastChecked) patt |= ~(kMask<<lastChecked); // not all layers were checked, complete unchecked once by potential hits
540 Bool_t seedOK = fTrCond.CheckPattern(patt);
546 //______________________________________________________________________________
547 Bool_t AliITSUTrackerGlo::PropagateSeed(AliITSUSeed *seed, Double_t xToGo, Double_t mass, Double_t maxStep, Bool_t matCorr)
549 // propagate seed to given x applying material correction if requested
550 const Double_t kEpsilon = 1e-5;
551 Double_t xpos = seed->GetX();
552 Int_t dir = (xpos<xToGo) ? 1:-1;
553 Double_t xyz0[3],xyz1[3],param[7];
555 if (matCorr) seed->GetXYZ(xyz1); //starting global position
556 while ( (xToGo-xpos)*dir > kEpsilon){
557 Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep);
558 Double_t x = xpos+step;
559 Double_t bz=GetBz(); // getting the local Bz
560 if (!seed->PropagateToX(x,bz)) return kFALSE;
562 xyz0[0]=xyz1[0]; // global pos at the beginning of step
565 seed->GetXYZ(xyz1); // // global pos at the end of step
566 MeanMaterialBudget(xyz0,xyz1,param);
567 Double_t xrho=param[0]*param[4], xx0=param[1];
568 if (dir>0) xrho = -xrho; // outward should be negative
569 if (!seed->ApplyMaterialCorrection(xx0,xrho,mass,kFALSE)) return kFALSE;
576 //______________________________________________________________________________
577 Bool_t AliITSUTrackerGlo::PropagateSeed(AliExternalTrackParam *seed, Double_t xToGo, Double_t mass, Double_t maxStep, Bool_t matCorr)
579 // propagate seed to given x applying material correction if requested
580 const Double_t kEpsilon = 1e-5;
581 Double_t xpos = seed->GetX();
582 Int_t dir = (xpos<xToGo) ? 1:-1;
583 Double_t xyz0[3],xyz1[3],param[7];
585 Bool_t updTime = dir>0 && seed->IsStartedTimeIntegral();
586 if (matCorr || updTime) seed->GetXYZ(xyz1); //starting global position
587 while ( (xToGo-xpos)*dir > kEpsilon){
588 Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep);
589 Double_t x = xpos+step;
590 Double_t bz=GetBz(); // getting the local Bz
591 if (!seed->PropagateTo(x,bz)) return kFALSE;
593 if (matCorr || updTime) {
594 xyz0[0]=xyz1[0]; // global pos at the beginning of step
597 seed->GetXYZ(xyz1); // // global pos at the end of step
600 MeanMaterialBudget(xyz0,xyz1,param);
601 Double_t xrho=param[0]*param[4], xx0=param[1];
602 if (dir>0) xrho = -xrho; // outward should be negative
603 if (!seed->CorrectForMeanMaterial(xx0,xrho,mass)) return kFALSE;
606 else { // matCorr is not requested but time integral is
607 double d0 = xyz1[0]-xyz0[0];
608 double d1 = xyz1[1]-xyz0[1];
609 double d2 = xyz1[2]-xyz0[2];
610 ds = TMath::Sqrt(d0*d0+d1*d1+d2*d2);
613 if (updTime) seed->AddTimeStep(ds);
620 //______________________________________________________________________________
621 void AliITSUTrackerGlo::SaveCurrentTrackHypotheses()
623 // RS: shall we clean up killed seeds?
629 //______________________________________________________________________________
630 void AliITSUTrackerGlo::FinalizeHypotheses()
632 // select winner for each hypothesis, remove cl. sharing conflicts
635 int nh = fHypStore.GetEntriesFast();
636 for (int ih=0;ih<nh;ih++) {
637 AliITSUTrackHyp* hyp = (AliITSUTrackHyp*) fHypStore.UncheckedAt(ih);