]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDAlignFaker.h
Added a lot of Doxygen documentation
[u/mrichter/AliRoot.git] / FMD / AliFMDAlignFaker.h
1 #ifndef ALIFMDALIGNFAKER_H
2 #define ALIFMDALIGNFAKER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
4  * reserved. 
5  *
6  * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
7  *
8  * See cxx source for full Copyright notice                               
9  */
10
11 //____________________________________________________________________
12 //
13 //  Class to make fake alignration parameters 
14 //
15 #ifndef ROOT_TTask
16 # include <TTask.h>
17 #endif
18 #ifndef ROOT_TVector3
19 # include <TVector3.h>
20 #endif
21 class TClonesArray;
22 class TString;
23
24 /** @class AliFMDAlignFaker 
25     This task creates fake alignment. Which alignment, depends on the
26     bit mask passed to the constructor, or added by `AddAlign'.
27
28     The default is to write all alignment parameters to a local
29     storage @c local://cdb which is a directory in the current
30     directory.
31     @ingroup FMD_util
32 */
33 class AliFMDAlignFaker : public TTask
34 {
35 public:
36   /** What to make alignments for */
37   enum EWhat {
38     /** MAke alignment for sensors */
39     kSensors =  1, 
40     /** Make alignment for half-rings */
41     kHalves
42   };
43   enum {
44     /** All types of alignment */
45     kAll             = (1<<kHalves|1<<kSensors)
46   };
47   /** Constructor 
48       @param mask Bit mask of what to make alignments for 
49       @param geo  File to read geometry from, if needed
50       @param loc  Where to store the result */
51   AliFMDAlignFaker(Int_t mask=kAll, 
52                    const char* geo="geometry.root",
53                    const char* loc="local://cdb");
54   /** Destructor */
55   virtual ~AliFMDAlignFaker() {}
56   /** Add something to make alignment for 
57       @param w Bit of alignment mask */
58   void AddAlign(EWhat w) { SETBIT(fMask, w); }
59   /** Remove something to make alignment for 
60       @param w Bit of alignment mask */
61   void RemoveAlign(EWhat w) { CLRBIT(fMask, w); }
62   /** Set alignment select mask 
63       @param mask Bit mask */
64   void SetAlign(Int_t mask) { fMask = mask; }
65   /** Set the displacement (translation) of sensors.  The displacement
66       is selected random uniformly between the corresponding minimum
67       and maximum. 
68       @param x1 Minimum X displacement (in centimeters)
69       @param y1 Minimum Y displacement (in centimeters)
70       @param z1 Minimum Z displacement (in centimeters)
71       @param x2 Maximum X displacement (in centimeters)
72       @param y2 Maximum Y displacement (in centimeters)
73       @param z2 Maximum Z displacement (in centimeters) */
74   void SetSensorDisplacement(Double_t x1=0,   Double_t y1=0,   Double_t z1=0,
75                              Double_t x2=.01, Double_t y2=.01, Double_t z2=0);
76   /** Set the rotation of sensors.  The displacement is selected
77       random uniformly between the corresponding minimum and maximum.
78       @param x1 Minimum X rotation (in degrees)
79       @param y1 Minimum Y rotation (in degrees)
80       @param z1 Minimum Z rotation (in degrees)
81       @param x2 Maximum X rotation (in degrees)
82       @param y2 Maximum Y rotation (in degrees)
83       @param z2 Maximum Z rotation (in degrees) */
84   void SetSensorRotation(Double_t x1=0,  Double_t y1=0,  Double_t z1=0,
85                          Double_t x2=.5, Double_t y2=.5, Double_t z2=.5);
86   /** Set the displacement (translation) of half-rings.  The
87       displacement is selected random uniformly between the
88       corresponding minimum and maximum.
89       @param x1 Minimum X displacement
90       @param y1 Minimum Y displacement
91       @param z1 Minimum Z displacement
92       @param x2 Maximum X displacement
93       @param y2 Maximum Y displacement
94       @param z2 Maximum Z displacement */
95   void SetHalfDisplacement(Double_t x1=0,   Double_t y1=0,   Double_t z1=0,
96                            Double_t x2=.05, Double_t y2=.05, Double_t z2=.05);
97   /** Set the rotation of half-rings.  The displacement is selected
98       random uniformly between the corresponding minimum and maximum.
99       @param x1 Minimum X rotation (in degrees)
100       @param y1 Minimum Y rotation (in degrees)
101       @param z1 Minimum Z rotation (in degrees)
102       @param x2 Maximum X rotation (in degrees)
103       @param y2 Maximum Y rotation (in degrees)
104       @param z2 Maximum Z rotation (in degrees) */
105   void SetHalfRotation(Double_t x1=0, Double_t y1=0, Double_t z1=0,
106                        Double_t x2=0, Double_t y2=0, Double_t z2=0);
107   /** Set the output file name.  Should be a valid CDB URL.
108       @param file CDB URL */
109   void SetOutput(const char* file) { SetTitle(file); }
110   /** Set the file to read the geometry from. 
111       @param file File name */
112   void SetGeometryFile(const char* file) { SetName(file); }
113   /** Make the alignment objects. 
114       @param option Not used. */
115   void Exec(Option_t* option="");
116 protected:
117   /** Make the alignment object for a path
118       @param path   Node path.
119       @param volID  Volume identifier 
120       @param transX Translation in X
121       @param transY Translation in Y
122       @param transZ Translation in Z
123       @param rotX   Rotation around X axis
124       @param rotY   Rotation around Y axis
125       @param rotZ   Rotation around Z axis
126       @return @c true on success */
127   Bool_t MakeAlign(const TString& path, Int_t volID, 
128                    Double_t transX, Double_t transY, Double_t transZ,
129                    Double_t rotX, Double_t rotY, Double_t rotZ);
130   /** Align a sensor 
131       @param path of a sensor 
132       @param id Volume id */
133   Bool_t MakeAlignSensor(const TString& path, Int_t id);
134   /** Align a half-ring
135       @param path of a sensor 
136       @param id Volume id */
137   Bool_t MakeAlignHalf(const TString& path, Int_t id);
138   /** Write to CDB */
139   void   WriteToCDB();
140   /** Write to file */
141   void   WriteToFile();
142   
143   Long_t        fMask;            // What to write 
144   TVector3      fSensorTransMin;  // Minimum translations of a sensor
145   TVector3      fSensorTransMax;  // Maximum translations of a sensor
146   TVector3      fSensorRotMin;    // Minimum rotation of a sensor
147   TVector3      fSensorRotMax;    // Maximum rotation of a sensor
148   TVector3      fHalfTransMin;    // Minimum translations of a half-ring
149   TVector3      fHalfTransMax;    // Maximum translations of a half-ring
150   TVector3      fHalfRotMin;      // Minimum rotation of a half-ring    
151   TVector3      fHalfRotMax;      // Maximum rotation of a half-ring 
152   Int_t         fRunMin;          // Run validity start 
153   Int_t         fRunMax;          // Run validity end
154   TClonesArray* fArray;           // Cache
155   
156   ClassDef(AliFMDAlignFaker,0)
157 };
158
159 #endif
160 //____________________________________________________________________
161 //
162 // Local Variables:
163 //   mode: C++
164 // End:
165 //
166 // EOF
167 //
168