]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationTriggerY.cxx
New definition of name ofobject in TMap tables. Fixing conding convention violations
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTriggerY.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
88cb7938 16/* $Id$ */
a9e2aefa 17
30178c30 18#include <TMath.h>
19
a9e2aefa 20#include "AliMUONSegmentationTriggerY.h"
3f2cdba8 21#include "AliMUONTriggerConstants.h"
9e1a0ddb 22#include "AliMUON.h"
23#include "AliRun.h"
30178c30 24
a9e2aefa 25ClassImp(AliMUONSegmentationTriggerY)
26
30178c30 27//------------------------------------------------------------------
28AliMUONSegmentationTriggerY::AliMUONSegmentationTriggerY()
29 : AliMUONSegmentationTrigger()
30{
31// Constructor
32}
33
3f2cdba8 34//------------------------------------------------------------------
d81db581 35void AliMUONSegmentationTriggerY::Init(Int_t chamber)
a9e2aefa 36{
3f2cdba8 37// intialize Y segmentation
9e1a0ddb 38 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
ef077202 39 if(pMUON->GetDebug()>1) printf("%s: Initialize Trigger Chamber Geometry Y\n",ClassName());
d81db581 40 AliMUONSegmentationTrigger::Init(chamber);
a9e2aefa 41
42// calculate x & y position of Y strips
3f2cdba8 43 Int_t nModule=AliMUONTriggerConstants::Nmodule();
44 for (Int_t imodule=0; imodule<nModule; imodule++) {
45 Float_t width=StripSizeY(AliMUONTriggerConstants::ModuleId(imodule));
46 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
47 for (Int_t istrip=0; istrip<nStrip; istrip++){
a9e2aefa 48 if (imodule<63) {
3f2cdba8 49 fXofysmin[imodule][istrip]=
50 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip))*fZscale;
51 fXofysmax[imodule][istrip]=
52 (AliMUONTriggerConstants::XcMin(imodule)+width*(istrip+1))*fZscale;
a9e2aefa 53 } else {
54 fXofysmin[imodule][istrip]=-1.*fXofysmax[imodule-63][istrip];
55 fXofysmax[imodule][istrip]=-1.*fXofysmin[imodule-63][istrip];
56 }
3f2cdba8 57 fYofysmin[imodule][istrip] = fYcmin[imodule]*fZscale;
58 fYofysmax[imodule][istrip] = fYcmax[imodule]*fZscale;
a9e2aefa 59 }
60 }
61
62}
63
64//------------------------------------------------------------------
c3eff6ad 65void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
66{
a9e2aefa 67// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
68// x,y = real coordinates; ix = module number , iy = strip number
69
70 ix = 0;
71 iy = 0;
3f2cdba8 72 Int_t nModule=AliMUONTriggerConstants::Nmodule();
73 for (Int_t imodule=0; imodule<nModule; imodule++) {
74 Int_t nStrip=AliMUONTriggerConstants::NstripY(imodule);
75 for (Int_t istrip=0; istrip<nStrip; istrip++){
a9e2aefa 76 if (x>fXofysmin[imodule][istrip]&&x<fXofysmax[imodule][istrip]&&
77 y>fYofysmin[imodule][istrip]&&y<fYofysmax[imodule][istrip]){
3f2cdba8 78 ix = AliMUONTriggerConstants::ModuleId(imodule);
a9e2aefa 79 iy = istrip;
80 }
81 }
82 }
83}
84
85//------------------------------------------------------------------
c3eff6ad 86void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
87{
a9e2aefa 88// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
89// ix = module number , iy = strip number; x,y = center of strip
90 x = 0.;
91 y = 0.;
3f2cdba8 92 Int_t nModule=AliMUONTriggerConstants::Nmodule();
93 for (Int_t imodule=0; imodule<nModule; imodule++) {
94 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
a9e2aefa 95 x=fXofysmin[imodule][iy]+(fXofysmax[imodule][iy]-fXofysmin[imodule][iy])/2.;
96 y=fYofysmin[imodule][iy]+(fYofysmax[imodule][iy]-fYofysmin[imodule][iy])/2.;
97 }
98 }
99}
100
101//------------------------------------------------------------------
102void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
103{
104// Sets the padsize
105//
106 fDpx=p1;
107 fDpy=p2;
108}
109
110//------------------------------------------------------------------
111void AliMUONSegmentationTriggerY::
03f221a7 112Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
113// Returns list of 10 next neighbours for given Y strip (ix, iy)
114// neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
115// \_______/ \_______/
116// left right
117// Note : should not be used to return a list of neighbours larger than 16 !
118
119 Int_t absiX = TMath::Abs(iX);
120 Int_t numModule = ModuleNumber(absiX); // module number Id.
121 Int_t nStrip = AliMUONTriggerConstants::NstripY(numModule); //numb of strips
122 Int_t iCandidateLeft, iCandidateRight;
123 Int_t iNewCandidateRight=0;
124 Int_t iNewCandidateLeft=0;
125// first strip number on the right of the left module
126 if ( (absiX-(Int_t(absiX/10))*10)!=1 && absiX!=52 )
127 iNewCandidateLeft =
128 AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
129 Int_t j;
a9e2aefa 130
03f221a7 131 *Nlist = 10;
132 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
133
134 if (iY < nStrip) {
135
136 for (Int_t i=0; i<5; i++) {
137 j = i + 5;
138 iCandidateRight = iY + (i + 1);
139 iCandidateLeft = iY - (i + 1);
140 if (iCandidateRight < nStrip) { // strip in same module
141 Xlist[i] = absiX;
142 Ylist[i] = iCandidateRight;
143 } else if ((absiX+1)%10!=8) { // need to scan the module on the right
144 Xlist[i] = absiX+1;
145 Ylist[i] = iNewCandidateRight;
146 iNewCandidateRight++;
147 }
148
149 if (iCandidateLeft >=0 ) { // strip in same module
150 Xlist[j] = absiX;
151 Ylist[j] = iCandidateLeft;
152 } else if ( iNewCandidateLeft !=0) {
153 Xlist[j] = absiX-1;
154 Ylist[j] = iNewCandidateLeft;
155 iNewCandidateLeft--;
156 }
a9e2aefa 157 }
158
159 if (iX<0) { // left side of chamber
03f221a7 160 for (Int_t i=0; i<10; i++) {
161 if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
162 }
a9e2aefa 163 }
03f221a7 164
165 } // iY < nStrip
a9e2aefa 166}
167
168//------------------------------------------------------------------
169void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
170{
171 // Sets virtual pad coordinates, needed for evaluating pad response
172 // outside the tracking program
ecfa008b 173 GetPadC(ix,iy,fX,fY);
174 GetPadI(fX,fY,fIx,fIy);
a9e2aefa 175 fSector=Sector(ix,iy);
176}
177
178//------------------------------------------------------------------
c3eff6ad 179Int_t AliMUONSegmentationTriggerY::ISector()
a9e2aefa 180{ return fSector;}
181
182//------------------------------------------------------------------
c3eff6ad 183
a9e2aefa 184Int_t AliMUONSegmentationTriggerY::Ix()
ecfa008b 185{ return fIx;}
a9e2aefa 186
187//------------------------------------------------------------------
c3eff6ad 188
a9e2aefa 189Int_t AliMUONSegmentationTriggerY::Iy()
ecfa008b 190{ return fIy;}
a9e2aefa 191
192//------------------------------------------------------------------
c3eff6ad 193Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
3f2cdba8 194{
195// returns x size of y strips for sector isec
a9e2aefa 196 if (isec==1) {
197 return 2.125*fZscale;
198 } else if (isec==2) {
199 return 2.125*fZscale;
200 } else if (isec==3) {
201 return 2.125*fZscale;
202 } else if (isec==4) {
203 return 4.25*fZscale;
204 } else {
205 return 0.;
206 }
207}
208
209//------------------------------------------------------------------
c3eff6ad 210Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
3f2cdba8 211{
212// returns y size of y strips for sector isec
a9e2aefa 213 if (isec==1) {
214 return 68.0*fZscale;
215 } else if (isec==2) {
216 return 51.0*fZscale;
217 } else if (isec==3) {
218 return 68.0*fZscale;
219 } else if (isec==4) {
220 return 68.0*fZscale;
221 } else if (isec==5) {
222 return 68.0*fZscale;
223 } else {
224 return 0.;
225 }
e889a146 226}
227//------------------------------------------------------------------
228void AliMUONSegmentationTriggerY::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy)
229{
230 GetPadI(x, y, ix, iy);
a9e2aefa 231}
232
233//------------------------------------------------------------------
234void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
3f2cdba8 235{
236// set hits during diintegration
03f221a7 237 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
3f2cdba8 238}
a9e2aefa 239//------------------------------------------------------------------
e889a146 240void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
241{
242 SetHit(xhit, yhit);
243}
244//------------------------------------------------------------------
245Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t /*iy*/)
a9e2aefa 246{
247// Returns sector number for given module
248//
249 Int_t absix=TMath::Abs(ix);
250 Int_t iwidth=Int_t(StripSizeY(absix));
3f2cdba8 251
a9e2aefa 252 if (absix==52) {
253 return 1;
254 } else if (absix==41||absix==61) {
255 return 2;
256 } else if (iwidth==2) {
257 return 3;
258 } else if (iwidth==4) {
259 return 4;
260 } else {
261 return 0;
262 }
263}
264
265//------------------------------------------------------------------
266void AliMUONSegmentationTriggerY::
03f221a7 267IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
a9e2aefa 268{
269// returns quantities needed to evaluate neighbour strip response
270 Int_t ix,iy;
271 Float_t xstrip,ystrip;
ecfa008b 272 GetPadI(fXhit,fYhit,ix,iy);
a30a000f 273 GetPadC(ix,iy,xstrip,ystrip);
ecfa008b 274 x1=fXhit; // hit x position
a9e2aefa 275 x2=xstrip; // x coordinate of the main strip
ecfa008b 276 x3=fX; // current strip real x coordinate
03f221a7 277 // width=StripSizeY(ix); // width of the main strip
278
279 // find the position of the 2 borders of the current strip
280 Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
281 Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
282
283 // dist. between the hit and the closest border of the current strip
284 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
285 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);
286
a9e2aefa 287}
288
289
290
291