]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationTriggerY.cxx
Cast to avoid problems on Alpha
[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$
9e1a0ddb 18Revision 1.8 2000/11/20 21:44:17 pcrochet
19some modifications to account for the new class AliMUONResponseTriggerV1
20
03f221a7 21Revision 1.7 2000/10/03 21:48:07 morsch
22Adopt to const declaration of some of the methods in AliSegmentation.
23
c3eff6ad 24Revision 1.6 2000/10/02 16:58:29 egangler
25Cleaning of the code :
26-> coding conventions
27-> void Streamers
28-> some useless includes removed or replaced by "class" statement
29
ecfa008b 30Revision 1.5 2000/07/03 11:54:57 morsch
31AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
32The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
33
a30a000f 34Revision 1.4 2000/06/29 12:34:09 morsch
35AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
36it usable with any other geometry class. The link to the object to which it belongs is
37established via an index. This assumes that there exists a global geometry manager
38from which the pointer to the parent object can be obtained (in our case gAlice).
39
d81db581 40Revision 1.3 2000/06/26 10:01:26 pcrochet
41global variables removed
42
3f2cdba8 43Revision 1.2 2000/06/15 07:58:48 morsch
44Code from MUON-dev joined
45
a9e2aefa 46Revision 1.1.2.1 2000/06/09 21:51:58 morsch
47Code from AliMUONSegResTriggerY.cxx
48
49*/
50
3f2cdba8 51
a9e2aefa 52/*
53Old Log:
54Revision 1.1.2.4 2000/05/05 10:17:04 morsch
55Y strip numerotation changed (CP)
56
57Revision 1.1.2.3 2000/04/26 12:33:40 morsch
58Minor changes in some methods (CP)
59
60Revision 1.1.2.2 2000/02/20 07:49:50 morsch
61Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
62
63Revision 1.1.2.1 2000/02/17 14:34:57 morsch
64Draft version from P. Crochet
65
66*/
67
68#include "AliMUONSegmentationTriggerY.h"
3f2cdba8 69#include "AliMUONTriggerConstants.h"
a9e2aefa 70#include "TMath.h"
71#include "TRandom.h"
72#include "TArc.h"
73#include "AliMUONChamber.h"
9e1a0ddb 74#include "AliMUON.h"
75#include "AliRun.h"
a9e2aefa 76#include <iostream.h>
77ClassImp(AliMUONSegmentationTriggerY)
78
3f2cdba8 79//------------------------------------------------------------------
d81db581 80void AliMUONSegmentationTriggerY::Init(Int_t chamber)
a9e2aefa 81{
3f2cdba8 82// intialize Y segmentation
9e1a0ddb 83 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
84 if(pMUON->GetDebug()) cout << ClassName() <<": Initialize Trigger Chamber Geometry Y " << "\n";
d81db581 85 AliMUONSegmentationTrigger::Init(chamber);
a9e2aefa 86
87// calculate x & y position of Y strips
3f2cdba8 88 Int_t nModule=AliMUONTriggerConstants::Nmodule();
89 for (Int_t imodule=0; imodule<nModule; imodule++) {
90 Float_t width=StripSizeY(AliMUONTriggerConstants::ModuleId(imodule));
91 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
92 for (Int_t istrip=0; istrip<nStrip; istrip++){
a9e2aefa 93 if (imodule<63) {
3f2cdba8 94 fXofysmin[imodule][istrip]=
95 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
96 fXofysmax[imodule][istrip]=
97 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
a9e2aefa 98 } else {
99 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
100 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
101 }
3f2cdba8 102 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
103 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
a9e2aefa 104 }
105 }
106
107}
108
109//------------------------------------------------------------------
c3eff6ad 110void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
111{
a9e2aefa 112// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
113// x,y = real coordinates; ix = module number , iy = strip number
114
115 ix = 0;
116 iy = 0;
3f2cdba8 117 Int_t nModule=AliMUONTriggerConstants::Nmodule();
118 for (Int_t imodule=0; imodule<nModule; imodule++) {
119 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
120 for (Int_t istrip=0; istrip<nStrip; istrip++){
a9e2aefa 121 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
122 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
3f2cdba8 123 ix = AliMUONTriggerConstants::ModuleId(imodule);
a9e2aefa 124 iy = istrip;
125 }
126 }
127 }
128}
129
130//------------------------------------------------------------------
c3eff6ad 131void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
132{
a9e2aefa 133// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
134// ix = module number , iy = strip number; x,y = center of strip
135 x = 0.;
136 y = 0.;
3f2cdba8 137 Int_t nModule=AliMUONTriggerConstants::Nmodule();
138 for (Int_t imodule=0; imodule<nModule; imodule++) {
139 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
a9e2aefa 140 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
141 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
142 }
143 }
144}
145
146//------------------------------------------------------------------
147void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
148{
149// Sets the padsize
150//
151 fDpx=p1;
152 fDpy=p2;
153}
154
155//------------------------------------------------------------------
156void AliMUONSegmentationTriggerY::
03f221a7 157Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
158// Returns list of 10 next neighbours for given Y strip (ix, iy)
159// neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
160// \_______/ \_______/
161// left right
162// Note : should not be used to return a list of neighbours larger than 16 !
163
164 Int_t absiX = TMath::Abs(iX);
165 Int_t numModule = ModuleNumber(absiX); // module number Id.
166 Int_t nStrip = AliMUONTriggerConstants::NstripY(numModule); //numb of strips
167 Int_t iCandidateLeft, iCandidateRight;
168 Int_t iNewCandidateRight=0;
169 Int_t iNewCandidateLeft=0;
170// first strip number on the right of the left module
171 if ( (absiX-(Int_t(absiX/10))*10)!=1 && absiX!=52 )
172 iNewCandidateLeft =
173 AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
174 Int_t j;
a9e2aefa 175
03f221a7 176 *Nlist = 10;
177 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
178
179 if (iY < nStrip) {
180
181 for (Int_t i=0; i<5; i++) {
182 j = i + 5;
183 iCandidateRight = iY + (i + 1);
184 iCandidateLeft = iY - (i + 1);
185 if (iCandidateRight < nStrip) { // strip in same module
186 Xlist[i] = absiX;
187 Ylist[i] = iCandidateRight;
188 } else if ((absiX+1)%10!=8) { // need to scan the module on the right
189 Xlist[i] = absiX+1;
190 Ylist[i] = iNewCandidateRight;
191 iNewCandidateRight++;
192 }
193
194 if (iCandidateLeft >=0 ) { // strip in same module
195 Xlist[j] = absiX;
196 Ylist[j] = iCandidateLeft;
197 } else if ( iNewCandidateLeft !=0) {
198 Xlist[j] = absiX-1;
199 Ylist[j] = iNewCandidateLeft;
200 iNewCandidateLeft--;
201 }
a9e2aefa 202 }
203
204 if (iX<0) { // left side of chamber
03f221a7 205 for (Int_t i=0; i<10; i++) {
206 if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
207 }
a9e2aefa 208 }
03f221a7 209
210 } // iY < nStrip
a9e2aefa 211}
212
213//------------------------------------------------------------------
214void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
215{
216 // Sets virtual pad coordinates, needed for evaluating pad response
217 // outside the tracking program
ecfa008b 218 GetPadC(ix,iy,fX,fY);
219 GetPadI(fX,fY,fIx,fIy);
a9e2aefa 220 fSector=Sector(ix,iy);
221}
222
223//------------------------------------------------------------------
c3eff6ad 224Int_t AliMUONSegmentationTriggerY::ISector()
a9e2aefa 225{ return fSector;}
226
227//------------------------------------------------------------------
c3eff6ad 228
a9e2aefa 229Int_t AliMUONSegmentationTriggerY::Ix()
ecfa008b 230{ return fIx;}
a9e2aefa 231
232//------------------------------------------------------------------
c3eff6ad 233
a9e2aefa 234Int_t AliMUONSegmentationTriggerY::Iy()
ecfa008b 235{ return fIy;}
a9e2aefa 236
237//------------------------------------------------------------------
c3eff6ad 238Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
3f2cdba8 239{
240// returns x size of y strips for sector isec
a9e2aefa 241 if (isec==1) {
242 return 2.125*fZscale;
243 } else if (isec==2) {
244 return 2.125*fZscale;
245 } else if (isec==3) {
246 return 2.125*fZscale;
247 } else if (isec==4) {
248 return 4.25*fZscale;
249 } else {
250 return 0.;
251 }
252}
253
254//------------------------------------------------------------------
c3eff6ad 255Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
3f2cdba8 256{
257// returns y size of y strips for sector isec
a9e2aefa 258 if (isec==1) {
259 return 68.0*fZscale;
260 } else if (isec==2) {
261 return 51.0*fZscale;
262 } else if (isec==3) {
263 return 68.0*fZscale;
264 } else if (isec==4) {
265 return 68.0*fZscale;
266 } else if (isec==5) {
267 return 68.0*fZscale;
268 } else {
269 return 0.;
270 }
271
272}
273
274//------------------------------------------------------------------
275void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
3f2cdba8 276{
277// set hits during diintegration
03f221a7 278 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
3f2cdba8 279}
a9e2aefa 280
281//------------------------------------------------------------------
282Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
283{
284// Returns sector number for given module
285//
286 Int_t absix=TMath::Abs(ix);
287 Int_t iwidth=Int_t(StripSizeY(absix));
3f2cdba8 288
a9e2aefa 289 if (absix==52) {
290 return 1;
291 } else if (absix==41||absix==61) {
292 return 2;
293 } else if (iwidth==2) {
294 return 3;
295 } else if (iwidth==4) {
296 return 4;
297 } else {
298 return 0;
299 }
300}
301
302//------------------------------------------------------------------
303void AliMUONSegmentationTriggerY::
03f221a7 304IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
a9e2aefa 305{
306// returns quantities needed to evaluate neighbour strip response
307 Int_t ix,iy;
308 Float_t xstrip,ystrip;
ecfa008b 309 GetPadI(fXhit,fYhit,ix,iy);
a30a000f 310 GetPadC(ix,iy,xstrip,ystrip);
ecfa008b 311 x1=fXhit; // hit x position
a9e2aefa 312 x2=xstrip; // x coordinate of the main strip
ecfa008b 313 x3=fX; // current strip real x coordinate
03f221a7 314 // width=StripSizeY(ix); // width of the main strip
315
316 // find the position of the 2 borders of the current strip
317 Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
318 Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
319
320 // dist. between the hit and the closest border of the current strip
321 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
322 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);
323
a9e2aefa 324}
325
326
327
328