]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationTriggerX.cxx
New class replacing AliCluster
[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$
c3eff6ad 18Revision 1.6 2000/10/02 16:58:29 egangler
19Cleaning of the code :
20-> coding conventions
21-> void Streamers
22-> some useless includes removed or replaced by "class" statement
23
ecfa008b 24Revision 1.5 2000/07/03 11:54:57 morsch
25AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
26The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
27
a30a000f 28Revision 1.4 2000/06/29 12:34:09 morsch
29AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
30it usable with any other geometry class. The link to the object to which it belongs is
31established via an index. This assumes that there exists a global geometry manager
32from which the pointer to the parent object can be obtained (in our case gAlice).
33
d81db581 34Revision 1.3 2000/06/26 10:01:26 pcrochet
35global variables removed
36
3f2cdba8 37Revision 1.2 2000/06/15 07:58:48 morsch
38Code from MUON-dev joined
39
a9e2aefa 40Revision 1.1.2.1 2000/06/09 21:51:03 morsch
41Code from AliMUONSegResTrigger.cxx
42
43*/
44
45
3f2cdba8 46
a9e2aefa 47/*
48Old Log:
49Revision 1.1.2.4 2000/04/26 12:33:25 morsch
50Minor changes in some methods (CP)
51
52Revision 1.1.2.3 2000/03/20 18:14:16 morsch
53Missing sector added.
54
55Revision 1.1.2.2 2000/02/20 07:50:49 morsch
56Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
57
58Revision 1.1.2.1 2000/02/17 14:33:49 morsch
59Draft version from P. Crochet
60
61*/
62
63#include "AliMUONSegmentationTriggerX.h"
3f2cdba8 64#include "AliMUONTriggerConstants.h"
a9e2aefa 65#include "TMath.h"
66#include "TRandom.h"
67#include "TArc.h"
68#include "AliMUONChamber.h"
69#include <iostream.h>
70ClassImp(AliMUONSegmentationTriggerX)
3f2cdba8 71
72//------------------------------------------------------------------
d81db581 73void AliMUONSegmentationTriggerX::Init(Int_t chamber)
a9e2aefa 74{
3f2cdba8 75// intialize X segmentation
a9e2aefa 76 cout << "Initialize Trigger Chamber Geometry X " << "\n";
d81db581 77 AliMUONSegmentationTrigger::Init(chamber);
a9e2aefa 78
79// calculate x & y position of X strips
3f2cdba8 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;
a9e2aefa 87
3f2cdba8 88 fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
89 fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
a9e2aefa 90 }
91 }
92}
93
94//------------------------------------------------------------------
c3eff6ad 95void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
96{
a9e2aefa 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;
3f2cdba8 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 }
a9e2aefa 110 }
a9e2aefa 111 }
112}
113
114//------------------------------------------------------------------
c3eff6ad 115void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
116{
a9e2aefa 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.;
3f2cdba8 121 Int_t nModule=AliMUONTriggerConstants::Nmodule();
122
123 for (Int_t imodule=0; imodule<nModule; imodule++) {
124 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
a9e2aefa 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//------------------------------------------------------------------
132void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2)
133{
134// Sets the padsize
135//
136 fDpx=p1;
137 fDpy=p2;
138}
139
140//------------------------------------------------------------------
141void AliMUONSegmentationTriggerX::
c3eff6ad 142Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2])
143{
a9e2aefa 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
3f2cdba8 152 if (iY<AliMUONTriggerConstants::NstripX(numModule)-1) { // strip up in same module
a9e2aefa 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//------------------------------------------------------------------
171void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy)
172{
173 // Sets virtual pad coordinates, needed for evaluating pad response
174 // outside the tracking program
ecfa008b 175 GetPadC(ix,iy,fX,fY);
176 GetPadI(fX,fY,fIx,fIy);
a9e2aefa 177 fSector=Sector(ix,iy);
178}
179
180//------------------------------------------------------------------
c3eff6ad 181Int_t AliMUONSegmentationTriggerX::ISector()
a9e2aefa 182{ return fSector;}
183
184//------------------------------------------------------------------
185Int_t AliMUONSegmentationTriggerX::Ix()
ecfa008b 186{ return fIx;}
a9e2aefa 187
188//------------------------------------------------------------------
c3eff6ad 189
a9e2aefa 190Int_t AliMUONSegmentationTriggerX::Iy()
ecfa008b 191{ return fIy;}
a9e2aefa 192
193//------------------------------------------------------------------
c3eff6ad 194Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const
3f2cdba8 195{
196// returns x size of x strips for sector isec
a9e2aefa 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//------------------------------------------------------------------
c3eff6ad 216Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const
3f2cdba8 217{
218// returns y size of x strips for sector isec
a9e2aefa 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//------------------------------------------------------------------
238void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
3f2cdba8 239{
240// set hit during disIntegration
241AliMUONSegmentationTrigger::SetHit(xhit,yhit);
242}
a9e2aefa 243
244//------------------------------------------------------------------
c3eff6ad 245Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t iy)
a9e2aefa 246{
247// Returns sector number for given module
248//
3f2cdba8 249
a9e2aefa 250 Int_t absix=TMath::Abs(ix);
251 Int_t iwidth=Int_t(StripSizeX(absix));
3f2cdba8 252
a9e2aefa 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//------------------------------------------------------------------
271void AliMUONSegmentationTriggerX::
272IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width)
3f2cdba8 273{
274// returns quantities needed to evaluate neighbour strip response
275
a9e2aefa 276 Int_t ix,iy;
277 Float_t xstrip,ystrip;
ecfa008b 278 GetPadI(fXhit,fYhit,ix,iy);
a30a000f 279 GetPadC(ix,iy,xstrip,ystrip);
ecfa008b 280 x1=fYhit; // hit y position
a9e2aefa 281 x2=ystrip; // y coordinate of the main strip
ecfa008b 282 x3=fY; // current strip real y coordinate
a9e2aefa 283 width=StripSizeX(ix); // width of the main strip
284}
285
286
287
288
289
290
291
292