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