New TrackReconstructor for Kalman tracking (Philippe Pillot)
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackReconstructor.h
CommitLineData
f29ba3e1 1#ifndef ALIMUONTRACKRECONSTRUCTOR_H
29f1b13a 2#define ALIMUONTRACKRECONSTRUCTOR_H
692de412 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
a9e2aefa 5
692de412 6/* $Id$ */
7
8/// \ingroup rec
9/// \class AliMUONTrackReconstructor
10/// \brief Class for the MUON track reconstruction
11///
12/////////////////////////////////////
13/// MUON track reconstructor in ALICE
14/////////////////////////////////////
3831f268 15
16#include <TObject.h>
190f97ea 17#include "AliMUONConstants.h"
a9e2aefa 18
a9e2aefa 19class AliMUONHitForRec;
20class AliMUONSegment;
21class TClonesArray;
22class TFile;
23class TTree;
52c9bc11 24class AliMUONData;
25class AliRunLoader;
58ff0bd4 26class AliMUONTriggerTrack;
de2cd600 27class AliMUONTrack;
28class TVirtualFitter;
a9e2aefa 29
29f1b13a 30class AliMUONTrackReconstructor : public TObject {
a9e2aefa 31
32 public:
cc9e7528 33 AliMUONTrackReconstructor(AliMUONData* data); // default Constructor
34 virtual ~AliMUONTrackReconstructor(); // Destructor
a9e2aefa 35
29f1b13a 36 // Parameters for track reconstruction: public methods
a9e2aefa 37 // Get and Set, Set to defaults
7fc86979 38
39 /// Return minimum value (GeV/c) of momentum in bending plane
3831f268 40 Double_t GetMinBendingMomentum(void) const {return fMinBendingMomentum;}
7fc86979 41 /// Set minimum value (GeV/c) of momentum in bending plane
a9e2aefa 42 void SetMinBendingMomentum(Double_t MinBendingMomentum) {fMinBendingMomentum = MinBendingMomentum;}
7fc86979 43
44 /// Return maximum value (GeV/c) of momentum in bending plane
3831f268 45 Double_t GetMaxBendingMomentum(void) const {return fMaxBendingMomentum;}
7fc86979 46 /// Set maximum value (GeV/c) of momentum in bending plane
d0bfce8d 47 void SetMaxBendingMomentum(Double_t MaxBendingMomentum) {fMaxBendingMomentum = MaxBendingMomentum;}
7fc86979 48
49 /// Return maximum Chi2 per degree of Freedom
3831f268 50 Double_t GetMaxChi2(void) const {return fMaxChi2;}
7fc86979 51 /// Set maximum Chi2 per degree of Freedom
d0bfce8d 52 void SetMaxChi2(Double_t MaxChi2) {fMaxChi2 = MaxChi2;}
7fc86979 53
54 /// Return maximum square distance in units of the variance (maximum chi2)
3831f268 55 Double_t GetMaxSigma2Distance(void) const {return fMaxSigma2Distance;}
7fc86979 56 /// Set maximum square distance in units of the variance (maximum chi2)
a9e2aefa 57 void SetMaxSigma2Distance(Double_t MaxSigma2Distance) {fMaxSigma2Distance = MaxSigma2Distance;}
7fc86979 58
59 /// Return chamber resolution (cm) in bending plane
3831f268 60 Double_t GetBendingResolution(void) const {return fBendingResolution;}
7fc86979 61 /// Set chamber resolution (cm) in bending plane
a9e2aefa 62 void SetBendingResolution(Double_t BendingResolution) {fBendingResolution = BendingResolution;}
7fc86979 63
64 /// Return chamber resolution (cm) in non-bending plane
3831f268 65 Double_t GetNonBendingResolution(void) const {return fNonBendingResolution;}
7fc86979 66 /// set chamber resolution (cm) in non-bending plane
a9e2aefa 67 void SetNonBendingResolution(Double_t NonBendingResolution) {fNonBendingResolution = NonBendingResolution;}
7fc86979 68
69 /// Return chamber thickness in number of radiation lengths
3831f268 70 Double_t GetChamberThicknessInX0(void) const {return fChamberThicknessInX0;}
7fc86979 71 /// Set chamber thickness in number of radiation lengths
a9e2aefa 72 void SetChamberThicknessInX0(Double_t ChamberThicknessInX0) {fChamberThicknessInX0 = ChamberThicknessInX0;}
7fc86979 73
74 /// Return simple magnetic field: value (kG)
3831f268 75 Double_t GetSimpleBValue(void) const {return fSimpleBValue;}
7fc86979 76 /// Set simple magnetic field: value (kG)
a9e2aefa 77 void SetSimpleBValue(Double_t SimpleBValue) {fSimpleBValue = SimpleBValue;}
7fc86979 78
79 /// Return simple magnetic field: length (cm)
3831f268 80 Double_t GetSimpleBLength(void) const {return fSimpleBLength;}
7fc86979 81 /// Set simple magnetic field: length (cm)
a9e2aefa 82 void SetSimpleBLength(Double_t SimpleBLength) {fSimpleBLength = SimpleBLength;}
7fc86979 83
84 /// Return simple magnetic field: Z central position (cm)
3831f268 85 Double_t GetSimpleBPosition(void) const {return fSimpleBPosition;}
7fc86979 86 /// Set simple magnetic field: Z central position (cm)
a9e2aefa 87 void SetSimpleBPosition(Double_t SimpleBPosition) {fSimpleBPosition = SimpleBPosition;}
7fc86979 88
89 /// Return chamber efficiency (used for track ref. hits only
3831f268 90 Double_t GetEfficiency(void) const {return fEfficiency;}
7fc86979 91 /// Set chamber efficiency (used for track ref. hits only
a9e2aefa 92 void SetEfficiency(Double_t Efficiency) {fEfficiency = Efficiency;}
7fc86979 93
a9e2aefa 94 void SetReconstructionParametersToDefaults(void);
7fc86979 95
96 /// Return track fitter
de2cd600 97 static TVirtualFitter* Fitter(void) {return fgFitter;}
a9e2aefa 98
7fc86979 99 /// Return number of hits for reconstruction
3831f268 100 Int_t GetNHitsForRec(void) const {return fNHitsForRec;} // Number
8429a5e4 101
7fc86979 102 /// Return number of reconstructed tracks
3831f268 103 Int_t GetNRecTracks() const {return fNRecTracks;} // Number
7fc86979 104 /// Set number of reconstructed tracks
8429a5e4 105 void SetNRecTracks(Int_t NRecTracks) {fNRecTracks = NRecTracks;}
7fc86979 106
107 /// Return array of reconstructed tracks
3831f268 108 TClonesArray* GetRecTracksPtr(void) const {return fRecTracksPtr;} // Array
52c9bc11 109
a9e2aefa 110 // Functions
3831f268 111 Double_t GetImpactParamFromBendingMomentum(Double_t BendingMomentum) const;
112 Double_t GetBendingMomentumFromImpactParam(Double_t ImpactParam) const;
a9e2aefa 113 void EventReconstruct(void);
276c44b7 114 void EventReconstructTrigger(void);
04b5ea16 115 void EventDump(void); // dump reconstructed event
276c44b7 116 void EventDumpTrigger(void); // dump reconstructed trigger event
3f9fc997 117 //PH void FillEvent(); // fill and write tree of reconstructed events
b035a148 118 void SetTrackMethod(Int_t iTrackMethod); //AZ
7fc86979 119 /// Return track method
120 Int_t GetTrackMethod(void) const {return fTrackMethod;}
b035a148 121 void FillMUONTrack(void); // set track parameters at hits for Kalman track
8574c72f 122 //Int_t fMuons; // AZ - number of muons within acceptance - just for tests
52c9bc11 123
7fc86979 124 /// Return MUON data
52c9bc11 125 AliMUONData* GetMUONData() {return fMUONData;}
126
7fc86979 127 /// Set trigger circuit
5e671e06 128 void SetTriggerCircuit(TClonesArray* circuit) {fTriggerCircuit = circuit;}
129
130
a9e2aefa 131 private:
132
343146bf 133 // Defaults parameters for reconstruction
829425a5 134 static const Double_t fgkDefaultMinBendingMomentum; ///< default min. bending momentum for reconstruction
135 static const Double_t fgkDefaultMaxBendingMomentum; ///< default max. bending momentum for reconstruction
136 static const Double_t fgkDefaultMaxChi2; ///< default max. track chi2 for reconstruction
137 static const Double_t fgkDefaultMaxSigma2Distance; ///< default square of max. distance for window size
138 static const Double_t fgkDefaultBendingResolution; ///< default bending coordinate resolution for reconstruction
139 static const Double_t fgkDefaultNonBendingResolution; ///< default non bending coordinate resolution for reconstruction
343146bf 140 // Simple magnetic field:
141 // Value taken from macro MUONtracking.C: 0.7 T, hence 7 kG
142 // Length and Position from reco_muon.F, with opposite sign:
143 // Length = ZMAGEND-ZCOIL
144 // Position = (ZMAGEND+ZCOIL)/2
145 // to be ajusted differently from real magnetic field ????
829425a5 146 static const Double_t fgkDefaultSimpleBValue; ///< default value of magnetic field (dipole)
147 static const Double_t fgkDefaultSimpleBLength; ///< default length of magnetic field (dipole)
148 static const Double_t fgkDefaultSimpleBPosition; ///< default position of magnetic field (dipole)
829425a5 149 static const Double_t fgkDefaultEfficiency; ///< default chamber efficiency for track ref. hits recontruction
343146bf 150
de2cd600 151 static TVirtualFitter* fgFitter; //!< Pointer to track fitter
343146bf 152
829425a5 153 Int_t fTrackMethod; ///< AZ - tracking method
83dbc640 154
29f1b13a 155 // Parameters for track reconstruction
829425a5 156 Double_t fMinBendingMomentum; ///< minimum value (GeV/c) of momentum in bending plane
29f1b13a 157 // Parameters for track reconstruction
829425a5 158 Double_t fMaxBendingMomentum; ///< maximum value (GeV/c) of momentum in bending plane
159 Double_t fMaxChi2; ///< maximum Chi2 per degree of Freedom
160 Double_t fMaxSigma2Distance; ///< maximum square distance in units of the variance (maximum chi2)
de2cd600 161 Double_t* fRMin; ///< minimum radius (cm)
162 Double_t* fRMax; ///< maximum radius (cm)
163 Double_t* fSegmentMaxDistBending; ///< maximum distance (cm) for segments in bending plane
164 Double_t* fSegmentMaxDistNonBending; ///< maximum distance (cm) for segments in non bending plane
829425a5 165 Double_t fBendingResolution; ///< chamber resolution (cm) in bending plane
166 Double_t fNonBendingResolution; ///< chamber resolution (cm) in non bending plane
167 Double_t fChamberThicknessInX0; ///< chamber thickness in number of radiation lengths
a9e2aefa 168 // how to take it from simulation ????
829425a5 169 Double_t fSimpleBValue; ///< simple magnetic field: value (kG)
170 Double_t fSimpleBLength; ///< simple magnetic field: length (cm)
171 Double_t fSimpleBPosition; ///< simple magnetic field: Z central position (cm)
829425a5 172 Double_t fEfficiency; ///< chamber efficiency (used for track ref. hits only)
a9e2aefa 173
174 // Hits for reconstruction (should be in AliMUON ????)
de2cd600 175 TClonesArray* fHitsForRecPtr; ///< pointer to the array of hits for reconstruction
829425a5 176 Int_t fNHitsForRec; ///< number of hits for reconstruction
a9e2aefa 177 // Information per chamber (should be in AliMUONChamber ????)
de2cd600 178 Int_t* fNHitsForRecPerChamber; ///< number of HitsForRec
179 Int_t* fIndexOfFirstHitForRecPerChamber; ///< index (0...) of first HitForRec
a9e2aefa 180
181 // Segments inside a station
de2cd600 182 TClonesArray** fSegmentsPtr; ///< array of pointers to the segments for each station
183 Int_t* fNSegments; ///< number of segments for each station
a9e2aefa 184
8429a5e4 185 // Reconstructed tracks
829425a5 186 TClonesArray *fRecTracksPtr; ///< pointer to array of reconstructed tracks
187 Int_t fNRecTracks; ///< number of reconstructed tracks
a9e2aefa 188
52c9bc11 189 // data container
829425a5 190 AliMUONData* fMUONData; ///< Data container for MUON subsystem
52c9bc11 191
829425a5 192 Int_t fMuons; ///< AZ - number of muons within acceptance - just for tests
8574c72f 193
58ff0bd4 194 AliMUONTriggerTrack* fTriggerTrack; ///< Trigger track structure
195
5e671e06 196 TClonesArray* fTriggerCircuit; //!< trigger circuit array
197
a9e2aefa 198 // Functions
54d7ba50 199 AliMUONTrackReconstructor (const AliMUONTrackReconstructor& rhs); // copy constructor
200 AliMUONTrackReconstructor& operator=(const AliMUONTrackReconstructor& rhs); // assignment operator
a9e2aefa 201 void ResetHitsForRec(void);
202 void MakeEventToBeReconstructed(void);
a9e2aefa 203 void AddHitsForRecFromRawClusters(TTree* TR);
204 void SortHitsForRecWithIncreasingChamber();
205 void MakeSegments(void);
206 void ResetSegments(void);
207 void MakeSegmentsPerStation(Int_t Station);
208 void MakeTracks(void);
d837040f 209 Bool_t MakeTriggerTracks(void);
a9e2aefa 210 void ResetTracks(void);
de2cd600 211 void MakeTrackCandidates(void);
a9e2aefa 212 Int_t MakeTrackCandidatesWithTwoSegments(AliMUONSegment *BegSegment);
213 Int_t MakeTrackCandidatesWithOneSegmentAndOnePoint(AliMUONSegment *BegSegment);
de2cd600 214 void CalcTrackParamAtVertex(AliMUONTrack *Track);
a9e2aefa 215 void FollowTracks(void);
de2cd600 216 void Fit(AliMUONTrack *Track, Int_t FitStart, Int_t FitMCS);
8429a5e4 217 void RemoveDoubleTracks(void);
b8dc484b 218 void UpdateHitForRecAtHit(void);
d837040f 219 void ValidateTracksWithTrigger(void);
83dbc640 220
221
222 //AZ - for Kalman Filter
223 void MakeTrackCandidatesK(void);
224 void FollowTracksK(void);
225 void RemoveDoubleTracksK(void);
226 void GoToVertex(void);
30178c30 227 Bool_t CheckCandidateK(Int_t icand, Int_t nSeeds) const;
83dbc640 228
29fc2c86 229
29f1b13a 230 ClassDef(AliMUONTrackReconstructor, 0) // MUON track reconstructor in ALICE
a9e2aefa 231 };
232
233#endif