]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUTrackerGlo.cxx
remove cerr
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUTrackerGlo.cxx
CommitLineData
32d38de2 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17 TO CHECK
18 GetBz usage
19
20 */
21
22//-------------------------------------------------------------------------
23// Implementation of the ITS Upgrade tracker mother class.
24//-------------------------------------------------------------------------
25#include <TTree.h>
26#include <Riostream.h>
27#include <TMath.h>
28
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"
c61e50c3 38#include "AliITSUClusterPix.h"
32d38de2 39using namespace AliITSUAux;
40using namespace TMath;
41
42
c8d1f258 43//----------------- tmp stuff -----------------
c8d1f258 44
32d38de2 45ClassImp(AliITSUTrackerGlo)
46//_________________________________________________________________________
47AliITSUTrackerGlo::AliITSUTrackerGlo(AliITSUReconstructor* rec)
48: fReconstructor(rec)
49 ,fITS(0)
0091e9f0 50 ,fCurrESDtrack(0)
32d38de2 51 ,fCurrMass(kPionMass)
716ccba7 52 ,fHypStore(100)
53 ,fCurrHyp(0)
c61e50c3 54 ,fSeedsPool("AliITSUSeed",0)
c8d1f258 55 ,fTrCond()
32d38de2 56{
57 // Default constructor
58 if (rec) Init(rec);
59}
60
61//_________________________________________________________________________
62AliITSUTrackerGlo::~AliITSUTrackerGlo()
63{
64 // Default destructor
65 //
66 delete fITS;
67 //
68}
69
70//_________________________________________________________________________
71void AliITSUTrackerGlo::Init(AliITSUReconstructor* rec)
72{
73 // init with external reconstructor
c61e50c3 74 //
32d38de2 75 fITS = new AliITSURecoDet(rec->GetGeom(),"ITSURecoInterface");
76 for (int ilr=fITS->GetNLayersActive();ilr--;) {
77 fITS->GetLayerActive(ilr)->SetClusters(rec->GetClusters(ilr));
78 }
c61e50c3 79 //
80 fSeedsPool.ExpandCreateFast(1000); // RS TOCHECK
c61e50c3 81 //
c8d1f258 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) );
87 //
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) );
92 //
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) );
97 //
98 printf("Tracking Conditions: ");
99 fTrCond.Print();
32d38de2 100}
101
102//_________________________________________________________________________
103Int_t AliITSUTrackerGlo::Clusters2Tracks(AliESDEvent *esdEv)
104{
105 //
106 //
dde91d5d 107 AliITSUReconstructor::GetRecoParam()->Print();
716ccba7 108 int nTrESD = esdEv->GetNumberOfTracks();
109 fHypStore.Delete();
110 if (fHypStore.GetSize()<nTrESD) fHypStore.Expand(nTrESD+100);
111 //
32d38de2 112 fITS->ProcessClusters();
113 // select ESD tracks to propagate
32d38de2 114 for (int itr=0;itr<nTrESD;itr++) {
115 AliESDtrack *esdTr = esdEv->GetTrack(itr);
0091e9f0 116 AliInfo(Form("Processing track %d | MCLabel: %d",itr,esdTr->GetTPCLabel()));
716ccba7 117 FindTrack(esdTr, itr);
32d38de2 118 }
716ccba7 119 //
120 printf("Hypotheses for current event (N seeds in pool: %d, size: %d)\n",fSeedsPool.GetEntriesFast(),fSeedsPool.GetSize());
121 fHypStore.Print();
122 //
32d38de2 123 return 0;
124}
125
126//_________________________________________________________________________
127Int_t AliITSUTrackerGlo::PropagateBack(AliESDEvent * /*event*/)
128{
129 //
130 // To be implemented
131 //
132
133 Info("PropagateBack","To be implemented");
134 return 0;
135}
136
137//_________________________________________________________________________
138Int_t AliITSUTrackerGlo::RefitInward(AliESDEvent * /*event*/)
139{
140 //
141 // To be implemented
142 //
143
144 Info("RefitInward","To be implemented");
145 return 0;
146}
147
148//_________________________________________________________________________
149Int_t AliITSUTrackerGlo::LoadClusters(TTree * treeRP)
150{
151 // read from tree (if pointer provided) or directly from the ITS reco interface
152 //
153 return fReconstructor->LoadClusters(treeRP);
154}
155
156//_________________________________________________________________________
157void AliITSUTrackerGlo::UnloadClusters()
158{
159 //
160 // To be implemented
161 //
162
163 Info("UnloadClusters","To be implemented");
164}
165//_________________________________________________________________________
166AliCluster * AliITSUTrackerGlo::GetCluster(Int_t /*index*/) const
167{
168 //
169 // To be implemented
170 //
171
172 Info("GetCluster","To be implemented");
173 return 0x0;
174}
175
176//_________________________________________________________________________
177Bool_t AliITSUTrackerGlo::NeedToProlong(AliESDtrack* esdTr)
178{
179 // do we need to match this track to ITS?
180 //
181 static double bz = GetBz();
182 if (!esdTr->IsOn(AliESDtrack::kTPCin) ||
183 esdTr->IsOn(AliESDtrack::kTPCout) ||
184 esdTr->IsOn(AliESDtrack::kITSin) ||
185 esdTr->GetKinkIndex(0)>0) return kFALSE;
186 //
c61e50c3 187 if (esdTr->Pt()<AliITSUReconstructor::GetRecoParam()->GetMinPtForProlongation()) return kFALSE;
32d38de2 188 //
189 float dtz[2];
190 esdTr->GetDZ(GetX(),GetY(),GetZ(),bz,dtz);
191 // if track is not V0 candidata but has large offset wrt IP, reject it. RS TOCHECK
c61e50c3 192 if ( !(esdTr->GetV0Index(0)>0 && dtz[0]>AliITSUReconstructor::GetRecoParam()->GetMaxDforV0dghtrForProlongation())
193 && (Abs(dtz[0])>AliITSUReconstructor::GetRecoParam()->GetMaxDForProlongation() ||
194 Abs(dtz[1])>AliITSUReconstructor::GetRecoParam()->GetMaxDZForProlongation())) return kFALSE;
32d38de2 195 //
196 return kTRUE;
197}
198
199//_________________________________________________________________________
716ccba7 200void AliITSUTrackerGlo::FindTrack(AliESDtrack* esdTr, Int_t esdID)
32d38de2 201{
202 // find prolongaion candidates finding for single seed
203 //
204 if (!NeedToProlong(esdTr)) return; // are we interested in this track?
716ccba7 205 if (!InitSeed(esdTr,esdID)) return; // initialize prolongations hypotheses tree
32d38de2 206 //
173b3073 207 AliITSURecoSens *hitSens[AliITSURecoSens::kNNeighbors+1];
f8832015 208 AliITSUSeed seedUC; // copy of the seed from the upper layer
209 AliITSUSeed seedT; // transient seed between the seedUC and new prolongation hypothesis
210 //
c61e50c3 211 TObjArray clArr; // container for transfer of clusters matching to seed
32d38de2 212 //
213 for (int ila=fITS->GetNLayersActive();ila--;) {
214 int ilaUp = ila+1; // prolong seeds from layer above
716ccba7 215 int nSeedsUp = fCurrHyp->GetNSeeds(ilaUp);
32d38de2 216 for (int isd=0;isd<nSeedsUp;isd++) {
716ccba7 217 AliITSUSeed* seedU = fCurrHyp->GetSeed(ilaUp,isd); // seed on prev.active layer to prolong
3dd9c283 218 seedUC = *seedU; // its copy will be prolonged
f8832015 219 seedUC.SetParent(seedU);
943e1898 220 seedUC.ResetFMatrix(); // reset the matrix for propagation to next layer
32d38de2 221 // go till next active layer
c8d1f258 222 AliInfo(Form("working on Lr:%d Seed:%d of %d",ila,isd,nSeedsUp));
f8832015 223 if (!TransportToLayer(&seedUC, fITS->GetLrIDActive(ilaUp), fITS->GetLrIDActive(ila)) ) {
32d38de2 224 //
0091e9f0 225 AliInfo("Transport failed");
32d38de2 226 // Check if the seed satisfies to track definition
3dd9c283 227 if (NeedToKill(&seedUC,kTransportFailed)) seedU->Kill();
32d38de2 228 continue; // RS TODO: decide what to do with tracks stopped on higher layers w/o killing
229 }
230 AliITSURecoLayer* lrA = fITS->GetLayerActive(ila);
f8832015 231 if (!GetRoadWidth(&seedUC, ila)) { // failed to find road width on the layer
3dd9c283 232 if (NeedToKill(&seedUC,kRWCheckFailed)) seedU->Kill();
32d38de2 233 continue;
234 }
173b3073 235 int nsens = lrA->FindSensors(&fTrImpData[kTrPhi0], hitSens); // find detectors which may be hit by the track
0091e9f0 236 AliInfo(Form("Will check %d sensors on lr:%d ",nsens,ila));
32d38de2 237 //
943e1898 238 double bz = GetBz();
32d38de2 239 for (int isn=nsens;isn--;) {
f8832015 240 seedT = seedUC;
c61e50c3 241 AliITSURecoSens* sens = hitSens[isn];
f8832015 242 //
943e1898 243 // We need to propagate the seed to sensor on lrA staying the frame of the sensor from prev.layer,
244 // since the transport matrix should be defined in this frame.
245 double xs; // X in the TF of current seed, corresponding to intersection with sensor plane
246 if (!seedT.GetTrackingXAtXAlpha(sens->GetXTF(),sens->GetPhiTF(),bz, xs)) continue;
247 if (!seedT.PropagateToX(xs,bz)) continue;
716ccba7 248 // if (!seedT.Rotate(sens->GetPhiTF())) continue;
249 if (!seedT.RotateToAlpha(sens->GetPhiTF())) continue;
943e1898 250 //
f8832015 251 int clID0 = sens->GetFirstClusterId();
c61e50c3 252 for (int icl=sens->GetNClusters();icl--;) {
f8832015 253 int res = CheckCluster(&seedT,ila,clID0+icl);
254 //
255 if (res==kStopSearchOnSensor) break; // stop looking on this sensor
256 if (res==kClusterNotMatching) continue; // cluster does not match
257 // cluster is matching and it was added to the hypotheses tree
c61e50c3 258 }
32d38de2 259 }
f8832015 260 // cluster search is done. Do we need ta have a version of this seed skipping current layer
261 seedT.SetLr(ila);
716ccba7 262 if (!NeedToKill(&seedT,kMissingCluster)) {
263 AliITSUSeed* seedSkp = NewSeedFromPool(&seedT);
264 double penalty = -AliITSUReconstructor::GetRecoParam()->GetMissPenalty(ila);
265 // to do: make penalty to account for probability to miss the cluster for good reason
266 seedSkp->SetChi2Cl(penalty);
267 AddProlongationHypothesis(seedSkp,ila);
268 }
32d38de2 269 }
716ccba7 270 ((TObjArray*)fCurrHyp->GetLayerSeeds(ila))->Sort();
c8d1f258 271 printf(">>> All hypotheses on lr %d: \n",ila);
716ccba7 272 for (int ih=0;ih<fCurrHyp->GetNSeeds(ila);ih++) {
273 printf(" #%3d ",ih); fCurrHyp->GetSeed(ila,ih)->Print();
274 //
275 /*
276 if (ila!=0) continue;
277 double vecL[5] = {0};
278 double matL[15] = {0};
279 AliITSUSeed* sp = fCurrHyp->GetSeed(ila,ih);
280 while(sp->GetParent()) {
281 sp->Smooth(vecL,matL);
282 if (sp->GetLayerID()>=fITS->GetNLayersActive()-1) break;
283 sp = (AliITSUSeed*)sp->GetParent();
284 }
285 */
c8d1f258 286 }
32d38de2 287 }
288 //
716ccba7 289 SaveCurrentTrackHypotheses();
290 //
32d38de2 291}
292
293//_________________________________________________________________________
716ccba7 294Bool_t AliITSUTrackerGlo::InitSeed(AliESDtrack *esdTr, Int_t esdID)
32d38de2 295{
c61e50c3 296 // init prolongaion candidates finding for single seed
716ccba7 297 fCurrHyp = GetTrackHyp(esdID);
298 if (fCurrHyp) return kTRUE;
299 //
32d38de2 300 fCurrMass = esdTr->GetMass();
0091e9f0 301 fCurrESDtrack = esdTr;
32d38de2 302 if (fCurrMass<kPionMass*0.9) fCurrMass = kPionMass; // don't trust to mu, e identification from TPCin
c61e50c3 303 //
304 AliITSUSeed* seed = NewSeedFromPool();
dde91d5d 305 seed->SetLr(fITS->GetNLayersActive()); // fake layer
c61e50c3 306 seed->AliExternalTrackParam::operator=(*esdTr);
307 seed->SetParent(esdTr);
716ccba7 308 int nl = fITS->GetNLayersActive();
309 fCurrHyp = new AliITSUTrackHyp(nl);
310 fCurrHyp->SetESDSeed(seed);
311 AddProlongationHypothesis(seed,nl);
312 fCurrHyp->SetUniqueID(esdID);
313 SetTrackHyp(fCurrHyp,esdID);
32d38de2 314 return kTRUE;
315 // TO DO
316}
317
318//_________________________________________________________________________
319Bool_t AliITSUTrackerGlo::TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo)
320{
321 // transport seed from layerFrom to the entrance of layerTo
322 //
323 const double kToler = 1e-6; // tolerance for layer on-surface check
324 //
325 int dir = lTo > lFrom ? 1:-1;
326 AliITSURecoLayer* lrFr = fITS->GetLayer(lFrom); // this can be 0 when extrapolation from TPC to ITS is requested
327 Bool_t checkFirst = kTRUE;
328 while(lFrom!=lTo) {
329 double curR2 = seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY(); // current radius
330 if (lrFr) {
331 Bool_t doLayer = kTRUE;
332 double xToGo = dir>0 ? lrFr->GetRMax() : lrFr->GetRMin();
333 if (checkFirst) { // do we need to track till the surface of the current layer ?
334 checkFirst = kFALSE;
335 if (dir>0) { if (curR2-xToGo*xToGo>kToler) doLayer = kFALSE; } // on the surface or outside of the layer
336 else if (dir<0) { if (xToGo*xToGo-curR2>kToler) doLayer = kFALSE; } // on the surface or outside of the layer
337 }
338 if (doLayer) {
339 if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
340 // go via layer to its boundary, applying material correction.
44785f3e 341 if (!PropagateSeed(seed,xToGo,fCurrMass, lrFr->GetMaxStep())) return kFALSE;
32d38de2 342 }
343 }
344 AliITSURecoLayer* lrTo = fITS->GetLayer( (lFrom+=dir) );
345 if (!lrTo) AliFatal(Form("Layer %d does not exist",lFrom));
346 //
347 // go the entrance of the layer, assuming no materials in between
348 double xToGo = dir>0 ? lrTo->GetRMin() : lrTo->GetRMax();
dde91d5d 349 if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
44785f3e 350 if (!PropagateSeed(seed,xToGo,fCurrMass,100, kFALSE )) return kFALSE;
32d38de2 351 lrFr = lrTo;
352 }
353 return kTRUE;
354 //
355}
356
357//_________________________________________________________________________
c61e50c3 358Bool_t AliITSUTrackerGlo::GetRoadWidth(AliITSUSeed* seed, int ilrA)
32d38de2 359{
360 // calculate road width in terms of phi and z for the track which MUST be on the external radius of the layer
361 // as well as some aux info
362 double bz = GetBz();
363 AliITSURecoLayer* lrA = fITS->GetLayerActive(ilrA);
c61e50c3 364 seed->GetXYZ(&fTrImpData[kTrXIn]); // lab position at the entrance from above
943e1898 365 static AliExternalTrackParam sc; // seed copy for manipalitions
366 sc = *seed;
32d38de2 367 //
c61e50c3 368 fTrImpData[kTrPhiIn] = ATan2(fTrImpData[kTrYIn],fTrImpData[kTrXIn]);
943e1898 369 if (!sc.Rotate(fTrImpData[kTrPhiIn])) return kFALSE; // go to the frame of the entry point into the layer
c61e50c3 370 double dr = lrA->GetDR(); // approximate X dist at the inner radius
943e1898 371 if (!sc.GetXYZAt(sc.GetX()-dr, bz, fTrImpData + kTrXOut)) {
32d38de2 372 // special case: track does not reach inner radius, might be tangential
943e1898 373 double r = sc.GetD(0,0,bz);
32d38de2 374 double x;
943e1898 375 if (!sc.GetXatLabR(r,x,bz,-1)) {
376 sc.Print();
377 AliFatal(Form("This should not happen: r=%f",r));
32d38de2 378 }
943e1898 379 dr = Abs(sc.GetX() - x);
380 if (!sc.GetXYZAt(x, bz, fTrImpData + kTrXOut)) {
381 sc.Print();
382 AliFatal(Form("This should not happen: x=%f",x));
32d38de2 383 }
384 }
385 //
c61e50c3 386 fTrImpData[kTrPhiOut] = ATan2(fTrImpData[kTrYOut],fTrImpData[kTrXOut]);
943e1898 387 double sgy = sc.GetSigmaY2() + dr*dr*sc.GetSigmaSnp2() + AliITSUReconstructor::GetRecoParam()->GetSigmaY2(ilrA);
388 double sgz = sc.GetSigmaZ2() + dr*dr*sc.GetSigmaTgl2() + AliITSUReconstructor::GetRecoParam()->GetSigmaZ2(ilrA);
c61e50c3 389 sgy = Sqrt(sgy)*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadY();
390 sgz = Sqrt(sgz)*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadZ();
391 fTrImpData[kTrPhi0] = 0.5*(fTrImpData[kTrPhiOut]+fTrImpData[kTrPhiIn]);
173b3073 392 fTrImpData[kTrZ0] = 0.5*(fTrImpData[kTrZOut]+fTrImpData[kTrZIn]);
c61e50c3 393 fTrImpData[kTrDPhi] = 0.5*Abs(fTrImpData[kTrPhiOut]-fTrImpData[kTrPhiIn]) + sgy/lrA->GetR();
173b3073 394 fTrImpData[kTrDZ] = 0.5*Abs(fTrImpData[kTrZOut]-fTrImpData[kTrZIn]) + sgz;
32d38de2 395 //
396 return kTRUE;
397}
398
399//_________________________________________________________________________
c61e50c3 400AliITSUSeed* AliITSUTrackerGlo::NewSeedFromPool(const AliITSUSeed* src)
32d38de2 401{
402 // create new seed, optionally copying from the source
403 return src ?
404 new(fSeedsPool[fSeedsPool.GetEntriesFast()]) AliITSUSeed(*src) :
405 new(fSeedsPool[fSeedsPool.GetEntriesFast()]) AliITSUSeed();
406}
f8832015 407
408//_________________________________________________________________________
409Int_t AliITSUTrackerGlo::CheckCluster(AliITSUSeed* track, Int_t lr, Int_t clID)
410{
411 // Check if the cluster (in tracking frame!) is matching to track.
412 // The track must be already propagated to sensor tracking frame.
413 // Returns: kStopSearchOnSensor if the search on given sensor should be stopped,
414 // kClusterMatching if the cluster is matching
415 // kClusterMatching otherwise
416 //
f8832015 417 const double kTolerX = 5e-4;
418 AliCluster *cl = fITS->GetLayerActive(lr)->GetCluster(clID);
419 //
c8d1f258 420 Bool_t goodCl = kFALSE;
716ccba7 421 int currLabel = Abs(fCurrESDtrack->GetTPCLabel());
422 //
423 if (cl->GetLabel(0)>=0) {for (int i=0;i<3;i++) if (cl->GetLabel(i)>=0 && cl->GetLabel(i)==currLabel) {goodCl = kTRUE; break;}}
424 else goodCl = kTRUE;
c8d1f258 425 //
f8832015 426 if (TMath::Abs(cl->GetX())>kTolerX) { // if due to the misalingment X is large, propagate track only
c8d1f258 427 if (!track->PropagateParamOnlyTo(track->GetX()+cl->GetX(),GetBz())) {
3dd9c283 428 if (goodCl) {printf("Loose good cl: Failed propagation. |"); cl->Print();}
c8d1f258 429 return kStopSearchOnSensor; // propagation failed, seedT is intact
430 }
f8832015 431 }
3dd9c283 432 double dy = cl->GetY()-track->GetY();
c8d1f258 433 double dz = cl->GetZ()-track->GetZ();
0091e9f0 434 //
f8832015 435 double dy2 = dy*dy;
436 double tol2 = (track->GetSigmaY2() + AliITSUReconstructor::GetRecoParam()->GetSigmaY2(lr))*
437 AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadY()*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadY(); // RS TOOPTIMIZE
438 if (dy2>tol2) { // the clusters are sorted in Z(col) then in Y(row).
3dd9c283 439 if (goodCl) {printf("Loose good cl: dy2=%e > tol2=%e |",dy2,tol2); cl->Print();}
f8832015 440 if (dy>0) return kStopSearchOnSensor; // No chance that other cluster of this sensor will match (all Y's will be even larger)
441 else return kClusterNotMatching; // Other clusters may match
442 }
c8d1f258 443 double dz2 = dz*dz;
f8832015 444 tol2 = (track->GetSigmaZ2() + AliITSUReconstructor::GetRecoParam()->GetSigmaZ2(lr))*
445 AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadZ()*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadZ(); // RS TOOPTIMIZE
c8d1f258 446 if (dz2>tol2) {
3dd9c283 447 if (goodCl) {printf("Loose good cl: dz2=%e > tol2=%e |",dz2,tol2); cl->Print();}
c8d1f258 448 return kClusterNotMatching; // Other clusters may match
449 }
f8832015 450 //
451 // check chi2
452 Double_t p[2]={cl->GetY(), cl->GetZ()};
453 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
454 double chi2 = track->GetPredictedChi2(p,cov);
c8d1f258 455 if (chi2>AliITSUReconstructor::GetRecoParam()->GetMaxTr2ClChi2(lr)) {
3dd9c283 456 if (goodCl) {
716ccba7 457 printf("Loose good cl: Chi2=%e > Chi2Max=%e |dy: %+.3e dz: %+.3e\n",
458 chi2,AliITSUReconstructor::GetRecoParam()->GetMaxTr2ClChi2(lr),dy,dz);
3dd9c283 459 track->Print("etp");
460 cl->Print("");
461 }
c8d1f258 462 return kClusterNotMatching;
463 }
f8832015 464 //
465 track = NewSeedFromPool(track); // input track will be reused, use its clone for updates
943e1898 466 if (!track->Update()) {
3dd9c283 467 if (goodCl) {printf("Loose good cl: Failed update |"); cl->Print();}
c8d1f258 468 return kClusterNotMatching;
469 }
f8832015 470 track->SetChi2Cl(chi2);
471 track->SetLrClusterID(lr,clID);
472 cl->IncreaseClusterUsage();
473 //
716ccba7 474 track->SetFake(!goodCl);
475 //
476 AliInfo(Form("AddCl(%d) Cl%d lr:%d: dY:%+8.4f dZ:%+8.4f (MC: %5d %5d %5d) |Chi2=%f(%c)",
477 goodCl,clID,lr,dy,dz2,cl->GetLabel(0),cl->GetLabel(1),cl->GetLabel(2), chi2, track->IsFake() ? '-':'+'));
c8d1f258 478 //
f8832015 479 AddProlongationHypothesis(track,lr);
480 //
481 return kClusterMatching;
482}
c8d1f258 483
484//_________________________________________________________________________
485Bool_t AliITSUTrackerGlo::NeedToKill(AliITSUSeed *seed, Int_t flag)
486{
487 // check if the seed should not be discarded
488 const UShort_t kMask = 0xffff;
489 if (flag==kMissingCluster) {
490 int lastChecked = seed->GetLayerID();
491 UShort_t patt = seed->GetHitsPattern();
492 if (lastChecked) patt |= ~(kMask<<lastChecked); // not all layers were checked, complete unchecked once by potential hits
493 Bool_t seedOK = fTrCond.CheckPattern(patt);
494 return !seedOK;
495 }
496 return kTRUE;
497}
44785f3e 498
499//______________________________________________________________________________
500Bool_t AliITSUTrackerGlo::PropagateSeed(AliITSUSeed *seed, Double_t xToGo, Double_t mass, Double_t maxStep, Bool_t matCorr)
501{
502 // propagate seed to given x applying material correction if requested
503 const Double_t kEpsilon = 1e-5;
504 Double_t xpos = seed->GetX();
505 Int_t dir = (xpos<xToGo) ? 1:-1;
506 Double_t xyz0[3],xyz1[3],param[7];
507 //
508 if (matCorr) seed->GetXYZ(xyz1); //starting global position
509 while ( (xToGo-xpos)*dir > kEpsilon){
510 Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep);
511 Double_t x = xpos+step;
512 Double_t bz=GetBz(); // getting the local Bz
513 if (!seed->PropagateToX(x,bz)) return kFALSE;
514 if (matCorr) {
515 xyz0[0]=xyz1[0]; // global pos at the beginning of step
516 xyz0[1]=xyz1[1];
517 xyz0[2]=xyz1[2];
518 seed->GetXYZ(xyz1); // // global pos at the end of step
519 MeanMaterialBudget(xyz0,xyz1,param);
520 Double_t xrho=param[0]*param[4], xx0=param[1];
521 if (dir>0) xrho = -xrho; // outward should be negative
522 if (!seed->ApplyMaterialCorrection(xx0,xrho,mass,kFALSE)) return kFALSE;
523 }
524 xpos = seed->GetX();
525 }
526 return kTRUE;
527}
716ccba7 528
529//______________________________________________________________________________
530void AliITSUTrackerGlo::SaveCurrentTrackHypotheses()
531{
532 // RS: shall we clean up killed seeds?
533 fCurrHyp = 0;
534 // TODO
535
536}