1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.2 2000/10/09 14:06:18 morsch
19 Some type cast problems of type (TMath::Sign((Float_t)1.,x)) corrected (P.H.)
21 Revision 1.1 2000/10/06 09:00:47 morsch
22 Segmentation class for chambers built out of slats.
26 #include "AliMUONSegmentationSlatN.h"
27 #include "AliMUONSegmentationSlatModuleN.h"
30 #include "TObjArray.h"
34 //___________________________________________
35 ClassImp(AliMUONSegmentationSlatN);
39 AliMUONSegmentationSlatN::AliMUONSegmentationSlatN()
41 // Default constructor
45 Float_t AliMUONSegmentationSlatN::Dpx(Int_t isec) const
48 // Returns y-pad size for given sector isec
52 Float_t AliMUONSegmentationSlatN::Dpy(Int_t isec) const
55 // Returns x-pad size for given sector isec
56 // isec = 100*islat+iregion
61 return Slat(islat)->Dpy(iregion);
66 void AliMUONSegmentationSlatN::GlobalToLocal(
67 Int_t ix, Int_t iy, Int_t &islat, Int_t &ixlocal, Int_t &iylocal)
70 // Perform local to global transformation for pad coordinates
79 // Find slat number (index) and iylocal
80 for (Int_t i=0; i<fNSlats; i++) {
81 if (ix <= Slat(i)->Npx()) {
82 Int_t isec=Slat(i)->Sector(ix,1);
83 iytemp-=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1];
85 if (iytemp <= 0) break;
93 void AliMUONSegmentationSlatN::LocalToGlobal(
94 Int_t islat, Int_t ixlocal, Int_t iylocal, Int_t &ix, Int_t &iy)
96 // Local to global transformation for pad coordinates
102 // Find iy global by adding iy offset from slats below
103 for (i=0; i<islat; i++) {
104 if (ixlocal <= Slat(i)->Npx()) {
105 Int_t isec=Slat(i)->Sector(ixlocal,1);
106 iy+=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1];
110 // Perform symmetry transformation
115 void AliMUONSegmentationSlatN::
116 GetPadI(Float_t x, Float_t y, Float_t z, Int_t &ix, Int_t &iy)
118 // Returns pad coordinates for given set of space coordinates
121 Float_t xlocal, ylocal;
122 // Transform to local coordinates
123 AliMUONSegmentationSlat::GlobalToLocal(x,y,z,islat,xlocal,ylocal);
124 Slat(islat)->GetPadI(xlocal, ylocal, ix, iy);
125 // add to local iy offfset from slats below
126 for (i=0; i<islat; i++) {
127 if (ix <= Slat(i)->Npx()) {
128 Int_t isec=Slat(i)->Sector(ix,1);
129 iy+=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1];
132 // Determine sign depending on quadrant
133 ix=ix*Int_t(TMath::Sign((Float_t)1.,x));
136 AliMUONSegmentationSlatModule* AliMUONSegmentationSlatN::
139 // Factory method for slat module
140 return new AliMUONSegmentationSlatModuleN();