]>
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" | |
28 | #include "AliTracker.h" | |
29 | #include "AliCodeTimer.h" | |
30 | ||
31 | #include "AliTRDtransform.h" | |
32 | #include "AliTRDcluster.h" | |
33 | #include "AliTRDgeometry.h" | |
34 | #include "AliTRDpadPlane.h" | |
35 | #include "AliTRDCommonParam.h" | |
36 | #include "AliTRDcalibDB.h" | |
37 | #include "Cal/AliTRDCalDet.h" | |
38 | #include "Cal/AliTRDCalROC.h" | |
39 | ||
40 | ClassImp(AliTRDtransform) | |
41 | ||
42 | //_____________________________________________________________________________ | |
43 | //AliTRDtransform::AliTRDtransform() | |
44 | // :AliTransform() | |
45 | AliTRDtransform::AliTRDtransform() | |
46 | :TObject() | |
47 | ,fGeo(0x0) | |
48 | ,fDetector(0) | |
49 | ,fParam(0x0) | |
50 | ,fCalibration(0x0) | |
51 | ,fCalVdriftROC(0x0) | |
52 | ,fCalT0ROC(0x0) | |
53 | ,fCalVdriftDet(0x0) | |
54 | ,fCalT0Det(0x0) | |
55 | ,fCalVdriftDetValue(0) | |
56 | ,fCalT0DetValue(0) | |
57 | ,fSamplingFrequency(0) | |
58 | ,fPadPlane(0x0) | |
59 | ,fZShiftIdeal(0) | |
60 | ,fMatrix(0x0) | |
61 | { | |
62 | // | |
63 | // AliTRDtransform default constructor | |
64 | // | |
65 | ||
66 | } | |
67 | ||
68 | //_____________________________________________________________________________ | |
69 | //AliTRDtransform::AliTRDtransform(Int_t det) | |
70 | // :AliTransform() | |
71 | AliTRDtransform::AliTRDtransform(Int_t det) | |
72 | :TObject() | |
73 | ,fGeo(0x0) | |
74 | ,fDetector(0) | |
75 | ,fParam(0x0) | |
76 | ,fCalibration(0x0) | |
77 | ,fCalVdriftROC(0x0) | |
78 | ,fCalT0ROC(0x0) | |
79 | ,fCalVdriftDet(0x0) | |
80 | ,fCalT0Det(0x0) | |
81 | ,fCalVdriftDetValue(0) | |
82 | ,fCalT0DetValue(0) | |
83 | ,fSamplingFrequency(0) | |
84 | ,fPadPlane(0x0) | |
85 | ,fZShiftIdeal(0) | |
86 | ,fMatrix(0x0) | |
87 | { | |
88 | // | |
89 | // AliTRDtransform constructor for a given detector | |
90 | // | |
91 | ||
92 | fGeo = new AliTRDgeometry(); | |
a938cf15 | 93 | if (!fGeo->CreateClusterMatrixArray()) { |
94 | AliError("Could not get transformation matrices\n"); | |
95 | } | |
af26ce80 | 96 | |
97 | fParam = AliTRDCommonParam::Instance(); | |
98 | if (!fParam) { | |
99 | AliError("Could not get common parameters\n"); | |
100 | } | |
101 | fSamplingFrequency = fParam->GetSamplingFrequency(); | |
102 | ||
103 | fCalibration = AliTRDcalibDB::Instance(); | |
104 | if (!fCalibration) { | |
105 | AliError("Cannot find calibration object"); | |
106 | } | |
107 | ||
108 | // Get the calibration objects for the global calibration | |
109 | fCalVdriftDet = fCalibration->GetVdriftDet(); | |
110 | fCalT0Det = fCalibration->GetT0Det(); | |
111 | ||
112 | SetDetector(det); | |
113 | ||
114 | } | |
115 | ||
116 | //_____________________________________________________________________________ | |
117 | //AliTRDtransform::AliTRDtransform(const AliTRDtransform &t) | |
118 | // :AliTransform(t) | |
119 | AliTRDtransform::AliTRDtransform(const AliTRDtransform &t) | |
120 | :TObject(t) | |
121 | ,fGeo(0x0) | |
122 | ,fDetector(t.fDetector) | |
123 | ,fParam(0x0) | |
124 | ,fCalibration(0x0) | |
125 | ,fCalVdriftROC(0x0) | |
126 | ,fCalT0ROC(0x0) | |
127 | ,fCalVdriftDet(0x0) | |
128 | ,fCalT0Det(0x0) | |
129 | ,fCalVdriftDetValue(0) | |
130 | ,fCalT0DetValue(0) | |
131 | ,fSamplingFrequency(0) | |
132 | ,fPadPlane(0x0) | |
133 | ,fZShiftIdeal(0) | |
134 | ,fMatrix(0x0) | |
135 | { | |
136 | // | |
137 | // AliTRDtransform copy constructor | |
138 | // | |
139 | ||
140 | if (fGeo) { | |
141 | delete fGeo; | |
142 | } | |
143 | fGeo = new AliTRDgeometry(); | |
9a96f175 | 144 | fGeo->CreateClusterMatrixArray(); |
af26ce80 | 145 | |
146 | fParam = AliTRDCommonParam::Instance(); | |
147 | if (!fParam) { | |
148 | AliError("Could not get common parameters\n"); | |
149 | } | |
150 | fSamplingFrequency = fParam->GetSamplingFrequency(); | |
151 | ||
152 | fCalibration = AliTRDcalibDB::Instance(); | |
153 | if (!fCalibration) { | |
154 | AliError("Cannot find calibration object"); | |
155 | } | |
156 | fCalVdriftDet = fCalibration->GetVdriftDet(); | |
157 | fCalT0Det = fCalibration->GetT0Det(); | |
158 | ||
159 | } | |
160 | ||
161 | //_____________________________________________________________________________ | |
162 | AliTRDtransform::~AliTRDtransform() | |
163 | { | |
164 | // | |
165 | // AliTRDtransform destructor | |
166 | // | |
167 | ||
168 | if (fGeo) { | |
169 | delete fGeo; | |
170 | } | |
171 | ||
172 | } | |
173 | ||
174 | //_____________________________________________________________________________ | |
175 | void AliTRDtransform::SetDetector(Int_t det) | |
176 | { | |
177 | // | |
178 | // Set to a new detector number and update the calibration objects | |
179 | // and values accordingly | |
180 | // | |
181 | ||
182 | fDetector = det; | |
183 | ||
184 | // Get the calibration objects for the pad-by-pad calibration | |
185 | fCalVdriftROC = fCalibration->GetVdriftROC(det); | |
186 | fCalT0ROC = fCalibration->GetT0ROC(det); | |
187 | ||
188 | // Get the detector wise defined calibration values | |
189 | fCalVdriftDetValue = fCalVdriftDet->GetValue(det); | |
190 | fCalT0DetValue = fCalT0Det->GetValue(det); | |
191 | ||
192 | // Shift needed to define Z-position relative to middle of chamber | |
053767a4 | 193 | Int_t layer = fGeo->GetLayer(det); |
194 | Int_t stack = fGeo->GetStack(det); | |
195 | fPadPlane = fGeo->GetPadPlane(layer,stack); | |
af26ce80 | 196 | fZShiftIdeal = 0.5 * (fPadPlane->GetRow0() + fPadPlane->GetRowEnd()); |
197 | ||
198 | // Get the current transformation matrix | |
9a96f175 | 199 | fMatrix = fGeo->GetClusterMatrix(det); |
af26ce80 | 200 | |
201 | } | |
202 | ||
203 | //_____________________________________________________________________________ | |
b72f4eaf | 204 | Bool_t AliTRDtransform::Transform(AliTRDcluster *c) |
af26ce80 | 205 | { |
206 | // | |
207 | // Transforms the local cluster coordinates into calibrated | |
208 | // space point positions defined in the local tracking system. | |
209 | // | |
210 | // Here the calibration for T0, Vdrift and ExB is applied as well. | |
211 | // | |
b72f4eaf | 212 | // Input: Cluster in the local chamber coordinates |
213 | // Output: Tracking cluster | |
af26ce80 | 214 | |
b72f4eaf | 215 | if (!fMatrix) return kFALSE; |
af26ce80 | 216 | |
af26ce80 | 217 | |
b72f4eaf | 218 | // Parameters to adjust the X position of clusters in the alignable volume |
ec3f0161 | 219 | const Double_t kX0shift = AliTRDgeometry::AnodePos(); //[cm] |
1814b374 | 220 | |
1814b374 | 221 | |
b72f4eaf | 222 | // Retrieve calibration values |
223 | Int_t col = c->GetPadCol(), row = c->GetPadRow(); | |
224 | // drift velocity | |
225 | Double_t vd = fCalVdriftDetValue * fCalVdriftROC->GetValue(col,row); | |
226 | // t0 | |
227 | Double_t t0 = fCalT0DetValue + fCalT0ROC->GetValue(col,row); | |
228 | // ExB correction | |
229 | Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(vd); | |
230 | ||
231 | Float_t x = c->GetXloc(t0, vd); | |
232 | ||
233 | // pad response width with diffusion corrections | |
234 | Double_t s2 = AliTRDcalibDB::Instance()->GetPRFWidth(fDetector, col, row); s2 *= s2; | |
17de99aa | 235 | Float_t dl, dt; |
236 | AliTRDCommonParam::Instance()->GetDiffCoeff(dl, dt, vd); | |
237 | s2 += dl*dl*x/(1.+2.*exb*exb); | |
b72f4eaf | 238 | s2 -= - 1.5e-1; |
239 | ||
240 | // Pad dimensions | |
241 | Double_t rs = fPadPlane->GetRowSize(row); | |
242 | Double_t cs = fPadPlane->GetColSize(col); | |
243 | Double_t y0 = fPadPlane->GetColPos(col) + .5*cs; | |
244 | Double_t loc[] = { | |
245 | kX0shift-x, // Invert the X-position, | |
246 | c->GetYloc(y0, s2, cs) - x*exb,// apply ExB correction | |
247 | fPadPlane->GetRowPos(row) - .5*rs - fZShiftIdeal // move the Z-position relative to the middle of the chamber | |
248 | }; | |
249 | ||
250 | // Go to tracking coordinates | |
251 | Double_t trk[3]; | |
252 | fMatrix->LocalToMaster(loc, trk); | |
253 | ||
254 | // store tracking values | |
255 | c->SetX(trk[0]);c->SetY(trk[1]);c->SetZ(trk[2]); | |
256 | c->SetSigmaY2(s2); | |
257 | c->SetSigmaZ2(fPadPlane->GetRowSize(row)*fPadPlane->GetRowSize(row)/12.); | |
258 | ||
259 | return kTRUE; | |
af26ce80 | 260 | } |
261 | ||
262 | //_____________________________________________________________________________ | |
263 | void AliTRDtransform::Recalibrate(AliTRDcluster *c, Bool_t setDet) | |
264 | { | |
265 | // | |
266 | // Recalibrates the position of a given cluster | |
267 | // If <setDet> is TRUE, the detector number is set for each cluster | |
268 | // automatically. Otherwise, AliTRDtransform::SetDetector() has to | |
269 | // be used. | |
270 | // | |
271 | ||
b72f4eaf | 272 | if (setDet) SetDetector(c->GetDetector()); |
273 | Transform(c); | |
af26ce80 | 274 | } |