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 **************************************************************************/
21 #include "AliMUONSegmentationV0.h"
22 #include "AliMUONChamber.h"
26 ClassImp(AliMUONSegmentationV0)
28 AliMUONSegmentationV0::AliMUONSegmentationV0()
35 AliMUONSegmentationV0::AliMUONSegmentationV0(const AliMUONSegmentationV0& segmentation)
36 : AliSegmentation(segmentation)
38 // Protected copy constructor
40 Fatal("AliMUONSegmentationV0", "Not implemented.");
45 // Commented out - not used
47 void AliMUONSegmentationV0::Init(Int_t chamber)
49 // Initialises member data of the segmentation from geometry data
53 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
54 fChamber=&(pMUON->Chamber(chamber));
56 // Initialise maximum number of pads in x ans y
57 fNpx=(Int_t) (fChamber->ROuter()/fDpx+1);
58 fNpy=(Int_t) (fChamber->ROuter()/fDpy+1);
59 // Initialize inner and outer radius of the sensitive region
60 fRmin=fChamber->RInner();
61 fRmax=fChamber->ROuter();
68 Float_t AliMUONSegmentationV0::GetAnod(Float_t xhit) const
70 // Returns for a hit position xhit the position of the nearest anode wire
71 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
74 //____________________________________________________________________________
75 void AliMUONSegmentationV0::GetNParallelAndOffset(Int_t /*iX*/, Int_t /*iY*/, Int_t *Nparallel, Int_t *Offset)
82 //____________________________________________________________________________
83 void AliMUONSegmentationV0::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy)
85 GetPadI(x, y, ix, iy);
87 //____________________________________________________________________________
88 void AliMUONSegmentationV0::SetCorrFunc(Int_t /*dum*/, TF1* func)
92 //____________________________________________________________________________
93 Int_t AliMUONSegmentationV0::Sector(Int_t /*ix*/, Int_t /*iy*/)
97 //____________________________________________________________________________
98 Int_t AliMUONSegmentationV0::Sector(Float_t /*x*/, Float_t /*y*/)
102 //____________________________________________________________________________
103 void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
111 void AliMUONSegmentationV0::
112 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
114 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
116 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1;
117 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
118 if (iy > fNpy) iy= fNpy;
119 if (iy < -fNpy) iy=-fNpy;
120 if (ix > fNpx) ix= fNpx;
121 if (ix < -fNpx) ix=-fNpx;
124 void AliMUONSegmentationV0::
125 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
127 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
129 // Comments and Critics:
131 // The Pad(0,0) does not exist, this causes in the present version errors
132 // during iteration when used with hits close to zero.
133 // Since we have frame crosses at x=0 or y=0 this does not cause any problems
134 // Nevertheless, should be corrected in the next version !!
135 // The name fRmin is misleading although we use this version with
136 // a circular chamber geometry.
138 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.;
139 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
141 //______________________________________________________________________
142 void AliMUONSegmentationV0::SetHit(Float_t xhit, Float_t yhit)
145 // Sets virtual hit position, needed for evaluating pad response
146 // outside the tracking program
150 //_______________________________________________________________________
151 void AliMUONSegmentationV0::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
155 //_______________________________________________________________________
158 void AliMUONSegmentationV0::
159 SetPad(Int_t ix, Int_t iy)
162 // Sets virtual pad coordinates, needed for evaluating pad response
163 // outside the tracking program
164 GetPadC(ix,iy,fX,fY);
166 //____________________________________________________________________________________
167 void AliMUONSegmentationV0::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
169 // Initialises iteration over pads for charge distribution algorithm
172 // Find the wire position (center of charge distribution)
173 Float_t x0a=GetAnod(xhit);
177 // and take fNsigma*sigma around this center
178 Float_t x01=x0a - dx;
179 Float_t x02=x0a + dx;
180 Float_t y01=yhit - dy;
181 Float_t y02=yhit + dy;
183 // find the pads over which the charge distributes
184 GetPadI(x01,y01,fIxmin,fIymin);
185 GetPadI(x02,y02,fIxmax,fIymax);
187 // Set current pad to lower left corner
190 GetPadC(fIx,fIy,fX,fY);
192 //________________________________________________________________________
193 void AliMUONSegmentationV0::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, Float_t dx, Float_t dy)
194 {FirstPad(xhit, yhit, dx, dy);}
197 void AliMUONSegmentationV0::NextPad()
199 // Stepper for the iteration over pads
201 // Comments and Critics:
202 // Boundary crossing at x=0 or y=0 not correctly handled !
203 // Step to next pad in the integration region
207 } else if (fIy != fIymax) {
212 printf("\n Error: Stepping outside integration region\n ");
214 GetPadC(fIx,fIy,fX,fY);
217 Int_t AliMUONSegmentationV0::MorePads()
219 // Stopping condition for the iterator over pads
221 // Are there more pads in the integration region ?
223 if (fIx == fIxmax && fIy == fIymax) {
231 void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t /*z*/)
234 // Initialises pad and wire position during stepping
237 GetPadI(x,y,fIxt,fIyt);
238 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
241 Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t /*z*/)
243 // Signal generation condition during stepping
244 // 0: don't generate signal
245 // 1: generate signal
246 // Comments and critics:
248 // Crossing of pad boundary and mid plane between neighbouring wires is checked.
249 // To correctly simulate the dependence of the spatial resolution on the angle
250 // of incidence signal must be generated for constant steps on
251 // the projection of the trajectory along the anode wire.
254 // Signal will be generated if particle crosses pad boundary or
255 // boundary between two wires.
257 GetPadI(x,y,ixt,iyt);
258 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
259 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
265 void AliMUONSegmentationV0::
266 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
268 // Returns integration limits for current pad
276 void AliMUONSegmentationV0::
277 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
279 // Returns list of next neighbours for given Pad (iX, iY)
281 // Comments and critics
282 // "Diagonal" neighbours are not passed
283 // Is this ok when we search for local maxima ??
284 // No test whether neighbours have valid indices id performed
286 Xlist[0]=Xlist[1]=iX;
291 Ylist[2]=Ylist[3]=iY;
294 Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
297 // Returns the square of the distance between 1 pad
298 // labelled by its Channel numbers and a coordinate
302 return (x-X)*(x-X) + (y-Y)*(y-Y);
306 void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
308 // Returns test point on the pad plane.
309 // Used during determination of the segmoid correction of the COG-method
311 x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.);
316 // Commented out - not used
318 void AliMUONSegmentationV0::Draw(const char *)
320 // Draws the segmentation zones
323 Float_t scale=0.95/fRmax/2.;
326 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
327 circle->SetFillColor(2);
330 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
331 circle->SetFillColor(1);
336 AliMUONSegmentationV0&
337 AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & rhs)
339 // Protected assignement operator
341 if (this == &rhs) return *this;
343 Fatal("operator=", "Not implemented.");