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