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