global variables removed
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTriggerY.cxx
CommitLineData
a9e2aefa 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$
3f2cdba8 18Revision 1.2 2000/06/15 07:58:48 morsch
19Code from MUON-dev joined
20
a9e2aefa 21Revision 1.1.2.1 2000/06/09 21:51:58 morsch
22Code from AliMUONSegResTriggerY.cxx
23
24*/
25
3f2cdba8 26
a9e2aefa 27/*
28Old Log:
29Revision 1.1.2.4 2000/05/05 10:17:04 morsch
30Y strip numerotation changed (CP)
31
32Revision 1.1.2.3 2000/04/26 12:33:40 morsch
33Minor changes in some methods (CP)
34
35Revision 1.1.2.2 2000/02/20 07:49:50 morsch
36Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
37
38Revision 1.1.2.1 2000/02/17 14:34:57 morsch
39Draft version from P. Crochet
40
41*/
42
43#include "AliMUONSegmentationTriggerY.h"
3f2cdba8 44#include "AliMUONTriggerConstants.h"
a9e2aefa 45#include "TMath.h"
46#include "TRandom.h"
47#include "TArc.h"
48#include "AliMUONChamber.h"
49#include <iostream.h>
50ClassImp(AliMUONSegmentationTriggerY)
51
3f2cdba8 52//------------------------------------------------------------------
a9e2aefa 53void AliMUONSegmentationTriggerY::Init(AliMUONChamber* Chamber)
54{
3f2cdba8 55// intialize Y segmentation
a9e2aefa 56 cout << "Initialize Trigger Chamber Geometry Y " << "\n";
57 AliMUONSegmentationTrigger::Init(Chamber);
58
59// calculate x & y position of Y strips
3f2cdba8 60 Int_t nModule=AliMUONTriggerConstants::Nmodule();
61 for (Int_t imodule=0; imodule<nModule; imodule++) {
62 Float_t width=StripSizeY(AliMUONTriggerConstants::ModuleId(imodule));
63 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
64 for (Int_t istrip=0; istrip<nStrip; istrip++){
a9e2aefa 65 if (imodule<63) {
3f2cdba8 66 fXofysmin[imodule][istrip]=
67 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
68 fXofysmax[imodule][istrip]=
69 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
a9e2aefa 70 } else {
71 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
72 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
73 }
3f2cdba8 74 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
75 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
a9e2aefa 76 }
77 }
78
79}
80
81//------------------------------------------------------------------
82void AliMUONSegmentationTriggerY::GetPadIxy(Float_t x,Float_t y,Int_t &ix,Int_t &iy){
83// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
84// x,y = real coordinates; ix = module number , iy = strip number
85
86 ix = 0;
87 iy = 0;
3f2cdba8 88 Int_t nModule=AliMUONTriggerConstants::Nmodule();
89 for (Int_t imodule=0; imodule<nModule; imodule++) {
90 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
91 for (Int_t istrip=0; istrip<nStrip; istrip++){
a9e2aefa 92 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
93 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
3f2cdba8 94 ix = AliMUONTriggerConstants::ModuleId(imodule);
a9e2aefa 95 iy = istrip;
96 }
97 }
98 }
99}
100
101//------------------------------------------------------------------
102void AliMUONSegmentationTriggerY::GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y){
103// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
104// ix = module number , iy = strip number; x,y = center of strip
105 x = 0.;
106 y = 0.;
3f2cdba8 107 Int_t nModule=AliMUONTriggerConstants::Nmodule();
108 for (Int_t imodule=0; imodule<nModule; imodule++) {
109 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
a9e2aefa 110 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
111 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
112 }
113 }
114}
115
116//------------------------------------------------------------------
117void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
118{
119// Sets the padsize
120//
121 fDpx=p1;
122 fDpy=p2;
123}
124
125//------------------------------------------------------------------
126void AliMUONSegmentationTriggerY::
127Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2]){
128// Returns list of next neighbours for given Pad (ix, iy)
129 Int_t absiX=TMath::Abs(iX);
130 *Nlist = 0;
131
132 if (absiX!=0) {
133 Int_t numModule=ModuleNumber(absiX);
134
3f2cdba8 135 if (iY==AliMUONTriggerConstants::NstripY(numModule)-1) { // strip right
a9e2aefa 136 if (absiX%10!=7) {
137 *Nlist=1;
138 Xlist[0]=absiX+1;
139 Ylist[0]=0;
140 }
141 } else {
142 *Nlist=1;
143 Xlist[0]=absiX;
144 Ylist[0]=iY+1;
145 }
146
147 if (iY==0) { // strip left
148 if (absiX%10!=1&&absiX!=52) {
149 *Nlist=*Nlist+1;
150 Xlist[*Nlist-1]=absiX-1;
3f2cdba8 151 Ylist[*Nlist-1]=AliMUONTriggerConstants::NstripY(numModule-1)-1;
a9e2aefa 152 }
153 } else {
154 *Nlist=*Nlist+1;
155 Xlist[*Nlist-1]=absiX;
156 Ylist[*Nlist-1]=iY-1;
157 }
158
159 if (iX<0) { // left side of chamber
160 for (Int_t i=0; i<*Nlist; i++) {Xlist[i]=-Xlist[i];}
161 }
162 }
163}
164
165//------------------------------------------------------------------
166void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
167{
168 // Sets virtual pad coordinates, needed for evaluating pad response
169 // outside the tracking program
170 GetPadCxy(ix,iy,fx,fy);
171 GetPadIxy(fx,fy,fix,fiy);
172 fSector=Sector(ix,iy);
173}
174
175//------------------------------------------------------------------
176Int_t AliMUONSegmentationTriggerY::ISector()
177{ return fSector;}
178
179//------------------------------------------------------------------
180Int_t AliMUONSegmentationTriggerY::Ix()
181{ return fix;}
182
183//------------------------------------------------------------------
184Int_t AliMUONSegmentationTriggerY::Iy()
185{ return fiy;}
186
187//------------------------------------------------------------------
188Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec)
3f2cdba8 189{
190// returns x size of y strips for sector isec
a9e2aefa 191 if (isec==1) {
192 return 2.125*fZscale;
193 } else if (isec==2) {
194 return 2.125*fZscale;
195 } else if (isec==3) {
196 return 2.125*fZscale;
197 } else if (isec==4) {
198 return 4.25*fZscale;
199 } else {
200 return 0.;
201 }
202}
203
204//------------------------------------------------------------------
205Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec)
3f2cdba8 206{
207// returns y size of y strips for sector isec
a9e2aefa 208 if (isec==1) {
209 return 68.0*fZscale;
210 } else if (isec==2) {
211 return 51.0*fZscale;
212 } else if (isec==3) {
213 return 68.0*fZscale;
214 } else if (isec==4) {
215 return 68.0*fZscale;
216 } else if (isec==5) {
217 return 68.0*fZscale;
218 } else {
219 return 0.;
220 }
221
222}
223
224//------------------------------------------------------------------
225void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
3f2cdba8 226{
227// set hits during diintegration
228 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
229}
a9e2aefa 230
231//------------------------------------------------------------------
232Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
233{
234// Returns sector number for given module
235//
236 Int_t absix=TMath::Abs(ix);
237 Int_t iwidth=Int_t(StripSizeY(absix));
3f2cdba8 238
a9e2aefa 239 if (absix==52) {
240 return 1;
241 } else if (absix==41||absix==61) {
242 return 2;
243 } else if (iwidth==2) {
244 return 3;
245 } else if (iwidth==4) {
246 return 4;
247 } else {
248 return 0;
249 }
250}
251
252//------------------------------------------------------------------
253void AliMUONSegmentationTriggerY::
254IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width)
255{
256// returns quantities needed to evaluate neighbour strip response
257 Int_t ix,iy;
258 Float_t xstrip,ystrip;
259 GetPadIxy(fxhit,fyhit,ix,iy);
260 GetPadCxy(ix,iy,xstrip,ystrip);
261 x1=fxhit; // hit x position
262 x2=xstrip; // x coordinate of the main strip
263 x3=fx; // current strip real x coordinate
264 width=StripSizeY(ix); // width of the main strip
265}
266
267
268
269