Some changes to make it possible to run the DA's
[u/mrichter/AliRoot.git] / FMD / AliFMDSurveyToAlignObjs.h
CommitLineData
b2e6f0b0 1#ifndef ALIFMDSURVEYTOALIGNOBJS_H
2#define ALIFMDSURVEYTOALIGNOBJS_H
3#include <AliSurveyToAlignObjs.h>
f567c3ce 4#include <TGeoMatrix.h>
b2e6f0b0 5
6// Forward decl
7class TVector3;
f567c3ce 8class TGeoMatrix;
4c01505b 9class AliAlignObjParams;
b2e6f0b0 10
f567c3ce 11/**
12 * Class to take survey data and transform that to alignment objects.
13 *
14 */
b2e6f0b0 15class AliFMDSurveyToAlignObjs : public AliSurveyToAlignObjs
16{
17public:
f567c3ce 18 /**
19 * Constructor
20 *
21 */
638bc5af 22 AliFMDSurveyToAlignObjs() : AliSurveyToAlignObjs(),
23 fFMD1Delta(0),
24 fFMD2Delta(0) {}
f567c3ce 25 /**
26 * Run the task.
27 *
28 */
b2e6f0b0 29 void Run();
4c01505b 30 void Run(const char** files);
f567c3ce 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 TClonesArray* GetAlignObjArray() const { return fAlignObjArray; }
41
b2e6f0b0 42protected:
f567c3ce 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 */
faf80567 60 Bool_t DoFMD1();
f567c3ce 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 */
faf80567 69 Bool_t GetFMD1Plane(Double_t* rot, Double_t* trans) const;
f567c3ce 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 */
b2e6f0b0 92 Bool_t DoFMD2();
f567c3ce 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 */
faf80567 103 Bool_t GetFMD2Plane(Double_t* rot, Double_t* trans) const;
f567c3ce 104 /**
105 * Get the factor to translate current coordinates to the canonical
106 * unit (centi-meters).
107 *
108 * @return Conversion factor
109 */
faf80567 110 Double_t GetUnitFactor() const;
f567c3ce 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 */
faf80567 120 Bool_t GetPoint(const char* name, TVector3& p, TVector3& e) const;
f567c3ce 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 */
faf80567 132 Bool_t CalculatePlane(const TVector3& a,
133 const TVector3& b,
f567c3ce 134 const TVector3& c,
135 Double_t depth,
faf80567 136 Double_t* trans,
137 Double_t* rot) const;
f567c3ce 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 */
09b6c804 169 Bool_t MakeDelta(const TGeoMatrix* global,
170 const Double_t* rot,
171 const Double_t* trans,
f567c3ce 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,
09b6c804 185 const Double_t* rot,
186 const Double_t* trans,
f567c3ce 187 TGeoHMatrix& delta) const;
188 /**
4c01505b 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 /**
f567c3ce 213 * Service member function to print a vector
214 *
215 * @param text Prefix text
216 * @param v Vector (array of 3 doubles)
217 */
b2e6f0b0 218 static void PrintVector(const char* text, const Double_t* v);
f567c3ce 219 /**
220 * Service member function to print a vector
221 *
222 * @param text Prefix text
223 * @param v Vector
224 */
b2e6f0b0 225 static void PrintVector(const char* text, const TVector3& v);
f567c3ce 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 */
b2e6f0b0 232 static void PrintRotation(const char* text, const Double_t* rot);
233
f567c3ce 234 TGeoHMatrix fFMD1Delta; // FMD1 delta transform
235 TGeoHMatrix fFMD2Delta; // FMD2 delta transform
b2e6f0b0 236
237 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