Cleaning of the code :
[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$
ecfa008b 18Revision 1.5 2000/07/03 11:54:57 morsch
19AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
20The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
21
a30a000f 22Revision 1.4 2000/06/29 12:34:09 morsch
23AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
24it usable with any other geometry class. The link to the object to which it belongs is
25established via an index. This assumes that there exists a global geometry manager
26from which the pointer to the parent object can be obtained (in our case gAlice).
27
d81db581 28Revision 1.3 2000/06/26 10:01:26 pcrochet
29global variables removed
30
3f2cdba8 31Revision 1.2 2000/06/15 07:58:48 morsch
32Code from MUON-dev joined
33
a9e2aefa 34Revision 1.1.2.1 2000/06/09 21:51:03 morsch
35Code from AliMUONSegResTrigger.cxx
36
37*/
38
39
3f2cdba8 40
a9e2aefa 41/*
42Old Log:
43Revision 1.1.2.4 2000/04/26 12:33:25 morsch
44Minor changes in some methods (CP)
45
46Revision 1.1.2.3 2000/03/20 18:14:16 morsch
47Missing sector added.
48
49Revision 1.1.2.2 2000/02/20 07:50:49 morsch
50Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
51
52Revision 1.1.2.1 2000/02/17 14:33:49 morsch
53Draft version from P. Crochet
54
55*/
56
57#include "AliMUONSegmentationTriggerX.h"
3f2cdba8 58#include "AliMUONTriggerConstants.h"
a9e2aefa 59#include "TMath.h"
60#include "TRandom.h"
61#include "TArc.h"
62#include "AliMUONChamber.h"
63#include <iostream.h>
64ClassImp(AliMUONSegmentationTriggerX)
3f2cdba8 65
66//------------------------------------------------------------------
d81db581 67void AliMUONSegmentationTriggerX::Init(Int_t chamber)
a9e2aefa 68{
3f2cdba8 69// intialize X segmentation
a9e2aefa 70 cout << "Initialize Trigger Chamber Geometry X " << "\n";
d81db581 71 AliMUONSegmentationTrigger::Init(chamber);
a9e2aefa 72
73// calculate x & y position of X strips
3f2cdba8 74 Int_t nModule=AliMUONTriggerConstants::Nmodule();
75 for (Int_t imodule=0; imodule<nModule; imodule++) {
76 Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule));
77 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
78 for (Int_t istrip=0; istrip<nStrip; istrip++){
79 fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale;
80 fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale;
a9e2aefa 81
3f2cdba8 82 fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
83 fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
a9e2aefa 84 }
85 }
86}
87
88//------------------------------------------------------------------
a30a000f 89void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy){
a9e2aefa 90// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
91// x,y = real coordinates; ix = module number , iy = strip number
92 ix = 0;
93 iy = 0;
3f2cdba8 94 Int_t nModule=AliMUONTriggerConstants::Nmodule();
95 for (Int_t imodule=0; imodule<nModule; imodule++) {
96 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
97 for (Int_t istrip=0; istrip<nStrip; istrip++){
98 if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
99 y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
100 ix = AliMUONTriggerConstants::ModuleId(imodule);
101 iy = istrip;
102 }
a9e2aefa 103 }
a9e2aefa 104 }
105}
106
107//------------------------------------------------------------------
a30a000f 108void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y){
a9e2aefa 109// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
110// ix = module number , iy = strip number; x,y = center of strip
111 x = 0.;
112 y = 0.;
3f2cdba8 113 Int_t nModule=AliMUONTriggerConstants::Nmodule();
114
115 for (Int_t imodule=0; imodule<nModule; imodule++) {
116 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
a9e2aefa 117 x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.;
118 y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.;
119 }
120 }
121}
122
123//------------------------------------------------------------------
124void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2)
125{
126// Sets the padsize
127//
128 fDpx=p1;
129 fDpy=p2;
130}
131
132//------------------------------------------------------------------
133void AliMUONSegmentationTriggerX::
134Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2]){
135// Returns list of next neighbours for given Pad (ix, iy)
136
137 Int_t absiX=TMath::Abs(iX);
138 *Nlist = 0;
139
140 if (absiX!=0) {
141 Int_t numModule=ModuleNumber(absiX);
142
3f2cdba8 143 if (iY<AliMUONTriggerConstants::NstripX(numModule)-1) { // strip up in same module
a9e2aefa 144 *Nlist=1;
145 Xlist[0]=absiX;
146 Ylist[0]=iY+1;
147 }
148
149 if (iY>0) { // strip down in same module
150 *Nlist=*Nlist+1;
151 Xlist[*Nlist-1]=absiX;
152 Ylist[*Nlist-1]=iY-1;
153 }
154
155 if (iX<0) { // left side of chamber
156 for (Int_t i=0; i<*Nlist; i++) {Xlist[i]=-Xlist[i];}
157 }
158 }
159}
160
161//------------------------------------------------------------------
162void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy)
163{
164 // Sets virtual pad coordinates, needed for evaluating pad response
165 // outside the tracking program
ecfa008b 166 GetPadC(ix,iy,fX,fY);
167 GetPadI(fX,fY,fIx,fIy);
a9e2aefa 168 fSector=Sector(ix,iy);
169}
170
171//------------------------------------------------------------------
172Int_t AliMUONSegmentationTriggerX::ISector()
173{ return fSector;}
174
175//------------------------------------------------------------------
176Int_t AliMUONSegmentationTriggerX::Ix()
ecfa008b 177{ return fIx;}
a9e2aefa 178
179//------------------------------------------------------------------
180Int_t AliMUONSegmentationTriggerX::Iy()
ecfa008b 181{ return fIy;}
a9e2aefa 182
183//------------------------------------------------------------------
184Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec)
3f2cdba8 185{
186// returns x size of x strips for sector isec
a9e2aefa 187
188 if (isec==1) {
189 return 17.0*fZscale;
190 } else if (isec==2) {
191 return 34.0*fZscale;
192 } else if (isec==3) {
193 return 34.0*fZscale;
194 } else if (isec==4) {
195 return 34.0*fZscale;
196 } else if (isec==5) {
197 return 34.0*fZscale;
198 } else if (isec==6) {
199 return 68.0*fZscale;
200 } else {
201 return 0.;
202 }
203}
204
205//------------------------------------------------------------------
206Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec)
3f2cdba8 207{
208// returns y size of x strips for sector isec
a9e2aefa 209
210 if (isec==1) {
211 return 1.0625*fZscale;
212 } else if (isec==2) {
213 return 1.0625*fZscale;
214 } else if (isec==3) {
215 return 1.0625*fZscale;
216 } else if (isec==4) {
217 return 2.125*fZscale;
218 } else if (isec==5) {
219 return 4.25*fZscale;
220 } else if (isec==6) {
221 return 4.25*fZscale;
222 } else {
223 return 0.;
224 }
225}
226
227//------------------------------------------------------------------
228void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
3f2cdba8 229{
230// set hit during disIntegration
231AliMUONSegmentationTrigger::SetHit(xhit,yhit);
232}
a9e2aefa 233
234//------------------------------------------------------------------
235Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t iy)
236{
237// Returns sector number for given module
238//
3f2cdba8 239
a9e2aefa 240 Int_t absix=TMath::Abs(ix);
241 Int_t iwidth=Int_t(StripSizeX(absix));
3f2cdba8 242
a9e2aefa 243 if (absix==52) {
244 return 1;
245 } else if (absix==41||absix==61) {
246 return 2;
247 } else if (iwidth==1) {
248 return 3;
249 } else if (iwidth==2) {
250 return 4;
251 } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) {
252 return 5;
253 } else if (iwidth==4) {
254 return 6;
255 } else {
256 return 0;
257 }
258}
259
260//------------------------------------------------------------------
261void AliMUONSegmentationTriggerX::
262IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width)
3f2cdba8 263{
264// returns quantities needed to evaluate neighbour strip response
265
a9e2aefa 266 Int_t ix,iy;
267 Float_t xstrip,ystrip;
ecfa008b 268 GetPadI(fXhit,fYhit,ix,iy);
a30a000f 269 GetPadC(ix,iy,xstrip,ystrip);
ecfa008b 270 x1=fYhit; // hit y position
a9e2aefa 271 x2=ystrip; // y coordinate of the main strip
ecfa008b 272 x3=fY; // current strip real y coordinate
a9e2aefa 273 width=StripSizeX(ix); // width of the main strip
274}
275
276
277
278
279
280
281
282