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.8 2000/10/18 11:42:06 morsch
18 - AliMUONRawCluster contains z-position.
19 - Some clean-up of useless print statements during initialisations.
21 Revision 1.7 2000/10/03 21:48:07 morsch
22 Adopt to const declaration of some of the methods in AliSegmentation.
24 Revision 1.6 2000/10/02 16:58:29 egangler
25 Cleaning of the code :
28 -> some useless includes removed or replaced by "class" statement
30 Revision 1.5 2000/07/13 16:19:44 fca
31 Mainly coding conventions + some small bug fixes
33 Revision 1.4 2000/07/03 11:54:57 morsch
34 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
35 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
37 Revision 1.3 2000/06/29 12:34:09 morsch
38 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
39 it usable with any other geometry class. The link to the object to which it belongs is
40 established via an index. This assumes that there exists a global geometry manager
41 from which the pointer to the parent object can be obtained (in our case gAlice).
43 Revision 1.2 2000/06/15 07:58:48 morsch
44 Code from MUON-dev joined
46 Revision 1.1.2.2 2000/06/12 07:57:23 morsch
49 Revision 1.1.2.1 2000/06/09 21:30:33 morsch
50 AliMUONSegmentationV0 code from AliMUONSegResV0.cxx
54 #include "AliMUONSegmentationV0.h"
57 #include "AliMUONChamber.h"
61 ClassImp(AliMUONSegmentationV0)
62 AliMUONSegmentationV0::AliMUONSegmentationV0(const AliMUONSegmentationV0& segmentation)
64 // Dummy copy constructor
67 void AliMUONSegmentationV0::Init(Int_t chamber)
69 // Initialises member data of the segmentation from geometry data
72 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
73 fChamber=&(pMUON->Chamber(chamber));
75 // Initialise maximum number of pads in x ans y
76 fNpx=(Int_t) (fChamber->ROuter()/fDpx+1);
77 fNpy=(Int_t) (fChamber->ROuter()/fDpy+1);
78 // Initialize inner and outer radius of the sensitive region
79 fRmin=fChamber->RInner();
80 fRmax=fChamber->ROuter();
87 Float_t AliMUONSegmentationV0::GetAnod(Float_t xhit) const
89 // Returns for a hit position xhit the position of the nearest anode wire
90 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
94 void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
102 void AliMUONSegmentationV0::
103 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
105 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
107 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1;
108 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
109 if (iy > fNpy) iy= fNpy;
110 if (iy < -fNpy) iy=-fNpy;
111 if (ix > fNpx) ix= fNpx;
112 if (ix < -fNpx) ix=-fNpx;
115 void AliMUONSegmentationV0::
116 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
118 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
120 // Comments and Critics:
122 // The Pad(0,0) does not exist, this causes in the present version errors
123 // during iteration when used with hits close to zero.
124 // Since we have frame crosses at x=0 or y=0 this does not cause any problems
125 // Nevertheless, should be corrected in the next version !!
126 // The name fRmin is misleading although we use this version with
127 // a circular chamber geometry.
129 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.;
130 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
133 void AliMUONSegmentationV0::
134 SetHit(Float_t xhit, Float_t yhit)
137 // Sets virtual hit position, needed for evaluating pad response
138 // outside the tracking program
143 void AliMUONSegmentationV0::
144 SetPad(Int_t ix, Int_t iy)
147 // Sets virtual pad coordinates, needed for evaluating pad response
148 // outside the tracking program
149 GetPadC(ix,iy,fX,fY);
152 void AliMUONSegmentationV0::
153 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
155 // Initialises iteration over pads for charge distribution algorithm
158 // Find the wire position (center of charge distribution)
159 Float_t x0a=GetAnod(xhit);
163 // and take fNsigma*sigma around this center
164 Float_t x01=x0a - dx;
165 Float_t x02=x0a + dx;
166 Float_t y01=yhit - dy;
167 Float_t y02=yhit + dy;
169 // find the pads over which the charge distributes
170 GetPadI(x01,y01,fIxmin,fIymin);
171 GetPadI(x02,y02,fIxmax,fIymax);
173 // Set current pad to lower left corner
176 GetPadC(fIx,fIy,fX,fY);
179 void AliMUONSegmentationV0::NextPad()
181 // Stepper for the iteration over pads
183 // Comments and Critics:
184 // Boundary crossing at x=0 or y=0 not correctly handled !
185 // Step to next pad in the integration region
189 } else if (fIy != fIymax) {
194 printf("\n Error: Stepping outside integration region\n ");
196 GetPadC(fIx,fIy,fX,fY);
199 Int_t AliMUONSegmentationV0::MorePads()
200 // Stopping condition for the iterator over pads
202 // Are there more pads in the integration region ?
204 if (fIx == fIxmax && fIy == fIymax) {
212 void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t z)
215 // Initialises pad and wire position during stepping
218 GetPadI(x,y,fIxt,fIyt);
219 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
222 Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t z)
224 // Signal generation condition during stepping
225 // 0: don't generate signal
226 // 1: generate signal
227 // Comments and critics:
229 // Crossing of pad boundary and mid plane between neighbouring wires is checked.
230 // To correctly simulate the dependence of the spatial resolution on the angle
231 // of incidence signal must be generated for constant steps on
232 // the projection of the trajectory along the anode wire.
235 // Signal will be generated if particle crosses pad boundary or
236 // boundary between two wires.
238 GetPadI(x,y,ixt,iyt);
239 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
240 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
246 void AliMUONSegmentationV0::
247 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
249 // Returns integration limits for current pad
257 void AliMUONSegmentationV0::
258 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
260 // Returns list of next neighbours for given Pad (iX, iY)
262 // Comments and critics
263 // "Diagonal" neighbours are not passed
264 // Is this ok when we search for local maxima ??
265 // No test whether neighbours have valid indices id performed
267 Xlist[0]=Xlist[1]=iX;
272 Ylist[2]=Ylist[3]=iY;
275 Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
277 // Returns the square of the distance between 1 pad
278 // labelled by its Channel numbers and a coordinate
282 return (x-X)*(x-X) + (y-Y)*(y-Y);
286 void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
288 // Returns test point on the pad plane.
289 // Used during determination of the segmoid correction of the COG-method
291 x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.);
295 void AliMUONSegmentationV0::Draw(const char *) const
297 // Draws the segmentation zones
300 Float_t scale=0.95/fRmax/2.;
303 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
304 circle->SetFillColor(2);
307 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
308 circle->SetFillColor(1);
312 AliMUONSegmentationV0& AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & rhs)
314 // Dummy assignment operator