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