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