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