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