]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationTriggerY.cxx
Double inclusion of AliResponse removed.
[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.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:58  morsch
41 Code from AliMUONSegResTriggerY.cxx
42
43 */
44
45
46 /*
47 Old Log:
48 Revision 1.1.2.4  2000/05/05 10:17:04  morsch
49 Y strip numerotation changed (CP)
50
51 Revision 1.1.2.3  2000/04/26 12:33:40  morsch
52 Minor changes in some methods (CP)
53
54 Revision 1.1.2.2  2000/02/20 07:49:50  morsch
55 Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
56
57 Revision 1.1.2.1  2000/02/17 14:34:57  morsch
58 Draft version from P. Crochet
59
60 */
61
62 #include "AliMUONSegmentationTriggerY.h"
63 #include "AliMUONTriggerConstants.h"
64 #include "TMath.h"
65 #include "TRandom.h"
66 #include "TArc.h"
67 #include "AliMUONChamber.h"
68 #include <iostream.h> 
69 ClassImp(AliMUONSegmentationTriggerY)
70
71 //------------------------------------------------------------------
72 void AliMUONSegmentationTriggerY::Init(Int_t chamber)
73 {
74 // intialize Y segmentation 
75   cout << "Initialize Trigger Chamber Geometry Y " << "\n";    
76   AliMUONSegmentationTrigger::Init(chamber);
77     
78 // calculate x & y position of Y strips
79   Int_t nModule=AliMUONTriggerConstants::Nmodule();  
80   for (Int_t imodule=0; imodule<nModule; imodule++) {    
81     Float_t width=StripSizeY(AliMUONTriggerConstants::ModuleId(imodule));
82     Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);    
83     for (Int_t istrip=0; istrip<nStrip; istrip++){
84       if (imodule<63) {
85         fXofysmin[imodule][istrip]=
86             (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
87         fXofysmax[imodule][istrip]=
88             (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
89       } else {  
90         fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
91         fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
92       }      
93       fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
94       fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
95     }
96   }
97
98 }
99
100 //------------------------------------------------------------------
101 void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy) 
102 {
103 //  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
104 //  x,y = real coordinates; ix = module number , iy = strip number
105
106   ix = 0;    
107   iy = 0;
108   Int_t nModule=AliMUONTriggerConstants::Nmodule();
109   for (Int_t imodule=0; imodule<nModule; imodule++) {
110       Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);      
111     for (Int_t istrip=0; istrip<nStrip; istrip++){
112       if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
113           y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
114         ix = AliMUONTriggerConstants::ModuleId(imodule);
115         iy = istrip;
116       }
117     }
118   }
119 }
120
121 //------------------------------------------------------------------
122 void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
123 {
124 //  Returns real coordinates (x,y) for given pad coordinates (ix,iy)
125 //  ix = module number , iy = strip number;  x,y = center of strip
126   x = 0.;    
127   y = 0.;
128   Int_t nModule=AliMUONTriggerConstants::Nmodule();
129   for (Int_t imodule=0; imodule<nModule; imodule++) {
130     if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
131       x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
132       y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
133     }
134   }
135 }
136
137 //------------------------------------------------------------------
138 void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
139 {
140 //  Sets the padsize 
141 //  
142   fDpx=p1;
143   fDpy=p2;
144 }
145
146 //------------------------------------------------------------------
147 void AliMUONSegmentationTriggerY::
148 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2])
149 {
150 // Returns list of next neighbours for given Pad (ix, iy)  
151   Int_t absiX=TMath::Abs(iX); 
152   *Nlist = 0;
153   
154   if (absiX!=0) {                         
155     Int_t numModule=ModuleNumber(absiX);
156     
157     if (iY==AliMUONTriggerConstants::NstripY(numModule)-1) { // strip right 
158       if (absiX%10!=7) {
159         *Nlist=1;
160         Xlist[0]=absiX+1;
161         Ylist[0]=0;
162       } 
163     } else {
164       *Nlist=1;
165       Xlist[0]=absiX;
166       Ylist[0]=iY+1;
167     }
168     
169     if (iY==0) {                                            // strip left 
170       if (absiX%10!=1&&absiX!=52) {
171         *Nlist=*Nlist+1;
172         Xlist[*Nlist-1]=absiX-1;
173         Ylist[*Nlist-1]=AliMUONTriggerConstants::NstripY(numModule-1)-1;
174       } 
175     } else {
176       *Nlist=*Nlist+1;
177       Xlist[*Nlist-1]=absiX;
178       Ylist[*Nlist-1]=iY-1;
179     }
180     
181     if (iX<0) {                                  // left side of chamber 
182       for (Int_t i=0; i<*Nlist; i++) {Xlist[i]=-Xlist[i];}
183     }
184   }     
185 }
186
187 //------------------------------------------------------------------   
188 void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
189 {
190   // Sets virtual pad coordinates, needed for evaluating pad response 
191   // outside the tracking program 
192   GetPadC(ix,iy,fX,fY);
193   GetPadI(fX,fY,fIx,fIy);
194   fSector=Sector(ix,iy);    
195 }
196
197 //------------------------------------------------------------------   
198 Int_t AliMUONSegmentationTriggerY::ISector() 
199 { return fSector;}
200
201 //------------------------------------------------------------------   
202
203 Int_t AliMUONSegmentationTriggerY::Ix()
204 { return fIx;}
205
206 //------------------------------------------------------------------   
207
208 Int_t AliMUONSegmentationTriggerY::Iy()
209 { return fIy;}
210
211 //------------------------------------------------------------------
212 Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
213
214 // returns x size of y strips for sector isec
215   if (isec==1) {
216     return 2.125*fZscale;
217   } else if (isec==2) {
218     return 2.125*fZscale;
219   } else if (isec==3) {
220     return 2.125*fZscale;
221   } else if (isec==4) {
222     return 4.25*fZscale;
223   } else {
224     return 0.;  
225   }       
226 }
227
228 //------------------------------------------------------------------
229 Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
230
231 // returns y size of y strips for sector isec
232   if (isec==1) {
233     return 68.0*fZscale;
234   } else if (isec==2) {
235     return 51.0*fZscale;
236   } else if (isec==3) {
237     return 68.0*fZscale;
238   } else if (isec==4) {
239     return 68.0*fZscale;
240   } else if (isec==5) {
241     return 68.0*fZscale;
242   } else {
243     return 0.;
244   }
245
246 }
247
248 //------------------------------------------------------------------   
249 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
250
251 // set hits during diintegration
252     AliMUONSegmentationTrigger::SetHit(xhit,yhit);
253 }
254
255 //------------------------------------------------------------------   
256 Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
257 {
258 // Returns sector number for given module
259 // 
260   Int_t absix=TMath::Abs(ix);
261   Int_t iwidth=Int_t(StripSizeY(absix));
262
263   if (absix==52) {
264     return 1;
265   } else if (absix==41||absix==61) {
266     return 2;
267   } else if (iwidth==2) {
268     return 3;
269   } else if (iwidth==4) {
270     return 4;
271   } else {
272     return 0;
273   }
274 }
275
276 //------------------------------------------------------------------   
277 void AliMUONSegmentationTriggerY::
278 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width) 
279
280 // returns quantities needed to evaluate neighbour strip response
281   Int_t ix,iy;
282   Float_t xstrip,ystrip;
283   GetPadI(fXhit,fYhit,ix,iy);  
284   GetPadC(ix,iy,xstrip,ystrip);  
285   x1=fXhit;        // hit x position
286   x2=xstrip;       // x coordinate of the main strip
287   x3=fX;           // current strip real x coordinate  
288   width=StripSizeY(ix);   // width of the main strip 
289 }
290
291
292
293