Transition to NewIO
[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
88cb7938 16/* $Id$ */
a9e2aefa 17
18#include "AliMUONSegmentationTriggerY.h"
3f2cdba8 19#include "AliMUONTriggerConstants.h"
a9e2aefa 20#include "TMath.h"
21#include "TRandom.h"
22#include "TArc.h"
23#include "AliMUONChamber.h"
9e1a0ddb 24#include "AliMUON.h"
25#include "AliRun.h"
70479d0e 26#include <Riostream.h>
a9e2aefa 27ClassImp(AliMUONSegmentationTriggerY)
28
3f2cdba8 29//------------------------------------------------------------------
d81db581 30void AliMUONSegmentationTriggerY::Init(Int_t chamber)
a9e2aefa 31{
3f2cdba8 32// intialize Y segmentation
9e1a0ddb 33 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
ef077202 34 if(pMUON->GetDebug()>1) printf("%s: Initialize Trigger Chamber Geometry Y\n",ClassName());
d81db581 35 AliMUONSegmentationTrigger::Init(chamber);
a9e2aefa 36
37// calculate x & y position of Y strips
3f2cdba8 38 Int_t nModule=AliMUONTriggerConstants::Nmodule();
39 for (Int_t imodule=0; imodule<nModule; imodule++) {
40 Float_t width=StripSizeY(AliMUONTriggerConstants::ModuleId(imodule));
41 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
42 for (Int_t istrip=0; istrip<nStrip; istrip++){
a9e2aefa 43 if (imodule<63) {
3f2cdba8 44 fXofysmin[imodule][istrip]=
45 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
46 fXofysmax[imodule][istrip]=
47 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
a9e2aefa 48 } else {
49 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
50 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
51 }
3f2cdba8 52 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
53 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
a9e2aefa 54 }
55 }
56
57}
58
59//------------------------------------------------------------------
c3eff6ad 60void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
61{
a9e2aefa 62// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
63// x,y = real coordinates; ix = module number , iy = strip number
64
65 ix = 0;
66 iy = 0;
3f2cdba8 67 Int_t nModule=AliMUONTriggerConstants::Nmodule();
68 for (Int_t imodule=0; imodule<nModule; imodule++) {
69 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
70 for (Int_t istrip=0; istrip<nStrip; istrip++){
a9e2aefa 71 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
72 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
3f2cdba8 73 ix = AliMUONTriggerConstants::ModuleId(imodule);
a9e2aefa 74 iy = istrip;
75 }
76 }
77 }
78}
79
80//------------------------------------------------------------------
c3eff6ad 81void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
82{
a9e2aefa 83// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
84// ix = module number , iy = strip number; x,y = center of strip
85 x = 0.;
86 y = 0.;
3f2cdba8 87 Int_t nModule=AliMUONTriggerConstants::Nmodule();
88 for (Int_t imodule=0; imodule<nModule; imodule++) {
89 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
a9e2aefa 90 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
91 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
92 }
93 }
94}
95
96//------------------------------------------------------------------
97void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
98{
99// Sets the padsize
100//
101 fDpx=p1;
102 fDpy=p2;
103}
104
105//------------------------------------------------------------------
106void AliMUONSegmentationTriggerY::
03f221a7 107Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
108// Returns list of 10 next neighbours for given Y strip (ix, iy)
109// neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
110// \_______/ \_______/
111// left right
112// Note : should not be used to return a list of neighbours larger than 16 !
113
114 Int_t absiX = TMath::Abs(iX);
115 Int_t numModule = ModuleNumber(absiX); // module number Id.
116 Int_t nStrip = AliMUONTriggerConstants::NstripY(numModule); //numb of strips
117 Int_t iCandidateLeft, iCandidateRight;
118 Int_t iNewCandidateRight=0;
119 Int_t iNewCandidateLeft=0;
120// first strip number on the right of the left module
121 if ( (absiX-(Int_t(absiX/10))*10)!=1 && absiX!=52 )
122 iNewCandidateLeft =
123 AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
124 Int_t j;
a9e2aefa 125
03f221a7 126 *Nlist = 10;
127 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
128
129 if (iY < nStrip) {
130
131 for (Int_t i=0; i<5; i++) {
132 j = i + 5;
133 iCandidateRight = iY + (i + 1);
134 iCandidateLeft = iY - (i + 1);
135 if (iCandidateRight < nStrip) { // strip in same module
136 Xlist[i] = absiX;
137 Ylist[i] = iCandidateRight;
138 } else if ((absiX+1)%10!=8) { // need to scan the module on the right
139 Xlist[i] = absiX+1;
140 Ylist[i] = iNewCandidateRight;
141 iNewCandidateRight++;
142 }
143
144 if (iCandidateLeft >=0 ) { // strip in same module
145 Xlist[j] = absiX;
146 Ylist[j] = iCandidateLeft;
147 } else if ( iNewCandidateLeft !=0) {
148 Xlist[j] = absiX-1;
149 Ylist[j] = iNewCandidateLeft;
150 iNewCandidateLeft--;
151 }
a9e2aefa 152 }
153
154 if (iX<0) { // left side of chamber
03f221a7 155 for (Int_t i=0; i<10; i++) {
156 if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
157 }
a9e2aefa 158 }
03f221a7 159
160 } // iY < nStrip
a9e2aefa 161}
162
163//------------------------------------------------------------------
164void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
165{
166 // Sets virtual pad coordinates, needed for evaluating pad response
167 // outside the tracking program
ecfa008b 168 GetPadC(ix,iy,fX,fY);
169 GetPadI(fX,fY,fIx,fIy);
a9e2aefa 170 fSector=Sector(ix,iy);
171}
172
173//------------------------------------------------------------------
c3eff6ad 174Int_t AliMUONSegmentationTriggerY::ISector()
a9e2aefa 175{ return fSector;}
176
177//------------------------------------------------------------------
c3eff6ad 178
a9e2aefa 179Int_t AliMUONSegmentationTriggerY::Ix()
ecfa008b 180{ return fIx;}
a9e2aefa 181
182//------------------------------------------------------------------
c3eff6ad 183
a9e2aefa 184Int_t AliMUONSegmentationTriggerY::Iy()
ecfa008b 185{ return fIy;}
a9e2aefa 186
187//------------------------------------------------------------------
c3eff6ad 188Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
3f2cdba8 189{
190// returns x size of y strips for sector isec
a9e2aefa 191 if (isec==1) {
192 return 2.125*fZscale;
193 } else if (isec==2) {
194 return 2.125*fZscale;
195 } else if (isec==3) {
196 return 2.125*fZscale;
197 } else if (isec==4) {
198 return 4.25*fZscale;
199 } else {
200 return 0.;
201 }
202}
203
204//------------------------------------------------------------------
c3eff6ad 205Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
3f2cdba8 206{
207// returns y size of y strips for sector isec
a9e2aefa 208 if (isec==1) {
209 return 68.0*fZscale;
210 } else if (isec==2) {
211 return 51.0*fZscale;
212 } else if (isec==3) {
213 return 68.0*fZscale;
214 } else if (isec==4) {
215 return 68.0*fZscale;
216 } else if (isec==5) {
217 return 68.0*fZscale;
218 } else {
219 return 0.;
220 }
221
222}
223
224//------------------------------------------------------------------
225void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
3f2cdba8 226{
227// set hits during diintegration
03f221a7 228 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
3f2cdba8 229}
a9e2aefa 230
231//------------------------------------------------------------------
232Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
233{
234// Returns sector number for given module
235//
236 Int_t absix=TMath::Abs(ix);
237 Int_t iwidth=Int_t(StripSizeY(absix));
3f2cdba8 238
a9e2aefa 239 if (absix==52) {
240 return 1;
241 } else if (absix==41||absix==61) {
242 return 2;
243 } else if (iwidth==2) {
244 return 3;
245 } else if (iwidth==4) {
246 return 4;
247 } else {
248 return 0;
249 }
250}
251
252//------------------------------------------------------------------
253void AliMUONSegmentationTriggerY::
03f221a7 254IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
a9e2aefa 255{
256// returns quantities needed to evaluate neighbour strip response
257 Int_t ix,iy;
258 Float_t xstrip,ystrip;
ecfa008b 259 GetPadI(fXhit,fYhit,ix,iy);
a30a000f 260 GetPadC(ix,iy,xstrip,ystrip);
ecfa008b 261 x1=fXhit; // hit x position
a9e2aefa 262 x2=xstrip; // x coordinate of the main strip
ecfa008b 263 x3=fX; // current strip real x coordinate
03f221a7 264 // width=StripSizeY(ix); // width of the main strip
265
266 // find the position of the 2 borders of the current strip
267 Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
268 Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
269
270 // dist. between the hit and the closest border of the current strip
271 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
272 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);
273
a9e2aefa 274}
275
276
277
278