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