]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALTracker.h
AliAlignObjAngles becomes AliAlignObjParams (Raffaele)
[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 #include "TMath.h"
27 class TList;
28 class TTree;
29 class TObjArray;
30 class AliESDEvent;
31 class AliESDCaloCluster;
32 class AliEMCALTrack;
33 class AliEMCALRecPoint;
34 class AliEMCALGeometry;
35
36 class AliEMCALTracker : public AliTracker 
37 {
38 public:
39
40         AliEMCALTracker();
41         AliEMCALTracker(const AliEMCALTracker &t);
42         AliEMCALTracker& operator=(const AliEMCALTracker &source);
43         
44         virtual ~AliEMCALTracker() {Clear();}
45         
46         virtual void        Clear(Option_t *option="ALL");
47         virtual Int_t       Clusters2Tracks(AliESDEvent*) {return -1;}
48         virtual Int_t       LoadClusters(TTree*);
49                 Int_t       LoadClusters(AliESDEvent* esd);
50                 Int_t       LoadTracks(AliESDEvent* esd);
51         virtual Int_t       PropagateBack(AliESDEvent* esd);
52         virtual Int_t       RefitInward(AliESDEvent*) {return -1;}
53         virtual void        UnloadClusters();
54         virtual AliCluster* GetCluster(Int_t) const {return NULL;};
55         TTree*              SearchTrueMatches();
56         void                SetCorrection(Double_t rho, Double_t x0) {fRho=rho;fX0=x0;}
57         void                SetCutAlpha(Double_t min, Double_t max) {fCutAlphaMin=min;fCutAlphaMax=max;}
58         void                SetCutAngle(Double_t value) {fCutAngle=value;}
59         void                SetCutX(Double_t value) {fCutX=value;}
60         void                SetCutY(Double_t value) {fCutY=value;}
61         void                SetCutZ(Double_t value) {fCutZ=value;}
62         void                SetGeometry(AliEMCALGeometry *geom) {fGeom=geom;}
63         void                SetMaxDistance(Double_t value) {fMaxDist=value;}
64         void                SetNumberOfSteps(Int_t n) {fNPropSteps=n;if(!n)SetTrackCorrectionMode("NONE");}
65         void                SetTrackCorrectionMode(Option_t *option);
66         
67         enum {
68                 kUnmatched = -99999
69         };
70         
71         class  AliEMCALMatchCluster : public TObject
72         {
73         public:
74                 AliEMCALMatchCluster(Int_t ID, AliEMCALRecPoint *recPoint);
75                 AliEMCALMatchCluster(Int_t ID, AliESDCaloCluster *caloCluster);
76                 virtual ~AliEMCALMatchCluster() { }
77                 //----------------------------------------------------------------------------
78                 Int_t     Index() {return fIndex;}
79                 Int_t     Label() {return fLabel;}
80                 Double_t  X() {return fX;}
81                 Double_t  Y() {return fY;} 
82                 Double_t  Z() {return fZ;}
83                 Double_t   Phi() {return TMath::ATan2(fY, fX);}
84         private:
85                 Int_t     fIndex;  // index of cluster in its native container (ESD or TClonesArray)
86                 Int_t     fLabel;  // track label of assigned cluster
87                 Double_t  fX;      // global X position
88                 Double_t  fY;      // global Y position
89                 Double_t  fZ;      // global Z position
90         };
91         
92         class  AliEMCALMatch : public TObject
93         {
94         public:
95                 AliEMCALMatch();
96                 AliEMCALMatch(const AliEMCALMatch& copy);
97                 virtual ~AliEMCALMatch() { }
98                 //----------------------------------------------------------------------------
99                 Bool_t&   CanBeSaved() {return fCanBeSaved;}
100                 Int_t     Compare(const TObject *obj) const;
101                 Double_t  GetDistance() {return fDistance;}
102                 Double_t  GetPt() {return fPt;}
103                 Int_t     GetIndexC() {return fIndexC;}
104                 Int_t     GetIndexT() {return fIndexT;}
105                 Bool_t    IsSortable() const {return kTRUE;}
106                 void      SetIndexC(Int_t icl) {fIndexC=icl;}
107                 void      SetIndexT(Int_t itr) {fIndexT=itr;}
108                 void      SetDistance(Double_t dist) {fDistance=dist;}
109                 void      SetPt(Double_t pt) {fPt=pt;}
110         private:
111                 Bool_t     fCanBeSaved;  // when true, this match can be saved, otherwise it will not be
112                 Int_t      fIndexC;      // cluster index in 'fClusters' array
113                 Int_t      fIndexT;      // track index in 'fTracks' array
114                 Double_t   fDistance;    // track - cluster distance
115                 Double_t   fPt;          // track pt
116         };
117
118 private:
119
120         Double_t   AngleDiff(Double_t angle1, Double_t angle2);
121         Double_t   CheckPair(AliEMCALTrack *tr, AliEMCALMatchCluster *cluster);
122         Double_t   CheckPairV2(AliEMCALTrack *tr, AliEMCALMatchCluster *cluster);
123         Double_t   CheckPairV3(AliEMCALTrack *tr, AliEMCALMatchCluster *cluster);
124         Int_t      CreateMatches();
125         Bool_t     PropagateToEMCAL(AliEMCALTrack *tr);
126         Int_t      SolveCompetitions();
127         
128         enum ETrackCorr { 
129                 kTrackCorrNone  = 0, // do not correct for energy loss
130                 kTrackCorrMMB   = 1, // use MeanMaterialBudget() function to evaluate correction
131                 kTrackCorrFixed = 2  // use fixed "X0" and "rho" parameters to correct
132         };
133         
134         Int_t       fNPropSteps;      // number of propagation steps (when correcting). If =0 no correction is done
135         ETrackCorr  fTrackCorrMode;   // track correction mode
136         
137         Double_t    fCutX;                    // cut on X difference
138         Double_t    fCutY;                    // cut on Y difference
139         Double_t    fCutZ;                    // cut on Z difference
140         Double_t    fCutAlphaMin;     // cut on difference between track 'alpha' and phi
141         Double_t    fCutAlphaMax;     // cut on difference between track 'alpha' and phi
142         Double_t    fCutAngle;        // cut on angle between track projection and cluster
143         Double_t    fMaxDist;         // maximum allowed total distance between track proj an cluster
144         
145         Double_t    fRho;             // energy correction: density
146         Double_t    fX0;              // energy correction: radiation length
147
148         TObjArray  *fTracks;          //! collection of tracks
149         TObjArray  *fClusters;        //! collection of EMCAL clusters (ESDCaloCluster or EMCALRecPoint)
150         TList      *fMatches;         //! collection of matches between tracks and clusters
151         
152         AliEMCALGeometry *fGeom;      //! EMCAL geometry
153         
154         ClassDef(AliEMCALTracker, 1)  // EMCAL "tracker"
155 };
156
157 #endif