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):AliSegmentation(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;
57 //____________________________________________________________________________
58 void AliMUONSegmentationV0::GetNParallelAndOffset(Int_t /*iX*/, Int_t /*iY*/, Int_t *Nparallel, Int_t *Offset)
65 //____________________________________________________________________________
66 void AliMUONSegmentationV0::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy)
68 GetPadI(x, y, ix, iy);
70 //____________________________________________________________________________
71 void AliMUONSegmentationV0::SetCorrFunc(Int_t /*dum*/, TF1* func)
75 //____________________________________________________________________________
76 Int_t AliMUONSegmentationV0::Sector(Int_t /*ix*/, Int_t /*iy*/)
80 //____________________________________________________________________________
81 Int_t AliMUONSegmentationV0::Sector(Float_t /*x*/, Float_t /*y*/)
85 //____________________________________________________________________________
86 void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
94 void AliMUONSegmentationV0::
95 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
97 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
99 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1;
100 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
101 if (iy > fNpy) iy= fNpy;
102 if (iy < -fNpy) iy=-fNpy;
103 if (ix > fNpx) ix= fNpx;
104 if (ix < -fNpx) ix=-fNpx;
107 void AliMUONSegmentationV0::
108 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
110 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
112 // Comments and Critics:
114 // The Pad(0,0) does not exist, this causes in the present version errors
115 // during iteration when used with hits close to zero.
116 // Since we have frame crosses at x=0 or y=0 this does not cause any problems
117 // Nevertheless, should be corrected in the next version !!
118 // The name fRmin is misleading although we use this version with
119 // a circular chamber geometry.
121 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.;
122 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
124 //______________________________________________________________________
125 void AliMUONSegmentationV0::SetHit(Float_t xhit, Float_t yhit)
128 // Sets virtual hit position, needed for evaluating pad response
129 // outside the tracking program
133 //_______________________________________________________________________
134 void AliMUONSegmentationV0::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
138 //_______________________________________________________________________
141 void AliMUONSegmentationV0::
142 SetPad(Int_t ix, Int_t iy)
145 // Sets virtual pad coordinates, needed for evaluating pad response
146 // outside the tracking program
147 GetPadC(ix,iy,fX,fY);
149 //____________________________________________________________________________________
150 void AliMUONSegmentationV0::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
152 // Initialises iteration over pads for charge distribution algorithm
155 // Find the wire position (center of charge distribution)
156 Float_t x0a=GetAnod(xhit);
160 // and take fNsigma*sigma around this center
161 Float_t x01=x0a - dx;
162 Float_t x02=x0a + dx;
163 Float_t y01=yhit - dy;
164 Float_t y02=yhit + dy;
166 // find the pads over which the charge distributes
167 GetPadI(x01,y01,fIxmin,fIymin);
168 GetPadI(x02,y02,fIxmax,fIymax);
170 // Set current pad to lower left corner
173 GetPadC(fIx,fIy,fX,fY);
175 //________________________________________________________________________
176 void AliMUONSegmentationV0::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, Float_t dx, Float_t dy)
177 {FirstPad(xhit, yhit, dx, dy);}
180 void AliMUONSegmentationV0::NextPad()
182 // Stepper for the iteration over pads
184 // Comments and Critics:
185 // Boundary crossing at x=0 or y=0 not correctly handled !
186 // Step to next pad in the integration region
190 } else if (fIy != fIymax) {
195 printf("\n Error: Stepping outside integration region\n ");
197 GetPadC(fIx,fIy,fX,fY);
200 Int_t AliMUONSegmentationV0::MorePads()
202 // Stopping condition for the iterator over pads
204 // Are there more pads in the integration region ?
206 if (fIx == fIxmax && fIy == fIymax) {
214 void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t /*z*/)
217 // Initialises pad and wire position during stepping
220 GetPadI(x,y,fIxt,fIyt);
221 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
224 Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t /*z*/)
226 // Signal generation condition during stepping
227 // 0: don't generate signal
228 // 1: generate signal
229 // Comments and critics:
231 // Crossing of pad boundary and mid plane between neighbouring wires is checked.
232 // To correctly simulate the dependence of the spatial resolution on the angle
233 // of incidence signal must be generated for constant steps on
234 // the projection of the trajectory along the anode wire.
237 // Signal will be generated if particle crosses pad boundary or
238 // boundary between two wires.
240 GetPadI(x,y,ixt,iyt);
241 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
242 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
248 void AliMUONSegmentationV0::
249 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
251 // Returns integration limits for current pad
259 void AliMUONSegmentationV0::
260 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
262 // Returns list of next neighbours for given Pad (iX, iY)
264 // Comments and critics
265 // "Diagonal" neighbours are not passed
266 // Is this ok when we search for local maxima ??
267 // No test whether neighbours have valid indices id performed
269 Xlist[0]=Xlist[1]=iX;
274 Ylist[2]=Ylist[3]=iY;
277 Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
280 // Returns the square of the distance between 1 pad
281 // labelled by its Channel numbers and a coordinate
285 return (x-X)*(x-X) + (y-Y)*(y-Y);
289 void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
291 // Returns test point on the pad plane.
292 // Used during determination of the segmoid correction of the COG-method
294 x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.);
298 void AliMUONSegmentationV0::Draw(const char *) const
300 // Draws the segmentation zones
303 Float_t scale=0.95/fRmax/2.;
306 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
307 circle->SetFillColor(2);
310 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
311 circle->SetFillColor(1);
315 AliMUONSegmentationV0& AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & /*rhs*/)
317 // Dummy assignment operator