]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALTracker.h
79b7876b77326667e75ee01aa8fa2dd465dffcf7
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTracker.h
1 //========================================================================  
2 // Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved.  
3 // See cxx source for full Copyright notice                                
4 //========================================================================  
5 //                       
6 //                       Class AliEMCALTracker 
7 //                      -----------------------
8 // Implementation of the track matching method between barrel tracks and
9 // EMCAL clusters.
10 // Besides algorithm implementation, some cuts are required to be set
11 // in order to define, for each track, an acceptance window where clusters
12 // are searched to find best match (if any).
13 // The class accepts as input an ESD container, and works directly on it,
14 // simply setting, for each of its tracks, the fEMCALindex flag, for each
15 // track which is matched to a cluster.
16 // In order to use method, one must launch PropagateBack().
17 //
18 // ------------------------------------------------------------------------
19 // author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
20 //=========================================================================
21
22 #ifndef ALIEMCALTRACKER_H
23 #define ALIEMCALTRACKER_H
24
25 #include "AliTracker.h"
26
27 class TList;
28 class TObjArray;
29 class AliESD;
30 class AliESDCaloCluster;
31 class AliEMCALTrack;
32 class AliEMCALRecPoint;
33
34 class AliEMCALTracker : public AliTracker 
35 {
36 public:
37
38         AliEMCALTracker();
39         AliEMCALTracker(const AliEMCALTracker &t);
40         AliEMCALTracker& operator=(const AliEMCALTracker &source);
41         
42         virtual ~AliEMCALTracker() {Clear();}
43         
44         virtual void        Clear(Option_t *option="ALL");
45         virtual Int_t       Clusters2Tracks(AliESD*) {return -1;}
46         virtual Int_t       LoadClusters(TTree*);
47                 Int_t       LoadClusters(AliESD* esd);
48                 Int_t       LoadTracks(AliESD* esd);
49         virtual Int_t       PropagateBack(AliESD* esd);
50         virtual Int_t       RefitInward(AliESD*) {return -1;}
51         virtual void        UnloadClusters();
52         virtual AliCluster* GetCluster(Int_t) const {return NULL;};
53         void                SetCorrection(Double_t rho, Double_t x0) {fRho=rho;fX0=x0;}
54         void                SetCutAlpha(Double_t min, Double_t max) {fCutAlphaMin=min;fCutAlphaMax=max;}
55         void                SetCutAngle(Double_t value) {fCutAngle=value;}
56         void                SetCutX(Double_t value) {fCutX=value;}
57         void                SetCutY(Double_t value) {fCutY=value;}
58         void                SetCutZ(Double_t value) {fCutZ=value;}
59         void                SetMaxDistance(Double_t value) {fMaxDist=value;}
60         void                SetNumberOfSteps(Int_t n) {fNPropSteps=n;if(!n)SetTrackCorrectionMode("NONE");}
61         void                SetTrackCorrectionMode(Option_t *option);
62         
63         class  AliEMCALMatchCluster : public TObject
64         {
65         public:
66                            AliEMCALMatchCluster(Int_t ID, AliEMCALRecPoint *recPoint);
67                                    AliEMCALMatchCluster(Int_t ID, AliESDCaloCluster *caloCluster);
68                 virtual   ~AliEMCALMatchCluster() { }
69                 Int_t&     Index() {return fIndex;}
70                 Int_t&     Label() {return fLabel;}
71                 Double_t&  X() {return fX;}
72                 Double_t&  Y() {return fY;}
73                 Double_t&  Z() {return fZ;}
74         private:
75                 Int_t     fIndex;  // index of cluster in its native container (ESD or TClonesArray)
76                 Int_t     fLabel;  // track label of assigned cluster
77                 Double_t  fX;      // global X position
78                 Double_t  fY;      // global Y position
79                 Double_t  fZ;      // global Z position
80         };
81         
82         class  AliEMCALMatch : public TObject
83         {
84         public:
85                           AliEMCALMatch();
86                           AliEMCALMatch(const AliEMCALMatch& copy);
87                          ~AliEMCALMatch() { }
88                 Bool_t&   CanBeSaved() {return fCanBeSaved;}
89                 Int_t     Compare(const TObject *obj) const;
90                 Double_t  GetDistance() {return fDistance;}
91                 Int_t     GetIndexC() {return fIndexC;}
92                 Int_t     GetIndexT() {return fIndexT;}
93                 Bool_t    IsSortable() const {return kTRUE;}
94                 void      SetIndexC(Int_t icl) {fIndexC=icl;}
95                 void      SetIndexT(Int_t itr) {fIndexT=itr;}
96                 void      SetDistance(Double_t dist) {fDistance=dist;}
97         private:
98                 Bool_t     fCanBeSaved;  // when true, this match can be saved, otherwise it will not be
99                 Int_t      fIndexC;      // cluster index in 'fClusters' array
100                 Int_t      fIndexT;      // track index in 'fTracks' array
101                 Double_t   fDistance;    // track - cluster distance
102         };
103
104 private:
105
106         Double_t   AngleDiff(Double_t angle1, Double_t angle2);
107         Double_t   CheckPair(AliEMCALTrack *tr, AliEMCALMatchCluster *cluster);
108         Double_t   CheckPairV2(AliEMCALTrack *tr, AliEMCALMatchCluster *cluster);
109         Int_t      CreateMatches();
110         Int_t      SolveCompetitions();
111         
112         enum ETrackCorr { 
113                 kTrackCorrNone  = 0, // do not correct for energy loss
114                 kTrackCorrMMB   = 1, // use MeanMaterialBudget() function to evaluate correction
115                 kTrackCorrFixed = 2  // use fixed "X0" and "rho" parameters to correct
116         };
117         
118         Int_t       fNPropSteps;      // number of propagation steps (when correcting). If =0 no correction is done
119         ETrackCorr  fTrackCorrMode;   // track correction mode
120         
121         Double_t    fCutX;                    // cut on X difference
122         Double_t    fCutY;                    // cut on Y difference
123         Double_t    fCutZ;                    // cut on Z difference
124         Double_t    fCutAlphaMin;     // cut on difference between track 'alpha' and phi
125         Double_t    fCutAlphaMax;     // cut on difference between track 'alpha' and phi
126         Double_t    fCutAngle;        // cut on angle between track projection and cluster
127         Double_t    fMaxDist;         // maximum allowed total distance between track proj an cluster
128         
129         Double_t    fRho;             // energy correction: density
130         Double_t    fX0;              // energy correction: radiation length
131
132         TObjArray  *fTracks;          //! collection of ESD tracks
133         TObjArray  *fClusters;        //! collection of EMCAL clusters (ESDCaloCluster or EMCALRecPoint)
134         TList      *fMatches;         //! collection of matches between tracks and clusters
135         
136         ClassDef(AliEMCALTracker, 1)  // EMCAL "tracker"
137 };
138
139 #endif