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