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