]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSAlignMille.h
Replace FXS fileID from DASSD_DB_results to CALIBRATION for compatibility with the...
[u/mrichter/AliRoot.git] / ITS / AliITSAlignMille.h
1 #ifndef ALIITSALIGNMILLE_H
2 #define ALIITSALIGNMILLE_H
3 /* Copyright(c) 2007-2009 , ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8
9 /// \ingroup rec
10 /// \class AliITSAlignMille
11 /// \brief Class for alignment of ITS
12 //
13 // Authors: Marcello Lunardon
14
15 #include <TString.h>
16 #include <TObject.h>
17 #include "AliTrackPointArray.h"
18
19 class AliMillepede;
20 class AliAlignObjParams;
21 class TGeoManager;
22 class TGeoHMatrix;
23
24 // number of used objects
25 #define ITSMILLE_NDETELEM    2198
26 #define ITSMILLE_NPARCH         6
27 #define ITSMILLE_NLOCAL         4
28 #define ITSMILLE_NSTDEV         3       
29
30 class AliITSAlignMille:public TObject
31 {
32
33 public:
34   AliITSAlignMille(const Char_t *configFilename="AliITSAlignMille.conf", Bool_t initmille=kTRUE);
35   virtual ~AliITSAlignMille();
36   
37   // geometry methods 
38   Int_t     GetModuleIndex(const Char_t *symname);
39   Int_t     GetModuleIndex(UShort_t voluid);
40   UShort_t  GetModuleVolumeID(const Char_t *symname);
41   UShort_t  GetModuleVolumeID(Int_t index);
42   void      SetCurrentModule(Int_t index);
43
44   // configuration methods
45   void      SetGeometryFileName(const Char_t* filename="geometry.root") 
46     { fGeometryFileName = filename; }
47   const Char_t* GetGeometryFileName() {return fGeometryFileName.Data();}
48   void      PrintCurrentModuleInfo();
49   void      Print();
50   
51   // fitting methods
52   void      SetMinNPtsPerTrack(Int_t pts=3) {fMinNPtsPerTrack=pts;}
53   //Bool_t    CheckTrack(AliTrackPointArray *track);
54   Int_t     ProcessTrack(AliTrackPointArray *track);
55   void      InitTrackParams(int meth=1);
56   Int_t     InitModuleParams();
57   Int_t     CheckCurrentTrack();
58   Bool_t    CheckVolumeID(UShort_t voluid) const ;
59   Int_t     CalcIntersectionPoint(Double_t *lpar, Double_t *gpar);
60   Int_t     CalcDerivatives(Int_t paridx, Bool_t islpar);
61   Double_t* GetLocalIntersectionPoint() {return fPintLoc;}
62   Double_t* GetGlobalIntersectionPoint() {return fPintGlo;}
63
64   // millepede methods
65   void      FixParameter(Int_t param, Double_t value);
66   void      AddConstraint(Double_t *factor, Double_t value );
67   void      InitGlobalParameters(Double_t *par);   
68   void      SetLocalDerivative(Int_t index, Double_t value) 
69     {fLocalDerivatives[index] = value;}
70   void      SetGlobalDerivative(Int_t index, Double_t value) 
71     {fGlobalDerivatives[index] = value;}  
72   void      LocalFit(Int_t iTrack, Double_t *lTrackParam, Int_t lSingleFit);
73   void      GlobalFit(Double_t *parameters,Double_t *errors,Double_t *pulls);
74   void      PrintGlobalParameters();
75   Double_t  GetParError(Int_t iPar);
76   Int_t     SetLocalEquations();
77   
78   // fitting stuffs
79   AliTrackPointArray *GetCurrentTrack() {return fTrack;}
80   AliTrackPoint      *GetCurrentCluster() {return &fCluster;}
81
82   // geometry stuffs
83   Int_t  GetNModules() const {return fNModules;}
84   Int_t  GetCurrentModuleIndex() const {return fCurrentModuleIndex;}
85   TGeoHMatrix *GetCurrentModuleHMatrix() {return fCurrentModuleHMatrix;}
86   Double_t    *GetCurrentModuleTranslation() {return fCurrentModuleTranslation;}
87   Int_t  GetCurrentModuleInternalIndex() const {return fCurrentModuleInternalIndex;}
88   Int_t       *GetModuleIndexArray() {return fModuleIndex;}
89   UShort_t    *GetModuleVolumeIDArray() {return fModuleVolumeID;}
90   
91  private:
92
93   // configuration methods
94   Int_t     LoadConfig(const Char_t *cfile="AliITSAlignMille.conf");
95   void      ResetLocalEquation();
96   void      InitGeometry();
97
98   // millepede methods
99   void      Init(Int_t nGlobal, Int_t nLocal, Int_t nStdDev);
100
101   // millepede stuffs
102   AliMillepede *fMillepede;   ///< Detector independent alignment class
103   static Int_t  fgNParCh;      ///< Number of degrees of freedom per chamber
104   static Int_t  fgNDetElem;    ///< Total number of detection elements
105   Double_t      fStartFac;      ///< Initial value for chi2 cut 
106                               ///< if > 1 Iterations in AliMil. are turned on
107   Double_t      fResCutInitial; ///< Cut on residual for first iteration
108   Double_t      fResCut;        ///< Cut on residual for other iterations 
109   Int_t         fNGlobal;       ///< Number of global parameters
110   Int_t         fNLocal;        ///< Number of local parameters
111   Int_t         fNStdDev;       ///< Number of standard deviations for chi2 cut
112   Bool_t        fIsMilleInit;  ///
113   Double_t      fParSigTranslations; ///< init sigma for transl. params [cm]
114   Double_t      fParSigRotations; ///< init sigma for rot. params [deg]
115
116   // fitting stuffs
117   AliTrackPointArray *fTrack;       ///< pointer to current track 
118   AliTrackPoint fCluster;           ///< current cluster
119   Double_t     *fGlobalDerivatives;   ///< Array of global derivatives
120   Double_t      fLocalDerivatives[ITSMILLE_NLOCAL]; ///< Array of local deriv.
121   Double_t      fLocalInitParam[ITSMILLE_NLOCAL];   ///< Array with inital values for local parameters for current track
122   Double_t      fModuleInitParam[ITSMILLE_NPARCH];  ///< Array with inital values for current module parameters (init geometry)
123   Double_t      fPintLoc[3]; ///
124   Double_t      fPintLoc0[3]; ///
125   Double_t      fPintGlo[3]; ///
126   Double_t      fMeasLoc[3]; // current point local coordinates (the original ones)
127   Double_t      fMeasGlo[3]; // current point glob. coord (AliTrackPoint)
128   Double_t      fSigmaLoc[3]; // stdev current point
129   TGeoHMatrix  *fTempHMat; ///
130   AliAlignObjParams *fTempAlignObj; ///
131   Double_t      fDerivativeXLoc; // localX deriv.
132   Double_t      fDerivativeZLoc; // localZ deriv.
133   Double_t      fDeltaPar; ///
134   Int_t         fMinNPtsPerTrack; ///
135   
136   // geometry stuffs
137   TString       fGeometryFileName;  ///
138   TGeoManager  *fGeoManager;        ///
139   Int_t         fCurrentModuleIndex;   ///
140   Int_t         fCurrentModuleInternalIndex;  ///
141   Double_t      fCurrentModuleTranslation[3]; ///
142   Int_t         fNModules;  /// number of defined modules from config file
143   Int_t         fModuleIndex[ITSMILLE_NDETELEM]; ///
144   UShort_t      fModuleVolumeID[ITSMILLE_NDETELEM];  ///
145   Bool_t        fFreeParam[ITSMILLE_NDETELEM][ITSMILLE_NPARCH];  ///
146   Bool_t        fUseLocalShifts; /// 
147   TGeoHMatrix  *fCurrentModuleHMatrix; /// 
148
149   AliITSAlignMille(const AliITSAlignMille& rhs);
150   AliITSAlignMille& operator=(const AliITSAlignMille& rhs);
151
152
153 ClassDef(AliITSAlignMille, 0)};
154
155 #endif