]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSAlignMille.h
AliITSRecoParam retrieved from the OCDB
[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 class AliITSAlignMilleModule;
24
25 // number of used objects
26 #define ITSMILLE_NDETELEM    2198
27 #define ITSMILLE_NPARCH         6
28 #define ITSMILLE_NLOCAL         4
29 #define ITSMILLE_NSTDEV         3       
30
31 class AliITSAlignMille:public TObject
32 {
33
34 public:
35   AliITSAlignMille(const Char_t *configFilename="AliITSAlignMille.conf", Bool_t initmille=kTRUE);
36   virtual ~AliITSAlignMille();
37   
38   // geometry methods 
39   Int_t  GetModuleIndex(const Char_t *symname);
40   Int_t     GetModuleIndex(UShort_t voluid);
41   UShort_t  GetModuleVolumeID(const Char_t *symname);
42   UShort_t  GetModuleVolumeID(Int_t index);
43   void      SetCurrentModule(Int_t index); 
44   void      SetCurrentSensitiveModule(Int_t index); // set as current the SENSITIVE module with index 'index'
45
46   // configuration methods
47   void      SetGeometryFileName(const Char_t* filename="geometry.root") 
48     { fGeometryFileName = filename; }
49   const Char_t* GetGeometryFileName() {return fGeometryFileName.Data();}
50   const Char_t* GetPreAlignmentFileName() {return fPreAlignmentFileName.Data();}
51   void      PrintCurrentModuleInfo();
52   void      Print(Option_t*) const;
53   
54   // fitting methods
55   void      SetMinNPtsPerTrack(Int_t pts=3) {fMinNPtsPerTrack=pts;}
56   Int_t     ProcessTrack(AliTrackPointArray *track);
57   void      InitTrackParams(int meth=1);
58   Int_t     InitModuleParams();
59   Int_t     CheckCurrentTrack();
60   Bool_t    CheckVolumeID(UShort_t voluid) const; // checks voluid for sensitive volumes
61   Int_t     IsDefined(UShort_t voluid) const;
62   Int_t     IsContained(UShort_t voluid) const;
63   Int_t     CalcIntersectionPoint(Double_t *lpar, Double_t *gpar);
64   Int_t     CalcDerivatives(Int_t paridx, Bool_t islpar);
65   Double_t* GetLocalIntersectionPoint() {return fPintLoc;}
66   Double_t* GetGlobalIntersectionPoint() {return fPintGlo;}
67   void      SetInitTrackParamsMeth(Int_t meth=1) {fInitTrackParamsMeth=meth;}
68
69   // millepede methods
70   void      FixParameter(Int_t param, Double_t value);
71   void      AddConstraint(Double_t *factor, Double_t value );
72   void      InitGlobalParameters(Double_t *par);   
73   void      SetLocalDerivative(Int_t index, Double_t value) 
74     {fLocalDerivatives[index] = value;}
75   void      SetGlobalDerivative(Int_t index, Double_t value) 
76     {fGlobalDerivatives[index] = value;}  
77   void      LocalFit(Int_t iTrack, Double_t *lTrackParam, Int_t lSingleFit);
78   void      GlobalFit(Double_t *parameters,Double_t *errors,Double_t *pulls);
79   void      PrintGlobalParameters();
80   Double_t  GetParError(Int_t iPar);
81   Int_t     SetLocalEquations();
82   
83   // fitting stuffs
84   AliTrackPointArray *GetCurrentTrack() {return fTrack;}
85   AliTrackPoint      *GetCurrentCluster() {return &fCluster;}
86
87   // geometry stuffs
88   Int_t  GetNModules() const {return fNModules;}
89   Int_t  GetCurrentModuleIndex() const {return fCurrentModuleIndex;}
90   TGeoHMatrix *GetCurrentModuleHMatrix() {return fCurrentModuleHMatrix;}
91   Double_t    *GetCurrentModuleTranslation() {return fCurrentModuleTranslation;}
92   Int_t  GetCurrentModuleInternalIndex() const {return fCurrentModuleInternalIndex;}
93   Int_t       *GetModuleIndexArray() {return fModuleIndex;}
94   AliITSAlignMilleModule  *GetMilleModule(UShort_t voluid); // get pointer to the defined supermodule
95   AliITSAlignMilleModule  *GetCurrentModule();
96   UShort_t    *GetModuleVolumeIDArray() {return fModuleVolumeID;}
97   
98  private:
99
100   // configuration methods
101   Int_t     LoadConfig(const Char_t *cfile="AliITSAlignMille.conf");
102   Int_t     LoadSuperModuleFile(const Char_t *cfile="ITSMilleSuperModules.root");
103   void      ResetLocalEquation();
104   void      InitGeometry();
105   Int_t     ApplyToGeometry();
106
107   // millepede methods
108   void      Init(Int_t nGlobal, Int_t nLocal, Int_t nStdDev);
109
110   // millepede stuffs
111   AliMillepede *fMillepede;   ///< Detector independent alignment class
112   static Int_t  fgNParCh;      ///< Number of degrees of freedom per chamber
113   static Int_t  fgNDetElem;    ///< Total number of detection elements
114   Double_t      fStartFac;      ///< Initial value for chi2 cut 
115                               ///< if > 1 Iterations in AliMil. are turned on
116   Double_t      fResCutInitial; ///< Cut on residual for first iteration
117   Double_t      fResCut;        ///< Cut on residual for other iterations 
118   Int_t         fNGlobal;       ///< Number of global parameters
119   Int_t         fNLocal;        ///< Number of local parameters
120   Int_t         fNStdDev;       ///< Number of standard deviations for chi2 cut
121   Bool_t        fIsMilleInit;  ///
122   Double_t      fParSigTranslations; ///< init sigma for transl. params [cm]
123   Double_t      fParSigRotations; ///< init sigma for rot. params [deg]
124
125   // fitting stuffs
126   AliTrackPointArray *fTrack;       ///< pointer to current track 
127   AliTrackPoint fCluster;           ///< current cluster
128   Double_t     *fGlobalDerivatives;   ///< Array of global derivatives
129   Double_t      fLocalDerivatives[ITSMILLE_NLOCAL]; ///< Array of local deriv.
130   Double_t      fLocalInitParam[ITSMILLE_NLOCAL];   ///< Array with inital values for local parameters for current track
131   Double_t      fModuleInitParam[ITSMILLE_NPARCH];  ///< Array with inital values for current module parameters (init geometry)
132   Double_t      fPintLoc[3]; ///
133   Double_t      fPintLoc0[3]; ///
134   Double_t      fPintGlo[3]; ///
135   Double_t      fMeasLoc[3]; // current point local coordinates (the original ones)
136   Double_t      fMeasGlo[3]; // current point glob. coord (AliTrackPoint)
137   Double_t      fSigmaLoc[3]; // stdev current point
138   //TGeoHMatrix  *fTempHMat; ///
139   AliAlignObjParams *fTempAlignObj; ///
140   Double_t      fDerivativeXLoc; // localX deriv.
141   Double_t      fDerivativeZLoc; // localZ deriv.
142   Double_t      fDeltaPar; ///
143   Int_t         fMinNPtsPerTrack; ///
144   Int_t         fInitTrackParamsMeth; ///
145
146   // geometry stuffs
147   TString       fGeometryFileName;  ///
148   TString       fPreAlignmentFileName;  ///
149   TGeoManager  *fGeoManager;        ///
150   Int_t         fCurrentModuleIndex;   /// SuperModule index
151   Int_t         fCurrentModuleInternalIndex;  /// SuperModule internal index
152   Int_t         fCurrentSensVolIndex;   /// Current point (sens. vol.) index
153   Double_t      fCurrentModuleTranslation[3]; ///
154   Int_t         fNModules;  /// number of defined modules from config file
155   Int_t         fModuleIndex[ITSMILLE_NDETELEM*2]; ///
156   UShort_t      fModuleVolumeID[ITSMILLE_NDETELEM*2];  ///
157   Bool_t        fFreeParam[ITSMILLE_NDETELEM*2][ITSMILLE_NPARCH];  ///
158   Bool_t        fUseLocalShifts; /// 
159   Bool_t        fUseSuperModules; /// 
160   Bool_t        fUsePreAlignment; /// 
161   Int_t         fNSuperModules; /// number of custom supermodules in SM file
162   TGeoHMatrix  *fCurrentModuleHMatrix; /// SuperModule matrix
163
164   AliITSAlignMilleModule *fMilleModule[ITSMILLE_NDETELEM*2]; /// array of super modules to be aligned
165
166   AliITSAlignMilleModule *fSuperModule[ITSMILLE_NDETELEM*2]; /// array of super modules defined in supermodule file
167
168   AliITSAlignMille(const AliITSAlignMille& rhs);
169   AliITSAlignMille& operator=(const AliITSAlignMille& rhs);
170
171
172   ClassDef(AliITSAlignMille, 0)
173
174 };
175
176 #endif