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.9 2000/11/06 09:20:43 morsch
18 AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the
19 Draw() method. This avoids code and parameter replication.
21 Revision 1.8 2000/10/18 11:42:06 morsch
22 - AliMUONRawCluster contains z-position.
23 - Some clean-up of useless print statements during initialisations.
25 Revision 1.7 2000/10/03 21:48:07 morsch
26 Adopt to const declaration of some of the methods in AliSegmentation.
28 Revision 1.6 2000/10/02 16:58:29 egangler
29 Cleaning of the code :
32 -> some useless includes removed or replaced by "class" statement
34 Revision 1.5 2000/07/13 16:19:44 fca
35 Mainly coding conventions + some small bug fixes
37 Revision 1.4 2000/07/03 11:54:57 morsch
38 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
39 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
41 Revision 1.3 2000/06/29 12:34:09 morsch
42 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
43 it usable with any other geometry class. The link to the object to which it belongs is
44 established via an index. This assumes that there exists a global geometry manager
45 from which the pointer to the parent object can be obtained (in our case gAlice).
47 Revision 1.2 2000/06/15 07:58:48 morsch
48 Code from MUON-dev joined
50 Revision 1.1.2.2 2000/06/12 07:57:23 morsch
53 Revision 1.1.2.1 2000/06/09 21:30:33 morsch
54 AliMUONSegmentationV0 code from AliMUONSegResV0.cxx
58 #include "AliMUONSegmentationV0.h"
61 #include "AliMUONChamber.h"
65 ClassImp(AliMUONSegmentationV0)
66 AliMUONSegmentationV0::AliMUONSegmentationV0(const AliMUONSegmentationV0& segmentation)
68 // Dummy copy constructor
71 void AliMUONSegmentationV0::Init(Int_t chamber)
73 // Initialises member data of the segmentation from geometry data
76 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
77 fChamber=&(pMUON->Chamber(chamber));
79 // Initialise maximum number of pads in x ans y
80 fNpx=(Int_t) (fChamber->ROuter()/fDpx+1);
81 fNpy=(Int_t) (fChamber->ROuter()/fDpy+1);
82 // Initialize inner and outer radius of the sensitive region
83 fRmin=fChamber->RInner();
84 fRmax=fChamber->ROuter();
91 Float_t AliMUONSegmentationV0::GetAnod(Float_t xhit) const
93 // Returns for a hit position xhit the position of the nearest anode wire
94 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
98 void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
106 void AliMUONSegmentationV0::
107 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
109 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
111 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1;
112 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
113 if (iy > fNpy) iy= fNpy;
114 if (iy < -fNpy) iy=-fNpy;
115 if (ix > fNpx) ix= fNpx;
116 if (ix < -fNpx) ix=-fNpx;
119 void AliMUONSegmentationV0::
120 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
122 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
124 // Comments and Critics:
126 // The Pad(0,0) does not exist, this causes in the present version errors
127 // during iteration when used with hits close to zero.
128 // Since we have frame crosses at x=0 or y=0 this does not cause any problems
129 // Nevertheless, should be corrected in the next version !!
130 // The name fRmin is misleading although we use this version with
131 // a circular chamber geometry.
133 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.;
134 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
137 void AliMUONSegmentationV0::
138 SetHit(Float_t xhit, Float_t yhit)
141 // Sets virtual hit position, needed for evaluating pad response
142 // outside the tracking program
147 void AliMUONSegmentationV0::
148 SetPad(Int_t ix, Int_t iy)
151 // Sets virtual pad coordinates, needed for evaluating pad response
152 // outside the tracking program
153 GetPadC(ix,iy,fX,fY);
156 void AliMUONSegmentationV0::
157 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
159 // Initialises iteration over pads for charge distribution algorithm
162 // Find the wire position (center of charge distribution)
163 Float_t x0a=GetAnod(xhit);
167 // and take fNsigma*sigma around this center
168 Float_t x01=x0a - dx;
169 Float_t x02=x0a + dx;
170 Float_t y01=yhit - dy;
171 Float_t y02=yhit + dy;
173 // find the pads over which the charge distributes
174 GetPadI(x01,y01,fIxmin,fIymin);
175 GetPadI(x02,y02,fIxmax,fIymax);
177 // Set current pad to lower left corner
180 GetPadC(fIx,fIy,fX,fY);
183 void AliMUONSegmentationV0::NextPad()
185 // Stepper for the iteration over pads
187 // Comments and Critics:
188 // Boundary crossing at x=0 or y=0 not correctly handled !
189 // Step to next pad in the integration region
193 } else if (fIy != fIymax) {
198 printf("\n Error: Stepping outside integration region\n ");
200 GetPadC(fIx,fIy,fX,fY);
203 Int_t AliMUONSegmentationV0::MorePads()
205 // Stopping condition for the iterator over pads
207 // Are there more pads in the integration region ?
209 if (fIx == fIxmax && fIy == fIymax) {
217 void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t z)
220 // Initialises pad and wire position during stepping
223 GetPadI(x,y,fIxt,fIyt);
224 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
227 Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t z)
229 // Signal generation condition during stepping
230 // 0: don't generate signal
231 // 1: generate signal
232 // Comments and critics:
234 // Crossing of pad boundary and mid plane between neighbouring wires is checked.
235 // To correctly simulate the dependence of the spatial resolution on the angle
236 // of incidence signal must be generated for constant steps on
237 // the projection of the trajectory along the anode wire.
240 // Signal will be generated if particle crosses pad boundary or
241 // boundary between two wires.
243 GetPadI(x,y,ixt,iyt);
244 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
245 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
251 void AliMUONSegmentationV0::
252 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
254 // Returns integration limits for current pad
262 void AliMUONSegmentationV0::
263 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
265 // Returns list of next neighbours for given Pad (iX, iY)
267 // Comments and critics
268 // "Diagonal" neighbours are not passed
269 // Is this ok when we search for local maxima ??
270 // No test whether neighbours have valid indices id performed
272 Xlist[0]=Xlist[1]=iX;
277 Ylist[2]=Ylist[3]=iY;
280 Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
283 // Returns the square of the distance between 1 pad
284 // labelled by its Channel numbers and a coordinate
288 return (x-X)*(x-X) + (y-Y)*(y-Y);
292 void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
294 // Returns test point on the pad plane.
295 // Used during determination of the segmoid correction of the COG-method
297 x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.);
301 void AliMUONSegmentationV0::Draw(const char *) const
303 // Draws the segmentation zones
306 Float_t scale=0.95/fRmax/2.;
309 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
310 circle->SetFillColor(2);
313 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
314 circle->SetFillColor(1);
318 AliMUONSegmentationV0& AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & rhs)
320 // Dummy assignment operator