]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationV02.cxx
Cleaning of the code :
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationV02.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.3  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.2  2000/06/15 07:58:48  morsch
23 Code from MUON-dev joined
24
25 Revision 1.1.2.1  2000/06/09 21:37:56  morsch
26 AliMUONSegmentationV02 code  from  AliMUONSegResV02.cxx
27
28 */
29
30
31
32 /////////////////////////////////////////////////////
33 //  Segmentation and Response classes version 02   //
34 /////////////////////////////////////////////////////
35
36
37 #include "AliMUONSegmentationV02.h"
38 #include "iostream.h"
39
40 //___________________________________________
41 ClassImp(AliMUONSegmentationV02)
42
43 void AliMUONSegmentationV02::SetPadSize(Float_t p1, Float_t p2)
44 {
45 //  Sets the padsize 
46 //
47     fDpy=p1;
48     fDpx=p2;
49 }
50
51 Int_t AliMUONSegmentationV02::Npx()
52 // Returns maximum number if pads in x
53 {return AliMUONSegmentationV01::Npy();}
54
55 Int_t AliMUONSegmentationV02::Npy()
56 // Returns maximum number if pads in y
57 {return AliMUONSegmentationV01::Npx();}
58
59
60 Float_t AliMUONSegmentationV02::Dpx(Int_t isec)
61 // Returns pad-size in x
62 {return fDpy;}
63
64 Float_t AliMUONSegmentationV02::Dpy(Int_t isec)
65 // Returns pad-size in y
66 {return fDpxD[isec];}
67 Int_t AliMUONSegmentationV02::Sector(Int_t ix, Int_t iy)
68 // Returns sector number for given pad position
69 //
70 {return AliMUONSegmentationV01::Sector(iy, ix);}
71
72 void AliMUONSegmentationV02::
73
74 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
75 //  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
76 //
77 {
78 AliMUONSegmentationV01::GetPadI(y, x, iy, ix);
79 // printf("\n x,y,ix,iy %f %f %d %d", x,y,ix,iy);
80 }
81
82 void AliMUONSegmentationV02::
83 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
84 //  Returns real coordinates (x,y) for given pad coordinates (ix,iy)
85 //
86 {
87     AliMUONSegmentationV01::GetPadC(iy, ix, y, x);
88 }
89 void AliMUONSegmentationV02::SetPad(Int_t ix,Int_t iy)
90 {
91     //
92     // Sets virtual pad coordinates, needed for evaluating pad response 
93     // outside the tracking program 
94     GetPadC(ix,iy,fX,fY);
95     fSector=Sector(ix,iy);    
96 }
97
98
99
100 void AliMUONSegmentationV02::NextPad()
101 {
102 // Stepper for the iteration over pads
103 //
104   // 
105   // Step to next pad in integration region
106     Float_t xc,yc;
107     Int_t   ixc;
108     
109 //  step up    
110     if (fY < fYmax && fY != 0) {
111         if (fIy==-1) fIy++;
112         fIy++;
113 //  step right 
114     } else if (fIx != fIxmax) {
115         if (fIx==-1) fIx++;
116         fIx++;
117 //      get y-position of next row (yc), xc not used here       
118         GetPadC(fIx,fIy,xc,yc);
119 //      get x-pad coordiante for 1 pad in row (fIx)
120         GetPadI(xc,fYmin,ixc,fIy);
121     } else {
122         printf("\n Error: Stepping outside integration region\n ");
123     }
124     GetPadC(fIx,fIy,fX,fY);
125     fSector=Sector(fIx,fIy);
126     if (MorePads() && 
127         (fSector ==-1 || fSector==0 )) 
128         NextPad();
129 //    printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy);
130     
131 }
132
133 Int_t AliMUONSegmentationV02::MorePads()
134 // Stopping condition for the iterator over pads
135 //
136 //
137 // Are there more pads in the integration region
138 {
139     if ((fY >= fYmax  && fIx >= fIxmax) || fX==0) {
140         return 0;
141     } else {
142         return 1;
143     }
144 }
145
146 void AliMUONSegmentationV02::
147 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
148 {
149 // Returns list of next neighbours for given Pad (iX, iY)
150 //
151     Int_t n;
152     AliMUONSegmentationV01::Neighbours(iY, iX, &n, Ylist, Xlist);
153     *Nlist=n;
154 }
155
156
157
158