]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerSegmentationV2.cxx
hardcoded detector position; bug in alignment pth fixed
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerSegmentationV2.cxx
CommitLineData
9ff9fab7 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
bdb9f2a3 18// -------------------------------------
19// Class AliMUONTriggerSegmentation
20// -------------------------------------
21// Segmentation for MUON trigger stations using
22// the mapping package
23
9ff9fab7 24#include "AliMUONTriggerSegmentationV2.h"
25
9ff9fab7 26#include "AliMpPCB.h"
27#include "AliMpTrigger.h"
28#include "AliMpTriggerSegmentation.h"
29#include "AliMpSlat.h"
30
8fbf5237 31#include "AliLog.h"
9ff9fab7 32
33#include "Riostream.h"
34#include "TClass.h"
35#include "TString.h"
36
5398f946 37/// \cond CLASSIMP
9ff9fab7 38ClassImp(AliMUONTriggerSegmentationV2)
5398f946 39/// \endcond
9ff9fab7 40
41namespace
42{
43// Int_t SPECIAL_SECTOR = 8;
44 Int_t fgIntOffset(1);
45 Float_t FMAX(1E9);
46 Int_t CODEMAKER(1000);
47
48 Int_t Code(Int_t ixLA, Int_t iyLA)
49 {
50 return iyLA*CODEMAKER + ixLA;
51 }
52
53 void Decode(Int_t code, Int_t& ixLA, Int_t& iyLA)
54 {
55 iyLA = code/CODEMAKER;
56 ixLA = code - iyLA*CODEMAKER;
57 }
58}
59
60//_____________________________________________________________________________
61AliMUONTriggerSegmentationV2::AliMUONTriggerSegmentationV2()
62: AliMUONVGeometryDESegmentation(),
da3d7180 63 fDetElemId(-1),
64 fPlaneType(kNonBendingPlane),
65 fSlat(0),
66 fSlatSegmentation(0),
67 fCurrentPad(),
68 fXhit(FMAX),
69 fYhit(FMAX),
70 fLineNumber(-1)
9ff9fab7 71{
5398f946 72/// Default ctor (empty).
73
9ff9fab7 74 AliDebug(1,Form("this=%p default (empty) ctor",this));
75}
76
77//_____________________________________________________________________________
8fbf5237 78AliMUONTriggerSegmentationV2::AliMUONTriggerSegmentationV2(
79 AliMpVSegmentation* segmentation,
80 Int_t detElemId, AliMpPlaneType bendingOrNonBending)
da3d7180 81 : AliMUONVGeometryDESegmentation(),
82 fDetElemId(detElemId),
83 fPlaneType(bendingOrNonBending),
84 fSlat(0),
85 fSlatSegmentation(0),
86 fCurrentPad(),
87 fXhit(FMAX),
88 fYhit(FMAX),
89 fLineNumber(-1)
9ff9fab7 90{
5398f946 91/// Normal ctor.
8fbf5237 92
93 fSlatSegmentation = dynamic_cast<AliMpTriggerSegmentation*>(segmentation);
94 if (fSlatSegmentation)
95 fSlat = fSlatSegmentation->Slat();
96 else
97 AliFatal("Wrong mapping segmentation type");
98
dda778c2 99 TString id(fSlat->GetID());
100 Ssiz_t pos = id.Last('L');
101 if ( pos <= 0 )
102 {
103 AliFatal(Form("Cannot infer line number for slat %s",id.Data()));
104 }
105 fLineNumber = TString(id(pos+1),1).Atoi();
9ff9fab7 106
107 AliDebug(1,Form("this=%p detElemId=%3d %s fSlatSegmentation=%p",this,detElemId,
108 ( (bendingOrNonBending==kBendingPlane)?"Bending":"NonBending" ),
109 fSlatSegmentation));
110}
111
9ff9fab7 112//_____________________________________________________________________________
113AliMUONTriggerSegmentationV2::~AliMUONTriggerSegmentationV2()
114{
5398f946 115/// Destructor
9ff9fab7 116
5398f946 117 AliDebug(1,Form("this=%p",this));
9ff9fab7 118}
119
120//_____________________________________________________________________________
121TF1*
122AliMUONTriggerSegmentationV2::CorrFunc(Int_t) const
123{
5398f946 124/// Not implemented
bdb9f2a3 125
9ff9fab7 126 AliFatal("Not implemented");
127 return 0x0;
128}
129
130//_____________________________________________________________________________
131Float_t
132AliMUONTriggerSegmentationV2::Distance2AndOffset(Int_t, Int_t,
133 Float_t, Float_t, Int_t*)
134{
5398f946 135/// Not implemented
bdb9f2a3 136
9ff9fab7 137 AliFatal("Not implemented");
138 return 0;
139}
140
141//_____________________________________________________________________________
142void
143AliMUONTriggerSegmentationV2::Draw(Option_t*)
144{
5398f946 145/// Not implemented
bdb9f2a3 146
9ff9fab7 147 AliFatal("Not Implemented");
148}
149
150//_____________________________________________________________________________
151Float_t
152AliMUONTriggerSegmentationV2::Dpx() const
153{
5398f946 154/// Not implemented
bdb9f2a3 155
9ff9fab7 156 AliFatal("Not Implemented");
157 return 0.0;
158}
159
160//_____________________________________________________________________________
161Float_t
162AliMUONTriggerSegmentationV2::Dpy() const
163{
5398f946 164/// Not implemented
bdb9f2a3 165
9ff9fab7 166 AliFatal("Not Implemented");
167 return 0.0;
168}
169
170//_____________________________________________________________________________
171Float_t
13985652 172AliMUONTriggerSegmentationV2::Dpx(Int_t sectorCode) const
9ff9fab7 173{
5398f946 174/// Get pad size in x
bdb9f2a3 175
176 Int_t ixLA, iyLA;
9ff9fab7 177 Decode(sectorCode,ixLA,iyLA);
178 AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kFALSE);
179 if ( !pad.IsValid() ) return 0.0;
180 return pad.Dimensions().X()*2.0;
181}
182
183//_____________________________________________________________________________
184Float_t
13985652 185AliMUONTriggerSegmentationV2::Dpy(Int_t sectorCode) const
9ff9fab7 186{
5398f946 187/// Get pad size in y
bdb9f2a3 188
9ff9fab7 189 Int_t ixLA, iyLA;
190 Decode(sectorCode,ixLA,iyLA);
191 AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kFALSE);
192 if ( !pad.IsValid() ) return 0.0;
193 return pad.Dimensions().Y()*2.0;
194}
195
196//_____________________________________________________________________________
197void
bdb9f2a3 198AliMUONTriggerSegmentationV2::FirstPad(Float_t /*xhit*/, Float_t /*yhit*/, Float_t /*zhit*/,
199 Float_t /*dx*/, Float_t /*dy*/)
9ff9fab7 200{
5398f946 201/// Not implemented
bdb9f2a3 202
9ff9fab7 203 AliFatal("Not implemented");
204}
205
206//_____________________________________________________________________________
207Float_t
208AliMUONTriggerSegmentationV2::GetAnod(Float_t) const
209{
5398f946 210/// Not implemented
bdb9f2a3 211
9ff9fab7 212 AliFatal("Not implemented");
213 return 0.0;
214}
215
216//_____________________________________________________________________________
217AliMUONGeometryDirection
218AliMUONTriggerSegmentationV2::GetDirection()
219{
5398f946 220/// Not implemented
bdb9f2a3 221
9ff9fab7 222 //AliWarning("Not Implemented");
223 return kDirUndefined;
224}
225
b7ef3c96 226//______________________________________________________________________________
227const AliMpVSegmentation*
228AliMUONTriggerSegmentationV2::GetMpSegmentation() const
229{
5398f946 230/// Returns the mapping segmentation
231/// (provides access to electronics info)
b7ef3c96 232
233 return fSlatSegmentation;
234}
235
9ff9fab7 236//_____________________________________________________________________________
237void
238AliMUONTriggerSegmentationV2::GetNParallelAndOffset(Int_t,Int_t,Int_t*,Int_t*)
239{
5398f946 240/// Not implemented
bdb9f2a3 241
9ff9fab7 242 AliFatal("Not Implemented");
243}
244
245//_____________________________________________________________________________
246void
247AliMUONTriggerSegmentationV2::GetPadC(Int_t ix, Int_t iy,
248 Float_t& x, Float_t& y, Float_t& z)
249{
5398f946 250/// Transform from pad to real coordinates
bdb9f2a3 251
9ff9fab7 252 z = 0;
253 GetPadC(ix,iy,x,y);
254}
255
256//_____________________________________________________________________________
257void
258AliMUONTriggerSegmentationV2::GetPadC(Int_t ixGlo, Int_t iyGlo,
259 Float_t& x, Float_t& y)
260{
5398f946 261/// Transform from pad to real coordinates
bdb9f2a3 262
9ff9fab7 263 Int_t ixLA,iyLA;
264 IGlo2ILoc(ixGlo,iyGlo,ixLA,iyLA);
265 AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kTRUE);
266 x = pad.Position().X();
267 y = pad.Position().Y();
268}
269
270//_____________________________________________________________________________
271void
272AliMUONTriggerSegmentationV2::GetPadI(Float_t x, Float_t y, Float_t,
273 Int_t& ix, Int_t& iy)
274{
5398f946 275/// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
bdb9f2a3 276
9ff9fab7 277 GetPadI(x,y,ix,iy);
278}
279
280//_____________________________________________________________________________
281void
282AliMUONTriggerSegmentationV2::GetPadI(Float_t x, Float_t y,
283 Int_t& ixGlo, Int_t& iyGlo)
284{
5398f946 285/// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
bdb9f2a3 286
9ff9fab7 287 AliDebug(2,Form("%s x=%e y=%e ixGlo,iyGlo=%d,%d\n",
288 fSlatSegmentation->GetName(),
289 x,y,ixGlo,iyGlo));
290
9ff9fab7 291 AliMpPad pad =
c608ca37 292 fSlatSegmentation->PadByPosition(TVector2(x,y), kTRUE);
9ff9fab7 293
294 if ( pad != AliMpPad::Invalid() )
295 {
296 Int_t ix = pad.GetIndices().GetFirst();
297 Int_t iy = pad.GetIndices().GetSecond();
298 ILoc2IGlo(ix,iy,ixGlo,iyGlo);
299 }
300 else
301 {
302 ixGlo=iyGlo=-1;
303 }
304 AliDebug(2,Form("ixGlo,iyGlo=%d,%d\n",ixGlo,iyGlo));
305}
306
307//_____________________________________________________________________________
308void
309AliMUONTriggerSegmentationV2::GetPadLoc2Glo(Int_t ix, Int_t iy,
310 Int_t& ixGlo, Int_t& iyGlo) const
311{
5398f946 312/// Converts from local (in PC convention) to (ix,iy) to global (ix,iy)
9ff9fab7 313
314 ixGlo=iyGlo=-1; // starts with invalid values
315
316 if ( fPlaneType == kBendingPlane )
317 {
318 ixGlo = 10*LineNumber() + ix;
319 iyGlo = iy - fgIntOffset;
320 }
321 else if ( fPlaneType == kNonBendingPlane )
322 {
323 Int_t i = fSlat->GetLayer(0)->FindPCBIndex(ix-fgIntOffset);
324 if (i<0)
325 {
326 AliError(Form("Invalid local (ix=%d,iy=%d) ?",ix,iy));
327 return ;
328 }
329 AliMpPCB* pcb = fSlat->GetLayer(0)->FindPCB(ix-fgIntOffset);
330 iyGlo = ix - pcb->Ixmin() - fgIntOffset;
331 if ( LineNumber() == 5 ) ++i;
332 ixGlo = 10*LineNumber() + i + fgIntOffset;
333 }
334}
335
336//_____________________________________________________________________________
337void
338AliMUONTriggerSegmentationV2::GetPadGlo2Loc(Int_t ixGlo, Int_t iyGlo,
339 Int_t& ix, Int_t& iy) const
340{
5398f946 341/// Converts from global (ix,iy) to local (ix,iy) (in PC convention)
9ff9fab7 342
343 ix=iy=-1; // starts with invalid values
344
345 if ( abs(ixGlo) == 51 ) return;
346
347 Int_t column = ModuleColNum(ixGlo);
348
349 if ( fPlaneType == kBendingPlane )
350 {
351 ix = column + fgIntOffset;
352 iy = iyGlo + fgIntOffset;
353 }
354 else if ( fPlaneType == kNonBendingPlane )
355 {
356 if ( LineNumber()==5 ) --column;
357 AliMpPCB* pcb = fSlat->GetLayer(0)->GetPCB(column);
358 if (!pcb)
359 {
360 AliError(Form("Invalid global (ix=%d,iy=%d)",ixGlo,iyGlo));
361 return;
362 }
363 ix = pcb->Ixmin() + iyGlo + fgIntOffset;
364 iy = fgIntOffset;
365 }
366}
367
368//_____________________________________________________________________________
369void
84aac932 370AliMUONTriggerSegmentationV2::GiveTestPoints(Int_t& /*n*/,
371 Float_t* /*x*/, Float_t*/*y*/) const
9ff9fab7 372{
bdb9f2a3 373// Not implemented
374
9ff9fab7 375 AliFatal("Not Implemented");
376}
377
378//_____________________________________________________________________________
379Bool_t
bdb9f2a3 380AliMUONTriggerSegmentationV2::HasPad(Float_t x, Float_t y, Float_t /*z*/)
9ff9fab7 381{
5398f946 382/// Returns true if a pad exists in the given position
383///
384/// Well, 2 implementations are possible here
385/// Either reuse HasPad(int,int), or get it from scratch using
386/// underlying fSlatSegmentation.
387/// Took second option, but w/o checking whether this is the faster.
388/// The second option is commented out below, for the record.
9ff9fab7 389
390// Int_t ix, iy;
391// GetPadI(x,y,z,ix,iy);
392// Int_t ixLA, iyLA;
393// IGlo2ILoc(ix,iy,ixLA,iyLA);
394// Int_t ixPC, iyPC;
395// LA2PC(ixLA,iyLA,ixPC,iyPC);
396// Bool_t ok1 = HasPad(ixPC,iyPC);
397
398 AliMpPad pad =
c608ca37 399 fSlatSegmentation->PadByPosition(TVector2(x,y),kFALSE);
9ff9fab7 400 return pad.IsValid();
401}
402
403//_____________________________________________________________________________
404Bool_t
405AliMUONTriggerSegmentationV2::HasPad(Int_t ixGlo, Int_t iyGlo)
406{
5398f946 407/// Returns true if a pad with given indices exists
bdb9f2a3 408
9ff9fab7 409 Int_t ixLA, iyLA;
410 IGlo2ILoc(ixGlo,iyGlo,ixLA,iyLA);
411 return fSlatSegmentation->HasPad(AliMpIntPair(ixLA,iyLA));
412}
413
414//_____________________________________________________________________________
415void
416AliMUONTriggerSegmentationV2::IGlo2ILoc(Int_t ixGlo, Int_t iyGlo,
6c92c893 417 Int_t& ixLA, Int_t& iyLA) const
9ff9fab7 418{
5398f946 419/// \todo FIXME: add comment
bdb9f2a3 420
9ff9fab7 421 Int_t ixPC, iyPC;
422 GetPadGlo2Loc(ixGlo,iyGlo,ixPC,iyPC);
423 PC2LA(ixPC,iyPC,ixLA,iyLA);
424}
425
426//_____________________________________________________________________________
427void
428AliMUONTriggerSegmentationV2::ILoc2IGlo(Int_t ixLA, Int_t iyLA,
6c92c893 429 Int_t& ixGlo, Int_t& iyGlo) const
9ff9fab7 430{
5398f946 431/// \todo FIXME: add comment
bdb9f2a3 432
9ff9fab7 433 Int_t ixPC, iyPC;
434 LA2PC(ixLA,iyLA,ixPC,iyPC);
435 GetPadLoc2Glo(ixPC,iyPC,ixGlo,iyGlo);
436}
437
9ff9fab7 438//_____________________________________________________________________________
439Int_t
440AliMUONTriggerSegmentationV2::ISector()
441{
5398f946 442/// \todo FIXME: remove the usage of ISector from all the code.
443
9ff9fab7 444 return -10;
445}
446
447//_____________________________________________________________________________
448void AliMUONTriggerSegmentationV2::IntegrationLimits(Float_t& x1,
449 Float_t& x2,
450 Float_t& x3,
451 Float_t& x4)
452{
5398f946 453/// \param x1 : hit x(y) position
454/// \param x2 : x(y) coordinate of the main strip
455/// \param x3 : current strip real x(y) coordinate
456/// \param x4 : dist. between x(y) hit pos. and the closest border of the current strip
457///
458/// Note : need to return (only) x4.
9ff9fab7 459
460 AliFatal("Check me before usage. ResponseTrigger does not use me, while"
461 "ResponseTriggerV1 does ?");
462
463 AliMpPad strip =
464 fSlatSegmentation->PadByPosition(TVector2(fXhit,fYhit),kFALSE);
465 if ( !strip.IsValid() )
466 {
467 AliWarning(Form("%s got invalid fXhit,fYhit=%e,%e\n",
468 fSlatSegmentation->GetName(),fXhit,fYhit));
469 x1=x2=x3=x4=0;
470 }
471 else
472 {
473 Double_t xstrip = strip.Position().X();
474 Double_t ystrip = strip.Position().Y();
475 AliDebug(1,Form("fXhit,Yhit=%e,%e xstrip,ystrip=%e,%e\n",
476 fXhit,fYhit,xstrip,ystrip));
477 x1 = (fPlaneType==kBendingPlane) ? fYhit : fXhit;
478 x2 = (fPlaneType==kBendingPlane) ? ystrip : xstrip;
479 x3 = (fPlaneType==kBendingPlane) ?
480 fCurrentPad.Position().Y() : fCurrentPad.Position().X();
481 Double_t xmin = 0.0;
482 Double_t xmax = 0.0;
483 if (fPlaneType==kBendingPlane)
484 {
485 xmin = x3 - fCurrentPad.Dimensions().X();
486 xmax = x3 + fCurrentPad.Dimensions().X();
487 }
488 else
489 {
490 xmin = x3 - fCurrentPad.Dimensions().Y();
491 xmax = x3 + fCurrentPad.Dimensions().Y();
492 }
493 // dist. between the hit and the closest border of the current strip
494 x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ?
495 TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);
496
497 AliDebug(1,Form("Bending %d x1=%e x2=%e x3=%e x4=%e xmin,max=%e,%e\n",
498 fPlaneType,x1,x2,x3,x4,xmin,xmax));
499
500 }
501}
502
503//_____________________________________________________________________________
504Int_t
505AliMUONTriggerSegmentationV2::Ix()
506{
5398f946 507/// Current pad cursor during disintegration
508/// x, y-coordinate
bdb9f2a3 509
9ff9fab7 510 if ( fCurrentPad.IsValid() )
511 {
512 Int_t ixGlo,iyGlo;
513 ILoc2IGlo(fCurrentPad.GetIndices().GetFirst(),
514 fCurrentPad.GetIndices().GetSecond(),ixGlo,iyGlo);
515 return ixGlo;
516 }
517 return -1;
518}
519
520//_____________________________________________________________________________
521Int_t
522AliMUONTriggerSegmentationV2::Iy()
523{
5398f946 524/// Current pad cursor during disintegration
525/// x, y-coordinate
bdb9f2a3 526
9ff9fab7 527 if ( fCurrentPad.IsValid() )
528 {
529 Int_t ixGlo,iyGlo;
530 ILoc2IGlo(fCurrentPad.GetIndices().GetFirst(),
531 fCurrentPad.GetIndices().GetSecond(),ixGlo,iyGlo);
532 return iyGlo;
533 }
534 return -1;
535}
536
537
538//_____________________________________________________________________________
539void
540AliMUONTriggerSegmentationV2::LA2PC(Int_t ixLA, Int_t iyLA,
6c92c893 541 Int_t& ixPC, Int_t& iyPC) const
9ff9fab7 542{
5398f946 543/// From LA to PC conventions for integers indices.
544
9ff9fab7 545 ixPC=iyPC=-1;
546
547 if ( ixLA<0 || iyLA<0 ) return;
548
549 ixPC = ixLA + 1;
550 iyPC = iyLA + 1;
551
552 if ( fPlaneType == kBendingPlane )
553 {
554 if ( LineNumber()==5 )
555 {
556 ++ixPC;
557 }
558 if ( LineNumber()==4 && ixLA==0 )
559 {
560 iyPC -= 16;
561 }
562 }
563
564 AliDebug(3,Form("ix,iy LA (%d,%d) -> PC (%d,%d)",ixLA,iyLA,ixPC,iyPC));
565
566}
567
568//_____________________________________________________________________________
569Int_t
570AliMUONTriggerSegmentationV2::LineNumber() const
571{
5398f946 572/// \todo FIXME: add comment
bdb9f2a3 573
574 return 10-fLineNumber;
9ff9fab7 575}
576
577//_____________________________________________________________________________
578Int_t
579AliMUONTriggerSegmentationV2::ModuleColNum(Int_t ixGlo) const
580{
5398f946 581/// returns column number (from 0 to 6) in which the (global) module
582/// ix is sitting (could return 7 if ix=isec)
583
9ff9fab7 584 return TMath::Abs(ixGlo)-Int_t(TMath::Abs(ixGlo)/10)*10-1;
585}
586
587//_____________________________________________________________________________
588Int_t
589AliMUONTriggerSegmentationV2::MorePads()
590{
5398f946 591/// Not implemented
bdb9f2a3 592
9ff9fab7 593 AliFatal("Not implemented");
594 return 0;
595}
596
597//_____________________________________________________________________________
598void AliMUONTriggerSegmentationV2::Neighbours(Int_t /*iX*/, Int_t /*iY*/,
599 Int_t* /*Nlist*/,
600 Int_t /*Xlist*/[10],
601 Int_t /*Ylist*/[10])
602{
5398f946 603/// Not implemented
604
9ff9fab7 605 //-----------------BENDING-----------------------------------------
606 // Returns list of 10 next neighbours for given X strip (ix, iy)
607 // neighbour number 4 in the list -
608 // neighbour number 3 in the list |
609 // neighbour number 2 in the list |_ Upper part
610 // neighbour number 1 in the list |
611 // neighbour number 0 in the list -
612 // X strip (ix, iy)
613 // neighbour number 5 in the list -
614 // neighbour number 6 in the list | _ Lower part
615 // neighbour number 7 in the list |
616 // neighbour number 8 in the list |
617 // neighbour number 9 in the list -
618
619 //-----------------NON-BENDING-------------------------------------
620 // Returns list of 10 next neighbours for given Y strip (ix, iy)
621 // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
622 // \_______/ \_______/
623 // left right
624 AliFatal("Please implement me");
625}
626
627//_____________________________________________________________________________
628void
629AliMUONTriggerSegmentationV2::NextPad()
630{
5398f946 631/// Not implemented
bdb9f2a3 632
9ff9fab7 633 AliFatal("Not implemented");
634}
635
636//_____________________________________________________________________________
637Int_t
638AliMUONTriggerSegmentationV2::Npx() const
639{
5398f946 640/// Maximum number of Pads in x
641/// hard coded for the time being
bdb9f2a3 642
9ff9fab7 643 return 124;// FIXME: this should not have to be done, if only we'd stick
644 // to a local (ix,iy) convention !!!
645 // return fSlatSegmentation->MaxPadIndexX()+1;
646}
647
648//_____________________________________________________________________________
649Int_t
650AliMUONTriggerSegmentationV2::Npy() const
651{
5398f946 652/// Maximum number of Pads in y
653/// hard coded for the time being
bdb9f2a3 654
9ff9fab7 655 return 64;
656// return fSlatSegmentation->MaxPadIndexY()+1;
657}
658
659//_____________________________________________________________________________
660void
661AliMUONTriggerSegmentationV2::PC2LA(Int_t ixPC, Int_t iyPC,
6c92c893 662 Int_t& ixLA, Int_t& iyLA) const
9ff9fab7 663{
5398f946 664/// From PC to LA conventions for integers indices.
665
9ff9fab7 666 ixLA=iyLA=-1;
667
668 if ( ixPC<0 || iyPC<0 ) return;
669
670 ixLA = ixPC - 1;
671 iyLA = iyPC - 1;
672
673 if ( fPlaneType == kBendingPlane )
674 {
675 if ( LineNumber()==5 )
676 {
677 --ixLA;
678 }
679 if ( LineNumber()==4 && ixLA==0 )
680 {
681 iyLA += 16;
682 }
683 }
684
685 AliDebug(3,Form("ix,iy PC (%d,%d) -> LA (%d,%d)",ixPC,iyPC,ixLA,iyLA));
686}
687
688//_____________________________________________________________________________
689void
690AliMUONTriggerSegmentationV2::Print(Option_t* opt) const
691{
5398f946 692/// Printing
bdb9f2a3 693
9ff9fab7 694 TString sopt(opt);
695
696 cout << "DetElemId=" << fDetElemId << " PlaneType="
697 << fPlaneType << " Npx=" << Npx() << " Npy=" << Npy() << endl;
698 if ( ( sopt.Contains("SEG") || sopt.Contains("ALL") ) && fSlatSegmentation )
699 {
700 fSlatSegmentation->Print();
701 }
702 if ( sopt.Contains("ALL") && fSlat )
703 {
704 fSlat->Print();
705 }
706}
707
9ff9fab7 708//_____________________________________________________________________________
709Int_t
710AliMUONTriggerSegmentationV2::Sector(Int_t ix, Int_t iy)
711{
5398f946 712/// Calculate sector from pad coordinates
bdb9f2a3 713
9ff9fab7 714 Int_t ixLA, iyLA;
715 IGlo2ILoc(ix,iy,ixLA,iyLA);
716 AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kFALSE);
717 if ( !pad.IsValid() ) return -1;
718 return Code(ixLA,iyLA);
719
720// AliMpPCB* pcb = fSlat->GetLayer(0)->FindPCB(ixLA);
721// if (!pcb)
722// {
723// AliError(Form("Could not find a pcb at (%d,%d) for slat %s",
724// ix,iy,fSlat->GetName()));
725// return -1;
726// }
727// if ( pcb->PadSizeX()==-1.0 )
728// {
729// // special case of column 7 non-bending.
730// return SPECIAL_SECTOR;
731// }
732// return fSlat->GetLayer(0)->FindPCBIndex(ixLA);
733}
734
735//_____________________________________________________________________________
736Int_t
737AliMUONTriggerSegmentationV2::Sector(Float_t, Float_t)
738{
5398f946 739/// Not implemented
bdb9f2a3 740
9ff9fab7 741 AliFatal("Not implemented");
742 return 0;
743}
744
745//_____________________________________________________________________________
746void
747AliMUONTriggerSegmentationV2::SetCorrFunc(Int_t,TF1*)
748{
5398f946 749/// Not implemented
bdb9f2a3 750
9ff9fab7 751 AliFatal("Not Implemented");
752}
753
754//_____________________________________________________________________________
755void
13985652 756AliMUONTriggerSegmentationV2::SetDAnod(Float_t)
9ff9fab7 757{
5398f946 758/// Not implemented
bdb9f2a3 759
9ff9fab7 760 AliFatal("Not Implemented");
761}
762
763//_____________________________________________________________________________
764void
765AliMUONTriggerSegmentationV2::SetHit(Float_t x, Float_t y)
766{
5398f946 767/// Set hit position
768/// Sets virtual hit position, needed for evaluating pad response
769/// outside the tracking program
bdb9f2a3 770
9ff9fab7 771 fXhit = x;
772 fYhit = y;
773
774 //
775 // insure we're within the slat limits. If not, issue an error and sets
776 // the current hit to slat center.
777 // FIXME: this should probably a) not happen at all b) be a fatal error
778 //
779 if ( fXhit < -fSlat->DX() || fXhit > fSlat->DX() ||
780 fYhit < -fSlat->DY() || fYhit > fSlat->DY() )
781 {
782 AliError(Form("Hit outside slat %s limits (x,y)hit = (%e,%e)."
783 " Forcing to (0,0)",fSlat->GetID(),fXhit,fYhit));
784 fXhit = 0.0;
785 fYhit = 0.0;
786 }
787
788}
789
790//_____________________________________________________________________________
791void
792AliMUONTriggerSegmentationV2::SetHit(Float_t x, Float_t y, Float_t)
793{
5398f946 794/// Set hit position
795/// Sets virtual hit position, needed for evaluating pad response
796/// outside the tracking program
bdb9f2a3 797
9ff9fab7 798 SetHit(x,y);
799}
800
801//_____________________________________________________________________________
802void
803AliMUONTriggerSegmentationV2::SetPad(Int_t ix, Int_t iy)
804{
5398f946 805/// Set pad position.
806/// Sets virtual pad coordinates, needed for evaluating pad response
807/// outside the tracking program.
bdb9f2a3 808
9ff9fab7 809 Int_t ixLA, iyLA;
810 IGlo2ILoc(ix,iy,ixLA,iyLA);
811 fCurrentPad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kTRUE);
812 if ( !fCurrentPad.IsValid() )
813 {
814 AliError(Form("Setting current pad to invalid ! (ix,iy)=(%4d,%4d)",ix,iy));
815 }
816}
817
818//_____________________________________________________________________________
819void
13985652 820AliMUONTriggerSegmentationV2::SetPadSize(Float_t,Float_t)
9ff9fab7 821{
5398f946 822/// Not implemented
bdb9f2a3 823
9ff9fab7 824 AliFatal("Not Implemented");
825}
826
827//_____________________________________________________________________________
828Int_t
829AliMUONTriggerSegmentationV2::SigGenCond(Float_t,Float_t,Float_t)
830{
5398f946 831/// Not implemented
bdb9f2a3 832
9ff9fab7 833 AliFatal("Not Implemented");
834 return 0;
835}
836
837//_____________________________________________________________________________
838void
839AliMUONTriggerSegmentationV2::SigGenInit(Float_t,Float_t,Float_t)
840{
5398f946 841/// Not implemented
bdb9f2a3 842
9ff9fab7 843 AliFatal("Not Implemented");
844}
845
9ff9fab7 846
847
848
849