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.5 2001/02/13 20:12:39 jbarbosa
19 Moved setting of variables to constructor. Init is now responsible for calculating padplane dimensions.
21 Revision 1.4 2001/01/22 21:38:46 jbarbosa
22 Dummy padplane dimensions
24 Revision 1.3 2000/10/03 21:44:09 morsch
25 Use AliSegmentation and AliHit abstract base classes.
27 Revision 1.2 2000/10/02 15:48:19 jbarbosa
28 Fixed coding conventions.
30 Revision 1.1 2000/06/12 15:31:54 jbarbosa
34 #include "AliRICHSegmentationV0.h"
37 ClassImp(AliRICHSegmentationV0)
39 //________________________________________________________________________________
40 AliRICHSegmentationV0::AliRICHSegmentationV0()
43 // Default constructor for AliRICHSegmentationV0 (no dead zones)
52 void AliRICHSegmentationV0::Init(Int_t id)
55 // Initialisation of chambers
57 //printf("* Initialising SegmentationV0 (no dead zones) in chamber %d *\n",id+1);
59 // parametrised definition
61 Float_t csi_length = fNpy*fDpy + fDeadZone;
62 Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
64 fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
65 fPadPlane_Length = (csi_length - fDeadZone)/2;
69 Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit) const
72 // Get anod wire closer to hit
74 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
78 void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
86 void AliRICHSegmentationV0::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
88 // returns pad coordinates (ix,iy) for given real coordinates (x,y)
90 // Please check origin of pad numbering !!!
93 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
94 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
95 if (iy > fNpy) iy= fNpy;
96 if (iy < -fNpy) iy=-fNpy;
97 if (ix > fNpx) ix= fNpx;
98 if (ix < -fNpx) ix=-fNpx;
100 void AliRICHSegmentationV0::
101 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
103 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
106 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
107 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
110 void AliRICHSegmentationV0::
111 SetHit(Float_t xhit, Float_t yhit)
114 // Find the wire position (center of charge distribution)
115 // Float_t x0a=GetAnod(xhit);
120 void AliRICHSegmentationV0::
121 SetPad(Int_t ix, Int_t iy)
124 // Move to pad ix, iy
126 GetPadC(ix,iy,fX,fY);
131 void AliRICHSegmentationV0::
132 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
136 // Find the wire position (center of charge distribution)
137 Float_t x0a=GetAnod(xhit);
141 // and take fNsigma*sigma around this center
142 Float_t x01=x0a - dx;
143 Float_t x02=x0a + dx;
144 Float_t y01=yhit - dy;
145 Float_t y02=yhit + dy;
147 // find the pads over which the charge distributes
148 GetPadI(x01,y01,fIxmin,fIymin);
149 GetPadI(x02,y02,fIxmax,fIymax);
151 // Set current pad to lower left corner
154 GetPadC(fIx,fIy,fX,fY);
157 //printf("fIx: %d, fIy: %d fX: %f, fY: %f\n",fIx,fIy,fX,fY);
160 void AliRICHSegmentationV0::NextPad()
162 //printf("\n Next Pad \n");
165 // Step to next pad in integration region
167 // if (fIx==-1) fIx++;
169 } else if (fIy <= fIymax) {
170 // if (fIy==-1) fIy++;
174 printf("\n Error: Stepping outside integration region\n ");
176 GetPadC(fIx,fIy,fX,fY);
179 Int_t AliRICHSegmentationV0::MorePads()
183 // Are there more pads in the integration region
185 //printf("\n More Pads ? \n");
188 if (fIx >= fIxmax && fIy >= fIymax) {
189 //printf("There are no more pads\n\n\n\n\n");
192 //printf("There are more pads\n\n");
197 void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
200 // Initialises pad and wire position during stepping
203 GetPadI(x,y,fIxt,fIyt);
204 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
207 Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
210 // Signal will be generated if particle crosses pad boundary or
211 // boundary between two wires.
213 GetPadI(x,y,ixt,iyt);
214 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
216 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
222 void AliRICHSegmentationV0::
223 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
226 // Calculate the integration limits
240 void AliRICHSegmentationV0::
241 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
243 //Is used for the cluster finder, include diagonal elements
245 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
246 Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
249 Xlist[0]=Xlist[1]=iX;
254 Ylist[2]=Ylist[3]=iY;
271 Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
275 // Returns the square of the distance between 1 pad
276 // labelled by its Channel numbers and a coordinate
280 return (x-X)*(x-X) + (y-Y)*(y-Y);
284 void AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
294 void AliRICHSegmentationV0::Draw(const char* opt) const
297 // Dummy draw routine
301 Float_t scale=0.95/fRmax/2.;
304 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
305 circle->SetFillColor(2);
308 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
309 circle->SetFillColor(1);