Add some charmed and bottom baryons to the particle list (TDatabasePDG). This
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationV0.cxx
CommitLineData
a9e2aefa 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15/*
16$Log$
17Revision 1.1.2.2 2000/06/12 07:57:23 morsch
18include TMath.h
19
20Revision 1.1.2.1 2000/06/09 21:30:33 morsch
21AliMUONSegmentationV0 code from AliMUONSegResV0.cxx
22
23*/
24
25#include "AliMUONSegmentationV0.h"
26#include "TArc.h"
27#include "TMath.h"
28#include "AliMUONChamber.h"
29
30ClassImp(AliMUONSegmentationV0)
31 AliMUONSegmentationV0::AliMUONSegmentationV0(const AliMUONSegmentationV0& segmentation)
32{
33// Dummy copy constructor
34}
35
36 void AliMUONSegmentationV0::Init(AliMUONChamber* Chamber)
37{
38// Initialises member data of the segmentation from geometry data
39// owned by Chamber
40//
41// Initialise maximum number of pads in x ans y
42 fNpx=(Int_t) (Chamber->ROuter()/fDpx+1);
43 fNpy=(Int_t) (Chamber->ROuter()/fDpy+1);
44// Initialize inner and outer radius of the sensitive region
45 fRmin=Chamber->RInner();
46 fRmax=Chamber->ROuter();
47 fCorr=0;
48
49}
50
51
52Float_t AliMUONSegmentationV0::GetAnod(Float_t xhit)
53{
54// Returns for a hit position xhit the position of the nearest anode wire
55 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
56 return fWireD*wire;
57}
58
59void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
60{
61// Sets the padsize
62//
63 fDpx=p1;
64 fDpy=p2;
65}
66void AliMUONSegmentationV0::
67 GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
68{
69// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
70//
71 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1;
72 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
73 if (iy > fNpy) iy= fNpy;
74 if (iy < -fNpy) iy=-fNpy;
75 if (ix > fNpx) ix= fNpx;
76 if (ix < -fNpx) ix=-fNpx;
77}
78void AliMUONSegmentationV0::
79GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
80{
81// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
82//
83// Comments and Critics:
84
85// The Pad(0,0) does not exist, this causes in the present version errors
86// during iteration when used with hits close to zero.
87// Since we have frame crosses at x=0 or y=0 this does not cause any problems
88// Nevertheless, should be corrected in the next version !!
89// The name fRmin is misleading although we use this version with
90// a circular chamber geometry.
91
92 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.;
93 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
94}
95
96void AliMUONSegmentationV0::
97SetHit(Float_t xhit, Float_t yhit)
98{
99 //
100 // Sets virtual hit position, needed for evaluating pad response
101 // outside the tracking program
102 fxhit=xhit;
103 fyhit=yhit;
104}
105
106void AliMUONSegmentationV0::
107SetPad(Int_t ix, Int_t iy)
108{
109 //
110 // Sets virtual pad coordinates, needed for evaluating pad response
111 // outside the tracking program
112 GetPadCxy(ix,iy,fx,fy);
113}
114
115void AliMUONSegmentationV0::
116FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
117{
118// Initialises iteration over pads for charge distribution algorithm
119//
120 //
121 // Find the wire position (center of charge distribution)
122 Float_t x0a=GetAnod(xhit);
123 fxhit=x0a;
124 fyhit=yhit;
125 //
126 // and take fNsigma*sigma around this center
127 Float_t x01=x0a - dx;
128 Float_t x02=x0a + dx;
129 Float_t y01=yhit - dy;
130 Float_t y02=yhit + dy;
131 //
132 // find the pads over which the charge distributes
133 GetPadIxy(x01,y01,fixmin,fiymin);
134 GetPadIxy(x02,y02,fixmax,fiymax);
135 //
136 // Set current pad to lower left corner
137 fix=fixmin;
138 fiy=fiymin;
139 GetPadCxy(fix,fiy,fx,fy);
140}
141
142void AliMUONSegmentationV0::NextPad()
143{
144 // Stepper for the iteration over pads
145 //
146 // Comments and Critics:
147 // Boundary crossing at x=0 or y=0 not correctly handled !
148 // Step to next pad in the integration region
149 if (fix != fixmax) {
150 if (fix==-1) fix++;
151 fix++;
152 } else if (fiy != fiymax) {
153 fix=fixmin;
154 if (fiy==-1) fiy++;
155 fiy++;
156 } else {
157 printf("\n Error: Stepping outside integration region\n ");
158 }
159 GetPadCxy(fix,fiy,fx,fy);
160}
161
162Int_t AliMUONSegmentationV0::MorePads()
163// Stopping condition for the iterator over pads
164//
165// Are there more pads in the integration region ?
166{
167 if (fix == fixmax && fiy == fiymax) {
168 return 0;
169 } else {
170 return 1;
171
172 }
173}
174
175void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t z)
176{
177//
178// Initialises pad and wire position during stepping
179 fxt =x;
180 fyt =y;
181 GetPadIxy(x,y,fixt,fiyt);
182 fiwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
183}
184
185Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t z)
186{
187// Signal generation condition during stepping
188// 0: don't generate signal
189// 1: generate signal
190// Comments and critics:
191
192// Crossing of pad boundary and mid plane between neighbouring wires is checked.
193// To correctly simulate the dependence of the spatial resolution on the angle
194// of incidence signal must be generated for constant steps on
195// the projection of the trajectory along the anode wire.
196
197//
198// Signal will be generated if particle crosses pad boundary or
199// boundary between two wires.
200 Int_t ixt, iyt;
201 GetPadIxy(x,y,ixt,iyt);
202 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
203 if ((ixt != fixt) || (iyt !=fiyt) || (iwt != fiwt)) {
204 return 1;
205 } else {
206 return 0;
207 }
208}
209void AliMUONSegmentationV0::
210IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
211{
212// Returns integration limits for current pad
213//
214 x1=fxhit-fx-fDpx/2.;
215 x2=x1+fDpx;
216 y1=fyhit-fy-fDpy/2.;
217 y2=y1+fDpy;
218}
219
220void AliMUONSegmentationV0::
221Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
222{
223// Returns list of next neighbours for given Pad (iX, iY)
224//
225// Comments and critics
226// "Diagonal" neighbours are not passed
227// Is this ok when we search for local maxima ??
228// No test whether neighbours have valid indices id performed
229 *Nlist=4;
230 Xlist[0]=Xlist[1]=iX;
231 Xlist[2]=iX-1;
232 Xlist[3]=iX+1;
233 Ylist[0]=iY-1;
234 Ylist[1]=iY+1;
235 Ylist[2]=Ylist[3]=iY;
236}
237
238Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
239, Int_t *dummy)
240// Returns the square of the distance between 1 pad
241// labelled by its Channel numbers and a coordinate
242{
243 Float_t x,y;
244 GetPadCxy(iX,iY,x,y);
245 return (x-X)*(x-X) + (y-Y)*(y-Y);
246}
247
248
249void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y)
250{
251// Returns test point on the pad plane.
252// Used during determination of the segmoid correction of the COG-method
253 n=1;
254 x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.);
255 y[0]=x[0];
256}
257
258void AliMUONSegmentationV0::Draw()
259{
260// Draws the segmentation zones
261//
262 TArc *circle;
263 Float_t scale=0.95/fRmax/2.;
264
265
266 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
267 circle->SetFillColor(2);
268 circle->Draw();
269
270 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
271 circle->SetFillColor(1);
272 circle->Draw();
273}
274
275AliMUONSegmentationV0& AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & rhs)
276{
277// Dummy assignment operator
278 return *this;
279}