]>
Commit | Line | Data |
---|---|---|
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$ | |
a30a000f | 18 | Revision 1.2 2000/06/15 07:58:48 morsch |
19 | Code from MUON-dev joined | |
20 | ||
a9e2aefa | 21 | Revision 1.1.2.1 2000/06/09 21:37:56 morsch |
22 | AliMUONSegmentationV02 code from AliMUONSegResV02.cxx | |
23 | ||
4c039060 | 24 | */ |
25 | ||
a9e2aefa | 26 | |
27 | ||
a897a37a | 28 | ///////////////////////////////////////////////////// |
29 | // Segmentation and Response classes version 02 // | |
30 | ///////////////////////////////////////////////////// | |
31 | ||
a9e2aefa | 32 | |
33 | #include "AliMUONSegmentationV02.h" | |
a897a37a | 34 | #include "iostream.h" |
35 | ||
36 | //___________________________________________ | |
a9e2aefa | 37 | ClassImp(AliMUONSegmentationV02) |
a897a37a | 38 | |
a9e2aefa | 39 | void AliMUONSegmentationV02::SetPadSize(Float_t p1, Float_t p2) |
a897a37a | 40 | { |
a9e2aefa | 41 | // Sets the padsize |
42 | // | |
a897a37a | 43 | fDpy=p1; |
44 | fDpx=p2; | |
45 | } | |
46 | ||
a9e2aefa | 47 | Int_t AliMUONSegmentationV02::Npx() |
48 | // Returns maximum number if pads in x | |
49 | {return AliMUONSegmentationV01::Npy();} | |
a897a37a | 50 | |
a9e2aefa | 51 | Int_t AliMUONSegmentationV02::Npy() |
52 | // Returns maximum number if pads in y | |
53 | {return AliMUONSegmentationV01::Npx();} | |
a897a37a | 54 | |
55 | ||
a9e2aefa | 56 | Float_t AliMUONSegmentationV02::Dpx(Int_t isec) |
57 | // Returns pad-size in x | |
a897a37a | 58 | {return fDpy;} |
59 | ||
a9e2aefa | 60 | Float_t AliMUONSegmentationV02::Dpy(Int_t isec) |
61 | // Returns pad-size in y | |
a897a37a | 62 | {return fDpxD[isec];} |
a9e2aefa | 63 | Int_t AliMUONSegmentationV02::Sector(Int_t ix, Int_t iy) |
64 | // Returns sector number for given pad position | |
65 | // | |
66 | {return AliMUONSegmentationV01::Sector(iy, ix);} | |
a897a37a | 67 | |
a9e2aefa | 68 | void AliMUONSegmentationV02:: |
a897a37a | 69 | |
a30a000f | 70 | GetPadI(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 | { |
a30a000f | 74 | AliMUONSegmentationV01::GetPadI(y, x, iy, ix); |
a897a37a | 75 | // printf("\n x,y,ix,iy %f %f %d %d", x,y,ix,iy); |
76 | } | |
77 | ||
a9e2aefa | 78 | void AliMUONSegmentationV02:: |
a30a000f | 79 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) |
a9e2aefa | 80 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) |
81 | // | |
a897a37a | 82 | { |
a30a000f | 83 | AliMUONSegmentationV01::GetPadC(iy, ix, y, x); |
a897a37a | 84 | } |
a9e2aefa | 85 | void AliMUONSegmentationV02::SetPad(Int_t ix,Int_t iy) |
a897a37a | 86 | { |
a9e2aefa | 87 | // |
88 | // Sets virtual pad coordinates, needed for evaluating pad response | |
89 | // outside the tracking program | |
a30a000f | 90 | GetPadC(ix,iy,fx,fy); |
a897a37a | 91 | fSector=Sector(ix,iy); |
92 | } | |
93 | ||
94 | ||
95 | ||
a9e2aefa | 96 | void AliMUONSegmentationV02::NextPad() |
a897a37a | 97 | { |
a9e2aefa | 98 | // Stepper for the iteration over pads |
99 | // | |
a897a37a | 100 | // |
101 | // Step to next pad in integration region | |
102 | Float_t xc,yc; | |
103 | Int_t ixc; | |
104 | ||
105 | // step up | |
106 | if (fy < fymax && fy != 0) { | |
107 | if (fiy==-1) fiy++; | |
108 | fiy++; | |
109 | // step right | |
110 | } else if (fix != fixmax) { | |
111 | if (fix==-1) fix++; | |
112 | fix++; | |
113 | // get y-position of next row (yc), xc not used here | |
a30a000f | 114 | GetPadC(fix,fiy,xc,yc); |
a897a37a | 115 | // get x-pad coordiante for 1 pad in row (fix) |
a30a000f | 116 | GetPadI(xc,fymin,ixc,fiy); |
a897a37a | 117 | } else { |
118 | printf("\n Error: Stepping outside integration region\n "); | |
119 | } | |
a30a000f | 120 | GetPadC(fix,fiy,fx,fy); |
a897a37a | 121 | fSector=Sector(fix,fiy); |
122 | if (MorePads() && | |
a9e2aefa | 123 | (fSector ==-1 || fSector==0 )) |
a897a37a | 124 | NextPad(); |
125 | // printf("\n this pad %f %f %d %d \n",fx,fy,fix,fiy); | |
126 | ||
127 | } | |
128 | ||
a9e2aefa | 129 | Int_t AliMUONSegmentationV02::MorePads() |
130 | // Stopping condition for the iterator over pads | |
131 | // | |
a897a37a | 132 | // |
133 | // Are there more pads in the integration region | |
134 | { | |
135 | if ((fy >= fymax && fix >= fixmax) || fx==0) { | |
136 | return 0; | |
137 | } else { | |
138 | return 1; | |
139 | } | |
140 | } | |
141 | ||
a9e2aefa | 142 | void AliMUONSegmentationV02:: |
a897a37a | 143 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) |
144 | { | |
a9e2aefa | 145 | // Returns list of next neighbours for given Pad (iX, iY) |
146 | // | |
147 | Int_t n; | |
148 | AliMUONSegmentationV01::Neighbours(iY, iX, &n, Ylist, Xlist); | |
149 | *Nlist=n; | |
a897a37a | 150 | } |
151 | ||
152 | ||
a9e2aefa | 153 | |
154 |