]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationTriggerY.cxx
New files for folders and Stack
[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.8  2000/11/20 21:44:17  pcrochet
19 some modifications to account for the new class AliMUONResponseTriggerV1
20
21 Revision 1.7  2000/10/03 21:48:07  morsch
22 Adopt to const declaration of some of the methods in AliSegmentation.
23
24 Revision 1.6  2000/10/02 16:58:29  egangler
25 Cleaning of the code :
26 -> coding conventions
27 -> void Streamers
28 -> some useless includes removed or replaced by "class" statement
29
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.
33
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).
39
40 Revision 1.3  2000/06/26 10:01:26  pcrochet
41 global variables removed
42
43 Revision 1.2  2000/06/15 07:58:48  morsch
44 Code from MUON-dev joined
45
46 Revision 1.1.2.1  2000/06/09 21:51:58  morsch
47 Code from AliMUONSegResTriggerY.cxx
48
49 */
50
51
52 /*
53 Old Log:
54 Revision 1.1.2.4  2000/05/05 10:17:04  morsch
55 Y strip numerotation changed (CP)
56
57 Revision 1.1.2.3  2000/04/26 12:33:40  morsch
58 Minor changes in some methods (CP)
59
60 Revision 1.1.2.2  2000/02/20 07:49:50  morsch
61 Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
62
63 Revision 1.1.2.1  2000/02/17 14:34:57  morsch
64 Draft version from P. Crochet
65
66 */
67
68 #include "AliMUONSegmentationTriggerY.h"
69 #include "AliMUONTriggerConstants.h"
70 #include "TMath.h"
71 #include "TRandom.h"
72 #include "TArc.h"
73 #include "AliMUONChamber.h"
74 #include "AliMUON.h"
75 #include "AliRun.h"
76 #include <iostream.h> 
77 ClassImp(AliMUONSegmentationTriggerY)
78
79 //------------------------------------------------------------------
80 void AliMUONSegmentationTriggerY::Init(Int_t chamber)
81 {
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);
86     
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++){
93       if (imodule<63) {
94         fXofysmin[imodule][istrip]=
95             (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
96         fXofysmax[imodule][istrip]=
97             (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
98       } else {  
99         fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
100         fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
101       }      
102       fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
103       fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
104     }
105   }
106
107 }
108
109 //------------------------------------------------------------------
110 void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy) 
111 {
112 //  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
113 //  x,y = real coordinates; ix = module number , iy = strip number
114
115   ix = 0;    
116   iy = 0;
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);
124         iy = istrip;
125       }
126     }
127   }
128 }
129
130 //------------------------------------------------------------------
131 void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
132 {
133 //  Returns real coordinates (x,y) for given pad coordinates (ix,iy)
134 //  ix = module number , iy = strip number;  x,y = center of strip
135   x = 0.;    
136   y = 0.;
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.;
142     }
143   }
144 }
145
146 //------------------------------------------------------------------
147 void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
148 {
149 //  Sets the padsize 
150 //  
151   fDpx=p1;
152   fDpy=p2;
153 }
154
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 //                  \_______/                    \_______/
161 //                    left                         right  
162 // Note : should not be used to return a list of neighbours larger than 16 !
163
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 ) 
172     iNewCandidateLeft = 
173       AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
174   Int_t j;
175   
176   *Nlist = 10;
177   for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
178
179   if (iY < nStrip) {
180
181     for (Int_t i=0; i<5; i++) {
182       j = i + 5;
183       iCandidateRight = iY + (i + 1);
184       iCandidateLeft  = iY - (i + 1);
185       if (iCandidateRight < nStrip) { // strip in same module  
186         Xlist[i] = absiX;
187         Ylist[i] = iCandidateRight;  
188       } else if ((absiX+1)%10!=8) {   // need to scan the module on the right
189         Xlist[i] = absiX+1;
190         Ylist[i] = iNewCandidateRight;  
191         iNewCandidateRight++;
192       }
193       
194       if (iCandidateLeft >=0 ) { // strip in same module
195         Xlist[j] = absiX;
196         Ylist[j] = iCandidateLeft;  
197       } else if ( iNewCandidateLeft !=0) {
198         Xlist[j] = absiX-1;
199         Ylist[j] = iNewCandidateLeft;  
200         iNewCandidateLeft--;
201       }
202     }
203     
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]; 
207       }
208     }
209     
210   } // iY < nStrip    
211 }
212
213 //------------------------------------------------------------------   
214 void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
215 {
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);    
221 }
222
223 //------------------------------------------------------------------   
224 Int_t AliMUONSegmentationTriggerY::ISector() 
225 { return fSector;}
226
227 //------------------------------------------------------------------   
228
229 Int_t AliMUONSegmentationTriggerY::Ix()
230 { return fIx;}
231
232 //------------------------------------------------------------------   
233
234 Int_t AliMUONSegmentationTriggerY::Iy()
235 { return fIy;}
236
237 //------------------------------------------------------------------
238 Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
239
240 // returns x size of y strips for sector isec
241   if (isec==1) {
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) {
248     return 4.25*fZscale;
249   } else {
250     return 0.;  
251   }       
252 }
253
254 //------------------------------------------------------------------
255 Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
256
257 // returns y size of y strips for sector isec
258   if (isec==1) {
259     return 68.0*fZscale;
260   } else if (isec==2) {
261     return 51.0*fZscale;
262   } else if (isec==3) {
263     return 68.0*fZscale;
264   } else if (isec==4) {
265     return 68.0*fZscale;
266   } else if (isec==5) {
267     return 68.0*fZscale;
268   } else {
269     return 0.;
270   }
271
272 }
273
274 //------------------------------------------------------------------   
275 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
276
277 // set hits during diintegration
278   AliMUONSegmentationTrigger::SetHit(xhit,yhit);
279 }
280
281 //------------------------------------------------------------------   
282 Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
283 {
284 // Returns sector number for given module
285 // 
286   Int_t absix=TMath::Abs(ix);
287   Int_t iwidth=Int_t(StripSizeY(absix));
288
289   if (absix==52) {
290     return 1;
291   } else if (absix==41||absix==61) {
292     return 2;
293   } else if (iwidth==2) {
294     return 3;
295   } else if (iwidth==4) {
296     return 4;
297   } else {
298     return 0;
299   }
300 }
301
302 //------------------------------------------------------------------   
303 void AliMUONSegmentationTriggerY::
304 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4) 
305
306 // returns quantities needed to evaluate neighbour strip response
307   Int_t ix,iy;
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 
315
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];
319
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);    
323
324 }
325
326
327
328