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 #include "AliMUONSegmentationV0.h"
21 #include "AliMUONChamber.h"
25 ClassImp(AliMUONSegmentationV0)
26 AliMUONSegmentationV0::AliMUONSegmentationV0(const AliMUONSegmentationV0& segmentation)
28 // Dummy copy constructor
31 void AliMUONSegmentationV0::Init(Int_t chamber)
33 // Initialises member data of the segmentation from geometry data
36 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
37 fChamber=&(pMUON->Chamber(chamber));
39 // Initialise maximum number of pads in x ans y
40 fNpx=(Int_t) (fChamber->ROuter()/fDpx+1);
41 fNpy=(Int_t) (fChamber->ROuter()/fDpy+1);
42 // Initialize inner and outer radius of the sensitive region
43 fRmin=fChamber->RInner();
44 fRmax=fChamber->ROuter();
51 Float_t AliMUONSegmentationV0::GetAnod(Float_t xhit) const
53 // Returns for a hit position xhit the position of the nearest anode wire
54 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
58 void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
66 void AliMUONSegmentationV0::
67 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
69 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
71 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1;
72 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
73 if (iy > fNpy) iy= fNpy;
74 if (iy < -fNpy) iy=-fNpy;
75 if (ix > fNpx) ix= fNpx;
76 if (ix < -fNpx) ix=-fNpx;
79 void AliMUONSegmentationV0::
80 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
82 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
84 // Comments and Critics:
86 // The Pad(0,0) does not exist, this causes in the present version errors
87 // during iteration when used with hits close to zero.
88 // Since we have frame crosses at x=0 or y=0 this does not cause any problems
89 // Nevertheless, should be corrected in the next version !!
90 // The name fRmin is misleading although we use this version with
91 // a circular chamber geometry.
93 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.;
94 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
97 void AliMUONSegmentationV0::
98 SetHit(Float_t xhit, Float_t yhit)
101 // Sets virtual hit position, needed for evaluating pad response
102 // outside the tracking program
107 void AliMUONSegmentationV0::
108 SetPad(Int_t ix, Int_t iy)
111 // Sets virtual pad coordinates, needed for evaluating pad response
112 // outside the tracking program
113 GetPadC(ix,iy,fX,fY);
116 void AliMUONSegmentationV0::
117 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
119 // Initialises iteration over pads for charge distribution algorithm
122 // Find the wire position (center of charge distribution)
123 Float_t x0a=GetAnod(xhit);
127 // and take fNsigma*sigma around this center
128 Float_t x01=x0a - dx;
129 Float_t x02=x0a + dx;
130 Float_t y01=yhit - dy;
131 Float_t y02=yhit + dy;
133 // find the pads over which the charge distributes
134 GetPadI(x01,y01,fIxmin,fIymin);
135 GetPadI(x02,y02,fIxmax,fIymax);
137 // Set current pad to lower left corner
140 GetPadC(fIx,fIy,fX,fY);
143 void AliMUONSegmentationV0::NextPad()
145 // Stepper for the iteration over pads
147 // Comments and Critics:
148 // Boundary crossing at x=0 or y=0 not correctly handled !
149 // Step to next pad in the integration region
153 } else if (fIy != fIymax) {
158 printf("\n Error: Stepping outside integration region\n ");
160 GetPadC(fIx,fIy,fX,fY);
163 Int_t AliMUONSegmentationV0::MorePads()
165 // Stopping condition for the iterator over pads
167 // Are there more pads in the integration region ?
169 if (fIx == fIxmax && fIy == fIymax) {
177 void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t z)
180 // Initialises pad and wire position during stepping
183 GetPadI(x,y,fIxt,fIyt);
184 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
187 Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t z)
189 // Signal generation condition during stepping
190 // 0: don't generate signal
191 // 1: generate signal
192 // Comments and critics:
194 // Crossing of pad boundary and mid plane between neighbouring wires is checked.
195 // To correctly simulate the dependence of the spatial resolution on the angle
196 // of incidence signal must be generated for constant steps on
197 // the projection of the trajectory along the anode wire.
200 // Signal will be generated if particle crosses pad boundary or
201 // boundary between two wires.
203 GetPadI(x,y,ixt,iyt);
204 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
205 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
211 void AliMUONSegmentationV0::
212 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
214 // Returns integration limits for current pad
222 void AliMUONSegmentationV0::
223 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
225 // Returns list of next neighbours for given Pad (iX, iY)
227 // Comments and critics
228 // "Diagonal" neighbours are not passed
229 // Is this ok when we search for local maxima ??
230 // No test whether neighbours have valid indices id performed
232 Xlist[0]=Xlist[1]=iX;
237 Ylist[2]=Ylist[3]=iY;
240 Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
243 // Returns the square of the distance between 1 pad
244 // labelled by its Channel numbers and a coordinate
248 return (x-X)*(x-X) + (y-Y)*(y-Y);
252 void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
254 // Returns test point on the pad plane.
255 // Used during determination of the segmoid correction of the COG-method
257 x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.);
261 void AliMUONSegmentationV0::Draw(const char *) const
263 // Draws the segmentation zones
266 Float_t scale=0.95/fRmax/2.;
269 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
270 circle->SetFillColor(2);
273 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
274 circle->SetFillColor(1);
278 AliMUONSegmentationV0& AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & rhs)
280 // Dummy assignment operator