]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUTrackerGlo.h
Modification of seeds mem.management, only reduced version of candidates is
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUTrackerGlo.h
CommitLineData
32d38de2 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
53870004 6#define _FILL_CONTROL_HISTOS_
7
32d38de2 8//-------------------------------------------------------------------------
9// ITS upgrade tracker base class
10//-------------------------------------------------------------------------
11
12#include "AliTracker.h"
13#include "AliESDEvent.h"
f8832015 14#include "AliITSUSeed.h"
c8d1f258 15#include "AliITSUTrackCond.h"
716ccba7 16#include "AliITSUTrackHyp.h"
32d38de2 17
18class AliITSUReconstructor;
19class AliITSURecoDet;
c61e50c3 20class AliITSUClusterPix;
0091e9f0 21class AliESDtrack;
e2d2481c 22class AliITSURecoLayer;
32d38de2 23class TTree;
24
c61e50c3 25
32d38de2 26//-------------------------------------------------------------------------
27class AliITSUTrackerGlo : public AliTracker {
28
29 public:
76390254 30 enum {kClus2Tracks,kPropBack,kRefitInw,kNTrackingPhases}; // tracking phases
32d38de2 31 enum { // info from track extrapolation to layer for cluster check
32 kTrXIn ,kTrYIn ,kTrZIn ,kTrPhiIn , // entrance (outer) point on the layer from above
33 kTrXOut,kTrYOut,kTrZOut,kTrPhiOut, // exit (inner) point on the layer
34 kTrPhi0, kTrDPhi, kTrZ0, kTrDZ, // mean phi,dPhi, mean z, dZ (don't change this order)
c61e50c3 35 kNTrImpData};
32d38de2 36 //
f8832015 37 enum {kMissingCluster=0 // no cluster found on this layer
38 ,kTransportFailed=1 // seed did not reach target layer
32d38de2 39 ,kRWCheckFailed =2 // failed to rotate the seed to frame of the layer impact point
40 };
f8832015 41 enum {kStopSearchOnSensor,kClusterNotMatching,kClusterMatching}; // flags for track-to-cluster checks
dd2117a2 42 //
43 enum {kDummyLabel=-3141593};
38997c3c 44 //
32d38de2 45 AliITSUTrackerGlo(AliITSUReconstructor* rec);
46 virtual ~AliITSUTrackerGlo();
47
48 virtual Int_t Clusters2Tracks(AliESDEvent *event);
49 virtual Int_t PropagateBack(AliESDEvent *event);
50 virtual Int_t RefitInward(AliESDEvent *event);
51 virtual Int_t LoadClusters(TTree * treeRP=0);
52 virtual void UnloadClusters();
53 virtual AliCluster* GetCluster(Int_t index) const;
53870004 54 void FlagSplitClusters();
55 Bool_t ContainsSplitCluster(const AliITSUSeed* seed, Int_t maxSize=99999);
56 void PrintSeedClusters(const AliITSUSeed* seed, Option_t* option="");
0ddbf657 57 //
58 Int_t GetCountPronlongationTrials() const {return fCountProlongationTrials;}
59 Int_t GetCountITSin() const {return fCountITSin;}
60 Int_t GetCountITSout() const {return fCountITSout;}
61 Int_t GetCountITSrefit() const {return fCountITSrefit;}
62
0091e9f0 63 //------------------------------------
64 AliITSURecoDet* GetITSInterface() const {return fITS;}
65 //
32d38de2 66 //------------------------------------
67 Bool_t NeedToProlong(AliESDtrack* estTr);
68 void Init(AliITSUReconstructor* rec);
716ccba7 69 void FindTrack(AliESDtrack* esdTr, Int_t esdID);
42c3d4bd 70 void CreateDefaultTrackCond();
6cd80116 71 AliITSUTrackHyp* InitHypothesis(AliESDtrack *esdTr, Int_t esdID);
32d38de2 72 Bool_t TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo);
3e4e3c23 73 Bool_t TransportToLayer(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo);
b515ad7e 74 Bool_t TransportToLayerX(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo, Double_t xStop);
e7d83d38 75 Bool_t GoToExitFromLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
76 Bool_t GoToExitFromLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
e2d2481c 77 Bool_t GoToEntranceToLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
78 Bool_t GoToEntranceToLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
44785f3e 79 Bool_t PropagateSeed(AliITSUSeed *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
3e4e3c23 80 Bool_t PropagateSeed(AliExternalTrackParam *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
68a0f687 81 Bool_t RefitTrack(AliITSUTrackHyp* trc, Double_t r, Bool_t stopAtLastCl=kFALSE);
e7d83d38 82 Int_t GetTrackingPhase() const {return fTrackPhase;}
83
44785f3e 84 //
b8b59e05 85 void KillSeed(AliITSUSeed* seed, Bool_t branch=kFALSE);
c8d1f258 86 Bool_t NeedToKill(AliITSUSeed* seed, Int_t flag);
c61e50c3 87 Bool_t GetRoadWidth(AliITSUSeed* seed, int ilrA);
f8832015 88 Int_t CheckCluster(AliITSUSeed* seed, Int_t lr, Int_t clID);
89 void AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr);
38997c3c 90 Bool_t AddSeedBranch(AliITSUSeed* seed);
91 void ValidateAllowedBranches(Int_t accMax);
92 void ValidateAllowedCandidates(Int_t ilr, Int_t accMax);
c03e4f8a 93 void FlagSeedClusters(const AliITSUSeed* seed, Bool_t flg);
c61e50c3 94 //
95 AliITSUSeed* NewSeedFromPool(const AliITSUSeed* src=0);
b8b59e05 96 void ResetSeedsPool();
97 void MarkSeedFree(AliITSUSeed* seed );
98
716ccba7 99 AliITSUTrackHyp* GetTrackHyp(Int_t id) const {return (AliITSUTrackHyp*)fHypStore.UncheckedAt(id);}
100 void SetTrackHyp(AliITSUTrackHyp* hyp,Int_t id) {fHypStore.AddAtAndExpand(hyp,id);}
101 void DeleteLastSeedFromPool() {fSeedsPool.RemoveLast();}
6cd80116 102 void SaveReducedHypothesesTree(AliITSUTrackHyp* dest);
3e4e3c23 103 void FinalizeHypotheses();
68a0f687 104 void UpdateESDTrack(AliITSUTrackHyp* hyp,Int_t flag);
dd2117a2 105 void CookMCLabel(AliITSUTrackHyp* hyp);
e7d83d38 106 void SetTrackingPhase(Int_t p) {fTrackPhase = p;}
716ccba7 107 //
b8b59e05 108 protected:
109 TObject*& NextFreeSeed();
110 //
32d38de2 111 private:
b8b59e05 112 //
32d38de2 113 AliITSUTrackerGlo(const AliITSUTrackerGlo&);
114 AliITSUTrackerGlo &operator=(const AliITSUTrackerGlo &tr);
115 //
116 protected:
117 AliITSUReconstructor* fReconstructor; // ITS global reconstructor
3d4dc3e2 118 AliITSURecoDet* fITS; // interface to ITS, borrowed from reconstructor
0091e9f0 119 AliESDtrack* fCurrESDtrack; // current esd track in processing
0ddbf657 120 Int_t fCurrESDtrMClb; // its eventual mc label
32d38de2 121 Double_t fCurrMass; // current track mass
c61e50c3 122 Double_t fTrImpData[kNTrImpData]; // data on track impact on the layer
32d38de2 123 //
0ddbf657 124 Int_t fCountProlongationTrials; // number of TPC seeds
125 Int_t fCountITSin; // number of successful ITSin
126 Int_t fCountITSout; // number of successful ITSout
127 Int_t fCountITSrefit; // number of successful ITSrefit
128 //
c61e50c3 129 // the seeds management to be optimized
716ccba7 130 TObjArray fHypStore; // storage for tracks hypotheses
6cd80116 131 Int_t fLayerMaxCandidates; //! size of tmp candidates array
132 AliITSUSeed** fLayerCandidates;//! array for branches of current track prolongation
38997c3c 133 Int_t fNBranchesAdded; // number of branches created for current seed in prolongation
134 Int_t fNCandidatesAdded; // number of candidates added for current seed in prolongation
6cd80116 135 AliITSUTrackHyp* fCurrHyp; //! hypotheses container for current track
136 AliITSUTrackHyp* fWorkHyp; //! temporary hypothesis for track finding
b8b59e05 137 TClonesArray fSeedsPool; //! pool for seeds
138 TArrayI fFreeSeedsID; //! array of ID's of freed seeds
139 Int_t fNFreeSeeds; //! number of seeds freed in the pool
140 Int_t fLastSeedID; //! id of the pool seed on which is returned by the NextFreeSeed method
6cd80116 141 Int_t fNLrActive; //! number of active layers
c8d1f258 142 //
42c3d4bd 143 TObjArray fDefTrackConds; //! default tracking conditions
c03e4f8a 144 AliITSUTrackCond* fCurrTrackCond; //! current tracking condition
145 Int_t fCurrActLrID; //! current active layer ID being processed (set only when needed, not guaranteed)
146 AliITSURecoLayer* fCurrLayer; //! current layer being processed (set only when needed, not guaranteed)
147 Int_t fTrackPhase; //! tracking phase
8b16dbae 148 Int_t* fClInfo; //! auxiliary track cluster info
c8d1f258 149 //
e2d2481c 150 static const Double_t fgkToler; // tracking tolerance
151 //
53870004 152#ifdef _FILL_CONTROL_HISTOS_
153 // this code is only for special histos needed to extract some control parameters
154 void BookControlHistos();
155 TObjArray* fCHistoArr;
c03e4f8a 156 enum {kHResY=0,kHResYP=10,kHResZ=20,kHResZP=30,kHChi2Cl=40,kHChi2Nrm=50,kHBestInBranch=60,kHBestInCand=70};
53870004 157 enum {kHistosPhase=100};
158 //
159#endif
160
32d38de2 161 ClassDef(AliITSUTrackerGlo,1) //ITS upgrade tracker
162
163};
f8832015 164
b8b59e05 165//________________________________________
166inline TObject *&AliITSUTrackerGlo::NextFreeSeed()
167{
168 // return next free slot where the seed can be created
169 fLastSeedID = fNFreeSeeds ? fFreeSeedsID.GetArray()[--fNFreeSeeds] : fSeedsPool.GetEntriesFast();
170 // AliInfo(Form("%d",fLastSeedID));
171 return fSeedsPool[ fLastSeedID ];
172 //
173}
174
175//_________________________________________________________________________
176inline AliITSUSeed* AliITSUTrackerGlo::NewSeedFromPool(const AliITSUSeed* src)
177{
178 // create new seed, optionally copying from the source
179 AliITSUSeed* sd = src ? new( NextFreeSeed() ) AliITSUSeed(*src) : new( NextFreeSeed() ) AliITSUSeed();
180 sd->SetPoolID(fLastSeedID);
181 return sd;
182}
183
184//_________________________________________________________________________
185inline void AliITSUTrackerGlo::KillSeed(AliITSUSeed* seed, Bool_t branch)
186{
187 // flag seed as killed, if requested, kill recursively its parents whose sole child is the seed being killed
188 seed->Kill();
189 seed = (AliITSUSeed*)seed->GetParent();
190 if (seed && !seed->DecChildren() && branch) KillSeed(seed,branch);
191}
f8832015 192
38997c3c 193//_________________________________________________________________________
194inline void AliITSUTrackerGlo::AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr)
195{
196 // add new seed prolongation hypothesis
197 fCurrHyp->AddSeed(seed,lr);
198}
199
32d38de2 200#endif
201