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