]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtrackingSector.cxx
Geom. volume data class. Can be used during lego run for debugging.
[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$
bbf92647 18Revision 1.4 2000/10/16 01:16:53 cblume
19Changed timebin 0 to be the one closest to the readout
20
ea6a8999 21Revision 1.3 2000/10/15 23:40:01 cblume
22Remove AliTRDconst
23
0e9c2ad5 24Revision 1.2 2000/10/06 16:49:46 cblume
25Made Getters const
26
46d29e70 27Revision 1.1.2.2 2000/10/04 16:34:58 cblume
28Replace include files by forward declarations
29
30Revision 1.1.2.1 2000/09/22 14:47:52 cblume
31Add the tracking code
32
33*/
34
35#include <TObject.h>
36
37#include "AliRun.h"
38
39#include "AliTRD.h"
46d29e70 40#include "AliTRDgeometry.h"
41#include "AliTRDcluster.h"
42#include "AliTRDtimeBin.h"
46d29e70 43#include "AliTRDtrackingSector.h"
44
46d29e70 45ClassImp(AliTRDtrackingSector)
46
47//_______________________________________________________
48
49AliTRDtrackingSector::~AliTRDtrackingSector()
50{
51 //
52 // Destructor
53 //
54
55 delete[] fTimeBin;
56
57}
58
59//_______________________________________________________
60AliTRDtimeBin &AliTRDtrackingSector::operator[](Int_t i)
61{
62 //
63 // Index operator
64 //
65
66 return *(fTimeBin+i);
67
68}
69
70//_______________________________________________________
71
72void AliTRDtrackingSector::SetUp()
73{
46d29e70 74 AliTRD *TRD = (AliTRD*) gAlice->GetDetector("TRD");
75 fGeom = TRD->GetGeometry();
76
77 fTimeBinSize = fGeom->GetTimeBinSize();
78
0e9c2ad5 79 fN = AliTRDgeometry::Nplan() * (Int_t(AliTRDgeometry::DrThick()
80 /fTimeBinSize) + 1);
46d29e70 81
82 fTimeBin = new AliTRDtimeBin[fN];
83
84}
85
86//______________________________________________________
87
88Double_t AliTRDtrackingSector::GetX(Int_t l) const
89{
90 if( (l<0) || (l>fN-1)) {
91 fprintf(stderr,"AliTRDtrackingSector::GetX: TimeBin index is out of range !\n");
92 return -99999.;
93 }
94 else {
95
0e9c2ad5 96 Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
46d29e70 97 Int_t plane = l/tb_per_plane;
0e9c2ad5 98 Int_t time_slice = l%(Int_t(AliTRDgeometry::DrThick()
99 /fTimeBinSize) + 1);
46d29e70 100
101 Float_t t0 = fGeom->GetTime0(plane);
bbf92647 102 Double_t x = t0 - time_slice * fTimeBinSize;
46d29e70 103
104 return x;
105 }
106}
107
108//______________________________________________________
109
110Double_t AliTRDtrackingSector::GetMaxY(Int_t l) const
111{
112
113 if((l<(fN-1)) && (l>-1)) {
0e9c2ad5 114 Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
46d29e70 115 Int_t plane = l/tb_per_plane;
116 return fGeom->GetChamberWidth(plane);
117 }
118 else {
119 fprintf(stderr,
120 "AliTRDtrackingSector::GetMaxY: TimeBin index is out of range !\n");
121 if(l<0) return fGeom->GetChamberWidth(0);
0e9c2ad5 122 else return fGeom->GetChamberWidth(AliTRDgeometry::Nplan()-1);
46d29e70 123 }
124}
125
126//______________________________________________________
127
128Int_t AliTRDtrackingSector::GetTimeBinNumber(Double_t x) const
129{
ea6a8999 130 Float_t r_out = fGeom->GetTime0(AliTRDgeometry::Nplan()-1);
bbf92647 131 Float_t r_in = fGeom->GetTime0(0) - AliTRDgeometry::DrThick();
46d29e70 132
133 if(x >= r_out) return fN-1;
134 if(x <= r_in) return 0;
135
136 Float_t gap = fGeom->GetTime0(1) - fGeom->GetTime0(0);
46d29e70 137
138 Int_t plane = Int_t((x - r_in + fTimeBinSize/2)/gap);
46d29e70 139
bbf92647 140 Int_t local_tb = Int_t((fGeom->GetTime0(plane)-x)/fTimeBinSize + 0.5);
141
46d29e70 142
bbf92647 143 Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
144
145 Int_t time_bin = plane * (Int_t(AliTRDgeometry::DrThick()/fTimeBinSize) + 1)
146 + (tb_per_plane - 1 - local_tb);
46d29e70 147
148 return time_bin;
149}
150
151//______________________________________________________
152
153Int_t AliTRDtrackingSector::GetTimeBin(Int_t det, Int_t local_tb) const
154{
155 Int_t plane = fGeom->GetPlane(det);
156
bbf92647 157 Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
158
159 Int_t time_bin = plane * (Int_t(AliTRDgeometry::DrThick()/fTimeBinSize) + 1)
160 + (tb_per_plane - 1 - local_tb);
161
46d29e70 162 return time_bin;
163}
164