]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSt345SlatSegmentation.cxx
inconsistency between TriggerCircuit and TriggerGeometryBuilder temporary fixed in...
[u/mrichter/AliRoot.git] / MUON / AliMUONSt345SlatSegmentation.cxx
CommitLineData
cc4dcfb0 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/* $Id$ */
17
18//*********************************************************
19// Segmentation classes for slat modules
20// This class works with local coordinates
21// of the slats via the class AliMUONGeometrySegmentation
22// This class contains the size of the slats and the
23// and the differents PCB densities.
24// (from old AliMUONSegmentationSlatModule)
25// Gines, Subatech, Nov04
f1501d74 26// Add electronics mapping
27// Christian, Subatech, Mai 05
cc4dcfb0 28//*********************************************************
29
30#include <TArrayI.h>
31#include <TArrayF.h>
32#include "AliMUONSt345SlatSegmentation.h"
f1501d74 33#include "AliMUONSegmentationDetectionElement.h"
34#include "AliMUONSegmentManuIndex.h"
35#include "AliMUONSegmentIndex.h"
36
cc4dcfb0 37#include "AliLog.h"
38
cc4dcfb0 39ClassImp(AliMUONSt345SlatSegmentation)
40
41
a713db22 42AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation()
f1501d74 43 : AliMUONVGeometryDESegmentation(),
a713db22 44 fBending(0),
45 fId(0),
6b9de626 46 fNsec(0),
47 fNDiv(0),
48 fDpxD(0),
49 fDpyD(0),
a713db22 50 fDpx(0),
51 fDpy(0),
52 fNpx(999999),
53 fNpy(999999),
54 fWireD(0.0),
55 fXhit(0.),
56 fYhit(0.),
57 fIx(0),
58 fIy(0),
59 fX(0.),
60 fY(0.),
61 fIxmin(0),
62 fIxmax(0),
63 fIymin(0),
f1501d74 64 fIymax(0),
65 fInitDone(kFALSE),
66 fSegmentationDetectionElement(0x0)
a713db22 67{
68 // default constructor
69
70}
71
72//___________________________________________
f48459ab 73AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(Bool_t bending)
fed772f3 74 : AliMUONVGeometryDESegmentation(),
f48459ab 75 fBending(bending),
76 fId(0),
6b9de626 77 fNsec(0),
78 fNDiv(0),
79 fDpxD(0),
80 fDpyD(0),
f48459ab 81 fDpx(0),
82 fDpy(0),
83 fNpx(999999),
84 fNpy(999999),
85 fWireD(0.25),
86 fXhit(0.),
87 fYhit(0.),
88 fIx(0),
89 fIy(0),
90 fX(0.),
91 fY(0.),
92 fIxmin(0),
93 fIxmax(0),
94 fIymin(0),
f1501d74 95 fIymax(0),
96 fInitDone(kFALSE),
97 fSegmentationDetectionElement(0x0)
98
99
cc4dcfb0 100{
f48459ab 101 // Non default constructor
cc4dcfb0 102 fNsec = 4; // 4 sector densities at most per slat
103 fNDiv = new TArrayI(fNsec);
104 fDpxD = new TArrayF(fNsec);
f48459ab 105 fDpyD = new TArrayF(fNsec);
cc4dcfb0 106 (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;
107 (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;
f1501d74 108 (*fDpyD)[0]=(*fDpyD)[1]=(*fDpyD)[2]=(*fDpyD)[3]=0;
109
110
cc4dcfb0 111}
112//----------------------------------------------------------------------
fed772f3 113AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(const AliMUONSt345SlatSegmentation& rhs)
114: AliMUONVGeometryDESegmentation(rhs),
115 fBending(0),
116 fId(0),
117 fDpx(0),
118 fDpy(0),
119 fNpx(999999),
120 fNpy(999999),
121 fWireD(0.25),
122 fXhit(0.),
123 fYhit(0.),
124 fIx(0),
125 fIy(0),
126 fX(0.),
127 fY(0.),
128 fIxmin(0),
129 fIxmax(0),
130 fIymin(0),
f1501d74 131 fIymax(0),
132 fSegmentationDetectionElement(0x0)
cc4dcfb0 133{
fed772f3 134 // default constructor
cc4dcfb0 135}
136//----------------------------------------------------------------------
137AliMUONSt345SlatSegmentation::~AliMUONSt345SlatSegmentation()
138{
f48459ab 139 // Destructor
140 if (fNDiv) delete fNDiv;
141 if (fDpxD) delete fDpxD;
142 if (fDpyD) delete fDpyD;
f1501d74 143 // if (fSegmentationDetectionElement) fSegmentationDetectionElement->Delete();
cc4dcfb0 144}
145//----------------------------------------------------------------------
146AliMUONSt345SlatSegmentation& AliMUONSt345SlatSegmentation::operator=(const AliMUONSt345SlatSegmentation& rhs)
147{
f48459ab 148 // Protected assignement operator
cc4dcfb0 149 if (this == &rhs) return *this;
150 AliFatal("Not implemented.");
151 return *this;
152}
153
154
155//------------------------------------------------------------------------
156Float_t AliMUONSt345SlatSegmentation::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y, Int_t * /*dummy*/)
157{
f48459ab 158 // Returns the square of the distance between 1 pad
159 // labelled by its Channel numbers and a coordinate
cc4dcfb0 160 Float_t x,y;
161 GetPadC(iX,iY,x,y);
162 return (x-X)*(x-X) + (y-Y)*(y-Y);
163}
164//____________________________________________________________________________
165Float_t AliMUONSt345SlatSegmentation::Dpx(Int_t isec) const
166{
f48459ab 167 // Return x-strip width
168 return (*fDpxD)[isec];
cc4dcfb0 169}
170
171//____________________________________________________________________________
f48459ab 172Float_t AliMUONSt345SlatSegmentation::Dpy(Int_t isec) const
cc4dcfb0 173{
174 // Return y-strip width
f48459ab 175 return (*fDpyD)[isec];
cc4dcfb0 176}
177//_____________________________________________________________________________
178Float_t AliMUONSt345SlatSegmentation::GetAnod(Float_t xhit) const
179{
f48459ab 180 // Returns for a hit position xhit the position of the nearest anode wire
181 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
182 return fWireD*wire;
cc4dcfb0 183}
cc4dcfb0 184
cc4dcfb0 185
f48459ab 186
cc4dcfb0 187//--------------------------------------------------------------------------------
188void AliMUONSt345SlatSegmentation::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
189{
bd57045f 190 if (ix < 1 || ix > Npx() || iy < 1 || iy > Npy() ){
f7db2071 191 AliWarning(Form("ix %d or iy %d out of boundaries: Npx=%d and Npy=%d",ix, iy, Npx(), Npy()));
13b83a58 192 x = y= 0.;
bd57045f 193
194 } else {
195
cc4dcfb0 196 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
cc4dcfb0 197 // Find sector isec
198 Int_t isec = Sector(ix,iy);
76fa1113 199 if (isec == -1) AliWarning(Form("isector = %d with ix %d, iy %d", isec, ix, iy));
f48459ab 200 if (iy > fNpyS[isec]) {
13b83a58 201 x = y = 0.;
f48459ab 202 return;
203 }
cc4dcfb0 204 if (isec>0) {
205 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
206 x = x-(*fDpxD)[isec]/2;
f48459ab 207 y = Float_t(iy*(*fDpyD)[isec])-(*fDpyD)[isec]/2.- fCy; // !!!
cc4dcfb0 208 } else {
bd57045f 209 x = y = 0;
cc4dcfb0 210 }
211 }
212}
f48459ab 213
214
215//_____________________________________________________________________________
216void AliMUONSt345SlatSegmentation::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
217{
218// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
76fa1113 219
f48459ab 220 // Find sector isec
221 Int_t isec=-1;
222 for (Int_t i=fNsec-1; i > 0; i--) {
223 if (x >= fCx[i-1]) {
224 isec=i;
13b83a58 225 if (TMath::Abs(fCx[isec] - fCx[isec-1]) <0.1 && isec > 1) isec--;
f48459ab 226 break;
227 }
228 }
f7db2071 229 if (isec == -1) AliWarning(Form("isector equal to %d with xl %f, yl %f", isec, x, y));
f48459ab 230 if (isec>0) {
231 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
232 +fNpxS[isec-1]+1;
233 iy= Int_t((y+fCy)/(*fDpyD)[isec])+1;
234 } else if (isec == 0) {
235 ix= Int_t(x/(*fDpxD)[isec])+1;
236 iy= Int_t((y+fCy)/(*fDpyD)[isec])+1;
237 } else {
238 ix=0;
239 iy=0;
240 }
241}
cc4dcfb0 242//-------------------------------------------------------------------------
243void AliMUONSt345SlatSegmentation::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy)
244{
245 GetPadI(x, y, ix, iy);
246}
f1501d74 247
248//-------------------------------------------------------------------------
249void AliMUONSt345SlatSegmentation::GetPadE(Int_t &ix, Int_t &iy, AliMUONSegmentManuIndex* manuIndex)
250{
251 //
252 // return Padx and Pady
253 // input value: electronic connection number
254
255 Int_t icathode = (fBending == 1) ? 0 : 1; // cathode 0 == bending
256
257 // Int_t busPatchId = manuIndex->GetBusPatchId(); //
258 Int_t manuId = manuIndex->GetManuId();
259 Int_t manuChannelId = manuIndex->GetManuChannelId();
260 // Int_t channelId = manuIndex->GetChannelId();
261
262 AliMUONSegmentIndex* index = fSegmentationDetectionElement->GetIndex(manuId, manuChannelId);
263
264 ix = index->GetPadX();
265 iy = index->GetPadY();
266 swap(ix,iy); // swap cos origin in segmentation and mapping file are different for iy (temporary solution)
267
268 if (index->GetCathode() != icathode)
269 AliWarning("Wrong cathode number !");
270
271}
272
273//-------------------------------------------------------------------------
274 AliMUONSegmentManuIndex* AliMUONSt345SlatSegmentation::GetMpConnection(Int_t ix, Int_t iy)
275{
276 //
277 // return electronic connection number
278 // input value: Padx and Pady
279
280 Int_t icathode = (fBending == 1) ? 0 : 1; // cathode 0 == bending
281
282 return fSegmentationDetectionElement->GetManuIndex(ix, iy, icathode);
283
284}
285
cc4dcfb0 286//_______________________________________________________________
287void AliMUONSt345SlatSegmentation::SetPadDivision(Int_t ndiv[4])
288{
f48459ab 289 // Defines the pad size perp. to the anode wire (y) for different sectors.
290 // Pad sizes are defined as integral fractions ndiv of a basis pad size
291 // fDpx
292 //
293 for (Int_t i=0; i<4; i++) {
294 (*fNDiv)[i]=ndiv[i];
295 }
296 ndiv[0]=ndiv[1];
cc4dcfb0 297}
298//____________________________________________________________________________
299void AliMUONSt345SlatSegmentation::SetPadSize(Float_t p1, Float_t p2)
300{
f48459ab 301 // Sets the padsize
302 fDpx=p1;
303 fDpy=p2;
cc4dcfb0 304}
305//_______________________________________________________________
306void AliMUONSt345SlatSegmentation::SetPcbBoards(Int_t n[4])
307{
f48459ab 308 //
309 // Set PcbBoard segmentation zones for each density
f1501d74 310 // n[0] slat type parameter
311 // n[1] PcbBoards for highest density sector fNDiv[1] etc ...
312
313 fRtype = n[0];
314 n[0] = 0;
f48459ab 315 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
f1501d74 316
cc4dcfb0 317}
318//-------------------------------------------------------------------------
319void AliMUONSt345SlatSegmentation::SetPad(Int_t ix, Int_t iy)
320{
f48459ab 321 //
322 // Sets virtual pad coordinates, needed for evaluating pad response
323 // outside the tracking program
324 GetPadC(ix,iy,fX,fY);
325 fSector=Sector(ix,iy);
cc4dcfb0 326}
327//---------------------------------------------------------------------------
328void AliMUONSt345SlatSegmentation::SetHit(Float_t x, Float_t y)
329{
f48459ab 330 // Set current hit
331 //
332 fXhit = x;
333 fYhit = y;
cc4dcfb0 334
bd57045f 335 if (x < fCx[0]) fXhit = fCx[0];
336 if (y < -fDyPCB/2.) fYhit = -fDyPCB/2.;
cc4dcfb0 337
bd57045f 338 if (x > fCx[fNsec-1]) fXhit = fCx[fNsec-1];
339 if (y > fDyPCB/2.) fYhit = fDyPCB/2.;
cc4dcfb0 340
341}
342//----------------------------------------------------------------------------
343void AliMUONSt345SlatSegmentation::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
344{
345 SetHit(xhit, yhit);
346}
f48459ab 347
cc4dcfb0 348//----------------------------------------------------------
349void AliMUONSt345SlatSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
350{
351// Initialises iteration over pads for charge distribution algorithm
352//
353 //
354 // Find the wire position (center of charge distribution)
bd57045f 355 Float_t x0a = GetAnod(xhit);
356 fXhit = x0a;
357 fYhit = yhit;
cc4dcfb0 358 //
359 // and take fNsigma*sigma around this center
bd57045f 360 Float_t x01 = x0a - dx ;
361 Float_t x02 = x0a + dx;
362 Float_t y01 = yhit - dy;
363 Float_t y02 = yhit + dy;
cc4dcfb0 364
bd57045f 365 // check the limits after adding (fNsigma*sigma)
366 if (x01 < fCx[0]) x01 = fCx[0];
367 if (y01 < -fDyPCB/2) y01 = -fDyPCB/2;
368
369 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1]; // still ok ? (CF)
13b83a58 370 if (y02 >= fDyPCB/2.) y02 = fDyPCB/2.;
cc4dcfb0 371
372
373 Int_t isec=-1;
374 for (Int_t i=fNsec-1; i > 0; i--) {
bd57045f 375 if (x02 >= fCx[i-1]) {
376 isec=i;
13b83a58 377 if (TMath::Abs(fCx[isec] - fCx[isec-1]) < 0.1 && isec > 1) isec--;
bd57045f 378 break;
379 }
cc4dcfb0 380 }
bd57045f 381
13b83a58 382 // y02 += Dpy(isec);// why ? (CF)
cc4dcfb0 383
384 //
385 // find the pads over which the charge distributes
386 GetPadI(x01,y01,fIxmin,fIymin);
387 GetPadI(x02,y02,fIxmax,fIymax);
388
389 if (fIxmax > fNpx) fIxmax=fNpx;
390 if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];
f7db2071 391 if (fIxmin < 1) fIxmin = 1; // patch for the moment (Ch. Finck)
392 if (fIymin < 1) fIymin = 1;
cc4dcfb0 393
bd57045f 394 fXmin = x01;
395 fXmax = x02;
396 fYmin = y01;
397 fYmax = y02;
cc4dcfb0 398
399 //
400 // Set current pad to lower left corner
bd57045f 401 if (fIxmax < fIxmin) fIxmax = fIxmin;
402 if (fIymax < fIymin) fIymax = fIymin;
403 fIx = fIxmin;
404 fIy = fIymin;
cc4dcfb0 405
406 GetPadC(fIx,fIy,fX,fY);
bd57045f 407 fSector = Sector(fIx,fIy);
13b83a58 408
cc4dcfb0 409}
f48459ab 410
411
412
cc4dcfb0 413//----------------------------------------------------------------------
414void AliMUONSt345SlatSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, Float_t dx, Float_t dy)
415{
416 FirstPad(xhit, yhit, dx, dy);
417}
418//----------------------------------------------------------------------
419void AliMUONSt345SlatSegmentation::NextPad()
420{
f48459ab 421 // Stepper for the iteration over pads
422 //
423 // Step to next pad in the integration region
424 // step from left to right
425 if (fIx != fIxmax) {
426 fIx++;
427 GetPadC(fIx,fIy,fX,fY);
428 fSector=Sector(fIx,fIy);
429 // step up
430 } else if (fIy != fIymax) {
431 fIx=fIxmin;
432 fIy++;
433 GetPadC(fIx,fIy,fX,fY);
434 fSector=Sector(fIx,fIy);
f48459ab 435 } else {
f7db2071 436 fIx=-999;
437 fIy=-999;
f48459ab 438 }
cc4dcfb0 439}
440//-------------------------------------------------------------------------
441Int_t AliMUONSt345SlatSegmentation::MorePads()
442{
f48459ab 443 // Stopping condition for the iterator over pads
444 //
445 // Are there more pads in the integration region
cc4dcfb0 446
f7db2071 447 return (fIx != -999 || fIy != -999);
cc4dcfb0 448}
449//--------------------------------------------------------------------------
450Int_t AliMUONSt345SlatSegmentation::Sector(Int_t ix, Int_t iy)
451{
f48459ab 452 //
453 // Determine segmentation zone from pad coordinates
454 //
bd57045f 455 Int_t isec = -1;
456 for (Int_t i = 0; i < fNsec; i++) {
f48459ab 457 if (ix <= fNpxS[i]) {
bd57045f 458 isec = i;
f48459ab 459 break;
cc4dcfb0 460 }
f48459ab 461 }
bd57045f 462 if (isec == -1) AliWarning(Form("Sector = %d with ix %d and iy %d, Npx %d",
463 isec, ix, iy, fNpx));
cc4dcfb0 464
f48459ab 465 return isec;
cc4dcfb0 466
467}
468//-----------------------------------------------------------------------------
469void AliMUONSt345SlatSegmentation::
470IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
471{
f48459ab 472 // Returns integration limits for current pad
473 //
474 x1=fXhit-fX-Dpx(fSector)/2.;
475 x2=x1+Dpx(fSector);
476 y1=fYhit-fY-Dpy(fSector)/2.;
477 y2=y1+Dpy(fSector);
76fa1113 478 // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
cc4dcfb0 479
480}
481//-----------------------------------------------------------------------------
482void AliMUONSt345SlatSegmentation::
483Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
484{
f48459ab 485 // Returns list of next neighbours for given Pad (iX, iY)
486 Int_t i=0;
487 // step right
488 if (iX+1 <= fNpx) {
489 Xlist[i]=iX+1;
490 Ylist[i++]=iY;
491 }
492 // step left
493 if (iX-1 > 0) {
494 Xlist[i]=iX-1;
495 Ylist[i++]=iY;
496 }
497 Int_t sector = Sector(iX,iY);
498 // step up
499 if (iY+1 <= fNpyS[sector]) {
500 Xlist[i]=iX;
501 Ylist[i++]=iY+1;
502 }
503 // step down
504 if (iY-1 > 0) {
505 Xlist[i]=iX;
506 Ylist[i++]=iY-1;
507 }
508 *Nlist=i;
cc4dcfb0 509}
f48459ab 510
cc4dcfb0 511//--------------------------------------------------------------------------
512void AliMUONSt345SlatSegmentation::Init(Int_t detectionElementId)
513{
f48459ab 514 //
515 // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
516 // These arrays help in converting from real to pad co-ordinates and
517 // vice versa
518 //
519 // Segmentation is defined by rectangular modules approximating
520 // concentric circles as shown below
521 //
522 // PCB module size in cm
523 // printf("\n Initialise Segmentation SlatModule \n");
cc4dcfb0 524
f48459ab 525
a713db22 526 // printf(" fBending: %d \n",fBending);
f48459ab 527
f1501d74 528 if (fInitDone) return; // security if init is already done in AliMUONFactory
f48459ab 529 fDxPCB=40;
530 fDyPCB=40;
531
532 // Calculate padsize along x
533 (*fDpxD)[fNsec-1]=fDpx;
534 (*fDpyD)[fNsec-1]=fDpy;
535 if (fNsec > 1) {
536 for (Int_t i=fNsec-1; i>=0; i--){ // fNsec-2
537 if (!fBending) {
538 (*fDpxD)[i]=fDpx;
539 (*fDpyD)[i]=(*fDpyD)[fNsec-1]/(*fNDiv)[i];
540 } else {
cc4dcfb0 541 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
f48459ab 542 (*fDpyD)[i]=fDpy;
cc4dcfb0 543 }
544 }
f48459ab 545 }
546 //
547 // fill the arrays defining the pad segmentation boundaries
548 //
549 //
550 // Loop over sectors (isec=0 for secto close to the beam pipe)
551 Float_t totalLength = 0;
552 for (Int_t isec=0; isec<4; isec++) totalLength += fPcbBoards[isec]*fDxPCB; // !!!!
553
554 fNpy = 0; // maximum number of pads in y
555 for (Int_t isec=0; isec<4; isec++) {
556 if (isec==0) {
557 fNpxS[0] = 0;
558 fNpyS[0] = 0;
559 fCx[0] = -totalLength/2;
560 } else {
13b83a58 561 fNpxS[isec] = fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]+0.5);
562 fNpyS[isec] = Int_t(fDyPCB/(*fDpyD)[isec]+0.5);
f48459ab 563 if (fNpyS[isec] >= fNpy) fNpy = fNpyS[isec];
564 fCx[isec]= fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
565 }
566 } // sectors
cc4dcfb0 567
f48459ab 568 fNpx = fNpxS[3]; // maximum number of pads in x
569 fCy = fDyPCB/2.;
570 //
571 fId = detectionElementId;
f1501d74 572
573 //
574 // initalize mapping
575 //
576// Int_t icathode = (fBending == 1) ? 0 : 1; // cathode 0 == bending
577// Char_t name[15];
578// GetMpFileName(name);
579// fSegmentationDetectionElement = new AliMUONSegmentationDetectionElement();
580// fSegmentationDetectionElement->Init(name, icathode);
581 fInitDone = kTRUE;
f48459ab 582}
cc4dcfb0 583
f1501d74 584//--------------------------------------------------------------------------
585void AliMUONSt345SlatSegmentation::GetMpFileName(Char_t* name) const
586{
587 //
588 // Get mapping file name
589 //
cc4dcfb0 590
f1501d74 591 strcpy(name,"slat");
592
593 for (Int_t isec = 1; isec < 4; isec++) {
594
595 switch(isec) {
596 case 1:
597 for (Int_t i = 0; i < fPcbBoards[isec]; i++)
598 strcat(name,"1");
599 break;
600 case 2 :
601 for (Int_t i = 0; i < fPcbBoards[isec]; i++)
602 strcat(name,"2");
603 break;
604 case 3:
605 for (Int_t i = 0; i < fPcbBoards[isec]; i++)
606 strcat(name,"3");
607 break;
608 }
609 }
610
611 while (strlen(name) < 10)
612 strcat(name,"0");
613
614 switch(fRtype) {
615 case 0:
616 strcat(name, "N");
617 break;
618 case 1:
619 strcat(name, "NR1");
620 break;
621 case 2:
622 strcat(name, "NR2");
623 break;
624 case 3:
625 strcat(name, "NR3");
626 break;
627 case 4:
628 strcat(name, "S");
629 break;
630 case -1:
631 strcat(name, "SR1");
632 break;
633 case -2:
634 strcat(name, "SR2");
635 break;
636 case -3:
637 strcat(name, "SR3"); // should not exist
638 AliFatal("SR3 Slat type does not exist !!");
639 break;
640 }
641}
cc4dcfb0 642
f1501d74 643//--------------------------------------------------------------------------
644void AliMUONSt345SlatSegmentation::Swap(Int_t padX, Int_t &padY)
645{
cc4dcfb0 646
f1501d74 647 // swap the numbering between segmentation (i.e. pady = [0,40])
648 // and mapping file (i.e. pady = [-20,20])
cc4dcfb0 649
650
f1501d74 651 if (fBending == 1) {
652 if (padY < 0)
653 padY += fNpy + 1;
654 else
655 padY += fNpy;
656 }
cc4dcfb0 657
658
f1501d74 659 if (fBending == 0) {
660 if (padY < 0)
661 padY += fNpyS[Sector(padX, padY)] + 1;
662 else
663 padY += fNpyS[Sector(padX, padY)];
664 }
cc4dcfb0 665
f1501d74 666}
cc4dcfb0 667
668