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.4 2000/07/03 11:54:57 morsch
18 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
19 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
21 Revision 1.3 2000/06/29 12:34:09 morsch
22 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
23 it usable with any other geometry class. The link to the object to which it belongs is
24 established via an index. This assumes that there exists a global geometry manager
25 from which the pointer to the parent object can be obtained (in our case gAlice).
27 Revision 1.2 2000/06/15 07:58:48 morsch
28 Code from MUON-dev joined
30 Revision 1.1.2.2 2000/06/12 07:57:23 morsch
33 Revision 1.1.2.1 2000/06/09 21:30:33 morsch
34 AliMUONSegmentationV0 code from AliMUONSegResV0.cxx
38 #include "AliMUONSegmentationV0.h"
41 #include "AliMUONChamber.h"
45 ClassImp(AliMUONSegmentationV0)
46 AliMUONSegmentationV0::AliMUONSegmentationV0(const AliMUONSegmentationV0& segmentation)
48 // Dummy copy constructor
51 void AliMUONSegmentationV0::Init(Int_t chamber)
53 // Initialises member data of the segmentation from geometry data
56 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
57 AliMUONChamber* iChamber=&(pMUON->Chamber(chamber));
59 // Initialise maximum number of pads in x ans y
60 fNpx=(Int_t) (iChamber->ROuter()/fDpx+1);
61 fNpy=(Int_t) (iChamber->ROuter()/fDpy+1);
62 // Initialize inner and outer radius of the sensitive region
63 fRmin=iChamber->RInner();
64 fRmax=iChamber->ROuter();
70 Float_t AliMUONSegmentationV0::GetAnod(Float_t xhit)
72 // Returns for a hit position xhit the position of the nearest anode wire
73 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
77 void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
84 void AliMUONSegmentationV0::
85 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
87 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
89 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1;
90 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
91 if (iy > fNpy) iy= fNpy;
92 if (iy < -fNpy) iy=-fNpy;
93 if (ix > fNpx) ix= fNpx;
94 if (ix < -fNpx) ix=-fNpx;
96 void AliMUONSegmentationV0::
97 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
99 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
101 // Comments and Critics:
103 // The Pad(0,0) does not exist, this causes in the present version errors
104 // during iteration when used with hits close to zero.
105 // Since we have frame crosses at x=0 or y=0 this does not cause any problems
106 // Nevertheless, should be corrected in the next version !!
107 // The name fRmin is misleading although we use this version with
108 // a circular chamber geometry.
110 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.;
111 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
114 void AliMUONSegmentationV0::
115 SetHit(Float_t xhit, Float_t yhit)
118 // Sets virtual hit position, needed for evaluating pad response
119 // outside the tracking program
124 void AliMUONSegmentationV0::
125 SetPad(Int_t ix, Int_t iy)
128 // Sets virtual pad coordinates, needed for evaluating pad response
129 // outside the tracking program
130 GetPadC(ix,iy,fx,fy);
133 void AliMUONSegmentationV0::
134 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
136 // Initialises iteration over pads for charge distribution algorithm
139 // Find the wire position (center of charge distribution)
140 Float_t x0a=GetAnod(xhit);
144 // and take fNsigma*sigma around this center
145 Float_t x01=x0a - dx;
146 Float_t x02=x0a + dx;
147 Float_t y01=yhit - dy;
148 Float_t y02=yhit + dy;
150 // find the pads over which the charge distributes
151 GetPadI(x01,y01,fixmin,fiymin);
152 GetPadI(x02,y02,fixmax,fiymax);
154 // Set current pad to lower left corner
157 GetPadC(fix,fiy,fx,fy);
160 void AliMUONSegmentationV0::NextPad()
162 // Stepper for the iteration over pads
164 // Comments and Critics:
165 // Boundary crossing at x=0 or y=0 not correctly handled !
166 // Step to next pad in the integration region
170 } else if (fiy != fiymax) {
175 printf("\n Error: Stepping outside integration region\n ");
177 GetPadC(fix,fiy,fx,fy);
180 Int_t AliMUONSegmentationV0::MorePads()
181 // Stopping condition for the iterator over pads
183 // Are there more pads in the integration region ?
185 if (fix == fixmax && fiy == fiymax) {
193 void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t z)
196 // Initialises pad and wire position during stepping
199 GetPadI(x,y,fixt,fiyt);
200 fiwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
203 Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t z)
205 // Signal generation condition during stepping
206 // 0: don't generate signal
207 // 1: generate signal
208 // Comments and critics:
210 // Crossing of pad boundary and mid plane between neighbouring wires is checked.
211 // To correctly simulate the dependence of the spatial resolution on the angle
212 // of incidence signal must be generated for constant steps on
213 // the projection of the trajectory along the anode wire.
216 // Signal will be generated if particle crosses pad boundary or
217 // boundary between two wires.
219 GetPadI(x,y,ixt,iyt);
220 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
221 if ((ixt != fixt) || (iyt !=fiyt) || (iwt != fiwt)) {
227 void AliMUONSegmentationV0::
228 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
230 // Returns integration limits for current pad
238 void AliMUONSegmentationV0::
239 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
241 // Returns list of next neighbours for given Pad (iX, iY)
243 // Comments and critics
244 // "Diagonal" neighbours are not passed
245 // Is this ok when we search for local maxima ??
246 // No test whether neighbours have valid indices id performed
248 Xlist[0]=Xlist[1]=iX;
253 Ylist[2]=Ylist[3]=iY;
256 Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
258 // Returns the square of the distance between 1 pad
259 // labelled by its Channel numbers and a coordinate
263 return (x-X)*(x-X) + (y-Y)*(y-Y);
267 void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y)
269 // Returns test point on the pad plane.
270 // Used during determination of the segmoid correction of the COG-method
272 x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.);
276 void AliMUONSegmentationV0::Draw(const char *)
278 // Draws the segmentation zones
281 Float_t scale=0.95/fRmax/2.;
284 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
285 circle->SetFillColor(2);
288 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
289 circle->SetFillColor(1);
293 AliMUONSegmentationV0& AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & rhs)
295 // Dummy assignment operator