]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerSegmentation.cxx
Updated list of MUON libraries
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerSegmentation.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 // -------------------------------------
19 // Class AliMUONTriggerSegmentation
20 // -------------------------------------
21 // Segmentation for MUON trigger stations using 
22 // the mapping package
23
24 #include "AliMUONTriggerSegmentation.h"
25
26 #include "AliMpPCB.h"
27 #include "AliMpTrigger.h"
28 #include "AliMpTriggerSegmentation.h"
29 #include "AliMpSlat.h"
30
31 #include "AliLog.h"
32
33 #include "Riostream.h"
34 #include "TClass.h"
35 #include "TString.h"
36
37 /// \cond CLASSIMP
38 ClassImp(AliMUONTriggerSegmentation)
39 /// \endcond
40
41 namespace
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 //_____________________________________________________________________________
61 AliMUONTriggerSegmentation::AliMUONTriggerSegmentation() 
62 : AliMUONVGeometryDESegmentation(),
63   fDetElemId(-1),
64   fPlaneType(AliMp::kBendingPlane),
65   fSlat(0),
66   fSlatSegmentation(0),
67   fCurrentPad(),
68   fXhit(FMAX),
69   fYhit(FMAX),
70   fLineNumber(-1)
71 {
72 /// Default ctor (empty).
73
74   AliDebug(1,Form("this=%p default (empty) ctor",this));
75 }
76
77 //_____________________________________________________________________________
78 AliMUONTriggerSegmentation::AliMUONTriggerSegmentation(
79                                    AliMpVSegmentation* segmentation,
80                                    Int_t detElemId, AliMp::PlaneType bendingOrNonBending)
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)
90 {
91 /// Normal ctor.
92
93   fSlatSegmentation = dynamic_cast<AliMpTriggerSegmentation*>(segmentation);
94   if (fSlatSegmentation)
95     fSlat = fSlatSegmentation->Slat();
96   else 
97     AliFatal("Wrong mapping segmentation type");
98                 
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();
106                 
107   AliDebug(1,Form("this=%p detElemId=%3d %s fSlatSegmentation=%p",this,detElemId,
108                                                                         ( (bendingOrNonBending==AliMp::kBendingPlane)?"Bending":"NonBending" ),
109                                                                         fSlatSegmentation));
110 }
111
112 //_____________________________________________________________________________
113 AliMUONTriggerSegmentation::~AliMUONTriggerSegmentation() 
114
115 /// Destructor
116
117   AliDebug(1,Form("this=%p",this));                     
118 }
119
120 //_____________________________________________________________________________
121 TF1*
122 AliMUONTriggerSegmentation::CorrFunc(Int_t) const
123 {
124 /// Not implemented
125
126   AliFatal("Not implemented");
127   return 0x0;
128 }
129
130 //_____________________________________________________________________________
131 Float_t
132 AliMUONTriggerSegmentation::Distance2AndOffset(Int_t, Int_t, 
133                                                  Float_t, Float_t, Int_t*)
134 {
135 /// Not implemented
136
137   AliFatal("Not implemented");
138   return 0;
139 }
140
141 //_____________________________________________________________________________
142 void
143 AliMUONTriggerSegmentation::Draw(Option_t*)
144 {
145 /// Not implemented
146
147   AliFatal("Not Implemented");
148 }
149
150 //_____________________________________________________________________________
151 Float_t
152 AliMUONTriggerSegmentation::Dpx() const
153 {
154 /// Not implemented
155
156   AliFatal("Not Implemented");
157   return 0.0;
158 }
159
160 //_____________________________________________________________________________
161 Float_t
162 AliMUONTriggerSegmentation::Dpy() const
163 {
164 /// Not implemented
165
166   AliFatal("Not Implemented");
167   return 0.0;
168 }
169
170 //_____________________________________________________________________________
171 Float_t
172 AliMUONTriggerSegmentation::Dpx(Int_t sectorCode) const
173 {
174 /// Get pad size in x
175
176  Int_t ixLA, iyLA;
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 //_____________________________________________________________________________
184 Float_t
185 AliMUONTriggerSegmentation::Dpy(Int_t sectorCode) const
186 {
187 /// Get pad size in y
188
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 //_____________________________________________________________________________
197 void
198 AliMUONTriggerSegmentation::FirstPad(Float_t /*xhit*/, Float_t /*yhit*/, Float_t /*zhit*/,
199                                        Float_t /*dx*/, Float_t /*dy*/)
200 {
201 /// Not implemented
202
203   AliFatal("Not implemented");
204 }
205
206 //_____________________________________________________________________________
207 Float_t
208 AliMUONTriggerSegmentation::GetAnod(Float_t) const
209 {
210 /// Not implemented
211
212   AliFatal("Not implemented");
213   return 0.0;
214 }
215
216 //_____________________________________________________________________________
217 AliMUONGeometryDirection
218 AliMUONTriggerSegmentation::GetDirection()
219 {
220 /// Not implemented
221
222   //AliWarning("Not Implemented");
223   return kDirUndefined;
224 }
225
226 //______________________________________________________________________________
227 const AliMpVSegmentation*  
228 AliMUONTriggerSegmentation::GetMpSegmentation() const
229 {
230 /// Returns the mapping segmentation
231 /// (provides access to electronics info)
232
233   return fSlatSegmentation;
234 }  
235
236 //_____________________________________________________________________________
237 void 
238 AliMUONTriggerSegmentation::GetNParallelAndOffset(Int_t,Int_t,Int_t*,Int_t*)
239 {
240 /// Not implemented
241
242   AliFatal("Not Implemented");
243 }
244
245 //_____________________________________________________________________________
246 void
247 AliMUONTriggerSegmentation::GetPadC(Int_t ix, Int_t iy, 
248                                       Float_t& x, Float_t& y, Float_t& z)
249 {
250 /// Transform from pad to real coordinates
251
252   z = 0;
253   GetPadC(ix,iy,x,y);
254 }
255
256 //_____________________________________________________________________________
257 void
258 AliMUONTriggerSegmentation::GetPadC(Int_t ixGlo, Int_t iyGlo, 
259                                       Float_t& x, Float_t& y)
260 {
261 /// Transform from pad to real coordinates
262
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 //_____________________________________________________________________________
271 void
272 AliMUONTriggerSegmentation::GetPadI(Float_t x, Float_t y, Float_t,
273                                       Int_t& ix, Int_t& iy)
274 {
275 ///  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
276
277   GetPadI(x,y,ix,iy);
278 }
279
280 //_____________________________________________________________________________
281 void
282 AliMUONTriggerSegmentation::GetPadI(Float_t x, Float_t y,
283                                       Int_t& ixGlo, Int_t& iyGlo)
284 {
285 ///  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
286
287   AliDebug(2,Form("%s x=%e y=%e ixGlo,iyGlo=%d,%d\n",
288                   fSlatSegmentation->GetName(),
289                   x,y,ixGlo,iyGlo));
290   
291   AliMpPad pad = 
292     fSlatSegmentation->PadByPosition(TVector2(x,y), kTRUE);
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 //_____________________________________________________________________________
308 void
309 AliMUONTriggerSegmentation::GetPadLoc2Glo(Int_t ix, Int_t iy,
310                                             Int_t& ixGlo, Int_t& iyGlo) const
311 {
312 /// Converts from local (in PC convention) to (ix,iy) to global (ix,iy)
313
314   ixGlo=iyGlo=-1; // starts with invalid values
315   
316   if ( fPlaneType == AliMp::kBendingPlane )
317   {
318     ixGlo = 10*LineNumber() + ix;
319     iyGlo = iy - fgIntOffset;
320   }
321   else if ( fPlaneType == AliMp::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 //_____________________________________________________________________________
337 void
338 AliMUONTriggerSegmentation::GetPadGlo2Loc(Int_t ixGlo, Int_t iyGlo,
339                                             Int_t& ix, Int_t& iy) const
340 {
341 /// Converts from global (ix,iy) to local (ix,iy) (in PC convention)
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 == AliMp::kBendingPlane )
350   {
351     ix = column + fgIntOffset;
352     iy = iyGlo + fgIntOffset;
353   }
354   else if ( fPlaneType == AliMp::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 //_____________________________________________________________________________
369 void 
370 AliMUONTriggerSegmentation::GiveTestPoints(Int_t& /*n*/, 
371                                              Float_t* /*x*/, Float_t*/*y*/) const
372 {
373 /// Not implemented
374
375   AliFatal("Not Implemented");
376 }
377
378 //_____________________________________________________________________________
379 Bool_t
380 AliMUONTriggerSegmentation::HasPad(Float_t x, Float_t y, Float_t /*z*/)
381 {
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.
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 = 
399   fSlatSegmentation->PadByPosition(TVector2(x,y),kFALSE);
400   return pad.IsValid();
401 }
402
403 //_____________________________________________________________________________
404 Bool_t
405 AliMUONTriggerSegmentation::HasPad(Int_t ixGlo, Int_t iyGlo)
406 {
407 /// Returns true if a pad with given indices exists
408
409   Int_t ixLA, iyLA;
410   IGlo2ILoc(ixGlo,iyGlo,ixLA,iyLA);
411   return fSlatSegmentation->HasPad(AliMpIntPair(ixLA,iyLA));
412 }
413
414 //_____________________________________________________________________________
415 void
416 AliMUONTriggerSegmentation::IGlo2ILoc(Int_t ixGlo, Int_t iyGlo,
417                                         Int_t& ixLA, Int_t& iyLA) const
418 {
419 /// \todo FIXME: add comment
420
421   Int_t ixPC, iyPC;
422   GetPadGlo2Loc(ixGlo,iyGlo,ixPC,iyPC);
423   PC2LA(ixPC,iyPC,ixLA,iyLA);
424 }
425
426 //_____________________________________________________________________________
427 void
428 AliMUONTriggerSegmentation::ILoc2IGlo(Int_t ixLA, Int_t iyLA,
429                                         Int_t& ixGlo, Int_t& iyGlo) const
430 {
431 /// \todo FIXME: add comment
432
433   Int_t ixPC, iyPC;
434   LA2PC(ixLA,iyLA,ixPC,iyPC);
435   GetPadLoc2Glo(ixPC,iyPC,ixGlo,iyGlo);
436 }
437
438 //_____________________________________________________________________________
439 Int_t
440 AliMUONTriggerSegmentation::ISector()
441 {
442 /// \todo FIXME: remove the usage of ISector from all the code.
443
444   return -10;
445 }
446
447 //_____________________________________________________________________________
448 void AliMUONTriggerSegmentation::IntegrationLimits(Float_t& x1, 
449                                                      Float_t& x2,
450                                                      Float_t& x3, 
451                                                      Float_t& x4) 
452 {
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.
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==AliMp::kBendingPlane) ? fYhit : fXhit;
478     x2 = (fPlaneType==AliMp::kBendingPlane) ? ystrip : xstrip;
479     x3 = (fPlaneType==AliMp::kBendingPlane) ? 
480       fCurrentPad.Position().Y() : fCurrentPad.Position().X();
481     Double_t xmin = 0.0;
482     Double_t xmax = 0.0;
483     if (fPlaneType==AliMp::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 //_____________________________________________________________________________
504 Int_t 
505 AliMUONTriggerSegmentation::Ix()
506 {
507 /// Current pad cursor during disintegration
508 /// x, y-coordinate
509
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 //_____________________________________________________________________________
521 Int_t 
522 AliMUONTriggerSegmentation::Iy()
523 {
524 /// Current pad cursor during disintegration
525 /// x, y-coordinate
526
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 //_____________________________________________________________________________
539 void
540 AliMUONTriggerSegmentation::LA2PC(Int_t ixLA, Int_t iyLA,
541                                     Int_t& ixPC, Int_t& iyPC) const
542 {
543 /// From LA to PC conventions for integers indices.
544
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 == AliMp::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 //_____________________________________________________________________________
569 Int_t
570 AliMUONTriggerSegmentation::LineNumber() const
571 {
572 /// \todo FIXME: add comment
573
574  return 10-fLineNumber;
575 }
576
577 //_____________________________________________________________________________
578 Int_t
579 AliMUONTriggerSegmentation::ModuleColNum(Int_t ixGlo) const
580 {
581 /// returns column number (from 0 to 6) in which the (global) module 
582 /// ix is sitting (could return 7 if ix=isec)
583
584   return TMath::Abs(ixGlo)-Int_t(TMath::Abs(ixGlo)/10)*10-1;
585 }
586
587 //_____________________________________________________________________________
588 Int_t
589 AliMUONTriggerSegmentation::MorePads()
590 {
591 /// Not implemented
592
593   AliFatal("Not implemented");
594   return 0;
595 }
596
597 //_____________________________________________________________________________
598 void AliMUONTriggerSegmentation::Neighbours(Int_t /*iX*/, Int_t /*iY*/, 
599                                               Int_t* /*Nlist*/, 
600                                               Int_t /*Xlist*/[10], 
601                                               Int_t /*Ylist*/[10]) 
602 {
603 /// Not implemented
604
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 //_____________________________________________________________________________
628 void
629 AliMUONTriggerSegmentation::NextPad()
630 {
631 /// Not implemented
632
633   AliFatal("Not implemented");
634 }
635
636 //_____________________________________________________________________________
637 Int_t
638 AliMUONTriggerSegmentation::Npx() const
639 {
640 /// Maximum number of Pads in x
641 /// hard coded for the time being
642
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 //_____________________________________________________________________________
649 Int_t
650 AliMUONTriggerSegmentation::Npy() const
651 {
652 /// Maximum number of Pads in y
653 /// hard coded for the time being
654
655   return 64;
656 //  return fSlatSegmentation->MaxPadIndexY()+1;
657 }
658
659 //_____________________________________________________________________________
660 void
661 AliMUONTriggerSegmentation::PC2LA(Int_t ixPC, Int_t iyPC,
662                                     Int_t& ixLA, Int_t& iyLA) const
663 {
664 /// From PC to LA conventions for integers indices.
665
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 == AliMp::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 //_____________________________________________________________________________
689 void
690 AliMUONTriggerSegmentation::Print(Option_t* opt) const
691 {
692 /// Printing
693
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
708 //_____________________________________________________________________________
709 Int_t
710 AliMUONTriggerSegmentation::Sector(Int_t ix, Int_t iy)
711 {
712 /// Calculate sector from pad coordinates
713
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 //_____________________________________________________________________________
736 Int_t
737 AliMUONTriggerSegmentation::Sector(Float_t, Float_t)
738 {
739 /// Not implemented
740
741   AliFatal("Not implemented");
742   return 0;
743 }
744
745 //_____________________________________________________________________________
746 void
747 AliMUONTriggerSegmentation::SetCorrFunc(Int_t,TF1*)
748 {
749 /// Not implemented
750
751   AliFatal("Not Implemented");
752 }
753
754 //_____________________________________________________________________________
755 void
756 AliMUONTriggerSegmentation::SetDAnod(Float_t)
757 {
758 /// Not implemented
759
760   AliFatal("Not Implemented");
761 }
762
763 //_____________________________________________________________________________
764 void
765 AliMUONTriggerSegmentation::SetHit(Float_t x, Float_t y)
766 {
767 /// Set hit position
768 /// Sets virtual hit position, needed for evaluating pad response 
769 /// outside the tracking program 
770
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 //_____________________________________________________________________________
791 void
792 AliMUONTriggerSegmentation::SetHit(Float_t x, Float_t y, Float_t)
793 {
794 /// Set hit position
795 /// Sets virtual hit position, needed for evaluating pad response 
796 /// outside the tracking program 
797
798   SetHit(x,y);
799 }
800
801 //_____________________________________________________________________________
802 void
803 AliMUONTriggerSegmentation::SetPad(Int_t ix, Int_t iy)
804 {
805 /// Set pad position.
806 /// Sets virtual pad coordinates, needed for evaluating pad response 
807 /// outside the tracking program.
808
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 //_____________________________________________________________________________
819 void
820 AliMUONTriggerSegmentation::SetPadSize(Float_t,Float_t)
821 {
822 /// Not implemented
823
824   AliFatal("Not Implemented");
825 }
826
827 //_____________________________________________________________________________
828 Int_t 
829 AliMUONTriggerSegmentation::SigGenCond(Float_t,Float_t,Float_t)
830 {
831 /// Not implemented
832
833   AliFatal("Not Implemented");
834   return 0;
835 }
836
837 //_____________________________________________________________________________
838 void 
839 AliMUONTriggerSegmentation::SigGenInit(Float_t,Float_t,Float_t)
840 {
841 /// Not implemented
842
843   AliFatal("Not Implemented");
844 }
845
846
847
848
849