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