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 void SetAllowedVariation( Int_t iPar, Double_t value );
115 void SetSigmaXY(Double_t sigmaX, Double_t sigmaY);
117 /// Set geometry transformer
118 void SetGeometryTransformer( AliMUONGeometryTransformer * transformer )
119 { fTransform = transformer; }
123 //@name fixing detectors
126 void FixAll( UInt_t parameterMask = ParAll );
128 void FixChamber( Int_t iCh, UInt_t parameterMask = ParAll );
130 void FixDetElem( Int_t iDetElemId, UInt_t parameterMask = ParAll );
132 void FixHalfSpectrometer( const Bool_t* bChOnOff, UInt_t sidesMask = AllSides, UInt_t parameterMask = ParAll );
134 void FixParameter( Int_t iPar );
136 void FixParameter( Int_t iDetElem, Int_t iPar )
137 { FixParameter( iDetElem*fgNParCh + iPar ); }
141 //@name releasing detectors
144 void ReleaseChamber( Int_t iCh, UInt_t parameterMask = ParAll );
146 void ReleaseDetElem( Int_t iDetElemId, UInt_t parameterMask = ParAll );
148 void ReleaseParameter( Int_t iPar );
150 void ReleaseParameter( Int_t iDetElem, Int_t iPar )
151 { ReleaseParameter( iDetElem*fgNParCh + iPar ); }
155 //@name grouping detectors
158 void GroupChamber( Int_t iCh, UInt_t parameterMask = ParAll );
160 void GroupDetElems( Int_t detElemMin, Int_t detElemMax, UInt_t parameterMask = ParAll );
162 void GroupDetElems( Int_t *detElemList, Int_t nDetElem, UInt_t parameterMask = ParAll );
166 //@name define non linearity
169 void SetChamberNonLinear( Int_t iCh, UInt_t parameterMask);
171 void SetDetElemNonLinear( Int_t iSt, UInt_t parameterMask);
173 void SetParameterNonLinear( Int_t iPar );
175 void SetParameterNonLinear( Int_t iDetElem, Int_t iPar )
176 { SetParameterNonLinear( iDetElem*fgNParCh + iPar ); }
183 void AddConstraints( const Bool_t *bChOnOff, UInt_t parameterMask );
185 void AddConstraints( const Bool_t *bChOnOff, const Bool_t *lVarXYT, UInt_t sidesMask = AllSides );
189 /// initialize global parameters to a give set of values
190 void InitGlobalParameters( Double_t *par );
192 /// perform global fit
193 void GlobalFit( Double_t *parameters,Double_t *errors,Double_t *pulls );
195 /// print global parameters
196 void PrintGlobalParameters( void ) const;
198 /// get error on a given parameter
199 Double_t GetParError( Int_t iPar ) const;
201 AliMUONGeometryTransformer* ReAlign( const AliMUONGeometryTransformer * transformer, const double *misAlignments, Bool_t verbose );
203 void SetAlignmentResolution( const TClonesArray* misAlignArray, Int_t chId, Double_t chResX, Double_t chResY, Double_t deResX, Double_t deResY );
208 AliMUONAlignment(const AliMUONAlignment& right);
211 AliMUONAlignment& operator = (const AliMUONAlignment& right);
213 /// Set array of local derivatives
214 void SetLocalDerivative(Int_t index, Double_t value)
215 { fLocalDerivatives[index] = value; }
217 /// Set array of global derivatives
218 void SetGlobalDerivative(Int_t index, Double_t value)
219 { fGlobalDerivatives[index] = value; }
221 void FillDetElemData( AliMUONVCluster* );
223 void FillRecPointData( AliMUONVCluster* );
225 void FillTrackParamData( AliMUONTrackParam* );
227 void LocalEquationX( void );
229 void LocalEquationY( void );
231 TGeoCombiTrans DeltaTransform(const double *detElemMisAlignment) const;
236 void AddConstraint(Double_t* parameters, Double_t value );
238 Int_t GetChamberId( Int_t iDetElemNumber ) const;
240 Bool_t DetElemIsValid( Int_t iDetElemId ) const;
242 Int_t GetDetElemNumber( Int_t iDetElemId ) const;
244 TString GetParameterMaskString( UInt_t parameterMask ) const;
246 TString GetSidesMaskString( UInt_t sidesMask ) const;
250 /// true when initialized
256 /// Flag for Magnetic filed On/Off
259 /// "Encouraged" variation for degrees of freedom
260 Double_t fAllowVar[fgNParCh];
262 /// Initial value for chi2 cut
263 /** if > 1 Iterations in AliMillepede are turned on */
266 /// Cut on residual for first iteration
267 Double_t fResCutInitial;
269 /// Cut on residual for other iterations
272 /// Detector independent alignment class
273 AliMillePede2* fMillepede;
275 /// running AliMUONVCluster
276 AliMUONVCluster* fCluster;
278 /// Number of standard deviations for chi2 cut
281 /// Cluster (global) position
282 Double_t fClustPos[3];
284 /// Track slope at reference point
285 Double_t fTrackSlope0[2];
287 /// Track slope at current point
288 Double_t fTrackSlope[2];
290 /// Track intersection at reference point
291 Double_t fTrackPos0[3];
293 /// Track intersection at current point
294 Double_t fTrackPos[3];
296 /// Current measurement (depend on B field On/Off)
299 /// Estimated resolution on measurement
302 /// degrees of freedom
306 kFreeParId = kFixedParId-1,
310 /// Array of effective degrees of freedom
311 /// it is used to fix detectors, parameters, etc.
312 Int_t fGlobalParameterStatus[fNGlobal];
314 /// Array of global derivatives
315 Double_t fGlobalDerivatives[fNGlobal];
317 /// Array of local derivatives
318 Double_t fLocalDerivatives[fNLocal];
320 /// current detection element number
321 Int_t fDetElemNumber;
323 /// running Track record
324 AliMillePedeRecord fTrackRecord;
326 /// Geometry transformation
327 AliMUONGeometryTransformer *fTransform;
328 TGeoCombiTrans fGeoCombiTransInverse;
330 ClassDef(AliMUONAlignment, 2)