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