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 */
6 /* $Id: AliMUONAlignment.h 50858 2011-07-29 10:58:20Z ivana $ */
9 /// \class AliMUONAlignment
10 /// \brief Class for alignment of muon spectrometer
12 // Authors: Bruce Becker, Javier Castillo, Hugo Pereira Da Costa
14 #include "AliMillePedeRecord.h"
18 #include <TGeoMatrix.h>
22 class AliMUONGeometryTransformer;
24 class AliMUONTrackParam;
25 class AliMUONVCluster;
27 class AliMUONAlignment:public TObject
34 virtual ~AliMUONAlignment();
41 /// Number tracking stations
44 /// Number tracking chambers
47 /// Number of tracking modules (4 ch + 6*2 half-ch)
50 /// Total number of detection elements
51 /// (4*2 + 4*2 + 18*2 + 26*2 + 26*2)
54 /// Number of local parameters
57 /// Number of degrees of freedom per chamber
60 /// Number of global parameters
61 fNGlobal = fgNParCh*fgNDetElem
64 /// Number of detection elements per chamber
65 static const Int_t fgNDetElemCh[fgNCh];
67 /// Sum of detection elements up to this chamber
68 static const Int_t fgSNDetElemCh[fgNCh+1];
70 /// global parameter bit set, used for masks
78 ParAllTranslations = ParX|ParY|ParZ,
79 ParAllRotations = ParTZ,
80 ParAll = ParAllTranslations|ParAllRotations
84 /// detector sides bit set, used for selecting sides in constrains
91 SideTopLeft = SideTop|SideLeft,
92 SideTopRight = SideTop|SideRight,
93 SideBottomLeft = SideBottom|SideLeft,
94 SideBottomRight = SideBottom|SideRight,
95 AllSides = SideTop|SideBottom|SideLeft|SideRight
98 AliMillePedeRecord* ProcessTrack( AliMUONTrack* track, Bool_t doAlignment, Double_t weight = 1 );
100 void ProcessTrack( AliMillePedeRecord* );
106 void SetRunNumber( Int_t id )
109 /// Set flag for Magnetic field On/Off
110 void SetBFieldOn( Bool_t value )
111 { fBFieldOn = value; }
113 /// use unbiased residuals
114 void SetUnbias( Bool_t value )
117 void SetAllowedVariation( Int_t iPar, Double_t value );
119 void SetSigmaXY(Double_t sigmaX, Double_t sigmaY);
121 /// Set geometry transformer
122 void SetGeometryTransformer( AliMUONGeometryTransformer * transformer )
123 { fTransform = transformer; }
127 //@name fixing detectors
130 void FixAll( UInt_t parameterMask = ParAll );
132 void FixChamber( Int_t iCh, UInt_t parameterMask = ParAll );
134 void FixDetElem( Int_t iDetElemId, UInt_t parameterMask = ParAll );
136 void FixHalfSpectrometer( const Bool_t* bChOnOff, UInt_t sidesMask = AllSides, UInt_t parameterMask = ParAll );
138 void FixParameter( Int_t iPar );
140 void FixParameter( Int_t iDetElem, Int_t iPar )
141 { FixParameter( iDetElem*fgNParCh + iPar ); }
145 //@name releasing detectors
148 void ReleaseChamber( Int_t iCh, UInt_t parameterMask = ParAll );
150 void ReleaseDetElem( Int_t iDetElemId, UInt_t parameterMask = ParAll );
152 void ReleaseParameter( Int_t iPar );
154 void ReleaseParameter( Int_t iDetElem, Int_t iPar )
155 { ReleaseParameter( iDetElem*fgNParCh + iPar ); }
159 //@name grouping detectors
162 void GroupChamber( Int_t iCh, UInt_t parameterMask = ParAll );
164 void GroupDetElems( Int_t detElemMin, Int_t detElemMax, UInt_t parameterMask = ParAll );
166 void GroupDetElems( Int_t *detElemList, Int_t nDetElem, UInt_t parameterMask = ParAll );
170 //@name define non linearity
173 void SetChamberNonLinear( Int_t iCh, UInt_t parameterMask);
175 void SetDetElemNonLinear( Int_t iSt, UInt_t parameterMask);
177 void SetParameterNonLinear( Int_t iPar );
179 void SetParameterNonLinear( Int_t iDetElem, Int_t iPar )
180 { SetParameterNonLinear( iDetElem*fgNParCh + iPar ); }
187 void AddConstraints( const Bool_t *bChOnOff, UInt_t parameterMask );
189 void AddConstraints( const Bool_t *bChOnOff, const Bool_t *lVarXYT, UInt_t sidesMask = AllSides );
193 /// initialize global parameters to a give set of values
194 void InitGlobalParameters( Double_t *par );
196 /// perform global fit
197 void GlobalFit( Double_t *parameters,Double_t *errors,Double_t *pulls );
199 /// print global parameters
200 void PrintGlobalParameters( void ) const;
202 /// get error on a given parameter
203 Double_t GetParError( Int_t iPar ) const;
205 AliMUONGeometryTransformer* ReAlign( const AliMUONGeometryTransformer * transformer, const double *misAlignments, Bool_t verbose );
207 void SetAlignmentResolution( const TClonesArray* misAlignArray, Int_t chId, Double_t chResX, Double_t chResY, Double_t deResX, Double_t deResY );
212 AliMUONAlignment(const AliMUONAlignment& right);
215 AliMUONAlignment& operator = (const AliMUONAlignment& right);
217 /// Set array of local derivatives
218 void SetLocalDerivative(Int_t index, Double_t value)
219 { fLocalDerivatives[index] = value; }
221 /// Set array of global derivatives
222 void SetGlobalDerivative(Int_t index, Double_t value)
223 { fGlobalDerivatives[index] = value; }
225 void FillDetElemData( AliMUONVCluster* );
227 void FillRecPointData( AliMUONVCluster* );
229 void FillTrackParamData( AliMUONTrackParam* );
231 Bool_t UnbiasTrackParamData( AliMUONTrackParam* ) const;
233 void LocalEquationX( void );
235 void LocalEquationY( void );
237 TGeoCombiTrans DeltaTransform(const double *detElemMisAlignment) const;
242 void AddConstraint(Double_t* parameters, Double_t value );
244 Int_t GetChamberId( Int_t iDetElemNumber ) const;
246 Bool_t DetElemIsValid( Int_t iDetElemId ) const;
248 Int_t GetDetElemNumber( Int_t iDetElemId ) const;
250 TString GetParameterMaskString( UInt_t parameterMask ) const;
252 TString GetSidesMaskString( UInt_t sidesMask ) const;
256 /// true when initialized
262 /// Flag for Magnetic filed On/Off
265 /// "Encouraged" variation for degrees of freedom
266 Double_t fAllowVar[fgNParCh];
268 /// Initial value for chi2 cut
269 /** if > 1 Iterations in AliMillepede are turned on */
272 /// Cut on residual for first iteration
273 Double_t fResCutInitial;
275 /// Cut on residual for other iterations
278 /// Detector independent alignment class
279 AliMillePede2* fMillepede;
281 /// running AliMUONVCluster
282 AliMUONVCluster* fCluster;
284 /// Number of standard deviations for chi2 cut
287 /// Cluster (global) position
288 Double_t fClustPos[3];
290 /// Track slope at reference point
291 Double_t fTrackSlope0[2];
293 /// Track slope at current point
294 Double_t fTrackSlope[2];
296 /// Track intersection at reference point
297 Double_t fTrackPos0[3];
299 /// Track intersection at current point
300 Double_t fTrackPos[3];
302 /// Current measurement (depend on B field On/Off)
305 /// Estimated resolution on measurement
308 /// degrees of freedom
312 kFreeParId = kFixedParId-1,
316 /// Array of effective degrees of freedom
317 /// it is used to fix detectors, parameters, etc.
318 Int_t fGlobalParameterStatus[fNGlobal];
320 /// Array of global derivatives
321 Double_t fGlobalDerivatives[fNGlobal];
323 /// Array of local derivatives
324 Double_t fLocalDerivatives[fNLocal];
326 /// current detection element number
327 Int_t fDetElemNumber;
332 /// running Track record
333 AliMillePedeRecord fTrackRecord;
335 /// Geometry transformation
336 AliMUONGeometryTransformer *fTransform;
337 TGeoCombiTrans fGeoCombiTransInverse;
339 ClassDef(AliMUONAlignment, 2)