]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHSegmentationV0.cxx
added the delete of EMCAL object posted in the folder when new file is opened
[u/mrichter/AliRoot.git] / RICH / AliRICHSegmentationV0.cxx
CommitLineData
237c933d 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/*
17 $Log$
edf34242 18 Revision 1.5 2001/02/13 20:12:39 jbarbosa
19 Moved setting of variables to constructor. Init is now responsible for calculating padplane dimensions.
20
5a0c129b 21 Revision 1.4 2001/01/22 21:38:46 jbarbosa
22 Dummy padplane dimensions
23
485f496c 24 Revision 1.3 2000/10/03 21:44:09 morsch
25 Use AliSegmentation and AliHit abstract base classes.
26
a2f7eaf6 27 Revision 1.2 2000/10/02 15:48:19 jbarbosa
28 Fixed coding conventions.
29
72e468a5 30 Revision 1.1 2000/06/12 15:31:54 jbarbosa
31 Cleaned up version.
32
237c933d 33*/
34#include "AliRICHSegmentationV0.h"
35
36
37ClassImp(AliRICHSegmentationV0)
38
5a0c129b 39//________________________________________________________________________________
40AliRICHSegmentationV0::AliRICHSegmentationV0()
41{
42
43// Default constructor for AliRICHSegmentationV0 (no dead zones)
44
45 fNpx=144;
46 fNpy=160;
47 fDeadZone=0;
48 fSector=-1;
edf34242 49 fCorr = 0;
5a0c129b 50}
51
a2f7eaf6 52void AliRICHSegmentationV0::Init(Int_t id)
237c933d 53{
54
55// Initialisation of chambers
5a0c129b 56
57 //printf("* Initialising SegmentationV0 (no dead zones) in chamber %d *\n",id+1);
237c933d 58
5a0c129b 59 // parametrised definition
60
61 Float_t csi_length = fNpy*fDpy + fDeadZone;
62 Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
63
64 fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
65 fPadPlane_Length = (csi_length - fDeadZone)/2;
237c933d 66}
67
68
a2f7eaf6 69Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit) const
237c933d 70{
71
72// Get anod wire closer to hit
73
74 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
75 return fWireD*wire;
76}
77
78void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
79{
80
81// Set the pad size
82
83 fDpx=p1;
84 fDpy=p2;
85}
a2f7eaf6 86void AliRICHSegmentationV0::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
237c933d 87{
88// returns pad coordinates (ix,iy) for given real coordinates (x,y)
89//
90// Please check origin of pad numbering !!!
91
92
93 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
94 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
95 if (iy > fNpy) iy= fNpy;
96 if (iy < -fNpy) iy=-fNpy;
97 if (ix > fNpx) ix= fNpx;
98 if (ix < -fNpx) ix=-fNpx;
99}
100void AliRICHSegmentationV0::
a2f7eaf6 101GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
237c933d 102{
103// returns real coordinates (x,y) for given pad coordinates (ix,iy)
104//
105
106 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
107 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
108}
109
110void AliRICHSegmentationV0::
111SetHit(Float_t xhit, Float_t yhit)
112{
113//
114// Find the wire position (center of charge distribution)
115// Float_t x0a=GetAnod(xhit);
72e468a5 116 fXhit=xhit;
117 fYhit=yhit;
237c933d 118}
119
120void AliRICHSegmentationV0::
121SetPad(Int_t ix, Int_t iy)
122{
123
124// Move to pad ix, iy
125
a2f7eaf6 126 GetPadC(ix,iy,fX,fY);
237c933d 127}
128
129
130
131void AliRICHSegmentationV0::
132FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
133{
134
135 //
136 // Find the wire position (center of charge distribution)
137 Float_t x0a=GetAnod(xhit);
72e468a5 138 fXhit=x0a;
139 fYhit=yhit;
237c933d 140 //
141 // and take fNsigma*sigma around this center
142 Float_t x01=x0a - dx;
143 Float_t x02=x0a + dx;
144 Float_t y01=yhit - dy;
145 Float_t y02=yhit + dy;
146 //
147 // find the pads over which the charge distributes
a2f7eaf6 148 GetPadI(x01,y01,fIxmin,fIymin);
149 GetPadI(x02,y02,fIxmax,fIymax);
237c933d 150 //
151 // Set current pad to lower left corner
72e468a5 152 fIx=fIxmin;
153 fIy=fIymin;
a2f7eaf6 154 GetPadC(fIx,fIy,fX,fY);
237c933d 155
156 //if (fSector==2)
72e468a5 157 //printf("fIx: %d, fIy: %d fX: %f, fY: %f\n",fIx,fIy,fX,fY);
237c933d 158}
159
160void AliRICHSegmentationV0::NextPad()
161{
162 //printf("\n Next Pad \n");
163
164 //
165 // Step to next pad in integration region
72e468a5 166 if (fIx <= fIxmax) {
167// if (fIx==-1) fIx++;
168 fIx++;
169 } else if (fIy <= fIymax) {
170// if (fIy==-1) fIy++;
171 fIx=fIxmin;
172 fIy++;
237c933d 173 } else {
174 printf("\n Error: Stepping outside integration region\n ");
175 }
a2f7eaf6 176 GetPadC(fIx,fIy,fX,fY);
237c933d 177}
178
179Int_t AliRICHSegmentationV0::MorePads()
180
181{
182//
183// Are there more pads in the integration region
184
185 //printf("\n More Pads ? \n");
186
187
72e468a5 188 if (fIx >= fIxmax && fIy >= fIymax) {
237c933d 189 //printf("There are no more pads\n\n\n\n\n");
190 return 0;
191 } else {
192 //printf("There are more pads\n\n");
193 return 1;
194 }
195}
196
197void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
198{
199//
200// Initialises pad and wire position during stepping
72e468a5 201 fXt =x;
202 fYt =y;
a2f7eaf6 203 GetPadI(x,y,fIxt,fIyt);
72e468a5 204 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
237c933d 205}
206
207Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
208{
209//
210// Signal will be generated if particle crosses pad boundary or
211// boundary between two wires.
212 Int_t ixt, iyt;
a2f7eaf6 213 GetPadI(x,y,ixt,iyt);
237c933d 214 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
215
72e468a5 216 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
237c933d 217 return 1;
218 } else {
219 return 0;
220 }
221}
222void AliRICHSegmentationV0::
223IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
224{
225
226// Calculate the integration limits
227
228/*
72e468a5 229 x1=fXt-fX-fDpx/2.;
237c933d 230 x2=x1+fDpx;
72e468a5 231 y1=fYt-fY-fDpy/2.;
237c933d 232 y2=y1+fDpy;
233*/
72e468a5 234 x1=fXhit-fX-fDpx/2.;
237c933d 235 x2=x1+fDpx;
72e468a5 236 y1=fYhit-fY-fDpy/2.;
237c933d 237 y2=y1+fDpy;
238}
239
240void AliRICHSegmentationV0::
241Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
242{
243//Is used for the cluster finder, include diagonal elements
244
245 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
246 Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
247/*
248 *Nlist=8;
249 Xlist[0]=Xlist[1]=iX;
250 Xlist[2]=iX-1;
251 Xlist[3]=iX+1;
252 Ylist[0]=iY-1;
253 Ylist[1]=iY+1;
254 Ylist[2]=Ylist[3]=iY;
255
256 // Diagonal elements
257 Xlist[4]=iX+1;
258 Ylist[4]=iY+1;
259
260 Xlist[5]=iX-1;
261 Ylist[5]=iY-1;
262
263 Xlist[6]=iX-1;
264 Ylist[6]=iY+1;
265
266 Xlist[7]=iX+1;
267 Ylist[7]=iY-1;
268*/
269}
270
271Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
272, Int_t *dummy)
273
274{
275// Returns the square of the distance between 1 pad
276// labelled by its Channel numbers and a coordinate
277
278 Float_t x,y;
a2f7eaf6 279 GetPadC(iX,iY,x,y);
237c933d 280 return (x-X)*(x-X) + (y-Y)*(y-Y);
281}
282
283
a2f7eaf6 284void AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
237c933d 285{
286
287// Test
288
289 n=1;
290 x[0]=0.;
291 y[0]=x[0];
292}
293
a2f7eaf6 294void AliRICHSegmentationV0::Draw(const char* opt) const
237c933d 295{
296
297// Dummy draw routine
298
299/*
300 TArc *circle;
301 Float_t scale=0.95/fRmax/2.;
302
303
304 circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
305 circle->SetFillColor(2);
306 circle->Draw();
307
308 circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
309 circle->SetFillColor(1);
310 circle->Draw();
311*/
312 ;
313
314}