1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include "AliMUONSegmentationTriggerY.h"
21 #include "AliMUONTriggerConstants.h"
25 ClassImp(AliMUONSegmentationTriggerY)
27 //------------------------------------------------------------------
28 AliMUONSegmentationTriggerY::AliMUONSegmentationTriggerY()
29 : AliMUONSegmentationTrigger()
34 //------------------------------------------------------------------
35 void AliMUONSegmentationTriggerY::Init(Int_t chamber)
37 // intialize Y segmentation
38 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
39 if(pMUON->GetDebug()>1) printf("%s: Initialize Trigger Chamber Geometry Y\n",ClassName());
40 AliMUONSegmentationTrigger::Init(chamber);
42 // calculate x & y position of Y strips
43 Int_t nModule=AliMUONTriggerConstants::Nmodule();
44 for (Int_t imodule=0; imodule<nModule; imodule++) {
45 Float_t width=StripSizeY(AliMUONTriggerConstants::ModuleId(imodule));
46 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
47 for (Int_t istrip=0; istrip<nStrip; istrip++){
49 fXofysmin[imodule][istrip]=
50 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
51 fXofysmax[imodule][istrip]=
52 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
54 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
55 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
57 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
58 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
64 //------------------------------------------------------------------
65 void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
67 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
68 // x,y = real coordinates; ix = module number , iy = strip number
72 Int_t nModule=AliMUONTriggerConstants::Nmodule();
73 for (Int_t imodule=0; imodule<nModule; imodule++) {
74 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
75 for (Int_t istrip=0; istrip<nStrip; istrip++){
76 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
77 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
78 ix = AliMUONTriggerConstants::ModuleId(imodule);
85 //------------------------------------------------------------------
86 void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
88 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
89 // ix = module number , iy = strip number; x,y = center of strip
92 Int_t nModule=AliMUONTriggerConstants::Nmodule();
93 for (Int_t imodule=0; imodule<nModule; imodule++) {
94 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
95 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
96 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
101 //------------------------------------------------------------------
102 void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
110 //------------------------------------------------------------------
111 void AliMUONSegmentationTriggerY::
112 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
113 // Returns list of 10 next neighbours for given Y strip (ix, iy)
114 // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
115 // \_______/ \_______/
117 // Note : should not be used to return a list of neighbours larger than 16 !
119 Int_t absiX = TMath::Abs(iX);
120 Int_t numModule = ModuleNumber(absiX); // module number Id.
121 Int_t nStrip = AliMUONTriggerConstants::NstripY(numModule); //numb of strips
122 Int_t iCandidateLeft, iCandidateRight;
123 Int_t iNewCandidateRight=0;
124 Int_t iNewCandidateLeft=0;
125 // first strip number on the right of the left module
126 if ( (absiX-(Int_t(absiX/10))*10)!=1 && absiX!=52 )
128 AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
132 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
136 for (Int_t i=0; i<5; i++) {
138 iCandidateRight = iY + (i + 1);
139 iCandidateLeft = iY - (i + 1);
140 if (iCandidateRight < nStrip) { // strip in same module
142 Ylist[i] = iCandidateRight;
143 } else if ((absiX+1)%10!=8) { // need to scan the module on the right
145 Ylist[i] = iNewCandidateRight;
146 iNewCandidateRight++;
149 if (iCandidateLeft >=0 ) { // strip in same module
151 Ylist[j] = iCandidateLeft;
152 } else if ( iNewCandidateLeft !=0) {
154 Ylist[j] = iNewCandidateLeft;
159 if (iX<0) { // left side of chamber
160 for (Int_t i=0; i<10; i++) {
161 if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
168 //------------------------------------------------------------------
169 void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
171 // Sets virtual pad coordinates, needed for evaluating pad response
172 // outside the tracking program
173 GetPadC(ix,iy,fX,fY);
174 GetPadI(fX,fY,fIx,fIy);
175 fSector=Sector(ix,iy);
178 //------------------------------------------------------------------
179 Int_t AliMUONSegmentationTriggerY::ISector()
182 //------------------------------------------------------------------
184 Int_t AliMUONSegmentationTriggerY::Ix()
187 //------------------------------------------------------------------
189 Int_t AliMUONSegmentationTriggerY::Iy()
192 //------------------------------------------------------------------
193 Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
195 // returns x size of y strips for sector isec
197 return 2.125*fZscale;
198 } else if (isec==2) {
199 return 2.125*fZscale;
200 } else if (isec==3) {
201 return 2.125*fZscale;
202 } else if (isec==4) {
209 //------------------------------------------------------------------
210 Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
212 // returns y size of y strips for sector isec
215 } else if (isec==2) {
217 } else if (isec==3) {
219 } else if (isec==4) {
221 } else if (isec==5) {
227 //------------------------------------------------------------------
228 void AliMUONSegmentationTriggerY::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy)
230 GetPadI(x, y, ix, iy);
233 //------------------------------------------------------------------
234 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
236 // set hits during diintegration
237 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
239 //------------------------------------------------------------------
240 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
244 //------------------------------------------------------------------
245 Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t /*iy*/)
247 // Returns sector number for given module
249 Int_t absix=TMath::Abs(ix);
250 Int_t iwidth=Int_t(StripSizeY(absix));
254 } else if (absix==41||absix==61) {
256 } else if (iwidth==2) {
258 } else if (iwidth==4) {
265 //------------------------------------------------------------------
266 void AliMUONSegmentationTriggerY::
267 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
269 // returns quantities needed to evaluate neighbour strip response
271 Float_t xstrip,ystrip;
272 GetPadI(fXhit,fYhit,ix,iy);
273 GetPadC(ix,iy,xstrip,ystrip);
274 x1=fXhit; // hit x position
275 x2=xstrip; // x coordinate of the main strip
276 x3=fX; // current strip real x coordinate
277 // width=StripSizeY(ix); // width of the main strip
279 // find the position of the 2 borders of the current strip
280 Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
281 Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
283 // dist. between the hit and the closest border of the current strip
284 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
285 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);