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