]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationSlatN.cxx
Use access functions for hit data members.
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationSlatN.cxx
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 Revision 1.1  2000/10/06 09:00:47  morsch
19 Segmentation class for chambers built out of slats.
20
21 */
22
23 #include "AliMUONSegmentationSlatN.h"
24 #include "AliMUONSegmentationSlatModuleN.h"
25 #include "TArrayI.h"
26 #include "TArrayF.h"
27 #include "TObjArray.h"
28 #include <TMath.h>
29 #include <iostream.h>
30
31 //___________________________________________
32 ClassImp(AliMUONSegmentationSlatN);
33
34
35
36 AliMUONSegmentationSlatN::AliMUONSegmentationSlatN()
37 {
38 // Default constructor
39 }
40
41
42 Float_t AliMUONSegmentationSlatN::Dpx(Int_t isec) const
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 //
69     Int_t iytemp = TMath::Abs(iy); 
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;
88 // Done !
89 }
90
91 void AliMUONSegmentationSlatN::LocalToGlobal(
92     Int_t islat, Int_t ixlocal, Int_t iylocal, Int_t &ix, Int_t &iy)
93 {
94 // Local to global transformation for pad coordinates
95     
96     Int_t i;
97     iy=iylocal;
98     
99 //
100 // Find iy global by adding iy offset from slats below
101     for (i=0; i<islat; i++) {
102         if (ixlocal <= Slat(i)->Npx()) {
103             Int_t isec=Slat(i)->Sector(ixlocal,1);
104             iy+=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1];
105         }
106     }
107 //
108 // Perform symmetry transformation
109     ix=ixlocal*fSym[0];
110     iy=iy*fSym[1];
111 }
112
113
114 void AliMUONSegmentationSlatN::
115 GetPadI(Float_t x, Float_t y, Float_t z, Int_t &ix, Int_t &iy) 
116 {
117 // Returns pad coordinates for given set of space coordinates
118
119     Int_t islat, i;
120     Float_t xlocal, ylocal;
121 // Transform to local coordinates    
122     AliMUONSegmentationSlat::GlobalToLocal(x,y,z,islat,xlocal,ylocal);
123     Slat(islat)->GetPadI(xlocal, ylocal, ix, iy);
124 // add to local iy offfset from slats below  
125     for (i=0; i<islat; i++) {
126         if (ix <= Slat(i)->Npx()) {
127             Int_t isec=Slat(i)->Sector(ix,1);
128             iy+=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1];
129         }
130     }
131 // Determine sign depending on quadrant
132     ix=ix*Int_t(TMath::Sign((Float_t)1.,x));
133     iy=iy*Int_t(TMath::Sign((Float_t)1.,y));    
134
135 }
136
137 AliMUONSegmentationSlatModule* AliMUONSegmentationSlatN::
138 CreateSlatModule()
139 {
140     // Factory method for slat module
141     return new AliMUONSegmentationSlatModuleN();
142 }
143
144
145
146
147