Major revision of the Kalman tracking: works with new data structure,
[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>
a9e2aefa 14
15class AliMUONHit;
16class AliMUONHitForRec;
17class AliMUONSegment;
18class TClonesArray;
19class TFile;
20class TTree;
c7ba256d 21class AliMUONRecoEvent;
52c9bc11 22class AliMUONData;
23class AliRunLoader;
24class AliLoader;
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;}
3831f268 54 Int_t GetRecGeantHits(void) const {return fRecGeantHits;}
a9e2aefa 55 void SetRecGeantHits(Int_t RecGeantHits) {fRecGeantHits = RecGeantHits;}
3831f268 56 Double_t GetEfficiency(void) const {return fEfficiency;}
a9e2aefa 57 void SetEfficiency(Double_t Efficiency) {fEfficiency = Efficiency;}
3831f268 58 Int_t GetPrintLevel(void) const {return fPrintLevel;}
a9e2aefa 59 void SetPrintLevel(Int_t PrintLevel) {fPrintLevel = PrintLevel;}
60 void SetReconstructionParametersToDefaults(void);
61
62 // Parameters for GEANT background events
3831f268 63 TFile* GetBkgGeantFile(void) const {return fBkgGeantFile;}
a9e2aefa 64 void SetBkgGeantFile(Text_t *BkgGeantFileName); // set background file for GEANT hits
65 void NextBkgGeantEvent(void); // next event in background file for GEANT hits
66
67 // Hits for reconstruction
3831f268 68 Int_t GetNHitsForRec(void) const {return fNHitsForRec;} // Number
8429a5e4 69
70 // Reconstructed tracks
3831f268 71 Int_t GetNRecTracks() const {return fNRecTracks;} // Number
8429a5e4 72 void SetNRecTracks(Int_t NRecTracks) {fNRecTracks = NRecTracks;}
3831f268 73 TClonesArray* GetRecTracksPtr(void) const {return fRecTracksPtr;} // Array
52c9bc11 74
75 // Reconstructed trigger tracks
76 Int_t GetNRecTriggerTracks() const {return fNRecTriggerTracks;} // Number
77 void SetNRecTriggerTracks(Int_t NRecTriggerTracks) {fNRecTriggerTracks = NRecTriggerTracks;}
78 TClonesArray* GetRecTriggerTracksPtr(void) const {return fRecTriggerTracksPtr;} // Array
8429a5e4 79
80 // Hits on reconstructed tracks
3831f268 81 Int_t GetNRecTrackHits() const {return fNRecTrackHits;} // Number
8429a5e4 82 void SetNRecTrackHits(Int_t NRecTrackHits) {fNRecTrackHits = NRecTrackHits;}
3831f268 83 TClonesArray* GetRecTrackHitsPtr(void) const {return fRecTrackHitsPtr;} // Array
a9e2aefa 84
85 // Functions
3831f268 86 Double_t GetImpactParamFromBendingMomentum(Double_t BendingMomentum) const;
87 Double_t GetBendingMomentumFromImpactParam(Double_t ImpactParam) const;
a9e2aefa 88 void EventReconstruct(void);
276c44b7 89 void EventReconstructTrigger(void);
04b5ea16 90 void EventDump(void); // dump reconstructed event
276c44b7 91 void EventDumpTrigger(void); // dump reconstructed trigger event
c7ba256d 92 void FillEvent(); // fill and write tree of reconstructed events
b035a148 93 void SetTrackMethod(Int_t iTrackMethod); //AZ
94 Int_t GetTrackMethod(void) const {return fTrackMethod;}
95 void FillMUONTrack(void); // set track parameters at hits for Kalman track
8574c72f 96 //Int_t fMuons; // AZ - number of muons within acceptance - just for tests
52c9bc11 97
98 AliMUONData* GetMUONData() {return fMUONData;}
99
9cbdf048 100 protected:
30178c30 101 AliMUONEventReconstructor (const AliMUONEventReconstructor& rhs); // copy constructor
102 AliMUONEventReconstructor& operator=(const AliMUONEventReconstructor& rhs); // assignment operator
9cbdf048 103
a9e2aefa 104 private:
105
343146bf 106 // Constants which should be elsewhere ????
107 static const Int_t fgkMaxMuonTrackingChambers = 10; // Max number of Muon tracking chambers
30178c30 108 static const Int_t fgkMaxMuonTrackingStations = 5; // Max number of Muon tracking stations
343146bf 109
110 // Defaults parameters for reconstruction
7e6d7e07 111 static const Double_t fgkDefaultMinBendingMomentum; // default min. bending momentum for reconstruction
112 static const Double_t fgkDefaultMaxBendingMomentum; // default max. bending momentum for reconstruction
113 static const Double_t fgkDefaultMaxChi2; // default max. track chi2 for reconstruction
114 static const Double_t fgkDefaultMaxSigma2Distance; // default square of max. distance for window size
115 static const Double_t fgkDefaultBendingResolution; // default bending coordinate resolution for reconstruction
116 static const Double_t fgkDefaultNonBendingResolution; // default non bending coordinate resolution for reconstruction
117 static const Double_t fgkDefaultChamberThicknessInX0; // default chamber thickness in X0 for reconstruction
343146bf 118 // Simple magnetic field:
119 // Value taken from macro MUONtracking.C: 0.7 T, hence 7 kG
120 // Length and Position from reco_muon.F, with opposite sign:
121 // Length = ZMAGEND-ZCOIL
122 // Position = (ZMAGEND+ZCOIL)/2
123 // to be ajusted differently from real magnetic field ????
7e6d7e07 124 static const Double_t fgkDefaultSimpleBValue; // default value of magnetic field (dipole)
125 static const Double_t fgkDefaultSimpleBLength; // default length of magnetic field (dipole)
126 static const Double_t fgkDefaultSimpleBPosition; // default position of magnetic field (dipole)
127 static const Int_t fgkDefaultRecGeantHits; // default flag for reconstrution GEANT hits or Clusters
128 static const Double_t fgkDefaultEfficiency; // default chamber efficiency for GEANT hits recontruction
343146bf 129
7e6d7e07 130 static const Int_t fgkDefaultPrintLevel; // default print level
343146bf 131
83dbc640 132 Int_t fTrackMethod; // AZ - tracking method
133
a9e2aefa 134 // Parameters for event reconstruction
135 Double_t fMinBendingMomentum; // minimum value (GeV/c) of momentum in bending plane
d0bfce8d 136 // Parameters for event reconstruction
137 Double_t fMaxBendingMomentum; // maximum value (GeV/c) of momentum in bending plane
138 Double_t fMaxChi2; // maximum Chi2 per degree of Freedom
a9e2aefa 139 Double_t fMaxSigma2Distance; // maximum square distance in units of the variance (maximum chi2)
343146bf 140 Double_t fRMin[fgkMaxMuonTrackingChambers]; // minimum radius (cm)
141 Double_t fRMax[fgkMaxMuonTrackingChambers]; // maximum radius (cm)
30178c30 142 Double_t fSegmentMaxDistBending[fgkMaxMuonTrackingStations]; // maximum distance (cm) for segments in bending plane
143 Double_t fSegmentMaxDistNonBending[fgkMaxMuonTrackingStations]; // maximum distance (cm) for segments in non bending plane
a9e2aefa 144 Double_t fBendingResolution; // chamber resolution (cm) in bending plane
145 Double_t fNonBendingResolution; // chamber resolution (cm) in non bending plane
146 Double_t fChamberThicknessInX0; // chamber thickness in number of radiation lengths
147 // how to take it from simulation ????
148 Double_t fSimpleBValue; // simple magnetic field: value (kG)
149 Double_t fSimpleBLength; // simple magnetic field: length (cm)
150 Double_t fSimpleBPosition; // simple magnetic field: Z central position (cm)
151 Int_t fRecGeantHits; // reconstruction from raw clusters (0) or from GEANT hits (1)
152 Double_t fEfficiency; // chamber efficiency (used for GEANT hits only)
153 Int_t fPrintLevel; // print level
154
155 // Parameters for GEANT background events
156 // should be in AliMUON class ????
157 TFile *fBkgGeantFile; // pointer to file
158 TTree *fBkgGeantTK; // pointer to tree TK
159 TClonesArray *fBkgGeantParticles; // pointer to list of particles in tree TK
160 TTree *fBkgGeantTH; // pointer to tree TH
7e6d7e07 161 TClonesArray *fBkgGeantHits; // pointer to list of hits in tree TH
162 Int_t fBkgGeantEventNumber; // event number
a9e2aefa 163
164 // Hits for reconstruction (should be in AliMUON ????)
165 TClonesArray *fHitsForRecPtr; // pointer to the array of hits for reconstruction
166 Int_t fNHitsForRec; // number of hits for reconstruction
167 // Information per chamber (should be in AliMUONChamber ????)
343146bf 168 Int_t fNHitsForRecPerChamber[fgkMaxMuonTrackingChambers]; // number of HitsForRec
169 Int_t fIndexOfFirstHitForRecPerChamber[fgkMaxMuonTrackingChambers]; // index (0...) of first HitForRec
a9e2aefa 170
171 // Segments inside a station
30178c30 172 TClonesArray *fSegmentsPtr[fgkMaxMuonTrackingStations]; // array of pointers to the segments for each station
173 Int_t fNSegments[fgkMaxMuonTrackingStations]; // number of segments for each station
a9e2aefa 174
8429a5e4 175 // Reconstructed tracks
a9e2aefa 176 TClonesArray *fRecTracksPtr; // pointer to array of reconstructed tracks
177 Int_t fNRecTracks; // number of reconstructed tracks
178
276c44b7 179 // Reconstructed trigger tracks
180 TClonesArray *fRecTriggerTracksPtr; // pointer to array of reconstructed trigger tracks
181 Int_t fNRecTriggerTracks; // number of reconstructed trigger tracks
182
8429a5e4 183 // Track hits on reconstructed tracks
184 TClonesArray *fRecTrackHitsPtr; // pointer to array of hits on reconstructed tracks
185 Int_t fNRecTrackHits; // number of hits on reconstructed tracks
186
c7ba256d 187 // Objects needed for tree writing
188 AliMUONRecoEvent *fRecoEvent; // the reconstructed event
189 TTree *fEventTree; // tree of reconstructed events
190 TFile *fTreeFile; // file where the tree is outputed
191
52c9bc11 192 // data container
7e6d7e07 193 AliMUONData* fMUONData; // Data container for MUON subsystem
52c9bc11 194
195 // alice loader
7e6d7e07 196 AliLoader* fLoader; // MUON loader to get data
52c9bc11 197
8574c72f 198 Int_t fMuons; // AZ - number of muons within acceptance - just for tests
199
a9e2aefa 200 // Functions
201 void ResetHitsForRec(void);
202 void MakeEventToBeReconstructed(void);
203 void AddHitsForRecFromGEANT(TTree *TH);
204 void AddHitsForRecFromBkgGEANT(TTree *TH, TClonesArray *Hits);
205 AliMUONHitForRec* NewHitForRecFromGEANT(AliMUONHit* Hit, Int_t TrackNumber, Int_t HitNumber, Int_t Signal);
206/* void AddHitsForRecFromCathodeCorrelations(TTree* TC); */
207 void AddHitsForRecFromRawClusters(TTree* TR);
208 void SortHitsForRecWithIncreasingChamber();
209 void MakeSegments(void);
210 void ResetSegments(void);
211 void MakeSegmentsPerStation(Int_t Station);
212 void MakeTracks(void);
d837040f 213 Bool_t MakeTriggerTracks(void);
8429a5e4 214 void ResetTrackHits(void);
a9e2aefa 215 void ResetTracks(void);
276c44b7 216 void ResetTriggerTracks(void);
a9e2aefa 217 Int_t MakeTrackCandidatesWithTwoSegments(AliMUONSegment *BegSegment);
218 Int_t MakeTrackCandidatesWithOneSegmentAndOnePoint(AliMUONSegment *BegSegment);
219 void MakeTrackCandidates(void);
220 void FollowTracks(void);
8429a5e4 221 void RemoveDoubleTracks(void);
d837040f 222 void UpdateTrackParamAtHit(void);
b8dc484b 223 void UpdateHitForRecAtHit(void);
d837040f 224 void ValidateTracksWithTrigger(void);
83dbc640 225
226
227 //AZ - for Kalman Filter
228 void MakeTrackCandidatesK(void);
229 void FollowTracksK(void);
230 void RemoveDoubleTracksK(void);
231 void GoToVertex(void);
30178c30 232 Bool_t CheckCandidateK(Int_t icand, Int_t nSeeds) const;
83dbc640 233
ecfa008b 234 ClassDef(AliMUONEventReconstructor, 0) // MUON event reconstructor in ALICE
a9e2aefa 235 };
236
237#endif