Line data Source code
1 : #ifndef ALIFMDSURVEYTOALIGNOBJS_H
2 : #define ALIFMDSURVEYTOALIGNOBJS_H
3 : #include <AliSurveyToAlignObjs.h>
4 : #include <TGeoMatrix.h>
5 :
6 : // Forward decl
7 : class TVector3;
8 : class TGeoMatrix;
9 : class AliAlignObjParams;
10 :
11 : /**
12 : * Class to take survey data and transform that to alignment objects.
13 : *
14 : */
15 0 : class AliFMDSurveyToAlignObjs : public AliSurveyToAlignObjs
16 : {
17 : public:
18 : /**
19 : * Constructor
20 : *
21 : */
22 0 : AliFMDSurveyToAlignObjs() : AliSurveyToAlignObjs(),
23 0 : fFMD1Delta(0),
24 0 : fFMD2Delta(0) {}
25 : /**
26 : * Run the task.
27 : *
28 : */
29 : void Run();
30 : void Run(const char** files);
31 : /**
32 : *
33 : * Method to create the alignment objects
34 : *
35 : * @return @c true on success, @c false otherwise
36 : */
37 : Bool_t CreateAlignObjs();
38 :
39 :
40 0 : TClonesArray* GetAlignObjArray() const { return fAlignObjArray; }
41 :
42 : protected:
43 : /**
44 : * Do the FMD1 analysis. We have 4 survey targets on V0-A on the
45 : * C-side. These are
46 : *
47 : * - V0A_ICT In-side, C-side, top.
48 : * - V0A_ICB In-side, C-side, bottom.
49 : * - V0A_OCT Out-side, C-side, top.
50 : * - V0A_OCB Out-side, C-side, bottom.
51 : *
52 : * These 4 survey targets sit 3.3mm over the V0-A C-side surface, or
53 : * 3.3mm over the back surface of FMD1.
54 : *
55 : * Since these are really sitting on a plane, we can use the method
56 : * proposed by the CORE offline.
57 : *
58 : * @return @c true on success, @c false otherwise.
59 : */
60 : Bool_t DoFMD1();
61 : /**
62 : * Get the FMD1 plane from the survey points
63 : *
64 : * @param rot Rotation matrix (direction cosines)
65 : * @param trans Translation
66 : *
67 : * @return @c true on success, @c false otherwise.
68 : */
69 : Bool_t GetFMD1Plane(Double_t* rot, Double_t* trans) const;
70 : /**
71 : * Do the FMD2 calculations. We have 6 survey points of which only
72 : * 5 are normally surveyed. These are all sittings
73 : *
74 : * - FMD2_ITOP - In-side, top
75 : * - FMD2_IBOTM - In-side, middle bottom
76 : * - FMD2_IBOT - In-side, bottom
77 : * - FMD2_OTOP - Out-side, top
78 : * - FMD2_OBOTM - Out-side, middle bottom
79 : * - FMD2_OBOT - Out-side, bottom
80 : *
81 : * The nominal coordinates of these retro-fitted survey stickers
82 : * isn't known. Also, these stickers are put on a thin (0.3mm
83 : * thick) carbon cover which flexes quite easily. This means, that
84 : * to rotations and xy-translation obtained from the survey data
85 : * cannot be used, and left is only the z-translation.
86 : *
87 : * Further more, since FMD2 to is attached to the ITS SPD thermal
88 : * screen, it is questionable if the FMD2 survey will ever be used.
89 : *
90 : * @return @c true on success, @c false otherwise.
91 : */
92 : Bool_t DoFMD2();
93 : /**
94 : * Get the surveyed plane corresponding to the backside of FMD2.
95 : * The plane is done as a best fit of the plane equation to at least
96 : * 4 of the available survey points.
97 : *
98 : * @param rot Rotation matrix (direction cosines)
99 : * @param trans Translation vector.
100 : *
101 : * @return @c true on success, @c false otherwise
102 : */
103 : Bool_t GetFMD2Plane(Double_t* rot, Double_t* trans) const;
104 : /**
105 : * Get the factor to translate current coordinates to the canonical
106 : * unit (centi-meters).
107 : *
108 : * @return Conversion factor
109 : */
110 : Double_t GetUnitFactor() const;
111 : /**
112 : * Get the coordinates of a survey point (if available).
113 : *
114 : * @param name Name of the survey point.
115 : * @param p Coordinates.
116 : * @param e Error on the measurement.
117 : *
118 : * @return @c true if the survey data is available, @c false otherwise.
119 : */
120 : Bool_t GetPoint(const char* name, TVector3& p, TVector3& e) const;
121 : /**
122 : * Calculate the plane translation and rotation from 3 survey points
123 : *
124 : * @param a 1st Survey point
125 : * @param b 2nd Survey point
126 : * @param c 3rd Survey point
127 : * @param trans Translation vector
128 : * @param rot Rotation matrix (direction cosines)
129 : *
130 : * @return
131 : */
132 : Bool_t CalculatePlane(const TVector3& a,
133 : const TVector3& b,
134 : const TVector3& c,
135 : Double_t depth,
136 : Double_t* trans,
137 : Double_t* rot) const;
138 : /**
139 : * Calculate the plane rotation and translation by doing a fit of
140 : * the plane equation to the surveyed points. At least 4 points
141 : * must be passed in the @a points array with corresponding errors
142 : * in the array @a errors. The arrays are assumed to contain
143 : * TVector3 objects.
144 : *
145 : * @param points Array surveyed positions
146 : * @param errors Array of errors corresponding to @a points
147 : * @param depth Survey targets depth (perpendicular to the plane)
148 : * @param trans On return, translation of the plane
149 : * @param rot On return, rotation (direction cosines) of the plane
150 : *
151 : * @return @c true on success, @c false otherwise
152 : */
153 : Bool_t FitPlane(const TObjArray& points,
154 : const TObjArray& errors,
155 : Double_t depth,
156 : Double_t* trans,
157 : Double_t* rot) const;
158 : /**
159 : * Create a delta transform from a global rotation matrix and
160 : * translation.
161 : *
162 : * @param global Global matrix of element to transform.
163 : * @param rot Rotation matrix (direction cosines)
164 : * @param trans Translation
165 : * @param delta On return, the delta transform
166 : *
167 : * @return Newly
168 : */
169 : Bool_t MakeDelta(const TGeoMatrix* global,
170 : const Double_t* rot,
171 : const Double_t* trans,
172 : TGeoHMatrix& delta) const;
173 : /**
174 : * Create a delta transform from a global rotation matrix and
175 : * translation.
176 : *
177 : * @param path Path of element to transform.
178 : * @param rot Rotation matrix (direction cosines)
179 : * @param trans Translation
180 : * @param delta On return, the delta transform
181 : *
182 : * @return Newly
183 : */
184 : Bool_t MakeDelta(const char* path,
185 : const Double_t* rot,
186 : const Double_t* trans,
187 : TGeoHMatrix& delta) const;
188 : /**
189 : * Create a default (i.e., no rotation or translation) alignment object.
190 : *
191 : * @param path Path to volume
192 : * @param id Id of volume
193 : *
194 : * @return Created object
195 : */
196 : AliAlignObjParams* CreateDefaultAlignObj(const TString& path, Int_t id=0);
197 : /**
198 : * Check if we have an alignment object for the given path alread
199 : *
200 : * @param path PAth to check
201 : *
202 : * @return Pointer to object if found, otherwise 0
203 : */
204 : AliAlignObjParams* FindAlignObj(const TString& path) const;
205 : /**
206 : * Fill In default alignmen objects
207 : *
208 : * @return true on sucess
209 : */
210 : Bool_t FillDefaultAlignObjs();
211 :
212 : /**
213 : * Service member function to print a vector
214 : *
215 : * @param text Prefix text
216 : * @param v Vector (array of 3 doubles)
217 : */
218 : static void PrintVector(const char* text, const Double_t* v);
219 : /**
220 : * Service member function to print a vector
221 : *
222 : * @param text Prefix text
223 : * @param v Vector
224 : */
225 : static void PrintVector(const char* text, const TVector3& v);
226 : /**
227 : * Service member function to print a rotation matrix
228 : *
229 : * @param text Prefix text
230 : * @param v Matrix (array of 9 doubles)
231 : */
232 : static void PrintRotation(const char* text, const Double_t* rot);
233 :
234 : TGeoHMatrix fFMD1Delta; // FMD1 delta transform
235 : TGeoHMatrix fFMD2Delta; // FMD2 delta transform
236 :
237 12 : ClassDef(AliFMDSurveyToAlignObjs,0) // Convert FMD survey to alignments
238 : };
239 :
240 :
241 : #endif
242 : //____________________________________________________________________
243 : //
244 : // Local Variables:
245 : // mode: C++
246 : // End:
247 : //
248 :
|