]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUTrackerGlo.h
1) Added optional usage of lookup table for mat.budget queries at
[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
6//-------------------------------------------------------------------------
7// ITS upgrade tracker base class
8//-------------------------------------------------------------------------
32d38de2 9#include "AliTracker.h"
10#include "AliESDEvent.h"
f8832015 11#include "AliITSUSeed.h"
c8d1f258 12#include "AliITSUTrackCond.h"
716ccba7 13#include "AliITSUTrackHyp.h"
08419930 14#include "AliITSUAux.h"
e1ef49ad 15#include "AliITSUMatLUT.h"
9cdcba2c 16#include <TArrayI.h>
32d38de2 17
18class AliITSUReconstructor;
19class AliITSURecoDet;
c61e50c3 20class AliITSUClusterPix;
0091e9f0 21class AliESDtrack;
e2d2481c 22class AliITSURecoLayer;
32d38de2 23class TTree;
24
25//-------------------------------------------------------------------------
26class AliITSUTrackerGlo : public AliTracker {
27
28 public:
76390254 29 enum {kClus2Tracks,kPropBack,kRefitInw,kNTrackingPhases}; // tracking phases
32d38de2 30 enum { // info from track extrapolation to layer for cluster check
31 kTrXIn ,kTrYIn ,kTrZIn ,kTrPhiIn , // entrance (outer) point on the layer from above
32 kTrXOut,kTrYOut,kTrZOut,kTrPhiOut, // exit (inner) point on the layer
33 kTrPhi0, kTrDPhi, kTrZ0, kTrDZ, // mean phi,dPhi, mean z, dZ (don't change this order)
c61e50c3 34 kNTrImpData};
32d38de2 35 //
f8832015 36 enum {kMissingCluster=0 // no cluster found on this layer
37 ,kTransportFailed=1 // seed did not reach target layer
32d38de2 38 ,kRWCheckFailed =2 // failed to rotate the seed to frame of the layer impact point
39 };
f8832015 40 enum {kStopSearchOnSensor,kClusterNotMatching,kClusterMatching}; // flags for track-to-cluster checks
dd2117a2 41 //
42 enum {kDummyLabel=-3141593};
38997c3c 43 //
32d38de2 44 AliITSUTrackerGlo(AliITSUReconstructor* rec);
45 virtual ~AliITSUTrackerGlo();
46
47 virtual Int_t Clusters2Tracks(AliESDEvent *event);
48 virtual Int_t PropagateBack(AliESDEvent *event);
49 virtual Int_t RefitInward(AliESDEvent *event);
50 virtual Int_t LoadClusters(TTree * treeRP=0);
51 virtual void UnloadClusters();
52 virtual AliCluster* GetCluster(Int_t index) const;
53870004 53 void PrintSeedClusters(const AliITSUSeed* seed, Option_t* option="");
0ddbf657 54 //
55 Int_t GetCountPronlongationTrials() const {return fCountProlongationTrials;}
56 Int_t GetCountITSin() const {return fCountITSin;}
57 Int_t GetCountITSout() const {return fCountITSout;}
58 Int_t GetCountITSrefit() const {return fCountITSrefit;}
59
0091e9f0 60 //------------------------------------
61 AliITSURecoDet* GetITSInterface() const {return fITS;}
62 //
32d38de2 63 //------------------------------------
0e40ce66 64 Bool_t NeedToProlong(AliESDtrack* estTr, Int_t esdID);
32d38de2 65 void Init(AliITSUReconstructor* rec);
716ccba7 66 void FindTrack(AliESDtrack* esdTr, Int_t esdID);
42c3d4bd 67 void CreateDefaultTrackCond();
6cd80116 68 AliITSUTrackHyp* InitHypothesis(AliESDtrack *esdTr, Int_t esdID);
70cb7fe4 69 Bool_t TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo, Double_t rLim=-1);
70 Bool_t TransportToLayer(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo, Double_t rLim=-1);
b515ad7e 71 Bool_t TransportToLayerX(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo, Double_t xStop);
e7d83d38 72 Bool_t GoToExitFromLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
73 Bool_t GoToExitFromLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
e2d2481c 74 Bool_t GoToEntranceToLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
75 Bool_t GoToEntranceToLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
44785f3e 76 Bool_t PropagateSeed(AliITSUSeed *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
3e4e3c23 77 Bool_t PropagateSeed(AliExternalTrackParam *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
7ce7f445 78 Double_t RefitTrack(AliITSUTrackHyp* trc, Double_t r, Int_t& nclFit, Int_t stopCond=0);
e1ef49ad 79 Double_t GetMaterialBudget(const double* pnt0, const double* pnt1, double& x2x0, double& rhol) const;
80
781c79ac 81 Int_t GetTrackingPhase() const {return fTrackPhaseID;}
e7d83d38 82
44785f3e 83 //
b8b59e05 84 void KillSeed(AliITSUSeed* seed, Bool_t branch=kFALSE);
c8d1f258 85 Bool_t NeedToKill(AliITSUSeed* seed, Int_t flag);
c61e50c3 86 Bool_t GetRoadWidth(AliITSUSeed* seed, int ilrA);
9cdcba2c 87 Bool_t CheckBackwardMatching(AliITSUSeed* seed);
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);
08419930 93 void FlagSeedClusters(const AliITSUSeed* seed, Bool_t flg, UShort_t hypRef);
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();}
08419930 102 void CheckClusterSharingConflicts(AliITSUTrackHyp* hyp);
6cd80116 103 void SaveReducedHypothesesTree(AliITSUTrackHyp* dest);
0e40ce66 104 void CleanHypothesis(AliITSUTrackHyp* hyp);
3e4e3c23 105 void FinalizeHypotheses();
9cdcba2c 106 Bool_t FinalizeHypothesis(AliITSUTrackHyp* hyp);
68a0f687 107 void UpdateESDTrack(AliITSUTrackHyp* hyp,Int_t flag);
dd2117a2 108 void CookMCLabel(AliITSUTrackHyp* hyp);
781c79ac 109 void SetTrackingPhase(Int_t p) {fTrackPhaseID = p;}
d99994b2 110 //
111 // monitoring stuff
112 void FlagSplitClusters();
113 Bool_t ContainsSplitCluster(const AliITSUSeed* seed, Int_t maxSize=99999);
114 void CheckClusterUsage();
115 //
b8b59e05 116 protected:
117 TObject*& NextFreeSeed();
118 //
32d38de2 119 private:
b8b59e05 120 //
32d38de2 121 AliITSUTrackerGlo(const AliITSUTrackerGlo&);
122 AliITSUTrackerGlo &operator=(const AliITSUTrackerGlo &tr);
123 //
124 protected:
125 AliITSUReconstructor* fReconstructor; // ITS global reconstructor
3d4dc3e2 126 AliITSURecoDet* fITS; // interface to ITS, borrowed from reconstructor
e1ef49ad 127 AliITSUMatLUT* fMatLUT; // material lookup table
0091e9f0 128 AliESDtrack* fCurrESDtrack; // current esd track in processing
0ddbf657 129 Int_t fCurrESDtrMClb; // its eventual mc label
32d38de2 130 Double_t fCurrMass; // current track mass
c61e50c3 131 Double_t fTrImpData[kNTrImpData]; // data on track impact on the layer
32d38de2 132 //
0ddbf657 133 Int_t fCountProlongationTrials; // number of TPC seeds
134 Int_t fCountITSin; // number of successful ITSin
135 Int_t fCountITSout; // number of successful ITSout
136 Int_t fCountITSrefit; // number of successful ITSrefit
d99994b2 137 Int_t fNTracksESD; // number of esd tracks
0ddbf657 138 //
c61e50c3 139 // the seeds management to be optimized
716ccba7 140 TObjArray fHypStore; // storage for tracks hypotheses
6cd80116 141 Int_t fLayerMaxCandidates; //! size of tmp candidates array
142 AliITSUSeed** fLayerCandidates;//! array for branches of current track prolongation
38997c3c 143 Int_t fNBranchesAdded; // number of branches created for current seed in prolongation
144 Int_t fNCandidatesAdded; // number of candidates added for current seed in prolongation
6cd80116 145 AliITSUTrackHyp* fCurrHyp; //! hypotheses container for current track
146 AliITSUTrackHyp* fWorkHyp; //! temporary hypothesis for track finding
b8b59e05 147 TClonesArray fSeedsPool; //! pool for seeds
148 TArrayI fFreeSeedsID; //! array of ID's of freed seeds
9cdcba2c 149 TArrayI fESDIndex; //! array of ID's of freed seeds
b8b59e05 150 Int_t fNFreeSeeds; //! number of seeds freed in the pool
151 Int_t fLastSeedID; //! id of the pool seed on which is returned by the NextFreeSeed method
6cd80116 152 Int_t fNLrActive; //! number of active layers
c8d1f258 153 //
42c3d4bd 154 TObjArray fDefTrackConds; //! default tracking conditions
c03e4f8a 155 AliITSUTrackCond* fCurrTrackCond; //! current tracking condition
156 Int_t fCurrActLrID; //! current active layer ID being processed (set only when needed, not guaranteed)
157 AliITSURecoLayer* fCurrLayer; //! current layer being processed (set only when needed, not guaranteed)
781c79ac 158 Int_t fTrackPhaseID; //! tracking phase (clusters2tracks, backward, inward)
159 Int_t fCurrPassID; //! tracking pass (different tracking conditions)
e1ef49ad 160 Bool_t fUseMatLUT; //! use material lookup table rather than TGeo
c8d1f258 161 //
e2d2481c 162 static const Double_t fgkToler; // tracking tolerance
163 //
08419930 164#ifdef _ITSU_TUNING_MODE_
53870004 165 // this code is only for special histos needed to extract some control parameters
781c79ac 166 Int_t GetHistoID(Int_t lr, Int_t hid, Int_t pass=0, Int_t phase=0);
167 TObjArray* BookControlHistos(const char* pref);
168 TObjArray* fCHistoArrCorr; // set of histos for each tracking pass/phase: correct
169 TObjArray* fCHistoArrFake; // set of histos for each tracking pass/phase: fakse
170 enum {kHResY,kHResYP,kHResZ,kHResZP,kHChi2Cl,kHChi2Nrm,kHBestInBranch,kHBestInCand,kMaxHID=10};
08419930 171 enum {kHChiMatch,kHChiITSSA}; // custom histos
781c79ac 172 enum {kHistosPhase=kMaxHID*(AliITSUAux::kMaxLayers+1),kHistosPass=kNTrackingPhases*kHistosPhase};
53870004 173 //
174#endif
bdb92766 175 //
32d38de2 176 ClassDef(AliITSUTrackerGlo,1) //ITS upgrade tracker
177
178};
f8832015 179
b8b59e05 180//________________________________________
181inline TObject *&AliITSUTrackerGlo::NextFreeSeed()
182{
183 // return next free slot where the seed can be created
184 fLastSeedID = fNFreeSeeds ? fFreeSeedsID.GetArray()[--fNFreeSeeds] : fSeedsPool.GetEntriesFast();
185 // AliInfo(Form("%d",fLastSeedID));
186 return fSeedsPool[ fLastSeedID ];
187 //
188}
189
190//_________________________________________________________________________
191inline AliITSUSeed* AliITSUTrackerGlo::NewSeedFromPool(const AliITSUSeed* src)
192{
193 // create new seed, optionally copying from the source
194 AliITSUSeed* sd = src ? new( NextFreeSeed() ) AliITSUSeed(*src) : new( NextFreeSeed() ) AliITSUSeed();
195 sd->SetPoolID(fLastSeedID);
196 return sd;
197}
198
199//_________________________________________________________________________
200inline void AliITSUTrackerGlo::KillSeed(AliITSUSeed* seed, Bool_t branch)
201{
202 // flag seed as killed, if requested, kill recursively its parents whose sole child is the seed being killed
203 seed->Kill();
204 seed = (AliITSUSeed*)seed->GetParent();
205 if (seed && !seed->DecChildren() && branch) KillSeed(seed,branch);
206}
f8832015 207
38997c3c 208//_________________________________________________________________________
209inline void AliITSUTrackerGlo::AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr)
210{
211 // add new seed prolongation hypothesis
08419930 212#ifdef _ITSU_TUNING_MODE_
213 seed->SetOrdCand(fCurrHyp->GetNSeeds(lr));
214#endif
215 fCurrHyp->AddSeed(seed,lr);
38997c3c 216}
217
e1ef49ad 218//_________________________________________________________________________
219inline Double_t AliITSUTrackerGlo::GetMaterialBudget(const double* pnt0,const double* pnt1, double& x2x0, double& rhol) const
220{
221 double par[7];
222 if (fUseMatLUT && fMatLUT) {
223 double d = fMatLUT->GetMatBudget(pnt0,pnt1,par);
224 x2x0 = par[AliITSUMatLUT::kParX2X0];
225 rhol = par[AliITSUMatLUT::kParRhoL];
226 return d;
227 }
228 else {
229 MeanMaterialBudget(pnt0,pnt1,par);
230 x2x0 = par[1];
231 rhol = par[0]*par[4];
232 return par[4];
233 }
234}
235
32d38de2 236#endif
237