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