Correction in the loop over track references. Upper bound has been affected
[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;
26class AliLoader;
29fc2c86 27class AliTrackReference;
a9e2aefa 28
29f1b13a 29class AliMUONTrackReconstructor : public TObject {
a9e2aefa 30
31 public:
29cac82a 32 AliMUONTrackReconstructor(AliLoader* loader, AliMUONData* data); // default Constructor
29f1b13a 33 virtual ~AliMUONTrackReconstructor(void); // Destructor
a9e2aefa 34
29f1b13a 35 // Parameters for track reconstruction: public methods
a9e2aefa 36 // Get and Set, Set to defaults
3831f268 37 Double_t GetMinBendingMomentum(void) const {return fMinBendingMomentum;}
a9e2aefa 38 void SetMinBendingMomentum(Double_t MinBendingMomentum) {fMinBendingMomentum = MinBendingMomentum;}
3831f268 39 Double_t GetMaxBendingMomentum(void) const {return fMaxBendingMomentum;}
d0bfce8d 40 void SetMaxBendingMomentum(Double_t MaxBendingMomentum) {fMaxBendingMomentum = MaxBendingMomentum;}
3831f268 41 Double_t GetMaxChi2(void) const {return fMaxChi2;}
d0bfce8d 42 void SetMaxChi2(Double_t MaxChi2) {fMaxChi2 = MaxChi2;}
3831f268 43 Double_t GetMaxSigma2Distance(void) const {return fMaxSigma2Distance;}
a9e2aefa 44 void SetMaxSigma2Distance(Double_t MaxSigma2Distance) {fMaxSigma2Distance = MaxSigma2Distance;}
3831f268 45 Double_t GetBendingResolution(void) const {return fBendingResolution;}
a9e2aefa 46 void SetBendingResolution(Double_t BendingResolution) {fBendingResolution = BendingResolution;}
3831f268 47 Double_t GetNonBendingResolution(void) const {return fNonBendingResolution;}
a9e2aefa 48 void SetNonBendingResolution(Double_t NonBendingResolution) {fNonBendingResolution = NonBendingResolution;}
3831f268 49 Double_t GetChamberThicknessInX0(void) const {return fChamberThicknessInX0;}
a9e2aefa 50 void SetChamberThicknessInX0(Double_t ChamberThicknessInX0) {fChamberThicknessInX0 = ChamberThicknessInX0;}
3831f268 51 Double_t GetSimpleBValue(void) const {return fSimpleBValue;}
a9e2aefa 52 void SetSimpleBValue(Double_t SimpleBValue) {fSimpleBValue = SimpleBValue;}
3831f268 53 Double_t GetSimpleBLength(void) const {return fSimpleBLength;}
a9e2aefa 54 void SetSimpleBLength(Double_t SimpleBLength) {fSimpleBLength = SimpleBLength;}
3831f268 55 Double_t GetSimpleBPosition(void) const {return fSimpleBPosition;}
a9e2aefa 56 void SetSimpleBPosition(Double_t SimpleBPosition) {fSimpleBPosition = SimpleBPosition;}
29fc2c86 57 Int_t GetRecTrackRefHits(void) const {return fRecTrackRefHits;}
58 void SetRecTrackRefHits(Int_t RecTrackRefHits) {fRecTrackRefHits = RecTrackRefHits;}
3831f268 59 Double_t GetEfficiency(void) const {return fEfficiency;}
a9e2aefa 60 void SetEfficiency(Double_t Efficiency) {fEfficiency = Efficiency;}
a9e2aefa 61 void SetReconstructionParametersToDefaults(void);
62
29fc2c86 63 // Parameters for Track Ref. background events
64 TFile* GetBkgTrackRefFile(void) const {return fBkgTrackRefFile;}
65 void SetBkgTrackRefFile(Text_t *BkgTrackRefFileName); // set background file for track ref. hits
66 void NextBkgTrackRefEvent(void); // next event in background file for track ref. hits
a9e2aefa 67
68 // Hits for reconstruction
3831f268 69 Int_t GetNHitsForRec(void) const {return fNHitsForRec;} // Number
8429a5e4 70
71 // Reconstructed tracks
3831f268 72 Int_t GetNRecTracks() const {return fNRecTracks;} // Number
8429a5e4 73 void SetNRecTracks(Int_t NRecTracks) {fNRecTracks = NRecTracks;}
3831f268 74 TClonesArray* GetRecTracksPtr(void) const {return fRecTracksPtr;} // Array
52c9bc11 75
8429a5e4 76 // Hits on reconstructed tracks
3831f268 77 Int_t GetNRecTrackHits() const {return fNRecTrackHits;} // Number
8429a5e4 78 void SetNRecTrackHits(Int_t NRecTrackHits) {fNRecTrackHits = NRecTrackHits;}
3831f268 79 TClonesArray* GetRecTrackHitsPtr(void) const {return fRecTrackHitsPtr;} // Array
a9e2aefa 80
81 // Functions
3831f268 82 Double_t GetImpactParamFromBendingMomentum(Double_t BendingMomentum) const;
83 Double_t GetBendingMomentumFromImpactParam(Double_t ImpactParam) const;
a9e2aefa 84 void EventReconstruct(void);
276c44b7 85 void EventReconstructTrigger(void);
04b5ea16 86 void EventDump(void); // dump reconstructed event
276c44b7 87 void EventDumpTrigger(void); // dump reconstructed trigger event
3f9fc997 88 //PH void FillEvent(); // fill and write tree of reconstructed events
b035a148 89 void SetTrackMethod(Int_t iTrackMethod); //AZ
90 Int_t GetTrackMethod(void) const {return fTrackMethod;}
91 void FillMUONTrack(void); // set track parameters at hits for Kalman track
8574c72f 92 //Int_t fMuons; // AZ - number of muons within acceptance - just for tests
52c9bc11 93
94 AliMUONData* GetMUONData() {return fMUONData;}
95
9cbdf048 96 protected:
29f1b13a 97 AliMUONTrackReconstructor (const AliMUONTrackReconstructor& rhs); // copy constructor
98 AliMUONTrackReconstructor& operator=(const AliMUONTrackReconstructor& rhs); // assignment operator
9cbdf048 99
a9e2aefa 100 private:
101
343146bf 102 // Constants which should be elsewhere ????
103 static const Int_t fgkMaxMuonTrackingChambers = 10; // Max number of Muon tracking chambers
30178c30 104 static const Int_t fgkMaxMuonTrackingStations = 5; // Max number of Muon tracking stations
343146bf 105
106 // Defaults parameters for reconstruction
7e6d7e07 107 static const Double_t fgkDefaultMinBendingMomentum; // default min. bending momentum for reconstruction
108 static const Double_t fgkDefaultMaxBendingMomentum; // default max. bending momentum for reconstruction
109 static const Double_t fgkDefaultMaxChi2; // default max. track chi2 for reconstruction
110 static const Double_t fgkDefaultMaxSigma2Distance; // default square of max. distance for window size
111 static const Double_t fgkDefaultBendingResolution; // default bending coordinate resolution for reconstruction
112 static const Double_t fgkDefaultNonBendingResolution; // default non bending coordinate resolution for reconstruction
113 static const Double_t fgkDefaultChamberThicknessInX0; // default chamber thickness in X0 for reconstruction
343146bf 114 // Simple magnetic field:
115 // Value taken from macro MUONtracking.C: 0.7 T, hence 7 kG
116 // Length and Position from reco_muon.F, with opposite sign:
117 // Length = ZMAGEND-ZCOIL
118 // Position = (ZMAGEND+ZCOIL)/2
119 // to be ajusted differently from real magnetic field ????
7e6d7e07 120 static const Double_t fgkDefaultSimpleBValue; // default value of magnetic field (dipole)
121 static const Double_t fgkDefaultSimpleBLength; // default length of magnetic field (dipole)
122 static const Double_t fgkDefaultSimpleBPosition; // default position of magnetic field (dipole)
29fc2c86 123 static const Int_t fgkDefaultRecTrackRefHits; // default flag for reconstrution track ref. hits or Clusters
124 static const Double_t fgkDefaultEfficiency; // default chamber efficiency for track ref. hits recontruction
343146bf 125
343146bf 126
83dbc640 127 Int_t fTrackMethod; // AZ - tracking method
128
29f1b13a 129 // Parameters for track reconstruction
a9e2aefa 130 Double_t fMinBendingMomentum; // minimum value (GeV/c) of momentum in bending plane
29f1b13a 131 // Parameters for track reconstruction
d0bfce8d 132 Double_t fMaxBendingMomentum; // maximum value (GeV/c) of momentum in bending plane
133 Double_t fMaxChi2; // maximum Chi2 per degree of Freedom
a9e2aefa 134 Double_t fMaxSigma2Distance; // maximum square distance in units of the variance (maximum chi2)
343146bf 135 Double_t fRMin[fgkMaxMuonTrackingChambers]; // minimum radius (cm)
136 Double_t fRMax[fgkMaxMuonTrackingChambers]; // maximum radius (cm)
30178c30 137 Double_t fSegmentMaxDistBending[fgkMaxMuonTrackingStations]; // maximum distance (cm) for segments in bending plane
138 Double_t fSegmentMaxDistNonBending[fgkMaxMuonTrackingStations]; // maximum distance (cm) for segments in non bending plane
a9e2aefa 139 Double_t fBendingResolution; // chamber resolution (cm) in bending plane
140 Double_t fNonBendingResolution; // chamber resolution (cm) in non bending plane
141 Double_t fChamberThicknessInX0; // chamber thickness in number of radiation lengths
142 // how to take it from simulation ????
143 Double_t fSimpleBValue; // simple magnetic field: value (kG)
144 Double_t fSimpleBLength; // simple magnetic field: length (cm)
145 Double_t fSimpleBPosition; // simple magnetic field: Z central position (cm)
29fc2c86 146 Int_t fRecTrackRefHits; // reconstruction from raw clusters (0) or from track ref. hits (1)
147 Double_t fEfficiency; // chamber efficiency (used for track ref. hits only)
a9e2aefa 148
29fc2c86 149 // Parameters for track ref. background events
a9e2aefa 150 // should be in AliMUON class ????
29fc2c86 151 TFile *fBkgTrackRefFile; // pointer to file
152 TTree *fBkgTrackRefTK; // pointer to tree TK
153 TClonesArray *fBkgTrackRefParticles; // pointer to list of particles in tree TK
154 TTree *fBkgTrackRefTTR; // pointer to tree TTR
155 Int_t fBkgTrackRefEventNumber; // event number
a9e2aefa 156
157 // Hits for reconstruction (should be in AliMUON ????)
158 TClonesArray *fHitsForRecPtr; // pointer to the array of hits for reconstruction
159 Int_t fNHitsForRec; // number of hits for reconstruction
160 // Information per chamber (should be in AliMUONChamber ????)
343146bf 161 Int_t fNHitsForRecPerChamber[fgkMaxMuonTrackingChambers]; // number of HitsForRec
162 Int_t fIndexOfFirstHitForRecPerChamber[fgkMaxMuonTrackingChambers]; // index (0...) of first HitForRec
a9e2aefa 163
164 // Segments inside a station
30178c30 165 TClonesArray *fSegmentsPtr[fgkMaxMuonTrackingStations]; // array of pointers to the segments for each station
166 Int_t fNSegments[fgkMaxMuonTrackingStations]; // number of segments for each station
a9e2aefa 167
8429a5e4 168 // Reconstructed tracks
a9e2aefa 169 TClonesArray *fRecTracksPtr; // pointer to array of reconstructed tracks
170 Int_t fNRecTracks; // number of reconstructed tracks
171
8429a5e4 172 // Track hits on reconstructed tracks
173 TClonesArray *fRecTrackHitsPtr; // pointer to array of hits on reconstructed tracks
174 Int_t fNRecTrackHits; // number of hits on reconstructed tracks
175
52c9bc11 176 // data container
7e6d7e07 177 AliMUONData* fMUONData; // Data container for MUON subsystem
52c9bc11 178
179 // alice loader
7e6d7e07 180 AliLoader* fLoader; // MUON loader to get data
52c9bc11 181
8574c72f 182 Int_t fMuons; // AZ - number of muons within acceptance - just for tests
183
a9e2aefa 184 // Functions
185 void ResetHitsForRec(void);
186 void MakeEventToBeReconstructed(void);
29fc2c86 187 void AddHitsForRecFromTrackRef(TTree *TTR, Int_t Signal);
188 AliMUONHitForRec* NewHitForRecFromTrackRef(AliTrackReference* Hit, Int_t TrackNumber, Int_t Signal);
189 TClonesArray *CleanTrackRefs(TTree *treeTR);
a9e2aefa 190/* void AddHitsForRecFromCathodeCorrelations(TTree* TC); */
191 void AddHitsForRecFromRawClusters(TTree* TR);
192 void SortHitsForRecWithIncreasingChamber();
193 void MakeSegments(void);
194 void ResetSegments(void);
195 void MakeSegmentsPerStation(Int_t Station);
196 void MakeTracks(void);
d837040f 197 Bool_t MakeTriggerTracks(void);
8429a5e4 198 void ResetTrackHits(void);
a9e2aefa 199 void ResetTracks(void);
200 Int_t MakeTrackCandidatesWithTwoSegments(AliMUONSegment *BegSegment);
201 Int_t MakeTrackCandidatesWithOneSegmentAndOnePoint(AliMUONSegment *BegSegment);
202 void MakeTrackCandidates(void);
203 void FollowTracks(void);
8429a5e4 204 void RemoveDoubleTracks(void);
d837040f 205 void UpdateTrackParamAtHit(void);
b8dc484b 206 void UpdateHitForRecAtHit(void);
d837040f 207 void ValidateTracksWithTrigger(void);
83dbc640 208
209
210 //AZ - for Kalman Filter
211 void MakeTrackCandidatesK(void);
212 void FollowTracksK(void);
213 void RemoveDoubleTracksK(void);
214 void GoToVertex(void);
30178c30 215 Bool_t CheckCandidateK(Int_t icand, Int_t nSeeds) const;
83dbc640 216
29fc2c86 217
29f1b13a 218 ClassDef(AliMUONTrackReconstructor, 0) // MUON track reconstructor in ALICE
a9e2aefa 219 };
220
221#endif