]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationSlatModule.cxx
New ITS detailed geometry to be used for the PPR. Only sensitive volumes added for...
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationSlatModule.cxx
CommitLineData
4c503756 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$
de05461e 18Revision 1.6 2000/11/06 09:20:43 morsch
19AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the
20Draw() method. This avoids code and parameter replication.
21
aaf4addd 22Revision 1.5 2000/10/26 19:32:04 morsch
23Problem with iteration over y-pads for 2nd cathode corrected.
24
d4ee3c3e 25Revision 1.4 2000/10/25 19:56:55 morsch
26Handle correctly slats with less than 3 segmentation zones.
27
f30dea32 28Revision 1.3 2000/10/22 16:56:32 morsch
29- Store chamber number as slat id.
30
de2f6d11 31Revision 1.2 2000/10/18 11:42:06 morsch
32- AliMUONRawCluster contains z-position.
33- Some clean-up of useless print statements during initialisations.
34
3e1872ed 35Revision 1.1 2000/10/06 08:59:03 morsch
36Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
37
4c503756 38*/
39
40/////////////////////////////////////////////////////
41// Segmentation classes for slat modules //
42// to be used with AluMUONSegmentationSlat //
43/////////////////////////////////////////////////////
44
45
46#include "AliMUONSegmentationSlatModule.h"
aaf4addd 47#include "AliRun.h"
48#include "AliMUON.h"
4c503756 49#include <TMath.h>
50#include <iostream.h>
51
52#include "AliMUONSegmentationV01.h"
53
54//___________________________________________
55ClassImp(AliMUONSegmentationSlatModule)
56
57AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule()
58{
59// Default constructor
60 fNsec=4;
61 fNDiv = new TArrayI(fNsec);
62 fDpxD = new TArrayF(fNsec);
63 (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;
64 (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;
65}
66
67void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
68{
69//
70// Set Pcb Board segmentation zones
71 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
72}
73
74
75void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4])
76{
77//
78// Defines the pad size perp. to the anode wire (y) for different sectors.
79// Pad sizes are defined as integral fractions ndiv of a basis pad size
80// fDpx
81//
82 for (Int_t i=0; i<4; i++) {
83 (*fNDiv)[i]=ndiv[i];
84 }
85 ndiv[0]=ndiv[1];
86}
87
88Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
89{
90// Return x-strip width
91 return (*fDpxD)[isec];
92}
93
94
95Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
96{
97// Return y-strip width
98
99 return fDpy;
100}
101
102
103void AliMUONSegmentationSlatModule::
104GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
105{
106// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
107//
108 iy = Int_t(y/fDpy)+1;
109 if (iy > fNpy) iy= fNpy;
110//
111// Find sector isec
112
113 Int_t isec=-1;
114 for (Int_t i=fNsec-1; i > 0; i--) {
115 if (x >= fCx[i-1]) {
116 isec=i;
f30dea32 117 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
4c503756 118 break;
119 }
120 }
121
122 if (isec>0) {
123 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
124 +fNpxS[isec-1]+1;
125 } else if (isec == 0) {
126 ix= Int_t(x/(*fDpxD)[isec])+1;
127 } else {
128 ix=0;
129 iy=0;
130 }
131}
132
133void AliMUONSegmentationSlatModule::
134GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
135{
136// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
137//
138 y = Float_t(iy*fDpy)-fDpy/2.;
139//
140// Find sector isec
141 Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy);
de2f6d11 142 if (isec == -1) printf("\n PadC %d %d %d %d \n ", isec, fId, ix, iy);
4c503756 143//
144 if (isec>0) {
145 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
146 x = x-(*fDpxD)[isec]/2;
147 } else {
148 x=y=0;
149 }
150}
151
152void AliMUONSegmentationSlatModule::
153SetPad(Int_t ix, Int_t iy)
154{
155 //
156 // Sets virtual pad coordinates, needed for evaluating pad response
157 // outside the tracking program
158 GetPadC(ix,iy,fX,fY);
159 fSector=Sector(ix,iy);
160}
161
162void AliMUONSegmentationSlatModule::
163SetHit(Float_t x, Float_t y)
164{
de05461e 165// Set current hit
166//
4c503756 167 fXhit = x;
168 fYhit = y;
169
170 if (x < 0) fXhit = 0;
171 if (y < 0) fYhit = 0;
172
173 if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
174 if (y >= fDyPCB) fYhit = fDyPCB;
175
176
177}
178
179
180void AliMUONSegmentationSlatModule::
181FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
182{
183// Initialises iteration over pads for charge distribution algorithm
184//
185 //
186 // Find the wire position (center of charge distribution)
187 Float_t x0a=GetAnod(xhit);
188 fXhit=x0a;
189 fYhit=yhit;
190 //
191 // and take fNsigma*sigma around this center
192 Float_t x01=x0a - dx;
193 Float_t x02=x0a + dx;
194 Float_t y01=yhit - dy;
195 Float_t y02=yhit + dy;
4c503756 196 if (x01 < 0) x01 = 0;
197 if (y01 < 0) y01 = 0;
f30dea32 198
199 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
d4ee3c3e 200
4c503756 201
f30dea32 202
4c503756 203 Int_t isec=-1;
204 for (Int_t i=fNsec-1; i > 0; i--) {
205 if (x02 >= fCx[i-1]) {
206 isec=i;
f30dea32 207 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
4c503756 208 break;
209 }
210 }
d4ee3c3e 211 y02 += Dpy(isec);
212 if (y02 >= fDyPCB) y02 = fDyPCB;
4c503756 213
4c503756 214 //
215 // find the pads over which the charge distributes
216 GetPadI(x01,y01,fIxmin,fIymin);
217 GetPadI(x02,y02,fIxmax,fIymax);
f30dea32 218
4c503756 219 if (fIxmax > fNpx) fIxmax=fNpx;
220 if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];
d4ee3c3e 221
4c503756 222 fXmin=x01;
d4ee3c3e 223 fXmax=x02;
4c503756 224 fYmin=y01;
d4ee3c3e 225 fYmax=y02;
226
4c503756 227 //
228 // Set current pad to lower left corner
229 if (fIxmax < fIxmin) fIxmax=fIxmin;
230 if (fIymax < fIymin) fIymax=fIymin;
231 fIx=fIxmin;
232 fIy=fIymin;
233
234 GetPadC(fIx,fIy,fX,fY);
235 fSector=Sector(fIx,fIy);
d4ee3c3e 236/*
237 printf("\n \n First Pad: %d %d %f %f %d %d %d %f" ,
238 fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));
239 printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
240 fIymin, fIymax, fYmin, fYmax, fNpyS[isec], fId, isec, Dpy(isec));
241*/
4c503756 242}
243
244void AliMUONSegmentationSlatModule::NextPad()
245{
246// Stepper for the iteration over pads
247//
248// Step to next pad in the integration region
249// step from left to right
250 if (fIx != fIxmax) {
251 fIx++;
252 GetPadC(fIx,fIy,fX,fY);
253 fSector=Sector(fIx,fIy);
254// step up
255 } else if (fIy != fIymax) {
256 fIx=fIxmin;
257 fIy++;
258 GetPadC(fIx,fIy,fX,fY);
259 fSector=Sector(fIx,fIy);
260
261 } else {
262 fIx=-1;
263 fIy=-1;
264 }
265// printf("\n Next Pad %d %d %f %f %d %d %d %d %d ",
266}
267
268
269Int_t AliMUONSegmentationSlatModule::MorePads()
de05461e 270{
4c503756 271// Stopping condition for the iterator over pads
272//
273// Are there more pads in the integration region
4c503756 274
275 return (fIx != -1 || fIy != -1);
276}
277
278
279Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy)
280{
281//
282// Determine segmentation zone from pad coordinates
283//
284 Int_t isec=-1;
285 for (Int_t i=0; i < fNsec; i++) {
286 if (ix <= fNpxS[i]) {
287 isec=i;
288 break;
289 }
290 }
291 if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
292 fId, ix, iy,fNpxS[3]);
293
294 return isec;
295
296}
297
298void AliMUONSegmentationSlatModule::
299IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
300{
301// Returns integration limits for current pad
302//
303
304 x1=fXhit-fX-Dpx(fSector)/2.;
305 x2=x1+Dpx(fSector);
306 y1=fYhit-fY-Dpy(fSector)/2.;
307 y2=y1+Dpy(fSector);
308// printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
309
310}
311
312void AliMUONSegmentationSlatModule::
313Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
314{
315// Returns list of next neighbours for given Pad (iX, iY)
316//
317//
318 Int_t i=0;
319//
320// step right
321 if (iX+1 <= fNpx) {
322 Xlist[i]=iX+1;
323 Ylist[i++]=iY;
324 }
325//
326// step left
327 if (iX-1 > 0) {
328 Xlist[i]=iX-1;
329 Ylist[i++]=iY;
330 }
331
332//
333// step up
334 if (iY+1 <= fNpy) {
335 Xlist[i]=iX;
336 Ylist[i++]=iY+1;
337 }
338//
339// step down
340 if (iY-1 > 0) {
341 Xlist[i]=iX;
342 Ylist[i++]=iY-1;
343 }
344
345 *Nlist=i;
346}
347
348
349void AliMUONSegmentationSlatModule::Init(Int_t chamber)
350{
4c503756 351//
352// Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
353// These arrays help in converting from real to pad co-ordinates and
354// vice versa
355//
356// Segmentation is defined by rectangular modules approximating
357// concentric circles as shown below
358//
359// PCB module size in cm
de05461e 360 printf("\n Initialise Segmentation SlatModule \n");
361
4c503756 362 fDxPCB=40;
363 fDyPCB=40;
364//
365// number of pad rows per PCB
366//
367 Int_t nPyPCB=Int_t(fDyPCB/fDpy);
368//
369// maximum number of pad rows
370 fNpy=nPyPCB;
371//
372// Calculate padsize along x
373 (*fDpxD)[fNsec-1]=fDpx;
374 if (fNsec > 1) {
375 for (Int_t i=fNsec-2; i>=0; i--){
376 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
4c503756 377 }
378 }
379//
380// fill the arrays defining the pad segmentation boundaries
381//
382//
383// Loop over sectors (isec=0 is the dead space surounding the beam pipe)
384 for (Int_t isec=0; isec<4; isec++) {
385 if (isec==0) {
386 fNpxS[0] = 0;
387 fNpyS[0] = 0;
388 fCx[0] = 0;
389 } else {
390 fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
391 fNpyS[isec]=fNpy;
392 fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
393 }
394 } // sectors
395// maximum number of pad rows
396 fNpy=nPyPCB;
397 fNpx=fNpxS[3];
de2f6d11 398//
aaf4addd 399 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
de2f6d11 400 fId = chamber;
4c503756 401}
402
403
404
405
406
407
408
409
410
411
412
413