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