]>
Commit | Line | Data |
---|---|---|
5de7d27f | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
5de7d27f | 17 | |
18 | #include "AliMUONSegmentationSlatN.h" | |
19 | #include "AliMUONSegmentationSlatModuleN.h" | |
20 | #include "TArrayI.h" | |
21 | #include "TArrayF.h" | |
22 | #include "TObjArray.h" | |
23 | #include <TMath.h> | |
70479d0e | 24 | #include <Riostream.h> |
5de7d27f | 25 | |
26 | //___________________________________________ | |
27 | ClassImp(AliMUONSegmentationSlatN); | |
28 | ||
5de7d27f | 29 | AliMUONSegmentationSlatN::AliMUONSegmentationSlatN() |
30 | { | |
31 | // Default constructor | |
32 | } | |
33 | ||
34 | ||
e9e4cdf2 | 35 | AliMUONSegmentationSlatN::AliMUONSegmentationSlatN(Int_t nsec) |
36 | : AliMUONSegmentationSlat(nsec) | |
37 | { | |
38 | // Non default constructor | |
39 | } | |
40 | ||
41 | ||
6aaf81e6 | 42 | Float_t AliMUONSegmentationSlatN::Dpx(Int_t /*isec*/) const |
5de7d27f | 43 | { |
44 | // | |
45 | // Returns y-pad size for given sector isec | |
46 | return fDpx; | |
47 | } | |
48 | ||
49 | Float_t AliMUONSegmentationSlatN::Dpy(Int_t isec) const | |
50 | { | |
51 | // | |
52 | // Returns x-pad size for given sector isec | |
53 | // isec = 100*islat+iregion | |
54 | // | |
55 | Int_t islat, iregion; | |
56 | islat = isec/100; | |
57 | iregion = isec%100; | |
58 | return Slat(islat)->Dpy(iregion); | |
59 | } | |
60 | ||
61 | ||
62 | ||
63 | void AliMUONSegmentationSlatN::GlobalToLocal( | |
64 | Int_t ix, Int_t iy, Int_t &islat, Int_t &ixlocal, Int_t &iylocal) | |
65 | { | |
66 | // | |
67 | // Perform local to global transformation for pad coordinates | |
68 | // | |
2b202c2e | 69 | Int_t iytemp = iy; |
5de7d27f | 70 | Int_t index = 0; |
71 | ||
72 | iylocal = iytemp; | |
73 | ix=TMath::Abs(ix); | |
74 | ||
75 | // | |
76 | // Find slat number (index) and iylocal | |
77 | for (Int_t i=0; i<fNSlats; i++) { | |
78 | if (ix <= Slat(i)->Npx()) { | |
79 | Int_t isec=Slat(i)->Sector(ix,1); | |
80 | iytemp-=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1]; | |
81 | } | |
82 | if (iytemp <= 0) break; | |
83 | iylocal = iytemp; | |
84 | index=i+1; | |
85 | } | |
86 | ixlocal=ix; | |
87 | islat=index; | |
5de7d27f | 88 | } |
89 | ||
90 | void AliMUONSegmentationSlatN::LocalToGlobal( | |
91 | Int_t islat, Int_t ixlocal, Int_t iylocal, Int_t &ix, Int_t &iy) | |
92 | { | |
93 | // Local to global transformation for pad coordinates | |
94 | ||
95 | Int_t i; | |
96 | iy=iylocal; | |
97 | ||
98 | // | |
99 | // Find iy global by adding iy offset from slats below | |
100 | for (i=0; i<islat; i++) { | |
101 | if (ixlocal <= Slat(i)->Npx()) { | |
102 | Int_t isec=Slat(i)->Sector(ixlocal,1); | |
103 | iy+=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1]; | |
104 | } | |
105 | } | |
106 | // | |
107 | // Perform symmetry transformation | |
2b202c2e | 108 | ix=ixlocal*fSym; |
5de7d27f | 109 | } |
110 | ||
111 | ||
112 | void AliMUONSegmentationSlatN:: | |
113 | GetPadI(Float_t x, Float_t y, Float_t z, Int_t &ix, Int_t &iy) | |
114 | { | |
115 | // Returns pad coordinates for given set of space coordinates | |
116 | ||
117 | Int_t islat, i; | |
118 | Float_t xlocal, ylocal; | |
119 | // Transform to local coordinates | |
120 | AliMUONSegmentationSlat::GlobalToLocal(x,y,z,islat,xlocal,ylocal); | |
121 | Slat(islat)->GetPadI(xlocal, ylocal, ix, iy); | |
122 | // add to local iy offfset from slats below | |
123 | for (i=0; i<islat; i++) { | |
124 | if (ix <= Slat(i)->Npx()) { | |
125 | Int_t isec=Slat(i)->Sector(ix,1); | |
126 | iy+=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1]; | |
127 | } | |
128 | } | |
129 | // Determine sign depending on quadrant | |
deba22dc | 130 | ix=ix*Int_t(TMath::Sign((Float_t)1.,x)); |
5de7d27f | 131 | } |
132 | ||
133 | AliMUONSegmentationSlatModule* AliMUONSegmentationSlatN:: | |
134 | CreateSlatModule() | |
135 | { | |
136 | // Factory method for slat module | |
e9e4cdf2 | 137 | return new AliMUONSegmentationSlatModuleN(4); |
5de7d27f | 138 | } |
139 | ||
140 | ||
141 | ||
142 | ||
143 |