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