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