]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONAlignment.h
Changes for #89427: Porting modification for material budget issues to the Release...
[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 #include <TString.h>
16
17 #include "AliMUONAlignmentRecord.h"
18
19 class TGeoCombiTrans;
20 class TClonesArray;
21 class AliMillepede;
22 class AliMUONGeometryTransformer;
23 class AliMUONTrack;
24 class AliMUONTrackParam;
25 class AliMUONVCluster;
26
27 class AliMUONAlignment:public TObject
28 {
29
30   public:
31
32
33   /// constructor
34   AliMUONAlignment();
35
36   /// destructor
37   virtual ~AliMUONAlignment();
38
39   /// process track for alignment minimization
40   /**
41   returns the alignment records for this track.
42   They can be stored in some output for later reprocessing.
43   */
44   AliMUONAlignmentTrackRecord* ProcessTrack(AliMUONTrack *track, Bool_t doAlignment );
45
46   /// process track record
47   void ProcessTrack( AliMUONAlignmentTrackRecord*, Bool_t doAlignment = kTRUE );
48
49   /// returns current track record
50   AliMUONAlignmentTrackRecord* GetTrackRecord( void )
51   { return &fTrackRecord; }
52
53   /// Set geometry transformer
54   void SetGeometryTransformer(AliMUONGeometryTransformer * transformer)
55   { fTransform = transformer; }
56
57   /// Set flag for Magnetic field On/Off
58   void SetBFieldOn(Bool_t bBFieldOn)
59   { fBFieldOn =  bBFieldOn; }
60
61   /// Define chambers to align
62   void SetChOnOff(Bool_t *bChOnOff)
63   {
64     for(int iCh=0; iCh<10; iCh++)
65     { fChOnOff[iCh] =  bChOnOff[iCh]; }
66   }
67
68   /// Possibility to align only one side of the detector
69   void SetSpecLROnOff(Bool_t *bSpecLROnOff)
70   {
71     fSpecLROnOff[0] =  bSpecLROnOff[0];
72     fSpecLROnOff[1] =  bSpecLROnOff[1];
73   }
74
75   void FixStation(Int_t iSt);
76
77   void FixChamber(Int_t iCh);
78
79   void FixDetElem(Int_t iDetElemId, TString sVarXYT = "XYTZ");
80
81   void FixHalfSpectrometer(const Bool_t* bChOnOff, const Bool_t* bSpecLROnOff);
82
83   void AllowVariations( const Bool_t* );
84
85   void SetNonLinear(const Bool_t *bChOnOff, const Bool_t *bVarXYT);
86
87   void AddConstraints(const Bool_t *bChOnOff, const Bool_t *bVarXYT);
88
89   void AddConstraints(const Bool_t *bChOnOff, const Bool_t *bVarXYT, const Bool_t *bDetTLBR, const Bool_t *bSpecLROnOff);
90
91   void ResetConstraints();
92
93   void FixParameter(Int_t param, Double_t value);
94
95   void SetNonLinear(Int_t param);
96
97   void AddConstraint(Double_t *factor, Double_t value );
98
99   void InitGlobalParameters(Double_t *par);
100
101   void SetSigmaXY(Double_t sigmaX, Double_t sigmaY);
102
103   /// Set array of local derivatives
104   void SetLocalDerivative(Int_t index, Double_t value)
105   { fLocalDerivatives[index] = value; }
106
107   /// Set array of global derivatives
108   void SetGlobalDerivative(Int_t index, Double_t value)
109   { fGlobalDerivatives[index] = value; }
110
111   void LocalFit(Int_t iTrack, Double_t *lTrackParam, Int_t lSingleFit);
112
113   void GlobalFit(Double_t *parameters,Double_t *errors,Double_t *pulls);
114
115   void PrintGlobalParameters();
116
117   Double_t GetParError(Int_t iPar);
118
119   AliMUONGeometryTransformer* ReAlign(const AliMUONGeometryTransformer * transformer, const double *misAlignments, Bool_t verbose);
120
121   void SetAlignmentResolution(const TClonesArray* misAlignArray, Int_t chId, Double_t chResX, Double_t chResY, Double_t deResX, Double_t deResY);
122
123   private:
124
125   /// Not implemented
126   AliMUONAlignment(const AliMUONAlignment& right);
127
128   /// Not implemented
129   AliMUONAlignment&  operator = (const AliMUONAlignment& right);
130
131   void Init(Int_t nGlobal, Int_t nLocal, Int_t nStdDev);
132
133   void ConstrainT(Int_t lDetElem, Int_t lCh, Double_t *lConstraintT, Int_t iVar, Double_t lWeight=1.0) const;
134
135   void ConstrainL(Int_t lDetElem, Int_t lCh, Double_t *lConstraintL, Int_t iVar, Double_t lWeight=1.0) const;
136
137   void ConstrainB(Int_t lDetElem, Int_t lCh, Double_t *lConstraintB, Int_t iVar, Double_t lWeight=1.0) const;
138
139   void ConstrainR(Int_t lDetElem, Int_t lCh, Double_t *lConstraintR, Int_t iVar, Double_t lWeight=1.0) const;
140
141   void FillDetElemData();
142
143   void FillRecPointData();
144
145   void FillTrackParamData();
146
147   void ResetLocalEquation();
148
149   /// local equation along X
150   void LocalEquationX( Bool_t doAlignment = kTRUE );
151
152   /// local equation along Y
153   void LocalEquationY( Bool_t doAlignment = kTRUE );
154
155   /// local equation using cluster alignment record
156   void LocalEquation( const AliMUONAlignmentClusterRecord& );
157
158   TGeoCombiTrans ReAlign(const TGeoCombiTrans& transform, const double *detElemMisAlignment) const;
159
160   /// Flag for Magnetic filed On/Off
161   Bool_t fBFieldOn;
162
163   /// Flags for chamber On/Off
164   Bool_t fChOnOff[10];
165
166   /// Flags for left right On/Off
167   Bool_t fSpecLROnOff[2];
168
169   /// Flags degrees of freedom to align (x,y,phi)
170   Bool_t fDoF[4];
171
172   /// "Encouraged" variation for degrees of freedom
173   Double_t fAllowVar[4];
174
175   /// Initial value for chi2 cut
176   /** if > 1 Iterations in AliMillepede are turned on */
177   Double_t fStartFac;
178
179   /// Cut on residual for first iteration
180   Double_t fResCutInitial;
181
182   /// Cut on residual for other iterations
183   Double_t fResCut;
184
185   /// Detector independent alignment class
186   AliMillepede *fMillepede;
187
188   /// AliMUONTrack
189   AliMUONTrack *fTrack;
190
191   /// AliMUONVCluster
192   AliMUONVCluster *fCluster;
193
194   ///< Track parameters
195   AliMUONTrackParam *fTrackParam;
196
197   Int_t fNGlobal;  ///< Number of global parameters
198   Int_t fNLocal;   ///< Number of local parameters
199   Int_t fNStdDev;  ///< Number of standard deviations for chi2 cut
200   Double_t fClustPos[3];    ///< Cluster position
201   Double_t fClustPosLoc[3]; ///< Cluster position in local coordinates
202   Double_t fTrackSlope0[2]; ///< Track slope at reference point
203   Double_t fTrackSlope[2];  ///< Track slope at current point
204   Double_t fTrackPos0[3];   ///< Track intersection at reference point
205   Double_t fTrackPos[3];    ///< Track intersection at current point
206   Double_t fTrackPosLoc[3]; ///< Track intersection at current point in local coordinates
207   Double_t fMeas[2];        ///< Current measurement (depend on B field On/Off)
208   Double_t fSigma[2];       ///< Estimated resolution on measurement
209
210   Double_t fGlobalDerivatives[624]; ///< Array of global derivatives
211   Double_t fLocalDerivatives[4];    ///< Array of local derivatives
212
213   Double_t fConstraintX[624];   ///< Array for constraint equation all X
214   Double_t fConstraintY[624];   ///< Array for constraint equation all Y
215   Double_t fConstraintP[624];   ///< Array for constraint equation all P
216   Double_t fConstraintXT[624];  ///< Array for constraint equation X Top half
217   Double_t fConstraintYT[624];  ///< Array for constraint equation Y Top half
218   Double_t fConstraintPT[624];  ///< Array for constraint equation P Top half
219   Double_t fConstraintXZT[624];  ///< Array for constraint equation X vs Z Top half
220   Double_t fConstraintYZT[624];  ///< Array for constraint equation Y vs Z Top half
221   Double_t fConstraintPZT[624];  ///< Array for constraint equation P vs Z Top half
222   Double_t fConstraintXYT[624];  ///< Array for constraint equation X vs Y Top half
223   Double_t fConstraintYYT[624];  ///< Array for constraint equation Y vs Y Top half
224   Double_t fConstraintPYT[624];  ///< Array for constraint equation P vs Y Top half
225   Double_t fConstraintXB[624];  ///< Array for constraint equation X Bottom half
226   Double_t fConstraintYB[624];  ///< Array for constraint equation Y Bottom half
227   Double_t fConstraintPB[624];  ///< Array for constraint equation P Bottom half
228   Double_t fConstraintXZB[624];  ///< Array for constraint equation X vs Z Bottom half
229   Double_t fConstraintYZB[624];  ///< Array for constraint equation Y vs Z Bottom half
230   Double_t fConstraintPZB[624];  ///< Array for constraint equation P vs Z Bottom half
231   Double_t fConstraintXYB[624];  ///< Array for constraint equation X vs Y Bottom half
232   Double_t fConstraintYYB[624];  ///< Array for constraint equation Y vs Y Bottom half
233   Double_t fConstraintPYB[624];  ///< Array for constraint equation P vs Y Bottom half
234   Double_t fConstraintXR[624];  ///< Array for constraint equation X Right half
235   Double_t fConstraintYR[624];  ///< Array for constraint equation Y Right half
236   Double_t fConstraintPR[624];  ///< Array for constraint equation P Right half
237   Double_t fConstraintXZR[624];  ///< Array for constraint equation X vs Z Right half
238   Double_t fConstraintYZR[624];  ///< Array for constraint equation Y vs Z Right half
239   Double_t fConstraintPZR[624];  ///< Array for constraint equation P vs Z Right half
240   Double_t fConstraintXYR[624];  ///< Array for constraint equation X vs Y Right half
241   Double_t fConstraintYYR[624];  ///< Array for constraint equation Y vs Y Right half
242   Double_t fConstraintPYR[624];  ///< Array for constraint equation P vs Y Right half
243   Double_t fConstraintXL[624];  ///< Array for constraint equation X Left half
244   Double_t fConstraintYL[624];  ///< Array for constraint equation Y Left half
245   Double_t fConstraintPL[624];  ///< Array for constraint equation P Left half
246   Double_t fConstraintXZL[624];  ///< Array for constraint equation X vs Z Left half
247   Double_t fConstraintYZL[624];  ///< Array for constraint equation Y vs Z Left half
248   Double_t fConstraintPZL[624];  ///< Array for constraint equation P vs Z Left half
249   Double_t fConstraintXYL[624];  ///< Array for constraint equation X vs Y Left half
250   Double_t fConstraintYYL[624];  ///< Array for constraint equation Y vs Y Left half
251   Double_t fConstraintPYL[624];  ///< Array for constraint equation P vs Y Left half
252   Double_t fConstraintX3[624];  ///< Array for constraint equation St3 X
253   Double_t fConstraintY3[624];  ///< Array for constraint equation St3 Y
254   Double_t fConstraintX4[624];  ///< Array for constraint equation St4 X
255   Double_t fConstraintY4[624];  ///< Array for constraint equation St4 Y
256   Double_t fConstraintP4[624];  ///< Array for constraint equation St4 P
257   Double_t fConstraintX5[624];  ///< Array for constraint equation St5 X
258   Double_t fConstraintY5[624];  ///< Array for constraint equation St5 Y
259
260   Int_t fDetElemId;        ///< Detection element id
261   Int_t fDetElemNumber;    ///< Detection element number
262   Double_t fPhi;           ///< Azimuthal tilt of detection element
263   Double_t fCosPhi;        ///< Cosine of fPhi
264   Double_t fSinPhi;        ///< Sine of fPhi
265   Double_t fDetElemPos[3]; ///< Position of detection element
266
267   /// running Track record
268   AliMUONAlignmentTrackRecord fTrackRecord;
269
270   /// Geometry transformation
271   AliMUONGeometryTransformer *fTransform;
272
273   static Int_t fgNSt;            ///< Number tracking stations
274   static Int_t fgNCh;            ///< Number tracking chambers
275   static Int_t fgNTrkMod;        ///< Number of tracking modules (4 ch + 6*2 half-ch)
276   static Int_t fgNParCh;         ///< Number of degrees of freedom per chamber
277   static Int_t fgNDetElem;       ///< Total number of detection elements
278   static Int_t fgNDetElemCh[10]; ///< Number of detection elements per chamber
279   static Int_t fgSNDetElemCh[10];///< Sum of detection elements up to this chamber (inc)
280
281   ClassDef(AliMUONAlignment, 2)
282
283 };
284
285 #endif