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 Int_t moduleId=AliMUONTriggerConstants::ModuleId(imodule);
46 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
47 for (Int_t istrip=0; istrip<nStrip; istrip++){
48 Float_t width=StripSizeY(moduleId,istrip);
51 if (moduleId-10*Int_t(moduleId/10.)==7&&istrip>7) {
52 fXofysmin[imodule][istrip]=
53 ( AliMUONTriggerConstants::XcMin(imodule)+
54 (width*2.)*8 + width*(istrip-8) )*fZscale;
55 fXofysmax[imodule][istrip]=
56 ( AliMUONTriggerConstants::XcMin(imodule)+
57 (width*2.)*8 + width*(istrip-7) )*fZscale;
59 fXofysmin[imodule][istrip]=
60 (AliMUONTriggerConstants::XcMin(imodule)
61 +width*(istrip))*fZscale;
62 fXofysmax[imodule][istrip]=
63 (AliMUONTriggerConstants::XcMin(imodule)
64 +width*(istrip+1))*fZscale;
69 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
70 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
72 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
73 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
77 if (TMath::Abs(AliMUONTriggerConstants::ModuleId(imodule))==11) {
78 printf("module Id istrip fXofxsmin fXofxsmax fYofxsmin fYofxsmax %d %d %f %f %f %f \n",
79 AliMUONTriggerConstants::ModuleId(imodule),
81 fXofysmin[imodule][istrip],
82 fXofysmax[imodule][istrip],
83 fYofysmin[imodule][istrip],
84 fYofysmax[imodule][istrip]);
91 //------------------------------------------------------------------
92 void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
94 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
95 // x,y = real coordinates; ix = module number , iy = strip number
99 Int_t nModule=AliMUONTriggerConstants::Nmodule();
100 for (Int_t imodule=0; imodule<nModule; imodule++) {
101 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
102 for (Int_t istrip=0; istrip<nStrip; istrip++){
103 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
104 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
105 ix = AliMUONTriggerConstants::ModuleId(imodule);
112 //------------------------------------------------------------------
113 void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
115 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
116 // ix = module number , iy = strip number; x,y = center of strip
119 Int_t nModule=AliMUONTriggerConstants::Nmodule();
120 for (Int_t imodule=0; imodule<nModule; imodule++) {
121 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
122 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
123 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
128 //------------------------------------------------------------------
129 void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
137 //------------------------------------------------------------------
138 void AliMUONSegmentationTriggerY::
139 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
140 // Returns list of 10 next neighbours for given Y strip (ix, iy)
141 // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
142 // \_______/ \_______/
144 // Note : should not be used to return a list of neighbours larger than 16 !
146 Int_t absiX = TMath::Abs(iX);
147 Int_t numModule = ModuleNumber(absiX); // module number Id.
148 Int_t nStrip = AliMUONTriggerConstants::NstripY(numModule); //numb of strips
149 Int_t iCandidateLeft, iCandidateRight;
150 Int_t iNewCandidateRight=0;
151 Int_t iNewCandidateLeft=0;
152 // first strip number on the right of the left module
153 if ( (absiX-(Int_t(absiX/10))*10)!=1 && absiX!=52 )
155 AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
159 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
163 for (Int_t i=0; i<5; i++) {
165 iCandidateRight = iY + (i + 1);
166 iCandidateLeft = iY - (i + 1);
167 if (iCandidateRight < nStrip) { // strip in same module
169 Ylist[i] = iCandidateRight;
170 } else if ((absiX+1)%10!=8) { // need to scan the module on the right
172 Ylist[i] = iNewCandidateRight;
173 iNewCandidateRight++;
176 if (iCandidateLeft >=0 ) { // strip in same module
178 Ylist[j] = iCandidateLeft;
179 } else if ( iNewCandidateLeft !=0) {
181 Ylist[j] = iNewCandidateLeft;
186 if (iX<0) { // left side of chamber
187 for (Int_t i=0; i<10; i++) {
188 if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
195 //------------------------------------------------------------------
196 void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
198 // Sets virtual pad coordinates, needed for evaluating pad response
199 // outside the tracking program
200 GetPadC(ix,iy,fX,fY);
201 GetPadI(fX,fY,fIx,fIy);
202 fSector=Sector(ix,iy);
205 //------------------------------------------------------------------
206 Int_t AliMUONSegmentationTriggerY::ISector()
209 //------------------------------------------------------------------
211 Int_t AliMUONSegmentationTriggerY::Ix()
214 //------------------------------------------------------------------
216 Int_t AliMUONSegmentationTriggerY::Iy()
219 //------------------------------------------------------------------
220 Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
222 // returns x size of y strips for sector isec
224 return AliMUONTriggerConstants::StripWidth(1)*fZscale;
225 } else if (isec==2) {
226 return AliMUONTriggerConstants::StripWidth(1)*fZscale;
227 } else if (isec==3) {
228 return AliMUONTriggerConstants::StripWidth(1)*fZscale;
229 } else if (isec==4) {
230 return AliMUONTriggerConstants::StripWidth(2)*fZscale;
236 //------------------------------------------------------------------
237 Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
239 // returns y size of y strips for sector isec
241 return AliMUONTriggerConstants::StripLength(3)*fZscale;
242 } else if (isec==2) {
243 return AliMUONTriggerConstants::StripLength(2)*fZscale;
244 } else if (isec==3) {
245 return AliMUONTriggerConstants::StripLength(3)*fZscale;
246 } else if (isec==4) {
247 return AliMUONTriggerConstants::StripLength(3)*fZscale;
248 } else if (isec==5) {
249 return AliMUONTriggerConstants::StripLength(3)*fZscale;
254 //------------------------------------------------------------------
255 void AliMUONSegmentationTriggerY::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy)
257 GetPadI(x, y, ix, iy);
260 //------------------------------------------------------------------
261 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
263 // set hits during diintegration
264 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
266 //------------------------------------------------------------------
267 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
271 //------------------------------------------------------------------
272 Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
274 // Returns sector number for given module
276 Int_t absix=TMath::Abs(ix);
277 Int_t iwidth=Int_t(StripSizeY(absix,iy));
281 } else if (absix==41||absix==61) {
283 } else if (iwidth==2) {
285 } else if (iwidth==4) {
293 //------------------------------------------------------------------
294 void AliMUONSegmentationTriggerY::
295 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
297 // returns quantities needed to evaluate neighbour strip response
299 Float_t xstrip,ystrip;
300 GetPadI(fXhit,fYhit,ix,iy);
301 GetPadC(ix,iy,xstrip,ystrip);
302 x1=fXhit; // hit x position
303 x2=xstrip; // x coordinate of the main strip
304 x3=fX; // current strip real x coordinate
305 // width=StripSizeY(ix); // width of the main strip
307 // find the position of the 2 borders of the current strip
308 Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
309 Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
311 // dist. between the hit and the closest border of the current strip
312 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
313 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);