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