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