1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.4 2001/01/22 21:38:46 jbarbosa
19 Dummy padplane dimensions
21 Revision 1.3 2000/10/03 21:44:09 morsch
22 Use AliSegmentation and AliHit abstract base classes.
24 Revision 1.2 2000/10/02 15:48:19 jbarbosa
25 Fixed coding conventions.
27 Revision 1.1 2000/06/12 15:31:54 jbarbosa
31 #include "AliRICHSegmentationV0.h"
34 ClassImp(AliRICHSegmentationV0)
36 //________________________________________________________________________________
37 AliRICHSegmentationV0::AliRICHSegmentationV0()
40 // Default constructor for AliRICHSegmentationV0 (no dead zones)
48 void AliRICHSegmentationV0::Init(Int_t id)
51 // Initialisation of chambers
53 //printf("* Initialising SegmentationV0 (no dead zones) in chamber %d *\n",id+1);
55 // parametrised definition
57 Float_t csi_length = fNpy*fDpy + fDeadZone;
58 Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
60 fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
61 fPadPlane_Length = (csi_length - fDeadZone)/2;
65 Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit) const
68 // Get anod wire closer to hit
70 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
74 void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
82 void AliRICHSegmentationV0::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
84 // returns pad coordinates (ix,iy) for given real coordinates (x,y)
86 // Please check origin of pad numbering !!!
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;
96 void AliRICHSegmentationV0::
97 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
99 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
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.;
106 void AliRICHSegmentationV0::
107 SetHit(Float_t xhit, Float_t yhit)
110 // Find the wire position (center of charge distribution)
111 // Float_t x0a=GetAnod(xhit);
116 void AliRICHSegmentationV0::
117 SetPad(Int_t ix, Int_t iy)
120 // Move to pad ix, iy
122 GetPadC(ix,iy,fX,fY);
127 void AliRICHSegmentationV0::
128 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
132 // Find the wire position (center of charge distribution)
133 Float_t x0a=GetAnod(xhit);
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;
143 // find the pads over which the charge distributes
144 GetPadI(x01,y01,fIxmin,fIymin);
145 GetPadI(x02,y02,fIxmax,fIymax);
147 // Set current pad to lower left corner
150 GetPadC(fIx,fIy,fX,fY);
153 //printf("fIx: %d, fIy: %d fX: %f, fY: %f\n",fIx,fIy,fX,fY);
156 void AliRICHSegmentationV0::NextPad()
158 //printf("\n Next Pad \n");
161 // Step to next pad in integration region
163 // if (fIx==-1) fIx++;
165 } else if (fIy <= fIymax) {
166 // if (fIy==-1) fIy++;
170 printf("\n Error: Stepping outside integration region\n ");
172 GetPadC(fIx,fIy,fX,fY);
175 Int_t AliRICHSegmentationV0::MorePads()
179 // Are there more pads in the integration region
181 //printf("\n More Pads ? \n");
184 if (fIx >= fIxmax && fIy >= fIymax) {
185 //printf("There are no more pads\n\n\n\n\n");
188 //printf("There are more pads\n\n");
193 void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
196 // Initialises pad and wire position during stepping
199 GetPadI(x,y,fIxt,fIyt);
200 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
203 Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
206 // Signal will be generated if particle crosses pad boundary or
207 // boundary between two wires.
209 GetPadI(x,y,ixt,iyt);
210 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
212 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
218 void AliRICHSegmentationV0::
219 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
222 // Calculate the integration limits
236 void AliRICHSegmentationV0::
237 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
239 //Is used for the cluster finder, include diagonal elements
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;
245 Xlist[0]=Xlist[1]=iX;
250 Ylist[2]=Ylist[3]=iY;
267 Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
271 // Returns the square of the distance between 1 pad
272 // labelled by its Channel numbers and a coordinate
276 return (x-X)*(x-X) + (y-Y)*(y-Y);
280 void AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
290 void AliRICHSegmentationV0::Draw(const char* opt) const
293 // Dummy draw routine
297 Float_t scale=0.95/fRmax/2.;
300 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
301 circle->SetFillColor(2);
304 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
305 circle->SetFillColor(1);