]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtrackingSector.cxx
Adding MUON HLT code to the repository.
[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
88cb7938 16/* $Id$ */
0a29d0f1 17
18/////////////////////////////////////////////////////////////////////////
19// //
20// Tracking sector //
21// //
22/////////////////////////////////////////////////////////////////////////
46d29e70 23
24#include <TObject.h>
25
26#include "AliRun.h"
27
28#include "AliTRD.h"
46d29e70 29#include "AliTRDgeometry.h"
30#include "AliTRDcluster.h"
31#include "AliTRDtimeBin.h"
46d29e70 32#include "AliTRDtrackingSector.h"
5443e65e 33#include "AliTRDparameter.h"
46d29e70 34
46d29e70 35ClassImp(AliTRDtrackingSector)
36
37//_______________________________________________________
46d29e70 38AliTRDtrackingSector::~AliTRDtrackingSector()
39{
40 //
41 // Destructor
42 //
43
a1c3aded 44 delete fTimeBin;
46d29e70 45
46}
47
48//_______________________________________________________
49AliTRDtimeBin &AliTRDtrackingSector::operator[](Int_t i)
50{
51 //
52 // Index operator
53 //
54
55 return *(fTimeBin+i);
56
57}
58
59//_______________________________________________________
46d29e70 60void AliTRDtrackingSector::SetUp()
61{
0a29d0f1 62 //
63 // Initialization
64 //
65
66 AliTRD *trd = (AliTRD*) gAlice->GetDetector("TRD");
67 fGeom = trd->GetGeometry();
46d29e70 68
88cb7938 69 fTimeBinSize = fGeom->GetTimeBinSize();
70
0e9c2ad5 71 fN = AliTRDgeometry::Nplan() * (Int_t(AliTRDgeometry::DrThick()
72 /fTimeBinSize) + 1);
46d29e70 73
74 fTimeBin = new AliTRDtimeBin[fN];
75
5443e65e 76 if (!fPar) {
77 fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
78 }
79
80 fTimeBinSize = fPar->GetTimeBinSize();
81
46d29e70 82}
83
84//______________________________________________________
a819a5f7 85Double_t AliTRDtrackingSector::GetX(Int_t tb) const
46d29e70 86{
0a29d0f1 87 //
88 // Get global x coordinate
89 //
90
a819a5f7 91 if( (tb<0) || (tb>fN-1)) {
46d29e70 92 fprintf(stderr,"AliTRDtrackingSector::GetX: TimeBin index is out of range !\n");
93 return -99999.;
94 }
95 else {
96
0a29d0f1 97 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
98 Int_t localTb = tbPerPlane - tb%tbPerPlane - 1;
46d29e70 99
0a29d0f1 100 Int_t plane = tb/tbPerPlane;
5443e65e 101 Float_t t0 = fPar->GetTime0(plane);
0a29d0f1 102 Double_t x = t0 - (localTb + 0.5) * fTimeBinSize;
46d29e70 103
104 return x;
0a29d0f1 105
46d29e70 106 }
0a29d0f1 107
46d29e70 108}
109
110//______________________________________________________
46d29e70 111Int_t AliTRDtrackingSector::GetTimeBinNumber(Double_t x) const
112{
0a29d0f1 113 //
114 // Returns the time bin number
115 //
116
5443e65e 117 Float_t rOut = fPar->GetTime0(AliTRDgeometry::Nplan()-1);
118 Float_t rIn = fPar->GetTime0(0) - AliTRDgeometry::DrThick();
46d29e70 119
a819a5f7 120
0a29d0f1 121 if(x >= rOut) return fN-1;
122 if(x <= rIn) return 0;
46d29e70 123
a819a5f7 124 Int_t plane;
125 for (plane = AliTRDgeometry::Nplan()-1; plane >= 0; plane--) {
5443e65e 126 if(x > (fPar->GetTime0(plane) - AliTRDgeometry::DrThick())) break;
a819a5f7 127 }
128
0a29d0f1 129 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
5443e65e 130 Int_t localTb = Int_t((fPar->GetTime0(plane)-x)/fTimeBinSize);
bbf92647 131
0a29d0f1 132 if((localTb < 0) || (localTb >= tbPerPlane)) {
a819a5f7 133 printf("AliTRDtrackingSector::GetTimeBinNumber: \n");
134 printf("local time bin %d is out of bounds [0..%d]: x = %f \n",
0a29d0f1 135 localTb,tbPerPlane-1,x);
a819a5f7 136 return -1;
137 }
138
0a29d0f1 139 Int_t timeBin = (plane + 1) * tbPerPlane - 1 - localTb;
46d29e70 140
0a29d0f1 141 return timeBin;
46d29e70 142}
143
144//______________________________________________________
0a29d0f1 145Int_t AliTRDtrackingSector::GetTimeBin(Int_t det, Int_t localTb) const
46d29e70 146{
0a29d0f1 147 //
148 // Time bin
149 //
150
46d29e70 151 Int_t plane = fGeom->GetPlane(det);
152
0a29d0f1 153 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
bbf92647 154
0a29d0f1 155 Int_t timeBin = (plane + 1) * tbPerPlane - 1 - localTb;
156
157 return timeBin;
bbf92647 158
46d29e70 159}
160
a819a5f7 161
162//______________________________________________________
163
164Bool_t AliTRDtrackingSector::TECframe(Int_t tb, Double_t y, Double_t z) const
165{
0a29d0f1 166 //
167 // Returns <true> if point defined by <x(tb),y,z> is within
168 // the TEC G10 frame, otherwise returns <false>
169 //
a819a5f7 170
171 if((tb > (fN-1)) || (tb < 0)) return kFALSE;
172
0a29d0f1 173 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
174 Int_t plane = tb/tbPerPlane;
a819a5f7 175
176 Double_t x = GetX(tb);
177 y = TMath::Abs(y);
178
179 if((y > fGeom->GetChamberWidth(plane)/2.) &&
180 (y < x*TMath::Tan(0.5*AliTRDgeometry::GetAlpha()))) return kTRUE;
181
182 Double_t zmin, zmax;
183 Float_t fRowPadSize, fRow0;
184 Int_t nPadRows;
185
186 for(Int_t iCha = 1; iCha < AliTRDgeometry::Ncham(); iCha++) {
187
5443e65e 188 fRow0 = fPar->GetRow0(plane,iCha-1,0);
189 fRowPadSize = fPar->GetRowPadSize(plane,iCha-1,0);
190 nPadRows = fPar->GetRowMax(plane,iCha-1,0);
a819a5f7 191 zmin = fRow0 - fRowPadSize/2 + fRowPadSize * nPadRows;
192
5443e65e 193 fRow0 = fPar->GetRow0(plane,iCha,0);
194 fRowPadSize = fPar->GetRowPadSize(plane,iCha,0);
a819a5f7 195 zmax = fRow0 - fRowPadSize/2;
196
197 if((z > zmin) && (z < zmax)) return kTRUE;
198 }
199
200 return kFALSE;
0a29d0f1 201
a819a5f7 202}