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 **************************************************************************/
17 Revision 1.2 2000/06/15 07:58:48 morsch
18 Code from MUON-dev joined
20 Revision 1.1.2.2 2000/06/12 07:57:23 morsch
23 Revision 1.1.2.1 2000/06/09 21:30:33 morsch
24 AliMUONSegmentationV0 code from AliMUONSegResV0.cxx
28 #include "AliMUONSegmentationV0.h"
31 #include "AliMUONChamber.h"
35 ClassImp(AliMUONSegmentationV0)
36 AliMUONSegmentationV0::AliMUONSegmentationV0(const AliMUONSegmentationV0& segmentation)
38 // Dummy copy constructor
41 void AliMUONSegmentationV0::Init(Int_t chamber)
43 // Initialises member data of the segmentation from geometry data
46 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
47 AliMUONChamber* iChamber=&(pMUON->Chamber(chamber));
49 // Initialise maximum number of pads in x ans y
50 fNpx=(Int_t) (iChamber->ROuter()/fDpx+1);
51 fNpy=(Int_t) (iChamber->ROuter()/fDpy+1);
52 // Initialize inner and outer radius of the sensitive region
53 fRmin=iChamber->RInner();
54 fRmax=iChamber->ROuter();
60 Float_t AliMUONSegmentationV0::GetAnod(Float_t xhit)
62 // Returns for a hit position xhit the position of the nearest anode wire
63 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
67 void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
74 void AliMUONSegmentationV0::
75 GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
77 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
79 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1;
80 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
81 if (iy > fNpy) iy= fNpy;
82 if (iy < -fNpy) iy=-fNpy;
83 if (ix > fNpx) ix= fNpx;
84 if (ix < -fNpx) ix=-fNpx;
86 void AliMUONSegmentationV0::
87 GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
89 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
91 // Comments and Critics:
93 // The Pad(0,0) does not exist, this causes in the present version errors
94 // during iteration when used with hits close to zero.
95 // Since we have frame crosses at x=0 or y=0 this does not cause any problems
96 // Nevertheless, should be corrected in the next version !!
97 // The name fRmin is misleading although we use this version with
98 // a circular chamber geometry.
100 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.;
101 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
104 void AliMUONSegmentationV0::
105 SetHit(Float_t xhit, Float_t yhit)
108 // Sets virtual hit position, needed for evaluating pad response
109 // outside the tracking program
114 void AliMUONSegmentationV0::
115 SetPad(Int_t ix, Int_t iy)
118 // Sets virtual pad coordinates, needed for evaluating pad response
119 // outside the tracking program
120 GetPadCxy(ix,iy,fx,fy);
123 void AliMUONSegmentationV0::
124 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
126 // Initialises iteration over pads for charge distribution algorithm
129 // Find the wire position (center of charge distribution)
130 Float_t x0a=GetAnod(xhit);
134 // and take fNsigma*sigma around this center
135 Float_t x01=x0a - dx;
136 Float_t x02=x0a + dx;
137 Float_t y01=yhit - dy;
138 Float_t y02=yhit + dy;
140 // find the pads over which the charge distributes
141 GetPadIxy(x01,y01,fixmin,fiymin);
142 GetPadIxy(x02,y02,fixmax,fiymax);
144 // Set current pad to lower left corner
147 GetPadCxy(fix,fiy,fx,fy);
150 void AliMUONSegmentationV0::NextPad()
152 // Stepper for the iteration over pads
154 // Comments and Critics:
155 // Boundary crossing at x=0 or y=0 not correctly handled !
156 // Step to next pad in the integration region
160 } else if (fiy != fiymax) {
165 printf("\n Error: Stepping outside integration region\n ");
167 GetPadCxy(fix,fiy,fx,fy);
170 Int_t AliMUONSegmentationV0::MorePads()
171 // Stopping condition for the iterator over pads
173 // Are there more pads in the integration region ?
175 if (fix == fixmax && fiy == fiymax) {
183 void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t z)
186 // Initialises pad and wire position during stepping
189 GetPadIxy(x,y,fixt,fiyt);
190 fiwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
193 Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t z)
195 // Signal generation condition during stepping
196 // 0: don't generate signal
197 // 1: generate signal
198 // Comments and critics:
200 // Crossing of pad boundary and mid plane between neighbouring wires is checked.
201 // To correctly simulate the dependence of the spatial resolution on the angle
202 // of incidence signal must be generated for constant steps on
203 // the projection of the trajectory along the anode wire.
206 // Signal will be generated if particle crosses pad boundary or
207 // boundary between two wires.
209 GetPadIxy(x,y,ixt,iyt);
210 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
211 if ((ixt != fixt) || (iyt !=fiyt) || (iwt != fiwt)) {
217 void AliMUONSegmentationV0::
218 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
220 // Returns integration limits for current pad
228 void AliMUONSegmentationV0::
229 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
231 // Returns list of next neighbours for given Pad (iX, iY)
233 // Comments and critics
234 // "Diagonal" neighbours are not passed
235 // Is this ok when we search for local maxima ??
236 // No test whether neighbours have valid indices id performed
238 Xlist[0]=Xlist[1]=iX;
243 Ylist[2]=Ylist[3]=iY;
246 Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
248 // Returns the square of the distance between 1 pad
249 // labelled by its Channel numbers and a coordinate
252 GetPadCxy(iX,iY,x,y);
253 return (x-X)*(x-X) + (y-Y)*(y-Y);
257 void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y)
259 // Returns test point on the pad plane.
260 // Used during determination of the segmoid correction of the COG-method
262 x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.);
266 void AliMUONSegmentationV0::Draw()
268 // Draws the segmentation zones
271 Float_t scale=0.95/fRmax/2.;
274 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
275 circle->SetFillColor(2);
278 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
279 circle->SetFillColor(1);
283 AliMUONSegmentationV0& AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & rhs)
285 // Dummy assignment operator