]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONAlignment.h
Typo corrected.
[u/mrichter/AliRoot.git] / MUON / AliMUONAlignment.h
1 #ifndef ALIMUONALIGNMENT_H
2 #define ALIMUONALIGNMENT_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 /// \ingroup rec
9 /// \class AliMUONAlignment
10 /// \brief Class for alignment of muon spectrometer
11 //
12 // Authors: Bruce Becker, Javier Castillo
13
14 #include <TObject.h>
15
16 class TGeoCombiTrans;
17 class TClonesArray;
18 class AliMillepede;
19 class AliMUONGeometryTransformer;
20 class AliMUONTrack;
21 class AliMUONTrackParam;
22 class AliMUONHitForRec;
23
24 class AliMUONAlignment:public TObject
25 {
26
27 public:
28   AliMUONAlignment();
29   virtual ~AliMUONAlignment();
30
31   void ProcessTrack(AliMUONTrack *track);
32   /// Set geometry transformer
33   void SetGeometryTransformer(AliMUONGeometryTransformer * transformer) {
34     fTransform = transformer;
35   }
36
37   void FixStation(Int_t iSt);
38   void FixHalfSpectrometer(Bool_t *bStOnOff, Bool_t *bSpecLROnOff);
39   void AllowVariations(Bool_t *bStOnOff);
40   void SetNonLinear(Bool_t *bStOnOff, Bool_t *bVarXYT);
41   void AddConstraints(Bool_t *bStOnOff, Bool_t *bVarXYT);
42   void AddConstraints(Bool_t *bStOnOff, Bool_t *bVarXYT, Bool_t *bDetTLBR, Bool_t *bSpecLROnOff);
43   void ResetConstraints();
44
45   void FixParameter(Int_t param, Double_t value);
46   void SetNonLinear(Int_t param);
47   void AddConstraint(Double_t *factor, Double_t value );
48   void InitGlobalParameters(Double_t *par);   
49   /// Set array of local derivatives
50   void SetLocalDerivative(Int_t index, Double_t value) {      
51     fLocalDerivatives[index] = value;
52   }
53   /// Set array of global derivatives
54   void SetGlobalDerivative(Int_t index, Double_t value) {
55     fGlobalDerivatives[index] = value;
56   }  
57   void LocalFit(Int_t iTrack, Double_t *lTrackParam, Int_t lSingleFit);
58   void GlobalFit(Double_t *parameters,Double_t *errors,Double_t *pulls);
59   void PrintGlobalParameters();
60   Double_t GetParError(Int_t iPar);
61   
62   AliMUONGeometryTransformer* 
63     ReAlign(const AliMUONGeometryTransformer * transformer, double *misAlignments, Bool_t verbose);
64
65  private:
66   /// Not implemented
67   AliMUONAlignment(const AliMUONAlignment& right);
68   /// Not implemented
69   AliMUONAlignment&  operator = (const AliMUONAlignment& right);
70
71   void Init(Int_t nGlobal, Int_t nLocal, Int_t nStdDev);
72   void ConstrainT(Int_t lDetElem, Int_t lCh, Double_t *lConstraintT, Int_t iVar, Double_t lWeight=1.0);
73   void ConstrainL(Int_t lDetElem, Int_t lCh, Double_t *lConstraintL, Int_t iVar, Double_t lWeight=1.0);
74   void ConstrainB(Int_t lDetElem, Int_t lCh, Double_t *lConstraintB, Int_t iVar, Double_t lWeight=1.0);
75   void ConstrainR(Int_t lDetElem, Int_t lCh, Double_t *lConstraintR, Int_t iVar, Double_t lWeight=1.0);
76   void FillDetElemData();
77   void FillRecPointData();
78   void FillTrackParamData();
79   void ResetLocalEquation();
80   void LocalEquationX();
81   void LocalEquationY();
82
83   TGeoCombiTrans ReAlign(const TGeoCombiTrans& transform, double *detElemMisAlignment) const;
84
85   Bool_t fBFieldOn;        ///< Flag for Magnetic filed On/Off
86                                                                        
87   Bool_t fDoF[3];          ///< Flags degrees of freedom to align (x,y,phi)
88   Double_t fAllowVar[3];   ///< "Encouraged" variation for degrees of freedom 
89   Double_t fStartFac;      ///< Initial value for chi2 cut 
90                            ///< if > 1 Iterations in AliMillepede are turned on
91   Double_t fResCutInitial; ///< Cut on residual for first iteration
92   Double_t fResCut;        ///< Cut on residual for other iterations 
93
94   AliMillepede *fMillepede; ///< Detector independent alignment class
95   
96   TClonesArray *fTrackParamAtHit; ///< Array of track parameters 
97   TClonesArray *fHitForRecAtHit;  ///< Array of track hits 
98   AliMUONTrack *fTrack;           ///< AliMUONTrack 
99   AliMUONHitForRec *fRecHit;      ///< AliMUONHitForRec
100   AliMUONTrackParam *fTrackParam; ///< Track parameters 
101
102   Int_t fNGlobal;  ///< Number of global parameters
103   Int_t fNLocal;   ///< Number of local parameters
104   Int_t fNStdDev;  ///< Number of standard deviations for chi2 cut
105   Double_t fClustPos[3];    ///< Cluster position
106   Double_t fClustPosLoc[3]; ///< Cluster position in local coordinates
107   Double_t fTrackSlope0[2]; ///< Track slope at reference point
108   Double_t fTrackSlope[2];  ///< Track slope at current point
109   Double_t fTrackPos0[3];   ///< Track intersection at reference point
110   Double_t fTrackPos[3];    ///< Track intersection at current point
111   Double_t fTrackPosLoc[3]; ///< Track intersection at current point in local coordinates 
112   Double_t fMeas[2];        ///< Current measurement (depend on B field On/Off)  
113   Double_t fSigma[2];       ///< Estimated resolution on measurement
114
115   Double_t fGlobalDerivatives[468]; ///< Array of global derivatives
116   Double_t fLocalDerivatives[4];    ///< Array of local derivatives
117
118   Double_t fConstraintX[468];   ///< Array for constraint equation all X
119   Double_t fConstraintY[468];   ///< Array for constraint equation all Y
120   Double_t fConstraintP[468];   ///< Array for constraint equation all P
121   Double_t fConstraintXT[468];  ///< Array for constraint equation X Top half
122   Double_t fConstraintYT[468];  ///< Array for constraint equation Y Top half
123   Double_t fConstraintPT[468];  ///< Array for constraint equation P Top half
124   Double_t fConstraintXZT[468];  ///< Array for constraint equation X vs Z Top half
125   Double_t fConstraintYZT[468];  ///< Array for constraint equation Y vs Z Top half
126   Double_t fConstraintPZT[468];  ///< Array for constraint equation P vs Z Top half
127   Double_t fConstraintXYT[468];  ///< Array for constraint equation X vs Y Top half
128   Double_t fConstraintYYT[468];  ///< Array for constraint equation Y vs Y Top half
129   Double_t fConstraintPYT[468];  ///< Array for constraint equation P vs Y Top half
130   Double_t fConstraintXB[468];  ///< Array for constraint equation X Bottom half
131   Double_t fConstraintYB[468];  ///< Array for constraint equation Y Bottom half
132   Double_t fConstraintPB[468];  ///< Array for constraint equation P Bottom half
133   Double_t fConstraintXZB[468];  ///< Array for constraint equation X vs Z Bottom half
134   Double_t fConstraintYZB[468];  ///< Array for constraint equation Y vs Z Bottom half
135   Double_t fConstraintPZB[468];  ///< Array for constraint equation P vs Z Bottom half
136   Double_t fConstraintXYB[468];  ///< Array for constraint equation X vs Y Bottom half
137   Double_t fConstraintYYB[468];  ///< Array for constraint equation Y vs Y Bottom half
138   Double_t fConstraintPYB[468];  ///< Array for constraint equation P vs Y Bottom half
139   Double_t fConstraintXR[468];  ///< Array for constraint equation X Right half
140   Double_t fConstraintYR[468];  ///< Array for constraint equation Y Right half
141   Double_t fConstraintPR[468];  ///< Array for constraint equation P Right half
142   Double_t fConstraintXZR[468];  ///< Array for constraint equation X vs Z Right half
143   Double_t fConstraintYZR[468];  ///< Array for constraint equation Y vs Z Right half
144   Double_t fConstraintPZR[468];  ///< Array for constraint equation P vs Z Right half
145   Double_t fConstraintXYR[468];  ///< Array for constraint equation X vs Y Right half
146   Double_t fConstraintYYR[468];  ///< Array for constraint equation Y vs Y Right half
147   Double_t fConstraintPYR[468];  ///< Array for constraint equation P vs Y Right half
148   Double_t fConstraintXL[468];  ///< Array for constraint equation X Left half
149   Double_t fConstraintYL[468];  ///< Array for constraint equation Y Left half
150   Double_t fConstraintPL[468];  ///< Array for constraint equation P Left half
151   Double_t fConstraintXZL[468];  ///< Array for constraint equation X vs Z Left half
152   Double_t fConstraintYZL[468];  ///< Array for constraint equation Y vs Z Left half
153   Double_t fConstraintPZL[468];  ///< Array for constraint equation P vs Z Left half
154   Double_t fConstraintXYL[468];  ///< Array for constraint equation X vs Y Left half
155   Double_t fConstraintYYL[468];  ///< Array for constraint equation Y vs Y Left half
156   Double_t fConstraintPYL[468];  ///< Array for constraint equation P vs Y Left half
157   Double_t fConstraintX3[468];  ///< Array for constraint equation St3 X
158   Double_t fConstraintY3[468];  ///< Array for constraint equation St3 Y
159   Double_t fConstraintX4[468];  ///< Array for constraint equation St4 X
160   Double_t fConstraintY4[468];  ///< Array for constraint equation St4 Y
161   Double_t fConstraintP4[468];  ///< Array for constraint equation St4 P
162   Double_t fConstraintX5[468];  ///< Array for constraint equation St5 X
163   Double_t fConstraintY5[468];  ///< Array for constraint equation St5 Y
164
165   Int_t fDetElemId;        ///< Detection element id
166   Int_t fDetElemNumber;    ///< Detection element number
167   Double_t fPhi;           ///< Azimuthal tilt of detection element 
168   Double_t fCosPhi;        ///< Cosine of fPhi
169   Double_t fSinPhi;        ///< Sine of fPhi
170   Double_t fDetElemPos[3]; ///< Position of detection element
171
172   AliMUONGeometryTransformer *fTransform; ///< Geometry transformation
173
174   static Int_t fgNSt;            ///< Number tracking stations
175   static Int_t fgNCh;            ///< Number tracking chambers
176   static Int_t fgNTrkMod;        ///< Number of tracking modules (4 ch + 6*2 half-ch)
177   static Int_t fgNParCh;         ///< Number of degrees of freedom per chamber
178   static Int_t fgNDetElem;       ///< Total number of detection elements
179   static Int_t fgNDetElemCh[10]; ///< Number of detection elements per chamber
180   static Int_t fgSNDetElemCh[10];///< Sum of detection elements up to this chamber (inc)
181
182 ClassDef(AliMUONAlignment, 0)};
183
184 #endif