]>
Commit | Line | Data |
---|---|---|
af26ce80 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Transforms clusters into space points with calibrated positions // | |
21 | // defined in the local tracking system // | |
22 | // // | |
23 | //////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include <TGeoMatrix.h> | |
26 | ||
27 | #include "AliLog.h" | |
af26ce80 | 28 | |
29 | #include "AliTRDtransform.h" | |
30 | #include "AliTRDcluster.h" | |
31 | #include "AliTRDgeometry.h" | |
32 | #include "AliTRDpadPlane.h" | |
33 | #include "AliTRDCommonParam.h" | |
34 | #include "AliTRDcalibDB.h" | |
35 | #include "Cal/AliTRDCalDet.h" | |
36 | #include "Cal/AliTRDCalROC.h" | |
37 | ||
38 | ClassImp(AliTRDtransform) | |
39 | ||
40 | //_____________________________________________________________________________ | |
af26ce80 | 41 | AliTRDtransform::AliTRDtransform() |
42 | :TObject() | |
af26ce80 | 43 | ,fDetector(0) |
44 | ,fParam(0x0) | |
45 | ,fCalibration(0x0) | |
46 | ,fCalVdriftROC(0x0) | |
47 | ,fCalT0ROC(0x0) | |
a60b4183 | 48 | ,fCalPRFROC(0x0) |
c893147d | 49 | ,fkCalVdriftDet(0x0) |
50 | ,fkCalT0Det(0x0) | |
af26ce80 | 51 | ,fCalVdriftDetValue(0) |
52 | ,fCalT0DetValue(0) | |
53 | ,fSamplingFrequency(0) | |
54 | ,fPadPlane(0x0) | |
55 | ,fZShiftIdeal(0) | |
56 | ,fMatrix(0x0) | |
57 | { | |
58 | // | |
59 | // AliTRDtransform default constructor | |
60 | // | |
61 | ||
225096c8 | 62 | fParam = AliTRDCommonParam::Instance(); |
63 | if (!fParam) { | |
64 | AliError("Could not get common parameters\n"); | |
65 | } | |
66 | fSamplingFrequency = fParam->GetSamplingFrequency(); | |
67 | ||
68 | fCalibration = AliTRDcalibDB::Instance(); | |
69 | if (!fCalibration) { | |
70 | AliError("Cannot find calibration object"); | |
71 | } | |
72 | ||
73 | // Get the calibration objects for the global calibration | |
74 | fkCalVdriftDet = fCalibration->GetVdriftDet(); | |
75 | fkCalT0Det = fCalibration->GetT0Det(); | |
76 | ||
af26ce80 | 77 | } |
78 | ||
79 | //_____________________________________________________________________________ | |
af26ce80 | 80 | AliTRDtransform::AliTRDtransform(Int_t det) |
81 | :TObject() | |
af26ce80 | 82 | ,fDetector(0) |
83 | ,fParam(0x0) | |
84 | ,fCalibration(0x0) | |
85 | ,fCalVdriftROC(0x0) | |
86 | ,fCalT0ROC(0x0) | |
a60b4183 | 87 | ,fCalPRFROC(0x0) |
c893147d | 88 | ,fkCalVdriftDet(0x0) |
89 | ,fkCalT0Det(0x0) | |
af26ce80 | 90 | ,fCalVdriftDetValue(0) |
91 | ,fCalT0DetValue(0) | |
92 | ,fSamplingFrequency(0) | |
93 | ,fPadPlane(0x0) | |
94 | ,fZShiftIdeal(0) | |
95 | ,fMatrix(0x0) | |
96 | { | |
97 | // | |
98 | // AliTRDtransform constructor for a given detector | |
99 | // | |
100 | ||
af26ce80 | 101 | fParam = AliTRDCommonParam::Instance(); |
102 | if (!fParam) { | |
103 | AliError("Could not get common parameters\n"); | |
104 | } | |
105 | fSamplingFrequency = fParam->GetSamplingFrequency(); | |
106 | ||
107 | fCalibration = AliTRDcalibDB::Instance(); | |
108 | if (!fCalibration) { | |
109 | AliError("Cannot find calibration object"); | |
110 | } | |
111 | ||
112 | // Get the calibration objects for the global calibration | |
c893147d | 113 | fkCalVdriftDet = fCalibration->GetVdriftDet(); |
114 | fkCalT0Det = fCalibration->GetT0Det(); | |
af26ce80 | 115 | |
116 | SetDetector(det); | |
117 | ||
118 | } | |
119 | ||
120 | //_____________________________________________________________________________ | |
af26ce80 | 121 | AliTRDtransform::AliTRDtransform(const AliTRDtransform &t) |
122 | :TObject(t) | |
af26ce80 | 123 | ,fDetector(t.fDetector) |
124 | ,fParam(0x0) | |
125 | ,fCalibration(0x0) | |
126 | ,fCalVdriftROC(0x0) | |
127 | ,fCalT0ROC(0x0) | |
a60b4183 | 128 | ,fCalPRFROC(0x0) |
c893147d | 129 | ,fkCalVdriftDet(0x0) |
130 | ,fkCalT0Det(0x0) | |
af26ce80 | 131 | ,fCalVdriftDetValue(0) |
132 | ,fCalT0DetValue(0) | |
133 | ,fSamplingFrequency(0) | |
134 | ,fPadPlane(0x0) | |
135 | ,fZShiftIdeal(0) | |
136 | ,fMatrix(0x0) | |
137 | { | |
138 | // | |
139 | // AliTRDtransform copy constructor | |
140 | // | |
141 | ||
af26ce80 | 142 | fParam = AliTRDCommonParam::Instance(); |
143 | if (!fParam) { | |
144 | AliError("Could not get common parameters\n"); | |
145 | } | |
146 | fSamplingFrequency = fParam->GetSamplingFrequency(); | |
147 | ||
148 | fCalibration = AliTRDcalibDB::Instance(); | |
149 | if (!fCalibration) { | |
150 | AliError("Cannot find calibration object"); | |
151 | } | |
c893147d | 152 | fkCalVdriftDet = fCalibration->GetVdriftDet(); |
153 | fkCalT0Det = fCalibration->GetT0Det(); | |
af26ce80 | 154 | |
155 | } | |
156 | ||
157 | //_____________________________________________________________________________ | |
158 | AliTRDtransform::~AliTRDtransform() | |
159 | { | |
160 | // | |
161 | // AliTRDtransform destructor | |
162 | // | |
163 | ||
af26ce80 | 164 | } |
165 | ||
fc1c9d79 | 166 | //_____________________________________________________________________________ |
167 | AliTRDtransform &AliTRDtransform::operator=(const AliTRDtransform &t) | |
168 | { | |
169 | // | |
170 | // Assignment operator | |
171 | // | |
172 | ||
173 | if (this != &t) { | |
174 | ((AliTRDtransform &) t).Copy(*this); | |
175 | } | |
176 | ||
177 | return *this; | |
178 | ||
179 | } | |
180 | ||
181 | //_____________________________________________________________________________ | |
182 | void AliTRDtransform::Copy(TObject &t) const | |
183 | { | |
184 | // | |
185 | // Copy function | |
186 | // | |
187 | ||
188 | ((AliTRDtransform &) t).fDetector = fDetector; | |
189 | ((AliTRDtransform &) t).fParam = AliTRDCommonParam::Instance(); | |
190 | ((AliTRDtransform &) t).fCalibration = AliTRDcalibDB::Instance(); | |
191 | if (fCalibration) { | |
192 | ((AliTRDtransform &) t).fkCalVdriftDet = fCalibration->GetVdriftDet(); | |
193 | ((AliTRDtransform &) t).fkCalT0Det = fCalibration->GetT0Det(); | |
194 | } | |
195 | else { | |
196 | ((AliTRDtransform &) t).fkCalVdriftDet = 0; | |
197 | ((AliTRDtransform &) t).fkCalT0Det = 0; | |
198 | } | |
199 | ((AliTRDtransform &) t).fCalVdriftROC = 0x0; | |
200 | ((AliTRDtransform &) t).fCalT0ROC = 0x0; | |
201 | ((AliTRDtransform &) t).fCalPRFROC = 0x0; | |
202 | ((AliTRDtransform &) t).fCalVdriftDetValue = 0; | |
203 | ((AliTRDtransform &) t).fCalT0DetValue = 0; | |
204 | ((AliTRDtransform &) t).fSamplingFrequency = 0; | |
205 | ((AliTRDtransform &) t).fPadPlane = 0x0; | |
206 | ((AliTRDtransform &) t).fZShiftIdeal = 0; | |
207 | ((AliTRDtransform &) t).fMatrix = 0x0; | |
208 | ||
209 | } | |
210 | ||
9dcc64cc | 211 | //_____________________________________________________________________________ |
212 | AliTRDgeometry& AliTRDtransform::Geometry() | |
213 | { | |
214 | static AliTRDgeometry g; | |
215 | if (!g.CreateClusterMatrixArray()) { | |
216 | AliErrorGeneral("AliTRDtransform::Geometry()", "Could not get transformation matrices\n"); | |
217 | } | |
218 | return g; | |
219 | } | |
220 | ||
af26ce80 | 221 | //_____________________________________________________________________________ |
222 | void AliTRDtransform::SetDetector(Int_t det) | |
223 | { | |
224 | // | |
225 | // Set to a new detector number and update the calibration objects | |
226 | // and values accordingly | |
227 | // | |
228 | ||
229 | fDetector = det; | |
230 | ||
231 | // Get the calibration objects for the pad-by-pad calibration | |
232 | fCalVdriftROC = fCalibration->GetVdriftROC(det); | |
233 | fCalT0ROC = fCalibration->GetT0ROC(det); | |
a60b4183 | 234 | fCalPRFROC = fCalibration->GetPRFROC(det); |
af26ce80 | 235 | |
236 | // Get the detector wise defined calibration values | |
c893147d | 237 | fCalVdriftDetValue = fkCalVdriftDet->GetValue(det); |
238 | fCalT0DetValue = fkCalT0Det->GetValue(det); | |
af26ce80 | 239 | |
240 | // Shift needed to define Z-position relative to middle of chamber | |
9dcc64cc | 241 | Int_t layer = Geometry().GetLayer(det); |
242 | Int_t stack = Geometry().GetStack(det); | |
243 | fPadPlane = Geometry().GetPadPlane(layer,stack); | |
af26ce80 | 244 | fZShiftIdeal = 0.5 * (fPadPlane->GetRow0() + fPadPlane->GetRowEnd()); |
245 | ||
246 | // Get the current transformation matrix | |
9dcc64cc | 247 | fMatrix = Geometry().GetClusterMatrix(det); |
af26ce80 | 248 | |
249 | } | |
250 | ||
251 | //_____________________________________________________________________________ | |
b72f4eaf | 252 | Bool_t AliTRDtransform::Transform(AliTRDcluster *c) |
af26ce80 | 253 | { |
254 | // | |
255 | // Transforms the local cluster coordinates into calibrated | |
256 | // space point positions defined in the local tracking system. | |
257 | // | |
258 | // Here the calibration for T0, Vdrift and ExB is applied as well. | |
259 | // | |
b72f4eaf | 260 | // Input: Cluster in the local chamber coordinates |
261 | // Output: Tracking cluster | |
af26ce80 | 262 | |
b72f4eaf | 263 | if (!fMatrix) return kFALSE; |
af26ce80 | 264 | |
af26ce80 | 265 | |
b72f4eaf | 266 | // Parameters to adjust the X position of clusters in the alignable volume |
ec3f0161 | 267 | const Double_t kX0shift = AliTRDgeometry::AnodePos(); //[cm] |
1814b374 | 268 | |
1814b374 | 269 | |
b72f4eaf | 270 | // Retrieve calibration values |
271 | Int_t col = c->GetPadCol(), row = c->GetPadRow(); | |
272 | // drift velocity | |
273 | Double_t vd = fCalVdriftDetValue * fCalVdriftROC->GetValue(col,row); | |
274 | // t0 | |
275 | Double_t t0 = fCalT0DetValue + fCalT0ROC->GetValue(col,row); | |
566bf887 | 276 | t0 /= fSamplingFrequency; |
b72f4eaf | 277 | // ExB correction |
278 | Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(vd); | |
279 | ||
280 | Float_t x = c->GetXloc(t0, vd); | |
281 | ||
b72f4eaf | 282 | // Pad dimensions |
283 | Double_t rs = fPadPlane->GetRowSize(row); | |
284 | Double_t cs = fPadPlane->GetColSize(col); | |
1fd9389f | 285 | |
286 | // cluster error with diffusion corrections | |
287 | Double_t s2 = cs*fCalPRFROC->GetValue(col, row); | |
288 | s2 *= s2; | |
289 | Float_t dl, dt; | |
290 | AliTRDCommonParam::Instance()->GetDiffCoeff(dl, dt, vd); | |
291 | ||
b72f4eaf | 292 | Double_t y0 = fPadPlane->GetColPos(col) + .5*cs; |
293 | Double_t loc[] = { | |
294 | kX0shift-x, // Invert the X-position, | |
295 | c->GetYloc(y0, s2, cs) - x*exb,// apply ExB correction | |
296 | fPadPlane->GetRowPos(row) - .5*rs - fZShiftIdeal // move the Z-position relative to the middle of the chamber | |
297 | }; | |
298 | ||
299 | // Go to tracking coordinates | |
300 | Double_t trk[3]; | |
301 | fMatrix->LocalToMaster(loc, trk); | |
302 | ||
303 | // store tracking values | |
304 | c->SetX(trk[0]);c->SetY(trk[1]);c->SetZ(trk[2]); | |
1fd9389f | 305 | c->SetSigmaY2(s2, dt, exb, x); |
b72f4eaf | 306 | c->SetSigmaZ2(fPadPlane->GetRowSize(row)*fPadPlane->GetRowSize(row)/12.); |
307 | ||
308 | return kTRUE; | |
c893147d | 309 | |
af26ce80 | 310 | } |
311 | ||
312 | //_____________________________________________________________________________ | |
313 | void AliTRDtransform::Recalibrate(AliTRDcluster *c, Bool_t setDet) | |
314 | { | |
315 | // | |
316 | // Recalibrates the position of a given cluster | |
317 | // If <setDet> is TRUE, the detector number is set for each cluster | |
318 | // automatically. Otherwise, AliTRDtransform::SetDetector() has to | |
319 | // be used. | |
320 | // | |
321 | ||
b72f4eaf | 322 | if (setDet) SetDetector(c->GetDetector()); |
323 | Transform(c); | |
c893147d | 324 | |
af26ce80 | 325 | } |