]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.h
0cff8a978c3027a6c0d4146fd35a5bea1f31b244
[u/mrichter/AliRoot.git] / HLT / MUON / OnlineAnalysis / AliHLTMUONFullTracker.h
1 #ifndef ALIHLTMUONFULLTRACKER_H
2 #define ALIHLTMUONFULLTRACKER_H
3 /* This file is property of and copyright by the ALICE HLT Project        *
4  * ALICE Experiment at CERN, All rights reserved.                         *
5  * See cxx source for full Copyright notice                               */
6
7 ///
8 ///  @file   AliHLTMUONFullTracker.h
9 ///  @author Indranil Das <indra.das@saha.ac.in> | <indra.ehep@gmail.com>
10 ///  @date   09 Feb 2010
11 ///  @brief  For full tracking in the dimuon HLT.
12 ///
13
14
15 /**********************************************************************
16  Created on : 08/12/2009
17  Purpose    : First version implementation of the Full tracker for dHLT.
18  Author     : Indranil Das, HEP Division, SINP
19  Email      : indra.das@saha.ac.in | indra.ehep@gmail.com
20 **********************************************************************/
21
22 #include <iostream>
23 #include <map>
24
25 #include "TMatrixD.h"
26 #include "TMath.h"
27 #include "AliHLTMUONDataBlockReader.h"
28 #include "AliHLTMUONDataBlockWriter.h"
29
30
31 class   AliHLTMUONUtils;
32 class   AliHLTMUONDataTypes;
33 class   AliHLTMUONConstants;
34 class   AliRunInfo;
35 class   AliLog;
36 class   AliCDBEntry;
37 class   AliMpDEIterator;
38 class   AliMpCDB;
39 class   AliMpSegmentation;
40 class   AliMpDDLStore;
41 class   AliMUONTrackParam;
42 class   AliMUONGeometryTransformer;
43 class   AliMUONConstants;
44 class   AliMUONTrackExtrap;
45 class   AliMUONTrackParam;
46 class   AliMUONTrackExtrap;
47 class   AliGRPObject;
48 class   AliGeomManager;
49 class   AliCDBStorage;
50 class   AliCDBManager;
51 class   AliMagF;
52 class   TGeoGlobalMagField;
53 class   TVector3;
54 class   TString;
55 class   TMap;
56
57 typedef std::map<Int_t, Int_t> DetElemList;
58
59 class AliHLTMUONFullTracker : public AliHLTLogging
60 {
61
62  public :
63   ///Constructor
64   AliHLTMUONFullTracker() ;
65   ///Destructor
66   virtual ~AliHLTMUONFullTracker();
67
68   ///Print message
69   void Print();
70   ///Set the input of trigrec blocks
71   Bool_t SetInput(AliHLTInt32_t ddl, const AliHLTMUONTriggerRecordStruct  *data, AliHLTInt32_t size);
72   ///Set the input of rechit blocks
73   Bool_t SetInput(AliHLTInt32_t ddl, const AliHLTMUONRecHitStruct  *data, AliHLTInt32_t size);
74   ///Main method to run and compute the tracks
75   Bool_t Run(int iEvent,AliHLTMUONTrackStruct *data, AliHLTUInt32_t& size);
76   ///To be called once from DoInit method of component
77   Bool_t Init();
78   ///Max number of points per chamber
79   int MaxNofPointsPerCh(){return fgkMaxNofPointsPerCh;}
80
81  protected:
82
83   /// copy constructor
84   AliHLTMUONFullTracker(const AliHLTMUONFullTracker& rhs); 
85   /// assignment operator
86   AliHLTMUONFullTracker& operator=(const AliHLTMUONFullTracker& rhs); 
87
88  private :
89
90   /// intger pair needed for QuadTrackSeg method
91   struct IntPair{
92     Int_t fFirst,fSecond; /// First and second
93   };
94   ///Structure for internal track segments
95   struct TrackSeg{
96     Int_t fIndex[4]; /// index array for cluster address
97     AliHLTInt32_t fTrigRec; /// trigrec
98   };
99
100   ///Sructure for clusters
101   struct Cluster{
102     Float_t fX,fY,fZ;  /// position
103     Float_t fErrX2,fErrY2;  /// error in position
104   };
105  
106   ///Sructure for clusters
107   struct HalfTrack{
108     Float_t fPx,fPy,fPz; /// momentum
109     Int_t fCharge;       /// charge
110   }; 
111
112   static const Float_t fgkTrackDetCoordinate[3]; /// set the constant value for third station position and size
113   
114   static const Double_t fgkAbsoedge[4] ;     /// edge of the absorber
115   static const Double_t fgkRadLen[3] ;       /// radiation length of the main three matirials of the front absorber
116   static const Double_t fgkRho[3] ;          /// density of the main three matirials of the front absorber
117   static const Double_t fgkAtomicZ[3] ;      /// atomic number the main three matirials of the front absorber
118   static const Double_t fgkAtomicA[3] ;      /// atomic mass of the main three matirials of the front absorber
119
120   static const Int_t fgkMaxNofCellsPerCh ;      /// maximum number of cell are allowed to create
121   static const Int_t fgkMaxNofPointsPerCh ;     /// maximim number of points per chamber
122   static const Int_t fgkMaxNofCh ;              /// maximum number of chambrs
123   static const Int_t fgkMaxNofTracks;           /// maximum number of allowed tracks
124   static const Int_t fgkMaxNofConnectedTracks;  /// maximum number of back to front connected tracks
125   
126   AliMUONGeometryTransformer *fChamberGeometryTransformer; /// Pointer to AliMUONGeometryTransformer
127   AliHLTMUONRecHitStruct ***fChPoint; /// array of pointer to rechit data
128   AliHLTMUONTriggerRecordStruct **fChPoint11; ///array of pointer to trigrec data
129   TrackSeg *fBackTrackSeg; /// track segments at the rear part of the spectrometer
130   TrackSeg *fFrontTrackSeg; /// track segments close the part of interaction point  of ALICE
131   Float_t *fExtrapSt3X ; /// Extrapolated x position in third station
132   Float_t *fExtrapSt3Y ; /// Extrapolated y position in third station
133   Float_t *fInclinationBack; /// values of inclination angle of back track segments
134
135   Int_t *fNofConnectedfrontTrackSeg ; /// nof connected tracks in front direction for each back track segments
136   Int_t **fBackToFront; /// Pointer to back to front segment mapping
137   Int_t *fNofPoints ; /// Number of points for each stations
138   AliMUONTrackParam *fTrackParam ; /// track parameters;
139   HalfTrack *fHalfTrack; /// momentum parameters for the tracks which doesnot have tracksegment in quadrants
140
141   Int_t fTotNofPoints; /// Total number of points received from all rechit source
142   Int_t fTotTrackSeg; /// Total number of track segments
143   Int_t fNofCells[2]; // nof cell count per station
144   Int_t fNofbackTrackSeg; /// number of back track segments
145   Int_t fNoffrontTrackSeg; /// number of front track segments
146   Int_t fNofConnected ; /// number of connected track segments
147   AliHLTUInt32_t fNofTracks; /// number of connected track segments
148   DetElemList fDetElemList; ///Map for valid detelem
149
150   /// Slat Track segments 
151   Bool_t SlatTrackSeg();
152   /// Calculate preliminary momentum
153   Bool_t PrelimMomCalc();
154   /// Quad Track segments 
155   Bool_t QuadTrackSeg();
156   /// Kalman Chi2 test
157   Bool_t KalmanChi2Test();
158   /// track extrapolation through  dipole magnet to connect front and back track seg
159   Bool_t SelectFront();
160   /// Propagate tracks
161   void PropagateTracks(Double_t charge, Float_t& px, Float_t& py, Float_t& pz, 
162                        Float_t& xr, Float_t& yr, Float_t& zr, Float_t zprop);
163   /// extrapolate to origin
164   Bool_t ExtrapolateToOrigin(Bool_t extrap);
165   /// Clean after each run
166   Bool_t Clear();
167
168
169   /// Angle calculate
170   inline Double_t Angle(const AliHLTMUONRecHitStruct *v1, const AliHLTMUONRecHitStruct *v2);
171   /// Subtracktion of two point
172   inline void Sub(const AliHLTMUONRecHitStruct *v1, const AliHLTMUONRecHitStruct *v2, AliHLTMUONRecHitStruct *v3) const;
173   /// Kalman Filter
174   inline Double_t KalmanFilter(AliMUONTrackParam &trackParamAtCluster, Cluster *cluster);
175   /// Try onecluster
176   inline Double_t TryOneCluster(const AliMUONTrackParam &trackParam, Cluster* cluster,
177                                 AliMUONTrackParam &trackParamAtCluster, Bool_t updatePropagator);
178   inline Bool_t TryOneClusterFast(const AliMUONTrackParam &trackParam, const Cluster* cluster);
179
180   /// MCS effect correction
181   inline void CorrectMCSEffectInAbsorber(AliMUONTrackParam* param,
182                                          Double_t xVtx, Double_t yVtx, Double_t zVtx,
183                                          Double_t absZBeg, 
184                                          Double_t f1, Double_t f2);
185   /// Covariant handling function
186   inline void Cov2CovP(const TMatrixD &param, TMatrixD &cov);
187   /// Covariant handling function
188   inline void CovP2Cov(const TMatrixD &param, TMatrixD &covP);
189   /// Energy loss coreection in front absorber
190   inline void CorrectELossEffectInAbsorber(AliMUONTrackParam* param, Double_t eLoss);
191   /// Linear Extrapolation to Z position
192   inline void LinearExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd);
193   /// Energy loss
194   inline Double_t EnergyLossFluctuation2(Double_t pTotal, Double_t pathLength, Double_t rho, Double_t atomicA, Double_t atomicZ);
195   /// Bethe Bloch formula of enrgy loss
196   inline Double_t BetheBloch(Double_t pTotal, Double_t pathLength, Double_t rho, Double_t atomicA, Double_t atomicZ);
197   
198   /// Runge Kutta method of track extrapolation through mag field
199   inline void OneStepRungekutta(Double_t charge, Double_t step, const Double_t* vect, Double_t* vout);
200   /// Helix3 method of track extrapolation through mag field
201   inline void OneStepHelix3(Double_t field, Double_t step, const Double_t *vect, Double_t *vout) const;                           
202   /// Fill the tracks to output pointer
203   Bool_t FillOutData(AliHLTMUONTrackStruct *data, AliHLTUInt32_t& size);
204   
205 };
206 #endif // ALIHLTMUONMANSOTRACKERFSM_H