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