]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtrackingSector.cxx
Merging the VirtualMC branch to the main development branch (HEAD)
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackingSector.cxx
CommitLineData
46d29e70 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/*
17$Log$
b9d0a01d 18Revision 1.7.6.2 2002/07/24 10:09:31 alibrary
19Updating VirtualMC
20
21Revision 1.9 2002/06/12 09:54:36 cblume
22Update of tracking code provided by Sergei
23
5443e65e 24Revision 1.8 2002/03/28 14:59:07 cblume
25Coding conventions
26
0a29d0f1 27Revision 1.7 2001/11/19 08:44:08 cblume
28Fix bugs reported by Rene
29
a1c3aded 30Revision 1.6 2001/05/28 17:07:58 hristov
31Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh)
32
a819a5f7 33Revision 1.5 2000/12/08 16:07:02 cblume
34Update of the tracking by Sergei
35
bbf92647 36Revision 1.4 2000/10/16 01:16:53 cblume
37Changed timebin 0 to be the one closest to the readout
38
ea6a8999 39Revision 1.3 2000/10/15 23:40:01 cblume
40Remove AliTRDconst
41
0e9c2ad5 42Revision 1.2 2000/10/06 16:49:46 cblume
43Made Getters const
44
46d29e70 45Revision 1.1.2.2 2000/10/04 16:34:58 cblume
46Replace include files by forward declarations
47
48Revision 1.1.2.1 2000/09/22 14:47:52 cblume
49Add the tracking code
50
0a29d0f1 51*/
52
53/////////////////////////////////////////////////////////////////////////
54// //
55// Tracking sector //
56// //
57/////////////////////////////////////////////////////////////////////////
46d29e70 58
59#include <TObject.h>
60
61#include "AliRun.h"
62
63#include "AliTRD.h"
46d29e70 64#include "AliTRDgeometry.h"
65#include "AliTRDcluster.h"
66#include "AliTRDtimeBin.h"
46d29e70 67#include "AliTRDtrackingSector.h"
5443e65e 68#include "AliTRDparameter.h"
46d29e70 69
46d29e70 70ClassImp(AliTRDtrackingSector)
71
72//_______________________________________________________
46d29e70 73AliTRDtrackingSector::~AliTRDtrackingSector()
74{
75 //
76 // Destructor
77 //
78
a1c3aded 79 delete fTimeBin;
46d29e70 80
81}
82
83//_______________________________________________________
84AliTRDtimeBin &AliTRDtrackingSector::operator[](Int_t i)
85{
86 //
87 // Index operator
88 //
89
90 return *(fTimeBin+i);
91
92}
93
94//_______________________________________________________
46d29e70 95void AliTRDtrackingSector::SetUp()
96{
0a29d0f1 97 //
98 // Initialization
99 //
100
101 AliTRD *trd = (AliTRD*) gAlice->GetDetector("TRD");
102 fGeom = trd->GetGeometry();
46d29e70 103
0e9c2ad5 104 fN = AliTRDgeometry::Nplan() * (Int_t(AliTRDgeometry::DrThick()
105 /fTimeBinSize) + 1);
46d29e70 106
107 fTimeBin = new AliTRDtimeBin[fN];
108
5443e65e 109 if (!fPar) {
110 fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
111 }
112
113 fTimeBinSize = fPar->GetTimeBinSize();
114
46d29e70 115}
116
117//______________________________________________________
a819a5f7 118Double_t AliTRDtrackingSector::GetX(Int_t tb) const
46d29e70 119{
0a29d0f1 120 //
121 // Get global x coordinate
122 //
123
a819a5f7 124 if( (tb<0) || (tb>fN-1)) {
46d29e70 125 fprintf(stderr,"AliTRDtrackingSector::GetX: TimeBin index is out of range !\n");
126 return -99999.;
127 }
128 else {
129
0a29d0f1 130 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
131 Int_t localTb = tbPerPlane - tb%tbPerPlane - 1;
46d29e70 132
0a29d0f1 133 Int_t plane = tb/tbPerPlane;
5443e65e 134 Float_t t0 = fPar->GetTime0(plane);
0a29d0f1 135 Double_t x = t0 - (localTb + 0.5) * fTimeBinSize;
46d29e70 136
137 return x;
0a29d0f1 138
46d29e70 139 }
0a29d0f1 140
46d29e70 141}
142
143//______________________________________________________
46d29e70 144Int_t AliTRDtrackingSector::GetTimeBinNumber(Double_t x) const
145{
0a29d0f1 146 //
147 // Returns the time bin number
148 //
149
5443e65e 150 Float_t rOut = fPar->GetTime0(AliTRDgeometry::Nplan()-1);
151 Float_t rIn = fPar->GetTime0(0) - AliTRDgeometry::DrThick();
46d29e70 152
a819a5f7 153
0a29d0f1 154 if(x >= rOut) return fN-1;
155 if(x <= rIn) return 0;
46d29e70 156
a819a5f7 157 Int_t plane;
158 for (plane = AliTRDgeometry::Nplan()-1; plane >= 0; plane--) {
5443e65e 159 if(x > (fPar->GetTime0(plane) - AliTRDgeometry::DrThick())) break;
a819a5f7 160 }
161
0a29d0f1 162 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
5443e65e 163 Int_t localTb = Int_t((fPar->GetTime0(plane)-x)/fTimeBinSize);
bbf92647 164
0a29d0f1 165 if((localTb < 0) || (localTb >= tbPerPlane)) {
a819a5f7 166 printf("AliTRDtrackingSector::GetTimeBinNumber: \n");
167 printf("local time bin %d is out of bounds [0..%d]: x = %f \n",
0a29d0f1 168 localTb,tbPerPlane-1,x);
a819a5f7 169 return -1;
170 }
171
0a29d0f1 172 Int_t timeBin = (plane + 1) * tbPerPlane - 1 - localTb;
46d29e70 173
0a29d0f1 174 return timeBin;
46d29e70 175}
176
177//______________________________________________________
0a29d0f1 178Int_t AliTRDtrackingSector::GetTimeBin(Int_t det, Int_t localTb) const
46d29e70 179{
0a29d0f1 180 //
181 // Time bin
182 //
183
46d29e70 184 Int_t plane = fGeom->GetPlane(det);
185
0a29d0f1 186 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
bbf92647 187
0a29d0f1 188 Int_t timeBin = (plane + 1) * tbPerPlane - 1 - localTb;
189
190 return timeBin;
bbf92647 191
46d29e70 192}
193
a819a5f7 194
195//______________________________________________________
196
197Bool_t AliTRDtrackingSector::TECframe(Int_t tb, Double_t y, Double_t z) const
198{
0a29d0f1 199 //
200 // Returns <true> if point defined by <x(tb),y,z> is within
201 // the TEC G10 frame, otherwise returns <false>
202 //
a819a5f7 203
204 if((tb > (fN-1)) || (tb < 0)) return kFALSE;
205
0a29d0f1 206 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
207 Int_t plane = tb/tbPerPlane;
a819a5f7 208
209 Double_t x = GetX(tb);
210 y = TMath::Abs(y);
211
212 if((y > fGeom->GetChamberWidth(plane)/2.) &&
213 (y < x*TMath::Tan(0.5*AliTRDgeometry::GetAlpha()))) return kTRUE;
214
215 Double_t zmin, zmax;
216 Float_t fRowPadSize, fRow0;
217 Int_t nPadRows;
218
219 for(Int_t iCha = 1; iCha < AliTRDgeometry::Ncham(); iCha++) {
220
5443e65e 221 fRow0 = fPar->GetRow0(plane,iCha-1,0);
222 fRowPadSize = fPar->GetRowPadSize(plane,iCha-1,0);
223 nPadRows = fPar->GetRowMax(plane,iCha-1,0);
a819a5f7 224 zmin = fRow0 - fRowPadSize/2 + fRowPadSize * nPadRows;
225
5443e65e 226 fRow0 = fPar->GetRow0(plane,iCha,0);
227 fRowPadSize = fPar->GetRowPadSize(plane,iCha,0);
a819a5f7 228 zmax = fRow0 - fRowPadSize/2;
229
230 if((z > zmin) && (z < zmax)) return kTRUE;
231 }
232
233 return kFALSE;
0a29d0f1 234
a819a5f7 235}