- Welding section on absorber side (LHCVC2C_001)
[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
88cb7938 16/* $Id$ */
a9e2aefa 17
a897a37a 18/////////////////////////////////////////////////////
19// Segmentation and Response classes version 02 //
20/////////////////////////////////////////////////////
21
a9e2aefa 22
23#include "AliMUONSegmentationV02.h"
70479d0e 24#include "Riostream.h"
a897a37a 25
26//___________________________________________
a9e2aefa 27ClassImp(AliMUONSegmentationV02)
a897a37a 28
e9e4cdf2 29
30AliMUONSegmentationV02::AliMUONSegmentationV02(Int_t nsec):
31 AliMUONSegmentationV01(nsec)
32{
33// Non default constructor
34}
35
a9e2aefa 36void AliMUONSegmentationV02::SetPadSize(Float_t p1, Float_t p2)
a897a37a 37{
a9e2aefa 38// Sets the padsize
39//
a897a37a 40 fDpy=p1;
41 fDpx=p2;
42}
43
c3eff6ad 44Int_t AliMUONSegmentationV02::Npx() const
a9e2aefa 45// Returns maximum number if pads in x
46{return AliMUONSegmentationV01::Npy();}
a897a37a 47
c3eff6ad 48Int_t AliMUONSegmentationV02::Npy() const
a9e2aefa 49// Returns maximum number if pads in y
50{return AliMUONSegmentationV01::Npx();}
a897a37a 51
52
b1ad38fa 53Float_t AliMUONSegmentationV02::Dpx(Int_t /*isec*/) const
a9e2aefa 54// Returns pad-size in x
a897a37a 55{return fDpy;}
56
c3eff6ad 57Float_t AliMUONSegmentationV02::Dpy(Int_t isec) const
a9e2aefa 58// Returns pad-size in y
c3eff6ad 59{return (*fDpxD)[isec];}
60
b1ad38fa 61void AliMUONSegmentationV02::Draw(const char * /*opt*/) const
62{}
63
c3eff6ad 64Int_t AliMUONSegmentationV02::Sector(Int_t ix, Int_t iy)
a9e2aefa 65// Returns sector number for given pad position
66//
67{return AliMUONSegmentationV01::Sector(iy, ix);}
a897a37a 68
a9e2aefa 69void AliMUONSegmentationV02::
c3eff6ad 70GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
a9e2aefa 71// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
72//
a897a37a 73{
c3eff6ad 74AliMUONSegmentationV01::GetPadI(y, x, iy, ix);
a897a37a 75// printf("\n x,y,ix,iy %f %f %d %d", x,y,ix,iy);
76}
77
b1ad38fa 78void AliMUONSegmentationV02::GetPad(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy)
79{
80 GetPadI(x, y, ix, iy);
81}
82
a9e2aefa 83void AliMUONSegmentationV02::
c3eff6ad 84GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
de05461e 85{
a9e2aefa 86// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
87//
de05461e 88
a30a000f 89 AliMUONSegmentationV01::GetPadC(iy, ix, y, x);
a897a37a 90}
a9e2aefa 91void AliMUONSegmentationV02::SetPad(Int_t ix,Int_t iy)
a897a37a 92{
a9e2aefa 93 //
94 // Sets virtual pad coordinates, needed for evaluating pad response
95 // outside the tracking program
ecfa008b 96 GetPadC(ix,iy,fX,fY);
a897a37a 97 fSector=Sector(ix,iy);
98}
99
100
101
a9e2aefa 102void AliMUONSegmentationV02::NextPad()
a897a37a 103{
a9e2aefa 104// Stepper for the iteration over pads
105//
a897a37a 106 //
107 // Step to next pad in integration region
108 Float_t xc,yc;
109 Int_t ixc;
110
111// step up
ecfa008b 112 if (fY < fYmax && fY != 0) {
113 if (fIy==-1) fIy++;
114 fIy++;
a897a37a 115// step right
ecfa008b 116 } else if (fIx != fIxmax) {
117 if (fIx==-1) fIx++;
118 fIx++;
a897a37a 119// get y-position of next row (yc), xc not used here
ecfa008b 120 GetPadC(fIx,fIy,xc,yc);
121// get x-pad coordiante for 1 pad in row (fIx)
122 GetPadI(xc,fYmin,ixc,fIy);
a897a37a 123 } else {
d7d176c9 124 fIx=fIy=-1;
a897a37a 125 }
ecfa008b 126 GetPadC(fIx,fIy,fX,fY);
127 fSector=Sector(fIx,fIy);
a897a37a 128 if (MorePads() &&
a9e2aefa 129 (fSector ==-1 || fSector==0 ))
a897a37a 130 NextPad();
ecfa008b 131// printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy);
a897a37a 132
133}
134
a9e2aefa 135Int_t AliMUONSegmentationV02::MorePads()
de05461e 136{
a9e2aefa 137// Stopping condition for the iterator over pads
138//
a897a37a 139//
140// Are there more pads in the integration region
de05461e 141
d7d176c9 142 return (fIx != -1 || fIy != -1);
143/*
ecfa008b 144 if ((fY >= fYmax && fIx >= fIxmax) || fX==0) {
a897a37a 145 return 0;
146 } else {
147 return 1;
148 }
d7d176c9 149*/
a897a37a 150}
151
a9e2aefa 152void AliMUONSegmentationV02::
c3eff6ad 153Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
a897a37a 154{
a9e2aefa 155// Returns list of next neighbours for given Pad (iX, iY)
156//
157 Int_t n;
158 AliMUONSegmentationV01::Neighbours(iY, iX, &n, Ylist, Xlist);
159 *Nlist=n;
a897a37a 160}
161
162
a9e2aefa 163
164