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