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