]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationTriggerY.cxx
Use access functions to AliMUONDigit member data.
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTriggerY.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.7  2000/10/03 21:48:07  morsch
19 Adopt to const declaration of some of the methods in AliSegmentation.
20
21 Revision 1.6  2000/10/02 16:58:29  egangler
22 Cleaning of the code :
23 -> coding conventions
24 -> void Streamers
25 -> some useless includes removed or replaced by "class" statement
26
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.
30
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).
36
37 Revision 1.3  2000/06/26 10:01:26  pcrochet
38 global variables removed
39
40 Revision 1.2  2000/06/15 07:58:48  morsch
41 Code from MUON-dev joined
42
43 Revision 1.1.2.1  2000/06/09 21:51:58  morsch
44 Code from AliMUONSegResTriggerY.cxx
45
46 */
47
48
49 /*
50 Old Log:
51 Revision 1.1.2.4  2000/05/05 10:17:04  morsch
52 Y strip numerotation changed (CP)
53
54 Revision 1.1.2.3  2000/04/26 12:33:40  morsch
55 Minor changes in some methods (CP)
56
57 Revision 1.1.2.2  2000/02/20 07:49:50  morsch
58 Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
59
60 Revision 1.1.2.1  2000/02/17 14:34:57  morsch
61 Draft version from P. Crochet
62
63 */
64
65 #include "AliMUONSegmentationTriggerY.h"
66 #include "AliMUONTriggerConstants.h"
67 #include "TMath.h"
68 #include "TRandom.h"
69 #include "TArc.h"
70 #include "AliMUONChamber.h"
71 #include <iostream.h> 
72 ClassImp(AliMUONSegmentationTriggerY)
73
74 //------------------------------------------------------------------
75 void AliMUONSegmentationTriggerY::Init(Int_t chamber)
76 {
77 // intialize Y segmentation 
78   cout << "Initialize Trigger Chamber Geometry Y " << "\n";    
79   AliMUONSegmentationTrigger::Init(chamber);
80     
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++){
87       if (imodule<63) {
88         fXofysmin[imodule][istrip]=
89             (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
90         fXofysmax[imodule][istrip]=
91             (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
92       } else {  
93         fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
94         fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
95       }      
96       fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
97       fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
98     }
99   }
100
101 }
102
103 //------------------------------------------------------------------
104 void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy) 
105 {
106 //  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
107 //  x,y = real coordinates; ix = module number , iy = strip number
108
109   ix = 0;    
110   iy = 0;
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);
118         iy = istrip;
119       }
120     }
121   }
122 }
123
124 //------------------------------------------------------------------
125 void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
126 {
127 //  Returns real coordinates (x,y) for given pad coordinates (ix,iy)
128 //  ix = module number , iy = strip number;  x,y = center of strip
129   x = 0.;    
130   y = 0.;
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.;
136     }
137   }
138 }
139
140 //------------------------------------------------------------------
141 void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
142 {
143 //  Sets the padsize 
144 //  
145   fDpx=p1;
146   fDpy=p2;
147 }
148
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 //                  \_______/                    \_______/
155 //                    left                         right  
156 // Note : should not be used to return a list of neighbours larger than 16 !
157
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 ) 
166     iNewCandidateLeft = 
167       AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
168   Int_t j;
169   
170   *Nlist = 10;
171   for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
172
173   if (iY < nStrip) {
174
175     for (Int_t i=0; i<5; i++) {
176       j = i + 5;
177       iCandidateRight = iY + (i + 1);
178       iCandidateLeft  = iY - (i + 1);
179       if (iCandidateRight < nStrip) { // strip in same module  
180         Xlist[i] = absiX;
181         Ylist[i] = iCandidateRight;  
182       } else if ((absiX+1)%10!=8) {   // need to scan the module on the right
183         Xlist[i] = absiX+1;
184         Ylist[i] = iNewCandidateRight;  
185         iNewCandidateRight++;
186       }
187       
188       if (iCandidateLeft >=0 ) { // strip in same module
189         Xlist[j] = absiX;
190         Ylist[j] = iCandidateLeft;  
191       } else if ( iNewCandidateLeft !=0) {
192         Xlist[j] = absiX-1;
193         Ylist[j] = iNewCandidateLeft;  
194         iNewCandidateLeft--;
195       }
196     }
197     
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]; 
201       }
202     }
203     
204   } // iY < nStrip    
205 }
206
207 //------------------------------------------------------------------   
208 void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
209 {
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);    
215 }
216
217 //------------------------------------------------------------------   
218 Int_t AliMUONSegmentationTriggerY::ISector() 
219 { return fSector;}
220
221 //------------------------------------------------------------------   
222
223 Int_t AliMUONSegmentationTriggerY::Ix()
224 { return fIx;}
225
226 //------------------------------------------------------------------   
227
228 Int_t AliMUONSegmentationTriggerY::Iy()
229 { return fIy;}
230
231 //------------------------------------------------------------------
232 Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
233
234 // returns x size of y strips for sector isec
235   if (isec==1) {
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) {
242     return 4.25*fZscale;
243   } else {
244     return 0.;  
245   }       
246 }
247
248 //------------------------------------------------------------------
249 Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
250
251 // returns y size of y strips for sector isec
252   if (isec==1) {
253     return 68.0*fZscale;
254   } else if (isec==2) {
255     return 51.0*fZscale;
256   } else if (isec==3) {
257     return 68.0*fZscale;
258   } else if (isec==4) {
259     return 68.0*fZscale;
260   } else if (isec==5) {
261     return 68.0*fZscale;
262   } else {
263     return 0.;
264   }
265
266 }
267
268 //------------------------------------------------------------------   
269 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
270
271 // set hits during diintegration
272   AliMUONSegmentationTrigger::SetHit(xhit,yhit);
273 }
274
275 //------------------------------------------------------------------   
276 Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
277 {
278 // Returns sector number for given module
279 // 
280   Int_t absix=TMath::Abs(ix);
281   Int_t iwidth=Int_t(StripSizeY(absix));
282
283   if (absix==52) {
284     return 1;
285   } else if (absix==41||absix==61) {
286     return 2;
287   } else if (iwidth==2) {
288     return 3;
289   } else if (iwidth==4) {
290     return 4;
291   } else {
292     return 0;
293   }
294 }
295
296 //------------------------------------------------------------------   
297 void AliMUONSegmentationTriggerY::
298 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4) 
299
300 // returns quantities needed to evaluate neighbour strip response
301   Int_t ix,iy;
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 
309
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];
313
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);    
317
318 }
319
320
321
322