]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSUTrackerGlo.h
Updates in Lc->V0bachelor analysis (Annalisa)
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUTrackerGlo.h
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
16 class AliITSUReconstructor;
17 class AliITSURecoDet;
18 class AliITSUClusterPix;
19 class AliESDtrack;
20 class AliITSURecoLayer;
21 class TTree;
22
23
24 //-------------------------------------------------------------------------
25 class AliITSUTrackerGlo : public AliTracker {
26
27   public:
28   enum {kClus2Tracks,kPropBack,kRefitInw};   // 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   AliITSUTrackerGlo(AliITSUReconstructor* rec);
43   virtual ~AliITSUTrackerGlo();
44
45   virtual Int_t          Clusters2Tracks(AliESDEvent *event);
46   virtual Int_t          PropagateBack(AliESDEvent *event);
47   virtual Int_t          RefitInward(AliESDEvent *event);
48   virtual Int_t          LoadClusters(TTree * treeRP=0);
49   virtual void           UnloadClusters();
50   virtual AliCluster*    GetCluster(Int_t index) const;
51   //------------------------------------
52   AliITSURecoDet*        GetITSInterface()       const {return fITS;}
53   //
54   //------------------------------------
55   Bool_t                 NeedToProlong(AliESDtrack* estTr);
56   void                   Init(AliITSUReconstructor* rec);
57   void                   FindTrack(AliESDtrack* esdTr, Int_t esdID);
58   void                   CreateDefaultTrackCond();
59   Bool_t                 InitHypothesis(AliESDtrack *esdTr, Int_t esdID);
60   Bool_t                 TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo);
61   Bool_t                 TransportToLayer(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo);
62   Bool_t                 GoToExitFromLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
63   Bool_t                 GoToExitFromLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
64   Bool_t                 GoToEntranceToLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
65   Bool_t                 GoToEntranceToLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
66   Bool_t                 PropagateSeed(AliITSUSeed *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
67   Bool_t                 PropagateSeed(AliExternalTrackParam *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
68   Bool_t                 RefitTrack(AliITSUTrackHyp* trc, Double_t r, Bool_t stopAtLastCl=kFALSE);
69   Int_t                  GetTrackingPhase()                 const {return fTrackPhase;}
70
71   //
72   void                   KillSeed(AliITSUSeed* seed, Bool_t branch=kFALSE);
73   Bool_t                 NeedToKill(AliITSUSeed* seed, Int_t flag);
74   Bool_t                 GetRoadWidth(AliITSUSeed* seed, int ilrA);
75   Int_t                  CheckCluster(AliITSUSeed* seed, Int_t lr, Int_t clID);
76   void                   AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr);
77   //
78   AliITSUSeed*           NewSeedFromPool(const AliITSUSeed* src=0);
79   void                   ResetSeedsPool();
80   void                   MarkSeedFree(AliITSUSeed* seed );
81
82   AliITSUTrackHyp*       GetTrackHyp(Int_t id)               const  {return (AliITSUTrackHyp*)fHypStore.UncheckedAt(id);}
83   void                   SetTrackHyp(AliITSUTrackHyp* hyp,Int_t id) {fHypStore.AddAtAndExpand(hyp,id);}
84   void                   DeleteLastSeedFromPool()                   {fSeedsPool.RemoveLast();}
85   void                   SaveCurrentTrackHypotheses();
86   void                   FinalizeHypotheses();
87   void                   UpdateESDTrack(AliITSUTrackHyp* hyp,Int_t flag);
88   void                   CookMCLabel(AliITSUTrackHyp* hyp);
89   void                   SetTrackingPhase(Int_t p)        {fTrackPhase = p;}
90  //
91  protected:
92   TObject*&              NextFreeSeed();
93   //
94  private:
95   //
96   AliITSUTrackerGlo(const AliITSUTrackerGlo&);
97   AliITSUTrackerGlo &operator=(const AliITSUTrackerGlo &tr);
98   //
99  protected:
100   AliITSUReconstructor*           fReconstructor;  // ITS global reconstructor 
101   AliITSURecoDet*                 fITS;            // interface to ITS, borrowed from reconstructor
102   AliESDtrack*                    fCurrESDtrack;   // current esd track in processing
103   Double_t                        fCurrMass;       // current track mass
104   Double_t                        fTrImpData[kNTrImpData];  // data on track impact on the layer
105   //
106   // the seeds management to be optimized
107   TObjArray                       fHypStore;       // storage for tracks hypotheses
108   AliITSUTrackHyp*                fCurrHyp;        // hypotheses container for current track
109   TClonesArray                    fSeedsPool;      //! pool for seeds
110   TArrayI                         fFreeSeedsID;    //! array of ID's of freed seeds
111   Int_t                           fNFreeSeeds;     //! number of seeds freed in the pool
112   Int_t                           fLastSeedID;     //! id of the pool seed on which is returned by the NextFreeSeed method
113   //
114   TObjArray                       fDefTrackConds;  //! default tracking conditions
115   AliITSUTrackCond*               fCurrTrackCond;  // current tracking condition
116   Int_t                           fTrackPhase;     // tracking phase
117   Int_t*                          fClInfo;         //! auxiliary track cluster info
118   //
119   static const Double_t           fgkToler;        // tracking tolerance
120   //
121   ClassDef(AliITSUTrackerGlo,1)   //ITS upgrade tracker
122     
123 };
124
125 //_________________________________________________________________________
126 inline void AliITSUTrackerGlo::AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr)
127 {
128   // add new seed prolongation hypothesis 
129   fCurrHyp->AddSeed(seed,lr);
130 }
131
132 //________________________________________
133 inline TObject *&AliITSUTrackerGlo::NextFreeSeed()
134 {
135   // return next free slot where the seed can be created
136   fLastSeedID = fNFreeSeeds ? fFreeSeedsID.GetArray()[--fNFreeSeeds] : fSeedsPool.GetEntriesFast();
137   //  AliInfo(Form("%d",fLastSeedID));
138   return fSeedsPool[ fLastSeedID ];
139   //
140 }
141
142 //_________________________________________________________________________
143 inline AliITSUSeed* AliITSUTrackerGlo::NewSeedFromPool(const AliITSUSeed* src)
144 {
145   // create new seed, optionally copying from the source
146   AliITSUSeed* sd =  src ? new( NextFreeSeed() ) AliITSUSeed(*src) : new( NextFreeSeed() ) AliITSUSeed();
147   sd->SetPoolID(fLastSeedID);
148   return sd;
149 }
150
151 //_________________________________________________________________________
152 inline void AliITSUTrackerGlo::KillSeed(AliITSUSeed* seed, Bool_t branch)
153 {
154   // flag seed as killed, if requested, kill recursively its parents whose sole child is the seed being killed
155   seed->Kill();
156   seed = (AliITSUSeed*)seed->GetParent();
157   if (seed && !seed->DecChildren() && branch) KillSeed(seed,branch);
158 }
159
160 #endif
161