]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONAlignment.h
Removing leftover return
[u/mrichter/AliRoot.git] / MUON / AliMUONAlignment.h
CommitLineData
010eb601 1#ifndef ALIMUONALIGNMENT_H
2#define ALIMUONALIGNMENT_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
516043cd 4* See cxx source for full Copyright notice */
010eb601 5
516043cd 6/* $Id: AliMUONAlignment.h 50858 2011-07-29 10:58:20Z ivana $ */
010eb601 7
8/// \ingroup rec
9/// \class AliMUONAlignment
10/// \brief Class for alignment of muon spectrometer
11//
516043cd 12// Authors: Bruce Becker, Javier Castillo, Hugo Pereira Da Costa
13
14#include "AliMillePedeRecord.h"
010eb601 15
16#include <TObject.h>
723b0b5b 17#include <TString.h>
516043cd 18#include <TGeoMatrix.h>
010eb601 19
010eb601 20class TClonesArray;
516043cd 21class AliMillePede2;
010eb601 22class AliMUONGeometryTransformer;
23class AliMUONTrack;
24class AliMUONTrackParam;
96ebe67e 25class AliMUONVCluster;
010eb601 26
27class AliMUONAlignment:public TObject
28{
29
56218672 30 public:
31
010eb601 32 AliMUONAlignment();
56218672 33
010eb601 34 virtual ~AliMUONAlignment();
35
516043cd 36 void Init( void );
56218672 37
516043cd 38 // array dimendions
39 enum
40 {
41 /// Number tracking stations
42 fgNSt = 5,
56218672 43
516043cd 44 /// Number tracking chambers
45 fgNCh = 10,
56218672 46
516043cd 47 /// Number of tracking modules (4 ch + 6*2 half-ch)
48 fgNTrkMod = 16,
010eb601 49
516043cd 50 /// Total number of detection elements
51 /// (4*2 + 4*2 + 18*2 + 26*2 + 26*2)
52 fgNDetElem = 156,
53
54 /// Number of local parameters
55 fNLocal = 4,
56
57 /// Number of degrees of freedom per chamber
58 fgNParCh = 4,
59
60 /// Number of global parameters
61 fNGlobal = fgNParCh*fgNDetElem
62 };
56218672 63
516043cd 64 /// Number of detection elements per chamber
65 static const Int_t fgNDetElemCh[fgNCh];
66
67 /// Sum of detection elements up to this chamber
68 static const Int_t fgSNDetElemCh[fgNCh+1];
69
70 /// global parameter bit set, used for masks
71 enum ParameterMask
56218672 72 {
516043cd 73 ParX = 1<<0,
74 ParY = 1<<1,
75 ParZ = 1<<2,
76 ParTZ = 1<<3,
77
78 ParAllTranslations = ParX|ParY|ParZ,
79 ParAllRotations = ParTZ,
80 ParAll = ParAllTranslations|ParAllRotations
56218672 81
516043cd 82 };
83
84 /// detector sides bit set, used for selecting sides in constrains
85 enum SidesMask
56218672 86 {
516043cd 87 SideTop = 1<<0,
88 SideLeft = 1<<1,
89 SideBottom = 1<<2,
90 SideRight = 1<<3,
91 SideTopLeft = SideTop|SideLeft,
92 SideTopRight = SideTop|SideRight,
93 SideBottomLeft = SideBottom|SideLeft,
94 SideBottomRight = SideBottom|SideRight,
95 AllSides = SideTop|SideBottom|SideLeft|SideRight
96 };
56218672 97
516043cd 98 AliMillePedeRecord* ProcessTrack( AliMUONTrack* track, Bool_t doAlignment, Double_t weight = 1 );
56218672 99
516043cd 100 void ProcessTrack( AliMillePedeRecord* );
56218672 101
516043cd 102 //@name modifiers
103 //@{
56218672 104
516043cd 105 /// run number
106 void SetRunNumber( Int_t id )
107 {fRunNumber = id;}
56218672 108
516043cd 109 /// Set flag for Magnetic field On/Off
110 void SetBFieldOn( Bool_t value )
111 { fBFieldOn = value; }
56218672 112
516043cd 113 void SetAllowedVariation( Int_t iPar, Double_t value );
56218672 114
516043cd 115 void SetSigmaXY(Double_t sigmaX, Double_t sigmaY);
56218672 116
516043cd 117 /// Set geometry transformer
118 void SetGeometryTransformer( AliMUONGeometryTransformer * transformer )
119 { fTransform = transformer; }
010eb601 120
516043cd 121 //@}
56218672 122
516043cd 123 //@name fixing detectors
124 //@{
56218672 125
516043cd 126 void FixAll( UInt_t parameterMask = ParAll );
56218672 127
516043cd 128 void FixChamber( Int_t iCh, UInt_t parameterMask = ParAll );
56218672 129
516043cd 130 void FixDetElem( Int_t iDetElemId, UInt_t parameterMask = ParAll );
56218672 131
516043cd 132 void FixHalfSpectrometer( const Bool_t* bChOnOff, UInt_t sidesMask = AllSides, UInt_t parameterMask = ParAll );
56218672 133
516043cd 134 void FixParameter( Int_t iPar );
135
136 void FixParameter( Int_t iDetElem, Int_t iPar )
137 { FixParameter( iDetElem*fgNParCh + iPar ); }
138
139 //@}
140
141 //@name releasing detectors
142 //@{
143
144 void ReleaseChamber( Int_t iCh, UInt_t parameterMask = ParAll );
145
146 void ReleaseDetElem( Int_t iDetElemId, UInt_t parameterMask = ParAll );
147
148 void ReleaseParameter( Int_t iPar );
149
150 void ReleaseParameter( Int_t iDetElem, Int_t iPar )
151 { ReleaseParameter( iDetElem*fgNParCh + iPar ); }
152
153 //@}
154
155 //@name grouping detectors
156 //@{
157
158 void GroupChamber( Int_t iCh, UInt_t parameterMask = ParAll );
159
160 void GroupDetElems( Int_t detElemMin, Int_t detElemMax, UInt_t parameterMask = ParAll );
161
162 void GroupDetElems( Int_t *detElemList, Int_t nDetElem, UInt_t parameterMask = ParAll );
163
164 //@}
165
166 //@name define non linearity
167 //@{
56218672 168
516043cd 169 void SetChamberNonLinear( Int_t iCh, UInt_t parameterMask);
56218672 170
516043cd 171 void SetDetElemNonLinear( Int_t iSt, UInt_t parameterMask);
56218672 172
516043cd 173 void SetParameterNonLinear( Int_t iPar );
56218672 174
516043cd 175 void SetParameterNonLinear( Int_t iDetElem, Int_t iPar )
176 { SetParameterNonLinear( iDetElem*fgNParCh + iPar ); }
56218672 177
516043cd 178 //@}
010eb601 179
516043cd 180 //@name constraints
181 //@{
182
183 void AddConstraints( const Bool_t *bChOnOff, UInt_t parameterMask );
184
185 void AddConstraints( const Bool_t *bChOnOff, const Bool_t *lVarXYT, UInt_t sidesMask = AllSides );
186
187 //@}
188
189 /// initialize global parameters to a give set of values
190 void InitGlobalParameters( Double_t *par );
191
192 /// perform global fit
193 void GlobalFit( Double_t *parameters,Double_t *errors,Double_t *pulls );
194
195 /// print global parameters
196 void PrintGlobalParameters( void ) const;
197
198 /// get error on a given parameter
199 Double_t GetParError( Int_t iPar ) const;
200
201 AliMUONGeometryTransformer* ReAlign( const AliMUONGeometryTransformer * transformer, const double *misAlignments, Bool_t verbose );
202
203 void SetAlignmentResolution( const TClonesArray* misAlignArray, Int_t chId, Double_t chResX, Double_t chResY, Double_t deResX, Double_t deResY );
4818a9b7 204
56218672 205 private:
206
c4ee792d 207 /// Not implemented
010eb601 208 AliMUONAlignment(const AliMUONAlignment& right);
56218672 209
c4ee792d 210 /// Not implemented
010eb601 211 AliMUONAlignment& operator = (const AliMUONAlignment& right);
010eb601 212
516043cd 213 /// Set array of local derivatives
214 void SetLocalDerivative(Int_t index, Double_t value)
215 { fLocalDerivatives[index] = value; }
216
217 /// Set array of global derivatives
218 void SetGlobalDerivative(Int_t index, Double_t value)
219 { fGlobalDerivatives[index] = value; }
220
221 void FillDetElemData( AliMUONVCluster* );
222
223 void FillRecPointData( AliMUONVCluster* );
56218672 224
516043cd 225 void FillTrackParamData( AliMUONTrackParam* );
56218672 226
516043cd 227 void LocalEquationX( void );
56218672 228
516043cd 229 void LocalEquationY( void );
56218672 230
516043cd 231 TGeoCombiTrans DeltaTransform(const double *detElemMisAlignment) const;
56218672 232
516043cd 233 ///@name utilities
234 //@{
56218672 235
516043cd 236 void AddConstraint(Double_t* parameters, Double_t value );
56218672 237
516043cd 238 Int_t GetChamberId( Int_t iDetElemNumber ) const;
56218672 239
516043cd 240 Bool_t DetElemIsValid( Int_t iDetElemId ) const;
56218672 241
516043cd 242 Int_t GetDetElemNumber( Int_t iDetElemId ) const;
56218672 243
516043cd 244 TString GetParameterMaskString( UInt_t parameterMask ) const;
010eb601 245
516043cd 246 TString GetSidesMaskString( UInt_t sidesMask ) const;
010eb601 247
516043cd 248 //@}
56218672 249
516043cd 250 /// true when initialized
251 Bool_t fInitialized;
56218672 252
516043cd 253 /// current run id
254 Int_t fRunNumber;
56218672 255
516043cd 256 /// Flag for Magnetic filed On/Off
257 Bool_t fBFieldOn;
56218672 258
516043cd 259 /// "Encouraged" variation for degrees of freedom
260 Double_t fAllowVar[fgNParCh];
56218672 261
516043cd 262 /// Initial value for chi2 cut
56218672 263 /** if > 1 Iterations in AliMillepede are turned on */
516043cd 264 Double_t fStartFac;
265
266 /// Cut on residual for first iteration
267 Double_t fResCutInitial;
268
269 /// Cut on residual for other iterations
270 Double_t fResCut;
271
272 /// Detector independent alignment class
273 AliMillePede2* fMillepede;
274
275 /// running AliMUONVCluster
276 AliMUONVCluster* fCluster;
277
278 /// Number of standard deviations for chi2 cut
279 Int_t fNStdDev;
280
281 /// Cluster (global) position
282 Double_t fClustPos[3];
283
284 /// Track slope at reference point
285 Double_t fTrackSlope0[2];
286
287 /// Track slope at current point
288 Double_t fTrackSlope[2];
289
290 /// Track intersection at reference point
291 Double_t fTrackPos0[3];
292
293 /// Track intersection at current point
294 Double_t fTrackPos[3];
295
296 /// Current measurement (depend on B field On/Off)
297 Double_t fMeas[2];
298
299 /// Estimated resolution on measurement
300 Double_t fSigma[2];
301
302 /// degrees of freedom
303 enum
304 {
305 kFixedParId = -1,
306 kFreeParId = kFixedParId-1,
307 kGroupBaseId = -10
308 };
309
310 /// Array of effective degrees of freedom
311 /// it is used to fix detectors, parameters, etc.
312 Int_t fGlobalParameterStatus[fNGlobal];
313
314 /// Array of global derivatives
315 Double_t fGlobalDerivatives[fNGlobal];
316
317 /// Array of local derivatives
318 Double_t fLocalDerivatives[fNLocal];
319
320 /// current detection element number
321 Int_t fDetElemNumber;
322
516043cd 323 /// running Track record
324 AliMillePedeRecord fTrackRecord;
325
326 /// Geometry transformation
327 AliMUONGeometryTransformer *fTransform;
328 TGeoCombiTrans fGeoCombiTransInverse;
010eb601 329
56218672 330 ClassDef(AliMUONAlignment, 2)
331
69d7ac2e 332};
010eb601 333
334#endif