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