update in integrated v2 macro
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUTrackerGlo.h
... / ...
CommitLineData
1#ifndef ALIITSTRACKERU_H
2#define ALIITSTRACKERU_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6//-------------------------------------------------------------------------
7// ITS upgrade tracker base class
8//-------------------------------------------------------------------------
9
10#include "AliTracker.h"
11#include "AliESDEvent.h"
12#include "AliITSUSeed.h"
13#include "AliITSUTrackCond.h"
14#include "AliITSUTrackHyp.h"
15
16class AliITSUReconstructor;
17class AliITSURecoDet;
18class AliITSUClusterPix;
19class AliESDtrack;
20class AliITSURecoLayer;
21class TTree;
22
23
24//-------------------------------------------------------------------------
25class AliITSUTrackerGlo : public AliTracker {
26
27 public:
28 enum {kClus2Tracks,kPropBack,kRefitInw,kNTrackingPhases}; // tracking phases
29 enum { // info from track extrapolation to layer for cluster check
30 kTrXIn ,kTrYIn ,kTrZIn ,kTrPhiIn , // entrance (outer) point on the layer from above
31 kTrXOut,kTrYOut,kTrZOut,kTrPhiOut, // exit (inner) point on the layer
32 kTrPhi0, kTrDPhi, kTrZ0, kTrDZ, // mean phi,dPhi, mean z, dZ (don't change this order)
33 kNTrImpData};
34 //
35 enum {kMissingCluster=0 // no cluster found on this layer
36 ,kTransportFailed=1 // seed did not reach target layer
37 ,kRWCheckFailed =2 // failed to rotate the seed to frame of the layer impact point
38 };
39 enum {kStopSearchOnSensor,kClusterNotMatching,kClusterMatching}; // flags for track-to-cluster checks
40 //
41 enum {kDummyLabel=-3141593};
42 //
43 AliITSUTrackerGlo(AliITSUReconstructor* rec);
44 virtual ~AliITSUTrackerGlo();
45
46 virtual Int_t Clusters2Tracks(AliESDEvent *event);
47 virtual Int_t PropagateBack(AliESDEvent *event);
48 virtual Int_t RefitInward(AliESDEvent *event);
49 virtual Int_t LoadClusters(TTree * treeRP=0);
50 virtual void UnloadClusters();
51 virtual AliCluster* GetCluster(Int_t index) const;
52 //
53 Int_t GetCountPronlongationTrials() const {return fCountProlongationTrials;}
54 Int_t GetCountITSin() const {return fCountITSin;}
55 Int_t GetCountITSout() const {return fCountITSout;}
56 Int_t GetCountITSrefit() const {return fCountITSrefit;}
57
58 //------------------------------------
59 AliITSURecoDet* GetITSInterface() const {return fITS;}
60 //
61 //------------------------------------
62 Bool_t NeedToProlong(AliESDtrack* estTr);
63 void Init(AliITSUReconstructor* rec);
64 void FindTrack(AliESDtrack* esdTr, Int_t esdID);
65 void CreateDefaultTrackCond();
66 Bool_t InitHypothesis(AliESDtrack *esdTr, Int_t esdID);
67 Bool_t TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo);
68 Bool_t TransportToLayer(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo);
69 Bool_t TransportToLayerX(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo, Double_t xStop);
70 Bool_t GoToExitFromLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
71 Bool_t GoToExitFromLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
72 Bool_t GoToEntranceToLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
73 Bool_t GoToEntranceToLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
74 Bool_t PropagateSeed(AliITSUSeed *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
75 Bool_t PropagateSeed(AliExternalTrackParam *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
76 Bool_t RefitTrack(AliITSUTrackHyp* trc, Double_t r, Bool_t stopAtLastCl=kFALSE);
77 Int_t GetTrackingPhase() const {return fTrackPhase;}
78
79 //
80 void KillSeed(AliITSUSeed* seed, Bool_t branch=kFALSE);
81 Bool_t NeedToKill(AliITSUSeed* seed, Int_t flag);
82 Bool_t GetRoadWidth(AliITSUSeed* seed, int ilrA);
83 Int_t CheckCluster(AliITSUSeed* seed, Int_t lr, Int_t clID);
84 void AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr);
85 Bool_t AddSeedBranch(AliITSUSeed* seed);
86 void ValidateAllowedBranches(Int_t accMax);
87 void ValidateAllowedCandidates(Int_t ilr, Int_t accMax);
88 //
89 AliITSUSeed* NewSeedFromPool(const AliITSUSeed* src=0);
90 void ResetSeedsPool();
91 void MarkSeedFree(AliITSUSeed* seed );
92
93 AliITSUTrackHyp* GetTrackHyp(Int_t id) const {return (AliITSUTrackHyp*)fHypStore.UncheckedAt(id);}
94 void SetTrackHyp(AliITSUTrackHyp* hyp,Int_t id) {fHypStore.AddAtAndExpand(hyp,id);}
95 void DeleteLastSeedFromPool() {fSeedsPool.RemoveLast();}
96 void SaveCurrentTrackHypotheses();
97 void FinalizeHypotheses();
98 void UpdateESDTrack(AliITSUTrackHyp* hyp,Int_t flag);
99 void CookMCLabel(AliITSUTrackHyp* hyp);
100 void SetTrackingPhase(Int_t p) {fTrackPhase = p;}
101 //
102 protected:
103 TObject*& NextFreeSeed();
104 //
105 private:
106 //
107 AliITSUTrackerGlo(const AliITSUTrackerGlo&);
108 AliITSUTrackerGlo &operator=(const AliITSUTrackerGlo &tr);
109 //
110 protected:
111 AliITSUReconstructor* fReconstructor; // ITS global reconstructor
112 AliITSURecoDet* fITS; // interface to ITS, borrowed from reconstructor
113 AliESDtrack* fCurrESDtrack; // current esd track in processing
114 Int_t fCurrESDtrMClb; // its eventual mc label
115 Double_t fCurrMass; // current track mass
116 Double_t fTrImpData[kNTrImpData]; // data on track impact on the layer
117 //
118 Int_t fCountProlongationTrials; // number of TPC seeds
119 Int_t fCountITSin; // number of successful ITSin
120 Int_t fCountITSout; // number of successful ITSout
121 Int_t fCountITSrefit; // number of successful ITSrefit
122 //
123 // the seeds management to be optimized
124 TObjArray fHypStore; // storage for tracks hypotheses
125 AliITSUSeed* fLayerCandidates[AliITSUTrackCond::kMaxCandidates]; // array for branches of current track prolongation
126 Int_t fNBranchesAdded; // number of branches created for current seed in prolongation
127 Int_t fNCandidatesAdded; // number of candidates added for current seed in prolongation
128 AliITSUTrackHyp* fCurrHyp; // hypotheses container for current track
129 TClonesArray fSeedsPool; //! pool for seeds
130 TArrayI fFreeSeedsID; //! array of ID's of freed seeds
131 Int_t fNFreeSeeds; //! number of seeds freed in the pool
132 Int_t fLastSeedID; //! id of the pool seed on which is returned by the NextFreeSeed method
133 //
134 TObjArray fDefTrackConds; //! default tracking conditions
135 AliITSUTrackCond* fCurrTrackCond; // current tracking condition
136 Int_t fTrackPhase; // tracking phase
137 Int_t* fClInfo; //! auxiliary track cluster info
138 //
139 static const Double_t fgkToler; // tracking tolerance
140 //
141 ClassDef(AliITSUTrackerGlo,1) //ITS upgrade tracker
142
143};
144
145//________________________________________
146inline TObject *&AliITSUTrackerGlo::NextFreeSeed()
147{
148 // return next free slot where the seed can be created
149 fLastSeedID = fNFreeSeeds ? fFreeSeedsID.GetArray()[--fNFreeSeeds] : fSeedsPool.GetEntriesFast();
150 // AliInfo(Form("%d",fLastSeedID));
151 return fSeedsPool[ fLastSeedID ];
152 //
153}
154
155//_________________________________________________________________________
156inline AliITSUSeed* AliITSUTrackerGlo::NewSeedFromPool(const AliITSUSeed* src)
157{
158 // create new seed, optionally copying from the source
159 AliITSUSeed* sd = src ? new( NextFreeSeed() ) AliITSUSeed(*src) : new( NextFreeSeed() ) AliITSUSeed();
160 sd->SetPoolID(fLastSeedID);
161 return sd;
162}
163
164//_________________________________________________________________________
165inline void AliITSUTrackerGlo::KillSeed(AliITSUSeed* seed, Bool_t branch)
166{
167 // flag seed as killed, if requested, kill recursively its parents whose sole child is the seed being killed
168 seed->Kill();
169 seed = (AliITSUSeed*)seed->GetParent();
170 if (seed && !seed->DecChildren() && branch) KillSeed(seed,branch);
171}
172
173//_________________________________________________________________________
174inline void AliITSUTrackerGlo::AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr)
175{
176 // add new seed prolongation hypothesis
177 fCurrHyp->AddSeed(seed,lr);
178}
179
180#endif
181