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.8 2000/11/20 21:44:17 pcrochet
19 some modifications to account for the new class AliMUONResponseTriggerV1
21 Revision 1.7 2000/10/03 21:48:07 morsch
22 Adopt to const declaration of some of the methods in AliSegmentation.
24 Revision 1.6 2000/10/02 16:58:29 egangler
25 Cleaning of the code :
28 -> some useless includes removed or replaced by "class" statement
30 Revision 1.5 2000/07/03 11:54:57 morsch
31 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
32 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
34 Revision 1.4 2000/06/29 12:34:09 morsch
35 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
36 it usable with any other geometry class. The link to the object to which it belongs is
37 established via an index. This assumes that there exists a global geometry manager
38 from which the pointer to the parent object can be obtained (in our case gAlice).
40 Revision 1.3 2000/06/26 10:01:26 pcrochet
41 global variables removed
43 Revision 1.2 2000/06/15 07:58:48 morsch
44 Code from MUON-dev joined
46 Revision 1.1.2.1 2000/06/09 21:51:58 morsch
47 Code from AliMUONSegResTriggerY.cxx
54 Revision 1.1.2.4 2000/05/05 10:17:04 morsch
55 Y strip numerotation changed (CP)
57 Revision 1.1.2.3 2000/04/26 12:33:40 morsch
58 Minor changes in some methods (CP)
60 Revision 1.1.2.2 2000/02/20 07:49:50 morsch
61 Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
63 Revision 1.1.2.1 2000/02/17 14:34:57 morsch
64 Draft version from P. Crochet
68 #include "AliMUONSegmentationTriggerY.h"
69 #include "AliMUONTriggerConstants.h"
73 #include "AliMUONChamber.h"
77 ClassImp(AliMUONSegmentationTriggerY)
79 //------------------------------------------------------------------
80 void AliMUONSegmentationTriggerY::Init(Int_t chamber)
82 // intialize Y segmentation
83 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
84 if(pMUON->GetDebug()) cout << ClassName() <<": Initialize Trigger Chamber Geometry Y " << "\n";
85 AliMUONSegmentationTrigger::Init(chamber);
87 // calculate x & y position of Y strips
88 Int_t nModule=AliMUONTriggerConstants::Nmodule();
89 for (Int_t imodule=0; imodule<nModule; imodule++) {
90 Float_t width=StripSizeY(AliMUONTriggerConstants::ModuleId(imodule));
91 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
92 for (Int_t istrip=0; istrip<nStrip; istrip++){
94 fXofysmin[imodule][istrip]=
95 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
96 fXofysmax[imodule][istrip]=
97 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
99 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
100 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
102 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
103 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
109 //------------------------------------------------------------------
110 void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
112 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
113 // x,y = real coordinates; ix = module number , iy = strip number
117 Int_t nModule=AliMUONTriggerConstants::Nmodule();
118 for (Int_t imodule=0; imodule<nModule; imodule++) {
119 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
120 for (Int_t istrip=0; istrip<nStrip; istrip++){
121 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
122 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
123 ix = AliMUONTriggerConstants::ModuleId(imodule);
130 //------------------------------------------------------------------
131 void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
133 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
134 // ix = module number , iy = strip number; x,y = center of strip
137 Int_t nModule=AliMUONTriggerConstants::Nmodule();
138 for (Int_t imodule=0; imodule<nModule; imodule++) {
139 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
140 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
141 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
146 //------------------------------------------------------------------
147 void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
155 //------------------------------------------------------------------
156 void AliMUONSegmentationTriggerY::
157 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
158 // Returns list of 10 next neighbours for given Y strip (ix, iy)
159 // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
160 // \_______/ \_______/
162 // Note : should not be used to return a list of neighbours larger than 16 !
164 Int_t absiX = TMath::Abs(iX);
165 Int_t numModule = ModuleNumber(absiX); // module number Id.
166 Int_t nStrip = AliMUONTriggerConstants::NstripY(numModule); //numb of strips
167 Int_t iCandidateLeft, iCandidateRight;
168 Int_t iNewCandidateRight=0;
169 Int_t iNewCandidateLeft=0;
170 // first strip number on the right of the left module
171 if ( (absiX-(Int_t(absiX/10))*10)!=1 && absiX!=52 )
173 AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
177 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
181 for (Int_t i=0; i<5; i++) {
183 iCandidateRight = iY + (i + 1);
184 iCandidateLeft = iY - (i + 1);
185 if (iCandidateRight < nStrip) { // strip in same module
187 Ylist[i] = iCandidateRight;
188 } else if ((absiX+1)%10!=8) { // need to scan the module on the right
190 Ylist[i] = iNewCandidateRight;
191 iNewCandidateRight++;
194 if (iCandidateLeft >=0 ) { // strip in same module
196 Ylist[j] = iCandidateLeft;
197 } else if ( iNewCandidateLeft !=0) {
199 Ylist[j] = iNewCandidateLeft;
204 if (iX<0) { // left side of chamber
205 for (Int_t i=0; i<10; i++) {
206 if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
213 //------------------------------------------------------------------
214 void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
216 // Sets virtual pad coordinates, needed for evaluating pad response
217 // outside the tracking program
218 GetPadC(ix,iy,fX,fY);
219 GetPadI(fX,fY,fIx,fIy);
220 fSector=Sector(ix,iy);
223 //------------------------------------------------------------------
224 Int_t AliMUONSegmentationTriggerY::ISector()
227 //------------------------------------------------------------------
229 Int_t AliMUONSegmentationTriggerY::Ix()
232 //------------------------------------------------------------------
234 Int_t AliMUONSegmentationTriggerY::Iy()
237 //------------------------------------------------------------------
238 Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
240 // returns x size of y strips for sector isec
242 return 2.125*fZscale;
243 } else if (isec==2) {
244 return 2.125*fZscale;
245 } else if (isec==3) {
246 return 2.125*fZscale;
247 } else if (isec==4) {
254 //------------------------------------------------------------------
255 Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
257 // returns y size of y strips for sector isec
260 } else if (isec==2) {
262 } else if (isec==3) {
264 } else if (isec==4) {
266 } else if (isec==5) {
274 //------------------------------------------------------------------
275 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
277 // set hits during diintegration
278 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
281 //------------------------------------------------------------------
282 Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
284 // Returns sector number for given module
286 Int_t absix=TMath::Abs(ix);
287 Int_t iwidth=Int_t(StripSizeY(absix));
291 } else if (absix==41||absix==61) {
293 } else if (iwidth==2) {
295 } else if (iwidth==4) {
302 //------------------------------------------------------------------
303 void AliMUONSegmentationTriggerY::
304 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
306 // returns quantities needed to evaluate neighbour strip response
308 Float_t xstrip,ystrip;
309 GetPadI(fXhit,fYhit,ix,iy);
310 GetPadC(ix,iy,xstrip,ystrip);
311 x1=fXhit; // hit x position
312 x2=xstrip; // x coordinate of the main strip
313 x3=fX; // current strip real x coordinate
314 // width=StripSizeY(ix); // width of the main strip
316 // find the position of the 2 borders of the current strip
317 Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
318 Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
320 // dist. between the hit and the closest border of the current strip
321 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
322 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);