1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-------------------------------------------------------
17 // Implementation of the TPC transformation class
19 // Origin: Marian Ivanov Marian.Ivanov@cern.ch
22 // Class for tranformation of the coordinate frame
24 // local coordinate frame (sector, padrow, pad, timebine) ==>
25 // rotated global (tracking) cooridnate frame (sector, lx,ly,lz)
27 // Unisochronity - (substract time0 - pad by pad)
28 // Drift velocity - Currently common drift velocity - functionality of AliTPCParam
32 // AliTPCclustererMI::AddCluster
33 // AliTPCtrackerMI::Transform
35 //-------------------------------------------------------
38 cdb=AliCDBManager::Instance()
39 cdb->SetDefaultStorage("local:///u/mmager/mycalib1")
40 c=AliTPCcalibDB::Instance()
42 Double_t x[]={1.0,2.0,3.0}
45 trafo.Transform(x,i,0,1)
50 #include "AliTPCROC.h"
51 #include "AliTPCCalPad.h"
52 #include "AliTPCCalROC.h"
53 #include "AliTPCcalibDB.h"
54 #include "AliTPCParam.h"
57 #include "AliTPCExB.h"
58 #include "TGeoMatrix.h"
59 #include "AliTPCTransform.h"
61 ClassImp(AliTPCTransform)
64 AliTPCTransform::AliTPCTransform() {
68 for (Int_t i=0;i<18;++i) {
69 Double_t alpha=TMath::DegToRad()*(10.+20.*(i%18));
70 fSins[i]=TMath::Sin(alpha);
71 fCoss[i]=TMath::Cos(alpha);
75 AliTPCTransform::~AliTPCTransform() {
81 void AliTPCTransform::Transform(Double_t *x,Int_t *i,UInt_t /*time*/,
82 Int_t /*coordinateType*/, Float_t *primvtx) {
83 // input: x[0] - pad row
87 // output: x[0] - x (all in the rotated global coordinate frame)
91 // primvtx - position of the primary vertex
92 // used for the TOF correction
93 // TOF of particle calculated assuming the speed-of-light and
98 Int_t row=TMath::Nint(x[0]);
99 Int_t pad=TMath::Nint(x[1]);
101 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
103 AliTPCCalPad * time0TPC = calib->GetPadTime0();
104 AliTPCParam * param = calib->GetParameters();
106 AliFatal("Time unisochronity missing");
110 AliFatal("Parameters missing");
114 // Apply Time0 correction - Pad by pad fluctuation
116 x[2]-=time0TPC->GetCalROC(sector)->GetValue(row,pad);
118 // Tranform from pad - time coordinate system to the rotated global (tracking) system
120 Local2RotatedGlobal(sector,x);
125 //TODO: calib->GetParameters()->GetClusterMatrix(sector)->LocalToMaster(x,xx);
126 RotatedGlobal2Global(sector,x);
131 calib->GetExB()->Correct(x,xx);
133 // Time of flight correction
138 dist+=(primvtx[0]-x[0])*(primvtx[0]-x[0]);
139 dist+=(primvtx[1]-x[1])*(primvtx[1]-x[1]);
140 dist+=(primvtx[0]-x[2])*(primvtx[0]-x[2]);
141 dist = TMath::Sqrt(dist);
142 // drift length correction because of TOF
143 // the drift velocity is in cm/s therefore multiplication by 0.01
144 deltaDr = (dist*(0.01*param->GetDriftV()))/TMath::C();
148 Global2RotatedGlobal(sector,xx);
150 x[0]=xx[0];x[1]=xx[1];x[2]=xx[2];
153 void AliTPCTransform::Local2RotatedGlobal(Int_t sector, Double_t *x) const {
156 // Tranform coordinate from
157 // row, pad, time to x,y,z
160 // Current implementation - common drift velocity - for full chamber
161 // TODO: use a map or parametrisation!
165 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
166 AliTPCParam * param = calib->GetParameters();
168 AliFatal("Parameters missing");
170 Int_t row=TMath::Nint(x[0]);
171 Int_t pad=TMath::Nint(x[1]);
173 const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector();
175 Double_t zwidth = param->GetZWidth();
176 Double_t padWidth = 0;
177 Double_t padLength = 0;
181 maxPad = param->GetNPadsLow(row);
182 sign = (sector < kNIS/2) ? 1 : -1;
183 padLength = param->GetPadPitchLength(sector,row);
184 padWidth = param->GetPadPitchWidth(sector);
186 maxPad = param->GetNPadsUp(row);
187 sign = ((sector-kNIS) < kNOS/2) ? 1 : -1;
188 padLength = param->GetPadPitchLength(sector,row);
189 padWidth = param->GetPadPitchWidth(sector);
193 x[0] = param->GetPadRowRadii(sector,row); // padrow X position - ideal
197 x[1]=(x[1]-0.5*maxPad)*padWidth;
201 x[2]*= zwidth; // tranform time bin to the distance to the ROC
202 x[2]-= 3.*param->GetZSigma() + param->GetNTBinsL1()*zwidth;
203 // subtract the time offsets
204 x[2] = sign*( param->GetZLength(sector) - x[2]);
207 inline void AliTPCTransform::RotatedGlobal2Global(Int_t sector,Double_t *x) const {
209 // transform possition rotated global to the global
212 GetCosAndSin(sector,cos,sin);
214 x[0]= cos*tmp+sin*x[1];
215 x[1]=-sin*tmp+cos*x[1];
218 inline void AliTPCTransform::Global2RotatedGlobal(Int_t sector,Double_t *x) const {
220 // tranform possition Global2RotatedGlobal
223 GetCosAndSin(sector,cos,sin);
225 x[0]= cos*tmp-sin*x[1];
226 x[1]= sin*tmp+cos*x[1];
229 inline void AliTPCTransform::GetCosAndSin(Int_t sector,Double_t &cos,
230 Double_t &sin) const {
231 cos=fCoss[sector%18];
232 sin=fSins[sector%18];