]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONAlignment.h
New developments of the analysis framework - selectorised version of the manager...
[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
16 class TGeoCombiTrans;
17 class TClonesArray;
18 class AliMillepede;
19 class AliMUONGeometryTransformer;
20 class AliMUONTrack;
21 class AliMUONTrackParam;
22 class AliMUONHitForRec;
23
24 class AliMUONAlignment:public TObject
25 {
26
27 public:
28   AliMUONAlignment();
29   virtual ~AliMUONAlignment();
30
31   void ProcessTrack(AliMUONTrack *track);
32   void SetGeometryTransformer(AliMUONGeometryTransformer * transformer) {
33     fTransform = transformer;
34   }
35
36   void FixStation(Int_t iSt);
37   void AllowVariations(Bool_t *bStOnOff);
38   void SetNonLinear(Bool_t *bStOnOff, Bool_t *bVarXYT);
39   void AddConstraints(Bool_t *bStOnOff, Bool_t *bVarXYT);
40   void AddConstraints(Bool_t *bStOnOff, Bool_t *bVarXYT, Bool_t *bDetTLBR);
41   void ResetConstraints();
42
43   void FixParameter(Int_t param, Double_t value);
44   void SetNonLinear(Int_t param);
45   void AddConstraint(Double_t *factor, Double_t value );
46   void InitGlobalParameters(Double_t *par);   
47   void SetLocalDerivative(Int_t index, Double_t value) {      
48     fLocalDerivatives[index] = value;
49   }
50   void SetGlobalDerivative(Int_t index, Double_t value) {
51     fGlobalDerivatives[index] = value;
52   }  
53   void LocalFit(Int_t iTrack, Double_t *lTrackParam, Int_t lSingleFit);
54   void GlobalFit(Double_t *parameters,Double_t *errors,Double_t *pulls);
55   void PrintGlobalParameters();
56   Double_t GetParError(Int_t iPar);
57   
58   AliMUONGeometryTransformer* 
59     ReAlign(const AliMUONGeometryTransformer * transformer, double *misAlignments, Bool_t verbose);
60
61  protected:
62   AliMUONAlignment(const AliMUONAlignment& right);
63   AliMUONAlignment&  operator = (const AliMUONAlignment& right);
64  
65   
66  private:
67
68   void Init(Int_t nGlobal, Int_t nLocal, Int_t nStdDev);
69   void ConstrainT(Int_t lDetElem, Int_t lCh, Double_t *lConstraintT, Int_t iVar);
70   void ConstrainL(Int_t lDetElem, Int_t lCh, Double_t *lConstraintL, Int_t iVar);
71   void ConstrainB(Int_t lDetElem, Int_t lCh, Double_t *lConstraintB, Int_t iVar);
72   void ConstrainR(Int_t lDetElem, Int_t lCh, Double_t *lConstraintR, Int_t iVar);
73   void FillDetElemData();
74   void FillRecPointData();
75   void FillTrackParamData();
76   void ResetLocalEquation();
77   void LocalEquationX();
78   void LocalEquationY();
79
80   TGeoCombiTrans ReAlign(const TGeoCombiTrans& transform, double *detElemMisAlignment) const;
81
82   Bool_t fBFieldOn;        // Flag for Magnetic filed On/Off
83                                                                        
84   Bool_t fDoF[3];          // Flags degrees of freedom to align (x,y,phi)
85   Double_t fAllowVar[3];   // "Encouraged" variation for degrees of freedom 
86   Double_t fStartFac;      // Initial value for chi2 cut 
87                            // if > 1 Iterations in AliMillepede are turned on
88   Double_t fResCutInitial; // Cut on residual for first iteration
89   Double_t fResCut;        // Cut on residual for other iterations 
90
91   AliMillepede *fMillepede; // Detector independent alignment class
92   
93   TClonesArray *fTrackParamAtHit; // Array of track parameters 
94   TClonesArray *fHitForRecAtHit;  // Array of track hits 
95   AliMUONTrack *fTrack;           // AliMUONTrack 
96   AliMUONHitForRec *fRecHit;      // AliMUONHitForRec
97   AliMUONTrackParam *fTrackParam; // Track parameters 
98
99   Int_t fNGlobal;  // Number of global parameters
100   Int_t fNLocal;   // Number of local parameters
101   Int_t fNStdDev;  // Number of standard deviations for chi2 cut
102   Double_t fClustPos[3];    // Cluster position
103   Double_t fClustPosLoc[3]; // Cluster position in local coordinates
104   Double_t fTrackSlope0[2]; // Track slope at reference point
105   Double_t fTrackSlope[2];  // Track slope at current point
106   Double_t fTrackPos0[3];   // Track intersection at reference point
107   Double_t fTrackPos[3];    // Track intersection at current point
108   Double_t fTrackPosLoc[3]; // Track intersection at current point in local coordinates 
109   Double_t fMeas[2];        // Current measurement (depend on B field On/Off)  
110   Double_t fSigma[2];       // Estimated resolution on measurement
111
112   Double_t fGlobalDerivatives[468]; // Array of global derivatives
113   Double_t fLocalDerivatives[4];    // Array of local derivatives
114
115   Double_t fConstraintX[468];   // Array for constraint equation all X
116   Double_t fConstraintY[468];   // Array for constraint equation all Y
117   Double_t fConstraintP[468];   // Array for constraint equation all P
118   Double_t fConstraintXT[468];  // Array for constraint equation X Top half
119   Double_t fConstraintYT[468];  // Array for constraint equation Y Top half
120   Double_t fConstraintPT[468];  // Array for constraint equation P Top half
121   Double_t fConstraintXB[468];  // Array for constraint equation X Bottom half
122   Double_t fConstraintYB[468];  // Array for constraint equation Y Bottom half
123   Double_t fConstraintPB[468];  // Array for constraint equation P Bottom half
124   Double_t fConstraintXR[468];  // Array for constraint equation X Right half
125   Double_t fConstraintYR[468];  // Array for constraint equation Y Right half
126   Double_t fConstraintPR[468];  // Array for constraint equation P Right half
127   Double_t fConstraintXL[468];  // Array for constraint equation X Left half
128   Double_t fConstraintYL[468];  // Array for constraint equation Y Left half
129   Double_t fConstraintPL[468];  // Array for constraint equation P Left half
130   Double_t fConstraintX3[468];  // Array for constraint equation St3 X
131   Double_t fConstraintY3[468];  // Array for constraint equation St3 Y
132   Double_t fConstraintX4[468];  // Array for constraint equation St4 X
133   Double_t fConstraintY4[468];  // Array for constraint equation St4 Y
134   Double_t fConstraintP4[468];  // Array for constraint equation St4 P
135   Double_t fConstraintX5[468];  // Array for constraint equation St5 X
136   Double_t fConstraintY5[468];  // Array for constraint equation St5 Y
137
138   Int_t fDetElemId;        // Detection element id
139   Int_t fDetElemNumber;    // Detection element number
140   Double_t fPhi;           // Azimuthal tilt of detection element 
141   Double_t fCosPhi;        // Cosine of fPhi
142   Double_t fSinPhi;        // Sine of fPhi
143   Double_t fDetElemPos[3]; // Position of detection element
144
145   AliMUONGeometryTransformer *fTransform; // Geometry transformation
146
147   static Int_t fgNSt;            // Number tracking stations
148   static Int_t fgNCh;            // Number tracking chambers
149   static Int_t fgNParCh;         // Number of degrees of freedom per chamber
150   static Int_t fgNDetElem;       // Total number of detection elements
151   static Int_t fgNDetElemCh[10]; // Number of detection elements per chamber
152   static Int_t fgSNDetElemCh[10];// Sum of detection elements up to this chamber (inc)
153
154 ClassDef(AliMUONAlignment, 0)};
155
156 #endif