]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationTriggerX.cxx
730b37a2325e216ba9a51ee2ce81eee7cf962e26
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTriggerX.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.5  2000/07/03 11:54:57  morsch
19 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
20 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
21
22 Revision 1.4  2000/06/29 12:34:09  morsch
23 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
24 it usable with any other geometry class. The link to the object to which it belongs is
25 established via an index. This assumes that there exists a global geometry manager
26 from which the pointer to the parent object can be obtained (in our case gAlice).
27
28 Revision 1.3  2000/06/26 10:01:26  pcrochet
29 global variables removed
30
31 Revision 1.2  2000/06/15 07:58:48  morsch
32 Code from MUON-dev joined
33
34 Revision 1.1.2.1  2000/06/09 21:51:03  morsch
35 Code from AliMUONSegResTrigger.cxx
36
37 */
38
39
40
41 /*
42 Old Log:
43 Revision 1.1.2.4  2000/04/26 12:33:25  morsch
44 Minor changes in some methods (CP)
45
46 Revision 1.1.2.3  2000/03/20 18:14:16  morsch
47 Missing sector added.
48
49 Revision 1.1.2.2  2000/02/20 07:50:49  morsch
50 Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
51
52 Revision 1.1.2.1  2000/02/17 14:33:49  morsch
53 Draft version from P. Crochet
54
55 */
56
57 #include "AliMUONSegmentationTriggerX.h"
58 #include "AliMUONTriggerConstants.h"
59 #include "TMath.h"
60 #include "TRandom.h"
61 #include "TArc.h"
62 #include "AliMUONChamber.h"
63 #include <iostream.h> 
64 ClassImp(AliMUONSegmentationTriggerX)
65
66 //------------------------------------------------------------------
67 void AliMUONSegmentationTriggerX::Init(Int_t chamber)
68 {
69 // intialize X segmentation 
70   cout << "Initialize Trigger Chamber Geometry X " << "\n";    
71   AliMUONSegmentationTrigger::Init(chamber);
72
73 // calculate x & y position of X strips
74   Int_t nModule=AliMUONTriggerConstants::Nmodule();
75   for (Int_t imodule=0; imodule<nModule; imodule++) {
76     Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule));     
77     Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
78     for (Int_t istrip=0; istrip<nStrip; istrip++){    
79       fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale;
80       fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale;
81       
82       fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
83       fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
84     }
85   }
86 }
87
88 //------------------------------------------------------------------
89 void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy){
90 //  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
91 //  x,y = real coordinates; ix = module number , iy = strip number
92   ix = 0;    
93   iy = 0;
94   Int_t nModule=AliMUONTriggerConstants::Nmodule();
95   for (Int_t imodule=0; imodule<nModule; imodule++) {
96       Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
97       for (Int_t istrip=0; istrip<nStrip; istrip++){
98           if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
99               y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
100               ix = AliMUONTriggerConstants::ModuleId(imodule);
101               iy = istrip;
102           }
103       }
104   }
105 }
106
107 //------------------------------------------------------------------
108 void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y){
109 //  Returns real coordinates (x,y) for given pad coordinates (ix,iy)
110 //  ix = module number , iy = strip number;  x,y = center of strip
111   x = 0.;    
112   y = 0.; 
113   Int_t nModule=AliMUONTriggerConstants::Nmodule();
114
115   for (Int_t imodule=0; imodule<nModule; imodule++) {
116     if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
117       x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.;
118       y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.;
119     }
120   }
121 }
122
123 //------------------------------------------------------------------
124 void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2)
125 {
126 //  Sets the padsize 
127 //  
128   fDpx=p1;
129   fDpy=p2;
130 }
131
132 //------------------------------------------------------------------
133 void AliMUONSegmentationTriggerX::
134 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2]){
135 // Returns list of next neighbours for given Pad (ix, iy)  
136
137   Int_t absiX=TMath::Abs(iX); 
138   *Nlist = 0;
139     
140   if (absiX!=0) {                           
141     Int_t numModule=ModuleNumber(absiX);
142     
143     if (iY<AliMUONTriggerConstants::NstripX(numModule)-1) { // strip up in same module 
144       *Nlist=1;
145       Xlist[0]=absiX;
146       Ylist[0]=iY+1;
147     } 
148     
149     if (iY>0) {                               // strip down in same module
150       *Nlist=*Nlist+1;
151       Xlist[*Nlist-1]=absiX;
152       Ylist[*Nlist-1]=iY-1;
153     } 
154     
155     if (iX<0) {                               // left side of chamber 
156       for (Int_t i=0; i<*Nlist; i++) {Xlist[i]=-Xlist[i];}
157     }
158   }
159 }
160
161 //------------------------------------------------------------------   
162 void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy)
163 {
164   // Sets virtual pad coordinates, needed for evaluating pad response 
165   // outside the tracking program
166   GetPadC(ix,iy,fX,fY);
167   GetPadI(fX,fY,fIx,fIy);
168   fSector=Sector(ix,iy);
169 }
170
171 //------------------------------------------------------------------   
172 Int_t AliMUONSegmentationTriggerX::ISector()
173 { return fSector;}
174
175 //------------------------------------------------------------------   
176 Int_t AliMUONSegmentationTriggerX::Ix()
177 { return fIx;}
178
179 //------------------------------------------------------------------   
180 Int_t AliMUONSegmentationTriggerX::Iy()
181 { return fIy;}
182
183 //------------------------------------------------------------------
184 Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec)
185
186 // returns x size of x strips for sector isec
187     
188   if (isec==1) {
189     return 17.0*fZscale;
190   } else if (isec==2) {
191     return 34.0*fZscale;
192   } else if (isec==3) {
193     return 34.0*fZscale;
194   } else if (isec==4) {
195     return 34.0*fZscale;
196   } else if (isec==5) {
197     return 34.0*fZscale;
198   } else if (isec==6) {
199     return 68.0*fZscale;
200   } else {
201     return 0.;
202   }
203 }
204
205 //------------------------------------------------------------------
206 Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec)
207
208 // returns y size of x strips for sector isec
209
210   if (isec==1) {
211     return 1.0625*fZscale;
212   } else if (isec==2) {
213     return 1.0625*fZscale;
214   } else if (isec==3) {
215     return 1.0625*fZscale;
216   } else if (isec==4) {
217     return 2.125*fZscale;
218   } else if (isec==5) {
219     return 4.25*fZscale;
220   } else if (isec==6) {
221     return 4.25*fZscale;
222   } else {
223     return 0.;  
224   }   
225 }
226
227 //------------------------------------------------------------------   
228 void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
229
230 // set hit during disIntegration
231 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
232 }
233
234 //------------------------------------------------------------------   
235 Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t iy)
236 {
237 // Returns sector number for given module
238 // 
239     
240   Int_t absix=TMath::Abs(ix);
241   Int_t iwidth=Int_t(StripSizeX(absix));
242
243   if (absix==52) {
244     return 1;
245   } else if (absix==41||absix==61) {
246     return 2;
247   } else if (iwidth==1) {
248     return 3;
249   } else if (iwidth==2) {
250     return 4;
251   } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) {
252     return 5;
253   } else if (iwidth==4) {
254     return 6;
255   } else {
256     return 0;
257   }
258 }
259
260 //------------------------------------------------------------------   
261 void AliMUONSegmentationTriggerX::
262 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width) 
263
264 // returns quantities needed to evaluate neighbour strip response
265
266   Int_t ix,iy;
267   Float_t xstrip,ystrip;
268   GetPadI(fXhit,fYhit,ix,iy);  
269   GetPadC(ix,iy,xstrip,ystrip);  
270   x1=fYhit;        // hit y position
271   x2=ystrip;       // y coordinate of the main strip
272   x3=fY;           // current strip real y coordinate  
273   width=StripSizeX(ix);   // width of the main strip 
274 }
275
276
277
278
279
280
281
282