]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtrackingSector.cxx
Gsbool and GetMCGeomType added
[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.6  2001/05/28 17:07:58  hristov
19 Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh)
20
21 Revision 1.5  2000/12/08 16:07:02  cblume
22 Update of the tracking by Sergei
23
24 Revision 1.4  2000/10/16 01:16:53  cblume
25 Changed timebin 0 to be the one closest to the readout
26
27 Revision 1.3  2000/10/15 23:40:01  cblume
28 Remove AliTRDconst
29
30 Revision 1.2  2000/10/06 16:49:46  cblume
31 Made Getters const
32
33 Revision 1.1.2.2  2000/10/04 16:34:58  cblume
34 Replace include files by forward declarations
35
36 Revision 1.1.2.1  2000/09/22 14:47:52  cblume
37 Add the tracking code
38
39 */                        
40                                 
41 #include <TObject.h>
42
43 #include "AliRun.h"
44
45 #include "AliTRD.h" 
46 #include "AliTRDgeometry.h" 
47 #include "AliTRDcluster.h" 
48 #include "AliTRDtimeBin.h" 
49 #include "AliTRDtrackingSector.h" 
50
51 ClassImp(AliTRDtrackingSector) 
52
53 //_______________________________________________________
54
55 AliTRDtrackingSector::~AliTRDtrackingSector()
56 {
57   //
58   // Destructor
59   //
60
61   delete fTimeBin;
62
63 }
64
65 //_______________________________________________________
66 AliTRDtimeBin &AliTRDtrackingSector::operator[](Int_t i)
67 {
68   //
69   // Index operator 
70   //
71
72   return *(fTimeBin+i);
73
74 }
75
76 //_______________________________________________________
77
78 void AliTRDtrackingSector::SetUp()
79
80   AliTRD *TRD = (AliTRD*) gAlice->GetDetector("TRD");
81   fGeom = TRD->GetGeometry();
82
83   fTimeBinSize = fGeom->GetTimeBinSize();
84
85   fN = AliTRDgeometry::Nplan() * (Int_t(AliTRDgeometry::DrThick()
86                                        /fTimeBinSize) + 1);
87
88   fTimeBin = new AliTRDtimeBin[fN]; 
89
90 }
91
92 //______________________________________________________
93
94 Double_t AliTRDtrackingSector::GetX(Int_t tb) const
95 {
96   if( (tb<0) || (tb>fN-1)) {
97     fprintf(stderr,"AliTRDtrackingSector::GetX: TimeBin index is out of range !\n");
98     return -99999.;
99   }
100   else { 
101     
102     Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
103     Int_t local_tb = tb_per_plane - tb%tb_per_plane - 1;
104
105     Int_t plane = tb/tb_per_plane;
106     Float_t t0 = fGeom->GetTime0(plane);
107     Double_t x = t0 - (local_tb + 0.5) * fTimeBinSize;
108
109     return x;
110   }
111 }
112
113 //______________________________________________________
114
115 Int_t AliTRDtrackingSector::GetTimeBinNumber(Double_t x) const
116 {
117   Float_t r_out = fGeom->GetTime0(AliTRDgeometry::Nplan()-1); 
118   Float_t r_in = fGeom->GetTime0(0) - AliTRDgeometry::DrThick();
119
120
121   if(x >= r_out) return fN-1;
122   if(x <= r_in) return 0;
123
124   Int_t plane;
125   for (plane = AliTRDgeometry::Nplan()-1; plane >= 0; plane--) {
126     if(x > (fGeom->GetTime0(plane) - AliTRDgeometry::DrThick())) break;
127   }  
128  
129   Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
130   Int_t local_tb = Int_t((fGeom->GetTime0(plane)-x)/fTimeBinSize);
131
132   if((local_tb < 0) || (local_tb >= tb_per_plane)) {
133     printf("AliTRDtrackingSector::GetTimeBinNumber: \n");
134     printf("local time bin %d is out of bounds [0..%d]: x = %f \n",
135            local_tb,tb_per_plane-1,x);
136     return -1;
137   }
138       
139   Int_t time_bin = (plane + 1) * tb_per_plane - 1 - local_tb;
140
141   return time_bin;
142 }
143
144 //______________________________________________________
145
146 Int_t AliTRDtrackingSector::GetTimeBin(Int_t det, Int_t local_tb) const 
147 {
148   Int_t plane = fGeom->GetPlane(det);
149
150   Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
151
152   Int_t time_bin = (plane + 1) * tb_per_plane - 1 - local_tb;
153
154   return time_bin;
155 }
156
157
158 //______________________________________________________
159
160 Bool_t AliTRDtrackingSector::TECframe(Int_t tb, Double_t y, Double_t z) const
161 {
162 // 
163 // Returns <true> if point defined by <x(tb),y,z> is within 
164 // the TEC G10 frame, otherwise returns <false>  
165 //  
166
167   if((tb > (fN-1)) || (tb < 0)) return kFALSE; 
168
169   Int_t tb_per_plane = fN/AliTRDgeometry::Nplan();
170   Int_t plane = tb/tb_per_plane;
171   
172   Double_t x = GetX(tb);
173   y = TMath::Abs(y);
174
175   if((y > fGeom->GetChamberWidth(plane)/2.) &&
176      (y < x*TMath::Tan(0.5*AliTRDgeometry::GetAlpha()))) return kTRUE; 
177
178   Double_t zmin, zmax;
179   Float_t  fRowPadSize, fRow0;
180   Int_t    nPadRows;
181
182   for(Int_t iCha = 1; iCha < AliTRDgeometry::Ncham(); iCha++) {
183
184     fRow0 = fGeom->GetRow0(plane,iCha-1,0);
185     fRowPadSize = fGeom->GetRowPadSize(plane,iCha-1,0);
186     nPadRows = fGeom->GetRowMax(plane,iCha-1,0);
187     zmin = fRow0 - fRowPadSize/2 + fRowPadSize * nPadRows;
188
189     fRow0 = fGeom->GetRow0(plane,iCha,0);
190     fRowPadSize = fGeom->GetRowPadSize(plane,iCha,0);
191     zmax = fRow0 - fRowPadSize/2;
192
193     if((z > zmin) && (z < zmax)) return kTRUE;     
194   }
195
196   return kFALSE;
197 }