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