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