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 **************************************************************************/
18 #include "AliMUONSegmentationTriggerY.h"
19 #include "AliMUONTriggerConstants.h"
23 #include "AliMUONChamber.h"
26 #include <Riostream.h>
27 ClassImp(AliMUONSegmentationTriggerY)
29 //------------------------------------------------------------------
30 void AliMUONSegmentationTriggerY::Init(Int_t chamber)
32 // intialize Y segmentation
33 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
34 if(pMUON->GetDebug()>1) printf("%s: Initialize Trigger Chamber Geometry Y\n",ClassName());
35 AliMUONSegmentationTrigger::Init(chamber);
37 // calculate x & y position of Y strips
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++){
44 fXofysmin[imodule][istrip]=
45 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
46 fXofysmax[imodule][istrip]=
47 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
49 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
50 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
52 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
53 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
59 //------------------------------------------------------------------
60 void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
62 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
63 // x,y = real coordinates; ix = module number , iy = strip number
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++){
71 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
72 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
73 ix = AliMUONTriggerConstants::ModuleId(imodule);
80 //------------------------------------------------------------------
81 void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
83 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
84 // ix = module number , iy = strip number; x,y = center of strip
87 Int_t nModule=AliMUONTriggerConstants::Nmodule();
88 for (Int_t imodule=0; imodule<nModule; imodule++) {
89 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
90 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
91 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
96 //------------------------------------------------------------------
97 void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
105 //------------------------------------------------------------------
106 void AliMUONSegmentationTriggerY::
107 Neighbours(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 // \_______/ \_______/
112 // Note : should not be used to return a list of neighbours larger than 16 !
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 )
123 AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
127 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
131 for (Int_t i=0; i<5; i++) {
133 iCandidateRight = iY + (i + 1);
134 iCandidateLeft = iY - (i + 1);
135 if (iCandidateRight < nStrip) { // strip in same module
137 Ylist[i] = iCandidateRight;
138 } else if ((absiX+1)%10!=8) { // need to scan the module on the right
140 Ylist[i] = iNewCandidateRight;
141 iNewCandidateRight++;
144 if (iCandidateLeft >=0 ) { // strip in same module
146 Ylist[j] = iCandidateLeft;
147 } else if ( iNewCandidateLeft !=0) {
149 Ylist[j] = iNewCandidateLeft;
154 if (iX<0) { // left side of chamber
155 for (Int_t i=0; i<10; i++) {
156 if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
163 //------------------------------------------------------------------
164 void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
166 // Sets virtual pad coordinates, needed for evaluating pad response
167 // outside the tracking program
168 GetPadC(ix,iy,fX,fY);
169 GetPadI(fX,fY,fIx,fIy);
170 fSector=Sector(ix,iy);
173 //------------------------------------------------------------------
174 Int_t AliMUONSegmentationTriggerY::ISector()
177 //------------------------------------------------------------------
179 Int_t AliMUONSegmentationTriggerY::Ix()
182 //------------------------------------------------------------------
184 Int_t AliMUONSegmentationTriggerY::Iy()
187 //------------------------------------------------------------------
188 Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
190 // returns x size of y strips for sector isec
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) {
204 //------------------------------------------------------------------
205 Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
207 // returns y size of y strips for sector isec
210 } else if (isec==2) {
212 } else if (isec==3) {
214 } else if (isec==4) {
216 } else if (isec==5) {
222 //------------------------------------------------------------------
223 void AliMUONSegmentationTriggerY::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy)
225 GetPadI(x, y, ix, iy);
228 //------------------------------------------------------------------
229 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
231 // set hits during diintegration
232 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
234 //------------------------------------------------------------------
235 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
239 //------------------------------------------------------------------
240 Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t /*iy*/)
242 // Returns sector number for given module
244 Int_t absix=TMath::Abs(ix);
245 Int_t iwidth=Int_t(StripSizeY(absix));
249 } else if (absix==41||absix==61) {
251 } else if (iwidth==2) {
253 } else if (iwidth==4) {
260 //------------------------------------------------------------------
261 void AliMUONSegmentationTriggerY::
262 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
264 // returns quantities needed to evaluate neighbour strip response
266 Float_t xstrip,ystrip;
267 GetPadI(fXhit,fYhit,ix,iy);
268 GetPadC(ix,iy,xstrip,ystrip);
269 x1=fXhit; // hit x position
270 x2=xstrip; // x coordinate of the main strip
271 x3=fX; // current strip real x coordinate
272 // width=StripSizeY(ix); // width of the main strip
274 // find the position of the 2 borders of the current strip
275 Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
276 Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
278 // dist. between the hit and the closest border of the current strip
279 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
280 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);