Change AliTRDdataArrayI to AliTRDdataArray in MakeBranch()
[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$
ea6a8999 18Revision 1.3 2000/10/15 23:40:01 cblume
19Remove AliTRDconst
20
0e9c2ad5 21Revision 1.2 2000/10/06 16:49:46 cblume
22Made Getters const
23
46d29e70 24Revision 1.1.2.2 2000/10/04 16:34:58 cblume
25Replace include files by forward declarations
26
27Revision 1.1.2.1 2000/09/22 14:47:52 cblume
28Add the tracking code
29
30*/
31
32#include <TObject.h>
33
34#include "AliRun.h"
35
36#include "AliTRD.h"
46d29e70 37#include "AliTRDgeometry.h"
38#include "AliTRDcluster.h"
39#include "AliTRDtimeBin.h"
46d29e70 40#include "AliTRDtrackingSector.h"
41
46d29e70 42ClassImp(AliTRDtrackingSector)
43
44//_______________________________________________________
45
46AliTRDtrackingSector::~AliTRDtrackingSector()
47{
48 //
49 // Destructor
50 //
51
52 delete[] fTimeBin;
53
54}
55
56//_______________________________________________________
57AliTRDtimeBin &AliTRDtrackingSector::operator[](Int_t i)
58{
59 //
60 // Index operator
61 //
62
63 return *(fTimeBin+i);
64
65}
66
67//_______________________________________________________
68
69void AliTRDtrackingSector::SetUp()
70{
71
72 AliTRD *TRD = (AliTRD*) gAlice->GetDetector("TRD");
73 fGeom = TRD->GetGeometry();
74
75 fTimeBinSize = fGeom->GetTimeBinSize();
76
0e9c2ad5 77 fN = AliTRDgeometry::Nplan() * (Int_t(AliTRDgeometry::DrThick()
78 /fTimeBinSize) + 1);
46d29e70 79
80 fTimeBin = new AliTRDtimeBin[fN];
81
82}
83
84//______________________________________________________
85
86Double_t AliTRDtrackingSector::GetX(Int_t l) const
87{
88 if( (l<0) || (l>fN-1)) {
89 fprintf(stderr,"AliTRDtrackingSector::GetX: TimeBin index is out of range !\n");
90 return -99999.;
91 }
92 else {
93
0e9c2ad5 94 Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
46d29e70 95 Int_t plane = l/tb_per_plane;
0e9c2ad5 96 Int_t time_slice = l%(Int_t(AliTRDgeometry::DrThick()
97 /fTimeBinSize) + 1);
46d29e70 98
99 Float_t t0 = fGeom->GetTime0(plane);
100 Double_t x = t0 + time_slice * fTimeBinSize;
101
102 // cerr<<"plane, tb, x = "<<plane<<","<<time_slice<<","<<x<<endl;
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)
131 // + AliTRDgeometry::DrThick();
132 // Changed to new time0 (CBL)
133 Float_t r_out = fGeom->GetTime0(AliTRDgeometry::Nplan()-1);
46d29e70 134 Float_t r_in = fGeom->GetTime0(0);
135 // cerr<<"GetTimeBinNumber: r_in,r_out = "<<r_in<<","<<r_out<<endl;
136
137 if(x >= r_out) return fN-1;
138 if(x <= r_in) return 0;
139
140 Float_t gap = fGeom->GetTime0(1) - fGeom->GetTime0(0);
141 // cerr<<"GetTimeBinNumber: gap = "<<gap<<endl;
142
143 Int_t plane = Int_t((x - r_in + fTimeBinSize/2)/gap);
144 // cerr<<"GetTimeBinNumber: plane="<<plane<<endl;
145
146 Int_t local_tb = Int_t((x-fGeom->GetTime0(plane))/fTimeBinSize + 0.5);
147 // cerr<<"GetTimeBinNumber: local_tb="<<local_tb<<endl;
148
0e9c2ad5 149 Int_t time_bin = plane * (Int_t(AliTRDgeometry::DrThick()
150 /fTimeBinSize) + 1) + local_tb;
46d29e70 151 // cerr<<"GetTimeBinNumber: time_bin = "<<time_bin<<endl;
152
153
154 return time_bin;
155}
156
157//______________________________________________________
158
159Int_t AliTRDtrackingSector::GetTimeBin(Int_t det, Int_t local_tb) const
160{
161 Int_t plane = fGeom->GetPlane(det);
162
0e9c2ad5 163 Int_t time_bin = plane * (Int_t(AliTRDgeometry::DrThick()
164 /fTimeBinSize) + 1) + local_tb;
46d29e70 165 return time_bin;
166}
167