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