]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtrackerV1.h
Bug fix
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackerV1.h
1 #ifndef ALITRDTRACKERV1_H
2 #define ALITRDTRACKERV1_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */ 
6
7 /* $Id$ */
8
9 ////////////////////////////////////////////////////////////////////////////
10 //                                                                        //
11 //  The TRD tracker                                                       //
12 //                                                                        //
13 //  Authors:                                                              //
14 //    Marian Ivanov <M.Ivanov@gsi.de>                                     //
15 //    Alex Bercuci <A.Bercuci@gsi.de>                                     //
16 //    Jouri Belikov <J.Belikov@cern.ch>                                   //
17 //    Markus Fasel <M.Fasel@gsi.de>                                       //
18 //                                                                        //
19 ////////////////////////////////////////////////////////////////////////////
20
21 #ifndef ALITRACKER_H
22 #include "AliTracker.h"
23 #endif
24
25 #ifndef ALITRDTRACKINGSECTOR_H
26 #include "AliTRDtrackingSector.h"
27 #endif
28
29 /**************************************************************************
30  * Class Status see source file                                           *
31  **************************************************************************/
32  
33 class TFile;
34 class TTreeSRedirector;
35 class TClonesArray;
36 class TLinearFitter;
37
38 class AliRieman;
39 class AliESDEvent;
40 class AliCluster;
41
42 class AliTRDcluster;
43 class AliTRDseedV1;
44 class AliTRDtrackingChamber;
45 class AliTRDchamberTimeBin;
46 class AliTRDtrackerFitter;
47 class AliTRDtrackV1;
48 class AliTrackPoint;
49 class AliTRDtrackerV1 : public AliTracker
50 {
51 public:
52         enum{
53                 kMaxLayersPerSector   = 1000
54                 , kMaxTimeBinIndex    = 216
55                 , kTrackingSectors    = 18
56                 , kNTimeBins          = 35
57                 , kNPlanes            = 6
58                 , kNSeedPlanes        = 4
59                 , kMaxTracksStack     = 100
60                 , kNConfigs           = 15
61         };
62         AliTRDtrackerV1();
63         virtual ~AliTRDtrackerV1();
64   
65   //temporary
66   AliTRDtrackingSector* GetTrackingSector(Int_t sec) {return &fTrSec[sec];}
67   
68         Int_t          Clusters2Tracks(AliESDEvent *esd);
69   static TTreeSRedirector* DebugStreamer() {return fgDebugStreamer;}
70   AliCluster*    GetCluster(Int_t index) const;
71         static void    GetExtrapolationConfig(Int_t iconfig, Int_t planes[2]);
72         static const Int_t   GetNTimeBins() {return fgNTimeBins;}
73         static void    GetSeedingConfig(Int_t iconfig, Int_t planes[4]);
74         static TLinearFitter *GetTiltedRiemanFitter();
75         static TLinearFitter *GetTiltedRiemanFitterConstraint();
76         static AliRieman *GetRiemanFitter();
77         static void    FitRieman(AliTRDcluster **clusters, Double_t chi2[2]);
78         static Float_t FitRieman(AliTRDseedV1 *tracklets, Double_t *chi2, Int_t *planes = 0x0);
79         static Float_t FitTiltedRiemanConstraint(AliTRDseedV1 *tracklets, Double_t zVertex);
80         static Float_t FitTiltedRieman(AliTRDseedV1 *tracklets, Bool_t sigError);
81         
82         Int_t          FollowBackProlongation(AliTRDtrackV1 &t);
83         Int_t          FollowProlongation(AliTRDtrackV1 &t);
84   Int_t          LoadClusters(TTree *cTree);
85         Int_t          PropagateBack(AliESDEvent *event);
86   Int_t          ReadClusters(TClonesArray* &array, TTree *in) const;
87         Int_t          RefitInward(AliESDEvent *event);
88         void           UnloadClusters();
89   
90   static Int_t   Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down); // to be removed 
91   static void    FitLeastSquare(Int_t nPoints, Float_t *x, Float_t *y, Float_t *errors, Float_t *fitparams);
92
93 protected:
94   Bool_t         AdjustSector(AliTRDtrackV1 *track); 
95         Double_t       BuildSeedingConfigs(AliTRDtrackingChamber **stack, Int_t *configs);
96         static Float_t CalculateChi2Z(AliTRDseedV1 *tracklets, Double_t offset, Double_t slope, Double_t xref);
97         Int_t          Clusters2TracksSM(Int_t sector, AliESDEvent *esd);
98         Int_t          Clusters2TracksStack(AliTRDtrackingChamber **stack, TClonesArray *esdTrackList);
99         AliTRDseedV1*  GetTracklet(AliTRDtrackV1 *trk, Int_t plane, Int_t &idx);
100         Bool_t         GetTrackPoint(Int_t index, AliTrackPoint &p) const;      
101         Int_t          MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 *sseed, Int_t *ipar);
102         AliTRDtrackV1* MakeTrack(AliTRDseedV1 *seeds, Double_t *params);
103   Int_t          PropagateToX(AliTRDtrackV1 &t, Double_t xToGo, Double_t maxStep);
104         Int_t          SetTracklet(AliTRDseedV1 *tracklet);
105
106 private:
107         AliTRDtrackerV1(const AliTRDtrackerV1 &tracker);
108         AliTRDtrackerV1 &operator=(const AliTRDtrackerV1 &tracker);
109         Double_t        CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4], Double_t *chi2);
110         Double_t        CalculateTrackLikelihood(AliTRDseedV1 *tracklets, Double_t *chi2);
111         Int_t           ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRDseedV1 *tracklet);
112         static Float_t  CalculateReferenceX(AliTRDseedV1 *tracklets);
113         
114         Float_t     GetChi2Y(AliTRDseedV1 *tracklets) const;
115         Float_t     GetChi2Z(AliTRDseedV1 *tracklets) const;
116
117 private:
118   AliTRDgeometry          *fGeom;                          // Pointer to TRD geometry
119   AliTRDtrackingSector    fTrSec[kTrackingSectors];       // Array of tracking sectors;    
120
121   TClonesArray        *fClusters;                       // List of clusters
122   TClonesArray        *fTracklets;                      // List of tracklets
123   TClonesArray        *fTracks;                         // List of tracks
124   
125   // should go to the recoParam
126   static const Double_t    fgkMaxChi2;                     // Max increment in track chi2 
127   static const Float_t     fgkMinClustersInTrack;          // Min number of clusters in track
128   static const Float_t     fgkLabelFraction;               // Min fraction of same label
129   static const Double_t    fgkMaxSnp;                      // Maximal snp for tracking
130   static const Double_t    fgkMaxStep;                     // Maximal step for tracking  
131         
132         // stand alone tracking
133         static Double_t      fgTopologicQA[kNConfigs];        //  Topologic quality
134         Double_t             fTrackQuality[kMaxTracksStack];  //  Track quality 
135         Int_t                fSeedLayer[kMaxTracksStack];     //  Seed layer
136         Int_t                fSieveSeeding;                   //! Seeding iterator
137         
138   static Int_t         fgNTimeBins;                     // Timebins per plane in track prolongation 
139         static TLinearFitter *fgTiltedRieman;                 //  Fitter for the tilted Rieman fit without vertex constriant
140         static TLinearFitter *fgTiltedRiemanConstrained;      //  Fitter for the tilted Rieman fit with vertex constraint       
141         static AliRieman     *fgRieman;                       //  Fitter for the untilted Rieman fit
142   
143         static TTreeSRedirector *fgDebugStreamer;             //!Debug streamer
144         
145         ClassDef(AliTRDtrackerV1, 2)                          //  TRD tracker development class
146
147 };
148 #endif