]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - FMD/AliFMDAlignFaker.h
sorry fixed now
[u/mrichter/AliRoot.git] / FMD / AliFMDAlignFaker.h
... / ...
CommitLineData
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 * @file AliFMDAlignFaker.h
12 * @author Christian Holm Christensen <cholm@nbi.dk>
13 * @date Sun Mar 26 18:26:39 2006
14 * @brief Make fake alignment
15 */
16//____________________________________________________________________
17//
18// Class
19// to
20// make
21// fake
22// alignment
23// parameters
24//
25#ifndef ROOT_TTask
26# include <TTask.h>
27#endif
28#ifndef ROOT_TVector3
29# include <TVector3.h>
30#endif
31class TClonesArray;
32class TString;
33
34/**
35 * @class AliFMDAlignFaker
36 * @brief This task creates fake alignment.
37 *
38 * Which alignment, depends on the bit mask passed to the
39 * constructor, or added by `AddAlign'.
40 *
41 * The default is to write all alignment parameters to a local
42 * storage @c local://cdb which is a directory in the current
43 * directory.
44 *
45 * @ingroup FMD_util
46 */
47class AliFMDAlignFaker : public TTask
48{
49public:
50 /**
51 * What to make alignments for
52 */
53 enum EWhat {
54 /** MAke alignment for sensors */
55 kSensors = 1,
56 /** Make alignment for half-rings */
57 kHalves
58 };
59 enum {
60 /** All types of alignment */
61 kAll = (1<<kHalves|1<<kSensors)
62 };
63 /**
64 * Constructor
65 @param mask Bit mask of what to make alignments for
66 @param geo File to read geometry from, if needed
67 @param loc Where to store the result
68 */
69 AliFMDAlignFaker(Int_t mask=kAll,
70 const char* geo="geometry.root",
71 const char* loc="");
72 /**
73 * Destructor
74 */
75 virtual ~AliFMDAlignFaker() {}
76 /**
77 * Add something to make alignment for
78 * @param w Bit of alignment mask
79 */
80 void AddAlign(EWhat w) { SETBIT(fMask, w); }
81 /**
82 * Remove something to make alignment for
83 * @param w Bit of alignment mask
84 */
85 void RemoveAlign(EWhat w) { CLRBIT(fMask, w); }
86 /**
87 * Set alignment select mask
88 * @param mask Bit mask
89 */
90 void SetAlign(Int_t mask) { fMask = mask; }
91 /**
92 * Set the displacement (translation) of sensors. The displacement
93 * is selected random uniformly between the corresponding minimum
94 * and maximum.
95 * @param x1 Minimum X displacement (in centimeters)
96 * @param y1 Minimum Y displacement (in centimeters)
97 * @param z1 Minimum Z displacement (in centimeters)
98 * @param x2 Maximum X displacement (in centimeters)
99 * @param y2 Maximum Y displacement (in centimeters)
100 * @param z2 Maximum Z displacement (in centimeters)
101 */
102 void SetSensorDisplacement(Double_t x1=0, Double_t y1=0, Double_t z1=0,
103 Double_t x2=.01, Double_t y2=.01, Double_t z2=0);
104 /**
105 * Set the rotation of sensors. The displacement is selected
106 * random uniformly between the corresponding minimum and maximum.
107 * @param x1 Minimum X rotation (in degrees)
108 * @param y1 Minimum Y rotation (in degrees)
109 * @param z1 Minimum Z rotation (in degrees)
110 * @param x2 Maximum X rotation (in degrees)
111 * @param y2 Maximum Y rotation (in degrees)
112 * @param z2 Maximum Z rotation (in degrees)
113 */
114 void SetSensorRotation(Double_t x1=0, Double_t y1=0, Double_t z1=0,
115 Double_t x2=.5, Double_t y2=.5, Double_t z2=.5);
116 /**
117 * Set the displacement (translation) of half-rings. The
118 * displacement is selected random uniformly between the
119 * corresponding minimum and maximum.
120 * @param x1 Minimum X displacement
121 * @param y1 Minimum Y displacement
122 * @param z1 Minimum Z displacement
123 * @param x2 Maximum X displacement
124 * @param y2 Maximum Y displacement
125 * @param z2 Maximum Z displacement
126 */
127 void SetHalfDisplacement(Double_t x1=0, Double_t y1=0, Double_t z1=0,
128 Double_t x2=.05, Double_t y2=.05, Double_t z2=.05);
129 /**
130 * Set the rotation of half-rings. The displacement is selected
131 * random uniformly between the corresponding minimum and maximum.
132 * @param x1 Minimum X rotation (in degrees)
133 * @param y1 Minimum Y rotation (in degrees)
134 * @param z1 Minimum Z rotation (in degrees)
135 * @param x2 Maximum X rotation (in degrees)
136 * @param y2 Maximum Y rotation (in degrees)
137 * @param z2 Maximum Z rotation (in degrees)
138 */
139 void SetHalfRotation(Double_t x1=0, Double_t y1=0, Double_t z1=0,
140 Double_t x2=0, Double_t y2=0, Double_t z2=0);
141 /**
142 * Set the output file name. Should be a valid CDB URL.
143 * @param file CDB URL
144 */
145 void SetOutput(const char* file) { SetTitle(file); }
146 /**
147 * Set the file to read the geometry from.
148 * @param file File name
149 */
150 void SetGeometryFile(const char* file) { SetName(file); }
151 /**
152 * Set the comment
153 */
154 void SetComment(const Char_t* comment="dummy data") { fComment = comment; }
155 /**
156 * Make the alignment objects.
157 * @param option Not used.
158 */
159 void Exec(Option_t* option="");
160 /**
161 * Get the geometry
162 *
163 * @param toCdb Whether to store in CDB
164 * @param storage Storage element to use
165 *
166 * @return true on success
167 */
168 static Bool_t GetGeometry(Bool_t toCdb=kFALSE,
169 const TString& storage=TString());
170protected:
171 /**
172 * Copy constructor
173 *
174 * @param o Object to copy from
175 */
176 AliFMDAlignFaker(const AliFMDAlignFaker& o)
177 : TTask(o),
178 fMask(0),
179 fSensorTransMin(0,0,0),
180 fSensorTransMax(0,0,0),
181 fSensorRotMin(0,0,0),
182 fSensorRotMax(0,0,0),
183 fHalfTransMin(0,0,0),
184 fHalfTransMax(0,0,0),
185 fHalfRotMin(0,0,0),
186 fHalfRotMax(0,0,0),
187 fRunMin(0),
188 fRunMax(0),
189 fArray(0),
190 fComment("")
191 {}
192 /**
193 * Assignment operator
194 *
195 *
196 * @return Reference to this
197 */
198 AliFMDAlignFaker& operator=(const AliFMDAlignFaker&) { return *this; }
199
200 /**
201 * Make the alignment object for a path
202 * @param path Node path.
203 * @param volID Volume identifier
204 * @param transX Translation in X
205 * @param transY Translation in Y
206 * @param transZ Translation in Z
207 * @param rotX Rotation around X axis
208 * @param rotY Rotation around Y axis
209 * @param rotZ Rotation around Z axis
210 * @return @c true on success
211 */
212 Bool_t MakeAlign(const TString& path, Int_t volID,
213 Double_t transX, Double_t transY, Double_t transZ,
214 Double_t rotX, Double_t rotY, Double_t rotZ);
215 /**
216 * Align a sensor
217 * @param path of a sensor
218 * @param id Volume id
219 */
220 Bool_t MakeAlignSensor(const TString& path, Int_t id);
221 /**
222 * Align a half-ring
223 * @param path of a sensor
224 * @param id Volume id
225 */
226 Bool_t MakeAlignHalf(const TString& path, Int_t id);
227 /**
228 * Write to CDB
229 */
230 void WriteToCDB();
231 /**
232 * Write to file
233 */
234 void WriteToFile();
235 Long_t fMask; // What to write
236 TVector3 fSensorTransMin; // Minimum translations of a sensor
237 TVector3 fSensorTransMax; // Maximum translations of a sensor
238 TVector3 fSensorRotMin; // Minimum rotation of a sensor
239 TVector3 fSensorRotMax; // Maximum rotation of a sensor
240 TVector3 fHalfTransMin; // Minimum translations of a half-ring
241 TVector3 fHalfTransMax; // Maximum translations of a half-ring
242 TVector3 fHalfRotMin; // Minimum rotation of a half-ring
243 TVector3 fHalfRotMax; // Maximum rotation of a half-ring
244 Int_t fRunMin; // Run validity start
245 Int_t fRunMax; // Run validity end
246 TClonesArray* fArray; // Cache
247 TString fComment; // Comment on data
248
249 ClassDef(AliFMDAlignFaker,0)
250};
251
252#endif
253//____________________________________________________________________
254//
255// Local Variables:
256// mode: C++
257// End:
258//
259// EOF
260//
261