1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /////////////////////////////////////////////////////////////////////////
22 /////////////////////////////////////////////////////////////////////////
29 #include "AliTRDgeometry.h"
30 #include "AliTRDcluster.h"
31 #include "AliTRDtimeBin.h"
32 #include "AliTRDtrackingSector.h"
33 #include "AliTRDparameter.h"
35 ClassImp(AliTRDtrackingSector)
37 //_______________________________________________________
38 AliTRDtrackingSector::~AliTRDtrackingSector()
48 //_______________________________________________________
49 AliTRDtimeBin &AliTRDtrackingSector::operator[](Int_t i)
59 //_______________________________________________________
60 void AliTRDtrackingSector::SetUp()
66 AliTRD *trd = (AliTRD*) gAlice->GetDetector("TRD");
67 fGeom = trd->GetGeometry();
69 fTimeBinSize = fGeom->GetTimeBinSize();
71 fN = AliTRDgeometry::Nplan() * (Int_t(AliTRDgeometry::DrThick()
74 fTimeBin = new AliTRDtimeBin[fN];
77 fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
80 fTimeBinSize = fPar->GetTimeBinSize();
84 //______________________________________________________
85 Double_t AliTRDtrackingSector::GetX(Int_t tb) const
88 // Get global x coordinate
91 if( (tb<0) || (tb>fN-1)) {
92 fprintf(stderr,"AliTRDtrackingSector::GetX: TimeBin index is out of range !\n");
97 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
98 Int_t localTb = tbPerPlane - tb%tbPerPlane - 1;
100 Int_t plane = tb/tbPerPlane;
101 Float_t t0 = fPar->GetTime0(plane);
102 Double_t x = t0 - (localTb + 0.5) * fTimeBinSize;
110 //______________________________________________________
111 Int_t AliTRDtrackingSector::GetTimeBinNumber(Double_t x) const
114 // Returns the time bin number
117 Float_t rOut = fPar->GetTime0(AliTRDgeometry::Nplan()-1);
118 Float_t rIn = fPar->GetTime0(0) - AliTRDgeometry::DrThick();
121 if(x >= rOut) return fN-1;
122 if(x <= rIn) return 0;
125 for (plane = AliTRDgeometry::Nplan()-1; plane >= 0; plane--) {
126 if(x > (fPar->GetTime0(plane) - AliTRDgeometry::DrThick())) break;
129 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
130 Int_t localTb = Int_t((fPar->GetTime0(plane)-x)/fTimeBinSize);
132 if((localTb < 0) || (localTb >= tbPerPlane)) {
133 printf("AliTRDtrackingSector::GetTimeBinNumber: \n");
134 printf("local time bin %d is out of bounds [0..%d]: x = %f \n",
135 localTb,tbPerPlane-1,x);
139 Int_t timeBin = (plane + 1) * tbPerPlane - 1 - localTb;
144 //______________________________________________________
145 Int_t AliTRDtrackingSector::GetTimeBin(Int_t det, Int_t localTb) const
151 Int_t plane = fGeom->GetPlane(det);
153 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
155 Int_t timeBin = (plane + 1) * tbPerPlane - 1 - localTb;
162 //______________________________________________________
164 Bool_t AliTRDtrackingSector::TECframe(Int_t tb, Double_t y, Double_t z) const
167 // Returns <true> if point defined by <x(tb),y,z> is within
168 // the TEC G10 frame, otherwise returns <false>
171 if((tb > (fN-1)) || (tb < 0)) return kFALSE;
173 Int_t tbPerPlane = fN/AliTRDgeometry::Nplan();
174 Int_t plane = tb/tbPerPlane;
176 Double_t x = GetX(tb);
179 if((y > fGeom->GetChamberWidth(plane)/2.) &&
180 (y < x*TMath::Tan(0.5*AliTRDgeometry::GetAlpha()))) return kTRUE;
183 Float_t fRowPadSize, fRow0;
186 for(Int_t iCha = 1; iCha < AliTRDgeometry::Ncham(); iCha++) {
188 fRow0 = fPar->GetRow0(plane,iCha-1,0);
189 fRowPadSize = fPar->GetRowPadSize(plane,iCha-1,0);
190 nPadRows = fPar->GetRowMax(plane,iCha-1,0);
191 zmin = fRow0 - fRowPadSize/2 + fRowPadSize * nPadRows;
193 fRow0 = fPar->GetRow0(plane,iCha,0);
194 fRowPadSize = fPar->GetRowPadSize(plane,iCha,0);
195 zmax = fRow0 - fRowPadSize/2;
197 if((z > zmin) && (z < zmax)) return kTRUE;