]>
Commit | Line | Data |
---|---|---|
483fd7d8 | 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> | |
d3603b4d | 17 | #include <TArray.h> |
483fd7d8 | 18 | #include "AliTrackPointArray.h" |
19 | ||
20 | class AliMillepede; | |
21 | class AliAlignObjParams; | |
22 | class TGeoManager; | |
23 | class TGeoHMatrix; | |
0856765c | 24 | class AliITSAlignMilleModule; |
d3603b4d | 25 | class AliTrackFitterRieman; |
483fd7d8 | 26 | |
27 | // number of used objects | |
28 | #define ITSMILLE_NDETELEM 2198 | |
29 | #define ITSMILLE_NPARCH 6 | |
d3603b4d | 30 | #define ITSMILLE_NLOCAL 5 |
483fd7d8 | 31 | #define ITSMILLE_NSTDEV 3 |
32 | ||
d3603b4d | 33 | |
34 | struct MilleData { | |
35 | /// structure to store data for 2 LocalEquations (X and Z) | |
36 | Double_t measX; | |
37 | Double_t sigmaX; | |
38 | Int_t idxlocX[ITSMILLE_NLOCAL]; | |
39 | Double_t derlocX[ITSMILLE_NLOCAL]; | |
40 | Int_t idxgloX[ITSMILLE_NPARCH]; | |
41 | Double_t dergloX[ITSMILLE_NPARCH]; | |
42 | ||
43 | Double_t measZ; | |
44 | Double_t sigmaZ; | |
45 | Int_t idxlocZ[ITSMILLE_NLOCAL]; | |
46 | Double_t derlocZ[ITSMILLE_NLOCAL]; | |
47 | Int_t idxgloZ[ITSMILLE_NPARCH]; | |
48 | Double_t dergloZ[ITSMILLE_NPARCH]; | |
49 | }; | |
50 | ||
483fd7d8 | 51 | class AliITSAlignMille:public TObject |
52 | { | |
483fd7d8 | 53 | public: |
54 | AliITSAlignMille(const Char_t *configFilename="AliITSAlignMille.conf", Bool_t initmille=kTRUE); | |
55 | virtual ~AliITSAlignMille(); | |
56 | ||
57 | // geometry methods | |
d3603b4d | 58 | Int_t GetModuleIndex(const Char_t *symname); |
483fd7d8 | 59 | Int_t GetModuleIndex(UShort_t voluid); |
60 | UShort_t GetModuleVolumeID(const Char_t *symname); | |
61 | UShort_t GetModuleVolumeID(Int_t index); | |
0856765c | 62 | void SetCurrentModule(Int_t index); |
63 | void SetCurrentSensitiveModule(Int_t index); // set as current the SENSITIVE module with index 'index' | |
483fd7d8 | 64 | |
65 | // configuration methods | |
66 | void SetGeometryFileName(const Char_t* filename="geometry.root") | |
67 | { fGeometryFileName = filename; } | |
68 | const Char_t* GetGeometryFileName() {return fGeometryFileName.Data();} | |
0856765c | 69 | const Char_t* GetPreAlignmentFileName() {return fPreAlignmentFileName.Data();} |
483fd7d8 | 70 | void PrintCurrentModuleInfo(); |
0856765c | 71 | void Print(Option_t*) const; |
d3603b4d | 72 | Bool_t IsConfigured() const {return fIsConfigured;} |
73 | void SetRequiredPoint(Char_t* where, Int_t ndet, Int_t updw, Int_t nreqpts); | |
483fd7d8 | 74 | |
75 | // fitting methods | |
76 | void SetMinNPtsPerTrack(Int_t pts=3) {fMinNPtsPerTrack=pts;} | |
483fd7d8 | 77 | Int_t ProcessTrack(AliTrackPointArray *track); |
d3603b4d | 78 | AliTrackPointArray *PrepareTrack(AliTrackPointArray *track); // build a new AliTrackPointArray with selected conditions |
483fd7d8 | 79 | void InitTrackParams(int meth=1); |
d3603b4d | 80 | Bool_t InitRiemanFit(); |
81 | AliTrackFitterRieman *GetRiemanFitter() const {return fRieman;} | |
483fd7d8 | 82 | Int_t InitModuleParams(); |
83 | Int_t CheckCurrentTrack(); | |
0856765c | 84 | Bool_t CheckVolumeID(UShort_t voluid) const; // checks voluid for sensitive volumes |
85 | Int_t IsDefined(UShort_t voluid) const; | |
86 | Int_t IsContained(UShort_t voluid) const; | |
483fd7d8 | 87 | Int_t CalcIntersectionPoint(Double_t *lpar, Double_t *gpar); |
88 | Int_t CalcDerivatives(Int_t paridx, Bool_t islpar); | |
89 | Double_t* GetLocalIntersectionPoint() {return fPintLoc;} | |
90 | Double_t* GetGlobalIntersectionPoint() {return fPintGlo;} | |
0856765c | 91 | void SetInitTrackParamsMeth(Int_t meth=1) {fInitTrackParamsMeth=meth;} |
d3603b4d | 92 | AliTrackPointArray *SortTrack(AliTrackPointArray *atp); |
93 | void SetTemporaryExcludedModule(Int_t index) {fTempExcludedModule=index;} | |
483fd7d8 | 94 | |
95 | // millepede methods | |
96 | void FixParameter(Int_t param, Double_t value); | |
97 | void AddConstraint(Double_t *factor, Double_t value ); | |
98 | void InitGlobalParameters(Double_t *par); | |
99 | void SetLocalDerivative(Int_t index, Double_t value) | |
100 | {fLocalDerivatives[index] = value;} | |
101 | void SetGlobalDerivative(Int_t index, Double_t value) | |
102 | {fGlobalDerivatives[index] = value;} | |
103 | void LocalFit(Int_t iTrack, Double_t *lTrackParam, Int_t lSingleFit); | |
104 | void GlobalFit(Double_t *parameters,Double_t *errors,Double_t *pulls); | |
105 | void PrintGlobalParameters(); | |
106 | Double_t GetParError(Int_t iPar); | |
d3603b4d | 107 | Int_t AddLocalEquation(MilleData &m); |
108 | void SetLocalEquations(MilleData *m, Int_t neq); | |
483fd7d8 | 109 | |
110 | // fitting stuffs | |
111 | AliTrackPointArray *GetCurrentTrack() {return fTrack;} | |
112 | AliTrackPoint *GetCurrentCluster() {return &fCluster;} | |
d3603b4d | 113 | void SetCurrentTrack(AliTrackPointArray *atp) {fTrack=atp;} |
114 | void SetCurrentCluster(AliTrackPoint &atp) {fCluster=atp;} | |
483fd7d8 | 115 | |
116 | // geometry stuffs | |
d3603b4d | 117 | Int_t GetNModules() const {return fNModules;} |
118 | Int_t GetCurrentModuleIndex() const {return fCurrentModuleIndex;} | |
483fd7d8 | 119 | TGeoHMatrix *GetCurrentModuleHMatrix() {return fCurrentModuleHMatrix;} |
d3603b4d | 120 | Double_t *GetCurrentModuleTranslation() {return fCurrentModuleTranslation;} |
121 | Int_t GetCurrentModuleInternalIndex() const {return fCurrentModuleInternalIndex;} | |
122 | Int_t *GetModuleIndexArray() {return fModuleIndex;} | |
123 | Int_t *GetProcessedPoints() {return fProcessedPoints;} | |
124 | Int_t GetTotBadLocEqPoints() const {return fTotBadLocEqPoints;} | |
0856765c | 125 | AliITSAlignMilleModule *GetMilleModule(UShort_t voluid); // get pointer to the defined supermodule |
126 | AliITSAlignMilleModule *GetCurrentModule(); | |
d3603b4d | 127 | UShort_t *GetModuleVolumeIDArray() {return fModuleVolumeID;} |
128 | ||
129 | // debug stuffs | |
130 | Double_t *GetMeasLoc() { return fMeasLoc;} | |
131 | Double_t *GetSigmaLoc() { return fSigmaLoc;} | |
132 | Double_t GetBField() const {return fBField;} | |
133 | Double_t *GetLocalInitParam() {return fLocalInitParam;} | |
134 | Double_t GetLocalDX() const {return fDerivativeXLoc;} | |
135 | Double_t GetLocalDZ() const {return fDerivativeZLoc;} | |
136 | Double_t GetParSigTranslations() const {return fParSigTranslations;} | |
137 | Double_t GetParSigRotations() const {return fParSigRotations;} | |
138 | Int_t GetPreAlignmentQualityFactor(Int_t index); // if not prealign. return -1 | |
139 | void SetBug(Int_t bug) {fBug=bug;} // 1:SSD inversion sens.18-19 | |
140 | ||
483fd7d8 | 141 | private: |
142 | ||
143 | // configuration methods | |
144 | Int_t LoadConfig(const Char_t *cfile="AliITSAlignMille.conf"); | |
0856765c | 145 | Int_t LoadSuperModuleFile(const Char_t *cfile="ITSMilleSuperModules.root"); |
483fd7d8 | 146 | void ResetLocalEquation(); |
147 | void InitGeometry(); | |
0856765c | 148 | Int_t ApplyToGeometry(); |
483fd7d8 | 149 | |
150 | // millepede methods | |
151 | void Init(Int_t nGlobal, Int_t nLocal, Int_t nStdDev); | |
152 | ||
153 | // millepede stuffs | |
154 | AliMillepede *fMillepede; ///< Detector independent alignment class | |
155 | static Int_t fgNParCh; ///< Number of degrees of freedom per chamber | |
156 | static Int_t fgNDetElem; ///< Total number of detection elements | |
157 | Double_t fStartFac; ///< Initial value for chi2 cut | |
158 | ///< if > 1 Iterations in AliMil. are turned on | |
159 | Double_t fResCutInitial; ///< Cut on residual for first iteration | |
160 | Double_t fResCut; ///< Cut on residual for other iterations | |
161 | Int_t fNGlobal; ///< Number of global parameters | |
162 | Int_t fNLocal; ///< Number of local parameters | |
163 | Int_t fNStdDev; ///< Number of standard deviations for chi2 cut | |
164 | Bool_t fIsMilleInit; /// | |
165 | Double_t fParSigTranslations; ///< init sigma for transl. params [cm] | |
166 | Double_t fParSigRotations; ///< init sigma for rot. params [deg] | |
167 | ||
168 | // fitting stuffs | |
169 | AliTrackPointArray *fTrack; ///< pointer to current track | |
170 | AliTrackPoint fCluster; ///< current cluster | |
171 | Double_t *fGlobalDerivatives; ///< Array of global derivatives | |
172 | Double_t fLocalDerivatives[ITSMILLE_NLOCAL]; ///< Array of local deriv. | |
173 | Double_t fLocalInitParam[ITSMILLE_NLOCAL]; ///< Array with inital values for local parameters for current track | |
174 | Double_t fModuleInitParam[ITSMILLE_NPARCH]; ///< Array with inital values for current module parameters (init geometry) | |
175 | Double_t fPintLoc[3]; /// | |
176 | Double_t fPintLoc0[3]; /// | |
177 | Double_t fPintGlo[3]; /// | |
178 | Double_t fMeasLoc[3]; // current point local coordinates (the original ones) | |
179 | Double_t fMeasGlo[3]; // current point glob. coord (AliTrackPoint) | |
180 | Double_t fSigmaLoc[3]; // stdev current point | |
d3603b4d | 181 | Double_t fSigmaXfactor; /// |
182 | Double_t fSigmaZfactor; /// | |
483fd7d8 | 183 | AliAlignObjParams *fTempAlignObj; /// |
184 | Double_t fDerivativeXLoc; // localX deriv. | |
185 | Double_t fDerivativeZLoc; // localZ deriv. | |
483fd7d8 | 186 | Int_t fMinNPtsPerTrack; /// |
0856765c | 187 | Int_t fInitTrackParamsMeth; /// |
d3603b4d | 188 | Int_t *fProcessedPoints; /// array of statistics of used points per module |
189 | Int_t fTotBadLocEqPoints; /// total number of reject points because of bad EqLoc | |
190 | AliTrackFitterRieman *fRieman; /// riemann fitter for helices | |
191 | Bool_t fRequirePoints; // required points in specific layers | |
192 | Int_t fNReqLayUp[6]; /// number of points required in layer[n] with Y>0 | |
193 | Int_t fNReqLayDown[6]; /// number of points required in layer[n] with Y<0 | |
194 | Int_t fNReqLay[6]; /// number of points required in layer[n] | |
195 | Int_t fNReqDetUp[3]; /// number of points required in Detector[n] with Y>0 | |
196 | Int_t fNReqDetDown[3]; /// number of points required in Detector[n] with Y<0 | |
197 | Int_t fNReqDet[3]; /// number of points required in Detector[n] | |
198 | Int_t fTempExcludedModule; /// single module temporary excluded from initial fit | |
0856765c | 199 | |
483fd7d8 | 200 | // geometry stuffs |
201 | TString fGeometryFileName; /// | |
0856765c | 202 | TString fPreAlignmentFileName; /// |
483fd7d8 | 203 | TGeoManager *fGeoManager; /// |
0856765c | 204 | Int_t fCurrentModuleIndex; /// SuperModule index |
205 | Int_t fCurrentModuleInternalIndex; /// SuperModule internal index | |
206 | Int_t fCurrentSensVolIndex; /// Current point (sens. vol.) index | |
483fd7d8 | 207 | Double_t fCurrentModuleTranslation[3]; /// |
208 | Int_t fNModules; /// number of defined modules from config file | |
0856765c | 209 | Int_t fModuleIndex[ITSMILLE_NDETELEM*2]; /// |
210 | UShort_t fModuleVolumeID[ITSMILLE_NDETELEM*2]; /// | |
211 | Bool_t fFreeParam[ITSMILLE_NDETELEM*2][ITSMILLE_NPARCH]; /// | |
483fd7d8 | 212 | Bool_t fUseLocalShifts; /// |
0856765c | 213 | Bool_t fUseSuperModules; /// |
214 | Bool_t fUsePreAlignment; /// | |
d3603b4d | 215 | Bool_t fUseSortedTracks; /// default is kTRUE |
216 | Bool_t fBOn; /// magentic field ON | |
217 | Double_t fBField; /// value of magnetic field | |
0856765c | 218 | Int_t fNSuperModules; /// number of custom supermodules in SM file |
219 | TGeoHMatrix *fCurrentModuleHMatrix; /// SuperModule matrix | |
d3603b4d | 220 | Bool_t fIsConfigured; /// |
221 | Int_t fPreAlignQF[ITSMILLE_NDETELEM*2]; /// | |
222 | Double_t fSensVolSigmaXfactor[ITSMILLE_NDETELEM*2]; /// | |
223 | Double_t fSensVolSigmaZfactor[ITSMILLE_NDETELEM*2]; /// | |
224 | Int_t fBug; /// tag for temporary bug correction | |
0856765c | 225 | |
226 | AliITSAlignMilleModule *fMilleModule[ITSMILLE_NDETELEM*2]; /// array of super modules to be aligned | |
227 | ||
228 | AliITSAlignMilleModule *fSuperModule[ITSMILLE_NDETELEM*2]; /// array of super modules defined in supermodule file | |
483fd7d8 | 229 | |
230 | AliITSAlignMille(const AliITSAlignMille& rhs); | |
231 | AliITSAlignMille& operator=(const AliITSAlignMille& rhs); | |
232 | ||
233 | ||
0856765c | 234 | ClassDef(AliITSAlignMille, 0) |
235 | ||
236 | }; | |
483fd7d8 | 237 | |
238 | #endif |