]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationSlatN.cxx
Put vacuum in beam-pipe not air.
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationSlatN.cxx
CommitLineData
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$
e9e4cdf2 18Revision 1.3 2000/10/22 16:55:43 morsch
19Use only x-symmetry in global to local transformations and delegation.
20
2b202c2e 21Revision 1.2 2000/10/09 14:06:18 morsch
22Some type cast problems of type (TMath::Sign((Float_t)1.,x)) corrected (P.H.)
23
deba22dc 24Revision 1.1 2000/10/06 09:00:47 morsch
25Segmentation class for chambers built out of slats.
26
5de7d27f 27*/
28
29#include "AliMUONSegmentationSlatN.h"
30#include "AliMUONSegmentationSlatModuleN.h"
31#include "TArrayI.h"
32#include "TArrayF.h"
33#include "TObjArray.h"
34#include <TMath.h>
35#include <iostream.h>
36
37//___________________________________________
38ClassImp(AliMUONSegmentationSlatN);
39
5de7d27f 40AliMUONSegmentationSlatN::AliMUONSegmentationSlatN()
41{
42// Default constructor
43}
44
45
e9e4cdf2 46AliMUONSegmentationSlatN::AliMUONSegmentationSlatN(Int_t nsec)
47 : AliMUONSegmentationSlat(nsec)
48{
49// Non default constructor
50}
51
52
5de7d27f 53Float_t AliMUONSegmentationSlatN::Dpx(Int_t isec) const
54{
55//
56// Returns y-pad size for given sector isec
57 return fDpx;
58}
59
60Float_t AliMUONSegmentationSlatN::Dpy(Int_t isec) const
61{
62//
63// Returns x-pad size for given sector isec
64// isec = 100*islat+iregion
65//
66 Int_t islat, iregion;
67 islat = isec/100;
68 iregion = isec%100;
69 return Slat(islat)->Dpy(iregion);
70}
71
72
73
74void AliMUONSegmentationSlatN::GlobalToLocal(
75 Int_t ix, Int_t iy, Int_t &islat, Int_t &ixlocal, Int_t &iylocal)
76{
77//
78// Perform local to global transformation for pad coordinates
79//
2b202c2e 80 Int_t iytemp = iy;
5de7d27f 81 Int_t index = 0;
82
83 iylocal = iytemp;
84 ix=TMath::Abs(ix);
85
86//
87// Find slat number (index) and iylocal
88 for (Int_t i=0; i<fNSlats; i++) {
89 if (ix <= Slat(i)->Npx()) {
90 Int_t isec=Slat(i)->Sector(ix,1);
91 iytemp-=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1];
92 }
93 if (iytemp <= 0) break;
94 iylocal = iytemp;
95 index=i+1;
96 }
97 ixlocal=ix;
98 islat=index;
5de7d27f 99}
100
101void AliMUONSegmentationSlatN::LocalToGlobal(
102 Int_t islat, Int_t ixlocal, Int_t iylocal, Int_t &ix, Int_t &iy)
103{
104// Local to global transformation for pad coordinates
105
106 Int_t i;
107 iy=iylocal;
108
109//
110// Find iy global by adding iy offset from slats below
111 for (i=0; i<islat; i++) {
112 if (ixlocal <= Slat(i)->Npx()) {
113 Int_t isec=Slat(i)->Sector(ixlocal,1);
114 iy+=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1];
115 }
116 }
117//
118// Perform symmetry transformation
2b202c2e 119 ix=ixlocal*fSym;
5de7d27f 120}
121
122
123void AliMUONSegmentationSlatN::
124GetPadI(Float_t x, Float_t y, Float_t z, Int_t &ix, Int_t &iy)
125{
126// Returns pad coordinates for given set of space coordinates
127
128 Int_t islat, i;
129 Float_t xlocal, ylocal;
130// Transform to local coordinates
131 AliMUONSegmentationSlat::GlobalToLocal(x,y,z,islat,xlocal,ylocal);
132 Slat(islat)->GetPadI(xlocal, ylocal, ix, iy);
133// add to local iy offfset from slats below
134 for (i=0; i<islat; i++) {
135 if (ix <= Slat(i)->Npx()) {
136 Int_t isec=Slat(i)->Sector(ix,1);
137 iy+=Slat(i)->Npy()*(*fNDiv)[isec]/(*fNDiv)[1];
138 }
139 }
140// Determine sign depending on quadrant
deba22dc 141 ix=ix*Int_t(TMath::Sign((Float_t)1.,x));
5de7d27f 142}
143
144AliMUONSegmentationSlatModule* AliMUONSegmentationSlatN::
145CreateSlatModule()
146{
147 // Factory method for slat module
e9e4cdf2 148 return new AliMUONSegmentationSlatModuleN(4);
5de7d27f 149}
150
151
152
153
154