Adaption to new fluka common blocks (E. Futo)
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationV02.cxx
CommitLineData
4c039060 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.8 2001/01/26 21:25:48 morsch
19Empty default constructors and.
20
e9e4cdf2 21Revision 1.7 2000/12/21 22:12:41 morsch
22Clean-up of coding rule violations,
23
de05461e 24Revision 1.6 2000/10/18 08:41:32 morsch
25Make NextPad() and MorePads() to iterate until the end.
26
d7d176c9 27Revision 1.5 2000/10/03 21:48:07 morsch
28Adopt to const declaration of some of the methods in AliSegmentation.
29
c3eff6ad 30Revision 1.4 2000/10/02 16:58:29 egangler
31Cleaning of the code :
32-> coding conventions
33-> void Streamers
34-> some useless includes removed or replaced by "class" statement
35
ecfa008b 36Revision 1.3 2000/07/03 11:54:57 morsch
37AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
38The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
39
a30a000f 40Revision 1.2 2000/06/15 07:58:48 morsch
41Code from MUON-dev joined
42
a9e2aefa 43Revision 1.1.2.1 2000/06/09 21:37:56 morsch
44AliMUONSegmentationV02 code from AliMUONSegResV02.cxx
45
4c039060 46*/
47
a9e2aefa 48
49
a897a37a 50/////////////////////////////////////////////////////
51// Segmentation and Response classes version 02 //
52/////////////////////////////////////////////////////
53
a9e2aefa 54
55#include "AliMUONSegmentationV02.h"
70479d0e 56#include "Riostream.h"
a897a37a 57
58//___________________________________________
a9e2aefa 59ClassImp(AliMUONSegmentationV02)
a897a37a 60
e9e4cdf2 61
62AliMUONSegmentationV02::AliMUONSegmentationV02(Int_t nsec):
63 AliMUONSegmentationV01(nsec)
64{
65// Non default constructor
66}
67
a9e2aefa 68void AliMUONSegmentationV02::SetPadSize(Float_t p1, Float_t p2)
a897a37a 69{
a9e2aefa 70// Sets the padsize
71//
a897a37a 72 fDpy=p1;
73 fDpx=p2;
74}
75
c3eff6ad 76Int_t AliMUONSegmentationV02::Npx() const
a9e2aefa 77// Returns maximum number if pads in x
78{return AliMUONSegmentationV01::Npy();}
a897a37a 79
c3eff6ad 80Int_t AliMUONSegmentationV02::Npy() const
a9e2aefa 81// Returns maximum number if pads in y
82{return AliMUONSegmentationV01::Npx();}
a897a37a 83
84
c3eff6ad 85Float_t AliMUONSegmentationV02::Dpx(Int_t isec) const
a9e2aefa 86// Returns pad-size in x
a897a37a 87{return fDpy;}
88
c3eff6ad 89Float_t AliMUONSegmentationV02::Dpy(Int_t isec) const
a9e2aefa 90// Returns pad-size in y
c3eff6ad 91{return (*fDpxD)[isec];}
92
93Int_t AliMUONSegmentationV02::Sector(Int_t ix, Int_t iy)
a9e2aefa 94// Returns sector number for given pad position
95//
96{return AliMUONSegmentationV01::Sector(iy, ix);}
a897a37a 97
a9e2aefa 98void AliMUONSegmentationV02::
c3eff6ad 99GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
a9e2aefa 100// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
101//
a897a37a 102{
c3eff6ad 103AliMUONSegmentationV01::GetPadI(y, x, iy, ix);
a897a37a 104// printf("\n x,y,ix,iy %f %f %d %d", x,y,ix,iy);
105}
106
a9e2aefa 107void AliMUONSegmentationV02::
c3eff6ad 108GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
de05461e 109{
a9e2aefa 110// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
111//
de05461e 112
a30a000f 113 AliMUONSegmentationV01::GetPadC(iy, ix, y, x);
a897a37a 114}
a9e2aefa 115void AliMUONSegmentationV02::SetPad(Int_t ix,Int_t iy)
a897a37a 116{
a9e2aefa 117 //
118 // Sets virtual pad coordinates, needed for evaluating pad response
119 // outside the tracking program
ecfa008b 120 GetPadC(ix,iy,fX,fY);
a897a37a 121 fSector=Sector(ix,iy);
122}
123
124
125
a9e2aefa 126void AliMUONSegmentationV02::NextPad()
a897a37a 127{
a9e2aefa 128// Stepper for the iteration over pads
129//
a897a37a 130 //
131 // Step to next pad in integration region
132 Float_t xc,yc;
133 Int_t ixc;
134
135// step up
ecfa008b 136 if (fY < fYmax && fY != 0) {
137 if (fIy==-1) fIy++;
138 fIy++;
a897a37a 139// step right
ecfa008b 140 } else if (fIx != fIxmax) {
141 if (fIx==-1) fIx++;
142 fIx++;
a897a37a 143// get y-position of next row (yc), xc not used here
ecfa008b 144 GetPadC(fIx,fIy,xc,yc);
145// get x-pad coordiante for 1 pad in row (fIx)
146 GetPadI(xc,fYmin,ixc,fIy);
a897a37a 147 } else {
d7d176c9 148 fIx=fIy=-1;
a897a37a 149 }
ecfa008b 150 GetPadC(fIx,fIy,fX,fY);
151 fSector=Sector(fIx,fIy);
a897a37a 152 if (MorePads() &&
a9e2aefa 153 (fSector ==-1 || fSector==0 ))
a897a37a 154 NextPad();
ecfa008b 155// printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy);
a897a37a 156
157}
158
a9e2aefa 159Int_t AliMUONSegmentationV02::MorePads()
de05461e 160{
a9e2aefa 161// Stopping condition for the iterator over pads
162//
a897a37a 163//
164// Are there more pads in the integration region
de05461e 165
d7d176c9 166 return (fIx != -1 || fIy != -1);
167/*
ecfa008b 168 if ((fY >= fYmax && fIx >= fIxmax) || fX==0) {
a897a37a 169 return 0;
170 } else {
171 return 1;
172 }
d7d176c9 173*/
a897a37a 174}
175
a9e2aefa 176void AliMUONSegmentationV02::
c3eff6ad 177Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
a897a37a 178{
a9e2aefa 179// Returns list of next neighbours for given Pad (iX, iY)
180//
181 Int_t n;
182 AliMUONSegmentationV01::Neighbours(iY, iX, &n, Ylist, Xlist);
183 *Nlist=n;
a897a37a 184}
185
186
a9e2aefa 187
188