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.2 2000/10/02 15:48:19 jbarbosa
19 Fixed coding conventions.
21 Revision 1.1 2000/06/12 15:31:54 jbarbosa
25 #include "AliRICHSegmentationV0.h"
28 ClassImp(AliRICHSegmentationV0)
30 void AliRICHSegmentationV0::Init(Int_t id)
33 // Initialisation of chambers
43 Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit) const
46 // Get anod wire closer to hit
48 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
52 void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
60 void AliRICHSegmentationV0::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
62 // returns pad coordinates (ix,iy) for given real coordinates (x,y)
64 // Please check origin of pad numbering !!!
67 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
68 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
69 if (iy > fNpy) iy= fNpy;
70 if (iy < -fNpy) iy=-fNpy;
71 if (ix > fNpx) ix= fNpx;
72 if (ix < -fNpx) ix=-fNpx;
74 void AliRICHSegmentationV0::
75 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
77 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
80 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
81 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
84 void AliRICHSegmentationV0::
85 SetHit(Float_t xhit, Float_t yhit)
88 // Find the wire position (center of charge distribution)
89 // Float_t x0a=GetAnod(xhit);
94 void AliRICHSegmentationV0::
95 SetPad(Int_t ix, Int_t iy)
100 GetPadC(ix,iy,fX,fY);
105 void AliRICHSegmentationV0::
106 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
110 // Find the wire position (center of charge distribution)
111 Float_t x0a=GetAnod(xhit);
115 // and take fNsigma*sigma around this center
116 Float_t x01=x0a - dx;
117 Float_t x02=x0a + dx;
118 Float_t y01=yhit - dy;
119 Float_t y02=yhit + dy;
121 // find the pads over which the charge distributes
122 GetPadI(x01,y01,fIxmin,fIymin);
123 GetPadI(x02,y02,fIxmax,fIymax);
125 // Set current pad to lower left corner
128 GetPadC(fIx,fIy,fX,fY);
131 //printf("fIx: %d, fIy: %d fX: %f, fY: %f\n",fIx,fIy,fX,fY);
134 void AliRICHSegmentationV0::NextPad()
136 //printf("\n Next Pad \n");
139 // Step to next pad in integration region
141 // if (fIx==-1) fIx++;
143 } else if (fIy <= fIymax) {
144 // if (fIy==-1) fIy++;
148 printf("\n Error: Stepping outside integration region\n ");
150 GetPadC(fIx,fIy,fX,fY);
153 Int_t AliRICHSegmentationV0::MorePads()
157 // Are there more pads in the integration region
159 //printf("\n More Pads ? \n");
162 if (fIx >= fIxmax && fIy >= fIymax) {
163 //printf("There are no more pads\n\n\n\n\n");
166 //printf("There are more pads\n\n");
171 void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
174 // Initialises pad and wire position during stepping
177 GetPadI(x,y,fIxt,fIyt);
178 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
181 Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
184 // Signal will be generated if particle crosses pad boundary or
185 // boundary between two wires.
187 GetPadI(x,y,ixt,iyt);
188 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
190 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
196 void AliRICHSegmentationV0::
197 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
200 // Calculate the integration limits
214 void AliRICHSegmentationV0::
215 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
217 //Is used for the cluster finder, include diagonal elements
219 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
220 Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
223 Xlist[0]=Xlist[1]=iX;
228 Ylist[2]=Ylist[3]=iY;
245 Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
249 // Returns the square of the distance between 1 pad
250 // labelled by its Channel numbers and a coordinate
254 return (x-X)*(x-X) + (y-Y)*(y-Y);
258 void AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
268 void AliRICHSegmentationV0::Draw(const char* opt) const
271 // Dummy draw routine
275 Float_t scale=0.95/fRmax/2.;
278 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
279 circle->SetFillColor(2);
282 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
283 circle->SetFillColor(1);