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