Dummy padplane dimensions
[u/mrichter/AliRoot.git] / RICH / AliRICHSegmentationV0.cxx
CommitLineData
237c933d 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$
485f496c 18 Revision 1.3 2000/10/03 21:44:09 morsch
19 Use AliSegmentation and AliHit abstract base classes.
20
a2f7eaf6 21 Revision 1.2 2000/10/02 15:48:19 jbarbosa
22 Fixed coding conventions.
23
72e468a5 24 Revision 1.1 2000/06/12 15:31:54 jbarbosa
25 Cleaned up version.
26
237c933d 27*/
28#include "AliRICHSegmentationV0.h"
29
30
31ClassImp(AliRICHSegmentationV0)
32
a2f7eaf6 33void AliRICHSegmentationV0::Init(Int_t id)
237c933d 34{
35
36// Initialisation of chambers
37
237c933d 38 fNpx=160;
39 fNpy=144;
40 //fNpx=80;
41 //fNpy=48;
485f496c 42 fPadPlane_Width=-1;
43 fPadPlane_Length=-1;
237c933d 44 fSector=-1;
45}
46
47
a2f7eaf6 48Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit) const
237c933d 49{
50
51// Get anod wire closer to hit
52
53 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
54 return fWireD*wire;
55}
56
57void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
58{
59
60// Set the pad size
61
62 fDpx=p1;
63 fDpy=p2;
64}
a2f7eaf6 65void AliRICHSegmentationV0::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
237c933d 66{
67// returns pad coordinates (ix,iy) for given real coordinates (x,y)
68//
69// Please check origin of pad numbering !!!
70
71
72 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
73 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
74 if (iy > fNpy) iy= fNpy;
75 if (iy < -fNpy) iy=-fNpy;
76 if (ix > fNpx) ix= fNpx;
77 if (ix < -fNpx) ix=-fNpx;
78}
79void AliRICHSegmentationV0::
a2f7eaf6 80GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
237c933d 81{
82// returns real coordinates (x,y) for given pad coordinates (ix,iy)
83//
84
85 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
86 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
87}
88
89void AliRICHSegmentationV0::
90SetHit(Float_t xhit, Float_t yhit)
91{
92//
93// Find the wire position (center of charge distribution)
94// Float_t x0a=GetAnod(xhit);
72e468a5 95 fXhit=xhit;
96 fYhit=yhit;
237c933d 97}
98
99void AliRICHSegmentationV0::
100SetPad(Int_t ix, Int_t iy)
101{
102
103// Move to pad ix, iy
104
a2f7eaf6 105 GetPadC(ix,iy,fX,fY);
237c933d 106}
107
108
109
110void AliRICHSegmentationV0::
111FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
112{
113
114 //
115 // Find the wire position (center of charge distribution)
116 Float_t x0a=GetAnod(xhit);
72e468a5 117 fXhit=x0a;
118 fYhit=yhit;
237c933d 119 //
120 // and take fNsigma*sigma around this center
121 Float_t x01=x0a - dx;
122 Float_t x02=x0a + dx;
123 Float_t y01=yhit - dy;
124 Float_t y02=yhit + dy;
125 //
126 // find the pads over which the charge distributes
a2f7eaf6 127 GetPadI(x01,y01,fIxmin,fIymin);
128 GetPadI(x02,y02,fIxmax,fIymax);
237c933d 129 //
130 // Set current pad to lower left corner
72e468a5 131 fIx=fIxmin;
132 fIy=fIymin;
a2f7eaf6 133 GetPadC(fIx,fIy,fX,fY);
237c933d 134
135 //if (fSector==2)
72e468a5 136 //printf("fIx: %d, fIy: %d fX: %f, fY: %f\n",fIx,fIy,fX,fY);
237c933d 137}
138
139void AliRICHSegmentationV0::NextPad()
140{
141 //printf("\n Next Pad \n");
142
143 //
144 // Step to next pad in integration region
72e468a5 145 if (fIx <= fIxmax) {
146// if (fIx==-1) fIx++;
147 fIx++;
148 } else if (fIy <= fIymax) {
149// if (fIy==-1) fIy++;
150 fIx=fIxmin;
151 fIy++;
237c933d 152 } else {
153 printf("\n Error: Stepping outside integration region\n ");
154 }
a2f7eaf6 155 GetPadC(fIx,fIy,fX,fY);
237c933d 156}
157
158Int_t AliRICHSegmentationV0::MorePads()
159
160{
161//
162// Are there more pads in the integration region
163
164 //printf("\n More Pads ? \n");
165
166
72e468a5 167 if (fIx >= fIxmax && fIy >= fIymax) {
237c933d 168 //printf("There are no more pads\n\n\n\n\n");
169 return 0;
170 } else {
171 //printf("There are more pads\n\n");
172 return 1;
173 }
174}
175
176void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
177{
178//
179// Initialises pad and wire position during stepping
72e468a5 180 fXt =x;
181 fYt =y;
a2f7eaf6 182 GetPadI(x,y,fIxt,fIyt);
72e468a5 183 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
237c933d 184}
185
186Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
187{
188//
189// Signal will be generated if particle crosses pad boundary or
190// boundary between two wires.
191 Int_t ixt, iyt;
a2f7eaf6 192 GetPadI(x,y,ixt,iyt);
237c933d 193 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
194
72e468a5 195 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
237c933d 196 return 1;
197 } else {
198 return 0;
199 }
200}
201void AliRICHSegmentationV0::
202IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
203{
204
205// Calculate the integration limits
206
207/*
72e468a5 208 x1=fXt-fX-fDpx/2.;
237c933d 209 x2=x1+fDpx;
72e468a5 210 y1=fYt-fY-fDpy/2.;
237c933d 211 y2=y1+fDpy;
212*/
72e468a5 213 x1=fXhit-fX-fDpx/2.;
237c933d 214 x2=x1+fDpx;
72e468a5 215 y1=fYhit-fY-fDpy/2.;
237c933d 216 y2=y1+fDpy;
217}
218
219void AliRICHSegmentationV0::
220Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
221{
222//Is used for the cluster finder, include diagonal elements
223
224 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
225 Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
226/*
227 *Nlist=8;
228 Xlist[0]=Xlist[1]=iX;
229 Xlist[2]=iX-1;
230 Xlist[3]=iX+1;
231 Ylist[0]=iY-1;
232 Ylist[1]=iY+1;
233 Ylist[2]=Ylist[3]=iY;
234
235 // Diagonal elements
236 Xlist[4]=iX+1;
237 Ylist[4]=iY+1;
238
239 Xlist[5]=iX-1;
240 Ylist[5]=iY-1;
241
242 Xlist[6]=iX-1;
243 Ylist[6]=iY+1;
244
245 Xlist[7]=iX+1;
246 Ylist[7]=iY-1;
247*/
248}
249
250Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
251, Int_t *dummy)
252
253{
254// Returns the square of the distance between 1 pad
255// labelled by its Channel numbers and a coordinate
256
257 Float_t x,y;
a2f7eaf6 258 GetPadC(iX,iY,x,y);
237c933d 259 return (x-X)*(x-X) + (y-Y)*(y-Y);
260}
261
262
a2f7eaf6 263void AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
237c933d 264{
265
266// Test
267
268 n=1;
269 x[0]=0.;
270 y[0]=x[0];
271}
272
a2f7eaf6 273void AliRICHSegmentationV0::Draw(const char* opt) const
237c933d 274{
275
276// Dummy draw routine
277
278/*
279 TArc *circle;
280 Float_t scale=0.95/fRmax/2.;
281
282
283 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
284 circle->SetFillColor(2);
285 circle->Draw();
286
287 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
288 circle->SetFillColor(1);
289 circle->Draw();
290*/
291 ;
292
293}