]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationSlatModuleN.cxx
Major upgrade of AliRoot code
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationSlatModuleN.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.5 2000/10/26 19:32:04 morsch
19Problem with iteration over y-pads for 2nd cathode corrected.
20
d4ee3c3e 21Revision 1.4 2000/10/25 19:56:55 morsch
22Handle correctly slats with less than 3 segmentation zones.
23
f30dea32 24Revision 1.3 2000/10/22 16:56:33 morsch
25- Store chamber number as slat id.
26
de2f6d11 27Revision 1.2 2000/10/18 11:42:06 morsch
28- AliMUONRawCluster contains z-position.
29- Some clean-up of useless print statements during initialisations.
30
3e1872ed 31Revision 1.1 2000/10/06 08:59:03 morsch
32Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
33
4c503756 34*/
35
36/////////////////////////////////////////////////////
37// Segmentation classes for slat modules //
38// to be used with AluMUONSegmentationSlat //
39/////////////////////////////////////////////////////
40
41
42#include "AliMUONSegmentationSlatModuleN.h"
43#include <TMath.h>
44#include <iostream.h>
45
46#include "AliMUONSegmentationV01.h"
47
48//___________________________________________
49ClassImp(AliMUONSegmentationSlatModuleN)
50
51AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN()
52{
53// Default constructor
54}
55
56
57Float_t AliMUONSegmentationSlatModuleN::Dpx(Int_t isec) const
58{
59//
60// Returns x-pad size for given sector isec
61 return fDpx;
62}
63
64Float_t AliMUONSegmentationSlatModuleN::Dpy(Int_t isec) const
65{
66//
67// Returns y-pad size for given sector isec
68 return (*fDpxD)[isec];
69}
70
71
72void AliMUONSegmentationSlatModuleN::
73GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
74{
75// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
76//
77 ix = Int_t(x/fDpx)+1;
78 if (ix > fNpx) ix= fNpx;
79//
80// Find sector isec
81 Int_t isec=-1;
82 for (Int_t i = fNsec-1; i > 0; i--) {
83 if (x >= fCx[i-1]) {
84 isec=i;
f30dea32 85 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
4c503756 86 break;
87 }
88 }
89//
90//
f30dea32 91
4c503756 92 if (isec == -1) {
93 ix = 0;
94 iy = 0;
95 } else {
96 iy = Int_t(y/(*fDpxD)[isec])+1;
97 }
98}
99
100void AliMUONSegmentationSlatModuleN::
101GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
102{
103// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
104//
105 x = Float_t(ix*fDpx)-fDpx/2.;
106//
107// Find sector isec
108 Int_t isec=Sector(ix,iy);
109 if (isec == -1) printf("\n gtpadc2 Warning isec !\n");
110 y = iy*(*fDpxD)[isec]-(*fDpxD)[isec]/2.;
111}
112
113
114void AliMUONSegmentationSlatModuleN::NextPad()
115{
116// Stepper for the iteration over pads
117//
118 Float_t xc,yc;
119 Int_t ixc;
120 // step up
121 if ((fY + Dpy(fSector)) < fYmax) {
122 fIy++;
123 GetPadC(fIx,fIy,fX,fY);
124// step right
125 } else if (fIx != fIxmax) {
126 fIx++;
127// get y-position of next row (yc), xc not used here
128 GetPadC(fIx,fIy,xc,yc);
129// get x-pad coordiante for 1 pad in row (fIx)
130 GetPadI(xc,fYmin,ixc,fIy);
131 GetPadC(fIx,fIy,fX,fY);
132 fSector=Sector(fIx,fIy);
133 } else {
134 fIx=fIy=-1;
135 }
136
137 if (fIy > fNpyS[fSector]) printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy);
138 GetPadC(fIx, fIy, xc, yc);
d4ee3c3e 139// printf("\n Next Pad (n)%d %d %f %f %d %f %d ", fIx,fIy,fX,fY,fSector, fYmax, fIxmax);
4c503756 140}
141
142Int_t AliMUONSegmentationSlatModuleN::MorePads()
de05461e 143{
4c503756 144// Stopping condition for the iterator over pads
145//
146//
147// Are there more pads in the integration region
de05461e 148
d4ee3c3e 149 if (fIy == -1) {
4c503756 150 return 0;
151 } else {
152 return 1;
153 }
154}
155
156void AliMUONSegmentationSlatModuleN::
157Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
158{
4c503756 159// Returns list of next neighbours for given Pad (iX, iY)
160//
161//
162 Int_t i=0;
163 Float_t x,y;
164 Int_t ix,iy,isec1,isec2;
165 Float_t kEpsil= 0.001;
166
167//
168// step up
169 Int_t isec=Sector(iX, iY);
170
171 if (iY+1 <= fNpyS[isec]) {
172 Xlist[i]=iX;
173 Ylist[i++]=iY+1;
174 }
175//
176// step down
177 if (iY-1 > 0) {
178 Xlist[i]=iX;
179 Ylist[i++]=iY-1;
180 }
181//
182//
183// step right
184
185 if (iX+1 <= fNpx) {
186
187
188 GetPadC(iX, iY, x, y);
189 GetPadI(x+fDpx, y, ix, iy);
190 Xlist[i]=iX+1;
191 Ylist[i++]=iy;
192 }
193//
194// step left
195 if (iX-1 > 0) {
196 isec1=Sector(iX, iY);
197 isec2=Sector(iX-1, iY);
198 if (isec1==isec2) {
199 Xlist[i]=iX-1;
200 Ylist[i++]=iY;
201 } else {
202 GetPadC(iX, iY, x, y);
203 GetPadI(x-fDpx, y+kEpsil, ix, iy);
204 if (ix != -1) {
205 Xlist[i]=iX-1;
206 Ylist[i++]=iy;
207 }
208 GetPadI(x-fDpx, y-kEpsil, ix, iy);
209 if (ix != -1) {
210 Xlist[i]=iX-1;
211 Ylist[i++]=iy;
212 }
213 }
214 }
215 *Nlist=i;
216}
217
218
219void AliMUONSegmentationSlatModuleN::Init(Int_t chamber)
220{
4c503756 221//
222// Fill the arrays fCx (x-contour) for each sector
223// These arrays help in converting from real to pad co-ordinates and
224// vice versa
225//
226// Segmentation is defined by rectangular modules approximating
227// concentric circles as shown below
228//
229// PCB module size in cm
de05461e 230
231 printf("\n Initialise Segmentation SlatModuleN \n");
232
233
4c503756 234 fDxPCB=40;
235 fDyPCB=40;
236//
237// number of pad rows per PCB
238//
239 fNpxPCB = Int_t(fDxPCB/fDpx) ;
240//
241// Calculate padsize along y
242 (*fDpxD)[fNsec-1]=fDpy;
243 if (fNsec > 1) {
244 for (Int_t i=fNsec-2; i>=0; i--){
245 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
4c503756 246 }
247 }
248//
249// fill the arrays defining the pad segmentation boundaries
250//
251//
252// Loop over sectors (isec=0 is the dead space surounding the beam pipe)
253
254 for (Int_t isec=0; isec<4; isec++) {
255 if (isec==0) {
256 fCx[0] = 0;
257 fNpxS[0] = 0;
258 fNpyS[0] = 0;
259 } else {
260 fNpxS[isec] = fNpxS[isec-1] + fPcbBoards[isec]*fNpxPCB;
261 fNpyS[isec] = Int_t(fDyPCB/fDpy)*(*fNDiv)[isec];
4c503756 262 fCx[isec] = fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
263 fNpx += fPcbBoards[isec] * fNpxPCB;
264 }
265 } // sectors
266
267 fNpx=fNpxS[3];
268 fNpy=Int_t(fDyPCB/fDpy)*(*fNDiv)[1];
de2f6d11 269//
270 fId = chamber;
271
4c503756 272}
273
274
275
276
277
278
279
280
281
282
283
284