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 Revision 1.7 2000/10/03 21:48:07 morsch
19 Adopt to const declaration of some of the methods in AliSegmentation.
21 Revision 1.6 2000/10/02 16:58:29 egangler
22 Cleaning of the code :
25 -> some useless includes removed or replaced by "class" statement
27 Revision 1.5 2000/07/03 11:54:57 morsch
28 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
29 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
31 Revision 1.4 2000/06/29 12:34:09 morsch
32 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
33 it usable with any other geometry class. The link to the object to which it belongs is
34 established via an index. This assumes that there exists a global geometry manager
35 from which the pointer to the parent object can be obtained (in our case gAlice).
37 Revision 1.3 2000/06/26 10:01:26 pcrochet
38 global variables removed
40 Revision 1.2 2000/06/15 07:58:48 morsch
41 Code from MUON-dev joined
43 Revision 1.1.2.1 2000/06/09 21:51:58 morsch
44 Code from AliMUONSegResTriggerY.cxx
51 Revision 1.1.2.4 2000/05/05 10:17:04 morsch
52 Y strip numerotation changed (CP)
54 Revision 1.1.2.3 2000/04/26 12:33:40 morsch
55 Minor changes in some methods (CP)
57 Revision 1.1.2.2 2000/02/20 07:49:50 morsch
58 Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
60 Revision 1.1.2.1 2000/02/17 14:34:57 morsch
61 Draft version from P. Crochet
65 #include "AliMUONSegmentationTriggerY.h"
66 #include "AliMUONTriggerConstants.h"
70 #include "AliMUONChamber.h"
72 ClassImp(AliMUONSegmentationTriggerY)
74 //------------------------------------------------------------------
75 void AliMUONSegmentationTriggerY::Init(Int_t chamber)
77 // intialize Y segmentation
78 cout << "Initialize Trigger Chamber Geometry Y " << "\n";
79 AliMUONSegmentationTrigger::Init(chamber);
81 // calculate x & y position of Y strips
82 Int_t nModule=AliMUONTriggerConstants::Nmodule();
83 for (Int_t imodule=0; imodule<nModule; imodule++) {
84 Float_t width=StripSizeY(AliMUONTriggerConstants::ModuleId(imodule));
85 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
86 for (Int_t istrip=0; istrip<nStrip; istrip++){
88 fXofysmin[imodule][istrip]=
89 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
90 fXofysmax[imodule][istrip]=
91 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
93 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
94 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
96 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
97 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
103 //------------------------------------------------------------------
104 void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
106 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
107 // x,y = real coordinates; ix = module number , iy = strip number
111 Int_t nModule=AliMUONTriggerConstants::Nmodule();
112 for (Int_t imodule=0; imodule<nModule; imodule++) {
113 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
114 for (Int_t istrip=0; istrip<nStrip; istrip++){
115 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
116 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
117 ix = AliMUONTriggerConstants::ModuleId(imodule);
124 //------------------------------------------------------------------
125 void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
127 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
128 // ix = module number , iy = strip number; x,y = center of strip
131 Int_t nModule=AliMUONTriggerConstants::Nmodule();
132 for (Int_t imodule=0; imodule<nModule; imodule++) {
133 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
134 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
135 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
140 //------------------------------------------------------------------
141 void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
149 //------------------------------------------------------------------
150 void AliMUONSegmentationTriggerY::
151 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
152 // Returns list of 10 next neighbours for given Y strip (ix, iy)
153 // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
154 // \_______/ \_______/
156 // Note : should not be used to return a list of neighbours larger than 16 !
158 Int_t absiX = TMath::Abs(iX);
159 Int_t numModule = ModuleNumber(absiX); // module number Id.
160 Int_t nStrip = AliMUONTriggerConstants::NstripY(numModule); //numb of strips
161 Int_t iCandidateLeft, iCandidateRight;
162 Int_t iNewCandidateRight=0;
163 Int_t iNewCandidateLeft=0;
164 // first strip number on the right of the left module
165 if ( (absiX-(Int_t(absiX/10))*10)!=1 && absiX!=52 )
167 AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
171 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
175 for (Int_t i=0; i<5; i++) {
177 iCandidateRight = iY + (i + 1);
178 iCandidateLeft = iY - (i + 1);
179 if (iCandidateRight < nStrip) { // strip in same module
181 Ylist[i] = iCandidateRight;
182 } else if ((absiX+1)%10!=8) { // need to scan the module on the right
184 Ylist[i] = iNewCandidateRight;
185 iNewCandidateRight++;
188 if (iCandidateLeft >=0 ) { // strip in same module
190 Ylist[j] = iCandidateLeft;
191 } else if ( iNewCandidateLeft !=0) {
193 Ylist[j] = iNewCandidateLeft;
198 if (iX<0) { // left side of chamber
199 for (Int_t i=0; i<10; i++) {
200 if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
207 //------------------------------------------------------------------
208 void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
210 // Sets virtual pad coordinates, needed for evaluating pad response
211 // outside the tracking program
212 GetPadC(ix,iy,fX,fY);
213 GetPadI(fX,fY,fIx,fIy);
214 fSector=Sector(ix,iy);
217 //------------------------------------------------------------------
218 Int_t AliMUONSegmentationTriggerY::ISector()
221 //------------------------------------------------------------------
223 Int_t AliMUONSegmentationTriggerY::Ix()
226 //------------------------------------------------------------------
228 Int_t AliMUONSegmentationTriggerY::Iy()
231 //------------------------------------------------------------------
232 Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
234 // returns x size of y strips for sector isec
236 return 2.125*fZscale;
237 } else if (isec==2) {
238 return 2.125*fZscale;
239 } else if (isec==3) {
240 return 2.125*fZscale;
241 } else if (isec==4) {
248 //------------------------------------------------------------------
249 Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
251 // returns y size of y strips for sector isec
254 } else if (isec==2) {
256 } else if (isec==3) {
258 } else if (isec==4) {
260 } else if (isec==5) {
268 //------------------------------------------------------------------
269 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
271 // set hits during diintegration
272 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
275 //------------------------------------------------------------------
276 Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
278 // Returns sector number for given module
280 Int_t absix=TMath::Abs(ix);
281 Int_t iwidth=Int_t(StripSizeY(absix));
285 } else if (absix==41||absix==61) {
287 } else if (iwidth==2) {
289 } else if (iwidth==4) {
296 //------------------------------------------------------------------
297 void AliMUONSegmentationTriggerY::
298 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
300 // returns quantities needed to evaluate neighbour strip response
302 Float_t xstrip,ystrip;
303 GetPadI(fXhit,fYhit,ix,iy);
304 GetPadC(ix,iy,xstrip,ystrip);
305 x1=fXhit; // hit x position
306 x2=xstrip; // x coordinate of the main strip
307 x3=fX; // current strip real x coordinate
308 // width=StripSizeY(ix); // width of the main strip
310 // find the position of the 2 borders of the current strip
311 Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
312 Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
314 // dist. between the hit and the closest border of the current strip
315 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
316 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);